Skip to content

Commit

Permalink
Improve dummy bindings for unresolved imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Feb 19, 2016
1 parent 1b5d2f2 commit 08b9097
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
kind: NameBindingKind::Def(Def::Err),
span: None,
});
let dummy_binding =
self.resolver.new_name_binding(e.import_directive.import(dummy_binding));

let _ = e.source_module.try_define_child(target, ValueNS, dummy_binding);
let _ = e.source_module.try_define_child(target, TypeNS, dummy_binding);
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ mod zed {
}

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

0 comments on commit 08b9097

Please sign in to comment.