summaryrefslogtreecommitdiffstats
path: root/src/test/ui/privacy
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/privacy')
-rw-r--r--src/test/ui/privacy/access_levels.rs49
-rw-r--r--src/test/ui/privacy/access_levels.stderr125
-rw-r--r--src/test/ui/privacy/associated-item-privacy-inherent.rs6
-rw-r--r--src/test/ui/privacy/associated-item-privacy-inherent.stderr6
-rw-r--r--src/test/ui/privacy/associated-item-privacy-trait.rs6
-rw-r--r--src/test/ui/privacy/associated-item-privacy-trait.stderr6
-rw-r--r--src/test/ui/privacy/auxiliary/issue-17718-const-privacy.rs8
-rw-r--r--src/test/ui/privacy/effective_visibilities.rs75
-rw-r--r--src/test/ui/privacy/effective_visibilities.stderr134
-rw-r--r--src/test/ui/privacy/issue-17718-const-privacy.rs16
-rw-r--r--src/test/ui/privacy/issue-17718-const-privacy.stderr27
-rw-r--r--src/test/ui/privacy/issue-30079.stderr2
-rw-r--r--src/test/ui/privacy/private-in-public-assoc-ty.stderr2
-rw-r--r--src/test/ui/privacy/private-in-public-non-principal.stderr2
-rw-r--r--src/test/ui/privacy/private-in-public-warn.stderr4
-rw-r--r--src/test/ui/privacy/private-inferred-type-3.rs2
-rw-r--r--src/test/ui/privacy/private-inferred-type-3.stderr2
-rw-r--r--src/test/ui/privacy/private-inferred-type.rs2
-rw-r--r--src/test/ui/privacy/private-inferred-type.stderr2
-rw-r--r--src/test/ui/privacy/reachable-unnameable-items.rs1
-rw-r--r--src/test/ui/privacy/where-priv-type.stderr2
21 files changed, 282 insertions, 197 deletions
diff --git a/src/test/ui/privacy/access_levels.rs b/src/test/ui/privacy/access_levels.rs
deleted file mode 100644
index d51d2b572..000000000
--- a/src/test/ui/privacy/access_levels.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-#![feature(rustc_attrs)]
-
-#[rustc_access_level] mod outer { //~ ERROR None
- #[rustc_access_level] pub mod inner { //~ ERROR Some(Exported)
- #[rustc_access_level]
- extern "C" { //~ ERROR Some(Exported)
- #[rustc_access_level] static a: u8; //~ ERROR None
- #[rustc_access_level] pub fn b(); //~ ERROR Some(Exported)
- }
- #[rustc_access_level]
- pub trait Trait { //~ ERROR Some(Exported)
- #[rustc_access_level] const A: i32; //~ ERROR Some(Exported)
- #[rustc_access_level] type B; //~ ERROR Some(Exported)
- }
-
- #[rustc_access_level]
- pub struct Struct { //~ ERROR Some(Exported)
- #[rustc_access_level] a: u8, //~ ERROR None
- #[rustc_access_level] pub b: u8, //~ ERROR Some(Exported)
- }
-
- #[rustc_access_level]
- pub union Union { //~ ERROR Some(Exported)
- #[rustc_access_level] a: u8, //~ ERROR None
- #[rustc_access_level] pub b: u8, //~ ERROR Some(Exported)
- }
-
- #[rustc_access_level]
- pub enum Enum { //~ ERROR Some(Exported)
- #[rustc_access_level] A( //~ ERROR Some(Exported)
- #[rustc_access_level] Struct, //~ ERROR Some(Exported)
- #[rustc_access_level] Union, //~ ERROR Some(Exported)
- ),
- }
- }
-
- #[rustc_access_level] macro_rules! none_macro { //~ ERROR None
- () => {};
- }
-
- #[macro_export]
- #[rustc_access_level] macro_rules! public_macro { //~ ERROR Some(Public)
- () => {};
- }
-}
-
-pub use outer::inner;
-
-fn main() {}
diff --git a/src/test/ui/privacy/access_levels.stderr b/src/test/ui/privacy/access_levels.stderr
deleted file mode 100644
index f326293c3..000000000
--- a/src/test/ui/privacy/access_levels.stderr
+++ /dev/null
@@ -1,125 +0,0 @@
-error: None
- --> $DIR/access_levels.rs:3:23
- |
-LL | #[rustc_access_level] mod outer {
- | ^^^^^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:4:27
- |
-LL | #[rustc_access_level] pub mod inner {
- | ^^^^^^^^^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:6:9
- |
-LL | / extern "C" {
-LL | | #[rustc_access_level] static a: u8;
-LL | | #[rustc_access_level] pub fn b();
-LL | | }
- | |_________^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:11:9
- |
-LL | pub trait Trait {
- | ^^^^^^^^^^^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:17:9
- |
-LL | pub struct Struct {
- | ^^^^^^^^^^^^^^^^^
-
-error: None
- --> $DIR/access_levels.rs:18:35
- |
-LL | #[rustc_access_level] a: u8,
- | ^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:19:35
- |
-LL | #[rustc_access_level] pub b: u8,
- | ^^^^^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:23:9
- |
-LL | pub union Union {
- | ^^^^^^^^^^^^^^^
-
-error: None
- --> $DIR/access_levels.rs:24:35
- |
-LL | #[rustc_access_level] a: u8,
- | ^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:25:35
- |
-LL | #[rustc_access_level] pub b: u8,
- | ^^^^^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:29:9
- |
-LL | pub enum Enum {
- | ^^^^^^^^^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:30:35
- |
-LL | #[rustc_access_level] A(
- | ^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:31:39
- |
-LL | #[rustc_access_level] Struct,
- | ^^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:32:39
- |
-LL | #[rustc_access_level] Union,
- | ^^^^^
-
-error: None
- --> $DIR/access_levels.rs:37:27
- |
-LL | #[rustc_access_level] macro_rules! none_macro {
- | ^^^^^^^^^^^^^^^^^^^^^^^
-
-error: Some(Public)
- --> $DIR/access_levels.rs:42:27
- |
-LL | #[rustc_access_level] macro_rules! public_macro {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:12:35
- |
-LL | #[rustc_access_level] const A: i32;
- | ^^^^^^^^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:13:35
- |
-LL | #[rustc_access_level] type B;
- | ^^^^^^
-
-error: None
- --> $DIR/access_levels.rs:7:35
- |
-LL | #[rustc_access_level] static a: u8;
- | ^^^^^^^^^^^^
-
-error: Some(Exported)
- --> $DIR/access_levels.rs:8:35
- |
-LL | #[rustc_access_level] pub fn b();
- | ^^^^^^^^^^
-
-error: aborting due to 20 previous errors
-
diff --git a/src/test/ui/privacy/associated-item-privacy-inherent.rs b/src/test/ui/privacy/associated-item-privacy-inherent.rs
index c3ae92023..7b7c734a9 100644
--- a/src/test/ui/privacy/associated-item-privacy-inherent.rs
+++ b/src/test/ui/privacy/associated-item-privacy-inherent.rs
@@ -11,11 +11,11 @@ mod priv_nominal {
pub macro mac() {
let value = Pub::method;
- //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
+ //~^ ERROR type `for<'a> fn(&'a priv_nominal::Pub) {priv_nominal::Pub::method}` is private
value;
- //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
+ //~^ ERROR type `for<'a> fn(&'a priv_nominal::Pub) {priv_nominal::Pub::method}` is private
Pub.method();
- //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
+ //~^ ERROR type `for<'a> fn(&'a priv_nominal::Pub) {priv_nominal::Pub::method}` is private
Pub::CONST;
//~^ ERROR associated constant `CONST` is private
// let _: Pub::AssocTy;
diff --git a/src/test/ui/privacy/associated-item-privacy-inherent.stderr b/src/test/ui/privacy/associated-item-privacy-inherent.stderr
index 4478e5c2a..f4d4ee459 100644
--- a/src/test/ui/privacy/associated-item-privacy-inherent.stderr
+++ b/src/test/ui/privacy/associated-item-privacy-inherent.stderr
@@ -1,4 +1,4 @@
-error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
+error: type `for<'a> fn(&'a priv_nominal::Pub) {priv_nominal::Pub::method}` is private
--> $DIR/associated-item-privacy-inherent.rs:13:21
|
LL | let value = Pub::method;
@@ -9,7 +9,7 @@ LL | priv_nominal::mac!();
|
= note: this error originates in the macro `priv_nominal::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
+error: type `for<'a> fn(&'a priv_nominal::Pub) {priv_nominal::Pub::method}` is private
--> $DIR/associated-item-privacy-inherent.rs:15:9
|
LL | value;
@@ -20,7 +20,7 @@ LL | priv_nominal::mac!();
|
= note: this error originates in the macro `priv_nominal::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
+error: type `for<'a> fn(&'a priv_nominal::Pub) {priv_nominal::Pub::method}` is private
--> $DIR/associated-item-privacy-inherent.rs:17:13
|
LL | Pub.method();
diff --git a/src/test/ui/privacy/associated-item-privacy-trait.rs b/src/test/ui/privacy/associated-item-privacy-trait.rs
index c07aeed99..ad9a5e15c 100644
--- a/src/test/ui/privacy/associated-item-privacy-trait.rs
+++ b/src/test/ui/privacy/associated-item-privacy-trait.rs
@@ -13,11 +13,11 @@ mod priv_trait {
pub macro mac() {
let value = <Pub as PrivTr>::method;
- //~^ ERROR type `for<'r> fn(&'r priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
+ //~^ ERROR type `for<'a> fn(&'a priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
value;
- //~^ ERROR type `for<'r> fn(&'r priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
+ //~^ ERROR type `for<'a> fn(&'a priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
Pub.method();
- //~^ ERROR type `for<'r> fn(&'r Self) {<Self as PrivTr>::method}` is private
+ //~^ ERROR type `for<'a> fn(&'a Self) {<Self as PrivTr>::method}` is private
<Pub as PrivTr>::CONST;
//~^ ERROR associated constant `<Pub as PrivTr>::CONST` is private
let _: <Pub as PrivTr>::AssocTy;
diff --git a/src/test/ui/privacy/associated-item-privacy-trait.stderr b/src/test/ui/privacy/associated-item-privacy-trait.stderr
index 6095f5f42..c4be1a9d9 100644
--- a/src/test/ui/privacy/associated-item-privacy-trait.stderr
+++ b/src/test/ui/privacy/associated-item-privacy-trait.stderr
@@ -1,4 +1,4 @@
-error: type `for<'r> fn(&'r priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
+error: type `for<'a> fn(&'a priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
--> $DIR/associated-item-privacy-trait.rs:15:21
|
LL | let value = <Pub as PrivTr>::method;
@@ -9,7 +9,7 @@ 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: type `for<'r> fn(&'r priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
+error: type `for<'a> fn(&'a priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
--> $DIR/associated-item-privacy-trait.rs:17:9
|
LL | value;
@@ -20,7 +20,7 @@ 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: type `for<'r> fn(&'r Self) {<Self as PrivTr>::method}` is private
+error: type `for<'a> fn(&'a Self) {<Self as PrivTr>::method}` is private
--> $DIR/associated-item-privacy-trait.rs:19:13
|
LL | Pub.method();
diff --git a/src/test/ui/privacy/auxiliary/issue-17718-const-privacy.rs b/src/test/ui/privacy/auxiliary/issue-17718-const-privacy.rs
new file mode 100644
index 000000000..93cf4bf3e
--- /dev/null
+++ b/src/test/ui/privacy/auxiliary/issue-17718-const-privacy.rs
@@ -0,0 +1,8 @@
+pub use foo::FOO2;
+
+pub const FOO: usize = 3;
+const BAR: usize = 3;
+
+mod foo {
+ pub const FOO2: usize = 3;
+}
diff --git a/src/test/ui/privacy/effective_visibilities.rs b/src/test/ui/privacy/effective_visibilities.rs
new file mode 100644
index 000000000..1d806a1d1
--- /dev/null
+++ b/src/test/ui/privacy/effective_visibilities.rs
@@ -0,0 +1,75 @@
+#![feature(rustc_attrs)]
+
+#[rustc_effective_visibility]
+mod outer { //~ ERROR Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate)
+ #[rustc_effective_visibility]
+ pub mod inner1 { //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+
+ #[rustc_effective_visibility]
+ extern "C" {} //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+
+ #[rustc_effective_visibility]
+ pub trait PubTrait { //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ #[rustc_effective_visibility]
+ const A: i32; //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ #[rustc_effective_visibility]
+ type B; //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ }
+
+ #[rustc_effective_visibility]
+ struct PrivStruct; //~ 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 not in the table
+ #[rustc_effective_visibility]
+ pub b: u8, //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ }
+
+ #[rustc_effective_visibility]
+ pub enum Enum { //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ #[rustc_effective_visibility]
+ A( //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ #[rustc_effective_visibility]
+ PubUnion, //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ ),
+ }
+ }
+
+ #[rustc_effective_visibility]
+ macro_rules! none_macro { //~ Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate)
+ () => {};
+ }
+
+ #[macro_export]
+ #[rustc_effective_visibility]
+ macro_rules! public_macro { //~ Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ () => {};
+ }
+
+ #[rustc_effective_visibility]
+ pub struct ReachableStruct { //~ ERROR Direct: pub(crate), Reexported: pub(crate), Reachable: pub, ReachableThroughImplTrait: pub
+ #[rustc_effective_visibility]
+ pub a: u8, //~ ERROR Direct: pub(crate), Reexported: pub(crate), Reachable: pub, ReachableThroughImplTrait: pub
+ }
+}
+
+#[rustc_effective_visibility]
+pub use outer::inner1; //~ ERROR Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+
+pub fn foo() -> outer::ReachableStruct { outer::ReachableStruct {a: 0} }
+
+mod half_public_import {
+ #[rustc_effective_visibility]
+ pub type HalfPublicImport = u8; //~ ERROR Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ #[rustc_effective_visibility]
+ #[allow(non_upper_case_globals)]
+ pub(crate) const HalfPublicImport: u8 = 0; //~ ERROR Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate)
+}
+
+#[rustc_effective_visibility]
+pub use half_public_import::HalfPublicImport; //~ ERROR Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ //~^ ERROR Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+
+fn main() {}
diff --git a/src/test/ui/privacy/effective_visibilities.stderr b/src/test/ui/privacy/effective_visibilities.stderr
new file mode 100644
index 000000000..1c6201600
--- /dev/null
+++ b/src/test/ui/privacy/effective_visibilities.stderr
@@ -0,0 +1,134 @@
+error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate)
+ --> $DIR/effective_visibilities.rs:4:1
+ |
+LL | mod outer {
+ | ^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:6:5
+ |
+LL | pub mod inner1 {
+ | ^^^^^^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:9:9
+ |
+LL | extern "C" {}
+ | ^^^^^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:12:9
+ |
+LL | pub trait PubTrait {
+ | ^^^^^^^^^^^^^^^^^^
+
+error: not in the table
+ --> $DIR/effective_visibilities.rs:20:9
+ |
+LL | struct PrivStruct;
+ | ^^^^^^^^^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:23:9
+ |
+LL | pub union PubUnion {
+ | ^^^^^^^^^^^^^^^^^^
+
+error: not in the table
+ --> $DIR/effective_visibilities.rs:25:13
+ |
+LL | a: u8,
+ | ^^^^^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:27:13
+ |
+LL | pub b: u8,
+ | ^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:31:9
+ |
+LL | pub enum Enum {
+ | ^^^^^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:33:13
+ |
+LL | A(
+ | ^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:35:17
+ |
+LL | PubUnion,
+ | ^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate)
+ --> $DIR/effective_visibilities.rs:41:5
+ |
+LL | macro_rules! none_macro {
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:47:5
+ |
+LL | macro_rules! public_macro {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:52:5
+ |
+LL | pub struct ReachableStruct {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:54:9
+ |
+LL | pub a: u8,
+ | ^^^^^^^^^
+
+error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:59:9
+ |
+LL | pub use outer::inner1;
+ | ^^^^^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:65:5
+ |
+LL | pub type HalfPublicImport = u8;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate)
+ --> $DIR/effective_visibilities.rs:68:5
+ |
+LL | pub(crate) const HalfPublicImport: u8 = 0;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:72:9
+ |
+LL | pub use half_public_import::HalfPublicImport;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:72:9
+ |
+LL | pub use half_public_import::HalfPublicImport;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:14:13
+ |
+LL | const A: i32;
+ | ^^^^^^^^^^^^
+
+error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
+ --> $DIR/effective_visibilities.rs:16:13
+ |
+LL | type B;
+ | ^^^^^^
+
+error: aborting due to 22 previous errors
+
diff --git a/src/test/ui/privacy/issue-17718-const-privacy.rs b/src/test/ui/privacy/issue-17718-const-privacy.rs
new file mode 100644
index 000000000..6ab3a60df
--- /dev/null
+++ b/src/test/ui/privacy/issue-17718-const-privacy.rs
@@ -0,0 +1,16 @@
+// aux-build:issue-17718-const-privacy.rs
+
+extern crate issue_17718_const_privacy as other;
+
+use a::B; //~ ERROR: constant `B` is private
+use other::{
+ FOO,
+ BAR, //~ ERROR: constant `BAR` is private
+ FOO2,
+};
+
+mod a {
+ const B: usize = 3;
+}
+
+fn main() {}
diff --git a/src/test/ui/privacy/issue-17718-const-privacy.stderr b/src/test/ui/privacy/issue-17718-const-privacy.stderr
new file mode 100644
index 000000000..133a6360b
--- /dev/null
+++ b/src/test/ui/privacy/issue-17718-const-privacy.stderr
@@ -0,0 +1,27 @@
+error[E0603]: constant `B` is private
+ --> $DIR/issue-17718-const-privacy.rs:5:8
+ |
+LL | use a::B;
+ | ^ private constant
+ |
+note: the constant `B` is defined here
+ --> $DIR/issue-17718-const-privacy.rs:13:5
+ |
+LL | const B: usize = 3;
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: constant `BAR` is private
+ --> $DIR/issue-17718-const-privacy.rs:8:5
+ |
+LL | BAR,
+ | ^^^ private constant
+ |
+note: the constant `BAR` is defined here
+ --> $DIR/auxiliary/issue-17718-const-privacy.rs:4:1
+ |
+LL | const BAR: usize = 3;
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/privacy/issue-30079.stderr b/src/test/ui/privacy/issue-30079.stderr
index dc98cfe3b..9179ff339 100644
--- a/src/test/ui/privacy/issue-30079.stderr
+++ b/src/test/ui/privacy/issue-30079.stderr
@@ -4,9 +4,9 @@ warning: private type `m1::Priv` in public interface (error E0446)
LL | pub fn f(_: Priv) {}
| ^^^^^^^^^^^^^^^^^
|
- = note: `#[warn(private_in_public)]` on by default
= 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[E0446]: private type `m2::Priv` in public interface
--> $DIR/issue-30079.rs:18:9
diff --git a/src/test/ui/privacy/private-in-public-assoc-ty.stderr b/src/test/ui/privacy/private-in-public-assoc-ty.stderr
index 1abeafe39..a59027d81 100644
--- a/src/test/ui/privacy/private-in-public-assoc-ty.stderr
+++ b/src/test/ui/privacy/private-in-public-assoc-ty.stderr
@@ -13,9 +13,9 @@ warning: private trait `PrivTr` in public interface (error E0445)
LL | type Alias1: PrivTr;
| ^^^^^^^^^^^^^^^^^^^
|
- = note: `#[warn(private_in_public)]` on by default
= 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: private type `Priv` in public interface (error E0446)
--> $DIR/private-in-public-assoc-ty.rs:27:9
diff --git a/src/test/ui/privacy/private-in-public-non-principal.stderr b/src/test/ui/privacy/private-in-public-non-principal.stderr
index 5b4123ea8..de20cada4 100644
--- a/src/test/ui/privacy/private-in-public-non-principal.stderr
+++ b/src/test/ui/privacy/private-in-public-non-principal.stderr
@@ -4,9 +4,9 @@ warning: private trait `PrivNonPrincipal` in public interface (error E0445)
LL | pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: `#[warn(private_in_public)]` on by default
= 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: missing documentation for an associated function
--> $DIR/private-in-public-non-principal.rs:14:9
diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr
index f2ff6cf2f..66f91ce6f 100644
--- a/src/test/ui/privacy/private-in-public-warn.stderr
+++ b/src/test/ui/privacy/private-in-public-warn.stderr
@@ -4,13 +4,13 @@ error: private type `types::Priv` in public interface (error E0446)
LL | pub type Alias = Priv;
| ^^^^^^^^^^^^^^
|
+ = 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-warn.rs:5:9
|
LL | #![deny(private_in_public)]
| ^^^^^^^^^^^^^^^^^
- = 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>
error: private type `types::Priv` in public interface (error E0446)
--> $DIR/private-in-public-warn.rs:18:12
diff --git a/src/test/ui/privacy/private-inferred-type-3.rs b/src/test/ui/privacy/private-inferred-type-3.rs
index 00f0a715a..0337aedd0 100644
--- a/src/test/ui/privacy/private-inferred-type-3.rs
+++ b/src/test/ui/privacy/private-inferred-type-3.rs
@@ -6,7 +6,7 @@
// error-pattern:type `fn() {<u8 as ext::PrivTrait>::method}` is private
// error-pattern:type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct}` is private
// error-pattern:type `fn(u8) -> PubTupleStruct {PubTupleStruct}` is private
-// error-pattern:type `for<'r> fn(&'r Pub<u8>) {Pub::<u8>::priv_method}` is private
+// error-pattern:type `for<'a> fn(&'a Pub<u8>) {Pub::<u8>::priv_method}` is private
#![feature(decl_macro)]
diff --git a/src/test/ui/privacy/private-inferred-type-3.stderr b/src/test/ui/privacy/private-inferred-type-3.stderr
index f9dd1c3d0..00b61512d 100644
--- a/src/test/ui/privacy/private-inferred-type-3.stderr
+++ b/src/test/ui/privacy/private-inferred-type-3.stderr
@@ -46,7 +46,7 @@ LL | ext::m!();
|
= note: this error originates in the macro `ext::m` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: type `for<'r> fn(&'r Pub<u8>) {Pub::<u8>::priv_method}` is private
+error: type `for<'a> fn(&'a Pub<u8>) {Pub::<u8>::priv_method}` is private
--> $DIR/private-inferred-type-3.rs:16:5
|
LL | ext::m!();
diff --git a/src/test/ui/privacy/private-inferred-type.rs b/src/test/ui/privacy/private-inferred-type.rs
index b083a3970..e8743dd96 100644
--- a/src/test/ui/privacy/private-inferred-type.rs
+++ b/src/test/ui/privacy/private-inferred-type.rs
@@ -47,7 +47,7 @@ mod m {
PubTupleStruct;
//~^ ERROR type `fn(u8) -> PubTupleStruct {PubTupleStruct}` is private
Pub(0u8).priv_method();
- //~^ ERROR type `for<'r> fn(&'r Pub<u8>) {Pub::<u8>::priv_method}` is private
+ //~^ ERROR type `for<'a> fn(&'a Pub<u8>) {Pub::<u8>::priv_method}` is private
}
trait Trait {}
diff --git a/src/test/ui/privacy/private-inferred-type.stderr b/src/test/ui/privacy/private-inferred-type.stderr
index aecd8b58c..fc3f9ab62 100644
--- a/src/test/ui/privacy/private-inferred-type.stderr
+++ b/src/test/ui/privacy/private-inferred-type.stderr
@@ -161,7 +161,7 @@ LL | m::m!();
|
= note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: type `for<'r> fn(&'r Pub<u8>) {Pub::<u8>::priv_method}` is private
+error: type `for<'a> fn(&'a Pub<u8>) {Pub::<u8>::priv_method}` is private
--> $DIR/private-inferred-type.rs:49:18
|
LL | Pub(0u8).priv_method();
diff --git a/src/test/ui/privacy/reachable-unnameable-items.rs b/src/test/ui/privacy/reachable-unnameable-items.rs
index 1c91541e6..1babe0119 100644
--- a/src/test/ui/privacy/reachable-unnameable-items.rs
+++ b/src/test/ui/privacy/reachable-unnameable-items.rs
@@ -1,5 +1,4 @@
// run-pass
-// ignore-wasm32-bare compiled with panic=abort by default
// needs-unwind
// aux-build:reachable-unnameable-items.rs
diff --git a/src/test/ui/privacy/where-priv-type.stderr b/src/test/ui/privacy/where-priv-type.stderr
index 7eb71346a..c5fb2cdb0 100644
--- a/src/test/ui/privacy/where-priv-type.stderr
+++ b/src/test/ui/privacy/where-priv-type.stderr
@@ -4,9 +4,9 @@ warning: private type `PrivTy` in public interface (error E0446)
LL | pub struct S
| ^^^^^^^^^^^^
|
- = note: `#[warn(private_in_public)]` on by default
= 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: private type `PrivTy` in public interface (error E0446)
--> $DIR/where-priv-type.rs:27:1