1
Fork 0

Avoid silencing relevant follow-up errors

This commit is contained in:
Oli Scherer 2023-10-31 13:45:26 +00:00
parent be00c5a9b8
commit 0978f6e010
184 changed files with 2700 additions and 631 deletions

View file

@ -6,6 +6,7 @@ trait FooBar<'foo, 'bar>: Foo<'foo> + Bar<'bar> {}
struct Baz<'foo, 'bar> {
baz: dyn FooBar<'foo, 'bar>,
//~^ ERROR ambiguous lifetime bound, explicit lifetime bound required
//~| ERROR lifetime bound not satisfied
}
fn main() {

View file

@ -4,6 +4,24 @@ error[E0227]: ambiguous lifetime bound, explicit lifetime bound required
LL | baz: dyn FooBar<'foo, 'bar>,
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
error[E0478]: lifetime bound not satisfied
--> $DIR/E0227.rs:7:10
|
LL | baz: dyn FooBar<'foo, 'bar>,
| ^^^^^^^^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'bar` as defined here
--> $DIR/E0227.rs:6:18
|
LL | struct Baz<'foo, 'bar> {
| ^^^^
note: but lifetime parameter must outlive the lifetime `'foo` as defined here
--> $DIR/E0227.rs:6:12
|
LL | struct Baz<'foo, 'bar> {
| ^^^^
For more information about this error, try `rustc --explain E0227`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0227, E0478.
For more information about an error, try `rustc --explain E0227`.

View file

@ -12,6 +12,9 @@ impl Foo for isize {
fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
//~^ ERROR associated type bindings are not allowed here [E0229]
//~| ERROR associated type bindings are not allowed here [E0229]
//~| ERROR associated type bindings are not allowed here [E0229]
//~| ERROR the trait bound `I: Foo` is not satisfied
fn main() {
}

View file

@ -4,6 +4,34 @@ error[E0229]: associated type bindings are not allowed here
LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
| ^^^^^ associated type not allowed here
error: aborting due to 1 previous error
error[E0229]: associated type bindings are not allowed here
--> $DIR/E0229.rs:13:25
|
LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
| ^^^^^ associated type not allowed here
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
For more information about this error, try `rustc --explain E0229`.
error[E0229]: associated type bindings are not allowed here
--> $DIR/E0229.rs:13:25
|
LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
| ^^^^^ associated type not allowed here
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `I: Foo` is not satisfied
--> $DIR/E0229.rs:13:15
|
LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
| ^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `I`
|
help: consider restricting type parameter `I`
|
LL | fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {}
| +++++
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0229, E0277.
For more information about an error, try `rustc --explain E0229`.

View file

@ -1,6 +1,7 @@
trait Foo: Iterator<Item = i32, Item = i32> {}
//~^ ERROR is already specified
//~| ERROR is already specified
//~| ERROR is already specified
type Unit = ();
@ -11,5 +12,6 @@ fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
fn main() {
let _: &dyn Iterator<Item = i32, Item = i32>;
//~^ ERROR already specified
test();
}

View file

@ -17,13 +17,31 @@ LL | trait Foo: Iterator<Item = i32, Item = i32> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:7:42
--> $DIR/E0719.rs:8:42
|
LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
| --------- ^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: aborting due to 3 previous errors
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:1:33
|
LL | trait Foo: Iterator<Item = i32, Item = i32> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:14:38
|
LL | let _: &dyn Iterator<Item = i32, Item = i32>;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0719`.