Skip to content

Commit 068a233

Browse files
committed
fix invalid unresolved imports errors the asterisk wildcard syntax causes
use a path variabale
1 parent 06460fe commit 068a233

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

compiler/rustc_resolve/src/imports.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,9 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
720720
note: Vec::new(),
721721
suggestion: None,
722722
};
723-
errors.push((path, err));
723+
if path.contains("::") {
724+
errors.push((path, err))
725+
}
724726
}
725727
}
726728

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// edition:2018
2+
3+
use not_existing_crate::*; //~ ERROR unresolved import `not_existing_crate
4+
use std as foo;
5+
6+
fn main() {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0432]: unresolved import `not_existing_crate`
2+
--> $DIR/unresolved-asterisk-imports.rs:3:5
3+
|
4+
LL | use not_existing_crate::*;
5+
| ^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `not_existing_crate`
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0432`.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
use not_existing_crate::*; //~ ERROR unresolved import `not_existing_crate
2+
use std as foo;
3+
4+
fn main() {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0432]: unresolved import `not_existing_crate`
2+
--> $DIR/unresolved-asterisk-imports.rs:1:5
3+
|
4+
LL | use not_existing_crate::*;
5+
| ^^^^^^^^^^^^^^^^^^ maybe a missing crate `not_existing_crate`?
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0432`.

0 commit comments

Comments
 (0)