Skip to content

Commit 08b9097

Browse files
committed
Improve dummy bindings for unresolved imports
1 parent 1b5d2f2 commit 08b9097

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/librustc_resolve/resolve_imports.rs

+2
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
218218
kind: NameBindingKind::Def(Def::Err),
219219
span: None,
220220
});
221+
let dummy_binding =
222+
self.resolver.new_name_binding(e.import_directive.import(dummy_binding));
221223

222224
let _ = e.source_module.try_define_child(target, ValueNS, dummy_binding);
223225
let _ = e.source_module.try_define_child(target, TypeNS, dummy_binding);

src/test/compile-fail/import.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ mod zed {
1919
}
2020

2121
fn main() {
22-
zed::foo(); // Check that this does not panic. Ideally, it would be a privacy error.
22+
zed::foo(); //~ ERROR unresolved name
2323
bar();
2424
}

0 commit comments

Comments
 (0)