Skip to content

Commit 1b5d2f2

Browse files
committed
Don't compute LastPrivate data for Def::Err.
1 parent 97842f5 commit 1b5d2f2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/librustc_resolve/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,7 @@ impl<'a> NameBinding<'a> {
10471047

10481048
fn def_and_lp(&self) -> (Def, LastPrivate) {
10491049
let def = self.def().unwrap();
1050+
if let Def::Err = def { return (def, LastMod(AllPublic)) }
10501051
(def, LastMod(if self.is_public() { AllPublic } else { DependsOn(def.def_id()) }))
10511052
}
10521053

src/test/compile-fail/import.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@ use zed::baz;
1515

1616
mod zed {
1717
pub fn bar() { println!("bar"); }
18+
use foo; //~ ERROR unresolved import
19+
}
20+
21+
fn main() {
22+
zed::foo(); // Check that this does not panic. Ideally, it would be a privacy error.
23+
bar();
1824
}
19-
fn main() { bar(); }

0 commit comments

Comments
 (0)