Skip to content

Commit 46bd5d3

Browse files
committed
Avoid emitting a unhelpful cascading resolution error.
1 parent ffcbd2d commit 46bd5d3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/librustc_resolve/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,8 @@ impl<'a> Resolver<'a> {
18101810
if let Def::Trait(_) = path_res.base_def {
18111811
debug!("(resolving trait) found trait def: {:?}", path_res);
18121812
Ok(path_res)
1813+
} else if path_res.base_def == Def::Err {
1814+
Err(true)
18131815
} else {
18141816
let mut err =
18151817
resolve_struct_error(self,

src/test/compile-fail/issue-5035.rs

+4
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ type K = I;
1313
//~^ NOTE: aliases cannot be used for traits
1414
impl K for isize {} //~ ERROR: `K` is not a trait
1515
//~| is not a trait
16+
17+
use ImportError; //~ ERROR unresolved
18+
impl ImportError for () {} // check that this is not an additional error (c.f. #35142)
19+
1620
fn main() {}

0 commit comments

Comments
 (0)