diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-01-06 08:09:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-06 08:09:05 +0100 |
| commit | b561659e437650181c7912ada4bd363b9f5aed75 (patch) | |
| tree | 8b1fcdbd08c67af1bbdca737315ac15905936c42 /compiler | |
| parent | 69e7b12b6bed98d40ee66960700b7c60d2ab1e40 (diff) | |
| parent | 2a96478dd80802ca98f358ffeeea17c7a508ced7 (diff) | |
| download | rust-b561659e437650181c7912ada4bd363b9f5aed75.tar.gz rust-b561659e437650181c7912ada4bd363b9f5aed75.zip | |
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
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_lint_defs/src/builtin.rs | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 2feed5e80dc..e74fb9d92e9 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1244,8 +1244,8 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller { declare_lint! { /// The `unreachable_pub` lint triggers for `pub` items not reachable from other crates - that - /// means neither directly accessible, nor reexported, nor leaked through things like return - /// types. + /// means neither directly accessible, nor reexported (with `pub use`), nor leaked through + /// things like return types (which the [`unnameable_types`] lint can detect if desired). /// /// ### Example /// @@ -1272,8 +1272,10 @@ declare_lint! { /// intent that the item is only visible within its own crate. /// /// This lint is "allow" by default because it will trigger for a large - /// amount existing Rust code, and has some false-positives. Eventually it + /// amount of existing Rust code, and has some false-positives. Eventually it /// is desired for this to become warn-by-default. + /// + /// [`unnameable_types`]: #unnameable-types pub UNREACHABLE_PUB, Allow, "`pub` items not reachable from crate root" diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 2f23ab27492..8399f4c12f4 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -4362,7 +4362,7 @@ declare_lint! { /// ### Explanation /// /// It is often expected that if you can obtain an object of type `T`, then - /// you can name the type `T` as well, this lint attempts to enforce this rule. + /// you can name the type `T` as well; this lint attempts to enforce this rule. /// The recommended action is to either reexport the type properly to make it nameable, /// or document that users are not supposed to be able to name it for one reason or another. /// |
