Skip to content

Commit

Permalink
Rollup merge of rust-lang#94595 - TaKO8Ki:fix-invalid-unresolved-impo…
Browse files Browse the repository at this point in the history
…rts-errors-for-asterisk-wildcard-syntax, r=estebank

Fix invalid `unresolved imports` errors for a single-segment import

closes rust-lang#90248
  • Loading branch information
Dylan-DPC authored Mar 4, 2022
2 parents 18a07a7 + 068a233 commit f27466d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/rustc_resolve/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/test/ui/rust-2018/unresolved-asterisk-imports.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// edition:2018

use not_existing_crate::*; //~ ERROR unresolved import `not_existing_crate
use std as foo;

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/rust-2018/unresolved-asterisk-imports.stderr
Original file line number Diff line number Diff line change
@@ -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`.
4 changes: 4 additions & 0 deletions src/test/ui/unresolved/unresolved-asterisk-imports.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use not_existing_crate::*; //~ ERROR unresolved import `not_existing_crate
use std as foo;

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/unresolved/unresolved-asterisk-imports.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit f27466d

Please sign in to comment.