Rollup merge of #120144 - petrochenkov:unty, r=davidtwco
privacy: Stabilize lint `unnameable_types` This is the last piece of ["RFC #2145: Type privacy and private-in-public lints"](https://github.com/rust-lang/rust/issues/48054). Having unstable lints is not very useful because you cannot even dogfood them in the compiler/stdlib in this case (https://github.com/rust-lang/rust/pull/113284). The worst thing that may happen when a lint is removed are some `removed_lints` warnings, but I haven't heard anyone suggesting removing this specific lint. This lint is allow-by-default and is supposed to be enabled explicitly. Some false positives are expected, because sometimes unnameable types are a legitimate pattern. This lint also have some unnecessary false positives, that can be fixed - see https://github.com/rust-lang/rust/issues/120146 and https://github.com/rust-lang/rust/issues/120149. Closes https://github.com/rust-lang/rust/issues/48054.
This commit is contained in:
commit
337be99bb6
8 changed files with 14 additions and 29 deletions
|
@ -4311,7 +4311,6 @@ declare_lint! {
|
|||
/// ### Example
|
||||
///
|
||||
/// ```rust,compile_fail
|
||||
/// # #![feature(type_privacy_lints)]
|
||||
/// # #![allow(unused)]
|
||||
/// #![deny(unnameable_types)]
|
||||
/// mod m {
|
||||
|
@ -4328,10 +4327,14 @@ declare_lint! {
|
|||
///
|
||||
/// 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.
|
||||
/// 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.
|
||||
///
|
||||
/// Besides types, this lint applies to traits because traits can also leak through signatures,
|
||||
/// and you may obtain objects of their `dyn Trait` or `impl Trait` types.
|
||||
pub UNNAMEABLE_TYPES,
|
||||
Allow,
|
||||
"effective visibility of a type is larger than the area in which it can be named",
|
||||
@feature_gate = sym::type_privacy_lints;
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue