diff options
Diffstat (limited to '')
19 files changed, 165 insertions, 116 deletions
diff --git a/tests/ui/auxiliary/xc-private-method-lib.rs b/tests/ui/privacy/auxiliary/xc-private-method-lib.rs index 4d5ec6de3..4d5ec6de3 100644 --- a/tests/ui/auxiliary/xc-private-method-lib.rs +++ b/tests/ui/privacy/auxiliary/xc-private-method-lib.rs diff --git a/tests/ui/privacy/effective_visibilities.rs b/tests/ui/privacy/effective_visibilities.rs index ff20e20d3..e9ac93160 100644 --- a/tests/ui/privacy/effective_visibilities.rs +++ b/tests/ui/privacy/effective_visibilities.rs @@ -1,3 +1,4 @@ +#![rustc_effective_visibility] //~ ERROR Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub #![feature(rustc_attrs)] #[rustc_effective_visibility] @@ -17,13 +18,13 @@ mod outer { //~ ERROR Direct: pub(crate), Reexported: pub(crate), Reachable: pub } #[rustc_effective_visibility] - struct PrivStruct; //~ ERROR Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) - //~| ERROR Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) + struct PrivStruct; //~ ERROR not in the table + //~| ERROR not in the table #[rustc_effective_visibility] pub union PubUnion { //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub #[rustc_effective_visibility] - a: u8, //~ ERROR Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) + a: u8, //~ ERROR not in the table #[rustc_effective_visibility] pub b: u8, //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub } diff --git a/tests/ui/privacy/effective_visibilities.stderr b/tests/ui/privacy/effective_visibilities.stderr index 046b6095f..f74f812e1 100644 --- a/tests/ui/privacy/effective_visibilities.stderr +++ b/tests/ui/privacy/effective_visibilities.stderr @@ -1,140 +1,152 @@ +error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub + --> $DIR/effective_visibilities.rs:1:1 + | +LL | / #![rustc_effective_visibility] +LL | | #![feature(rustc_attrs)] +LL | | +LL | | #[rustc_effective_visibility] +... | +LL | | +LL | | fn main() {} + | |____________^ + error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate) - --> $DIR/effective_visibilities.rs:4:1 + --> $DIR/effective_visibilities.rs:5:1 | LL | mod outer { | ^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:6:5 + --> $DIR/effective_visibilities.rs:7:5 | LL | pub mod inner1 { | ^^^^^^^^^^^^^^ error: not in the table - --> $DIR/effective_visibilities.rs:9:9 + --> $DIR/effective_visibilities.rs:10:9 | LL | extern "C" {} | ^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:12:9 + --> $DIR/effective_visibilities.rs:13:9 | LL | pub trait PubTrait { | ^^^^^^^^^^^^^^^^^^ -error: Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) - --> $DIR/effective_visibilities.rs:20:9 +error: not in the table + --> $DIR/effective_visibilities.rs:21:9 | LL | struct PrivStruct; | ^^^^^^^^^^^^^^^^^ -error: Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) - --> $DIR/effective_visibilities.rs:20:9 +error: not in the table + --> $DIR/effective_visibilities.rs:21:9 | LL | struct PrivStruct; | ^^^^^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:24:9 + --> $DIR/effective_visibilities.rs:25:9 | LL | pub union PubUnion { | ^^^^^^^^^^^^^^^^^^ -error: Direct: pub(self), Reexported: pub(self), Reachable: pub(self), ReachableThroughImplTrait: pub(self) - --> $DIR/effective_visibilities.rs:26:13 +error: not in the table + --> $DIR/effective_visibilities.rs:27:13 | LL | a: u8, | ^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:28:13 + --> $DIR/effective_visibilities.rs:29:13 | LL | pub b: u8, | ^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:32:9 + --> $DIR/effective_visibilities.rs:33:9 | LL | pub enum Enum { | ^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:34:13 + --> $DIR/effective_visibilities.rs:35:13 | LL | A( | ^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:34:13 + --> $DIR/effective_visibilities.rs:35:13 | LL | A( | ^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:37:17 + --> $DIR/effective_visibilities.rs:38:17 | LL | PubUnion, | ^^^^^^^^ error: not in the table - --> $DIR/effective_visibilities.rs:43:5 + --> $DIR/effective_visibilities.rs:44:5 | LL | macro_rules! none_macro { | ^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub(self), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:49:5 + --> $DIR/effective_visibilities.rs:50:5 | LL | macro_rules! public_macro { | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:54:5 + --> $DIR/effective_visibilities.rs:55:5 | LL | pub struct ReachableStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:56:9 + --> $DIR/effective_visibilities.rs:57:9 | LL | pub a: u8, | ^^^^^^^^^ error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:61:9 + --> $DIR/effective_visibilities.rs:62:9 | LL | pub use outer::inner1; | ^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:67:5 + --> $DIR/effective_visibilities.rs:68:5 | LL | pub type HalfPublicImport = u8; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate) - --> $DIR/effective_visibilities.rs:70:5 + --> $DIR/effective_visibilities.rs:71:5 | LL | pub(crate) const HalfPublicImport: u8 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:74:9 + --> $DIR/effective_visibilities.rs:75:9 | LL | pub use half_public_import::HalfPublicImport; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:14:13 + --> $DIR/effective_visibilities.rs:15:13 | LL | const A: i32; | ^^^^^^^^^^^^ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:16:13 + --> $DIR/effective_visibilities.rs:17:13 | LL | type B; | ^^^^^^ -error: aborting due to 23 previous errors +error: aborting due to 24 previous errors diff --git a/tests/ui/privacy/issue-29161.rs b/tests/ui/privacy/issue-29161.rs index d80405aa8..5c926dee0 100644 --- a/tests/ui/privacy/issue-29161.rs +++ b/tests/ui/privacy/issue-29161.rs @@ -2,7 +2,7 @@ mod a { struct A; impl Default for A { - pub fn default() -> A { //~ ERROR unnecessary visibility qualifier + pub fn default() -> A { //~ ERROR visibility qualifiers are not permitted here A } } diff --git a/tests/ui/privacy/issue-29161.stderr b/tests/ui/privacy/issue-29161.stderr index 7ce95e4b0..1a6c80499 100644 --- a/tests/ui/privacy/issue-29161.stderr +++ b/tests/ui/privacy/issue-29161.stderr @@ -1,8 +1,10 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/issue-29161.rs:5:9 | LL | pub fn default() -> A { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait error[E0603]: struct `A` is private --> $DIR/issue-29161.rs:13:8 diff --git a/tests/ui/privacy/priv-in-bad-locations.rs b/tests/ui/privacy/priv-in-bad-locations.rs index 76af8c6cd..32c5b801f 100644 --- a/tests/ui/privacy/priv-in-bad-locations.rs +++ b/tests/ui/privacy/priv-in-bad-locations.rs @@ -1,4 +1,4 @@ -pub extern "C" { //~ ERROR unnecessary visibility qualifier +pub extern "C" { //~ ERROR visibility qualifiers are not permitted here pub fn bar(); } @@ -8,10 +8,10 @@ trait A { struct B; -pub impl B {} //~ ERROR unnecessary visibility qualifier +pub impl B {} //~ ERROR visibility qualifiers are not permitted here -pub impl A for B { //~ ERROR unnecessary visibility qualifier - pub fn foo(&self) {} //~ ERROR unnecessary visibility qualifier +pub impl A for B { //~ ERROR visibility qualifiers are not permitted here + pub fn foo(&self) {} //~ ERROR visibility qualifiers are not permitted here } pub fn main() {} diff --git a/tests/ui/privacy/priv-in-bad-locations.stderr b/tests/ui/privacy/priv-in-bad-locations.stderr index 75bd2fe47..70dab5bfe 100644 --- a/tests/ui/privacy/priv-in-bad-locations.stderr +++ b/tests/ui/privacy/priv-in-bad-locations.stderr @@ -1,30 +1,34 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:1:1 | LL | pub extern "C" { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual foreign items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:11:1 | LL | pub impl B {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual impl items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:13:1 | LL | pub impl A for B { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/priv-in-bad-locations.rs:14:5 | LL | pub fn foo(&self) {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait error: aborting due to 4 previous errors diff --git a/tests/ui/privacy/privacy-ns1.stderr b/tests/ui/privacy/privacy-ns1.stderr index 91bc84e70..9710cc486 100644 --- a/tests/ui/privacy/privacy-ns1.stderr +++ b/tests/ui/privacy/privacy-ns1.stderr @@ -13,7 +13,7 @@ LL | Baz(); | ~~~ help: consider importing this function instead | -LL | use foo2::Bar; +LL + use foo2::Bar; | error[E0425]: cannot find function, tuple struct or tuple variant `Bar` in this scope @@ -31,7 +31,7 @@ LL | Baz(); | ~~~ help: consider importing this function | -LL | use foo2::Bar; +LL + use foo2::Bar; | error[E0412]: cannot find type `Bar` in this scope @@ -49,7 +49,7 @@ LL | let _x: Box<Baz>; | ~~~ help: consider importing this trait | -LL | use foo1::Bar; +LL + use foo1::Bar; | error[E0747]: constant provided when a type was expected diff --git a/tests/ui/privacy/privacy-ns2.stderr b/tests/ui/privacy/privacy-ns2.stderr index 904e9013f..75e735e1e 100644 --- a/tests/ui/privacy/privacy-ns2.stderr +++ b/tests/ui/privacy/privacy-ns2.stderr @@ -6,7 +6,7 @@ LL | Bar(); | help: consider importing this function instead | -LL | use foo2::Bar; +LL + use foo2::Bar; | error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar` @@ -24,7 +24,7 @@ LL | Baz(); | ~~~ help: consider importing this function instead | -LL | use foo2::Bar; +LL + use foo2::Bar; | error[E0573]: expected type, found function `Bar` @@ -39,7 +39,7 @@ LL | let _x = Bar(); | ~ help: consider importing this trait instead | -LL | use foo1::Bar; +LL + use foo1::Bar; | error[E0603]: trait `Bar` is private diff --git a/tests/ui/privacy/privacy-sanity.rs b/tests/ui/privacy/privacy-sanity.rs index 8bbf1ab5d..6622089dd 100644 --- a/tests/ui/privacy/privacy-sanity.rs +++ b/tests/ui/privacy/privacy-sanity.rs @@ -10,17 +10,17 @@ pub struct S { } struct Ts(pub u8); -pub impl Tr for S { //~ ERROR unnecessary visibility qualifier - pub fn f() {} //~ ERROR unnecessary visibility qualifier - pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier - pub type T = u8; //~ ERROR unnecessary visibility qualifier +pub impl Tr for S { //~ ERROR visibility qualifiers are not permitted here + pub fn f() {} //~ ERROR visibility qualifiers are not permitted here + pub const C: u8 = 0; //~ ERROR visibility qualifiers are not permitted here + pub type T = u8; //~ ERROR visibility qualifiers are not permitted here } -pub impl S { //~ ERROR unnecessary visibility qualifier +pub impl S { //~ ERROR visibility qualifiers are not permitted here pub fn f() {} pub const C: u8 = 0; // pub type T = u8; } -pub extern "C" { //~ ERROR unnecessary visibility qualifier +pub extern "C" { //~ ERROR visibility qualifiers are not permitted here pub fn f(); pub static St: u8; } @@ -36,17 +36,17 @@ const MAIN: u8 = { } struct Ts(pub u8); - pub impl Tr for S { //~ ERROR unnecessary visibility qualifier - pub fn f() {} //~ ERROR unnecessary visibility qualifier - pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier - pub type T = u8; //~ ERROR unnecessary visibility qualifier + pub impl Tr for S { //~ ERROR visibility qualifiers are not permitted here + pub fn f() {} //~ ERROR visibility qualifiers are not permitted here + pub const C: u8 = 0; //~ ERROR visibility qualifiers are not permitted here + pub type T = u8; //~ ERROR visibility qualifiers are not permitted here } - pub impl S { //~ ERROR unnecessary visibility qualifier + pub impl S { //~ ERROR visibility qualifiers are not permitted here pub fn f() {} pub const C: u8 = 0; // pub type T = u8; } - pub extern "C" { //~ ERROR unnecessary visibility qualifier + pub extern "C" { //~ ERROR visibility qualifiers are not permitted here pub fn f(); pub static St: u8; } @@ -65,17 +65,17 @@ fn main() { } struct Ts(pub u8); - pub impl Tr for S { //~ ERROR unnecessary visibility qualifier - pub fn f() {} //~ ERROR unnecessary visibility qualifier - pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier - pub type T = u8; //~ ERROR unnecessary visibility qualifier + pub impl Tr for S { //~ ERROR visibility qualifiers are not permitted here + pub fn f() {} //~ ERROR visibility qualifiers are not permitted here + pub const C: u8 = 0; //~ ERROR visibility qualifiers are not permitted here + pub type T = u8; //~ ERROR visibility qualifiers are not permitted here } - pub impl S { //~ ERROR unnecessary visibility qualifier + pub impl S { //~ ERROR visibility qualifiers are not permitted here pub fn f() {} pub const C: u8 = 0; // pub type T = u8; } - pub extern "C" { //~ ERROR unnecessary visibility qualifier + pub extern "C" { //~ ERROR visibility qualifiers are not permitted here pub fn f(); pub static St: u8; } diff --git a/tests/ui/privacy/privacy-sanity.stderr b/tests/ui/privacy/privacy-sanity.stderr index c92553fd1..a537f8c19 100644 --- a/tests/ui/privacy/privacy-sanity.stderr +++ b/tests/ui/privacy/privacy-sanity.stderr @@ -1,120 +1,144 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:13:1 | LL | pub impl Tr for S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:14:5 | LL | pub fn f() {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:15:5 | LL | pub const C: u8 = 0; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:16:5 | LL | pub type T = u8; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:18:1 | LL | pub impl S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual impl items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:23:1 | LL | pub extern "C" { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual foreign items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:39:5 | LL | pub impl Tr for S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:40:9 | LL | pub fn f() {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:41:9 | LL | pub const C: u8 = 0; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:42:9 | LL | pub type T = u8; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:44:5 | LL | pub impl S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual impl items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:49:5 | LL | pub extern "C" { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual foreign items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:68:5 | LL | pub impl Tr for S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:69:9 | LL | pub fn f() {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:70:9 | LL | pub const C: u8 = 0; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:71:9 | LL | pub type T = u8; - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:73:5 | LL | pub impl S { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual impl items instead -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/privacy-sanity.rs:78:5 | LL | pub extern "C" { - | ^^^ `pub` not permitted here because it's implied + | ^^^ | = note: place qualifiers on individual foreign items instead diff --git a/tests/ui/privacy/private-in-public-assoc-ty.rs b/tests/ui/privacy/private-in-public-assoc-ty.rs index fba72c131..d4d379bdb 100644 --- a/tests/ui/privacy/private-in-public-assoc-ty.rs +++ b/tests/ui/privacy/private-in-public-assoc-ty.rs @@ -2,7 +2,7 @@ // This test also ensures that the checks are performed even inside private modules. #![feature(associated_type_defaults)] -#![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] mod m { struct Priv; 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 c7df31529..fe6ed4673 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,5 +1,5 @@ // build-pass (FIXME(62277): could be check-pass?) - +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![deny(private_in_public)] diff --git a/tests/ui/privacy/useless-pub.rs b/tests/ui/privacy/useless-pub.rs index fde7cd5d8..e4b671142 100644 --- a/tests/ui/privacy/useless-pub.rs +++ b/tests/ui/privacy/useless-pub.rs @@ -5,12 +5,12 @@ pub trait E { } impl E for A { - pub fn foo(&self) {} //~ ERROR: unnecessary visibility qualifier + pub fn foo(&self) {} //~ ERROR: visibility qualifiers are not permitted here } enum Foo { - V1 { pub f: i32 }, //~ ERROR unnecessary visibility qualifier - V2(pub i32), //~ ERROR unnecessary visibility qualifier + V1 { pub f: i32 }, //~ ERROR visibility qualifiers are not permitted here + V2(pub i32), //~ ERROR visibility qualifiers are not permitted here } fn main() {} diff --git a/tests/ui/privacy/useless-pub.stderr b/tests/ui/privacy/useless-pub.stderr index 14c4983ae..73497e3fe 100644 --- a/tests/ui/privacy/useless-pub.stderr +++ b/tests/ui/privacy/useless-pub.stderr @@ -1,20 +1,26 @@ -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/useless-pub.rs:8:5 | LL | pub fn foo(&self) {} - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: trait items always share the visibility of their trait -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/useless-pub.rs:12:10 | LL | V1 { pub f: i32 }, - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: enum variants and their fields always share the visibility of the enum they are in -error[E0449]: unnecessary visibility qualifier +error[E0449]: visibility qualifiers are not permitted here --> $DIR/useless-pub.rs:13:8 | LL | V2(pub i32), - | ^^^ `pub` not permitted here because it's implied + | ^^^ + | + = note: enum variants and their fields always share the visibility of the enum they are in error: aborting due to 3 previous errors diff --git a/tests/ui/xc-private-method.rs b/tests/ui/privacy/xc-private-method.rs index f05994646..f05994646 100644 --- a/tests/ui/xc-private-method.rs +++ b/tests/ui/privacy/xc-private-method.rs diff --git a/tests/ui/xc-private-method.stderr b/tests/ui/privacy/xc-private-method.stderr index 0eabc592a..0eabc592a 100644 --- a/tests/ui/xc-private-method.stderr +++ b/tests/ui/privacy/xc-private-method.stderr diff --git a/tests/ui/xc-private-method2.rs b/tests/ui/privacy/xc-private-method2.rs index f11b25108..f11b25108 100644 --- a/tests/ui/xc-private-method2.rs +++ b/tests/ui/privacy/xc-private-method2.rs diff --git a/tests/ui/xc-private-method2.stderr b/tests/ui/privacy/xc-private-method2.stderr index af0c3cfcb..af0c3cfcb 100644 --- a/tests/ui/xc-private-method2.stderr +++ b/tests/ui/privacy/xc-private-method2.stderr |