1
Fork 0

Replace old private-in-public diagnostic with type privacy lints

This commit is contained in:
Bryanskiy 2023-06-19 17:06:00 +03:00
parent 5cbfee5455
commit e26614e6a7
68 changed files with 862 additions and 1700 deletions

View file

@ -982,44 +982,6 @@ declare_lint! {
"detects trivial casts of numeric types which could be removed"
}
declare_lint! {
/// The `private_in_public` lint detects private items in public
/// interfaces not caught by the old implementation.
///
/// ### Example
///
/// ```rust
/// # #![allow(unused)]
/// struct SemiPriv;
///
/// mod m1 {
/// struct Priv;
/// impl super::SemiPriv {
/// pub fn f(_: Priv) {}
/// }
/// }
/// # fn main() {}
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// The visibility rules are intended to prevent exposing private items in
/// public interfaces. This is a [future-incompatible] lint to transition
/// this to a hard error in the future. See [issue #34537] for more
/// details.
///
/// [issue #34537]: https://github.com/rust-lang/rust/issues/34537
/// [future-incompatible]: ../index.md#future-incompatible-lints
pub PRIVATE_IN_PUBLIC,
Warn,
"detect private items in public interfaces not caught by the old implementation",
@future_incompatible = FutureIncompatibleInfo {
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
};
}
declare_lint! {
/// The `invalid_alignment` lint detects dereferences of misaligned pointers during
/// constant evaluation.
@ -3374,7 +3336,6 @@ declare_lint_pass! {
PATTERNS_IN_FNS_WITHOUT_BODY,
POINTER_STRUCTURAL_MATCH,
PRIVATE_BOUNDS,
PRIVATE_IN_PUBLIC,
PRIVATE_INTERFACES,
PROC_MACRO_BACK_COMPAT,
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
@ -4293,9 +4254,7 @@ declare_lint! {
/// ### Example
///
/// ```rust,compile_fail
/// # #![feature(type_privacy_lints)]
/// # #![allow(unused)]
/// # #![allow(private_in_public)]
/// #![deny(private_interfaces)]
/// struct SemiPriv;
///
@ -4316,9 +4275,8 @@ declare_lint! {
/// Having something private in primary interface guarantees that
/// the item will be unusable from outer modules due to type privacy.
pub PRIVATE_INTERFACES,
Allow,
Warn,
"private type in primary interface of an item",
@feature_gate = sym::type_privacy_lints;
}
declare_lint! {
@ -4329,8 +4287,6 @@ declare_lint! {
/// ### Example
///
/// ```rust,compile_fail
/// # #![feature(type_privacy_lints)]
/// # #![allow(private_in_public)]
/// # #![allow(unused)]
/// #![deny(private_bounds)]
///
@ -4348,9 +4304,8 @@ declare_lint! {
/// Having private types or traits in item bounds makes it less clear what interface
/// the item actually provides.
pub PRIVATE_BOUNDS,
Allow,
Warn,
"private type in secondary interface of an item",
@feature_gate = sym::type_privacy_lints;
}
declare_lint! {