-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-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
This code:
mod foo {
use super::NonZeroU8;
pub(crate) fn bar() -> NonZeroU8 {
NonZeroU8::new(1).unwrap()
}
}
use foo::bar;
fn main() {
let y = NonZeroU8::new(2).unwrap();
}Trying to compile it with rustc (1.54.0-nightly 5c02926 2021-05-11), it gives:
error[E0432]: unresolved import `super::NonZeroU8`
--> ...\test.rs:2:9
|
2 | use super::NonZeroU8;
| ^^^^^^^^^^^^^^^^ no `NonZeroU8` in the root
error[E0433]: failed to resolve: use of undeclared type `NonZeroU8`
--> ...\test.rs:12:13
|
12 | let y = NonZeroU8::new(2).unwrap();
| ^^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
9 | use core::num::NonZeroU8;
|
9 | use std::num::NonZeroU8;
|I'd like to see the 'use std::num::NonZeroU8;' help for the first unresolved import in the module too.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-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.