rust/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr
Esteban Küber b61570ac11 Structured suggestion for extern crate foo when foo isn't resolved in import
When encountering a name in an import that could have come from a crate that wasn't imported, use a structured suggestion to suggest `extern crate foo;` pointing at the right place in the crate.

When encountering `_` in an import, do not suggest `extern crate _;`.

```
error[E0432]: unresolved import `spam`
  --> $DIR/import-from-missing-star-3.rs:2:9
   |
LL |     use spam::*;
   |         ^^^^ maybe a missing crate `spam`?
   |
help: consider importing the `spam` crate
   |
LL + extern crate spam;
   |
```
2024-07-29 23:49:51 +00:00

26 lines
651 B
Plaintext

error: expected identifier, found keyword `extern`
--> $DIR/keyword-extern-as-identifier-use.rs:1:5
|
LL | use extern::foo;
| ^^^^^^ expected identifier, found keyword
|
help: escape `extern` to use it as an identifier
|
LL | use r#extern::foo;
| ++
error[E0432]: unresolved import `r#extern`
--> $DIR/keyword-extern-as-identifier-use.rs:1:5
|
LL | use extern::foo;
| ^^^^^^ you might be missing crate `r#extern`
|
help: consider importing the `r#extern` crate
|
LL + extern crate r#extern;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0432`.