Skip to content

rustc_resolve: Do not allow mods to shadow types#21269

Merged
bors merged 3 commits into
rust-lang:masterfrom
alexcrichton:issue-6936
Jan 19, 2015
Merged

rustc_resolve: Do not allow mods to shadow types#21269
bors merged 3 commits into
rust-lang:masterfrom
alexcrichton:issue-6936

Conversation

@alexcrichton

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

@bors: r+ 3121c04

@bors

bors commented Jan 19, 2015

Copy link
Copy Markdown
Collaborator

⌛ 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 commented Jan 19, 2015

Copy link
Copy Markdown
Collaborator

@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