diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /tests/ui/pub | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/pub')
3 files changed, 15 insertions, 65 deletions
diff --git a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs index cdeea6224..7930964c8 100644 --- a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs +++ b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs @@ -1,44 +1,24 @@ -#![feature(type_privacy_lints)] -#![allow(non_camel_case_types)] // genus is always capitalized -#![warn(private_interfaces)] -//~^ NOTE the lint level is defined here +// check-pass -// In this test both old and new private-in-public diagnostic were emitted. -// Old diagnostic will be deleted soon. -// See https://rust-lang.github.io/rfcs/2145-type-privacy.html. +#![allow(non_camel_case_types)] // genus is always capitalized pub(crate) struct Snail; -//~^ NOTE `Snail` declared as private -//~| NOTE but type `Snail` is only usable at visibility `pub(crate)` mod sea { pub(super) struct Turtle; - //~^ NOTE `Turtle` declared as crate-private - //~| NOTE but type `Turtle` is only usable at visibility `pub(crate)` } struct Tortoise; -//~^ NOTE `Tortoise` declared as private -//~| NOTE but type `Tortoise` is only usable at visibility `pub(crate)` pub struct Shell<T> { pub(crate) creature: T, } pub type Helix_pomatia = Shell<Snail>; -//~^ ERROR private type `Snail` in public interface -//~| WARNING type `Snail` is more private than the item `Helix_pomatia` -//~| NOTE can't leak private type -//~| NOTE type alias `Helix_pomatia` is reachable at visibility `pub` +//~^ WARNING type `Snail` is more private than the item `Helix_pomatia` pub type Dermochelys_coriacea = Shell<sea::Turtle>; -//~^ ERROR crate-private type `Turtle` in public interface -//~| WARNING type `Turtle` is more private than the item `Dermochelys_coriacea` -//~| NOTE can't leak crate-private type -//~| NOTE type alias `Dermochelys_coriacea` is reachable at visibility `pub` +//~^ WARNING type `Turtle` is more private than the item `Dermochelys_coriacea` pub type Testudo_graeca = Shell<Tortoise>; -//~^ ERROR private type `Tortoise` in public interface -//~| WARNING type `Tortoise` is more private than the item `Testudo_graeca` -//~| NOTE can't leak private type -//~| NOTE type alias `Testudo_graeca` is reachable at visibility `pub` +//~^ WARNING type `Tortoise` is more private than the item `Testudo_graeca` fn main() {} 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 20e51e190..26dfa2e7d 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 @@ -1,71 +1,39 @@ -error[E0446]: private type `Snail` in public interface - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1 - | -LL | pub(crate) struct Snail; - | ----------------------- `Snail` declared as private -... -LL | pub type Helix_pomatia = Shell<Snail>; - | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type - warning: type `Snail` is more private than the item `Helix_pomatia` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:17:1 | LL | pub type Helix_pomatia = Shell<Snail>; | ^^^^^^^^^^^^^^^^^^^^^^ type alias `Helix_pomatia` is reachable at visibility `pub` | note: but type `Snail` is only usable at visibility `pub(crate)` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:10:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:5:1 | LL | pub(crate) struct Snail; | ^^^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:3:9 - | -LL | #![warn(private_interfaces)] - | ^^^^^^^^^^^^^^^^^^ - -error[E0446]: crate-private type `Turtle` in public interface - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:33:1 - | -LL | pub(super) struct Turtle; - | ------------------------ `Turtle` declared as crate-private -... -LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private type + = note: `#[warn(private_interfaces)]` on by default warning: type `Turtle` is more private than the item `Dermochelys_coriacea` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:33:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:19:1 | LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type alias `Dermochelys_coriacea` is reachable at visibility `pub` | note: but type `Turtle` is only usable at visibility `pub(crate)` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:15:5 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:8:5 | LL | pub(super) struct Turtle; | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0446]: private type `Tortoise` in public interface - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:38:1 - | -LL | struct Tortoise; - | --------------- `Tortoise` declared as private -... -LL | pub type Testudo_graeca = Shell<Tortoise>; - | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type - warning: type `Tortoise` is more private than the item `Testudo_graeca` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:38:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:21:1 | LL | pub type Testudo_graeca = Shell<Tortoise>; | ^^^^^^^^^^^^^^^^^^^^^^^ type alias `Testudo_graeca` is reachable at visibility `pub` | note: but type `Tortoise` is only usable at visibility `pub(crate)` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:20:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:11:1 | LL | struct Tortoise; | ^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors; 3 warnings emitted +warning: 3 warnings emitted -For more information about this error, try `rustc --explain E0446`. diff --git a/tests/ui/pub/pub-restricted-error-fn.stderr b/tests/ui/pub/pub-restricted-error-fn.stderr index 0511a821a..ca5d8e1b5 100644 --- a/tests/ui/pub/pub-restricted-error-fn.stderr +++ b/tests/ui/pub/pub-restricted-error-fn.stderr @@ -11,6 +11,8 @@ error: expected item, found `(` | LL | pub(crate) () fn foo() {} | ^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> error: aborting due to 2 previous errors |