]> git.lizzy.rs Git - rust.git/commitdiff
Avoid emitting a unhelpful cascading resolution error.
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>
Sun, 31 Jul 2016 20:11:38 +0000 (20:11 +0000)
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>
Sun, 31 Jul 2016 20:17:08 +0000 (20:17 +0000)
src/librustc_resolve/lib.rs
src/test/compile-fail/issue-5035.rs

index 8c8cf1da467388cc98c3bec6d88c8cfda283e077..23281d25c8d527ea3967864fbacc772053c746b5 100644 (file)
@@ -1810,6 +1810,8 @@ fn resolve_trait_reference(&mut self,
             if let Def::Trait(_) = path_res.base_def {
                 debug!("(resolving trait) found trait def: {:?}", path_res);
                 Ok(path_res)
+            } else if path_res.base_def == Def::Err {
+                Err(true)
             } else {
                 let mut err =
                     resolve_struct_error(self,
index a186a399a112c1f614ac16616b5c9d0a04e8ecf7..61080ef60964539a1d535db9f81a02e5efad4dd9 100644 (file)
@@ -13,4 +13,8 @@ trait I {}
 //~^ NOTE: aliases cannot be used for traits
 impl K for isize {} //~ ERROR: `K` is not a trait
 //~| is not a trait
+
+use ImportError; //~ ERROR unresolved
+impl ImportError for () {} // check that this is not an additional error (c.f. #35142)
+
 fn main() {}