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: Make "empty import canaries" invisible from other crates #56117

Merged
merged 1 commit into from
Nov 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,10 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
None => continue,
};

if binding.is_import() || binding.is_macro_def() {
// Filter away "empty import canaries".
let is_non_canary_import =
binding.is_import() && binding.vis != ty::Visibility::Invisible;
if is_non_canary_import || binding.is_macro_def() {
let def = binding.def();
if def != Def::Err {
if let Some(def_id) = def.opt_def_id() {
Expand Down
5 changes: 5 additions & 0 deletions src/test/ui/imports/auxiliary/issue-55811.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mod m {}

// These two imports should not conflict when this crate is loaded from some other crate.
use m::{};
use m::{};
6 changes: 6 additions & 0 deletions src/test/ui/imports/issue-55811.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// compile-pass
// aux-build:issue-55811.rs

extern crate issue_55811;

fn main() {}