Skip to content

[ER] Help for unresolved super::X imports too. #85249

@leonardo-m

Description

@leonardo-m

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

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`D-papercutDiagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions