-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
mod rs {
pub use rustc_abi as abi;
}
fn foo(_x: rs::abi::Type) {}Current output
error[E0433]: failed to resolve: could not find `abi` in `rs`
--> src/lib.rs:5:16
|
5 | fn foo(_x: rs::abi::Type) {}
| ^^^ could not find `abi` in `rs`
warning: unused import: `rustc_abi as abi`
--> src/lib.rs:2:13
|
2 | pub use rustc_abi as abi;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by defaultDesired output
It should point at `pub use rustc_abi as abi;` and complain that `rustc_abi` does not exist.
The correct fix is to add
extern crate rustc_abi;Rationale and extra context
Neither of the actually shown errors is helpful:
- One error says that
rs::abidoes not exist -- but clearly it does exist, I wrote it right there! - The other error says that
rs::abiis unused -- but it is used, there's even an error pointing at it!
If I change rustc_abi to foobar, the error changes to something much better:
error[E0432]: unresolved import `foobar`
--> src/lib.rs:2:13
|
2 | pub use foobar as abi;
| ^^^^^^^^^^^^^ no external crate `foobar`
For more information about this error, try `rustc --explain E0432`.
error: could not compile `playground` (lib) due to 1 previous error
I assume this is related to the fact that rustc_abi exists as a crate, it's just not been imported.
Other cases
Rust Version
Rust 1.86.0Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.