rust/src/test/ui/pub/pub-restricted.stderr
Esteban Küber 769b95dc9f Add diagnostic for incorrect pub (restriction)
Given the following statement

```rust
pub (a) fn afn() {}
```

Provide the following diagnostic:

```rust
error: incorrect restriction in `pub`
  --> file.rs:15:1
   |
15 | pub (a) fn afn() {}
   | ^^^^^^^
   |
   = help: some valid visibility restrictions are:
           `pub(crate)`: visible only on the current crate
           `pub(super)`: visible only in the current module's parent
           `pub(in path::to::module)`: visible only on the specified path
help: to make this visible only to module `a`, add `in` before the path:
   | pub (in a) fn afn() {}
```

Remove cruft from old `pub(path)` syntax.
2017-03-22 22:51:45 -07:00

48 lines
1.7 KiB
Plaintext

error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:15:5
|
15 | pub (a) fn afn() {}
| ^^^
|
= help: some possible visibility restrictions are:
`pub(crate)`: visible only on the current crate
`pub(super)`: visible only in the current module's parent
`pub(in path::to::module)`: visible only on the specified path
help: to make this visible only to module `a`, add `in` before the path:
| pub (in a) fn afn() {}
error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:16:5
|
16 | pub (b) fn bfn() {}
| ^^^
|
= help: some possible visibility restrictions are:
`pub(crate)`: visible only on the current crate
`pub(super)`: visible only in the current module's parent
`pub(in path::to::module)`: visible only on the specified path
help: to make this visible only to module `b`, add `in` before the path:
| pub (in b) fn bfn() {}
error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:32:13
|
32 | pub (a) invalid: usize,
| ^^^
|
= help: some possible visibility restrictions are:
`pub(crate)`: visible only on the current crate
`pub(super)`: visible only in the current module's parent
`pub(in path::to::module)`: visible only on the specified path
help: to make this visible only to module `a`, add `in` before the path:
| pub (in a) invalid: usize,
error: visibilities can only be restricted to ancestor modules
--> $DIR/pub-restricted.rs:33:17
|
33 | pub (in x) non_parent_invalid: usize,
| ^
error: aborting due to 4 previous errors