diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/privacy/restricted | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/privacy/restricted')
-rw-r--r-- | src/test/ui/privacy/restricted/auxiliary/pub_restricted.rs | 14 | ||||
-rw-r--r-- | src/test/ui/privacy/restricted/lookup-ignores-private.rs | 34 | ||||
-rw-r--r-- | src/test/ui/privacy/restricted/private-in-public.rs | 11 | ||||
-rw-r--r-- | src/test/ui/privacy/restricted/private-in-public.stderr | 21 | ||||
-rw-r--r-- | src/test/ui/privacy/restricted/relative-2018.rs | 13 | ||||
-rw-r--r-- | src/test/ui/privacy/restricted/relative-2018.stderr | 17 | ||||
-rw-r--r-- | src/test/ui/privacy/restricted/struct-literal-field.rs | 19 | ||||
-rw-r--r-- | src/test/ui/privacy/restricted/struct-literal-field.stderr | 9 | ||||
-rw-r--r-- | src/test/ui/privacy/restricted/test.rs | 52 | ||||
-rw-r--r-- | src/test/ui/privacy/restricted/test.stderr | 112 |
10 files changed, 0 insertions, 302 deletions
diff --git a/src/test/ui/privacy/restricted/auxiliary/pub_restricted.rs b/src/test/ui/privacy/restricted/auxiliary/pub_restricted.rs deleted file mode 100644 index a4013e6ac..000000000 --- a/src/test/ui/privacy/restricted/auxiliary/pub_restricted.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub(crate) struct Crate; - -#[derive(Default)] -pub struct Universe { - pub x: i32, - pub(crate) y: i32, - pub(crate) z: i32, -} - -impl Universe { - pub fn f(&self) {} - pub(crate) fn g(&self) {} - pub(crate) fn h(&self) {} -} diff --git a/src/test/ui/privacy/restricted/lookup-ignores-private.rs b/src/test/ui/privacy/restricted/lookup-ignores-private.rs deleted file mode 100644 index 240ce1e2b..000000000 --- a/src/test/ui/privacy/restricted/lookup-ignores-private.rs +++ /dev/null @@ -1,34 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) -#![allow(warnings)] - -mod foo { - pub use foo::bar::S; - mod bar { - #[derive(Default)] - pub struct S { - pub(in foo) x: i32, - } - impl S { - pub(in foo) fn f(&self) -> i32 { 0 } - } - - pub struct S2 { - pub(crate) x: bool, - } - impl S2 { - pub(crate) fn f(&self) -> bool { false } - } - - impl ::std::ops::Deref for S { - type Target = S2; - fn deref(&self) -> &S2 { unimplemented!() } - } - } -} - - -fn main() { - let s = foo::S::default(); - let _: bool = s.x; - let _: bool = s.f(); -} diff --git a/src/test/ui/privacy/restricted/private-in-public.rs b/src/test/ui/privacy/restricted/private-in-public.rs deleted file mode 100644 index 1e3dbdf73..000000000 --- a/src/test/ui/privacy/restricted/private-in-public.rs +++ /dev/null @@ -1,11 +0,0 @@ -mod foo { - struct Priv; - mod bar { - use foo::Priv; - pub(super) fn f(_: Priv) {} - pub(crate) fn g(_: Priv) {} //~ ERROR E0446 - pub(crate) fn h(_: Priv) {} //~ ERROR E0446 - } -} - -fn main() { } diff --git a/src/test/ui/privacy/restricted/private-in-public.stderr b/src/test/ui/privacy/restricted/private-in-public.stderr deleted file mode 100644 index 65d996f0f..000000000 --- a/src/test/ui/privacy/restricted/private-in-public.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0446]: private type `Priv` in public interface - --> $DIR/private-in-public.rs:6:9 - | -LL | struct Priv; - | ----------- `Priv` declared as private -... -LL | pub(crate) fn g(_: Priv) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type - -error[E0446]: private type `Priv` in public interface - --> $DIR/private-in-public.rs:7:9 - | -LL | struct Priv; - | ----------- `Priv` declared as private -... -LL | pub(crate) fn h(_: Priv) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0446`. diff --git a/src/test/ui/privacy/restricted/relative-2018.rs b/src/test/ui/privacy/restricted/relative-2018.rs deleted file mode 100644 index 954169a9f..000000000 --- a/src/test/ui/privacy/restricted/relative-2018.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2018 - -mod m { - pub(in crate) struct S1; // OK - pub(in super) struct S2; // OK - pub(in self) struct S3; // OK - pub(in ::core) struct S4; - //~^ ERROR visibilities can only be restricted to ancestor modules - pub(in a::b) struct S5; - //~^ ERROR relative paths are not supported in visibilities in 2018 edition or later -} - -fn main() {} diff --git a/src/test/ui/privacy/restricted/relative-2018.stderr b/src/test/ui/privacy/restricted/relative-2018.stderr deleted file mode 100644 index dec0d5157..000000000 --- a/src/test/ui/privacy/restricted/relative-2018.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0742]: visibilities can only be restricted to ancestor modules - --> $DIR/relative-2018.rs:7:12 - | -LL | pub(in ::core) struct S4; - | ^^^^^^ - -error: relative paths are not supported in visibilities in 2018 edition or later - --> $DIR/relative-2018.rs:9:12 - | -LL | pub(in a::b) struct S5; - | ^--- - | | - | help: try: `crate::a::b` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0742`. diff --git a/src/test/ui/privacy/restricted/struct-literal-field.rs b/src/test/ui/privacy/restricted/struct-literal-field.rs deleted file mode 100644 index 9c6104755..000000000 --- a/src/test/ui/privacy/restricted/struct-literal-field.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![allow(warnings)] - -mod foo { - pub mod bar { - pub struct S { - pub(in foo) x: i32, - } - } - - fn f() { - use foo::bar::S; - S { x: 0 }; // ok - } -} - -fn main() { - use foo::bar::S; - S { x: 0 }; //~ ERROR private -} diff --git a/src/test/ui/privacy/restricted/struct-literal-field.stderr b/src/test/ui/privacy/restricted/struct-literal-field.stderr deleted file mode 100644 index eee964f02..000000000 --- a/src/test/ui/privacy/restricted/struct-literal-field.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0451]: field `x` of struct `S` is private - --> $DIR/struct-literal-field.rs:18:9 - | -LL | S { x: 0 }; - | ^^^^ private field - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0451`. diff --git a/src/test/ui/privacy/restricted/test.rs b/src/test/ui/privacy/restricted/test.rs deleted file mode 100644 index a8c269378..000000000 --- a/src/test/ui/privacy/restricted/test.rs +++ /dev/null @@ -1,52 +0,0 @@ -// aux-build:pub_restricted.rs - -#![allow(warnings)] -extern crate pub_restricted; - -mod foo { - pub mod bar { - pub(super) fn f() {} - #[derive(Default)] - pub struct S { - pub(super) x: i32, - } - impl S { - pub(super) fn f(&self) {} - pub(super) fn g() {} - } - } - fn f() { - use foo::bar::S; - pub(self) use foo::bar::f; // ok - pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported - S::default().x; // ok - S::default().f(); // ok - S::g(); // ok - } -} - -fn f() { - use foo::bar::S; - use foo::bar::f; //~ ERROR private - S::default().x; //~ ERROR private - S::default().f(); //~ ERROR private - S::g(); //~ ERROR private -} - -fn main() { - use pub_restricted::Universe; - use pub_restricted::Crate; //~ ERROR private - - let u = Universe::default(); - let _ = u.x; - let _ = u.y; //~ ERROR private - let _ = u.z; //~ ERROR private - u.f(); - u.g(); //~ ERROR private - u.h(); //~ ERROR private -} - -mod pathological { - pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: maybe a missing crate `bad`? - pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules -} diff --git a/src/test/ui/privacy/restricted/test.stderr b/src/test/ui/privacy/restricted/test.stderr deleted file mode 100644 index 1acd221b4..000000000 --- a/src/test/ui/privacy/restricted/test.stderr +++ /dev/null @@ -1,112 +0,0 @@ -error[E0433]: failed to resolve: maybe a missing crate `bad`? - --> $DIR/test.rs:50:12 - | -LL | pub(in bad::path) mod m1 {} - | ^^^ maybe a missing crate `bad`? - | - = help: consider adding `extern crate bad` to use the `bad` crate - -error[E0742]: visibilities can only be restricted to ancestor modules - --> $DIR/test.rs:51:12 - | -LL | pub(in foo) mod m2 {} - | ^^^ - -error[E0364]: `f` is private, and cannot be re-exported - --> $DIR/test.rs:21:24 - | -LL | pub(super) use foo::bar::f as g; - | ^^^^^^^^^^^^^^^^ - | -note: consider marking `f` as `pub` in the imported module - --> $DIR/test.rs:21:24 - | -LL | pub(super) use foo::bar::f as g; - | ^^^^^^^^^^^^^^^^ - -error[E0603]: struct `Crate` is private - --> $DIR/test.rs:38:25 - | -LL | use pub_restricted::Crate; - | ^^^^^ private struct - | -note: the struct `Crate` is defined here - --> $DIR/auxiliary/pub_restricted.rs:1:1 - | -LL | pub(crate) struct Crate; - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0603]: function `f` is private - --> $DIR/test.rs:30:19 - | -LL | use foo::bar::f; - | ^ private function - | -note: the function `f` is defined here - --> $DIR/test.rs:8:9 - | -LL | pub(super) fn f() {} - | ^^^^^^^^^^^^^^^^^ - -error[E0616]: field `x` of struct `S` is private - --> $DIR/test.rs:31:18 - | -LL | S::default().x; - | ^ private field - -error[E0624]: associated function `f` is private - --> $DIR/test.rs:32:18 - | -LL | pub(super) fn f(&self) {} - | ---------------------- private associated function defined here -... -LL | S::default().f(); - | ^ private associated function - -error[E0624]: associated function `g` is private - --> $DIR/test.rs:33:8 - | -LL | pub(super) fn g() {} - | ----------------- private associated function defined here -... -LL | S::g(); - | ^ private associated function - -error[E0616]: field `y` of struct `Universe` is private - --> $DIR/test.rs:42:15 - | -LL | let _ = u.y; - | ^ private field - -error[E0616]: field `z` of struct `Universe` is private - --> $DIR/test.rs:43:15 - | -LL | let _ = u.z; - | ^ private field - -error[E0624]: associated function `g` is private - --> $DIR/test.rs:45:7 - | -LL | u.g(); - | ^ private associated function - | - ::: $DIR/auxiliary/pub_restricted.rs:12:5 - | -LL | pub(crate) fn g(&self) {} - | ---------------------- private associated function defined here - -error[E0624]: associated function `h` is private - --> $DIR/test.rs:46:7 - | -LL | u.h(); - | ^ private associated function - | - ::: $DIR/auxiliary/pub_restricted.rs:13:5 - | -LL | pub(crate) fn h(&self) {} - | ---------------------- private associated function defined here - -error: aborting due to 12 previous errors - -Some errors have detailed explanations: E0364, E0433, E0603, E0616, E0624, E0742. -For more information about an error, try `rustc --explain E0364`. |