Make the existential type errors a little bit more helpful

This commit is contained in:
Oliver Scherer 2019-01-29 17:10:08 +01:00
parent 984688ace3
commit f2241f640b
7 changed files with 32 additions and 12 deletions

View file

@ -4,7 +4,7 @@ error: concrete type differs from previous defining existential type use
LL | / fn bar() -> Foo { //~ ERROR concrete type differs from previous
LL | | 42i32
LL | | }
| |_^
| |_^ expected `&'static str`, got `i32`
|
note: previous use here
--> $DIR/different_defining_uses.rs:8:1

View file

@ -4,7 +4,7 @@ error: concrete type differs from previous defining existential type use
LL | / fn bar() -> Foo { //~ ERROR concrete type differs from previous
LL | | panic!()
LL | | }
| |_^
| |_^ expected `&'static str`, got `()`
|
note: previous use here
--> $DIR/different_defining_uses_never_type.rs:8:1
@ -20,7 +20,7 @@ error: concrete type differs from previous defining existential type use
LL | / fn boo() -> Foo { //~ ERROR concrete type differs from previous
LL | | loop {}
LL | | }
| |_^
| |_^ expected `&'static str`, got `()`
|
note: previous use here
--> $DIR/different_defining_uses_never_type.rs:8:1

View file

@ -4,7 +4,7 @@ error: concrete type differs from previous defining existential type use
LL | / fn my_iter2<T>(t: T) -> MyIter<T> { //~ ERROR concrete type differs from previous
LL | | Some(t).into_iter()
LL | | }
| |_^
| |_^ expected `std::iter::Once<T>`, got `std::option::IntoIter<T>`
|
note: previous use here
--> $DIR/generic_different_defining_uses.rs:7:1

View file

@ -14,7 +14,7 @@ LL | / fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> {
LL | | //~^ concrete type's generic parameters differ from previous defining use
LL | | u
LL | | }
| |_^
| |_^ expected [`T`], got [`U`]
|
note: previous use here
--> $DIR/generic_duplicate_param_use3.rs:15:1

View file

@ -5,7 +5,7 @@ LL | / fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
LL | | //~^ concrete type differs from previous
LL | | (u, t)
LL | | }
| |_^
| |_^ expected `(T, U)`, got `(U, T)`
|
note: previous use here
--> $DIR/generic_duplicate_param_use5.rs:10:1

View file

@ -5,7 +5,7 @@ LL | / fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
LL | | //~^ concrete type differs from previous
LL | | (u, t)
LL | | }
| |_^
| |_^ expected `(T, T)`, got `(U, T)`
|
note: previous use here
--> $DIR/generic_duplicate_param_use6.rs:10:1