"[E0603] unit variant X
is private. help: import X
directly" suggests invalid path in private module
#140831
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-resolve
Area: Name/path resolution done by `rustc_resolve` specifically
A-visibility
Area: Visibility / privacy
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
The first suggestion to use
Val::Null
is fine. The second suggestion has 2 issues:val
module is privateVal::Null::Null
is not a valid paththus it is not needed in this case
Other cases
Rust Version
Anything else?
Stumbled upon this because I noticed rust-analyzer was only suggesting types in type position. Wanted to see if it would suggest functions where applicable, and noticed it was also suggesting imported (but not re-exported) items in the scope of the
parse
module of the crate.If you use the suggestion of
val::Val::Null:Null
, it will tell you theval
mod is private, but once again also suggests to use an invalid path,Val::Null::Null
:The text was updated successfully, but these errors were encountered: