diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-07-31 20:11:38 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-07-31 20:17:08 +0000 |
| commit | 46bd5d3fa01a86925f7e7776a5567c536e6f2408 (patch) | |
| tree | 897d0ed197fd591a582de3151a21779b52e55355 | |
| parent | ffcbd2deb5ca953512a20785224120437cb310f0 (diff) | |
| download | rust-46bd5d3fa01a86925f7e7776a5567c536e6f2408.tar.gz rust-46bd5d3fa01a86925f7e7776a5567c536e6f2408.zip | |
Avoid emitting a unhelpful cascading resolution error.
| -rw-r--r-- | src/librustc_resolve/lib.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-5035.rs | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 8c8cf1da467..23281d25c8d 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1810,6 +1810,8 @@ impl<'a> Resolver<'a> { 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, diff --git a/src/test/compile-fail/issue-5035.rs b/src/test/compile-fail/issue-5035.rs index a186a399a11..61080ef6096 100644 --- a/src/test/compile-fail/issue-5035.rs +++ b/src/test/compile-fail/issue-5035.rs @@ -13,4 +13,8 @@ type K = 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() {} |
