Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We should forbid type parameters from shadowing other types #707

Closed
rust-highfive opened this issue Jan 22, 2015 · 1 comment
Closed

We should forbid type parameters from shadowing other types #707

rust-highfive opened this issue Jan 22, 2015 · 1 comment
Labels
breaking-change The RFC proposes a breaking change. T-lang Relevant to the language team, which will review and decide on the RFC.

Comments

@rust-highfive
Copy link

Issue by erickt
Saturday Jan 17, 2015 at 16:01 GMT

For earlier discussion, see rust-lang/rust#21301

This issue was labelled with: A-associated-items in the Rust repository


This is a weird case that we should probably not allow:

mod T {
    pub type Type = i32;
}

trait Trait {
    type Type;
}

impl Trait for i32 {
    type Type = i8;
}

struct Baz<T: Trait> {
    a: T::Type,
}

fn main() {
    let x: Baz<i32> = Baz { a: 0i8 };
}

The rule appears to be that the <T: Trait> has precedence over the module, it would be easiest if we just errored out in this circumstance.

@petrochenkov petrochenkov added breaking-change The RFC proposes a breaking change. T-lang Relevant to the language team, which will review and decide on the RFC. labels Jan 20, 2018
@Centril
Copy link
Contributor

Centril commented Oct 7, 2018

Closing as non-actionable; I'm not inclined to use the edition mechanism for this.

@Centril Centril closed this as completed Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change The RFC proposes a breaking change. T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

4 participants