mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
17a6ae2df3
When an associated type with GATs isn't specified in a `dyn Trait`, emit an object safety error instead of only complaining about the missing associated type, as it will lead the user down a path of three different errors before letting them know that what they were trying to do is impossible to begin with. Fix #103155.
30 lines
1.2 KiB
Plaintext
30 lines
1.2 KiB
Plaintext
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
|
|
|
|
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:7:42
|
|
|
|
|
LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
|
|
| --------- ^^^^^^^^^^^ re-bound here
|
|
| |
|
|
| `Item` bound here first
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0719`.
|