Closed
Description
When a private member is accessed from another module an error is raised as expected, but it is wrongly hinted that you can import it into scope, as seen in this example:
mod other_module {
struct PrivateMember;
}
fn main() {
PrivateMember;
}
error[E0425]: cannot find value `PrivateMember` in this scope
--> src/main.rs:6:5
|
6 | PrivateMember;
| ^^^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
1 | use other_module::PrivateMember;
|
Following the hint is clearly wrong:
error[E0603]: struct `PrivateMember` is private
--> src/main.rs:5:5
|
5 | use other_module::PrivateMember;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Meta
$ rustc --version --verbose
rustc 1.26.0 (a77568041 2018-05-07)
binary: rustc
commit-hash: a7756804103447ea4e68a71ccf071e7ad8f7a03e
commit-date: 2018-05-07
host: x86_64-unknown-linux-gnu
release: 1.26.0
LLVM version: 6.0
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Category: An issue proposing an enhancement or a PR with one.Diagnostics: A structured suggestion resulting in incorrect code.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Relevant to the compiler team, which will review and decide on the PR/issue.