about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorBryanskiy <ivakin.kir@gmail.com>2023-06-19 17:06:00 +0300
committerBryanskiy <ivakin.kir@gmail.com>2023-08-02 13:40:28 +0300
commite26614e6a7f8003dfd2a756db070c6d04ca34c6f (patch)
tree22bc39fc5f1b096999c0d39a245e9b6261efcdc8 /tests
parent5cbfee545543a8e3d91c54997c6bcd24d2054321 (diff)
downloadrust-e26614e6a7f8003dfd2a756db070c6d04ca34c6f.tar.gz
rust-e26614e6a7f8003dfd2a756db070c6d04ca34c6f.zip
Replace old private-in-public diagnostic with type privacy lints
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/associated-inherent-types/private-in-public.rs21
-rw-r--r--tests/ui/associated-inherent-types/private-in-public.stderr52
-rw-r--r--tests/ui/const-generics/generic_const_exprs/eval-privacy.rs7
-rw-r--r--tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr21
-rw-r--r--tests/ui/error-codes/E0445.rs23
-rw-r--r--tests/ui/error-codes/E0445.stderr71
-rw-r--r--tests/ui/error-codes/E0446.rs15
-rw-r--r--tests/ui/error-codes/E0446.stderr23
-rw-r--r--tests/ui/feature-gates/feature-gate-type_privacy_lints.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr70
-rw-r--r--tests/ui/issues/issue-18389.rs10
-rw-r--r--tests/ui/issues/issue-18389.stderr28
-rw-r--r--tests/ui/lint/issue-99387.rs2
-rw-r--r--tests/ui/lint/lint-ctypes-fn.rs2
-rw-r--r--tests/ui/lint/lint-ctypes.rs2
-rw-r--r--tests/ui/privacy/associated-item-privacy-inherent.rs2
-rw-r--r--tests/ui/privacy/associated-item-privacy-trait.rs2
-rw-r--r--tests/ui/privacy/associated-item-privacy-type-binding.rs2
-rw-r--r--tests/ui/privacy/effective_visibilities_full_priv.rs2
-rw-r--r--tests/ui/privacy/issue-30079.rs3
-rw-r--r--tests/ui/privacy/issue-30079.stderr17
-rw-r--r--tests/ui/privacy/private-in-public-assoc-ty.rs9
-rw-r--r--tests/ui/privacy/private-in-public-assoc-ty.stderr50
-rw-r--r--tests/ui/privacy/private-in-public-lint.rs19
-rw-r--r--tests/ui/privacy/private-in-public-lint.stderr21
-rw-r--r--tests/ui/privacy/private-in-public-non-principal-2.rs2
-rw-r--r--tests/ui/privacy/private-in-public-non-principal.rs10
-rw-r--r--tests/ui/privacy/private-in-public-non-principal.stderr28
-rw-r--r--tests/ui/privacy/private-in-public-type-alias-impl-trait.rs2
-rw-r--r--tests/ui/privacy/private-in-public-warn.rs85
-rw-r--r--tests/ui/privacy/private-in-public-warn.stderr376
-rw-r--r--tests/ui/privacy/private-in-public.rs66
-rw-r--r--tests/ui/privacy/private-in-public.stderr468
-rw-r--r--tests/ui/privacy/private-inferred-type-2.rs1
-rw-r--r--tests/ui/privacy/private-inferred-type-2.stderr6
-rw-r--r--tests/ui/privacy/private-inferred-type.rs2
-rw-r--r--tests/ui/privacy/private-type-in-interface.rs1
-rw-r--r--tests/ui/privacy/private-type-in-interface.stderr18
-rw-r--r--tests/ui/privacy/restricted/private-in-public.rs5
-rw-r--r--tests/ui/privacy/restricted/private-in-public.stderr21
-rw-r--r--tests/ui/privacy/unnameable_types.rs1
-rw-r--r--tests/ui/privacy/unnameable_types.stderr8
-rw-r--r--tests/ui/privacy/where-priv-type.rs27
-rw-r--r--tests/ui/privacy/where-priv-type.stderr107
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.rs23
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.stderr84
-rw-r--r--tests/ui/proc-macro/allowed-signatures.rs2
-rw-r--r--tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs30
-rw-r--r--tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr48
-rw-r--r--tests/ui/test-attrs/issue-36768.rs2
-rw-r--r--tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs4
-rw-r--r--tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr19
-rw-r--r--tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs4
-rw-r--r--tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr19
-rw-r--r--tests/ui/type-alias-impl-trait/privacy.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/privacy.stderr18
56 files changed, 798 insertions, 1173 deletions
diff --git a/tests/ui/associated-inherent-types/private-in-public.rs b/tests/ui/associated-inherent-types/private-in-public.rs
index e9e189f95c9..7797a2a16a5 100644
--- a/tests/ui/associated-inherent-types/private-in-public.rs
+++ b/tests/ui/associated-inherent-types/private-in-public.rs
@@ -1,26 +1,15 @@
+// check-pass
+
 #![feature(inherent_associated_types)]
-#![feature(type_privacy_lints)]
 #![allow(incomplete_features)]
 #![crate_type = "lib"]
-#![deny(private_in_public)]
-#![warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
 
 pub type PubAlias0 = PubTy::PrivAssocTy;
-//~^ ERROR private associated type `PubTy::PrivAssocTy` in public interface (error E0446)
-//~| WARNING this was previously accepted
-//~| WARNING associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
+//~^ WARNING associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
 pub type PubAlias1 = PrivTy::PubAssocTy;
-//~^ ERROR private type `PrivTy` in public interface (error E0446)
-//~| WARNING this was previously accepted
-//~| WARNING type `PrivTy` is more private than the item `PubAlias1`
+//~^ WARNING type `PrivTy` is more private than the item `PubAlias1`
 pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>;
