mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
7dffd24da5
Suggest publicly accessible paths for items in private mod: When encountering a path in non-import situations that are not reachable due to privacy constraints, search for any public re-exports that the user could use instead. Track whether an import suggestion is offering a re-export. When encountering a path with private segments, mention if the item at the final path segment is not publicly accessible at all. Add item visibility metadata to privacy errors from imports: On unreachable imports, record the item that was being imported in order to suggest publicly available re-exports or to be explicit that the item is not available publicly from any path. In order to allow this, we add a mode to `resolve_path` that will not add new privacy errors, nor return early if it encounters one. This way we can get the `Res` corresponding to the final item in the import, which is used in the privacy error machinery.
224 lines
5.5 KiB
Plaintext
224 lines
5.5 KiB
Plaintext
error[E0603]: module `baz` is private
|
|
--> $DIR/privacy1.rs:132:18
|
|
|
|
|
LL | use bar::baz::{foo, bar};
|
|
| ^^^ private module
|
|
|
|
|
note: the module `baz` is defined here
|
|
--> $DIR/privacy1.rs:50:5
|
|
|
|
|
LL | mod baz {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: module `baz` is private
|
|
--> $DIR/privacy1.rs:132:18
|
|
|
|
|
LL | use bar::baz::{foo, bar};
|
|
| ^^^ private module
|
|
|
|
|
note: the module `baz` is defined here
|
|
--> $DIR/privacy1.rs:50:5
|
|
|
|
|
LL | mod baz {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: module `baz` is private
|
|
--> $DIR/privacy1.rs:141:18
|
|
|
|
|
LL | use bar::baz;
|
|
| ^^^ private module
|
|
|
|
|
note: the module `baz` is defined here
|
|
--> $DIR/privacy1.rs:50:5
|
|
|
|
|
LL | mod baz {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: module `i` is private
|
|
--> $DIR/privacy1.rs:165:20
|
|
|
|
|
LL | use self::foo::i::A;
|
|
| ^ private module
|
|
|
|
|
note: the module `i` is defined here
|
|
--> $DIR/privacy1.rs:170:9
|
|
|
|
|
LL | mod i {
|
|
| ^^^^^
|
|
|
|
error[E0603]: module `baz` is private
|
|
--> $DIR/privacy1.rs:104:16
|
|
|
|
|
LL | ::bar::baz::A::foo();
|
|
| ^^^ - struct `A` is not publicly re-exported
|
|
| |
|
|
| private module
|
|
|
|
|
note: the module `baz` is defined here
|
|
--> $DIR/privacy1.rs:50:5
|
|
|
|
|
LL | mod baz {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: module `baz` is private
|
|
--> $DIR/privacy1.rs:105:16
|
|
|
|
|
LL | ::bar::baz::A::bar();
|
|
| ^^^ - struct `A` is not publicly re-exported
|
|
| |
|
|
| private module
|
|
|
|
|
note: the module `baz` is defined here
|
|
--> $DIR/privacy1.rs:50:5
|
|
|
|
|
LL | mod baz {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: module `baz` is private
|
|
--> $DIR/privacy1.rs:107:16
|
|
|
|
|
LL | ::bar::baz::A.foo2();
|
|
| ^^^ - unit struct `A` is not publicly re-exported
|
|
| |
|
|
| private module
|
|
|
|
|
note: the module `baz` is defined here
|
|
--> $DIR/privacy1.rs:50:5
|
|
|
|
|
LL | mod baz {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: module `baz` is private
|
|
--> $DIR/privacy1.rs:108:16
|
|
|
|
|
LL | ::bar::baz::A.bar2();
|
|
| ^^^ - unit struct `A` is not publicly re-exported
|
|
| |
|
|
| private module
|
|
|
|
|
note: the module `baz` is defined here
|
|
--> $DIR/privacy1.rs:50:5
|
|
|
|
|
LL | mod baz {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: trait `B` is private
|
|
--> $DIR/privacy1.rs:112:16
|
|
|
|
|
LL | ::bar::B::foo();
|
|
| ^ --- associated function `foo` is not publicly re-exported
|
|
| |
|
|
| private trait
|
|
|
|
|
note: the trait `B` is defined here
|
|
--> $DIR/privacy1.rs:40:5
|
|
|
|
|
LL | trait B {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: function `epriv` is private
|
|
--> $DIR/privacy1.rs:118:20
|
|
|
|
|
LL | ::bar::epriv();
|
|
| ^^^^^ private function
|
|
|
|
|
note: the function `epriv` is defined here
|
|
--> $DIR/privacy1.rs:65:9
|
|
|
|
|
LL | fn epriv();
|
|
| ^^^^^^^^^^^
|
|
|
|
error[E0603]: module `baz` is private
|
|
--> $DIR/privacy1.rs:127:16
|
|
|
|
|
LL | ::bar::baz::foo();
|
|
| ^^^ private module
|
|
|
|
|
note: the module `baz` is defined here
|
|
--> $DIR/privacy1.rs:50:5
|
|
|
|
|
LL | mod baz {
|
|
| ^^^^^^^
|
|
help: consider importing this function through its public re-export instead
|
|
|
|
|
LL | bar::foo();
|
|
| ~~~~~~~~
|
|
|
|
error[E0603]: module `baz` is private
|
|
--> $DIR/privacy1.rs:128:16
|
|
|
|
|
LL | ::bar::baz::bar();
|
|
| ^^^ private module
|
|
|
|
|
note: the module `baz` is defined here
|
|
--> $DIR/privacy1.rs:50:5
|
|
|
|
|
LL | mod baz {
|
|
| ^^^^^^^
|
|
help: consider importing this function through its public re-export instead
|
|
|
|
|
LL | bar::bar();
|
|
| ~~~~~~~~
|
|
|
|
error[E0603]: trait `B` is private
|
|
--> $DIR/privacy1.rs:157:17
|
|
|
|
|
LL | impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } }
|
|
| ^ private trait
|
|
|
|
|
note: the trait `B` is defined here
|
|
--> $DIR/privacy1.rs:40:5
|
|
|
|
|
LL | trait B {
|
|
| ^^^^^^^
|
|
|
|
error[E0624]: associated function `bar` is private
|
|
--> $DIR/privacy1.rs:77:23
|
|
|
|
|
LL | fn bar() {}
|
|
| -------- private associated function defined here
|
|
...
|
|
LL | self::baz::A::bar();
|
|
| ^^^ private associated function
|
|
|
|
error[E0624]: associated function `bar` is private
|
|
--> $DIR/privacy1.rs:95:13
|
|
|
|
|
LL | fn bar() {}
|
|
| -------- private associated function defined here
|
|
...
|
|
LL | bar::A::bar();
|
|
| ^^^ private associated function
|
|
|
|
error[E0624]: associated function `bar` is private
|
|
--> $DIR/privacy1.rs:102:19
|
|
|
|
|
LL | fn bar() {}
|
|
| -------- private associated function defined here
|
|
...
|
|
LL | ::bar::A::bar();
|
|
| ^^^ private associated function
|
|
|
|
error[E0624]: associated function `bar` is private
|
|
--> $DIR/privacy1.rs:105:24
|
|
|
|
|
LL | fn bar() {}
|
|
| -------- private associated function defined here
|
|
...
|
|
LL | ::bar::baz::A::bar();
|
|
| ^^^ private associated function
|
|
|
|
error[E0624]: method `bar2` is private
|
|
--> $DIR/privacy1.rs:108:23
|
|
|
|
|
LL | fn bar2(&self) {}
|
|
| -------------- private method defined here
|
|
...
|
|
LL | ::bar::baz::A.bar2();
|
|
| ^^^^ private method
|
|
|
|
error: aborting due to 18 previous errors
|
|
|
|
Some errors have detailed explanations: E0603, E0624.
|
|
For more information about an error, try `rustc --explain E0603`.
|