Skip to content

Commit 1484f9c

Browse files
author
Jakub Bukaj
committed
Update tests with the new error messages
1 parent 4380e96 commit 1484f9c

15 files changed

+56
-29
lines changed

src/test/compile-fail/destructure-trait-ref.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ fn main() {
3030
let &&x = &&(&1i as &T);
3131

3232
// n == m
33-
let &x = &1i as &T; //~ ERROR cannot be dereferenced
34-
let &&x = &(&1i as &T); //~ ERROR cannot be dereferenced
35-
let box x = box 1i as Box<T>; //~ ERROR cannot be dereferenced
33+
let &x = &1i as &T; //~ ERROR type `&T` cannot be dereferenced
34+
let &&x = &(&1i as &T); //~ ERROR type `&T` cannot be dereferenced
35+
let box x = box 1i as Box<T>; //~ ERROR type `Box<T>` cannot be dereferenced
3636

3737
// n > m
38-
let &&x = &1i as &T; //~ ERROR found an `&`-pointer pattern
39-
let &&&x = &(&1i as &T); //~ ERROR found an `&`-pointer pattern
40-
let box box x = box 1i as Box<T>; //~ ERROR found a box pattern
38+
let &&x = &1i as &T; //~ ERROR found &-ptr
39+
let &&&x = &(&1i as &T); //~ ERROR found &-ptr
40+
let box box x = box 1i as Box<T>; //~ ERROR found box
4141
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ fn main() {
1212
let x = [1,2];
1313
let y = match x {
1414
[] => None,
15-
//~^ ERROR expected `[<generic integer #0>, ..2]`, found a fixed array pattern of size 0
15+
//~^ ERROR mismatched types: expected `[<generic integer #0>, ..2]`, found `[<generic #7>, ..0]`
16+
// (expected array, found array)
1617
[a,_] => Some(a)
1718
};
1819
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ mod b {
2929
let enum_struct_variant = ::a::get_enum_struct_variant();
3030
match enum_struct_variant {
3131
a::EnumStructVariant { x, y, z } => {
32-
//~^ ERROR error: mismatched types: expected `()`, found a structure pattern
32+
//~^ ERROR mismatched types: expected `()`, found `a::Enum`
33+
// (expected (), found enum a::Enum)
3334
}
3435
}
3536
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ struct vec3 { y: f32, z: f32 }
1313

1414
fn make(v: vec2) {
1515
let vec3 { y: _, z: _ } = v;
16-
//~^ ERROR `vec3` does not name the structure `vec2`
17-
//~^^ ERROR struct `vec2` does not have a field named `z`
16+
//~^ ERROR mismatched types: expected `vec2`, found `vec3`
17+
// (expected struct vec2, found struct vec3)
1818
}
1919

2020
fn main() { }

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

+17-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,23 @@
99
// except according to those terms.
1010

1111
struct Foo {
12-
a: uint,
12+
a: uint,
1313
}
1414

15-
fn main(){
16-
let Foo {a: _, a: _} = Foo {a: 29};
17-
//~^ ERROR field `a` bound twice in pattern
18-
}
15+
fn main() {
16+
let Foo {
17+
a: _, //~ NOTE field `a` previously bound here
18+
a: _ //~ ERROR field `a` bound multiple times in the pattern
19+
} = Foo { a: 29 };
20+
21+
let Foo {
22+
a, //~ NOTE field `a` previously bound here
23+
a: _ //~ ERROR field `a` bound multiple times in the pattern
24+
} = Foo { a: 29 };
1925

26+
let Foo {
27+
a, //~ NOTE field `a` previously bound here
28+
a: _, //~ ERROR field `a` bound multiple times in the pattern
29+
a: x //~ ERROR field `a` bound multiple times in the pattern
30+
} = Foo { a: 29 };
31+
}

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ fn main() {
1818
let e = B(REB(()), Tau { t: 3 });
1919
let u = match e {
2020
B(
21-
Tau{t: x}, //~ ERROR `Tau` does not name a variant
21+
Tau{t: x},
22+
//~^ ERROR mismatched types: expected `main::R`, found `main::Tau`
23+
// (expected enum main::R, found struct main::Tau)
2224
_) => x,
2325
};
2426
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +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 a structure pattern
15+
//~^ ERROR mismatched types: expected `&str`, found `core::raw::Slice<<generic #3>>`
16+
// (expected &-ptr, found struct core::raw::Slice)
1617
}
1718

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ use std::raw::Slice;
1313
fn main() {
1414
match () {
1515
Slice { data: data, len: len } => (),
16-
//~^ ERROR mismatched types: expected `()`, found a structure pattern
16+
//~^ ERROR mismatched types: expected `()`, found `core::raw::Slice<<generic #3>>`
17+
// (expected (), found struct core::raw::Slice)
1718
_ => unreachable!()
1819
}
1920
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ enum Foo {
1414

1515
fn main() {
1616
match Bar(1i) {
17-
Foo { i } => () //~ ERROR `Foo` does not name a variant
17+
Foo { i } => () //~ ERROR `Foo` does not name a struct or a struct variant
1818
}
1919
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enum MyOption<T> {
1515

1616
fn main() {
1717
match MySome(42i) {
18-
MySome { x: 42i } => (), //~ ERROR `MySome` does not name a struct variant
18+
MySome { x: 42i } => (), //~ ERROR `MySome` does not name a struct or a struct variant
1919
_ => (),
2020
}
2121
}

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

+9-4
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,29 @@ enum A { B, C }
1212

1313
fn main() {
1414
match (true, false) {
15-
B => (), //~ ERROR expected `(bool,bool)`, found an enum or structure pattern
15+
B => (),
16+
//~^ ERROR mismatched types: expected `(bool,bool)`, found `A`
17+
// (expected tuple, found enum A)
1618
_ => ()
1719
}
1820

1921
match (true, false) {
2022
(true, false, false) => ()
21-
//~^ ERROR mismatched types: expected `(bool,bool)`, found tuple
23+
//~^ ERROR mismatched types: expected `(bool,bool)`,
24+
// found `(<generic #7>,<generic #8>,<generic #9>)`
2225
// (expected a tuple with 2 elements, found one with 3 elements)
2326
}
2427

2528
match (true, false) {
2629
box (true, false) => ()
27-
//~^ ERROR mismatched types: expected `(bool,bool)`, found a box pattern
30+
//~^ ERROR mismatched types: expected `(bool,bool)`, found `Box<<generic #11>>`
31+
// (expected tuple, found box)
2832
}
2933

3034
match (true, false) {
3135
&(true, false) => ()
32-
//~^ ERROR mismatched types: expected `(bool,bool)`, found an `&`-pointer pattern
36+
//~^ ERROR mismatched types: expected `(bool,bool)`, found `&<generic #15>`
37+
// (expected tuple, found &-ptr)
3338
}
3439

3540

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ enum Whatever {
1313

1414
fn foo(x: Whatever) {
1515
match x {
16-
Some(field) => field.access(),
17-
//~^ ERROR: mismatched types: expected `Whatever`, found
16+
Some(field) =>
17+
//~^ ERROR: mismatched types: expected `Whatever`, found `core::option::Option<<generic #3>>`
18+
field.access(), //~ ERROR the type of this value must be known in this context
1819
}
1920
}
2021

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
fn main() {
1212
match () {
13-
[()] => { } //~ ERROR mismatched types: expected `()`, found an array pattern
13+
[()] => { }
14+
//~^ ERROR mismatched types: expected `()`, found `&[<generic #1>]` (expected (), found &-ptr)
1415
}
1516
}

src/test/compile-fail/pattern-error-continue.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ fn main() {
2929
_ => ()
3030
}
3131
match 'c' {
32-
S { .. } => (), //~ ERROR mismatched types: expected `char`, found a structure pattern
32+
S { .. } => (),
33+
//~^ ERROR mismatched types: expected `char`, found `S` (expected char, found struct S)
3334

3435
_ => ()
3536
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

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

0 commit comments

Comments
 (0)