-//~^ ERROR private type `PrivTy` in public interface (error E0446)
-//~| WARNING this was previously accepted
-//~| WARNING type `PrivTy` is more private than the item `PubAlias2`
+//~^ WARNING type `PrivTy` is more private than the item `PubAlias2`
 
 pub struct PubTy;
 impl PubTy {
diff --git a/tests/ui/associated-inherent-types/private-in-public.stderr b/tests/ui/associated-inherent-types/private-in-public.stderr
index 65d187c1bcd..076bbd78ae9 100644
--- a/tests/ui/associated-inherent-types/private-in-public.stderr
+++ b/tests/ui/associated-inherent-types/private-in-public.stderr
@@ -1,75 +1,39 @@
-error: private associated type `PubTy::PrivAssocTy` in public interface (error E0446)
-  --> $DIR/private-in-public.rs:12:1
-   |
-LL | pub type PubAlias0 = PubTy::PrivAssocTy;
-   | ^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-note: the lint level is defined here
-  --> $DIR/private-in-public.rs:5:9
-   |
-LL | #![deny(private_in_public)]
-   |         ^^^^^^^^^^^^^^^^^
-
 warning: associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
-  --> $DIR/private-in-public.rs:12:1
+  --> $DIR/private-in-public.rs:7:1
    |
 LL | pub type PubAlias0 = PubTy::PrivAssocTy;
    | ^^^^^^^^^^^^^^^^^^ type alias `PubAlias0` is reachable at visibility `pub`
    |
 note: but associated type `PubTy::PrivAssocTy` is only usable at visibility `pub(crate)`
-  --> $DIR/private-in-public.rs:27:5
+  --> $DIR/private-in-public.rs:16:5
    |
 LL |     type PrivAssocTy = ();
    |     ^^^^^^^^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/private-in-public.rs:6:9
-   |
-LL | #![warn(private_interfaces)]
-   |         ^^^^^^^^^^^^^^^^^^
-
-error: private type `PrivTy` in public interface (error E0446)
-  --> $DIR/private-in-public.rs:16:1
-   |
-LL | pub type PubAlias1 = PrivTy::PubAssocTy;
-   | ^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+   = note: `#[warn(private_interfaces)]` on by default
 
 warning: type `PrivTy` is more private than the item `PubAlias1`
-  --> $DIR/private-in-public.rs:16:1
+  --> $DIR/private-in-public.rs:9:1
    |
 LL | pub type PubAlias1 = PrivTy::PubAssocTy;
    | ^^^^^^^^^^^^^^^^^^ type alias `PubAlias1` is reachable at visibility `pub`
    |
 note: but type `PrivTy` is only usable at visibility `pub(crate)`
-  --> $DIR/private-in-public.rs:31:1
+  --> $DIR/private-in-public.rs:20:1
    |
 LL | struct PrivTy;
    | ^^^^^^^^^^^^^
 
-error: private type `PrivTy` in public interface (error E0446)
-  --> $DIR/private-in-public.rs:20:1
-   |
-LL | pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>;
-   | ^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-
 warning: type `PrivTy` is more private than the item `PubAlias2`
-  --> $DIR/private-in-public.rs:20:1
+  --> $DIR/private-in-public.rs:11:1
    |
 LL | pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>;
    | ^^^^^^^^^^^^^^^^^^ type alias `PubAlias2` is reachable at visibility `pub`
    |
 note: but type `PrivTy` is only usable at visibility `pub(crate)`
-  --> $DIR/private-in-public.rs:31:1
+  --> $DIR/private-in-public.rs:20:1
    |
 LL | struct PrivTy;
    | ^^^^^^^^^^^^^
 
-error: aborting due to 3 previous errors; 3 warnings emitted
+warning: 3 warnings emitted
 
diff --git a/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs b/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
index e5464a4253f..8023b998a40 100644
--- a/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
+++ b/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
@@ -1,12 +1,6 @@
 #![crate_type = "lib"]
 #![feature(generic_const_exprs)]
-#![feature(type_privacy_lints)]
 #![allow(incomplete_features)]
-#![warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
 
 pub struct Const<const U: u8>;
 
@@ -21,7 +15,6 @@ where
 {
     type AssocTy = Const<{ my_const_fn(U) }>;
     //~^ ERROR private type
-    //~| WARNING type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
     fn assoc_fn() -> Self::AssocTy {
         Const
     }
diff --git a/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr b/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr
index 16fae6b5c63..2d9de8805bb 100644
--- a/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr
@@ -1,5 +1,5 @@
 error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
-  --> $DIR/eval-privacy.rs:22:5
+  --> $DIR/eval-privacy.rs:16:5
    |
 LL |     type AssocTy = Const<{ my_const_fn(U) }>;
    |     ^^^^^^^^^^^^ can't leak private type
@@ -7,23 +7,6 @@ LL |     type AssocTy = Const<{ my_const_fn(U) }>;
 LL | const fn my_const_fn(val: u8) -> u8 {
    | ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
 
-warning: type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
-  --> $DIR/eval-privacy.rs:22:5
-   |
-LL |     type AssocTy = Const<{ my_const_fn(U) }>;
-   |     ^^^^^^^^^^^^ associated type `<Const<U> as Trait>::AssocTy` is reachable at visibility `pub`
-   |
-note: but type `fn(u8) -> u8 {my_const_fn}` is only usable at visibility `pub(crate)`
-  --> $DIR/eval-privacy.rs:30:1
-   |
-LL | const fn my_const_fn(val: u8) -> u8 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/eval-privacy.rs:5:9
-   |
-LL | #![warn(private_interfaces)]
-   |         ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/error-codes/E0445.rs b/tests/ui/error-codes/E0445.rs
deleted file mode 100644
index 9f29c81673e..00000000000
--- a/tests/ui/error-codes/E0445.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-#![feature(type_privacy_lints)]
-#[warn(private_bounds)]
-#[warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
-
-trait Foo {
-    fn dummy(&self) { }
-}
-
-pub trait Bar : Foo {}
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `Bar`
-pub struct Bar2<T: Foo>(pub T);
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `Bar2`
-pub fn foo<T: Foo> (t: T) {}
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `foo`
-
-fn main() {}
diff --git a/tests/ui/error-codes/E0445.stderr b/tests/ui/error-codes/E0445.stderr
deleted file mode 100644
index 4f940868ff9..00000000000
--- a/tests/ui/error-codes/E0445.stderr
+++ /dev/null
@@ -1,71 +0,0 @@
-error[E0445]: private trait `Foo` in public interface
-  --> $DIR/E0445.rs:13:1
-   |
-LL | trait Foo {
-   | --------- `Foo` declared as private
-...
-LL | pub trait Bar : Foo {}
-   | ^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `Bar`
-  --> $DIR/E0445.rs:13:1
-   |
-LL | pub trait Bar : Foo {}
-   | ^^^^^^^^^^^^^^^^^^^ trait `Bar` is reachable at visibility `pub`
-   |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
-  --> $DIR/E0445.rs:9:1
-   |
-LL | trait Foo {
-   | ^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/E0445.rs:2:8
-   |
-LL | #[warn(private_bounds)]
-   |        ^^^^^^^^^^^^^^
-
-error[E0445]: private trait `Foo` in public interface
-  --> $DIR/E0445.rs:16:1
-   |
-LL | trait Foo {
-   | --------- `Foo` declared as private
-...
-LL | pub struct Bar2<T: Foo>(pub T);
-   | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `Bar2`
-  --> $DIR/E0445.rs:16:1
-   |
-LL | pub struct Bar2<T: Foo>(pub T);
-   | ^^^^^^^^^^^^^^^^^^^^^^^ struct `Bar2` is reachable at visibility `pub`
-   |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
-  --> $DIR/E0445.rs:9:1
-   |
-LL | trait Foo {
-   | ^^^^^^^^^
-
-error[E0445]: private trait `Foo` in public interface
-  --> $DIR/E0445.rs:19:1
-   |
-LL | trait Foo {
-   | --------- `Foo` declared as private
-...
-LL | pub fn foo<T: Foo> (t: T) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `foo`
-  --> $DIR/E0445.rs:19:1
-   |
-LL | pub fn foo<T: Foo> (t: T) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `foo` is reachable at visibility `pub`
-   |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
-  --> $DIR/E0445.rs:9:1
-   |
-LL | trait Foo {
-   | ^^^^^^^^^
-
-error: aborting due to 3 previous errors; 3 warnings emitted
-
-For more information about this error, try `rustc --explain E0445`.
diff --git a/tests/ui/error-codes/E0446.rs b/tests/ui/error-codes/E0446.rs
index f61c7e54616..6d6c4f97c06 100644
--- a/tests/ui/error-codes/E0446.rs
+++ b/tests/ui/error-codes/E0446.rs
@@ -1,9 +1,14 @@
-mod foo {
-    struct Bar(u32);
+struct Bar;
+trait PrivTr {}
 
-    pub fn bar() -> Bar { //~ ERROR E0446
-        Bar(0)
-    }
+pub trait PubTr {
+    type Alias1;
+    type Alias2;
+}
+
+impl PubTr for u8 {
+    type Alias1 = Bar; //~ ERROR E0446
+    type Alias2 = Box<dyn PrivTr>; //~ ERROR E0446
 }
 
 fn main() {}
diff --git a/tests/ui/error-codes/E0446.stderr b/tests/ui/error-codes/E0446.stderr
index b6a195c40a9..2951e69d1c2 100644
--- a/tests/ui/error-codes/E0446.stderr
+++ b/tests/ui/error-codes/E0446.stderr
@@ -1,12 +1,21 @@
 error[E0446]: private type `Bar` in public interface
-  --> $DIR/E0446.rs:4:5
+  --> $DIR/E0446.rs:10:5
    |
-LL |     struct Bar(u32);
-   |     ---------- `Bar` declared as private
-LL |
-LL |     pub fn bar() -> Bar {
-   |     ^^^^^^^^^^^^^^^^^^^ can't leak private type
+LL | struct Bar;
+   | ---------- `Bar` declared as private
+...
+LL |     type Alias1 = Bar;
+   |     ^^^^^^^^^^^ can't leak private type
 
-error: aborting due to previous error
+error[E0446]: private trait `PrivTr` in public interface
+  --> $DIR/E0446.rs:11:5
+   |
+LL | trait PrivTr {}
+   | ------------ `PrivTr` declared as private
+...
+LL |     type Alias2 = Box<dyn PrivTr>;
+   |     ^^^^^^^^^^^ can't leak private trait
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs b/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
index aad64c9d073..8bb9736f1b4 100644
--- a/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
+++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
@@ -1,11 +1,5 @@
 // check-pass
 
-#![warn(private_interfaces)] //~ WARN unknown lint
-                             //~| WARN unknown lint
-                             //~| WARN unknown lint
-#![warn(private_bounds)] //~ WARN unknown lint
-                         //~| WARN unknown lint
-                         //~| WARN unknown lint
 #![warn(unnameable_types)] //~ WARN unknown lint
                            //~| WARN unknown lint
                            //~| WARN unknown lint
diff --git a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
index 79cc974cca1..4349fea6f89 100644
--- a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
+++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
@@ -1,26 +1,5 @@
-warning: unknown lint: `private_interfaces`
-  --> $DIR/feature-gate-type_privacy_lints.rs:3:1
-   |
-LL | #![warn(private_interfaces)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: the `private_interfaces` lint is unstable
-   = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
-   = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-   = note: `#[warn(unknown_lints)]` on by default
-
-warning: unknown lint: `private_bounds`
-  --> $DIR/feature-gate-type_privacy_lints.rs:6:1
-   |
-LL | #![warn(private_bounds)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: the `private_bounds` lint is unstable
-   = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
-   = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
 warning: unknown lint: `unnameable_types`
-  --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+  --> $DIR/feature-gate-type_privacy_lints.rs:3:1
    |
 LL | #![warn(unnameable_types)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -28,29 +7,10 @@ LL | #![warn(unnameable_types)]
    = note: the `unnameable_types` lint is unstable
    = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
    = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
-warning: unknown lint: `private_interfaces`
-  --> $DIR/feature-gate-type_privacy_lints.rs:3:1
-   |
-LL | #![warn(private_interfaces)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: the `private_interfaces` lint is unstable
-   = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
-   = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
-warning: unknown lint: `private_bounds`
-  --> $DIR/feature-gate-type_privacy_lints.rs:6:1
-   |
-LL | #![warn(private_bounds)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: the `private_bounds` lint is unstable
-   = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
-   = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+   = note: `#[warn(unknown_lints)]` on by default
 
 warning: unknown lint: `unnameable_types`
-  --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+  --> $DIR/feature-gate-type_privacy_lints.rs:3:1
    |
 LL | #![warn(unnameable_types)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -59,28 +19,8 @@ LL | #![warn(unnameable_types)]
    = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
    = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
 
-warning: unknown lint: `private_interfaces`
-  --> $DIR/feature-gate-type_privacy_lints.rs:3:1
-   |
-LL | #![warn(private_interfaces)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: the `private_interfaces` lint is unstable
-   = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
-   = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
-warning: unknown lint: `private_bounds`
-  --> $DIR/feature-gate-type_privacy_lints.rs:6:1
-   |
-LL | #![warn(private_bounds)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: the `private_bounds` lint is unstable
-   = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
-   = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
 warning: unknown lint: `unnameable_types`
-  --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+  --> $DIR/feature-gate-type_privacy_lints.rs:3:1
    |
 LL | #![warn(unnameable_types)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -89,5 +29,5 @@ LL | #![warn(unnameable_types)]
    = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
    = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
 
-warning: 9 warnings emitted
+warning: 3 warnings emitted
 
diff --git a/tests/ui/issues/issue-18389.rs b/tests/ui/issues/issue-18389.rs
index 05a5decf462..26b607f4081 100644
--- a/tests/ui/issues/issue-18389.rs
+++ b/tests/ui/issues/issue-18389.rs
@@ -1,9 +1,4 @@
-#![feature(type_privacy_lints)]
-#![warn(private_bounds)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
+// check-pass
 
 use std::any::Any;
 use std::any::TypeId;
@@ -12,8 +7,7 @@ trait Private<P, R> {
     fn call(&self, p: P, r: R);
 }
 pub trait Public: Private<
-//~^ ERROR private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
-//~| WARNING trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public`
+//~^ WARNING trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public`
     <Self as Public>::P,
     <Self as Public>::R
 > {
diff --git a/tests/ui/issues/issue-18389.stderr b/tests/ui/issues/issue-18389.stderr
index 18ffc4177d7..4706d1ba177 100644
--- a/tests/ui/issues/issue-18389.stderr
+++ b/tests/ui/issues/issue-18389.stderr
@@ -1,39 +1,19 @@
-error[E0445]: private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
-  --> $DIR/issue-18389.rs:14:1
-   |
-LL |   trait Private<P, R> {
-   |   ------------------- `Private<<Self as Public>::P, <Self as Public>::R>` declared as private
-...
-LL | / pub trait Public: Private<
-LL | |
-LL | |
-LL | |     <Self as Public>::P,
-LL | |     <Self as Public>::R
-LL | | > {
-   | |_^ can't leak private trait
-
 warning: trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public`
-  --> $DIR/issue-18389.rs:14:1
+  --> $DIR/issue-18389.rs:9:1
    |
 LL | / pub trait Public: Private<
 LL | |
-LL | |
 LL | |     <Self as Public>::P,
 LL | |     <Self as Public>::R
 LL | | > {
    | |_^ trait `Public` is reachable at visibility `pub`
    |
 note: but trait `Private<<Self as Public>::P, <Self as Public>::R>` is only usable at visibility `pub(crate)`
-  --> $DIR/issue-18389.rs:11:1
+  --> $DIR/issue-18389.rs:6:1
    |
 LL | trait Private<P, R> {
    | ^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/issue-18389.rs:2:9
-   |
-LL | #![warn(private_bounds)]
-   |         ^^^^^^^^^^^^^^
+   = note: `#[warn(private_bounds)]` on by default
 
-error: aborting due to previous error; 1 warning emitted
+warning: 1 warning emitted
 
-For more information about this error, try `rustc --explain E0445`.
diff --git a/tests/ui/lint/issue-99387.rs b/tests/ui/lint/issue-99387.rs
index ba5031167e3..571d4194fe7 100644
--- a/tests/ui/lint/issue-99387.rs
+++ b/tests/ui/lint/issue-99387.rs
@@ -2,7 +2,7 @@
 //! opaque types.
 
 #![feature(type_alias_impl_trait)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
 
 pub type Successors<'a> = impl Iterator<Item = &'a ()>;
 
diff --git a/tests/ui/lint/lint-ctypes-fn.rs b/tests/ui/lint/lint-ctypes-fn.rs
index d3b36a9d59c..14831e24718 100644
--- a/tests/ui/lint/lint-ctypes-fn.rs
+++ b/tests/ui/lint/lint-ctypes-fn.rs
@@ -1,6 +1,6 @@
 #![feature(rustc_private)]
 
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
 #![deny(improper_ctypes_definitions)]
 
 extern crate libc;
diff --git a/tests/ui/lint/lint-ctypes.rs b/tests/ui/lint/lint-ctypes.rs
index 9165e14b7ff..3dd731625f4 100644
--- a/tests/ui/lint/lint-ctypes.rs
+++ b/tests/ui/lint/lint-ctypes.rs
@@ -1,6 +1,6 @@
 #![feature(rustc_private)]
 
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
 #![deny(improper_ctypes)]
 
 extern crate libc;
diff --git a/tests/ui/privacy/associated-item-privacy-inherent.rs b/tests/ui/privacy/associated-item-privacy-inherent.rs
index 7b7c734a99a..81703ae1067 100644
--- a/tests/ui/privacy/associated-item-privacy-inherent.rs
+++ b/tests/ui/privacy/associated-item-privacy-inherent.rs
@@ -1,5 +1,5 @@
 #![feature(decl_macro, associated_type_defaults)]
-#![allow(unused, private_in_public)]
+#![allow(private_interfaces)]
 
 mod priv_nominal {
     pub struct Pub;
diff --git a/tests/ui/privacy/associated-item-privacy-trait.rs b/tests/ui/privacy/associated-item-privacy-trait.rs
index c686a21772e..db77a6a7258 100644
--- a/tests/ui/privacy/associated-item-privacy-trait.rs
+++ b/tests/ui/privacy/associated-item-privacy-trait.rs
@@ -1,5 +1,5 @@
 #![feature(decl_macro, associated_type_defaults)]
-#![allow(unused, private_in_public)]
+#![allow(private_interfaces, private_bounds)]
 
 mod priv_trait {
     trait PrivTr {
diff --git a/tests/ui/privacy/associated-item-privacy-type-binding.rs b/tests/ui/privacy/associated-item-privacy-type-binding.rs
index 9826b83a35d..95a4fbf639c 100644
--- a/tests/ui/privacy/associated-item-privacy-type-binding.rs
+++ b/tests/ui/privacy/associated-item-privacy-type-binding.rs
@@ -1,5 +1,5 @@
 #![feature(decl_macro, associated_type_defaults)]
-#![allow(unused, private_in_public)]
+#![allow(private_interfaces, private_bounds)]
 
 mod priv_trait {
     trait PrivTr {
diff --git a/tests/ui/privacy/effective_visibilities_full_priv.rs b/tests/ui/privacy/effective_visibilities_full_priv.rs
index a26ae3bd122..b96eddcab67 100644
--- a/tests/ui/privacy/effective_visibilities_full_priv.rs
+++ b/tests/ui/privacy/effective_visibilities_full_priv.rs
@@ -1,5 +1,5 @@
 #![feature(rustc_attrs)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
 
 struct SemiPriv;
 
diff --git a/tests/ui/privacy/issue-30079.rs b/tests/ui/privacy/issue-30079.rs
index a02a932d057..ddba629f528 100644
--- a/tests/ui/privacy/issue-30079.rs
+++ b/tests/ui/privacy/issue-30079.rs
@@ -3,8 +3,7 @@ struct SemiPriv;
 mod m1 {
     struct Priv;
     impl ::SemiPriv {
-        pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public interface
-        //~^ WARNING hard error
+        pub fn f(_: Priv) {} //~ WARN type `m1::Priv` is more private than the item `m1::<impl SemiPriv>::f`
     }
 
     impl Priv {
diff --git a/tests/ui/privacy/issue-30079.stderr b/tests/ui/privacy/issue-30079.stderr
index 9179ff339bf..f1facba7cd2 100644
--- a/tests/ui/privacy/issue-30079.stderr
+++ b/tests/ui/privacy/issue-30079.stderr
@@ -1,15 +1,18 @@
-warning: private type `m1::Priv` in public interface (error E0446)
+warning: type `m1::Priv` is more private than the item `m1::<impl SemiPriv>::f`
   --> $DIR/issue-30079.rs:6:9
    |
 LL |         pub fn f(_: Priv) {}
-   |         ^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^ associated function `m1::<impl SemiPriv>::f` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-   = note: `#[warn(private_in_public)]` on by default
+note: but type `m1::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/issue-30079.rs:4:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
+   = note: `#[warn(private_interfaces)]` on by default
 
 error[E0446]: private type `m2::Priv` in public interface
-  --> $DIR/issue-30079.rs:18:9
+  --> $DIR/issue-30079.rs:17:9
    |
 LL |     struct Priv;
    |     ----------- `m2::Priv` declared as private
@@ -18,7 +21,7 @@ LL |         type Target = Priv;
    |         ^^^^^^^^^^^ can't leak private type
 
 error[E0446]: private type `m3::Priv` in public interface
-  --> $DIR/issue-30079.rs:35:9
+  --> $DIR/issue-30079.rs:34:9
    |
 LL |     struct Priv;
    |     ----------- `m3::Priv` declared as private
diff --git a/tests/ui/privacy/private-in-public-assoc-ty.rs b/tests/ui/privacy/private-in-public-assoc-ty.rs
index d4d379bdb73..5f7c4bcf265 100644
--- a/tests/ui/privacy/private-in-public-assoc-ty.rs
+++ b/tests/ui/privacy/private-in-public-assoc-ty.rs
@@ -22,14 +22,11 @@ mod m {
     // applies only to the aliased types, not bounds.
     pub trait PubTr {
         type Alias1: PrivTr;
-        //~^ WARN private trait `PrivTr` in public interface
-        //~| WARN this was previously accepted
+        //~^ WARN trait `PrivTr` is more private than the item `PubTr::Alias1`
         type Alias2: PubTrAux1<Priv> = u8;
-        //~^ WARN private type `Priv` in public interface
-        //~| WARN this was previously accepted
+        //~^ WARN type `Priv` is more private than the item `PubTr::Alias2`
         type Alias3: PubTrAux2<A = Priv> = u8;
-        //~^ WARN private type `Priv` in public interface
-        //~| WARN this was previously accepted
+        //~^ WARN type `Priv` is more private than the item `PubTr::Alias3`
 
         type Alias4 = Priv;
         //~^ ERROR private type `Priv` in public interface
diff --git a/tests/ui/privacy/private-in-public-assoc-ty.stderr b/tests/ui/privacy/private-in-public-assoc-ty.stderr
index a59027d81d2..0931e6d9971 100644
--- a/tests/ui/privacy/private-in-public-assoc-ty.stderr
+++ b/tests/ui/privacy/private-in-public-assoc-ty.stderr
@@ -7,36 +7,45 @@ LL |     struct Priv;
 LL |         type A = Priv;
    |         ^^^^^^ can't leak private type
 
-warning: private trait `PrivTr` in public interface (error E0445)
+warning: trait `PrivTr` is more private than the item `PubTr::Alias1`
   --> $DIR/private-in-public-assoc-ty.rs:24:9
    |
 LL |         type Alias1: PrivTr;
-   |         ^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^ associated type `PubTr::Alias1` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-   = note: `#[warn(private_in_public)]` on by default
+note: but trait `PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-assoc-ty.rs:9:5
+   |
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
+   = note: `#[warn(private_bounds)]` on by default
 
-warning: private type `Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-assoc-ty.rs:27:9
+warning: type `Priv` is more private than the item `PubTr::Alias2`
+  --> $DIR/private-in-public-assoc-ty.rs:26:9
    |
 LL |         type Alias2: PubTrAux1<Priv> = u8;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `PubTr::Alias2` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-assoc-ty.rs:8:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-warning: private type `Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-assoc-ty.rs:30:9
+warning: type `Priv` is more private than the item `PubTr::Alias3`
+  --> $DIR/private-in-public-assoc-ty.rs:28:9
    |
 LL |         type Alias3: PubTrAux2<A = Priv> = u8;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `PubTr::Alias3` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-assoc-ty.rs:8:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
 error[E0446]: private type `Priv` in public interface
-  --> $DIR/private-in-public-assoc-ty.rs:34:9
+  --> $DIR/private-in-public-assoc-ty.rs:31:9
    |
 LL |     struct Priv;
    |     ----------- `Priv` declared as private
@@ -45,7 +54,7 @@ LL |         type Alias4 = Priv;
    |         ^^^^^^^^^^^ can't leak private type
 
 error[E0446]: private type `Priv` in public interface
-  --> $DIR/private-in-public-assoc-ty.rs:41:9
+  --> $DIR/private-in-public-assoc-ty.rs:38:9
    |
 LL |     struct Priv;
    |     ----------- `Priv` declared as private
@@ -53,8 +62,8 @@ LL |     struct Priv;
 LL |         type Alias1 = Priv;
    |         ^^^^^^^^^^^ can't leak private type
 
-error[E0445]: private trait `PrivTr` in public interface
-  --> $DIR/private-in-public-assoc-ty.rs:44:9
+error[E0446]: private trait `PrivTr` in public interface
+  --> $DIR/private-in-public-assoc-ty.rs:41:9
    |
 LL |     trait PrivTr {}
    |     ------------ `PrivTr` declared as private
@@ -64,5 +73,4 @@ LL |         type Exist = impl PrivTr;
 
 error: aborting due to 4 previous errors; 3 warnings emitted
 
-Some errors have detailed explanations: E0445, E0446.
-For more information about an error, try `rustc --explain E0445`.
+For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/private-in-public-lint.rs b/tests/ui/privacy/private-in-public-lint.rs
deleted file mode 100644
index 8b6e4360160..00000000000
--- a/tests/ui/privacy/private-in-public-lint.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-mod m1 {
-    pub struct Pub;
-    struct Priv;
-
-    impl Pub {
-        pub fn f() -> Priv {Priv} //~ ERROR private type `m1::Priv` in public interface
-    }
-}
-
-mod m2 {
-    pub struct Pub;
-    struct Priv;
-
-    impl Pub {
-        pub fn f() -> Priv {Priv} //~ ERROR private type `m2::Priv` in public interface
-    }
-}
-
-fn main() {}
diff --git a/tests/ui/privacy/private-in-public-lint.stderr b/tests/ui/privacy/private-in-public-lint.stderr
deleted file mode 100644
index 1e98e3bed14..00000000000
--- a/tests/ui/privacy/private-in-public-lint.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0446]: private type `m1::Priv` in public interface
-  --> $DIR/private-in-public-lint.rs:6:9
-   |
-LL |     struct Priv;
-   |     ----------- `m1::Priv` declared as private
-...
-LL |         pub fn f() -> Priv {Priv}
-   |         ^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `m2::Priv` in public interface
-  --> $DIR/private-in-public-lint.rs:15:9
-   |
-LL |     struct Priv;
-   |     ----------- `m2::Priv` declared as private
-...
-LL |         pub fn f() -> Priv {Priv}
-   |         ^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/private-in-public-non-principal-2.rs b/tests/ui/privacy/private-in-public-non-principal-2.rs
index db451d33429..d7223c647c0 100644
--- a/tests/ui/privacy/private-in-public-non-principal-2.rs
+++ b/tests/ui/privacy/private-in-public-non-principal-2.rs
@@ -1,7 +1,7 @@
 #![feature(auto_traits)]
 #![feature(negative_impls)]
 
-#[allow(private_in_public)]
+#[allow(private_interfaces)]
 mod m {
     pub trait PubPrincipal {}
     auto trait PrivNonPrincipal {}
diff --git a/tests/ui/privacy/private-in-public-non-principal.rs b/tests/ui/privacy/private-in-public-non-principal.rs
index a2284c93027..e348a181651 100644
--- a/tests/ui/privacy/private-in-public-non-principal.rs
+++ b/tests/ui/privacy/private-in-public-non-principal.rs
@@ -1,19 +1,11 @@
 #![feature(auto_traits)]
 #![feature(negative_impls)]
-#![feature(type_privacy_lints)]
-#![deny(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
 
 pub trait PubPrincipal {}
 auto trait PrivNonPrincipal {}
 
 pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
-//~^ WARN private trait `PrivNonPrincipal` in public interface
-//~| WARN this was previously accepted
-//~| ERROR trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
+//~^ WARN trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
 
 #[deny(missing_docs)]
 fn container() {
diff --git a/tests/ui/privacy/private-in-public-non-principal.stderr b/tests/ui/privacy/private-in-public-non-principal.stderr
index 1387f59cbde..63512f462f5 100644
--- a/tests/ui/privacy/private-in-public-non-principal.stderr
+++ b/tests/ui/privacy/private-in-public-non-principal.stderr
@@ -1,41 +1,27 @@
-warning: private trait `PrivNonPrincipal` in public interface (error E0445)
-  --> $DIR/private-in-public-non-principal.rs:13:1
-   |
-LL | pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-   = note: `#[warn(private_in_public)]` on by default
-
-error: trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
-  --> $DIR/private-in-public-non-principal.rs:13:1
+warning: trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
+  --> $DIR/private-in-public-non-principal.rs:7:1
    |
 LL | pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `leak_dyn_nonprincipal` is reachable at visibility `pub`
    |
 note: but trait `PrivNonPrincipal` is only usable at visibility `pub(crate)`
-  --> $DIR/private-in-public-non-principal.rs:11:1
+  --> $DIR/private-in-public-non-principal.rs:5:1
    |
 LL | auto trait PrivNonPrincipal {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/private-in-public-non-principal.rs:4:9
-   |
-LL | #![deny(private_interfaces)]
-   |         ^^^^^^^^^^^^^^^^^^
+   = note: `#[warn(private_interfaces)]` on by default
 
 error: missing documentation for an associated function
-  --> $DIR/private-in-public-non-principal.rs:21:9
+  --> $DIR/private-in-public-non-principal.rs:13:9
    |
 LL |         pub fn check_doc_lint() {}
    |         ^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: the lint level is defined here
-  --> $DIR/private-in-public-non-principal.rs:18:8
+  --> $DIR/private-in-public-non-principal.rs:10:8
    |
 LL | #[deny(missing_docs)]
    |        ^^^^^^^^^^^^
 
-error: aborting due to 2 previous errors; 1 warning emitted
+error: aborting due to previous error; 1 warning emitted
 
diff --git a/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs b/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs
index fe6ed46734c..3fb543e9624 100644
--- a/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs
+++ b/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs
@@ -1,7 +1,7 @@
 // build-pass (FIXME(62277): could be check-pass?)
 #![feature(impl_trait_in_assoc_type)]
 #![feature(type_alias_impl_trait)]
-#![deny(private_in_public)]
+#![deny(private_interfaces, private_bounds)]
 
 pub type Pub = impl Default;
 
diff --git a/tests/ui/privacy/private-in-public-warn.rs b/tests/ui/privacy/private-in-public-warn.rs
index 0fa1de975b0..99d318e36be 100644
--- a/tests/ui/privacy/private-in-public-warn.rs
+++ b/tests/ui/privacy/private-in-public-warn.rs
@@ -2,7 +2,7 @@
 // This test also ensures that the checks are performed even inside private modules.
 
 #![feature(associated_type_defaults)]
-#![deny(private_in_public)]
+#![deny(private_interfaces, private_bounds)]
 #![allow(improper_ctypes)]
 
 mod types {
@@ -12,30 +12,21 @@ mod types {
         type Alias;
     }
 
-    pub type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
-    //~^ WARNING hard error
+    pub type Alias = Priv; //~ ERROR type `types::Priv` is more private than the item `types::Alias`
     pub enum E {
-        V1(Priv), //~ ERROR private type `types::Priv` in public interface
-        //~^ WARNING hard error
-        V2 { field: Priv }, //~ ERROR private type `types::Priv` in public interface
-        //~^ WARNING hard error
+        V1(Priv), //~ ERROR type `types::Priv` is more private than the item `E::V1::0`
+        V2 { field: Priv }, //~ ERROR type `types::Priv` is more private than the item `E::V2::field`
     }
     pub trait Tr {
-        const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
-        //~^ WARNING hard error
+        const C: Priv = Priv; //~ ERROR type `types::Priv` is more private than the item `Tr::C`
         type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
-        fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
-        //~^ WARNING hard error
-        fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
-        //~^ WARNING hard error
+        fn f1(arg: Priv) {} //~ ERROR type `types::Priv` is more private than the item `Tr::f1`
+        fn f2() -> Priv { panic!() } //~ ERROR type `types::Priv` is more private than the item `Tr::f2`
     }
     extern "C" {
-        pub static ES: Priv; //~ ERROR private type `types::Priv` in public interface
-        //~^ WARNING hard error
-        pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in public interface
-        //~^ WARNING hard error
-        pub fn ef2() -> Priv; //~ ERROR private type `types::Priv` in public interface
-        //~^ WARNING hard error
+        pub static ES: Priv; //~ ERROR type `types::Priv` is more private than the item `types::ES`
+        pub fn ef1(arg: Priv); //~ ERROR type `types::Priv` is more private than the item `types::ef1`
+        pub fn ef2() -> Priv; //~ ERROR type `types::Priv` is more private than the item `types::ef2`
     }
     impl PubTr for Pub {
         type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
@@ -47,22 +38,16 @@ mod traits {
     pub struct Pub<T>(T);
     pub trait PubTr {}
 
-    pub type Alias<T: PrivTr> = T; //~ ERROR private trait `traits::PrivTr` in public interface
-    //~| WARNING hard error
-    //~| WARNING bounds on generic parameters are not enforced in type aliases
-    pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in public interface
-    //~^ WARNING hard error
-    pub trait Tr2<T: PrivTr> {} //~ ERROR private trait `traits::PrivTr` in public interface
-        //~^ WARNING hard error
+    pub type Alias<T: PrivTr> = T; //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Alias`
+    //~^ WARNING bounds on generic parameters are not enforced in type aliases
+    pub trait Tr1: PrivTr {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr1`
+    pub trait Tr2<T: PrivTr> {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr2`
     pub trait Tr3 {
         type Alias: PrivTr;
-        //~^ ERROR private trait `traits::PrivTr` in public interface
-        //~| WARNING hard error
-        fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface
-        //~^ WARNING hard error
+        //~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::Alias`
+        fn f<T: PrivTr>(arg: T) {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
     }
-    impl<T: PrivTr> Pub<T> {} //~ ERROR private trait `traits::PrivTr` in public interface
-        //~^ WARNING hard error
+    impl<T: PrivTr> Pub<T> {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
     impl<T: PrivTr> PubTr for Pub<T> {} // OK, trait impl predicates
 }
 
@@ -72,20 +57,16 @@ mod traits_where {
     pub trait PubTr {}
 
     pub type Alias<T> where T: PrivTr = T;
-        //~^ ERROR private trait `traits_where::PrivTr` in public interface
-        //~| WARNING hard error
+        //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Alias`
         //~| WARNING where clauses are not enforced in type aliases
     pub trait Tr2<T> where T: PrivTr {}
-        //~^ ERROR private trait `traits_where::PrivTr` in public interface
-        //~| WARNING hard error
+        //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Tr2`
     pub trait Tr3 {
         fn f<T>(arg: T) where T: PrivTr {}
-        //~^ ERROR private trait `traits_where::PrivTr` in public interface
-        //~| WARNING hard error
+        //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Tr3::f`
     }
     impl<T> Pub<T> where T: PrivTr {}
-        //~^ ERROR private trait `traits_where::PrivTr` in public interface
-        //~| WARNING hard error
+        //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
     impl<T> PubTr for Pub<T> where T: PrivTr {} // OK, trait impl predicates
 }
 
@@ -96,14 +77,10 @@ mod generics {
     pub trait PubTr<T> {}
 
     pub trait Tr1: PrivTr<Pub> {}
-        //~^ ERROR private trait `generics::PrivTr<generics::Pub>` in public interface
-        //~| WARNING hard error
-    pub trait Tr2: PubTr<Priv> {} //~ ERROR private type `generics::Priv` in public interface
-        //~^ WARNING hard error
-    pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Priv` in public interface
-        //~^ WARNING hard error
-    pub trait Tr4: PubTr<Pub<Priv>> {} //~ ERROR private type `generics::Priv` in public interface
-        //~^ WARNING hard error
+        //~^ ERROR trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
+    pub trait Tr2: PubTr<Priv> {} //~ ERROR type `generics::Priv` is more private than the item `generics::Tr2`
+    pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR type `generics::Priv` is more private than the item `generics::Tr3`
+    pub trait Tr4: PubTr<Pub<Priv>> {} //~ ERROR type `generics::Priv` is more private than the item `Tr4`
 }
 
 mod impls {
@@ -200,8 +177,7 @@ mod aliases_pub {
     pub trait Tr2: PrivUseAliasTr<PrivAlias> {} // OK
 
     impl PrivAlias {
-        pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface
-        //~^ WARNING hard error
+        pub fn f(arg: Priv) {} //~ ERROR type `aliases_pub::Priv` is more private than the item `aliases_pub::<impl Pub2>::f`
     }
     impl PrivUseAliasTr for PrivUseAlias {
         type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface
@@ -244,13 +220,10 @@ mod aliases_priv {
     }
 
     pub trait Tr1: PrivUseAliasTr {}
-        //~^ ERROR private trait `PrivTr1` in public interface
-        //~| WARNING hard error
+        //~^ ERROR trait `PrivTr1` is more private than the item `aliases_priv::Tr1`
     pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
-        //~^ ERROR private trait `PrivTr1<Priv2>` in public interface
-        //~| WARNING hard error
-        //~| ERROR private type `Priv2` in public interface
-        //~| WARNING hard error
+        //~^ ERROR trait `PrivTr1<Priv2>` is more private than the item `aliases_priv::Tr2`
+        //~| ERROR type `Priv2` is more private than the item `aliases_priv::Tr2`
 
     impl PrivUseAlias {
         pub fn f(arg: Priv) {} // OK
diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr
index 66f91ce6fd6..6497b7ff535 100644
--- a/tests/ui/privacy/private-in-public-warn.stderr
+++ b/tests/ui/privacy/private-in-public-warn.stderr
@@ -1,46 +1,58 @@
-error: private type `types::Priv` in public interface (error E0446)
+error: type `types::Priv` is more private than the item `types::Alias`
   --> $DIR/private-in-public-warn.rs:15:5
    |
 LL |     pub type Alias = Priv;
-   |     ^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^ type alias `types::Alias` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:9:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 note: the lint level is defined here
   --> $DIR/private-in-public-warn.rs:5:9
    |
-LL | #![deny(private_in_public)]
-   |         ^^^^^^^^^^^^^^^^^
+LL | #![deny(private_interfaces, private_bounds)]
+   |         ^^^^^^^^^^^^^^^^^^
 
-error: private type `types::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:18:12
+error: type `types::Priv` is more private than the item `E::V1::0`
+  --> $DIR/private-in-public-warn.rs:17:12
    |
 LL |         V1(Priv),
-   |            ^^^^
+   |            ^^^^ field `E::V1::0` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:9:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-error: private type `types::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:20:14
+error: type `types::Priv` is more private than the item `E::V2::field`
+  --> $DIR/private-in-public-warn.rs:18:14
    |
 LL |         V2 { field: Priv },
-   |              ^^^^^^^^^^^
+   |              ^^^^^^^^^^^ field `E::V2::field` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:9:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-error: private type `types::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:24:9
+error: type `types::Priv` is more private than the item `Tr::C`
+  --> $DIR/private-in-public-warn.rs:21:9
    |
 LL |         const C: Priv = Priv;
-   |         ^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^ associated constant `Tr::C` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:9:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
 error[E0446]: private type `types::Priv` in public interface
-  --> $DIR/private-in-public-warn.rs:26:9
+  --> $DIR/private-in-public-warn.rs:22:9
    |
 LL |     struct Priv;
    |     ----------- `types::Priv` declared as private
@@ -48,53 +60,68 @@ LL |     struct Priv;
 LL |         type Alias = Priv;
    |         ^^^^^^^^^^ can't leak private type
 
-error: private type `types::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:27:9
+error: type `types::Priv` is more private than the item `Tr::f1`
+  --> $DIR/private-in-public-warn.rs:23:9
    |
 LL |         fn f1(arg: Priv) {}
-   |         ^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^ associated function `Tr::f1` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:9:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-error: private type `types::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:29:9
+error: type `types::Priv` is more private than the item `Tr::f2`
+  --> $DIR/private-in-public-warn.rs:24:9
    |
 LL |         fn f2() -> Priv { panic!() }
-   |         ^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^ associated function `Tr::f2` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:9:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-error: private type `types::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:33:9
+error: type `types::Priv` is more private than the item `types::ES`
+  --> $DIR/private-in-public-warn.rs:27:9
    |
 LL |         pub static ES: Priv;
-   |         ^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^ static `types::ES` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:9:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-error: private type `types::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:35:9
+error: type `types::Priv` is more private than the item `types::ef1`
+  --> $DIR/private-in-public-warn.rs:28:9
    |
 LL |         pub fn ef1(arg: Priv);
-   |         ^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^ function `types::ef1` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:9:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-error: private type `types::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:37:9
+error: type `types::Priv` is more private than the item `types::ef2`
+  --> $DIR/private-in-public-warn.rs:29:9
    |
 LL |         pub fn ef2() -> Priv;
-   |         ^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^ function `types::ef2` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:9:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
 error[E0446]: private type `types::Priv` in public interface
-  --> $DIR/private-in-public-warn.rs:41:9
+  --> $DIR/private-in-public-warn.rs:32:9
    |
 LL |     struct Priv;
    |     ----------- `types::Priv` declared as private
@@ -102,134 +129,181 @@ LL |     struct Priv;
 LL |         type Alias = Priv;
    |         ^^^^^^^^^^ can't leak private type
 
-error: private trait `traits::PrivTr` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:50:5
+error: trait `traits::PrivTr` is more private than the item `traits::Alias`
+  --> $DIR/private-in-public-warn.rs:41:5
    |
 LL |     pub type Alias<T: PrivTr> = T;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ type alias `traits::Alias` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:37:5
+   |
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
+note: the lint level is defined here
+  --> $DIR/private-in-public-warn.rs:5:29
+   |
+LL | #![deny(private_interfaces, private_bounds)]
+   |                             ^^^^^^^^^^^^^^
 
-error: private trait `traits::PrivTr` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:53:5
+error: trait `traits::PrivTr` is more private than the item `traits::Tr1`
+  --> $DIR/private-in-public-warn.rs:43:5
    |
 LL |     pub trait Tr1: PrivTr {}
-   |     ^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^ trait `traits::Tr1` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:37:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
 
-error: private trait `traits::PrivTr` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:55:5
+error: trait `traits::PrivTr` is more private than the item `traits::Tr2`
+  --> $DIR/private-in-public-warn.rs:44:5
    |
 LL |     pub trait Tr2<T: PrivTr> {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ trait `traits::Tr2` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:37:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
 
-error: private trait `traits::PrivTr` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:58:9
+error: trait `traits::PrivTr` is more private than the item `traits::Tr3::Alias`
+  --> $DIR/private-in-public-warn.rs:46:9
    |
 LL |         type Alias: PrivTr;
-   |         ^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^ associated type `traits::Tr3::Alias` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:37:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
 
-error: private trait `traits::PrivTr` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:61:9
+error: trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
+  --> $DIR/private-in-public-warn.rs:48:9
    |
 LL |         fn f<T: PrivTr>(arg: T) {}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits::Tr3::f` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:37:5
+   |
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
 
-error: private trait `traits::PrivTr` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:64:5
+error: trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
+  --> $DIR/private-in-public-warn.rs:50:5
    |
 LL |     impl<T: PrivTr> Pub<T> {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^ implementation `traits::Pub<T>` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:37:5
+   |
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
 
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:74:5
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Alias`
+  --> $DIR/private-in-public-warn.rs:59:5
    |
 LL |     pub type Alias<T> where T: PrivTr = T;
-   |     ^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^ type alias `traits_where::Alias` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:55:5
+   |
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
 
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:78:5
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr2`
+  --> $DIR/private-in-public-warn.rs:62:5
    |
 LL |     pub trait Tr2<T> where T: PrivTr {}
-   |     ^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^ trait `traits_where::Tr2` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:55:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
 
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:82:9
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr3::f`
+  --> $DIR/private-in-public-warn.rs:65:9
    |
 LL |         fn f<T>(arg: T) where T: PrivTr {}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits_where::Tr3::f` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:55:5
+   |
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
 
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:86:5
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
+  --> $DIR/private-in-public-warn.rs:68:5
    |
 LL |     impl<T> Pub<T> where T: PrivTr {}
-   |     ^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:55:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
 
-error: private trait `generics::PrivTr<generics::Pub>` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:98:5
+error: trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
+  --> $DIR/private-in-public-warn.rs:79:5
    |
 LL |     pub trait Tr1: PrivTr<Pub> {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr1` is reachable at visibility `pub(crate)`
+   |
+note: but trait `generics::PrivTr<generics::Pub>` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:76:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     trait PrivTr<T> {}
+   |     ^^^^^^^^^^^^^^^
 
-error: private type `generics::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:101:5
+error: type `generics::Priv` is more private than the item `generics::Tr2`
+  --> $DIR/private-in-public-warn.rs:81:5
    |
 LL |     pub trait Tr2: PubTr<Priv> {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr2` is reachable at visibility `pub(crate)`
+   |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:74:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     struct Priv<T = u8>(T);
+   |     ^^^^^^^^^^^^^^^^^^^
 
-error: private type `generics::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:103:5
+error: type `generics::Priv` is more private than the item `generics::Tr3`
+  --> $DIR/private-in-public-warn.rs:82:5
    |
 LL |     pub trait Tr3: PubTr<[Priv; 1]> {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr3` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:74:5
+   |
+LL |     struct Priv<T = u8>(T);
+   |     ^^^^^^^^^^^^^^^^^^^
 
-error: private type `generics::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:105:5
+error: type `generics::Priv` is more private than the item `Tr4`
+  --> $DIR/private-in-public-warn.rs:83:5
    |
 LL |     pub trait Tr4: PubTr<Pub<Priv>> {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `Tr4` is reachable at visibility `pub(crate)`
+   |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:74:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     struct Priv<T = u8>(T);
+   |     ^^^^^^^^^^^^^^^^^^^
 
 error[E0446]: private type `impls::Priv` in public interface
-  --> $DIR/private-in-public-warn.rs:132:9
+  --> $DIR/private-in-public-warn.rs:109:9
    |
 LL |     struct Priv;
    |     ----------- `impls::Priv` declared as private
@@ -237,17 +311,20 @@ LL |     struct Priv;
 LL |         type Alias = Priv;
    |         ^^^^^^^^^^ can't leak private type
 
-error: private type `aliases_pub::Priv` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:203:9
+error: type `aliases_pub::Priv` is more private than the item `aliases_pub::<impl Pub2>::f`
+  --> $DIR/private-in-public-warn.rs:180:9
    |
 LL |         pub fn f(arg: Priv) {}
-   |         ^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^ associated function `aliases_pub::<impl Pub2>::f` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `aliases_pub::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:153:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
 error[E0446]: private type `aliases_pub::Priv` in public interface
-  --> $DIR/private-in-public-warn.rs:207:9
+  --> $DIR/private-in-public-warn.rs:183:9
    |
 LL |     struct Priv;
    |     ----------- `aliases_pub::Priv` declared as private
@@ -256,7 +333,7 @@ LL |         type Check = Priv;
    |         ^^^^^^^^^^ can't leak private type
 
 error[E0446]: private type `aliases_pub::Priv` in public interface
-  --> $DIR/private-in-public-warn.rs:210:9
+  --> $DIR/private-in-public-warn.rs:186:9
    |
 LL |     struct Priv;
    |     ----------- `aliases_pub::Priv` declared as private
@@ -265,7 +342,7 @@ LL |         type Check = Priv;
    |         ^^^^^^^^^^ can't leak private type
 
 error[E0446]: private type `aliases_pub::Priv` in public interface
-  --> $DIR/private-in-public-warn.rs:213:9
+  --> $DIR/private-in-public-warn.rs:189:9
    |
 LL |     struct Priv;
    |     ----------- `aliases_pub::Priv` declared as private
@@ -274,7 +351,7 @@ LL |         type Check = Priv;
    |         ^^^^^^^^^^ can't leak private type
 
 error[E0446]: private type `aliases_pub::Priv` in public interface
-  --> $DIR/private-in-public-warn.rs:216:9
+  --> $DIR/private-in-public-warn.rs:192:9
    |
 LL |     struct Priv;
    |     ----------- `aliases_pub::Priv` declared as private
@@ -282,35 +359,44 @@ LL |     struct Priv;
 LL |         type Check = Priv;
    |         ^^^^^^^^^^ can't leak private type
 
-error: private trait `PrivTr1` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:246:5
+error: trait `PrivTr1` is more private than the item `aliases_priv::Tr1`
+  --> $DIR/private-in-public-warn.rs:222:5
    |
 LL |     pub trait Tr1: PrivUseAliasTr {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr1` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `PrivTr1` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:208:5
+   |
+LL |     trait PrivTr1<T = u8> {
+   |     ^^^^^^^^^^^^^^^^^^^^^
 
-error: private trait `PrivTr1<Priv2>` in public interface (error E0445)
-  --> $DIR/private-in-public-warn.rs:249:5
+error: trait `PrivTr1<Priv2>` is more private than the item `aliases_priv::Tr2`
+  --> $DIR/private-in-public-warn.rs:224:5
    |
 LL |     pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `PrivTr1<Priv2>` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:208:5
+   |
+LL |     trait PrivTr1<T = u8> {
+   |     ^^^^^^^^^^^^^^^^^^^^^
 
-error: private type `Priv2` in public interface (error E0446)
-  --> $DIR/private-in-public-warn.rs:249:5
+error: type `Priv2` is more private than the item `aliases_priv::Tr2`
+  --> $DIR/private-in-public-warn.rs:224:5
    |
 LL |     pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
+   |
+note: but type `Priv2` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public-warn.rs:206:5
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL |     struct Priv2;
+   |     ^^^^^^^^^^^^
 
 warning: bounds on generic parameters are not enforced in type aliases
-  --> $DIR/private-in-public-warn.rs:50:23
+  --> $DIR/private-in-public-warn.rs:41:23
    |
 LL |     pub type Alias<T: PrivTr> = T;
    |                       ^^^^^^
@@ -323,7 +409,7 @@ LL +     pub type Alias<T> = T;
    |
 
 warning: where clauses are not enforced in type aliases
-  --> $DIR/private-in-public-warn.rs:74:29
+  --> $DIR/private-in-public-warn.rs:59:29
    |
 LL |     pub type Alias<T> where T: PrivTr = T;
    |                             ^^^^^^^^^
diff --git a/tests/ui/privacy/private-in-public.rs b/tests/ui/privacy/private-in-public.rs
index dbd1c483f81..f54f9e38faa 100644
--- a/tests/ui/privacy/private-in-public.rs
+++ b/tests/ui/privacy/private-in-public.rs
@@ -1,3 +1,5 @@
+// check-pass
+
 // Private types and traits are not allowed in public interfaces.
 // This test also ensures that the checks are performed even inside private modules.
 
@@ -10,16 +12,16 @@ mod types {
         type Alias;
     }
 
-    pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
-    pub static S: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
-    pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
-    pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
-    pub struct S1(pub Priv); //~ ERROR private type `types::Priv` in public interface
-    pub struct S2 { pub field: Priv } //~ ERROR private type `types::Priv` in public interface
+    pub const C: Priv = Priv; //~ WARNING type `types::Priv` is more private than the item `C`
+    pub static S: Priv = Priv; //~ WARNING type `types::Priv` is more private than the item `S`
+    pub fn f1(arg: Priv) {} //~ WARNING `types::Priv` is more private than the item `types::f1`
+    pub fn f2() -> Priv { panic!() } //~ WARNING type `types::Priv` is more private than the item `types::f2`
+    pub struct S1(pub Priv); //~ WARNING type `types::Priv` is more private than the item `types::S1::0`
+    pub struct S2 { pub field: Priv } //~ WARNING `types::Priv` is more private than the item `S2::field`
     impl Pub {
-        pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
-        pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
-        pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
+        pub const C: Priv = Priv; //~ WARNING type `types::Priv` is more private than the item `types::Pub::C`
+        pub fn f1(arg: Priv) {} //~ WARNING type `types::Priv` is more private than the item `types::Pub::f1`
+        pub fn f2() -> Priv { panic!() } //~ WARNING type `types::Priv` is more private than the item `types::Pub::f2`
     }
 }
 
@@ -28,11 +30,11 @@ mod traits {
     pub struct Pub<T>(T);
     pub trait PubTr {}
 
-    pub enum E<T: PrivTr> { V(T) } //~ ERROR private trait `traits::PrivTr` in public interface
-    pub fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface
-    pub struct S1<T: PrivTr>(T); //~ ERROR private trait `traits::PrivTr` in public interface
-    impl<T: PrivTr> Pub<T> { //~ ERROR private trait `traits::PrivTr` in public interface
-        pub fn f<U: PrivTr>(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface
+    pub enum E<T: PrivTr> { V(T) } //~ WARNING trait `traits::PrivTr` is more private than the item `traits::E`
+    pub fn f<T: PrivTr>(arg: T) {} //~ WARNING trait `traits::PrivTr` is more private than the item `traits::f`
+    pub struct S1<T: PrivTr>(T); //~ WARNING trait `traits::PrivTr` is more private than the item `traits::S1`
+    impl<T: PrivTr> Pub<T> { //~ WARNING trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
+        pub fn f<U: PrivTr>(arg: U) {} //~ WARNING trait `traits::PrivTr` is more private than the item `traits::Pub::<T>::f`
     }
 }
 
@@ -42,15 +44,15 @@ mod traits_where {
     pub trait PubTr {}
 
     pub enum E<T> where T: PrivTr { V(T) }
-    //~^ ERROR private trait `traits_where::PrivTr` in public interface
+    //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::E`
     pub fn f<T>(arg: T) where T: PrivTr {}
-    //~^ ERROR private trait `traits_where::PrivTr` in public interface
+    //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::f`
     pub struct S1<T>(T) where T: PrivTr;
-    //~^ ERROR private trait `traits_where::PrivTr` in public interface
+    //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::S1`
     impl<T> Pub<T> where T: PrivTr {
-    //~^ ERROR private trait `traits_where::PrivTr` in public interface
+    //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
         pub fn f<U>(arg: U) where U: PrivTr {}
-        //~^ ERROR private trait `traits_where::PrivTr` in public interface
+        //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::Pub::<T>::f`
     }
 }
 
@@ -60,10 +62,10 @@ mod generics {
     trait PrivTr<T> {}
     pub trait PubTr<T> {}
 
-    pub fn f1(arg: [Priv; 1]) {} //~ ERROR private type `generics::Priv` in public interface
-    pub fn f2(arg: Pub<Priv>) {} //~ ERROR private type `generics::Priv` in public interface
+    pub fn f1(arg: [Priv; 1]) {} //~ WARNING type `generics::Priv` is more private than the item `generics::f1`
+    pub fn f2(arg: Pub<Priv>) {} //~ WARNING type `generics::Priv` is more private than the item `generics::f2`
     pub fn f3(arg: Priv<Pub>) {}
-    //~^ ERROR private type `generics::Priv<generics::Pub>` in public interface
+    //~^ WARNING type `generics::Priv<generics::Pub>` is more private than the item `generics::f3`
 }
 
 mod impls {
@@ -77,7 +79,7 @@ mod impls {
     }
 
     impl Pub {
-        pub fn f(arg: Priv) {} //~ ERROR private type `impls::Priv` in public interface
+        pub fn f(arg: Priv) {} //~ WARNING type `impls::Priv` is more private than the item `impls::Pub::f`
     }
 }
 
@@ -102,11 +104,11 @@ mod aliases_pub {
 
     // This should be OK, but associated type aliases are not substituted yet
     pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
-    //~^ ERROR private trait `aliases_pub::PrivTr` in public interface
-    //~| ERROR private type `aliases_pub::Priv` in public interface
+    //~^ WARNING trait `aliases_pub::PrivTr` is more private than the item `aliases_pub::f3`
+    //~| WARNING type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
 
     impl PrivUseAlias {
-        pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface
+        pub fn f(arg: Priv) {}
     }
 }
 
@@ -128,11 +130,11 @@ mod aliases_priv {
     }
     impl PrivTr for Priv {}
 
-    pub fn f1(arg: PrivUseAlias) {} //~ ERROR private type `Priv1` in public interface
-    pub fn f2(arg: PrivAlias) {} //~ ERROR private type `Priv2` in public interface
+    pub fn f1(arg: PrivUseAlias) {} //~ WARNING type `Priv1` is more private than the item `aliases_priv::f1`
+    pub fn f2(arg: PrivAlias) {} //~ WARNING type `Priv2` is more private than the item `aliases_priv::f2`
     pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
-    //~^ ERROR private trait `aliases_priv::PrivTr` in public interface
-    //~| ERROR private type `aliases_priv::Priv` in public interface
+    //~^ WARNING trait `aliases_priv::PrivTr` is more private than the item `aliases_priv::f3`
+    //~| WARNING type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
 }
 
 mod aliases_params {
@@ -141,8 +143,8 @@ mod aliases_params {
     type Result<T> = ::std::result::Result<T, Priv>;
 
     pub fn f2(arg: PrivAliasGeneric) {}
-    //~^ ERROR private type `aliases_params::Priv` in public interface
-    pub fn f3(arg: Result<u8>) {} //~ ERROR private type `aliases_params::Priv` in public interface
+    //~^ WARNING type `aliases_params::Priv` is more private than the item `aliases_params::f2`
+    pub fn f3(arg: Result<u8>) {} //~ WARNING type `aliases_params::Priv` is more private than the item `aliases_params::f3`
 }
 
 fn main() {}
diff --git a/tests/ui/privacy/private-in-public.stderr b/tests/ui/privacy/private-in-public.stderr
index 887eebf53ef..d8f9fd00716 100644
--- a/tests/ui/privacy/private-in-public.stderr
+++ b/tests/ui/privacy/private-in-public.stderr
@@ -1,292 +1,376 @@
-error[E0446]: private type `types::Priv` in public interface
-  --> $DIR/private-in-public.rs:13:5
+warning: type `types::Priv` is more private than the item `C`
+  --> $DIR/private-in-public.rs:15:5
    |
-LL |     struct Priv;
-   |     ----------- `types::Priv` declared as private
-...
 LL |     pub const C: Priv = Priv;
-   |     ^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `types::Priv` in public interface
-  --> $DIR/private-in-public.rs:14:5
+   |     ^^^^^^^^^^^^^^^^^ constant `C` is reachable at visibility `pub(crate)`
    |
-LL |     struct Priv;
-   |     ----------- `types::Priv` declared as private
-...
-LL |     pub static S: Priv = Priv;
-   |     ^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `types::Priv` in public interface
-  --> $DIR/private-in-public.rs:15:5
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:9:5
    |
 LL |     struct Priv;
-   |     ----------- `types::Priv` declared as private
-...
-LL |     pub fn f1(arg: Priv) {}
-   |     ^^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^
+   = note: `#[warn(private_interfaces)]` on by default
 
-error[E0446]: private type `types::Priv` in public interface
+warning: type `types::Priv` is more private than the item `S`
   --> $DIR/private-in-public.rs:16:5
    |
+LL |     pub static S: Priv = Priv;
+   |     ^^^^^^^^^^^^^^^^^^ static `S` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:9:5
+   |
 LL |     struct Priv;
-   |     ----------- `types::Priv` declared as private
-...
-LL |     pub fn f2() -> Priv { panic!() }
-   |     ^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^
 
-error[E0446]: private type `types::Priv` in public interface
-  --> $DIR/private-in-public.rs:17:19
+warning: type `types::Priv` is more private than the item `types::f1`
+  --> $DIR/private-in-public.rs:17:5
+   |
+LL |     pub fn f1(arg: Priv) {}
+   |     ^^^^^^^^^^^^^^^^^^^^ function `types::f1` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:9:5
    |
 LL |     struct Priv;
-   |     ----------- `types::Priv` declared as private
-...
-LL |     pub struct S1(pub Priv);
-   |                   ^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^
 
-error[E0446]: private type `types::Priv` in public interface
-  --> $DIR/private-in-public.rs:18:21
+warning: type `types::Priv` is more private than the item `types::f2`
+  --> $DIR/private-in-public.rs:18:5
+   |
+LL |     pub fn f2() -> Priv { panic!() }
+   |     ^^^^^^^^^^^^^^^^^^^ function `types::f2` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:9:5
    |
 LL |     struct Priv;
-   |     ----------- `types::Priv` declared as private
-...
-LL |     pub struct S2 { pub field: Priv }
-   |                     ^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^
 
-error[E0446]: private type `types::Priv` in public interface
-  --> $DIR/private-in-public.rs:20:9
+warning: type `types::Priv` is more private than the item `types::S1::0`
+  --> $DIR/private-in-public.rs:19:19
+   |
+LL |     pub struct S1(pub Priv);
+   |                   ^^^^^^^^ field `types::S1::0` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:9:5
    |
 LL |     struct Priv;
-   |     ----------- `types::Priv` declared as private
-...
-LL |         pub const C: Priv = Priv;
-   |         ^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^
 
-error[E0446]: private type `types::Priv` in public interface
-  --> $DIR/private-in-public.rs:21:9
+warning: type `types::Priv` is more private than the item `S2::field`
+  --> $DIR/private-in-public.rs:20:21
+   |
+LL |     pub struct S2 { pub field: Priv }
+   |                     ^^^^^^^^^^^^^^^ field `S2::field` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:9:5
    |
 LL |     struct Priv;
-   |     ----------- `types::Priv` declared as private
-...
-LL |         pub fn f1(arg: Priv) {}
-   |         ^^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^
 
-error[E0446]: private type `types::Priv` in public interface
+warning: type `types::Priv` is more private than the item `types::Pub::C`
   --> $DIR/private-in-public.rs:22:9
    |
+LL |         pub const C: Priv = Priv;
+   |         ^^^^^^^^^^^^^^^^^ associated constant `types::Pub::C` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:9:5
+   |
 LL |     struct Priv;
-   |     ----------- `types::Priv` declared as private
-...
-LL |         pub fn f2() -> Priv { panic!() }
-   |         ^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^
 
-error[E0445]: private trait `traits::PrivTr` in public interface
-  --> $DIR/private-in-public.rs:31:5
+warning: type `types::Priv` is more private than the item `types::Pub::f1`
+  --> $DIR/private-in-public.rs:23:9
    |
-LL |     trait PrivTr {}
-   |     ------------ `traits::PrivTr` declared as private
-...
-LL |     pub enum E<T: PrivTr> { V(T) }
-   |     ^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+LL |         pub fn f1(arg: Priv) {}
+   |         ^^^^^^^^^^^^^^^^^^^^ associated function `types::Pub::f1` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:9:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-error[E0445]: private trait `traits::PrivTr` in public interface
-  --> $DIR/private-in-public.rs:32:5
+warning: type `types::Priv` is more private than the item `types::Pub::f2`
+  --> $DIR/private-in-public.rs:24:9
    |
-LL |     trait PrivTr {}
-   |     ------------ `traits::PrivTr` declared as private
-...
-LL |     pub fn f<T: PrivTr>(arg: T) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+LL |         pub fn f2() -> Priv { panic!() }
+   |         ^^^^^^^^^^^^^^^^^^^ associated function `types::Pub::f2` is reachable at visibility `pub(crate)`
+   |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:9:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-error[E0445]: private trait `traits::PrivTr` in public interface
+warning: trait `traits::PrivTr` is more private than the item `traits::E`
   --> $DIR/private-in-public.rs:33:5
    |
+LL |     pub enum E<T: PrivTr> { V(T) }
+   |     ^^^^^^^^^^^^^^^^^^^^^ enum `traits::E` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:29:5
+   |
 LL |     trait PrivTr {}
-   |     ------------ `traits::PrivTr` declared as private
-...
-LL |     pub struct S1<T: PrivTr>(T);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+   |     ^^^^^^^^^^^^
+   = note: `#[warn(private_bounds)]` on by default
 
-error[E0445]: private trait `traits::PrivTr` in public interface
+warning: trait `traits::PrivTr` is more private than the item `traits::f`
   --> $DIR/private-in-public.rs:34:5
    |
+LL |     pub fn f<T: PrivTr>(arg: T) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `traits::f` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:29:5
+   |
 LL |     trait PrivTr {}
-   |     ------------ `traits::PrivTr` declared as private
-...
-LL |     impl<T: PrivTr> Pub<T> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+   |     ^^^^^^^^^^^^
 
-error[E0445]: private trait `traits::PrivTr` in public interface
-  --> $DIR/private-in-public.rs:35:9
+warning: trait `traits::PrivTr` is more private than the item `traits::S1`
+  --> $DIR/private-in-public.rs:35:5
+   |
+LL |     pub struct S1<T: PrivTr>(T);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ struct `traits::S1` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:29:5
    |
 LL |     trait PrivTr {}
-   |     ------------ `traits::PrivTr` declared as private
-...
-LL |         pub fn f<U: PrivTr>(arg: U) {}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+   |     ^^^^^^^^^^^^
 
-error[E0445]: private trait `traits_where::PrivTr` in public interface
-  --> $DIR/private-in-public.rs:44:5
+warning: trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
+  --> $DIR/private-in-public.rs:36:5
+   |
+LL |     impl<T: PrivTr> Pub<T> {
+   |     ^^^^^^^^^^^^^^^^^^^^^^ implementation `traits::Pub<T>` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:29:5
    |
 LL |     trait PrivTr {}
-   |     ------------ `traits_where::PrivTr` declared as private
-...
-LL |     pub enum E<T> where T: PrivTr { V(T) }
-   |     ^^^^^^^^^^^^^ can't leak private trait
+   |     ^^^^^^^^^^^^
 
-error[E0445]: private trait `traits_where::PrivTr` in public interface
+warning: trait `traits::PrivTr` is more private than the item `traits::Pub::<T>::f`
+  --> $DIR/private-in-public.rs:37:9
+   |
+LL |         pub fn f<U: PrivTr>(arg: U) {}
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits::Pub::<T>::f` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:29:5
+   |
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
+
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::E`
   --> $DIR/private-in-public.rs:46:5
    |
+LL |     pub enum E<T> where T: PrivTr { V(T) }
+   |     ^^^^^^^^^^^^^ enum `traits_where::E` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:42:5
+   |
 LL |     trait PrivTr {}
-   |     ------------ `traits_where::PrivTr` declared as private
-...
-LL |     pub fn f<T>(arg: T) where T: PrivTr {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+   |     ^^^^^^^^^^^^
 
-error[E0445]: private trait `traits_where::PrivTr` in public interface
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::f`
   --> $DIR/private-in-public.rs:48:5
    |
+LL |     pub fn f<T>(arg: T) where T: PrivTr {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `traits_where::f` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:42:5
+   |
 LL |     trait PrivTr {}
-   |     ------------ `traits_where::PrivTr` declared as private
-...
-LL |     pub struct S1<T>(T) where T: PrivTr;
-   |     ^^^^^^^^^^^^^^^^ can't leak private trait
+   |     ^^^^^^^^^^^^
 
-error[E0445]: private trait `traits_where::PrivTr` in public interface
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::S1`
   --> $DIR/private-in-public.rs:50:5
    |
+LL |     pub struct S1<T>(T) where T: PrivTr;
+   |     ^^^^^^^^^^^^^^^^ struct `traits_where::S1` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:42:5
+   |
 LL |     trait PrivTr {}
-   |     ------------ `traits_where::PrivTr` declared as private
-...
-LL |     impl<T> Pub<T> where T: PrivTr {
-   |     ^^^^^^^^^^^^^^ can't leak private trait
+   |     ^^^^^^^^^^^^
 
-error[E0445]: private trait `traits_where::PrivTr` in public interface
-  --> $DIR/private-in-public.rs:52:9
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
+  --> $DIR/private-in-public.rs:52:5
+   |
+LL |     impl<T> Pub<T> where T: PrivTr {
+   |     ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:42:5
    |
 LL |     trait PrivTr {}
-   |     ------------ `traits_where::PrivTr` declared as private
-...
+   |     ^^^^^^^^^^^^
+
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub::<T>::f`
+  --> $DIR/private-in-public.rs:54:9
+   |
 LL |         pub fn f<U>(arg: U) where U: PrivTr {}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits_where::Pub::<T>::f` is reachable at visibility `pub(crate)`
+   |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:42:5
+   |
+LL |     trait PrivTr {}
+   |     ^^^^^^^^^^^^
 
-error[E0446]: private type `generics::Priv` in public interface
-  --> $DIR/private-in-public.rs:63:5
+warning: type `generics::Priv` is more private than the item `generics::f1`
+  --> $DIR/private-in-public.rs:65:5
    |
-LL |     struct Priv<T = u8>(T);
-   |     ------------------- `generics::Priv` declared as private
-...
 LL |     pub fn f1(arg: [Priv; 1]) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `generics::Priv` in public interface
-  --> $DIR/private-in-public.rs:64:5
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ function `generics::f1` is reachable at visibility `pub(crate)`
+   |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:60:5
    |
 LL |     struct Priv<T = u8>(T);
-   |     ------------------- `generics::Priv` declared as private
-...
-LL |     pub fn f2(arg: Pub<Priv>) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^^^^^^^^^
 
-error[E0446]: private type `generics::Priv<generics::Pub>` in public interface
-  --> $DIR/private-in-public.rs:65:5
+warning: type `generics::Priv` is more private than the item `generics::f2`
+  --> $DIR/private-in-public.rs:66:5
+   |
+LL |     pub fn f2(arg: Pub<Priv>) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ function `generics::f2` is reachable at visibility `pub(crate)`
+   |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:60:5
    |
 LL |     struct Priv<T = u8>(T);
-   |     ------------------- `generics::Priv<generics::Pub>` declared as private
-...
+   |     ^^^^^^^^^^^^^^^^^^^
+
+warning: type `generics::Priv<generics::Pub>` is more private than the item `generics::f3`
+  --> $DIR/private-in-public.rs:67:5
+   |
 LL |     pub fn f3(arg: Priv<Pub>) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ function `generics::f3` is reachable at visibility `pub(crate)`
+   |
+note: but type `generics::Priv<generics::Pub>` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:60:5
+   |
+LL |     struct Priv<T = u8>(T);
+   |     ^^^^^^^^^^^^^^^^^^^
 
-error[E0446]: private type `impls::Priv` in public interface
-  --> $DIR/private-in-public.rs:80:9
+warning: type `impls::Priv` is more private than the item `impls::Pub::f`
+  --> $DIR/private-in-public.rs:82:9
    |
-LL |     struct Priv;
-   |     ----------- `impls::Priv` declared as private
-...
 LL |         pub fn f(arg: Priv) {}
-   |         ^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |         ^^^^^^^^^^^^^^^^^^^ associated function `impls::Pub::f` is reachable at visibility `pub(crate)`
+   |
+note: but type `impls::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:72:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-error[E0445]: private trait `aliases_pub::PrivTr` in public interface
-  --> $DIR/private-in-public.rs:104:5
+warning: trait `aliases_pub::PrivTr` is more private than the item `aliases_pub::f3`
+  --> $DIR/private-in-public.rs:106:5
    |
-LL |     trait PrivTr {
-   |     ------------ `aliases_pub::PrivTr` declared as private
-...
 LL |     pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_pub::f3` is reachable at visibility `pub(crate)`
+   |
+note: but trait `aliases_pub::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:100:5
+   |
+LL |     trait PrivTr {
+   |     ^^^^^^^^^^^^
 
-error[E0446]: private type `aliases_pub::Priv` in public interface
-  --> $DIR/private-in-public.rs:104:5
+warning: type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
+  --> $DIR/private-in-public.rs:106:5
    |
-LL |     struct Priv;
-   |     ----------- `aliases_pub::Priv` declared as private
-...
 LL |     pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `aliases_pub::Priv` in public interface
-  --> $DIR/private-in-public.rs:109:9
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_pub::f3` is reachable at visibility `pub(crate)`
+   |
+note: but type `aliases_pub::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:87:5
    |
 LL |     struct Priv;
-   |     ----------- `aliases_pub::Priv` declared as private
-...
-LL |         pub fn f(arg: Priv) {}
-   |         ^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^
 
-error[E0446]: private type `Priv1` in public interface
-  --> $DIR/private-in-public.rs:131:5
+warning: type `Priv1` is more private than the item `aliases_priv::f1`
+  --> $DIR/private-in-public.rs:133:5
    |
-LL |     struct Priv1;
-   |     ------------ `Priv1` declared as private
-...
 LL |     pub fn f1(arg: PrivUseAlias) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f1` is reachable at visibility `pub(crate)`
+   |
+note: but type `Priv1` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:118:5
+   |
+LL |     struct Priv1;
+   |     ^^^^^^^^^^^^
 
-error[E0446]: private type `Priv2` in public interface
-  --> $DIR/private-in-public.rs:132:5
+warning: type `Priv2` is more private than the item `aliases_priv::f2`
+  --> $DIR/private-in-public.rs:134:5
    |
-LL |     struct Priv2;
-   |     ------------ `Priv2` declared as private
-...
 LL |     pub fn f2(arg: PrivAlias) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f2` is reachable at visibility `pub(crate)`
+   |
+note: but type `Priv2` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:119:5
+   |
+LL |     struct Priv2;
+   |     ^^^^^^^^^^^^
 
-error[E0445]: private trait `aliases_priv::PrivTr` in public interface
-  --> $DIR/private-in-public.rs:133:5
+warning: trait `aliases_priv::PrivTr` is more private than the item `aliases_priv::f3`
+  --> $DIR/private-in-public.rs:135:5
    |
-LL |     trait PrivTr {
-   |     ------------ `aliases_priv::PrivTr` declared as private
-...
 LL |     pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f3` is reachable at visibility `pub(crate)`
+   |
+note: but trait `aliases_priv::PrivTr` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:128:5
+   |
+LL |     trait PrivTr {
+   |     ^^^^^^^^^^^^
 
-error[E0446]: private type `aliases_priv::Priv` in public interface
-  --> $DIR/private-in-public.rs:133:5
+warning: type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
+  --> $DIR/private-in-public.rs:135:5
    |
-LL |     struct Priv;
-   |     ----------- `aliases_priv::Priv` declared as private
-...
 LL |     pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `aliases_params::Priv` in public interface
-  --> $DIR/private-in-public.rs:143:5
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f3` is reachable at visibility `pub(crate)`
+   |
+note: but type `aliases_priv::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:116:5
    |
 LL |     struct Priv;
-   |     ----------- `aliases_params::Priv` declared as private
-...
-LL |     pub fn f2(arg: PrivAliasGeneric) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^
 
-error[E0446]: private type `aliases_params::Priv` in public interface
+warning: type `aliases_params::Priv` is more private than the item `aliases_params::f2`
   --> $DIR/private-in-public.rs:145:5
    |
+LL |     pub fn f2(arg: PrivAliasGeneric) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_params::f2` is reachable at visibility `pub(crate)`
+   |
+note: but type `aliases_params::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:141:5
+   |
 LL |     struct Priv;
-   |     ----------- `aliases_params::Priv` declared as private
-...
+   |     ^^^^^^^^^^^
+
+warning: type `aliases_params::Priv` is more private than the item `aliases_params::f3`
+  --> $DIR/private-in-public.rs:147:5
+   |
 LL |     pub fn f3(arg: Result<u8>) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_params::f3` is reachable at visibility `pub(crate)`
+   |
+note: but type `aliases_params::Priv` is only usable at visibility `pub(self)`
+  --> $DIR/private-in-public.rs:141:5
+   |
+LL |     struct Priv;
+   |     ^^^^^^^^^^^
 
-error: aborting due to 32 previous errors
+warning: 31 warnings emitted
 
-Some errors have detailed explanations: E0445, E0446.
-For more information about an error, try `rustc --explain E0445`.
diff --git a/tests/ui/privacy/private-inferred-type-2.rs b/tests/ui/privacy/private-inferred-type-2.rs
index 15b263b3814..1c4c52bea28 100644
--- a/tests/ui/privacy/private-inferred-type-2.rs
+++ b/tests/ui/privacy/private-inferred-type-2.rs
@@ -1,4 +1,5 @@
 // aux-build:private-inferred-type.rs
+#![allow(private_interfaces)]
 
 extern crate private_inferred_type as ext;
 
diff --git a/tests/ui/privacy/private-inferred-type-2.stderr b/tests/ui/privacy/private-inferred-type-2.stderr
index 3a0fc03b4d5..8a905f5d88a 100644
--- a/tests/ui/privacy/private-inferred-type-2.stderr
+++ b/tests/ui/privacy/private-inferred-type-2.stderr
@@ -1,17 +1,17 @@
 error: type `Priv` is private
-  --> $DIR/private-inferred-type-2.rs:16:5
+  --> $DIR/private-inferred-type-2.rs:17:5
    |
 LL |     m::Pub::get_priv;
    |     ^^^^^^^^^^^^^^^^ private type
 
 error: type `Priv` is private
-  --> $DIR/private-inferred-type-2.rs:17:5
+  --> $DIR/private-inferred-type-2.rs:18:5
    |
 LL |     m::Pub::static_method;
    |     ^^^^^^^^^^^^^^^^^^^^^ private type
 
 error: type `ext::Priv` is private
-  --> $DIR/private-inferred-type-2.rs:18:5
+  --> $DIR/private-inferred-type-2.rs:19:5
    |
 LL |     ext::Pub::static_method;
    |     ^^^^^^^^^^^^^^^^^^^^^^^ private type
diff --git a/tests/ui/privacy/private-inferred-type.rs b/tests/ui/privacy/private-inferred-type.rs
index e8743dd968f..8c07226fe0e 100644
--- a/tests/ui/privacy/private-inferred-type.rs
+++ b/tests/ui/privacy/private-inferred-type.rs
@@ -1,5 +1,5 @@
 #![feature(decl_macro)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
 
 mod m {
     fn priv_fn() {}
diff --git a/tests/ui/privacy/private-type-in-interface.rs b/tests/ui/privacy/private-type-in-interface.rs
index 7fbdbaf5f31..39e0bf23cac 100644
--- a/tests/ui/privacy/private-type-in-interface.rs
+++ b/tests/ui/privacy/private-type-in-interface.rs
@@ -1,6 +1,7 @@
 // aux-build:private-inferred-type.rs
 
 #![allow(warnings)]
+#![allow(private_interfaces)]
 
 extern crate private_inferred_type as ext;
 
diff --git a/tests/ui/privacy/private-type-in-interface.stderr b/tests/ui/privacy/private-type-in-interface.stderr
index 4e87caa3415..03225d84fdb 100644
--- a/tests/ui/privacy/private-type-in-interface.stderr
+++ b/tests/ui/privacy/private-type-in-interface.stderr
@@ -1,53 +1,53 @@
 error: type `Priv` is private
-  --> $DIR/private-type-in-interface.rs:15:9
+  --> $DIR/private-type-in-interface.rs:16:9
    |
 LL | fn f(_: m::Alias) {}
    |         ^^^^^^^^ private type
 
 error: type `Priv` is private
-  --> $DIR/private-type-in-interface.rs:15:6
+  --> $DIR/private-type-in-interface.rs:16:6
    |
 LL | fn f(_: m::Alias) {}
    |      ^ private type
 
 error: type `ext::Priv` is private
-  --> $DIR/private-type-in-interface.rs:17:13
+  --> $DIR/private-type-in-interface.rs:18:13
    |
 LL | fn f_ext(_: ext::Alias) {}
    |             ^^^^^^^^^^ private type
 
 error: type `ext::Priv` is private
-  --> $DIR/private-type-in-interface.rs:17:10
+  --> $DIR/private-type-in-interface.rs:18:10
    |
 LL | fn f_ext(_: ext::Alias) {}
    |          ^ private type
 
 error: type `Priv` is private
-  --> $DIR/private-type-in-interface.rs:21:6
+  --> $DIR/private-type-in-interface.rs:22:6
    |
 LL | impl m::Alias {}
    |      ^^^^^^^^ private type
 
 error: type `ext::Priv` is private
-  --> $DIR/private-type-in-interface.rs:22:14
+  --> $DIR/private-type-in-interface.rs:23:14
    |
 LL | impl Tr1 for ext::Alias {}
    |              ^^^^^^^^^^ private type
 
 error: type `Priv` is private
-  --> $DIR/private-type-in-interface.rs:23:10
+  --> $DIR/private-type-in-interface.rs:24:10
    |
 LL | type A = <m::Alias as m::Trait>::X;
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^ private type
 
 error: type `Priv` is private
-  --> $DIR/private-type-in-interface.rs:27:11
+  --> $DIR/private-type-in-interface.rs:28:11
    |
 LL | fn g() -> impl Tr2<m::Alias> { 0 }
    |           ^^^^^^^^^^^^^^^^^^ private type
 
 error: type `ext::Priv` is private
-  --> $DIR/private-type-in-interface.rs:28:15
+  --> $DIR/private-type-in-interface.rs:29:15
    |
 LL | fn g_ext() -> impl Tr2<ext::Alias> { 0 }
    |               ^^^^^^^^^^^^^^^^^^^^ private type
diff --git a/tests/ui/privacy/restricted/private-in-public.rs b/tests/ui/privacy/restricted/private-in-public.rs
index 1e3dbdf73b9..80a7e6ad0a7 100644
--- a/tests/ui/privacy/restricted/private-in-public.rs
+++ b/tests/ui/privacy/restricted/private-in-public.rs
@@ -1,10 +1,11 @@
+// check-pass
 mod foo {
     struct Priv;
     mod bar {
         use foo::Priv;
         pub(super) fn f(_: Priv) {}
-        pub(crate) fn g(_: Priv) {} //~ ERROR E0446
-        pub(crate) fn h(_: Priv) {} //~ ERROR E0446
+        pub(crate) fn g(_: Priv) {}
+        pub(crate) fn h(_: Priv) {}
     }
 }
 
diff --git a/tests/ui/privacy/restricted/private-in-public.stderr b/tests/ui/privacy/restricted/private-in-public.stderr
deleted file mode 100644
index 65d996f0f07..00000000000
--- a/tests/ui/privacy/restricted/private-in-public.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0446]: private type `Priv` in public interface
-  --> $DIR/private-in-public.rs:6:9
-   |
-LL |     struct Priv;
-   |     ----------- `Priv` declared as private
-...
-LL |         pub(crate) fn g(_: Priv) {}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `Priv` in public interface
-  --> $DIR/private-in-public.rs:7:9
-   |
-LL |     struct Priv;
-   |     ----------- `Priv` declared as private
-...
-LL |         pub(crate) fn h(_: Priv) {}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/unnameable_types.rs b/tests/ui/privacy/unnameable_types.rs
index 46e24915259..e35aaec5b3b 100644
--- a/tests/ui/privacy/unnameable_types.rs
+++ b/tests/ui/privacy/unnameable_types.rs
@@ -1,5 +1,4 @@
 #![feature(type_privacy_lints)]
-#![allow(private_in_public)]
 #![deny(unnameable_types)]
 
 mod m {
diff --git a/tests/ui/privacy/unnameable_types.stderr b/tests/ui/privacy/unnameable_types.stderr
index 90412752575..d68a11c9728 100644
--- a/tests/ui/privacy/unnameable_types.stderr
+++ b/tests/ui/privacy/unnameable_types.stderr
@@ -1,23 +1,23 @@
 error: struct `PubStruct` is reachable but cannot be named
-  --> $DIR/unnameable_types.rs:6:5
+  --> $DIR/unnameable_types.rs:5:5
    |
 LL |     pub struct PubStruct(pub i32);
    |     ^^^^^^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
    |
 note: the lint level is defined here
-  --> $DIR/unnameable_types.rs:3:9
+  --> $DIR/unnameable_types.rs:2:9
    |
 LL | #![deny(unnameable_types)]
    |         ^^^^^^^^^^^^^^^^
 
 error: enum `PubE` is reachable but cannot be named
-  --> $DIR/unnameable_types.rs:8:5
+  --> $DIR/unnameable_types.rs:7:5
    |
 LL |     pub enum PubE {
    |     ^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
 
 error: trait `PubTr` is reachable but cannot be named
-  --> $DIR/unnameable_types.rs:12:5
+  --> $DIR/unnameable_types.rs:11:5
    |
 LL |     pub trait PubTr {
    |     ^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
diff --git a/tests/ui/privacy/where-priv-type.rs b/tests/ui/privacy/where-priv-type.rs
index 2e0a6b3e72c..cd9cce7ec3e 100644
--- a/tests/ui/privacy/where-priv-type.rs
+++ b/tests/ui/privacy/where-priv-type.rs
@@ -3,14 +3,7 @@
 
 #![crate_type = "lib"]
 #![feature(generic_const_exprs)]
-#![feature(type_privacy_lints)]
 #![allow(incomplete_features)]
-#![warn(private_bounds)]
-#![warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
 
 struct PrivTy;
 trait PrivTr {}
@@ -23,42 +16,33 @@ impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; }
 
 
 pub struct S
-//~^ WARNING private type `PrivTy` in public interface
-//~| WARNING hard error
-//~| WARNING type `PrivTy` is more private than the item `S`
+//~^ WARNING type `PrivTy` is more private than the item `S`
 where
     PrivTy:
 {}
 
 
 pub enum E
-//~^ WARNING private type `PrivTy` in public interface
-//~| WARNING hard error
-//~| WARNING type `PrivTy` is more private than the item `E`
+//~^ WARNING type `PrivTy` is more private than the item `E`
 where
     PrivTy:
 {}
 
 
 pub fn f()
-//~^ WARNING private type `PrivTy` in public interface
-//~| WARNING hard error
-//~| WARNING type `PrivTy` is more private than the item `f`
+//~^ WARNING type `PrivTy` is more private than the item `f`
 where
     PrivTy:
 {}
 
 
 impl S
-//~^ ERROR private type `PrivTy` in public interface
-//~| WARNING type `PrivTy` is more private than the item `S`
+//~^ WARNING type `PrivTy` is more private than the item `S`
 where
     PrivTy:
 {
     pub fn f()
-    //~^ WARNING private type `PrivTy` in public interface
-    //~| WARNING hard error
-    //~| WARNING type `PrivTy` is more private than the item `S::f`
+    //~^ WARNING type `PrivTy` is more private than the item `S::f`
     where
         PrivTy:
     {}
@@ -90,7 +74,6 @@ where
 {
     type AssocTy = Const<{ my_const_fn(U) }>;
     //~^ ERROR private type
-    //~| WARNING type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
     fn assoc_fn() -> Self::AssocTy {
         Const
     }
diff --git a/tests/ui/privacy/where-priv-type.stderr b/tests/ui/privacy/where-priv-type.stderr
index d6baf22b3fb..dcc249c6351 100644
--- a/tests/ui/privacy/where-priv-type.stderr
+++ b/tests/ui/privacy/where-priv-type.stderr
@@ -1,136 +1,72 @@
-warning: private type `PrivTy` in public interface (error E0446)
-  --> $DIR/where-priv-type.rs:25:1
-   |
-LL | pub struct S
-   | ^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-   = note: `#[warn(private_in_public)]` on by default
-
 warning: type `PrivTy` is more private than the item `S`
-  --> $DIR/where-priv-type.rs:25:1
+  --> $DIR/where-priv-type.rs:18:1
    |
 LL | pub struct S
    | ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub`
    |
 note: but type `PrivTy` is only usable at visibility `pub(crate)`
-  --> $DIR/where-priv-type.rs:15:1
+  --> $DIR/where-priv-type.rs:8:1
    |
 LL | struct PrivTy;
    | ^^^^^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/where-priv-type.rs:8:9
-   |
-LL | #![warn(private_bounds)]
-   |         ^^^^^^^^^^^^^^
-
-warning: private type `PrivTy` in public interface (error E0446)
-  --> $DIR/where-priv-type.rs:34:1
-   |
-LL | pub enum E
-   | ^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+   = note: `#[warn(private_bounds)]` on by default
 
 warning: type `PrivTy` is more private than the item `E`
-  --> $DIR/where-priv-type.rs:34:1
+  --> $DIR/where-priv-type.rs:25:1
    |
 LL | pub enum E
    | ^^^^^^^^^^ enum `E` is reachable at visibility `pub`
    |
 note: but type `PrivTy` is only usable at visibility `pub(crate)`
-  --> $DIR/where-priv-type.rs:15:1
+  --> $DIR/where-priv-type.rs:8:1
    |
 LL | struct PrivTy;
    | ^^^^^^^^^^^^^
 
-warning: private type `PrivTy` in public interface (error E0446)
-  --> $DIR/where-priv-type.rs:43:1
-   |
-LL | / pub fn f()
-LL | |
-LL | |
-LL | |
-LL | | where
-LL | |     PrivTy:
-   | |___________^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-
 warning: type `PrivTy` is more private than the item `f`
-  --> $DIR/where-priv-type.rs:43:1
+  --> $DIR/where-priv-type.rs:32:1
    |
 LL | / pub fn f()
 LL | |
-LL | |
-LL | |
 LL | | where
 LL | |     PrivTy:
    | |___________^ function `f` is reachable at visibility `pub`
    |
 note: but type `PrivTy` is only usable at visibility `pub(crate)`
-  --> $DIR/where-priv-type.rs:15:1
+  --> $DIR/where-priv-type.rs:8:1
    |
 LL | struct PrivTy;
    | ^^^^^^^^^^^^^
 
-error[E0446]: private type `PrivTy` in public interface
-  --> $DIR/where-priv-type.rs:52:1
-   |
-LL | struct PrivTy;
-   | ------------- `PrivTy` declared as private
-...
-LL | impl S
-   | ^^^^^^ can't leak private type
-
 warning: type `PrivTy` is more private than the item `S`
-  --> $DIR/where-priv-type.rs:52:1
+  --> $DIR/where-priv-type.rs:39:1
    |
 LL | impl S
    | ^^^^^^ implementation `S` is reachable at visibility `pub`
    |
 note: but type `PrivTy` is only usable at visibility `pub(crate)`
-  --> $DIR/where-priv-type.rs:15:1
+  --> $DIR/where-priv-type.rs:8:1
    |
 LL | struct PrivTy;
    | ^^^^^^^^^^^^^
 
-warning: private type `PrivTy` in public interface (error E0446)
-  --> $DIR/where-priv-type.rs:58:5
-   |
-LL | /     pub fn f()
-LL | |
-LL | |
-LL | |
-LL | |     where
-LL | |         PrivTy:
-   | |_______________^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-
 warning: type `PrivTy` is more private than the item `S::f`
-  --> $DIR/where-priv-type.rs:58:5
+  --> $DIR/where-priv-type.rs:44:5
    |
 LL | /     pub fn f()
 LL | |
-LL | |
-LL | |
 LL | |     where
 LL | |         PrivTy:
    | |_______________^ associated function `S::f` is reachable at visibility `pub`
    |
 note: but type `PrivTy` is only usable at visibility `pub(crate)`
-  --> $DIR/where-priv-type.rs:15:1
+  --> $DIR/where-priv-type.rs:8:1
    |
 LL | struct PrivTy;
    | ^^^^^^^^^^^^^
 
 error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
-  --> $DIR/where-priv-type.rs:91:5
+  --> $DIR/where-priv-type.rs:75:5
    |
 LL |     type AssocTy = Const<{ my_const_fn(U) }>;
    |     ^^^^^^^^^^^^ can't leak private type
@@ -138,23 +74,6 @@ LL |     type AssocTy = Const<{ my_const_fn(U) }>;
 LL | const fn my_const_fn(val: u8) -> u8 {
    | ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
 
-warning: type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
-  --> $DIR/where-priv-type.rs:91:5
-   |
-LL |     type AssocTy = Const<{ my_const_fn(U) }>;
-   |     ^^^^^^^^^^^^ associated type `<Const<U> as Trait>::AssocTy` is reachable at visibility `pub`
-   |
-note: but type `fn(u8) -> u8 {my_const_fn}` is only usable at visibility `pub(crate)`
-  --> $DIR/where-priv-type.rs:99:1
-   |
-LL | const fn my_const_fn(val: u8) -> u8 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/where-priv-type.rs:9:9
-   |
-LL | #![warn(private_interfaces)]
-   |         ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors; 10 warnings emitted
+error: aborting due to previous error; 5 warnings emitted
 
 For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
index c59fdb7c7a9..d5e797b52b3 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
@@ -1,14 +1,10 @@
+// check-pass
+
 // priv-in-pub lint tests where the private trait bounds a public type
 
 #![crate_type = "lib"]
 #![feature(generic_const_exprs)]
-#![feature(type_privacy_lints)]
 #![allow(incomplete_features)]
-#![warn(private_bounds)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
 
 struct PrivTy;
 trait PrivTr {}
@@ -22,38 +18,33 @@ impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; }
 
 
 pub struct S
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `S`
+//~^ WARNING trait `PrivTr` is more private than the item `S`
 where
     PubTy: PrivTr
 {}
 
 
 pub enum E
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `E`
+//~^ WARNING trait `PrivTr` is more private than the item `E`
 where
     PubTy: PrivTr
 {}
 
 
 pub fn f()
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `f`
+//~^ WARNING trait `PrivTr` is more private than the item `f`
 where
     PubTy: PrivTr
 {}
 
 
 impl S
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `S`
+//~^ WARNING trait `PrivTr` is more private than the item `S`
 where
     PubTy: PrivTr
 {
     pub fn f()
-    //~^ ERROR private trait `PrivTr` in public interface
-    //~| WARNING trait `PrivTr` is more private than the item `S::f`
+    //~^ WARNING trait `PrivTr` is more private than the item `S::f`
     where
         PubTy: PrivTr
     {}
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
index e2d7ce44692..c476874332c 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
@@ -1,129 +1,69 @@
-error[E0445]: private trait `PrivTr` in public interface
-  --> $DIR/where-pub-type-impls-priv-trait.rs:24:1
-   |
-LL | trait PrivTr {}
-   | ------------ `PrivTr` declared as private
-...
-LL | pub struct S
-   | ^^^^^^^^^^^^ can't leak private trait
-
 warning: trait `PrivTr` is more private than the item `S`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:24:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:20:1
    |
 LL | pub struct S
    | ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub`
    |
 note: but trait `PrivTr` is only usable at visibility `pub(crate)`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
    |
 LL | trait PrivTr {}
    | ^^^^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/where-pub-type-impls-priv-trait.rs:7:9
-   |
-LL | #![warn(private_bounds)]
-   |         ^^^^^^^^^^^^^^
-
-error[E0445]: private trait `PrivTr` in public interface
-  --> $DIR/where-pub-type-impls-priv-trait.rs:32:1
-   |
-LL | trait PrivTr {}
-   | ------------ `PrivTr` declared as private
-...
-LL | pub enum E
-   | ^^^^^^^^^^ can't leak private trait
+   = note: `#[warn(private_bounds)]` on by default
 
 warning: trait `PrivTr` is more private than the item `E`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:32:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:27:1
    |
 LL | pub enum E
    | ^^^^^^^^^^ enum `E` is reachable at visibility `pub`
    |
 note: but trait `PrivTr` is only usable at visibility `pub(crate)`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
    |
 LL | trait PrivTr {}
    | ^^^^^^^^^^^^
 
-error[E0445]: private trait `PrivTr` in public interface
-  --> $DIR/where-pub-type-impls-priv-trait.rs:40:1
-   |
-LL |   trait PrivTr {}
-   |   ------------ `PrivTr` declared as private
-...
-LL | / pub fn f()
-LL | |
-LL | |
-LL | | where
-LL | |     PubTy: PrivTr
-   | |_________________^ can't leak private trait
-
 warning: trait `PrivTr` is more private than the item `f`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:40:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:34:1
    |
 LL | / pub fn f()
 LL | |
-LL | |
 LL | | where
 LL | |     PubTy: PrivTr
    | |_________________^ function `f` is reachable at visibility `pub`
    |
 note: but trait `PrivTr` is only usable at visibility `pub(crate)`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
    |
 LL | trait PrivTr {}
    | ^^^^^^^^^^^^
 
-error[E0445]: private trait `PrivTr` in public interface
-  --> $DIR/where-pub-type-impls-priv-trait.rs:48:1
-   |
-LL | trait PrivTr {}
-   | ------------ `PrivTr` declared as private
-...
-LL | impl S
-   | ^^^^^^ can't leak private trait
-
 warning: trait `PrivTr` is more private than the item `S`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:48:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:41:1
    |
 LL | impl S
    | ^^^^^^ implementation `S` is reachable at visibility `pub`
    |
 note: but trait `PrivTr` is only usable at visibility `pub(crate)`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
    |
 LL | trait PrivTr {}
    | ^^^^^^^^^^^^
 
-error[E0445]: private trait `PrivTr` in public interface
-  --> $DIR/where-pub-type-impls-priv-trait.rs:54:5
-   |
-LL |   trait PrivTr {}
-   |   ------------ `PrivTr` declared as private
-...
-LL | /     pub fn f()
-LL | |
-LL | |
-LL | |     where
-LL | |         PubTy: PrivTr
-   | |_____________________^ can't leak private trait
-
 warning: trait `PrivTr` is more private than the item `S::f`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:54:5
+  --> $DIR/where-pub-type-impls-priv-trait.rs:46:5
    |
 LL | /     pub fn f()
 LL | |
-LL | |
 LL | |     where
 LL | |         PubTy: PrivTr
    | |_____________________^ associated function `S::f` is reachable at visibility `pub`
    |
 note: but trait `PrivTr` is only usable at visibility `pub(crate)`
-  --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+  --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
    |
 LL | trait PrivTr {}
    | ^^^^^^^^^^^^
 
-error: aborting due to 5 previous errors; 5 warnings emitted
+warning: 5 warnings emitted
 
-For more information about this error, try `rustc --explain E0445`.
diff --git a/tests/ui/proc-macro/allowed-signatures.rs b/tests/ui/proc-macro/allowed-signatures.rs
index 86850876112..ce327901b1a 100644
--- a/tests/ui/proc-macro/allowed-signatures.rs
+++ b/tests/ui/proc-macro/allowed-signatures.rs
@@ -3,7 +3,7 @@
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
 extern crate proc_macro;
 use proc_macro::TokenStream;
 
diff --git a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs
index cdeea6224b2..7930964c83b 100644
--- a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs
+++ b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs
@@ -1,44 +1,24 @@
-#![feature(type_privacy_lints)]
-#![allow(non_camel_case_types)] // genus is always capitalized
-#![warn(private_interfaces)]
-//~^ NOTE the lint level is defined here
+// check-pass
 
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
+#![allow(non_camel_case_types)] // genus is always capitalized
 
 pub(crate) struct Snail;
-//~^ NOTE `Snail` declared as private
-//~| NOTE but type `Snail` is only usable at visibility `pub(crate)`
 
 mod sea {
     pub(super) struct Turtle;
-    //~^ NOTE `Turtle` declared as crate-private
-    //~| NOTE but type `Turtle` is only usable at visibility `pub(crate)`
 }
 
 struct Tortoise;
-//~^ NOTE `Tortoise` declared as private
-//~| NOTE but type `Tortoise` is only usable at visibility `pub(crate)`
 
 pub struct Shell<T> {
     pub(crate) creature: T,
 }
 
 pub type Helix_pomatia = Shell<Snail>;
-//~^ ERROR private type `Snail` in public interface
-//~| WARNING type `Snail` is more private than the item `Helix_pomatia`
-//~| NOTE can't leak private type
-//~| NOTE type alias `Helix_pomatia` is reachable at visibility `pub`
+//~^ WARNING type `Snail` is more private than the item `Helix_pomatia`
 pub type Dermochelys_coriacea = Shell<sea::Turtle>;
-//~^ ERROR crate-private type `Turtle` in public interface
-//~| WARNING type `Turtle` is more private than the item `Dermochelys_coriacea`
-//~| NOTE can't leak crate-private type
-//~| NOTE type alias `Dermochelys_coriacea` is reachable at visibility `pub`
+//~^ WARNING type `Turtle` is more private than the item `Dermochelys_coriacea`
 pub type Testudo_graeca = Shell<Tortoise>;
-//~^ ERROR private type `Tortoise` in public interface
-//~| WARNING type `Tortoise` is more private than the item `Testudo_graeca`
-//~| NOTE can't leak private type
-//~| NOTE type alias `Testudo_graeca` is reachable at visibility `pub`
+//~^ WARNING type `Tortoise` is more private than the item `Testudo_graeca`
 
 fn main() {}
diff --git a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr
index 20e51e1901f..26dfa2e7d4f 100644
--- a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr
+++ b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr
@@ -1,71 +1,39 @@
-error[E0446]: private type `Snail` in public interface
-  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1
-   |
-LL | pub(crate) struct Snail;
-   | ----------------------- `Snail` declared as private
-...
-LL | pub type Helix_pomatia = Shell<Snail>;
-   | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
 warning: type `Snail` is more private than the item `Helix_pomatia`
-  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1
+  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:17:1
    |
 LL | pub type Helix_pomatia = Shell<Snail>;
    | ^^^^^^^^^^^^^^^^^^^^^^ type alias `Helix_pomatia` is reachable at visibility `pub`
    |
 note: but type `Snail` is only usable at visibility `pub(crate)`
-  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:10:1
+  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:5:1
    |
 LL | pub(crate) struct Snail;
    | ^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:3:9
-   |
-LL | #![warn(private_interfaces)]
-   |         ^^^^^^^^^^^^^^^^^^
-
-error[E0446]: crate-private type `Turtle` in public interface
-  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:33:1
-   |
-LL |     pub(super) struct Turtle;
-   |     ------------------------ `Turtle` declared as crate-private
-...
-LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private type
+   = note: `#[warn(private_interfaces)]` on by default
 
 warning: type `Turtle` is more private than the item `Dermochelys_coriacea`
-  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:33:1
+  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:19:1
    |
 LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type alias `Dermochelys_coriacea` is reachable at visibility `pub`
    |
 note: but type `Turtle` is only usable at visibility `pub(crate)`
-  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:15:5
+  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:8:5
    |
 LL |     pub(super) struct Turtle;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
-error[E0446]: private type `Tortoise` in public interface
-  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:38:1
-   |
-LL | struct Tortoise;
-   | --------------- `Tortoise` declared as private
-...
-LL | pub type Testudo_graeca = Shell<Tortoise>;
-   | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
 warning: type `Tortoise` is more private than the item `Testudo_graeca`
-  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:38:1
+  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:21:1
    |
 LL | pub type Testudo_graeca = Shell<Tortoise>;
    | ^^^^^^^^^^^^^^^^^^^^^^^ type alias `Testudo_graeca` is reachable at visibility `pub`
    |
 note: but type `Tortoise` is only usable at visibility `pub(crate)`
-  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:20:1
+  --> $DIR/issue-33174-restricted-type-in-public-interface.rs:11:1
    |
 LL | struct Tortoise;
    | ^^^^^^^^^^^^^^^
 
-error: aborting due to 3 previous errors; 3 warnings emitted
+warning: 3 warnings emitted
 
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/test-attrs/issue-36768.rs b/tests/ui/test-attrs/issue-36768.rs
index f671cbc8205..7531f3621f5 100644
--- a/tests/ui/test-attrs/issue-36768.rs
+++ b/tests/ui/test-attrs/issue-36768.rs
@@ -1,6 +1,6 @@
 // run-pass
 // compile-flags:--test
-#![deny(private_in_public)]
+#![deny(private_interfaces)]
 
 #[test] fn foo() {}
 mod foo {}
diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs
index 546fcbaa3de..b6129163333 100644
--- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs
+++ b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs
@@ -1,3 +1,5 @@
+// check-pass
+
 //! If visibility is assumed, a transmutation should be accepted even if the
 //! destination type contains an unreachable field (e.g., a public field with a
 //! private type). (This rule is distinct from type privacy, which still may
@@ -29,7 +31,7 @@ mod dst {
     #[repr(C)] pub(self) struct Zst; // <- unreachable type
 
     #[repr(C)] pub(in super) struct Dst {
-        pub(in super) field: Zst, //~ ERROR private type
+        pub(in super) field: Zst, //~ WARNING type `dst::Zst` is more private than the item `Dst::field`
     }
 }
 
diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr
index be83b7ce33f..80099388d63 100644
--- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr
+++ b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr
@@ -1,12 +1,15 @@
-error[E0446]: private type `dst::Zst` in public interface
-  --> $DIR/should_accept_if_dst_has_unreachable_field.rs:32:9
+warning: type `dst::Zst` is more private than the item `Dst::field`
+  --> $DIR/should_accept_if_dst_has_unreachable_field.rs:34:9
    |
-LL |     #[repr(C)] pub(self) struct Zst; // <- unreachable type
-   |                -------------------- `dst::Zst` declared as private
-...
 LL |         pub(in super) field: Zst,
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^ field `Dst::field` is reachable at visibility `pub(crate)`
+   |
+note: but type `dst::Zst` is only usable at visibility `pub(self)`
+  --> $DIR/should_accept_if_dst_has_unreachable_field.rs:31:16
+   |
+LL |     #[repr(C)] pub(self) struct Zst; // <- unreachable type
+   |                ^^^^^^^^^^^^^^^^^^^^
+   = note: `#[warn(private_interfaces)]` on by default
 
-error: aborting due to previous error
+warning: 1 warning emitted
 
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs
index 9c8345a8e91..e7742058c57 100644
--- a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs
+++ b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs
@@ -1,3 +1,5 @@
+// check-pass
+
 //! The presence of an unreachable field in the source type (e.g., a public
 //! field with a private type does not affect transmutability. (This rule is
 //! distinct from type privacy, which still may forbid naming such types.)
@@ -19,7 +21,7 @@ mod src {
     #[repr(C)] pub(self) struct Zst; // <- unreachable type
 
     #[repr(C)] pub(in super) struct Src {
-        pub(in super) field: Zst, //~ ERROR private type
+        pub(in super) field: Zst, //~ WARNING type `src::Zst` is more private than the item `Src::field`
     }
 }
 
diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr
index 39b73302e36..55fb3392305 100644
--- a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr
+++ b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr
@@ -1,12 +1,15 @@
-error[E0446]: private type `src::Zst` in public interface
-  --> $DIR/should_accept_if_src_has_unreachable_field.rs:22:9
+warning: type `src::Zst` is more private than the item `Src::field`
+  --> $DIR/should_accept_if_src_has_unreachable_field.rs:24:9
    |
-LL |     #[repr(C)] pub(self) struct Zst; // <- unreachable type
-   |                -------------------- `src::Zst` declared as private
-...
 LL |         pub(in super) field: Zst,
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^ field `Src::field` is reachable at visibility `pub(crate)`
+   |
+note: but type `src::Zst` is only usable at visibility `pub(self)`
+  --> $DIR/should_accept_if_src_has_unreachable_field.rs:21:16
+   |
+LL |     #[repr(C)] pub(self) struct Zst; // <- unreachable type
+   |                ^^^^^^^^^^^^^^^^^^^^
+   = note: `#[warn(private_interfaces)]` on by default
 
-error: aborting due to previous error
+warning: 1 warning emitted
 
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/type-alias-impl-trait/privacy.rs b/tests/ui/type-alias-impl-trait/privacy.rs
index aa092f6f8ec..3efbfaf0916 100644
--- a/tests/ui/type-alias-impl-trait/privacy.rs
+++ b/tests/ui/type-alias-impl-trait/privacy.rs
@@ -1,8 +1,10 @@
+// check-pass
+
 #![feature(type_alias_impl_trait)]
 
 type Foo = (impl Sized, u8);
 pub fn foo() -> Foo {
-    //~^ ERROR private type alias `Foo` in public interface
+    //~^ WARNING type alias `Foo` is more private than the item `foo`
     (42, 42)
 }
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/privacy.stderr b/tests/ui/type-alias-impl-trait/privacy.stderr
index e8c6039cdc8..50870905c30 100644
--- a/tests/ui/type-alias-impl-trait/privacy.stderr
+++ b/tests/ui/type-alias-impl-trait/privacy.stderr
@@ -1,11 +1,15 @@
-error[E0446]: private type alias `Foo` in public interface
-  --> $DIR/privacy.rs:4:1
+warning: type alias `Foo` is more private than the item `foo`
+  --> $DIR/privacy.rs:6:1
    |
-LL | type Foo = (impl Sized, u8);
-   | -------- `Foo` declared as private
 LL | pub fn foo() -> Foo {
-   | ^^^^^^^^^^^^^^^^^^^ can't leak private type alias
+   | ^^^^^^^^^^^^^^^^^^^ function `foo` is reachable at visibility `pub`
+   |
+note: but type alias `Foo` is only usable at visibility `pub(crate)`
+  --> $DIR/privacy.rs:5:1
+   |
+LL | type Foo = (impl Sized, u8);
+   | ^^^^^^^^
+   = note: `#[warn(private_interfaces)]` on by default
 
-error: aborting due to previous error
+warning: 1 warning emitted
 
-For more information about this error, try `rustc --explain E0446`.