Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic error on crate root import #104276

Closed
SparkyPotato opened this issue Nov 11, 2022 · 1 comment · Fixed by #104315
Closed

Cryptic error on crate root import #104276

SparkyPotato opened this issue Nov 11, 2022 · 1 comment · Fixed by #104315
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@SparkyPotato
Copy link
Contributor

SparkyPotato commented Nov 11, 2022

Given the following code:

use crate::{self};

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=edadec50c25bbafc952c63f878b76af5

The current output is:

error: crate root imports need to be explicitly named: `use crate as name;`
 --> src/lib.rs:1:5
  |
1 | use crate::{self};
  |     ^^^^^

warning: unused import: `self`
 --> src/lib.rs:1:13
  |
1 | use crate::{self};
  |             ^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Ideally the output should look like:

error: crate root imports need to be explicitly named: `self as name`
 --> src/lib.rs:1:5
  |
1 | use crate::{self};
  |             ^^^^

This happens on both stable and the latest nightly.

@SparkyPotato SparkyPotato added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 11, 2022
@SparkyPotato
Copy link
Contributor Author

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant