mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +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.
134 lines
3.8 KiB
Plaintext
134 lines
3.8 KiB
Plaintext
error[E0603]: static `j` is private
|
|
--> $DIR/xcrate-private-by-default.rs:23:29
|
|
|
|
|
LL | static_priv_by_default::j;
|
|
| ^ private static
|
|
|
|
|
note: the static `j` is defined here
|
|
--> $DIR/auxiliary/static_priv_by_default.rs:47:1
|
|
|
|
|
LL | static j: isize = 0;
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error[E0603]: function `k` is private
|
|
--> $DIR/xcrate-private-by-default.rs:25:29
|
|
|
|
|
LL | static_priv_by_default::k;
|
|
| ^ private function
|
|
|
|
|
note: the function `k` is defined here
|
|
--> $DIR/auxiliary/static_priv_by_default.rs:48:1
|
|
|
|
|
LL | fn k() {}
|
|
| ^^^^^^
|
|
|
|
error[E0603]: unit struct `l` is private
|
|
--> $DIR/xcrate-private-by-default.rs:27:29
|
|
|
|
|
LL | static_priv_by_default::l;
|
|
| ^ private unit struct
|
|
|
|
|
note: the unit struct `l` is defined here
|
|
--> $DIR/auxiliary/static_priv_by_default.rs:49:1
|
|
|
|
|
LL | struct l;
|
|
| ^^^^^^^^
|
|
|
|
error[E0603]: enum `m` is private
|
|
--> $DIR/xcrate-private-by-default.rs:29:35
|
|
|
|
|
LL | foo::<static_priv_by_default::m>();
|
|
| ^ private enum
|
|
|
|
|
note: the enum `m` is defined here
|
|
--> $DIR/auxiliary/static_priv_by_default.rs:50:1
|
|
|
|
|
LL | enum m {}
|
|
| ^^^^^^
|
|
|
|
error[E0603]: type alias `n` is private
|
|
--> $DIR/xcrate-private-by-default.rs:31:35
|
|
|
|
|
LL | foo::<static_priv_by_default::n>();
|
|
| ^ private type alias
|
|
|
|
|
note: the type alias `n` is defined here
|
|
--> $DIR/auxiliary/static_priv_by_default.rs:51:1
|
|
|
|
|
LL | type n = isize;
|
|
| ^^^^^^
|
|
|
|
error[E0603]: module `foo` is private
|
|
--> $DIR/xcrate-private-by-default.rs:35:29
|
|
|
|
|
LL | static_priv_by_default::foo::a;
|
|
| ^^^ - static `a` is not publicly re-exported
|
|
| |
|
|
| private module
|
|
|
|
|
note: the module `foo` is defined here
|
|
--> $DIR/auxiliary/static_priv_by_default.rs:12:1
|
|
|
|
|
LL | mod foo {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: module `foo` is private
|
|
--> $DIR/xcrate-private-by-default.rs:37:29
|
|
|
|
|
LL | static_priv_by_default::foo::b;
|
|
| ^^^ - function `b` is not publicly re-exported
|
|
| |
|
|
| private module
|
|
|
|
|
note: the module `foo` is defined here
|
|
--> $DIR/auxiliary/static_priv_by_default.rs:12:1
|
|
|
|
|
LL | mod foo {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: module `foo` is private
|
|
--> $DIR/xcrate-private-by-default.rs:39:29
|
|
|
|
|
LL | static_priv_by_default::foo::c;
|
|
| ^^^ - unit struct `c` is not publicly re-exported
|
|
| |
|
|
| private module
|
|
|
|
|
note: the module `foo` is defined here
|
|
--> $DIR/auxiliary/static_priv_by_default.rs:12:1
|
|
|
|
|
LL | mod foo {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: module `foo` is private
|
|
--> $DIR/xcrate-private-by-default.rs:41:35
|
|
|
|
|
LL | foo::<static_priv_by_default::foo::d>();
|
|
| ^^^ - enum `d` is not publicly re-exported
|
|
| |
|
|
| private module
|
|
|
|
|
note: the module `foo` is defined here
|
|
--> $DIR/auxiliary/static_priv_by_default.rs:12:1
|
|
|
|
|
LL | mod foo {
|
|
| ^^^^^^^
|
|
|
|
error[E0603]: module `foo` is private
|
|
--> $DIR/xcrate-private-by-default.rs:43:35
|
|
|
|
|
LL | foo::<static_priv_by_default::foo::e>();
|
|
| ^^^ - type alias `e` is not publicly re-exported
|
|
| |
|
|
| private module
|
|
|
|
|
note: the module `foo` is defined here
|
|
--> $DIR/auxiliary/static_priv_by_default.rs:12:1
|
|
|
|
|
LL | mod foo {
|
|
| ^^^^^^^
|
|
|
|
error: aborting due to 10 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0603`.
|