diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index bf570fb0f80b..70ade7a5600b 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -720,7 +720,9 @@ impl<'a, 'b> ImportResolver<'a, 'b> { note: Vec::new(), suggestion: None, }; - errors.push((path, err)); + if path.contains("::") { + errors.push((path, err)) + } } } diff --git a/src/test/ui/rust-2018/unresolved-asterisk-imports.rs b/src/test/ui/rust-2018/unresolved-asterisk-imports.rs new file mode 100644 index 000000000000..ad1064570c77 --- /dev/null +++ b/src/test/ui/rust-2018/unresolved-asterisk-imports.rs @@ -0,0 +1,6 @@ +// edition:2018 + +use not_existing_crate::*; //~ ERROR unresolved import `not_existing_crate +use std as foo; + +fn main() {} diff --git a/src/test/ui/rust-2018/unresolved-asterisk-imports.stderr b/src/test/ui/rust-2018/unresolved-asterisk-imports.stderr new file mode 100644 index 000000000000..09e9edc638d1 --- /dev/null +++ b/src/test/ui/rust-2018/unresolved-asterisk-imports.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `not_existing_crate` + --> $DIR/unresolved-asterisk-imports.rs:3:5 + | +LL | use not_existing_crate::*; + | ^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `not_existing_crate` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/unresolved/unresolved-asterisk-imports.rs b/src/test/ui/unresolved/unresolved-asterisk-imports.rs new file mode 100644 index 000000000000..2d853a66c8d0 --- /dev/null +++ b/src/test/ui/unresolved/unresolved-asterisk-imports.rs @@ -0,0 +1,4 @@ +use not_existing_crate::*; //~ ERROR unresolved import `not_existing_crate +use std as foo; + +fn main() {} diff --git a/src/test/ui/unresolved/unresolved-asterisk-imports.stderr b/src/test/ui/unresolved/unresolved-asterisk-imports.stderr new file mode 100644 index 000000000000..a789179db65b --- /dev/null +++ b/src/test/ui/unresolved/unresolved-asterisk-imports.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `not_existing_crate` + --> $DIR/unresolved-asterisk-imports.rs:1:5 + | +LL | use not_existing_crate::*; + | ^^^^^^^^^^^^^^^^^^ maybe a missing crate `not_existing_crate`? + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`.