summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/ui/privacy
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/privacy')
-rw-r--r--tests/ui/privacy/associated-item-privacy-trait.rs2
-rw-r--r--tests/ui/privacy/associated-item-privacy-trait.stderr4
-rw-r--r--tests/ui/privacy/effective_visibilities.stderr4
-rw-r--r--tests/ui/privacy/effective_visibilities_full_priv.stderr2
-rw-r--r--tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs4
-rw-r--r--tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr38
-rw-r--r--tests/ui/privacy/privacy1.stderr1
-rw-r--r--tests/ui/privacy/private-in-public-warn.stderr2
-rw-r--r--tests/ui/privacy/private-in-public.rs8
-rw-r--r--tests/ui/privacy/private-in-public.stderr22
-rw-r--r--tests/ui/privacy/private-variant-reexport.rs4
-rw-r--r--tests/ui/privacy/private-variant-reexport.stderr8
-rw-r--r--tests/ui/privacy/sealed-traits/sealed-trait-local.rs40
-rw-r--r--tests/ui/privacy/sealed-traits/sealed-trait-local.stderr44
-rw-r--r--tests/ui/privacy/suggest-box-new.fixed15
-rw-r--r--tests/ui/privacy/suggest-box-new.rs15
-rw-r--r--tests/ui/privacy/suggest-box-new.stderr20
-rw-r--r--tests/ui/privacy/where-priv-type.stderr7
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.stderr7
19 files changed, 208 insertions, 39 deletions
diff --git a/tests/ui/privacy/associated-item-privacy-trait.rs b/tests/ui/privacy/associated-item-privacy-trait.rs
index db77a6a72..f038ae9e2 100644
--- a/tests/ui/privacy/associated-item-privacy-trait.rs
+++ b/tests/ui/privacy/associated-item-privacy-trait.rs
@@ -23,7 +23,7 @@ mod priv_trait {
let _: <Pub as PrivTr>::AssocTy;
//~^ ERROR associated type `PrivTr::AssocTy` is private
pub type InSignatureTy = <Pub as PrivTr>::AssocTy;
- //~^ ERROR trait `PrivTr` is private
+ //~^ ERROR associated type `PrivTr::AssocTy` is private
pub trait InSignatureTr: PrivTr {}
//~^ ERROR trait `PrivTr` is private
impl PrivTr for u8 {}
diff --git a/tests/ui/privacy/associated-item-privacy-trait.stderr b/tests/ui/privacy/associated-item-privacy-trait.stderr
index eb905bf7e..4e9dfa4a8 100644
--- a/tests/ui/privacy/associated-item-privacy-trait.stderr
+++ b/tests/ui/privacy/associated-item-privacy-trait.stderr
@@ -53,11 +53,11 @@ LL | priv_trait::mac!();
|
= note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: trait `PrivTr` is private
+error: associated type `PrivTr::AssocTy` is private
--> $DIR/associated-item-privacy-trait.rs:25:34
|
LL | pub type InSignatureTy = <Pub as PrivTr>::AssocTy;
- | ^^^^^^^^^^^^^^^^^^^^^^^^ private trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ private associated type
...
LL | priv_trait::mac!();
| ------------------ in this macro invocation
diff --git a/tests/ui/privacy/effective_visibilities.stderr b/tests/ui/privacy/effective_visibilities.stderr
index f74f812e1..41d63532d 100644
--- a/tests/ui/privacy/effective_visibilities.stderr
+++ b/tests/ui/privacy/effective_visibilities.stderr
@@ -45,6 +45,8 @@ error: not in the table
|
LL | struct PrivStruct;
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
--> $DIR/effective_visibilities.rs:25:9
@@ -81,6 +83,8 @@ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImpl
|
LL | A(
| ^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
--> $DIR/effective_visibilities.rs:38:17
diff --git a/tests/ui/privacy/effective_visibilities_full_priv.stderr b/tests/ui/privacy/effective_visibilities_full_priv.stderr
index 29d82e2ee..0577be147 100644
--- a/tests/ui/privacy/effective_visibilities_full_priv.stderr
+++ b/tests/ui/privacy/effective_visibilities_full_priv.stderr
@@ -9,6 +9,8 @@ error: not in the table
|
LL | struct Priv;
| ^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate)
--> $DIR/effective_visibilities_full_priv.rs:13:5
diff --git a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
index 6f115e78e..653dcab57 100644
--- a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
+++ b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
@@ -2,13 +2,17 @@
mod rank {
pub use self::Professor::*;
//~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `self::Professor::*`
pub use self::Lieutenant::{JuniorGrade, Full};
//~^ ERROR `JuniorGrade` is private, and cannot be re-exported
//~| ERROR `Full` is private, and cannot be re-exported
+ //~| ERROR unused imports: `Full`, `JuniorGrade`
pub use self::PettyOfficer::*;
//~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `self::PettyOfficer::*`
pub use self::Crewman::*;
//~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `self::Crewman::*`
enum Professor {
Adjunct,
diff --git a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
index 59b181fab..df5968ba3 100644
--- a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
+++ b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
@@ -1,23 +1,23 @@
error[E0364]: `JuniorGrade` is private, and cannot be re-exported
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:32
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^^^^^^^^
|
note: consider marking `JuniorGrade` as `pub` in the imported module
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:32
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^^^^^^^^
error[E0364]: `Full` is private, and cannot be re-exported
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:45
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^
|
note: consider marking `Full` as `pub` in the imported module
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:45
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^
@@ -34,18 +34,42 @@ note: the lint level is defined here
LL | #[deny(unused_imports)]
| ^^^^^^^^^^^^^^
+error: unused import: `self::Professor::*`
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:3:13
+ |
+LL | pub use self::Professor::*;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: unused imports: `Full`, `JuniorGrade`
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
+ |
+LL | pub use self::Lieutenant::{JuniorGrade, Full};
+ | ^^^^^^^^^^^ ^^^^
+
error: glob import doesn't reexport anything because no candidate is public enough
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:8:13
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
|
LL | pub use self::PettyOfficer::*;
| ^^^^^^^^^^^^^^^^^^^^^
-error: glob import doesn't reexport anything because no candidate is public enough
+error: unused import: `self::PettyOfficer::*`
--> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
|
+LL | pub use self::PettyOfficer::*;
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: glob import doesn't reexport anything because no candidate is public enough
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:13:13
+ |
+LL | pub use self::Crewman::*;
+ | ^^^^^^^^^^^^^^^^
+
+error: unused import: `self::Crewman::*`
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:13:13
+ |
LL | pub use self::Crewman::*;
| ^^^^^^^^^^^^^^^^
-error: aborting due to 5 previous errors
+error: aborting due to 9 previous errors
For more information about this error, try `rustc --explain E0364`.
diff --git a/tests/ui/privacy/privacy1.stderr b/tests/ui/privacy/privacy1.stderr
index ca8f242e0..a3552e146 100644
--- a/tests/ui/privacy/privacy1.stderr
+++ b/tests/ui/privacy/privacy1.stderr
@@ -21,6 +21,7 @@ note: the module `baz` is defined here
|
LL | mod baz {
| ^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:141:18
diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr
index 6497b7ff5..ac7e5547d 100644
--- a/tests/ui/privacy/private-in-public-warn.stderr
+++ b/tests/ui/privacy/private-in-public-warn.stderr
@@ -246,7 +246,7 @@ error: trait `traits_where::PrivTr` is more private than the item `traits_where:
--> $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)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
diff --git a/tests/ui/privacy/private-in-public.rs b/tests/ui/privacy/private-in-public.rs
index f54f9e38f..3fff2d517 100644
--- a/tests/ui/privacy/private-in-public.rs
+++ b/tests/ui/privacy/private-in-public.rs
@@ -104,8 +104,8 @@ mod aliases_pub {
// This should be OK, but associated type aliases are not substituted yet
pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- //~^ 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`
+ //~^ WARNING type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
+ //~| WARNING associated type `aliases_pub::PrivTr::Assoc` is more private than the item `aliases_pub::f3`
impl PrivUseAlias {
pub fn f(arg: Priv) {}
@@ -133,8 +133,8 @@ mod aliases_priv {
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) {}
- //~^ 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`
+ //~^ WARNING type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
+ //~| WARNING associated type `aliases_priv::PrivTr::Assoc` is more private than the item `aliases_priv::f3`
}
mod aliases_params {
diff --git a/tests/ui/privacy/private-in-public.stderr b/tests/ui/privacy/private-in-public.stderr
index d8f9fd007..49cc2e19b 100644
--- a/tests/ui/privacy/private-in-public.stderr
+++ b/tests/ui/privacy/private-in-public.stderr
@@ -208,7 +208,7 @@ warning: trait `traits_where::PrivTr` is more private than the item `traits_wher
--> $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)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
@@ -276,17 +276,17 @@ note: but type `impls::Priv` is only usable at visibility `pub(self)`
LL | struct Priv;
| ^^^^^^^^^^^
-warning: trait `aliases_pub::PrivTr` is more private than the item `aliases_pub::f3`
+warning: associated type `aliases_pub::PrivTr::Assoc` is more private than the item `aliases_pub::f3`
--> $DIR/private-in-public.rs:106:5
|
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
+note: but associated type `aliases_pub::PrivTr::Assoc` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:101:9
|
-LL | trait PrivTr {
- | ^^^^^^^^^^^^
+LL | type Assoc = m::Pub3;
+ | ^^^^^^^^^^
warning: type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
--> $DIR/private-in-public.rs:106:5
@@ -324,17 +324,17 @@ note: but type `Priv2` is only usable at visibility `pub(self)`
LL | struct Priv2;
| ^^^^^^^^^^^^
-warning: trait `aliases_priv::PrivTr` is more private than the item `aliases_priv::f3`
+warning: associated type `aliases_priv::PrivTr::Assoc` is more private than the item `aliases_priv::f3`
--> $DIR/private-in-public.rs:135:5
|
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
+note: but associated type `aliases_priv::PrivTr::Assoc` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:129:9
|
-LL | trait PrivTr {
- | ^^^^^^^^^^^^
+LL | type Assoc = Priv3;
+ | ^^^^^^^^^^
warning: type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
--> $DIR/private-in-public.rs:135:5
diff --git a/tests/ui/privacy/private-variant-reexport.rs b/tests/ui/privacy/private-variant-reexport.rs
index 688284460..b59243af6 100644
--- a/tests/ui/privacy/private-variant-reexport.rs
+++ b/tests/ui/privacy/private-variant-reexport.rs
@@ -12,7 +12,9 @@ mod m3 {
#[deny(unused_imports)]
mod m4 {
- pub use ::E::*; //~ ERROR glob import doesn't reexport anything
+ pub use ::E::*;
+ //~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `::E::*`
}
enum E { V }
diff --git a/tests/ui/privacy/private-variant-reexport.stderr b/tests/ui/privacy/private-variant-reexport.stderr
index 78771ee30..2f041934a 100644
--- a/tests/ui/privacy/private-variant-reexport.stderr
+++ b/tests/ui/privacy/private-variant-reexport.stderr
@@ -42,7 +42,13 @@ note: the lint level is defined here
LL | #[deny(unused_imports)]
| ^^^^^^^^^^^^^^
-error: aborting due to 4 previous errors
+error: unused import: `::E::*`
+ --> $DIR/private-variant-reexport.rs:15:13
+ |
+LL | pub use ::E::*;
+ | ^^^^^^
+
+error: aborting due to 5 previous errors
Some errors have detailed explanations: E0364, E0365.
For more information about an error, try `rustc --explain E0364`.
diff --git a/tests/ui/privacy/sealed-traits/sealed-trait-local.rs b/tests/ui/privacy/sealed-traits/sealed-trait-local.rs
index 778ddf0f8..9ae01259a 100644
--- a/tests/ui/privacy/sealed-traits/sealed-trait-local.rs
+++ b/tests/ui/privacy/sealed-traits/sealed-trait-local.rs
@@ -13,7 +13,43 @@ pub mod a {
}
}
-struct S;
-impl a::Sealed for S {} //~ ERROR the trait bound `S: Hidden` is not satisfied
+pub mod c {
+ pub trait Sealed: self::d::Hidden {
+ fn foo() {}
+ }
+
+ struct X;
+ impl Sealed for X {}
+ impl self::d::Hidden for X {}
+
+ struct Y;
+ impl Sealed for Y {}
+ impl self::d::Hidden for Y {}
+
+ mod d {
+ pub trait Hidden {}
+ }
+}
+pub mod e {
+ pub trait Sealed: self::f::Hidden {
+ fn foo() {}
+ }
+
+ struct X;
+ impl self::f::Hidden for X {}
+
+ struct Y;
+ impl self::f::Hidden for Y {}
+ impl<T: self::f::Hidden> Sealed for T {}
+
+ mod f {
+ pub trait Hidden {}
+ }
+}
+
+struct S;
+impl a::Sealed for S {} //~ ERROR the trait bound
+impl c::Sealed for S {} //~ ERROR the trait bound
+impl e::Sealed for S {} //~ ERROR the trait bound
fn main() {}
diff --git a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
index 5f8076fc8..a7f77a1c0 100644
--- a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
+++ b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
@@ -1,16 +1,50 @@
-error[E0277]: the trait bound `S: Hidden` is not satisfied
- --> $DIR/sealed-trait-local.rs:17:20
+error[E0277]: the trait bound `S: b::Hidden` is not satisfied
+ --> $DIR/sealed-trait-local.rs:52:20
|
LL | impl a::Sealed for S {}
- | ^ the trait `Hidden` is not implemented for `S`
+ | ^ the trait `b::Hidden` is not implemented for `S`
|
-note: required by a bound in `Sealed`
+note: required by a bound in `a::Sealed`
--> $DIR/sealed-trait-local.rs:3:23
|
LL | pub trait Sealed: self::b::Hidden {
| ^^^^^^^^^^^^^^^ required by this bound in `Sealed`
= note: `Sealed` is a "sealed trait", because to implement it you also need to implement `a::b::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
+ = help: the following type implements the trait:
+ a::X
-error: aborting due to previous error
+error[E0277]: the trait bound `S: d::Hidden` is not satisfied
+ --> $DIR/sealed-trait-local.rs:53:20
+ |
+LL | impl c::Sealed for S {}
+ | ^ the trait `d::Hidden` is not implemented for `S`
+ |
+note: required by a bound in `c::Sealed`
+ --> $DIR/sealed-trait-local.rs:17:23
+ |
+LL | pub trait Sealed: self::d::Hidden {
+ | ^^^^^^^^^^^^^^^ required by this bound in `Sealed`
+ = note: `Sealed` is a "sealed trait", because to implement it you also need to implement `c::d::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
+ = help: the following types implement the trait:
+ c::X
+ c::Y
+
+error[E0277]: the trait bound `S: f::Hidden` is not satisfied
+ --> $DIR/sealed-trait-local.rs:54:20
+ |
+LL | impl e::Sealed for S {}
+ | ^ the trait `f::Hidden` is not implemented for `S`
+ |
+note: required by a bound in `e::Sealed`
+ --> $DIR/sealed-trait-local.rs:35:23
+ |
+LL | pub trait Sealed: self::f::Hidden {
+ | ^^^^^^^^^^^^^^^ required by this bound in `Sealed`
+ = note: `Sealed` is a "sealed trait", because to implement it you also need to implement `e::f::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
+ = help: the following types implement the trait:
+ e::X
+ e::Y
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/privacy/suggest-box-new.fixed b/tests/ui/privacy/suggest-box-new.fixed
new file mode 100644
index 000000000..f5ae5c2ab
--- /dev/null
+++ b/tests/ui/privacy/suggest-box-new.fixed
@@ -0,0 +1,15 @@
+// run-rustfix
+#![allow(dead_code)]
+struct U <T> {
+ wtf: Option<Box<U<T>>>,
+ x: T,
+}
+fn main() {
+ U {
+ wtf: Some(Box::new(U { //~ ERROR cannot initialize a tuple struct which contains private fields
+ wtf: None,
+ x: (),
+ })),
+ x: ()
+ };
+}
diff --git a/tests/ui/privacy/suggest-box-new.rs b/tests/ui/privacy/suggest-box-new.rs
new file mode 100644
index 000000000..2e18dba8b
--- /dev/null
+++ b/tests/ui/privacy/suggest-box-new.rs
@@ -0,0 +1,15 @@
+// run-rustfix
+#![allow(dead_code)]
+struct U <T> {
+ wtf: Option<Box<U<T>>>,
+ x: T,
+}
+fn main() {
+ U {
+ wtf: Some(Box(U { //~ ERROR cannot initialize a tuple struct which contains private fields
+ wtf: None,
+ x: (),
+ })),
+ x: ()
+ };
+}
diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr
new file mode 100644
index 000000000..ed7fa0364
--- /dev/null
+++ b/tests/ui/privacy/suggest-box-new.stderr
@@ -0,0 +1,20 @@
+error[E0423]: cannot initialize a tuple struct which contains private fields
+ --> $DIR/suggest-box-new.rs:9:19
+ |
+LL | wtf: Some(Box(U {
+ | ^^^
+ |
+note: constructor is not visible here due to private fields
+ --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
+ |
+ = note: private field
+ |
+ = note: private field
+help: you might have meant to use the `new` associated function
+ |
+LL | wtf: Some(Box::new(U {
+ | +++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0423`.
diff --git a/tests/ui/privacy/where-priv-type.stderr b/tests/ui/privacy/where-priv-type.stderr
index dcc249c63..650766458 100644
--- a/tests/ui/privacy/where-priv-type.stderr
+++ b/tests/ui/privacy/where-priv-type.stderr
@@ -41,8 +41,11 @@ LL | struct PrivTy;
warning: type `PrivTy` is more private than the item `S`
--> $DIR/where-priv-type.rs:39:1
|
-LL | impl S
- | ^^^^^^ implementation `S` is reachable at visibility `pub`
+LL | / impl S
+LL | |
+LL | | where
+LL | | PrivTy:
+ | |___________^ implementation `S` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
--> $DIR/where-priv-type.rs:8:1
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 c47687433..ee79ce3f5 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
@@ -41,8 +41,11 @@ LL | trait PrivTr {}
warning: trait `PrivTr` is more private than the item `S`
--> $DIR/where-pub-type-impls-priv-trait.rs:41:1
|
-LL | impl S
- | ^^^^^^ implementation `S` is reachable at visibility `pub`
+LL | / impl S
+LL | |
+LL | | where
+LL | | PubTy: PrivTr
+ | |_________________^ 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:10:1