Open
Description
Code
use _::a;
use _::*;
fn main() {
use _::a;
use _::*;
}
Current output
⣿
Errors
Exited with status 101
Standard Error
Compiling playground v0.0.1 (/playground)
error: expected identifier, found reserved identifier `_`
--> src/main.rs:1:5
|
1 | use _::a;
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> src/main.rs:2:5
|
2 | use _::*;
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> src/main.rs:5:9
|
5 | use _::a;
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> src/main.rs:6:9
|
6 | use _::*;
| ^ expected identifier, found reserved identifier
error[E0432]: unresolved import `_`
--> src/main.rs:2:5
|
2 | use _::*;
| ^ use of unresolved module or unlinked crate `_`
|
= help: if you wanted to use a crate named `_`, use `cargo add _` to add it to your `Cargo.toml`
error[E0432]: unresolved import `_`
--> src/main.rs:1:5
|
1 | use _::a;
| ^ use of unresolved module or unlinked crate `_`
|
= help: if you wanted to use a crate named `_`, use `cargo add _` to add it to your `Cargo.toml`
error[E0432]: unresolved import `_`
--> src/main.rs:5:9
|
5 | use _::a;
| ^ use of unresolved module or unlinked crate `_`
|
= help: if you wanted to use a crate named `_`, use `cargo add _` to add it to your `Cargo.toml`
error[E0432]: unresolved import `_`
--> src/main.rs:6:9
|
6 | use _::*;
| ^ use of unresolved module or unlinked crate `_`
|
= help: if you wanted to use a crate named `_`, use `cargo add _` to add it to your `Cargo.toml`
For more information about this error, try `rustc --explain E0432`.
error: could not compile `playground` (bin "playground") due to 8 previous errors
Standard Output
Desired output
⣿
Errors
Exited with status 101
Standard Error
Compiling playground v0.0.1 (/playground)
error: expected identifier, found reserved identifier `_`
--> src/main.rs:1:5
|
1 | use _::a;
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> src/main.rs:2:5
|
2 | use _::*;
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> src/main.rs:5:9
|
5 | use _::a;
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> src/main.rs:6:9
|
6 | use _::*;
| ^ expected identifier, found reserved identifier
For more information about this error, try `rustc --explain E0432`.
error: could not compile `playground` (bin "playground") due to 8 previous errors
Standard Output
Rationale and extra context
crates cannot be named _
in Rust. Note this only happens with edition 2018 and beyond.
This was discovered by the ferrocene team while running the test suite with edition 2018, specifically with the test tests/ui/underscore-imports/issue-110164.rs
output changing and showing this regression.
Other cases
Rust Version
rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1
Anything else?
No response