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

resolve: fix bug in duplicate checking for extern crates #30295

Merged
merged 1 commit into from
Jan 11, 2016

Conversation

jseyfried
Copy link
Contributor

Fix a bug allowing an item and an external crate to collide so long as the external crate is declared after the item. For example,

mod core { pub fn f() {} } // This would be an error if it followed the `extern crate`
extern crate core; // This declaration is shadowed by the preceding module

fn main() { core::f(); }

This is a [breaking-change], but it looks unlikely to cause breakage in practice, and any breakage can be fixed by removing colliding extern crate declarations, which are shadowed and hence unused.

@rust-highfive
Copy link
Collaborator

r? @pnkfelix

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

@jseyfried
Copy link
Contributor Author

r? @nrc

@rust-highfive rust-highfive assigned nrc and unassigned pnkfelix Dec 11, 2015
@nrc
Copy link
Member

nrc commented Dec 11, 2015

r+

cc @rust-lang/compiler does this need a Crater run? I think not, but does anyone think we should?

@nagisa
Copy link
Member

nagisa commented Dec 29, 2015

@nrc ping?

@nrc
Copy link
Member

nrc commented Dec 29, 2015

@bors: r+

@bors
Copy link
Contributor

bors commented Dec 29, 2015

📌 Commit 0310a7a has been approved by nrc

@bors
Copy link
Contributor

bors commented Dec 30, 2015

⌛ Testing commit 0310a7a with merge d91bf3f...

@bors
Copy link
Contributor

bors commented Dec 30, 2015

💔 Test failed - auto-linux-64-nopt-t

@@ -209,6 +211,14 @@ fn resolve_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
return;
}
match resolution_error {
ResolutionError::NameConflictsWithExternCrate(name) => {
span_err!(resolver.session,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot be merged anymore because in master, the type of this match statement has changed. While it still merges cleanly, it will not compile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nagisa Thanks for the diagnosis

@jseyfried jseyfried force-pushed the fix_extern_crate_duplicate branch 3 times, most recently from 8ae7d1b to 0c64dda Compare January 6, 2016 02:06
@jseyfried jseyfried force-pushed the fix_extern_crate_duplicate branch from 0c64dda to 834fb17 Compare January 6, 2016 07:07
@jseyfried
Copy link
Contributor Author

@nrc rebased

@nrc
Copy link
Member

nrc commented Jan 7, 2016

@bors: r+

@bors
Copy link
Contributor

bors commented Jan 7, 2016

📌 Commit 834fb17 has been approved by nrc

@bors
Copy link
Contributor

bors commented Jan 7, 2016

⌛ Testing commit 834fb17 with merge 3917c98...

@bors
Copy link
Contributor

bors commented Jan 7, 2016

💔 Test failed - auto-linux-64-nopt-t

@brson
Copy link
Contributor

brson commented Jan 8, 2016

@bors retry

bors added a commit that referenced this pull request Jan 8, 2016
Fix a bug allowing an item and an external crate to collide so long as the external crate is declared after the item. For example,
```rust
mod core { pub fn f() {} } // This would be an error if it followed the `extern crate`
extern crate core; // This declaration is shadowed by the preceding module

fn main() { core::f(); }
```
This is a [breaking-change], but it looks unlikely to cause breakage in practice, and any breakage can be fixed by removing colliding `extern crate` declarations, which are shadowed and hence unused.
@bors
Copy link
Contributor

bors commented Jan 8, 2016

⌛ Testing commit 834fb17 with merge dfbb422...

@pnkfelix
Copy link
Member

pnkfelix commented Jan 9, 2016

@bors retry force

@pnkfelix
Copy link
Member

pnkfelix commented Jan 9, 2016

@bors r-

@pnkfelix
Copy link
Member

pnkfelix commented Jan 9, 2016

@bors r=nrc force

@bors
Copy link
Contributor

bors commented Jan 9, 2016

📌 Commit 834fb17 has been approved by nrc

nagisa added a commit to nagisa/rust that referenced this pull request Jan 9, 2016
…e, r=nrc

Fix a bug allowing an item and an external crate to collide so long as the external crate is declared after the item. For example,
```rust
mod core { pub fn f() {} } // This would be an error if it followed the `extern crate`
extern crate core; // This declaration is shadowed by the preceding module

fn main() { core::f(); }
```
This is a [breaking-change], but it looks unlikely to cause breakage in practice, and any breakage can be fixed by removing colliding `extern crate` declarations, which are shadowed and hence unused.
@bors
Copy link
Contributor

bors commented Jan 11, 2016

⌛ Testing commit 834fb17 with merge c9b4826...

@bors
Copy link
Contributor

bors commented Jan 11, 2016

💔 Test failed - auto-win-gnu-64-nopt-t

@alexcrichton
Copy link
Member

@bors: retry

On Mon, Jan 11, 2016 at 3:09 PM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-win-gnu-64-nopt-t
http://buildbot.rust-lang.org/builders/auto-win-gnu-64-nopt-t/builds/2642


Reply to this email directly or view it on GitHub
#30295 (comment).

@bors
Copy link
Contributor

bors commented Jan 11, 2016

⌛ Testing commit 834fb17 with merge 69e1f57...

bors added a commit that referenced this pull request Jan 11, 2016
Fix a bug allowing an item and an external crate to collide so long as the external crate is declared after the item. For example,
```rust
mod core { pub fn f() {} } // This would be an error if it followed the `extern crate`
extern crate core; // This declaration is shadowed by the preceding module

fn main() { core::f(); }
```
This is a [breaking-change], but it looks unlikely to cause breakage in practice, and any breakage can be fixed by removing colliding `extern crate` declarations, which are shadowed and hence unused.
@bors bors merged commit 834fb17 into rust-lang:master Jan 11, 2016
@jseyfried jseyfried deleted the fix_extern_crate_duplicate branch February 11, 2017 01:29
@jseyfried jseyfried changed the title rustc_resolve: Fix bug in duplicate checking for extern crates. resolve: fix bug in duplicate checking for extern crates Feb 14, 2017
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.

8 participants