diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/error-codes/E0283.stderr | 4 | ||||
-rw-r--r-- | tests/ui/error-codes/E0445.rs | 11 | ||||
-rw-r--r-- | tests/ui/error-codes/E0445.stderr | 49 | ||||
-rw-r--r-- | tests/ui/error-codes/E0560.stderr | 2 | ||||
-rw-r--r-- | tests/ui/error-codes/E0637.stderr | 7 | ||||
-rw-r--r-- | tests/ui/error-codes/E0790.stderr | 4 |
6 files changed, 64 insertions, 13 deletions
diff --git a/tests/ui/error-codes/E0283.stderr b/tests/ui/error-codes/E0283.stderr index 90316c6e9..89e634a70 100644 --- a/tests/ui/error-codes/E0283.stderr +++ b/tests/ui/error-codes/E0283.stderr @@ -9,8 +9,8 @@ LL | let cont: u32 = Generator::create(); | help: use a fully-qualified path to a specific available implementation (2 found) | -LL | let cont: u32 = <Impl as Generator>::create(); - | ++++++++ + +LL | let cont: u32 = </* self type */ as Generator>::create(); + | +++++++++++++++++++ + error[E0283]: type annotations needed --> $DIR/E0283.rs:35:24 diff --git a/tests/ui/error-codes/E0445.rs b/tests/ui/error-codes/E0445.rs index a9a3aee25..9f29c8167 100644 --- a/tests/ui/error-codes/E0445.rs +++ b/tests/ui/error-codes/E0445.rs @@ -1,12 +1,23 @@ +#![feature(type_privacy_lints)] +#[warn(private_bounds)] +#[warn(private_interfaces)] + +// 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. + trait Foo { fn dummy(&self) { } } pub trait Bar : Foo {} //~^ ERROR private trait `Foo` in public interface [E0445] +//~| WARNING trait `Foo` is more private than the item `Bar` pub struct Bar2<T: Foo>(pub T); //~^ ERROR private trait `Foo` in public interface [E0445] +//~| WARNING trait `Foo` is more private than the item `Bar2` pub fn foo<T: Foo> (t: T) {} //~^ ERROR private trait `Foo` in public interface [E0445] +//~| WARNING trait `Foo` is more private than the item `foo` fn main() {} diff --git a/tests/ui/error-codes/E0445.stderr b/tests/ui/error-codes/E0445.stderr index 23b7a3350..4f940868f 100644 --- a/tests/ui/error-codes/E0445.stderr +++ b/tests/ui/error-codes/E0445.stderr @@ -1,5 +1,5 @@ error[E0445]: private trait `Foo` in public interface - --> $DIR/E0445.rs:5:1 + --> $DIR/E0445.rs:13:1 | LL | trait Foo { | --------- `Foo` declared as private @@ -7,8 +7,25 @@ LL | trait Foo { LL | pub trait Bar : Foo {} | ^^^^^^^^^^^^^^^^^^^ can't leak private trait +warning: trait `Foo` is more private than the item `Bar` + --> $DIR/E0445.rs:13:1 + | +LL | pub trait Bar : Foo {} + | ^^^^^^^^^^^^^^^^^^^ trait `Bar` is reachable at visibility `pub` + | +note: but trait `Foo` is only usable at visibility `pub(crate)` + --> $DIR/E0445.rs:9:1 + | +LL | trait Foo { + | ^^^^^^^^^ +note: the lint level is defined here + --> $DIR/E0445.rs:2:8 + | +LL | #[warn(private_bounds)] + | ^^^^^^^^^^^^^^ + error[E0445]: private trait `Foo` in public interface - --> $DIR/E0445.rs:7:1 + --> $DIR/E0445.rs:16:1 | LL | trait Foo { | --------- `Foo` declared as private @@ -16,15 +33,39 @@ LL | trait Foo { LL | pub struct Bar2<T: Foo>(pub T); | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait -error[E0445]: private trait `Foo` in public interface +warning: trait `Foo` is more private than the item `Bar2` + --> $DIR/E0445.rs:16:1 + | +LL | pub struct Bar2<T: Foo>(pub T); + | ^^^^^^^^^^^^^^^^^^^^^^^ struct `Bar2` is reachable at visibility `pub` + | +note: but trait `Foo` is only usable at visibility `pub(crate)` --> $DIR/E0445.rs:9:1 | LL | trait Foo { + | ^^^^^^^^^ + +error[E0445]: private trait `Foo` in public interface + --> $DIR/E0445.rs:19:1 + | +LL | trait Foo { | --------- `Foo` declared as private ... LL | pub fn foo<T: Foo> (t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait -error: aborting due to 3 previous errors +warning: trait `Foo` is more private than the item `foo` + --> $DIR/E0445.rs:19:1 + | +LL | pub fn foo<T: Foo> (t: T) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `foo` is reachable at visibility `pub` + | +note: but trait `Foo` is only usable at visibility `pub(crate)` + --> $DIR/E0445.rs:9:1 + | +LL | trait Foo { + | ^^^^^^^^^ + +error: aborting due to 3 previous errors; 3 warnings emitted For more information about this error, try `rustc --explain E0445`. diff --git a/tests/ui/error-codes/E0560.stderr b/tests/ui/error-codes/E0560.stderr index 6b634f185..bb5ce478a 100644 --- a/tests/ui/error-codes/E0560.stderr +++ b/tests/ui/error-codes/E0560.stderr @@ -4,7 +4,7 @@ error[E0560]: struct `Simba` has no field named `father` LL | let s = Simba { mother: 1, father: 0 }; | ^^^^^^ `Simba` does not have this field | - = note: available fields are: `mother` + = note: all struct fields are already assigned error: aborting due to previous error diff --git a/tests/ui/error-codes/E0637.stderr b/tests/ui/error-codes/E0637.stderr index 78341735e..d9db89ddb 100644 --- a/tests/ui/error-codes/E0637.stderr +++ b/tests/ui/error-codes/E0637.stderr @@ -22,11 +22,10 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here LL | T: Into<&u32>, | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/E0637.rs:13:8 +help: consider introducing a higher-ranked lifetime here | -LL | T: Into<&u32>, - | ^ +LL | T: for<'a> Into<&'a u32>, + | +++++++ ++ error: aborting due to 3 previous errors diff --git a/tests/ui/error-codes/E0790.stderr b/tests/ui/error-codes/E0790.stderr index fc025a3fc..724876628 100644 --- a/tests/ui/error-codes/E0790.stderr +++ b/tests/ui/error-codes/E0790.stderr @@ -65,8 +65,8 @@ LL | MyTrait2::my_fn(); | help: use a fully-qualified path to a specific available implementation (2 found) | -LL | <Impl1 as MyTrait2>::my_fn(); - | +++++++++ + +LL | </* self type */ as MyTrait2>::my_fn(); + | +++++++++++++++++++ + error: aborting due to 5 previous errors |