rust/src/test/ui/issue-42944.rs
David Wood 48b0c9da69
Only suggest imports if not imported.
This commit modifies name resolution error reporting so that if a name
is in scope and has been imported then we do not suggest importing it.

This can occur when we add a label about constructors not being visible
due to private fields. In these cases, we know that the struct/variant
has been imported and we should silence any suggestions to import the
struct/variant.
2019-02-11 19:29:10 +01:00

20 lines
274 B
Rust

mod foo {
pub struct B(());
}
mod bar {
use foo::B;
fn foo() {
B(()); //~ ERROR expected function, found struct `B` [E0423]
}
}
mod baz {
fn foo() {
B(()); //~ ERROR cannot find function `B` in this scope [E0425]
}
}
fn main() {}