Skip to content

Commit 4326671

Browse files
committed
merged tests/ui/issues/issue-2951.rs with
tests/ui/type/type-parameter-names.rs
1 parent 18d0c37 commit 4326671

File tree

4 files changed

+33
-39
lines changed

4 files changed

+33
-39
lines changed

tests/ui/issues/issue-2951.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/ui/issues/issue-2951.stderr

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
// Test that we print out the names of type parameters correctly in
22
// our error messages.
3+
// related issue <https://github.com/rust-lang/rust/issues/2951>
34

45
//@ dont-require-annotations: NOTE
56

67
fn foo<Foo, Bar>(x: Foo) -> Bar {
78
x
8-
//~^ ERROR mismatched types
9-
//~| NOTE expected type parameter `Bar`, found type parameter `Foo`
10-
//~| NOTE expected type parameter `Bar`
11-
//~| NOTE found type parameter `Foo`
9+
//~^ ERROR mismatched types
10+
//~| NOTE expected type parameter `Bar`, found type parameter `Foo`
11+
//~| NOTE expected type parameter `Bar`
12+
//~| NOTE found type parameter `Foo`
13+
}
14+
15+
fn bar<Foo, Bar>(x: Foo, y: Bar) {
16+
let mut xx = x;
17+
xx = y;
18+
//~^ ERROR mismatched types
19+
//~| NOTE expected type parameter `Foo`, found type parameter `Bar`
20+
//~| NOTE expected type parameter `Foo`
21+
//~| NOTE found type parameter `Bar`
1222
}
1323

1424
fn main() {}

tests/ui/type/type-parameter-names.stderr

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/type-parameter-names.rs:7:5
2+
--> $DIR/type-parameter-names.rs:8:5
33
|
44
LL | fn foo<Foo, Bar>(x: Foo) -> Bar {
55
| --- --- --- expected `Bar` because of return type
@@ -15,6 +15,23 @@ LL | x
1515
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
1616
= note: the caller chooses a type for `Bar` which can be different from `Foo`
1717

18-
error: aborting due to 1 previous error
18+
error[E0308]: mismatched types
19+
--> $DIR/type-parameter-names.rs:17:10
20+
|
21+
LL | fn bar<Foo, Bar>(x: Foo, y: Bar) {
22+
| --- --- found type parameter
23+
| |
24+
| expected type parameter
25+
LL | let mut xx = x;
26+
| - expected due to this value
27+
LL | xx = y;
28+
| ^ expected type parameter `Foo`, found type parameter `Bar`
29+
|
30+
= note: expected type parameter `Foo`
31+
found type parameter `Bar`
32+
= note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
33+
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
34+
35+
error: aborting due to 2 previous errors
1936

2037
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)