Don't compute LastPrivate data for Def::Err.

This commit is contained in:
Jeffrey Seyfried 2016-02-16 21:59:46 +00:00
parent 97842f54c9
commit 1b5d2f21d6
2 changed files with 7 additions and 1 deletions

View File

@ -1047,6 +1047,7 @@ impl<'a> NameBinding<'a> {
fn def_and_lp(&self) -> (Def, LastPrivate) {
let def = self.def().unwrap();
if let Def::Err = def { return (def, LastMod(AllPublic)) }
(def, LastMod(if self.is_public() { AllPublic } else { DependsOn(def.def_id()) }))
}

View File

@ -15,5 +15,10 @@ use zed::baz;
mod zed {
pub fn bar() { println!("bar"); }
use foo; //~ ERROR unresolved import
}
fn main() {
zed::foo(); // Check that this does not panic. Ideally, it would be a privacy error.
bar();
}
fn main() { bar(); }