rust/src/test/ui/lint
bors 59d484575a Auto merge of #45569 - zackmdavis:unexported_pub_lint, r=petrochenkov
`unreachable-pub` lint (as authorized by RFC 2126)

To whom it may concern:

RFC 2126 commissions the creation of a lint for `pub` items that are not visible from crate root (#45521). We understand (but seek confirmation from more knowledgable compiler elders) that this can be implemented by linting HIR items that are _not_ ~~`cx.access_levels.is_exported`~~ `cx.access_levels.is_reachable` but have a `vis` (-ibility) field of `hir::Visibility::Public`.

The lint, tentatively called ~~`unexported-pub`~~ `unreachable-pub` (with the understanding that much could be written on the merits of various names, as it is said of the colors of bicycle-sheds), suggests `crate` as a replacement for `pub` if the `crate_visibility_modifier` feature is enabled (see #45388), and `pub(crate)` otherwise. We also use help messaging to suggest the other potential fix of exporting the item; feedback is desired as to whether this may be confusing or could be worded better.

As a preview of what respecting the proposed lint would look like (and to generate confirmatory evidence that this implementation doesn't issue false positives), ~~we take its suggestions for `libcore`~~ (save one, which is deferred to another pull request because it brings up an unrelated technical matter). I remain your obedient servant.

![unexported_pub](https://user-images.githubusercontent.com/1076988/32089794-fbd02420-baa0-11e7-87e5-3ec01f18924a.png)

r? @petrochenkov
2017-11-03 16:28:24 +00:00
..
command-line-lint-group-allow.rs note lint group set on command line triggering individual lint 2017-02-04 10:51:11 -08:00
command-line-lint-group-deny.rs note lint group set on command line triggering individual lint 2017-02-04 10:51:11 -08:00
command-line-lint-group-deny.stderr Revert "Change error count messages" 2017-07-02 13:49:30 +03:00
command-line-lint-group-forbid.rs note lint group set on command line triggering individual lint 2017-02-04 10:51:11 -08:00
command-line-lint-group-forbid.stderr Revert "Change error count messages" 2017-07-02 13:49:30 +03:00
command-line-lint-group-warn.rs note lint group set on command line triggering individual lint 2017-02-04 10:51:11 -08:00
command-line-lint-group-warn.stderr note wording: lint implied by lint group, not lint group implies lint 2017-02-04 10:51:11 -08:00
lint-group-style.rs make lint-group-style test a UI rather than a compile-fail test 2017-02-04 10:51:11 -08:00
lint-group-style.stderr Revert "Change error count messages" 2017-07-02 13:49:30 +03:00
not_found.rs add a lowercase suggestion to unknown_lints 2017-08-31 22:18:12 +02:00
not_found.stderr add a lowercase suggestion to unknown_lints 2017-08-31 22:18:12 +02:00
outer-forbid.rs rustc: Rearchitect lints to be emitted more eagerly 2017-08-09 09:13:51 -07:00
outer-forbid.stderr rustc: Rearchitect lints to be emitted more eagerly 2017-08-09 09:13:51 -07:00
suggestions.rs Add several lints into unused lint group 2017-10-29 22:14:23 +03:00
suggestions.stderr Add several lints into unused lint group 2017-10-29 22:14:23 +03:00
unreachable_pub-pub_crate.rs unreachable-pub lint for pub items not reachable from crate root 2017-11-02 20:50:17 -07:00
unreachable_pub-pub_crate.stderr unreachable-pub lint for pub items not reachable from crate root 2017-11-02 20:50:17 -07:00
unreachable_pub.rs unreachable-pub lint for pub items not reachable from crate root 2017-11-02 20:50:17 -07:00
unreachable_pub.stderr unreachable-pub lint for pub items not reachable from crate root 2017-11-02 20:50:17 -07:00
unused_parens_json_suggestion.rs Add several lints into unused lint group 2017-10-29 22:14:23 +03:00
unused_parens_json_suggestion.stderr Report lint names in json diagnostics 2017-11-02 10:19:41 +01:00
use_suggestion_json.rs Add a test reproducing the quadratic json explosion 2017-10-24 16:22:35 +02:00
use_suggestion_json.stderr Reduce the repetition in json error output 2017-10-24 16:41:16 +02:00