Skip to content

Commit 4e10b75

Browse files
committed
Update tests
Update the tests to reflect changes to how type mismatch errors are reported (two previous commits).
1 parent 036f182 commit 4e10b75

19 files changed

+116
-40
lines changed

src/test/ui/associated-types/associated-types-issue-20346.stderr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == std::op
44
LL | fn is_iterator_of<A, I: Iterator<Item=A>>(_: &I) {}
55
| -------------- ------ required by this bound in `is_iterator_of`
66
...
7+
LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
8+
| - this type parameter
9+
...
710
LL | is_iterator_of::<Option<T>, _>(&adapter);
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found type parameter
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found type parameter `T`
912
|
1013
= note: expected type `std::option::Option<T>`
1114
found type `T`

src/test/ui/compare-method/reordered-type-param.stderr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ LL | fn b<C:Clone,D>(&self, x: C) -> C;
55
| - type in trait
66
...
77
LL | fn b<F:Clone,G>(&self, _x: G) -> G { panic!() }
8-
| ^ expected type parameter, found a different type parameter
8+
| - - ^ expected type parameter `F`, found type parameter `G`
9+
| | |
10+
| | found type parameter
11+
| expected type parameter
912
|
1013
= note: expected type `fn(&E, F) -> F`
1114
found type `fn(&E, G) -> G`

src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ LL | fn foo<A: Debug>(&self, a: &A, b: &impl Debug);
55
| -- type in trait
66
...
77
LL | fn foo<B: Debug>(&self, a: &impl Debug, b: &B) { }
8-
| ^^^^^^^^^^^ expected type parameter, found a different type parameter
8+
| - ^----------
9+
| | ||
10+
| | |found type parameter
11+
| | expected type parameter `B`, found type parameter `impl Debug`
12+
| expected type parameter
913
|
1014
= note: expected type `fn(&(), &B, &impl Debug)`
1115
found type `fn(&(), &impl Debug, &B)`

src/test/ui/impl-trait/universal-mismatched-type.stderr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ error[E0308]: mismatched types
22
--> $DIR/universal-mismatched-type.rs:4:5
33
|
44
LL | fn foo(x: impl Debug) -> String {
5-
| ------ expected `std::string::String` because of return type
5+
| ---------- ------ expected `std::string::String` because of return type
6+
| |
7+
| this type parameter
68
LL | x
7-
| ^ expected struct `std::string::String`, found type parameter
9+
| ^ expected struct `std::string::String`, found type parameter `impl Debug`
810
|
911
= note: expected type `std::string::String`
1012
found type `impl Debug`

src/test/ui/impl-trait/universal-two-impl-traits.stderr

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
error[E0308]: mismatched types
22
--> $DIR/universal-two-impl-traits.rs:5:9
33
|
4+
LL | fn foo(x: impl Debug, y: impl Debug) -> String {
5+
| ---------- ---------- found type parameter
6+
| |
7+
| expected type parameter
8+
LL | let mut a = x;
49
LL | a = y;
5-
| ^ expected type parameter, found a different type parameter
10+
| ^ expected type parameter `impl Debug`, found a different type parameter `impl Debug`
611
|
7-
= note: expected type `impl Debug` (type parameter)
8-
found type `impl Debug` (type parameter)
12+
= note: expected type `impl Debug` (type parameter `impl Debug`)
13+
found type `impl Debug` (type parameter `impl Debug`)
914
= note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
1015
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
1116

src/test/ui/issues/issue-13853.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ error[E0308]: mismatched types
22
--> $DIR/issue-13853.rs:14:9
33
|
44
LL | fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
5-
| - expected `I` because of return type
5+
| - this type parameter - expected `I` because of return type
66
...
77
LL | self.iter()
8-
| ^^^^^^^^^^^ expected type parameter, found struct `std::slice::Iter`
8+
| ^^^^^^^^^^^ expected type parameter `I`, found struct `std::slice::Iter`
99
|
1010
= note: expected type `I`
1111
found type `std::slice::Iter<'_, N>`

src/test/ui/issues/issue-20225.stderr

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
error[E0053]: method `call` has an incompatible type for trait
22
--> $DIR/issue-20225.rs:6:3
33
|
4+
LL | impl<'a, T> Fn<(&'a T,)> for Foo {
5+
| - this type parameter
46
LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter `T`
68
|
79
= note: expected type `extern "rust-call" fn(&Foo, (&'a T,))`
810
found type `extern "rust-call" fn(&Foo, (T,))`
@@ -12,8 +14,10 @@ LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
1214
error[E0053]: method `call_mut` has an incompatible type for trait
1315
--> $DIR/issue-20225.rs:12:3
1416
|
17+
LL | impl<'a, T> FnMut<(&'a T,)> for Foo {
18+
| - this type parameter
1519
LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
16-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter `T`
1721
|
1822
= note: expected type `extern "rust-call" fn(&mut Foo, (&'a T,))`
1923
found type `extern "rust-call" fn(&mut Foo, (T,))`
@@ -23,8 +27,11 @@ LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
2327
error[E0053]: method `call_once` has an incompatible type for trait
2428
--> $DIR/issue-20225.rs:20:3
2529
|
30+
LL | impl<'a, T> FnOnce<(&'a T,)> for Foo {
31+
| - this type parameter
32+
...
2633
LL | extern "rust-call" fn call_once(self, (_,): (T,)) {}
27-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter
34+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter `T`
2835
|
2936
= note: expected type `extern "rust-call" fn(Foo, (&'a T,))`
3037
found type `extern "rust-call" fn(Foo, (T,))`

src/test/ui/issues/issue-24204.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | trait Trait: Sized {
55
| ------------------ required by `Trait`
66
...
77
LL | fn test<T: Trait<B=i32>>(b: i32) -> T where T::A: MultiDispatch<i32> { T::new(b) }
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter, found associated type
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
99
|
1010
= note: expected type `T`
1111
found type `<<T as Trait>::A as MultiDispatch<i32>>::O`

src/test/ui/issues/issue-2951.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn foo<T, U>(x: T, y: U) {
44
//~^ ERROR mismatched types
55
//~| expected type `T`
66
//~| found type `U`
7-
//~| expected type parameter, found a different type parameter
7+
//~| expected type parameter `T`, found type parameter `U`
88
}
99

1010
fn main() {

src/test/ui/issues/issue-2951.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
error[E0308]: mismatched types
22
--> $DIR/issue-2951.rs:3:10
33
|
4+
LL | fn foo<T, U>(x: T, y: U) {
5+
| - - found type parameter
6+
| |
7+
| expected type parameter
8+
LL | let mut xx = x;
49
LL | xx = y;
5-
| ^ expected type parameter, found a different type parameter
10+
| ^ expected type parameter `T`, found type parameter `U`
611
|
712
= note: expected type `T`
813
found type `U`

0 commit comments

Comments
 (0)