Skip to content

Commit 66fbe4c

Browse files
author
Jakub Bukaj
committed
Update tests with the new diagnostic tweaks
1 parent 0c0365d commit 66fbe4c

21 files changed

+43
-40
lines changed

src/test/compile-fail/array-not-vector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
let _x: int = [1i, 2, 3]; //~ ERROR expected int, found array
12+
let _x: int = [1i, 2, 3]; //~ ERROR expected int, found array of 3 elements
1313

1414
let x: &[int] = &[1, 2, 3];
15-
let _y: &int = x; //~ ERROR expected int, found unsized array
15+
let _y: &int = x; //~ ERROR expected int, found slice
1616
}

src/test/compile-fail/explicit-self-lifetime-mismatch.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ struct Foo<'a,'b> {
1616
impl<'a,'b> Foo<'a,'b> {
1717
// The number of errors is related to the way invariance works.
1818
fn bar(self: Foo<'b,'a>) {}
19-
//~^ ERROR mismatched types: expected `Foo<'a,'b>`, found `Foo<'b,'a>`
20-
//~^^ ERROR mismatched types: expected `Foo<'a,'b>`, found `Foo<'b,'a>`
21-
//~^^^ ERROR mismatched types: expected `Foo<'b,'a>`, found `Foo<'a,'b>`
22-
//~^^^^ ERROR mismatched types: expected `Foo<'b,'a>`, found `Foo<'a,'b>`
19+
//~^ ERROR mismatched types: expected `Foo<'a, 'b>`, found `Foo<'b, 'a>`
20+
//~^^ ERROR mismatched types: expected `Foo<'a, 'b>`, found `Foo<'b, 'a>`
21+
//~^^^ ERROR mismatched types: expected `Foo<'b, 'a>`, found `Foo<'a, 'b>`
22+
//~^^^^ ERROR mismatched types: expected `Foo<'b, 'a>`, found `Foo<'a, 'b>`
2323
}
2424

2525
fn main() {}

src/test/compile-fail/generic-type-params-name-repr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ fn main() {
2929

3030
// Including cases where the default is using previous type params.
3131
let _: HashMap<String, int> = ();
32-
//~^ ERROR mismatched types: expected `HashMap<collections::string::String,int>`, found `()`
32+
//~^ ERROR mismatched types: expected `HashMap<collections::string::String, int>`, found `()`
3333
let _: HashMap<String, int, Hash<String>> = ();
34-
//~^ ERROR mismatched types: expected `HashMap<collections::string::String,int>`, found `()`
34+
//~^ ERROR mismatched types: expected `HashMap<collections::string::String, int>`, found `()`
3535

3636
// But not when there's a different type in between.
3737
let _: Foo<A, int, C> = ();
38-
//~^ ERROR mismatched types: expected `Foo<A,int>`, found `()`
38+
//~^ ERROR mismatched types: expected `Foo<A, int>`, found `()`
3939

4040
// And don't print <> at all when there's just defaults.
4141
let _: Foo<A, B, C> = ();

src/test/compile-fail/issue-13482.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ fn main() {
1212
let x = [1,2];
1313
let y = match x {
1414
[] => None,
15-
//~^ ERROR mismatched types: expected `[<generic integer #0>, ..2]`, found `[<generic #7>, ..0]`
16-
// (expected array, found array)
15+
//~^ ERROR types: expected `[_#0i, ..2]`, found `[_#7, ..0]`
16+
// (expected array of 2 elements, found array of 0 elements)
1717
[a,_] => Some(a)
1818
};
1919
}

src/test/compile-fail/issue-16338.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::raw::Slice;
1212

1313
fn main() {
1414
let Slice { data: data, len: len } = "foo";
15-
//~^ ERROR mismatched types: expected `&str`, found `core::raw::Slice<<generic #3>>`
15+
//~^ ERROR mismatched types: expected `&str`, found `core::raw::Slice<_>`
1616
// (expected &-ptr, found struct core::raw::Slice)
1717
}
1818

src/test/compile-fail/issue-16401.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::raw::Slice;
1313
fn main() {
1414
match () {
1515
Slice { data: data, len: len } => (),
16-
//~^ ERROR mismatched types: expected `()`, found `core::raw::Slice<<generic #3>>`
16+
//~^ ERROR mismatched types: expected `()`, found `core::raw::Slice<_>`
1717
// (expected (), found struct core::raw::Slice)
1818
_ => unreachable!()
1919
}

src/test/compile-fail/issue-3680.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
fn main() {
1212
match None {
1313
Err(_) => ()
14-
//~^ ERROR mismatched types: expected `core::option::Option<<generic #1>>`
15-
// , found `core::result::Result<<generic #2>,<generic #3>>`
14+
//~^ ERROR mismatched types: expected `core::option::Option<_#1>`
15+
// , found `core::result::Result<_#2, _#3>`
1616
}
1717
}

src/test/compile-fail/issue-4201.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn main() {
1212
let a = if true {
1313
0
1414
} else if false {
15-
//~^ ERROR if may be missing an else clause: expected `()`, found `<generic integer #1>`
15+
//~^ ERROR if may be missing an else clause: expected `()`, found `_#1i`
1616
1
1717
};
1818
}

src/test/compile-fail/issue-4968.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
const A: (int,int) = (4,2);
1414
fn main() {
1515
match 42 { A => () }
16-
//~^ ERROR mismatched types: expected `<generic integer #0>`, found `(int,int)`
16+
//~^ ERROR mismatched types: expected `_#0i`, found `(int, int)`
1717
// (expected integral variable, found tuple)
1818
}

src/test/compile-fail/issue-5100.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,32 @@ enum A { B, C }
1313
fn main() {
1414
match (true, false) {
1515
B => (),
16-
//~^ ERROR mismatched types: expected `(bool,bool)`, found `A`
17-
// (expected tuple, found enum A)
16+
//~^ ERROR mismatched types: expected `(bool, bool)`, found `A` (expected tuple, found enum A)
1817
_ => ()
1918
}
2019

2120
match (true, false) {
2221
(true, false, false) => ()
23-
//~^ ERROR mismatched types: expected `(bool,bool)`,
24-
// found `(<generic #7>,<generic #8>,<generic #9>)`
25-
// (expected a tuple with 2 elements, found one with 3 elements)
22+
//~^ ERROR mismatched types: expected `(bool, bool)`, found `(_#9, _#10, _#11)`
23+
}
24+
25+
match (true, false) {
26+
(true, false, false) => ()
27+
//~^ ERROR (expected a tuple with 2 elements, found one with 3 elements)
2628
}
2729

2830
match (true, false) {
2931
box (true, false) => ()
30-
//~^ ERROR mismatched types: expected `(bool,bool)`, found `Box<<generic #15>>`
31-
// (expected tuple, found box)
32+
//~^ ERROR mismatched types: expected `(bool, bool)`, found `Box<_>` (expected tuple, found box)
3233
}
3334

3435
match (true, false) {
3536
&(true, false) => ()
36-
//~^ ERROR mismatched types: expected `(bool,bool)`, found `&<generic #21>`
37-
// (expected tuple, found &-ptr)
37+
//~^ ERROR mismatched types: expected `(bool, bool)`, found `&_` (expected tuple, found &-ptr)
3838
}
3939

4040

41-
let v = [('a', 'b') //~ ERROR expected function, found `(char,char)`
41+
let v = [('a', 'b') //~ ERROR expected function, found `(char, char)`
4242
('c', 'd'),
4343
('e', 'f')];
4444

src/test/compile-fail/issue-5500.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
fn main() {
1212
&panic!()
13-
//~^ ERROR mismatched types: expected `()`, found `&<generic #2>` (expected (), found &-ptr)
13+
//~^ ERROR mismatched types: expected `()`, found `&_` (expected (), found &-ptr)
1414
}

src/test/compile-fail/issue-7092.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ enum Whatever {
1414
fn foo(x: Whatever) {
1515
match x {
1616
Some(field) =>
17-
//~^ ERROR: mismatched types: expected `Whatever`, found `core::option::Option<<generic #3>>`
17+
//~^ ERROR: mismatched types: expected `Whatever`, found `core::option::Option<_>`
1818
field.access(), //~ ERROR the type of this value must be known in this context
1919
}
2020
}

src/test/compile-fail/issue-7867.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ mod foo { pub fn bar() {} }
1414

1515
fn main() {
1616
match (true, false) {
17-
B => (), //~ ERROR expected `(bool,bool)`, found `A` (expected tuple, found enum A)
17+
B => (), //~ ERROR expected `(bool, bool)`, found `A` (expected tuple, found enum A)
1818
_ => ()
1919
}
2020

2121
match &Some(42i) {
2222
Some(x) => (), //~ ERROR expected `&core::option::Option<int>`,
23-
// found `core::option::Option<<generic #4>>`
23+
// found `core::option::Option<_>`
2424
None => () //~ ERROR expected `&core::option::Option<int>`,
25-
// found `core::option::Option<<generic #5>>`
25+
// found `core::option::Option<_>`
2626
}
2727
}

src/test/compile-fail/map-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ fn main() {
1818
let x: Box<HashMap<int, int>> = box HashMap::new();
1919
let x: Box<Map<int, int>> = x;
2020
let y: Box<Map<uint, int>> = box x;
21-
//~^ ERROR the trait `collections::Map<uint,int>` is not implemented
21+
//~^ ERROR the trait `collections::Map<uint, int>` is not implemented
2222
}

src/test/compile-fail/match-vec-mismatch-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
fn main() {
1212
match () {
1313
[()] => { }
14-
//~^ ERROR mismatched types: expected `()`, found `&[<generic #1>]` (expected (), found &-ptr)
14+
//~^ ERROR mismatched types: expected `()`, found `&[_]` (expected (), found &-ptr)
1515
}
1616
}

src/test/compile-fail/repeat_count.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() {
1818
let c = [0, ..true]; //~ ERROR expected positive integer for repeat count, found boolean
1919
//~^ ERROR: expected `uint`, found `bool`
2020
let d = [0, ..0.5]; //~ ERROR expected positive integer for repeat count, found float
21-
//~^ ERROR: expected `uint`, found `<generic float #0>`
21+
//~^ ERROR: expected `uint`, found `_#0f`
2222
let e = [0, .."foo"]; //~ ERROR expected positive integer for repeat count, found string
2323
//~^ ERROR: expected `uint`, found `&'static str`
2424
let f = [0, ..-4];

src/test/compile-fail/slightly-nice-generic-literal-messages.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct Foo<T,U>(T);
1313
fn main() {
1414
match Foo(1.1) {
1515
1 => {}
16-
//~^ ERROR expected `Foo<<generic float #0>,<generic #2>>`, found `<generic integer #0>`
16+
//~^ ERROR expected `Foo<_#0f, _#2>`, found `_#0i`
1717
}
1818

1919
}

src/test/compile-fail/suppressed-error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
fn main() {
1212
let (x, y) = ();
13-
//~^ ERROR types: expected `()`, found `(<generic #3>,<generic #4>)` (expected (), found tuple)
13+
//~^ ERROR expected `()`, found `(_#3, _#4)` (expected (), found tuple)
1414
return x;
1515
}

src/test/compile-fail/tuple-arity-mismatch.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ fn first((value, _): (int, f64)) -> int { value }
1515
fn main() {
1616
let y = first ((1,2.0,3));
1717
//~^ ERROR expected a tuple with 2 elements, found one with 3 elements
18+
19+
let y = first ((1,));
20+
//~^ ERROR expected `(int, f64)`, found `(int,)`
1821
}

src/test/compile-fail/tuple-index-out-of-bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ fn main() {
2222
tuple.0;
2323
tuple.1;
2424
tuple.2;
25-
//~^ ERROR attempted out-of-bounds tuple index `2` on type `(int,int)`
25+
//~^ ERROR attempted out-of-bounds tuple index `2` on type `(int, int)`
2626
}

src/test/compile-fail/typeck_type_placeholder_mismatch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ pub fn main() {
1919

2020
fn test1() {
2121
let x: Foo<_> = Bar::<uint>;
22-
//~^ ERROR mismatched types: expected `Foo<<generic #0>>`, found `Bar<uint>`
22+
//~^ ERROR mismatched types: expected `Foo<_>`, found `Bar<uint>`
2323
let y: Foo<uint> = x;
2424
}
2525

2626
fn test2() {
2727
let x: Foo<_> = Bar::<uint>;
28-
//~^ ERROR mismatched types: expected `Foo<<generic #0>>`, found `Bar<uint>`
28+
//~^ ERROR mismatched types: expected `Foo<_>`, found `Bar<uint>`
2929
}

0 commit comments

Comments
 (0)