summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
commit023939b627b7dc93b01471f7d41fb8553ddb4ffa (patch)
tree60fc59477c605c72b0a1051409062ddecc43f877 /tests/ui/privacy
parentAdding debian version 1.72.1+dfsg1-1. (diff)
downloadrustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.tar.xz
rustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/privacy')
-rw-r--r--tests/ui/privacy/issue-113860-1.rs16
-rw-r--r--tests/ui/privacy/issue-113860-1.stderr49
-rw-r--r--tests/ui/privacy/issue-113860-2.rs16
-rw-r--r--tests/ui/privacy/issue-113860-2.stderr49
-rw-r--r--tests/ui/privacy/issue-113860.rs16
-rw-r--r--tests/ui/privacy/issue-113860.stderr49
-rw-r--r--tests/ui/privacy/privacy2.rs2
-rw-r--r--tests/ui/privacy/privacy2.stderr8
-rw-r--r--tests/ui/privacy/privacy3.rs2
-rw-r--r--tests/ui/privacy/privacy3.stderr2
-rw-r--r--tests/ui/privacy/sealed-traits/sealed-trait-local.stderr2
-rw-r--r--tests/ui/privacy/unnameable_types.rs4
-rw-r--r--tests/ui/privacy/unnameable_types.stderr14
13 files changed, 208 insertions, 21 deletions
diff --git a/tests/ui/privacy/issue-113860-1.rs b/tests/ui/privacy/issue-113860-1.rs
new file mode 100644
index 000000000..86ccca41f
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-1.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+pub trait Trait {
+ //~^ ERROR trait has missing stability attribute
+ fn fun() {}
+ //~^ ERROR associated function has missing stability attribute
+}
+
+impl Trait for u8 {
+ //~^ ERROR implementation has missing stability attribute
+ pub(self) fn fun() {}
+ //~^ ERROR visibility qualifiers are not permitted here [E0449]
+}
+
+fn main() {}
diff --git a/tests/ui/privacy/issue-113860-1.stderr b/tests/ui/privacy/issue-113860-1.stderr
new file mode 100644
index 000000000..c33ce26f0
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-1.stderr
@@ -0,0 +1,49 @@
+error[E0449]: visibility qualifiers are not permitted here
+ --> $DIR/issue-113860-1.rs:12:5
+ |
+LL | pub(self) fn fun() {}
+ | ^^^^^^^^^
+ |
+ = note: trait items always share the visibility of their trait
+
+error: module has missing stability attribute
+ --> $DIR/issue-113860-1.rs:1:1
+ |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | pub trait Trait {
+... |
+LL | |
+LL | | fn main() {}
+ | |____________^
+
+error: trait has missing stability attribute
+ --> $DIR/issue-113860-1.rs:4:1
+ |
+LL | / pub trait Trait {
+LL | |
+LL | | fn fun() {}
+LL | |
+LL | | }
+ | |_^
+
+error: implementation has missing stability attribute
+ --> $DIR/issue-113860-1.rs:10:1
+ |
+LL | / impl Trait for u8 {
+LL | |
+LL | | pub(self) fn fun() {}
+LL | |
+LL | | }
+ | |_^
+
+error: associated function has missing stability attribute
+ --> $DIR/issue-113860-1.rs:6:5
+ |
+LL | fn fun() {}
+ | ^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/tests/ui/privacy/issue-113860-2.rs b/tests/ui/privacy/issue-113860-2.rs
new file mode 100644
index 000000000..59be19d88
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-2.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+pub trait Trait {
+ //~^ ERROR trait has missing stability attribute
+ type X;
+ //~^ ERROR associated type has missing stability attribute
+}
+
+impl Trait for u8 {
+ //~^ ERROR implementation has missing stability attribute
+ pub(self) type X = Self;
+ //~^ ERROR visibility qualifiers are not permitted here [E0449]
+}
+
+fn main() {}
diff --git a/tests/ui/privacy/issue-113860-2.stderr b/tests/ui/privacy/issue-113860-2.stderr
new file mode 100644
index 000000000..6748bc276
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-2.stderr
@@ -0,0 +1,49 @@
+error[E0449]: visibility qualifiers are not permitted here
+ --> $DIR/issue-113860-2.rs:12:5
+ |
+LL | pub(self) type X = Self;
+ | ^^^^^^^^^
+ |
+ = note: trait items always share the visibility of their trait
+
+error: module has missing stability attribute
+ --> $DIR/issue-113860-2.rs:1:1
+ |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | pub trait Trait {
+... |
+LL | |
+LL | | fn main() {}
+ | |____________^
+
+error: trait has missing stability attribute
+ --> $DIR/issue-113860-2.rs:4:1
+ |
+LL | / pub trait Trait {
+LL | |
+LL | | type X;
+LL | |
+LL | | }
+ | |_^
+
+error: implementation has missing stability attribute
+ --> $DIR/issue-113860-2.rs:10:1
+ |
+LL | / impl Trait for u8 {
+LL | |
+LL | | pub(self) type X = Self;
+LL | |
+LL | | }
+ | |_^
+
+error: associated type has missing stability attribute
+ --> $DIR/issue-113860-2.rs:6:5
+ |
+LL | type X;
+ | ^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/tests/ui/privacy/issue-113860.rs b/tests/ui/privacy/issue-113860.rs
new file mode 100644
index 000000000..b94c14fac
--- /dev/null
+++ b/tests/ui/privacy/issue-113860.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+pub trait Trait {
+ //~^ ERROR trait has missing stability attribute
+ const X: u32;
+ //~^ ERROR associated constant has missing stability attribute
+}
+
+impl Trait for u8 {
+ //~^ ERROR implementation has missing stability attribute
+ pub(self) const X: u32 = 3;
+ //~^ ERROR visibility qualifiers are not permitted here [E0449]
+}
+
+fn main() {}
diff --git a/tests/ui/privacy/issue-113860.stderr b/tests/ui/privacy/issue-113860.stderr
new file mode 100644
index 000000000..3204f4ff9
--- /dev/null
+++ b/tests/ui/privacy/issue-113860.stderr
@@ -0,0 +1,49 @@
+error[E0449]: visibility qualifiers are not permitted here
+ --> $DIR/issue-113860.rs:12:5
+ |
+LL | pub(self) const X: u32 = 3;
+ | ^^^^^^^^^
+ |
+ = note: trait items always share the visibility of their trait
+
+error: module has missing stability attribute
+ --> $DIR/issue-113860.rs:1:1
+ |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | pub trait Trait {
+... |
+LL | |
+LL | | fn main() {}
+ | |____________^
+
+error: trait has missing stability attribute
+ --> $DIR/issue-113860.rs:4:1
+ |
+LL | / pub trait Trait {
+LL | |
+LL | | const X: u32;
+LL | |
+LL | | }
+ | |_^
+
+error: implementation has missing stability attribute
+ --> $DIR/issue-113860.rs:10:1
+ |
+LL | / impl Trait for u8 {
+LL | |
+LL | | pub(self) const X: u32 = 3;
+LL | |
+LL | | }
+ | |_^
+
+error: associated constant has missing stability attribute
+ --> $DIR/issue-113860.rs:6:5
+ |
+LL | const X: u32;
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/tests/ui/privacy/privacy2.rs b/tests/ui/privacy/privacy2.rs
index c8fa436bd..212bc003e 100644
--- a/tests/ui/privacy/privacy2.rs
+++ b/tests/ui/privacy/privacy2.rs
@@ -1,3 +1,5 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
#![feature(start, no_core)]
#![no_core] // makes debugging this test *a lot* easier (during resolve)
diff --git a/tests/ui/privacy/privacy2.stderr b/tests/ui/privacy/privacy2.stderr
index c2a33ce1f..e7135d3fd 100644
--- a/tests/ui/privacy/privacy2.stderr
+++ b/tests/ui/privacy/privacy2.stderr
@@ -1,22 +1,22 @@
error[E0432]: unresolved import `bar::foo`
- --> $DIR/privacy2.rs:17:9
+ --> $DIR/privacy2.rs:19:9
|
LL | use bar::foo;
| ^^^^^^^^ no `foo` in `bar`
error[E0603]: function import `foo` is private
- --> $DIR/privacy2.rs:23:20
+ --> $DIR/privacy2.rs:25:20
|
LL | use bar::glob::foo;
| ^^^ private function import
|
note: the function import `foo` is defined here...
- --> $DIR/privacy2.rs:10:13
+ --> $DIR/privacy2.rs:12:13
|
LL | use foo;
| ^^^
note: ...and refers to the function `foo` which is defined here
- --> $DIR/privacy2.rs:14:1
+ --> $DIR/privacy2.rs:16:1
|
LL | pub fn foo() {}
| ^^^^^^^^^^^^ consider importing it directly
diff --git a/tests/ui/privacy/privacy3.rs b/tests/ui/privacy/privacy3.rs
index 5a7cd76a9..3466f5bb1 100644
--- a/tests/ui/privacy/privacy3.rs
+++ b/tests/ui/privacy/privacy3.rs
@@ -1,3 +1,5 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
#![feature(start, no_core)]
#![no_core] // makes debugging this test *a lot* easier (during resolve)
diff --git a/tests/ui/privacy/privacy3.stderr b/tests/ui/privacy/privacy3.stderr
index 22c1e48b0..df66c8475 100644
--- a/tests/ui/privacy/privacy3.stderr
+++ b/tests/ui/privacy/privacy3.stderr
@@ -1,5 +1,5 @@
error[E0432]: unresolved import `bar::gpriv`
- --> $DIR/privacy3.rs:18:9
+ --> $DIR/privacy3.rs:20:9
|
LL | use bar::gpriv;
| ^^^^^^^^^^ no `gpriv` in `bar`
diff --git a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
index d1052ce35..5f8076fc8 100644
--- a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
+++ b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
@@ -9,7 +9,7 @@ note: required by a bound in `Sealed`
|
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 implelement `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
+ = 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
error: aborting due to previous error
diff --git a/tests/ui/privacy/unnameable_types.rs b/tests/ui/privacy/unnameable_types.rs
index eae20dd9d..46e249152 100644
--- a/tests/ui/privacy/unnameable_types.rs
+++ b/tests/ui/privacy/unnameable_types.rs
@@ -11,12 +11,12 @@ mod m {
pub trait PubTr { //~ ERROR trait `PubTr` is reachable but cannot be named
const C : i32 = 0;
- type Alias; //~ ERROR associated type `PubTr::Alias` is reachable but cannot be named
+ type Alias;
fn f() {}
}
impl PubTr for PubStruct {
- type Alias = i32; //~ ERROR associated type `<PubStruct as PubTr>::Alias` is reachable but cannot be named
+ type Alias = i32;
fn f() {}
}
}
diff --git a/tests/ui/privacy/unnameable_types.stderr b/tests/ui/privacy/unnameable_types.stderr
index 25eb5c943..904127525 100644
--- a/tests/ui/privacy/unnameable_types.stderr
+++ b/tests/ui/privacy/unnameable_types.stderr
@@ -22,17 +22,5 @@ error: trait `PubTr` is reachable but cannot be named
LL | pub trait PubTr {
| ^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
-error: associated type `PubTr::Alias` is reachable but cannot be named
- --> $DIR/unnameable_types.rs:14:9
- |
-LL | type Alias;
- | ^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
-
-error: associated type `<PubStruct as PubTr>::Alias` is reachable but cannot be named
- --> $DIR/unnameable_types.rs:19:9
- |
-LL | type Alias = i32;
- | ^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
-
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors