Skip to content

Commit b561659

Browse files
authored
Rollup merge of #135145 - kpreid:unnameable, r=compiler-errors
Mention `unnameable_types` in `unreachable_pub` documentation. This link makes sense because someone who wishes to avoid unusable `pub` is likely, but not guaranteed, to be interested in avoiding unnameable types. Also fixed some grammar problems I noticed in the area. Fixes #116604. r? Urgau
2 parents 69e7b12 + 2a96478 commit b561659

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

compiler/rustc_lint/src/builtin.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1244,8 +1244,8 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller {
12441244

12451245
declare_lint! {
12461246
/// The `unreachable_pub` lint triggers for `pub` items not reachable from other crates - that
1247-
/// means neither directly accessible, nor reexported, nor leaked through things like return
1248-
/// types.
1247+
/// means neither directly accessible, nor reexported (with `pub use`), nor leaked through
1248+
/// things like return types (which the [`unnameable_types`] lint can detect if desired).
12491249
///
12501250
/// ### Example
12511251
///
@@ -1272,8 +1272,10 @@ declare_lint! {
12721272
/// intent that the item is only visible within its own crate.
12731273
///
12741274
/// This lint is "allow" by default because it will trigger for a large
1275-
/// amount existing Rust code, and has some false-positives. Eventually it
1275+
/// amount of existing Rust code, and has some false-positives. Eventually it
12761276
/// is desired for this to become warn-by-default.
1277+
///
1278+
/// [`unnameable_types`]: #unnameable-types
12771279
pub UNREACHABLE_PUB,
12781280
Allow,
12791281
"`pub` items not reachable from crate root"

compiler/rustc_lint_defs/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4362,7 +4362,7 @@ declare_lint! {
43624362
/// ### Explanation
43634363
///
43644364
/// It is often expected that if you can obtain an object of type `T`, then
4365-
/// you can name the type `T` as well, this lint attempts to enforce this rule.
4365+
/// you can name the type `T` as well; this lint attempts to enforce this rule.
43664366
/// The recommended action is to either reexport the type properly to make it nameable,
43674367
/// or document that users are not supposed to be able to name it for one reason or another.
43684368
///

0 commit comments

Comments
 (0)