diff --git a/compiler/rustc_privacy/messages.ftl b/compiler/rustc_privacy/messages.ftl index b68e8a78aab86..35eb8e6bfb1bc 100644 --- a/compiler/rustc_privacy/messages.ftl +++ b/compiler/rustc_privacy/messages.ftl @@ -8,6 +8,7 @@ privacy_from_private_dep_in_public_interface = privacy_in_public_interface = {$vis_descr} {$kind} `{$descr}` in public interface .label = can't leak {$vis_descr} {$kind} .visibility_label = `{$descr}` declared as {$vis_descr} + .suggestion = consider adding `pub` in front of it privacy_item_is_private = {$kind} `{$descr}` is private .label = private {$kind} diff --git a/compiler/rustc_privacy/src/errors.rs b/compiler/rustc_privacy/src/errors.rs index 72b53eefa0817..726f3a97815ee 100644 --- a/compiler/rustc_privacy/src/errors.rs +++ b/compiler/rustc_privacy/src/errors.rs @@ -73,6 +73,8 @@ pub struct InPublicInterface<'a> { pub descr: DiagnosticArgFromDisplay<'a>, #[label(privacy_visibility_label)] pub vis_span: Span, + #[suggestion(code = "", applicability = "maybe-incorrect")] + pub suggestion: Span, } #[derive(Diagnostic)] diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index afd32e38d5b87..7cc5c1610af29 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -1846,6 +1846,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> { kind, descr: descr.into(), vis_span, + suggestion: vis_span, }); } } else { 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 2d9de8805bb55..10975b9e8edbe 100644 --- a/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr +++ b/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr @@ -5,7 +5,10 @@ LL | type AssocTy = Const<{ my_const_fn(U) }>; | ^^^^^^^^^^^^ can't leak private type ... LL | const fn my_const_fn(val: u8) -> u8 { - | ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private + | ----------------------------------- + | | + | `fn(u8) -> u8 {my_const_fn}` declared as private + | help: consider adding `pub` in front of it error: aborting due to previous error diff --git a/tests/ui/error-codes/E0446.stderr b/tests/ui/error-codes/E0446.stderr index b6a195c40a93a..df5f76ba2a23a 100644 --- a/tests/ui/error-codes/E0446.stderr +++ b/tests/ui/error-codes/E0446.stderr @@ -2,7 +2,10 @@ error[E0446]: private type `Bar` in public interface --> $DIR/E0446.rs:4:5 | LL | struct Bar(u32); - | ---------- `Bar` declared as private + | ---------- + | | + | `Bar` declared as private + | help: consider adding `pub` in front of it LL | LL | pub fn bar() -> Bar { | ^^^^^^^^^^^^^^^^^^^ can't leak private type diff --git a/tests/ui/privacy/issue-30079.stderr b/tests/ui/privacy/issue-30079.stderr index 9179ff339bf6b..f438ed513467b 100644 --- a/tests/ui/privacy/issue-30079.stderr +++ b/tests/ui/privacy/issue-30079.stderr @@ -12,7 +12,10 @@ error[E0446]: private type `m2::Priv` in public interface --> $DIR/issue-30079.rs:18:9 | LL | struct Priv; - | ----------- `m2::Priv` declared as private + | ----------- + | | + | `m2::Priv` declared as private + | help: consider adding `pub` in front of it LL | impl ::std::ops::Deref for ::SemiPriv { LL | type Target = Priv; | ^^^^^^^^^^^ can't leak private type @@ -21,7 +24,10 @@ error[E0446]: private type `m3::Priv` in public interface --> $DIR/issue-30079.rs:35:9 | LL | struct Priv; - | ----------- `m3::Priv` declared as private + | ----------- + | | + | `m3::Priv` declared as private + | help: consider adding `pub` in front of it LL | impl ::SemiPrivTrait for () { LL | type Assoc = Priv; | ^^^^^^^^^^ can't leak private type diff --git a/tests/ui/privacy/private-in-public-assoc-ty.stderr b/tests/ui/privacy/private-in-public-assoc-ty.stderr index a59027d81d286..5ed8ce96c67ad 100644 --- a/tests/ui/privacy/private-in-public-assoc-ty.stderr +++ b/tests/ui/privacy/private-in-public-assoc-ty.stderr @@ -2,7 +2,10 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-in-public-assoc-ty.rs:17:9 | LL | struct Priv; - | ----------- `Priv` declared as private + | ----------- + | | + | `Priv` declared as private + | help: consider adding `pub` in front of it ... LL | type A = Priv; | ^^^^^^ can't leak private type @@ -39,7 +42,10 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-in-public-assoc-ty.rs:34:9 | LL | struct Priv; - | ----------- `Priv` declared as private + | ----------- + | | + | `Priv` declared as private + | help: consider adding `pub` in front of it ... LL | type Alias4 = Priv; | ^^^^^^^^^^^ can't leak private type @@ -48,7 +54,10 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-in-public-assoc-ty.rs:41:9 | LL | struct Priv; - | ----------- `Priv` declared as private + | ----------- + | | + | `Priv` declared as private + | help: consider adding `pub` in front of it ... LL | type Alias1 = Priv; | ^^^^^^^^^^^ can't leak private type diff --git a/tests/ui/privacy/private-in-public-lint.stderr b/tests/ui/privacy/private-in-public-lint.stderr index 1e98e3bed147c..9b6c3b9f17c4c 100644 --- a/tests/ui/privacy/private-in-public-lint.stderr +++ b/tests/ui/privacy/private-in-public-lint.stderr @@ -2,7 +2,10 @@ 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 + | ----------- + | | + | `m1::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f() -> Priv {Priv} | ^^^^^^^^^^^^^^^^^^ can't leak private type @@ -11,7 +14,10 @@ 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 + | ----------- + | | + | `m2::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f() -> Priv {Priv} | ^^^^^^^^^^^^^^^^^^ can't leak private type diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr index 66f91ce6fd683..1afc5a6331a93 100644 --- a/tests/ui/privacy/private-in-public-warn.stderr +++ b/tests/ui/privacy/private-in-public-warn.stderr @@ -43,7 +43,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public-warn.rs:26:9 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | type Alias = Priv; | ^^^^^^^^^^ can't leak private type @@ -97,7 +100,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public-warn.rs:41:9 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | type Alias = Priv; | ^^^^^^^^^^ can't leak private type @@ -232,7 +238,10 @@ error[E0446]: private type `impls::Priv` in public interface --> $DIR/private-in-public-warn.rs:132:9 | LL | struct Priv; - | ----------- `impls::Priv` declared as private + | ----------- + | | + | `impls::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | type Alias = Priv; | ^^^^^^^^^^ can't leak private type @@ -250,7 +259,10 @@ error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public-warn.rs:207:9 | LL | struct Priv; - | ----------- `aliases_pub::Priv` declared as private + | ----------- + | | + | `aliases_pub::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | type Check = Priv; | ^^^^^^^^^^ can't leak private type @@ -259,7 +271,10 @@ error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public-warn.rs:210:9 | LL | struct Priv; - | ----------- `aliases_pub::Priv` declared as private + | ----------- + | | + | `aliases_pub::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | type Check = Priv; | ^^^^^^^^^^ can't leak private type @@ -268,7 +283,10 @@ error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public-warn.rs:213:9 | LL | struct Priv; - | ----------- `aliases_pub::Priv` declared as private + | ----------- + | | + | `aliases_pub::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | type Check = Priv; | ^^^^^^^^^^ can't leak private type @@ -277,7 +295,10 @@ error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public-warn.rs:216:9 | LL | struct Priv; - | ----------- `aliases_pub::Priv` declared as private + | ----------- + | | + | `aliases_pub::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | type Check = Priv; | ^^^^^^^^^^ can't leak private type diff --git a/tests/ui/privacy/private-in-public.stderr b/tests/ui/privacy/private-in-public.stderr index 887eebf53efac..2c0c63f3dead6 100644 --- a/tests/ui/privacy/private-in-public.stderr +++ b/tests/ui/privacy/private-in-public.stderr @@ -2,7 +2,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:13:5 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub const C: Priv = Priv; | ^^^^^^^^^^^^^^^^^ can't leak private type @@ -11,7 +14,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:14:5 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub static S: Priv = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type @@ -20,7 +26,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:15:5 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f1(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -29,7 +38,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:16:5 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f2() -> Priv { panic!() } | ^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -38,7 +50,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:17:19 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub struct S1(pub Priv); | ^^^^^^^^ can't leak private type @@ -47,7 +62,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:18:21 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub struct S2 { pub field: Priv } | ^^^^^^^^^^^^^^^ can't leak private type @@ -56,7 +74,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:20:9 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub const C: Priv = Priv; | ^^^^^^^^^^^^^^^^^ can't leak private type @@ -65,7 +86,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:21:9 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f1(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -74,7 +98,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:22:9 | LL | struct Priv; - | ----------- `types::Priv` declared as private + | ----------- + | | + | `types::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f2() -> Priv { panic!() } | ^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -173,7 +200,10 @@ error[E0446]: private type `generics::Priv` in public interface --> $DIR/private-in-public.rs:63:5 | LL | struct Priv(T); - | ------------------- `generics::Priv` declared as private + | ------------------- + | | + | `generics::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f1(arg: [Priv; 1]) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -182,7 +212,10 @@ error[E0446]: private type `generics::Priv` in public interface --> $DIR/private-in-public.rs:64:5 | LL | struct Priv(T); - | ------------------- `generics::Priv` declared as private + | ------------------- + | | + | `generics::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f2(arg: Pub) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -191,7 +224,10 @@ error[E0446]: private type `generics::Priv` in public interface --> $DIR/private-in-public.rs:65:5 | LL | struct Priv(T); - | ------------------- `generics::Priv` declared as private + | ------------------- + | | + | `generics::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f3(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -200,7 +236,10 @@ error[E0446]: private type `impls::Priv` in public interface --> $DIR/private-in-public.rs:80:9 | LL | struct Priv; - | ----------- `impls::Priv` declared as private + | ----------- + | | + | `impls::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -218,7 +257,10 @@ error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public.rs:104:5 | LL | struct Priv; - | ----------- `aliases_pub::Priv` declared as private + | ----------- + | | + | `aliases_pub::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f3(arg: ::Assoc) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -227,7 +269,10 @@ error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public.rs:109:9 | LL | struct Priv; - | ----------- `aliases_pub::Priv` declared as private + | ----------- + | | + | `aliases_pub::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -236,7 +281,10 @@ error[E0446]: private type `Priv1` in public interface --> $DIR/private-in-public.rs:131:5 | LL | struct Priv1; - | ------------ `Priv1` declared as private + | ------------ + | | + | `Priv1` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f1(arg: PrivUseAlias) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -245,7 +293,10 @@ error[E0446]: private type `Priv2` in public interface --> $DIR/private-in-public.rs:132:5 | LL | struct Priv2; - | ------------ `Priv2` declared as private + | ------------ + | | + | `Priv2` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f2(arg: PrivAlias) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -263,7 +314,10 @@ error[E0446]: private type `aliases_priv::Priv` in public interface --> $DIR/private-in-public.rs:133:5 | LL | struct Priv; - | ----------- `aliases_priv::Priv` declared as private + | ----------- + | | + | `aliases_priv::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f3(arg: ::Assoc) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -272,7 +326,10 @@ error[E0446]: private type `aliases_params::Priv` in public interface --> $DIR/private-in-public.rs:143:5 | LL | struct Priv; - | ----------- `aliases_params::Priv` declared as private + | ----------- + | | + | `aliases_params::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f2(arg: PrivAliasGeneric) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -281,7 +338,10 @@ error[E0446]: private type `aliases_params::Priv` in public interface --> $DIR/private-in-public.rs:145:5 | LL | struct Priv; - | ----------- `aliases_params::Priv` declared as private + | ----------- + | | + | `aliases_params::Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub fn f3(arg: Result) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type diff --git a/tests/ui/privacy/private-inferred-type.stderr b/tests/ui/privacy/private-inferred-type.stderr index fc3f9ab62bfa9..cc1a0db54cadb 100644 --- a/tests/ui/privacy/private-inferred-type.stderr +++ b/tests/ui/privacy/private-inferred-type.stderr @@ -2,7 +2,10 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-inferred-type.rs:61:36 | LL | struct Priv; - | ----------- `Priv` declared as private + | ----------- + | | + | `Priv` declared as private + | help: consider adding `pub` in front of it ... LL | impl TraitWithAssocTy for u8 { type AssocTy = Priv; } | ^^^^^^^^^^^^ can't leak private type @@ -11,7 +14,10 @@ error[E0446]: private type `S2` in public interface --> $DIR/private-inferred-type.rs:83:9 | LL | struct S2; - | --------- `S2` declared as private + | --------- + | | + | `S2` declared as private + | help: consider adding `pub` in front of it ... LL | type Target = S2Alias; | ^^^^^^^^^^^ can't leak private type diff --git a/tests/ui/privacy/restricted/private-in-public.stderr b/tests/ui/privacy/restricted/private-in-public.stderr index 65d996f0f0709..e6fa705d6ca8c 100644 --- a/tests/ui/privacy/restricted/private-in-public.stderr +++ b/tests/ui/privacy/restricted/private-in-public.stderr @@ -2,7 +2,10 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-in-public.rs:6:9 | LL | struct Priv; - | ----------- `Priv` declared as private + | ----------- + | | + | `Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub(crate) fn g(_: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -11,7 +14,10 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-in-public.rs:7:9 | LL | struct Priv; - | ----------- `Priv` declared as private + | ----------- + | | + | `Priv` declared as private + | help: consider adding `pub` in front of it ... LL | pub(crate) fn h(_: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type diff --git a/tests/ui/privacy/where-priv-type.stderr b/tests/ui/privacy/where-priv-type.stderr index c5fb2cdb0cf61..ed7f8a52fad0f 100644 --- a/tests/ui/privacy/where-priv-type.stderr +++ b/tests/ui/privacy/where-priv-type.stderr @@ -34,7 +34,10 @@ error[E0446]: private type `PrivTy` in public interface --> $DIR/where-priv-type.rs:43:1 | LL | struct PrivTy; - | ------------- `PrivTy` declared as private + | ------------- + | | + | `PrivTy` declared as private + | help: consider adding `pub` in front of it ... LL | impl S | ^^^^^^ can't leak private type @@ -59,7 +62,10 @@ LL | type AssocTy = Const<{ my_const_fn(U) }>; | ^^^^^^^^^^^^ can't leak private type ... LL | const fn my_const_fn(val: u8) -> u8 { - | ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private + | ----------------------------------- + | | + | `fn(u8) -> u8 {my_const_fn}` declared as private + | help: consider adding `pub` in front of it error: aborting due to 2 previous errors; 4 warnings emitted 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 39d4f5ac8d3cf..1fd6bfd1881c1 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 @@ -2,7 +2,10 @@ error[E0446]: private type `Snail` in public interface --> $DIR/issue-33174-restricted-type-in-public-interface.rs:18:1 | LL | pub(crate) struct Snail; - | ----------------------- `Snail` declared as private + | ----------------------- + | | + | `Snail` declared as private + | help: consider adding `pub` in front of it ... LL | pub type Helix_pomatia = Shell; | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -11,7 +14,10 @@ error[E0446]: crate-private type `Turtle` in public interface --> $DIR/issue-33174-restricted-type-in-public-interface.rs:21:1 | LL | pub(super) struct Turtle; - | ------------------------ `Turtle` declared as crate-private + | ------------------------ + | | + | `Turtle` declared as crate-private + | help: consider adding `pub` in front of it ... LL | pub type Dermochelys_coriacea = Shell; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private type @@ -20,7 +26,10 @@ error[E0446]: private type `Tortoise` in public interface --> $DIR/issue-33174-restricted-type-in-public-interface.rs:24:1 | LL | struct Tortoise; - | --------------- `Tortoise` declared as private + | --------------- + | | + | `Tortoise` declared as private + | help: consider adding `pub` in front of it ... LL | pub type Testudo_graeca = Shell; | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type 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 be83b7ce33f24..305e4995aa0c0 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 @@ -2,7 +2,10 @@ error[E0446]: private type `dst::Zst` in public interface --> $DIR/should_accept_if_dst_has_unreachable_field.rs:32:9 | LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type - | -------------------- `dst::Zst` declared as private + | -------------------- + | | + | `dst::Zst` declared as private + | help: consider adding `pub` in front of it ... LL | pub(in super) field: Zst, | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type 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 39b73302e364d..57543f525beb7 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 @@ -2,7 +2,10 @@ error[E0446]: private type `src::Zst` in public interface --> $DIR/should_accept_if_src_has_unreachable_field.rs:22:9 | LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type - | -------------------- `src::Zst` declared as private + | -------------------- + | | + | `src::Zst` declared as private + | help: consider adding `pub` in front of it ... LL | pub(in super) field: Zst, | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type