Skip to content

Commit 1e4cf74

Browse files
committed
resolve: Make "empty import canaries" invisible from other crates
1 parent f1e2fa8 commit 1e4cf74

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Diff for: src/librustc_resolve/resolve_imports.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,10 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
11641164
None => continue,
11651165
};
11661166

1167-
if binding.is_import() || binding.is_macro_def() {
1167+
// Filter away "empty import canaries".
1168+
let is_non_canary_import =
1169+
binding.is_import() && binding.vis != ty::Visibility::Invisible;
1170+
if is_non_canary_import || binding.is_macro_def() {
11681171
let def = binding.def();
11691172
if def != Def::Err {
11701173
if let Some(def_id) = def.opt_def_id() {

Diff for: src/test/ui/imports/auxiliary/issue-55811.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mod m {}
2+
3+
// These two imports should not conflict when this crate is loaded from some other crate.
4+
use m::{};
5+
use m::{};

Diff for: src/test/ui/imports/issue-55811.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// compile-pass
2+
// aux-build:issue-55811.rs
3+
4+
extern crate issue_55811;
5+
6+
fn main() {}

0 commit comments

Comments
 (0)