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

rustc_resolve: Do not allow mods to shadow types #21269

Merged
merged 3 commits into from
Jan 19, 2015

Conversation

alexcrichton
Copy link
Member

This commit modifies resolve to prevent conflicts with typedef names in the same
method that conflits are prevented with enum names. This is a breaking change
due to the differing semantics in resolve, and any errors generated on behalf of
this change require that a conflicting typedef, module, or structure to be
renamed so they do not conflict.

[breaking-change]
Closes #6936

@rust-highfive
Copy link
Collaborator

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

Helps reduce some rightward drift
This commit modifies resolve to prevent conflicts with typedef names in the same
method that conflits are prevented with enum names. This is a breaking change
due to the differing semantics in resolve, and any errors generated on behalf of
this change require that a conflicting typedef, module, or structure to be
renamed so they do not conflict.

[breaking-change]
Closes rust-lang#6936
@pnkfelix
Copy link
Member

The switches e.g. from NodeSet::new() to NodeSet() did make me wonder if there's something wrong overall with either this "new" rule or our conventions (which say one is supposed to eschew fn TypeName() preferring impl TypeName { fn new() -> TypeName { ... } }, which is not compatible with type TypeName = ... definitions).

But overall I think the rule is the right direction, and I would be happy to revise our conventions to say that fn TypeName() is fine. (Kill the naming convention lints!)

@pnkfelix
Copy link
Member

@bors: r+ 3121c04

@bors
Copy link
Contributor

bors commented Jan 19, 2015

⌛ Testing commit 3121c04 with merge cda3490...

bors added a commit that referenced this pull request Jan 19, 2015
This commit modifies resolve to prevent conflicts with typedef names in the same
method that conflits are prevented with enum names. This is a breaking change
due to the differing semantics in resolve, and any errors generated on behalf of
this change require that a conflicting typedef, module, or structure to be
renamed so they do not conflict.

[breaking-change]
Closes #6936
@bors bors merged commit 3121c04 into rust-lang:master Jan 19, 2015
@alexcrichton alexcrichton deleted the issue-6936 branch January 19, 2015 20:47
renato-zannon added a commit to renato-zannon/num that referenced this pull request Jan 20, 2015
Without this rename, the library fails to compile on Rust master, since rust-lang/rust#21269 has landed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type aliases and mods of the same name in the same namespace should be forbidden
4 participants