Skip to content

Commit 7b82a93

Browse files
committed
Fix testsuite errors
1 parent 5616b92 commit 7b82a93

File tree

95 files changed

+980
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+980
-221
lines changed

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

+12-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,18 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
let _x: isize = [1is, 2, 3]; //~ ERROR expected isize, found array of 3 elements
12+
let _x: isize = [1is, 2, 3];
13+
//~^ ERROR mismatched types
14+
//~| expected `isize`
15+
//~| found `[isize; 3]`
16+
//~| expected isize
17+
//~| found array of 3 elements
1318

1419
let x: &[isize] = &[1, 2, 3];
15-
let _y: &isize = x; //~ ERROR expected isize, found slice
20+
let _y: &isize = x;
21+
//~^ ERROR mismatched types
22+
//~| expected `&isize`
23+
//~| found `&[isize]`
24+
//~| expected isize
25+
//~| found slice
1626
}

src/test/compile-fail/associated-types-eq-3.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ fn foo1<I: Foo<A=Bar>>(x: I) {
3030
}
3131

3232
fn foo2<I: Foo>(x: I) {
33-
let _: Bar = x.boo(); //~ERROR mismatched types
33+
let _: Bar = x.boo();
34+
//~^ ERROR mismatched types
35+
//~| expected `Bar`
36+
//~| found `<I as Foo>::A`
37+
//~| expected struct `Bar`
38+
//~| found associated type
3439
}
3540

3641

@@ -41,6 +46,12 @@ pub fn baz(x: &Foo<A=Bar>) {
4146

4247
pub fn main() {
4348
let a = 42is;
44-
foo1(a); //~ERROR expected usize, found struct Bar
45-
baz(&a); //~ERROR expected usize, found struct Bar
49+
foo1(a);
50+
//~^ ERROR type mismatch resolving
51+
//~| expected usize
52+
//~| found struct `Bar`
53+
baz(&a);
54+
//~^ ERROR type mismatch resolving
55+
//~| expected usize
56+
//~| found struct `Bar`
4657
}

src/test/compile-fail/associated-types-path-2.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ pub fn f2<T: Foo>(a: T) -> T::A {
2525

2626
pub fn f1_int_int() {
2727
f1(2is, 4is);
28-
//~^ ERROR expected usize, found isize
28+
//~^ ERROR type mismatch resolving
29+
//~| expected usize
30+
//~| found isize
2931
}
3032

3133
pub fn f1_int_uint() {
@@ -46,7 +48,11 @@ pub fn f1_uint_int() {
4648

4749
pub fn f2_int() {
4850
let _: isize = f2(2is);
49-
//~^ ERROR expected `isize`, found `usize`
51+
//~^ ERROR mismatched types
52+
//~| expected `isize`
53+
//~| found `usize`
54+
//~| expected isize
55+
//~| found usize
5056
}
5157

5258
pub fn main() { }

src/test/compile-fail/bad-const-type.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:expected `collections::string::String`, found `isize`
12-
1311
static i: String = 10is;
12+
//~^ ERROR mismatched types
13+
//~| expected `collections::string::String`
14+
//~| found `isize`
15+
//~| expected struct `collections::string::String`
16+
//~| found isize
1417
fn main() { println!("{}", i); }

src/test/compile-fail/block-must-not-have-result-do.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:mismatched types: expected `()`, found `bool`
12-
1311
fn main() {
1412
loop {
15-
true
13+
true //~ ERROR mismatched types
14+
//~| expected ()
15+
//~| found bool
16+
//~| expected ()
17+
//~| found bool
1618
}
1719
}

src/test/compile-fail/block-must-not-have-result-res.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:mismatched types: expected `()`, found `bool`
12-
1311
struct r;
1412

1513
impl Drop for r {
1614
fn drop(&mut self) {
17-
true
15+
true //~ ERROR mismatched types
16+
//~| expected ()
17+
//~| found bool
18+
//~| expected ()
19+
//~| found bool
1820
}
1921
}
2022

src/test/compile-fail/block-must-not-have-result-while.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:mismatched types: expected `()`, found `bool`
12-
1311
fn main() {
1412
while true {
15-
true
13+
true //~ ERROR mismatched types
14+
//~| expected `()`
15+
//~| found `bool`
16+
//~| expected ()
17+
//~| found bool
1618
}
1719
}

src/test/compile-fail/coercion-slice.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@
1111
// Tests that we forbid coercion from `[T; n]` to `&[T]`
1212

1313
fn main() {
14-
let _: &[isize] = [0is]; //~ERROR: mismatched types: expected `&[isize]`, found `[isize; 1]`
14+
let _: &[isize] = [0is];
15+
//~^ ERROR mismatched types
16+
//~| expected `&[isize]`
17+
//~| found `[isize; 1]`
18+
//~| expected &-ptr
19+
//~| found array of 1 elements
1520
}

src/test/compile-fail/const-cast-different-types.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@
1010

1111
static a: &'static str = "foo";
1212
static b: *const u8 = a as *const u8;
13-
//~^ ERROR mismatched types: expected `*const u8`, found `&'static str`
13+
//~^ ERROR mismatched types
14+
//~| expected *const u8
15+
//~| found &'static str
16+
//~| expected u8
17+
//~| found str
1418
static c: *const u8 = &a as *const u8;
15-
//~^ ERROR mismatched types: expected `*const u8`, found `&&'static str`
19+
//~^ ERROR mismatched types
20+
//~| expected *const u8
21+
//~| found &&'static str
22+
//~| expected u8
23+
//~| found &-ptr
1624

1725
fn main() {
1826
}

src/test/compile-fail/cross-borrow-trait.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ impl Trait for Foo {}
1919

2020
pub fn main() {
2121
let x: Box<Trait> = box Foo;
22-
let _y: &Trait = x; //~ ERROR mismatched types: expected `&Trait`, found `Box<Trait>`
22+
let _y: &Trait = x; //~ ERROR mismatched types
23+
//~| expected `&Trait`
24+
//~| found `Box<Trait>`
25+
//~| expected &-ptr
26+
//~| found box
2327
}
2428

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

+18-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,22 @@ fn main() {
3737
let box x = box 1is as Box<T>; //~ ERROR type `Box<T>` cannot be dereferenced
3838

3939
// n > m
40-
let &&x = &1is as &T; //~ ERROR found &-ptr
41-
let &&&x = &(&1is as &T); //~ ERROR found &-ptr
42-
let box box x = box 1is as Box<T>; //~ ERROR found box
40+
let &&x = &1is as &T;
41+
//~^ ERROR mismatched types
42+
//~| expected `T`
43+
//~| found `&_`
44+
//~| expected trait T
45+
//~| found &-ptr
46+
let &&&x = &(&1is as &T);
47+
//~^ ERROR mismatched types
48+
//~| expected `T`
49+
//~| found `&_`
50+
//~| expected trait T
51+
//~| found &-ptr
52+
let box box x = box 1is as Box<T>;
53+
//~^ ERROR mismatched types
54+
//~| expected `T`
55+
//~| found `Box<_>`
56+
//~| expected trait T
57+
//~| found box
4358
}

src/test/compile-fail/dst-bad-assign.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ pub fn main() {
4444
// Assignment.
4545
let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} };
4646
let z: Box<ToBar> = box Bar1 {f: 36};
47-
f5.ptr = Bar1 {f: 36}; //~ ERROR mismatched types: expected `ToBar`, found `Bar1`
48-
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `ToBar`
47+
f5.ptr = Bar1 {f: 36};
48+
//~^ ERROR mismatched types
49+
//~| expected `ToBar`
50+
//~| found `Bar1`
51+
//~| expected trait ToBar
52+
//~| found struct `Bar1`
53+
//~| ERROR the trait `core::marker::Sized` is not implemented for the type `ToBar`
4954
}

src/test/compile-fail/dst-bad-coerce1.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ pub fn main() {
2222
let f1 = Fat { ptr: [1, 2, 3] };
2323
let f2: &Fat<[isize; 3]> = &f1;
2424
let f3: &Fat<[usize]> = f2;
25-
//~^ ERROR mismatched types: expected `&Fat<[usize]>`, found `&Fat<[isize; 3]>`
25+
//~^ ERROR mismatched types
26+
//~| expected `&Fat<[usize]>`
27+
//~| found `&Fat<[isize; 3]>`
28+
//~| expected usize
29+
//~| found isize
2630

2731
// With a trait.
2832
let f1 = Fat { ptr: Foo };

src/test/compile-fail/dst-bad-coerce4.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@ pub fn main() {
1818
// With a vec of isizes.
1919
let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] };
2020
let f2: &Fat<[isize; 3]> = f1;
21-
//~^ ERROR mismatched types: expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>`
21+
//~^ ERROR mismatched types
22+
//~| expected `&Fat<[isize; 3]>`
23+
//~| found `&Fat<[isize]>`
24+
//~| expected array of 3 elements
25+
//~| found slice
2226
}

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ struct Foo<'a,'b> {
1515

1616
impl<'a,'b> Foo<'a,'b> {
1717
fn bar(self: Foo<'b,'a>) {}
18-
//~^ ERROR mismatched types: expected `Foo<'a, 'b>`, found `Foo<'b, 'a>`
19-
//~^^ ERROR mismatched types: expected `Foo<'a, 'b>`, found `Foo<'b, 'a>`
18+
//~^ ERROR mismatched types
19+
//~| expected `Foo<'a, 'b>`
20+
//~| found `Foo<'b, 'a>`
21+
//~| lifetime mismatch
22+
//~| ERROR mismatched types
23+
//~| expected `Foo<'a, 'b>`
24+
//~| found `Foo<'b, 'a>`
25+
//~| lifetime mismatch
2026
}
2127

2228
fn main() {}

src/test/compile-fail/fn-item-type.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@ fn eq<T>(x: T, y: T) { }
1818

1919
fn main() {
2020
let f = if true { foo } else { bar };
21-
//~^ ERROR expected fn item, found a different fn item
21+
//~^ ERROR if and else have incompatible types
22+
//~| expected `fn(isize) -> isize {foo}`
23+
//~| found `fn(isize) -> isize {bar}`
24+
//~| expected fn item,
25+
//~| found a different fn item
2226

2327
eq(foo, bar);
24-
//~^ ERROR expected fn item, found a different fn item
28+
//~^ ERROR mismatched types
29+
//~| expected `fn(isize) -> isize {foo}`
30+
//~| found `fn(isize) -> isize {bar}`
31+
//~| expected fn item
32+
//~| found a different fn item
2533
}

src/test/compile-fail/fn-trait-formatting.rs

+17-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,25 @@
1414
fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
1515

1616
fn main() {
17-
let _: () = (box |:_: isize| {}) as Box<FnOnce(isize)>; //~ ERROR object-safe
18-
//~^ ERROR Box<core::ops::FnOnce(isize)>
17+
let _: () = (box |:_: isize| {}) as Box<FnOnce(isize)>;
18+
//~^ ERROR object-safe
19+
//~| ERROR mismatched types
20+
//~| expected `()`
21+
//~| found `Box<core::ops::FnOnce(isize)>`
22+
//~| expected ()
23+
//~| found box
1924
let _: () = (box |&:_: isize, isize| {}) as Box<Fn(isize, isize)>;
20-
//~^ ERROR Box<core::ops::Fn(isize, isize)>
25+
//~^ ERROR mismatched types
26+
//~| expected `()`
27+
//~| found `Box<core::ops::Fn(isize, isize)>`
28+
//~| expected ()
29+
//~| found box
2130
let _: () = (box |&mut:| -> isize unimplemented!()) as Box<FnMut() -> isize>;
22-
//~^ ERROR Box<core::ops::FnMut() -> isize>
31+
//~^ ERROR mismatched types
32+
//~| expected `()`
33+
//~| found `Box<core::ops::FnMut() -> isize>`
34+
//~| expected ()
35+
//~| found box
2336

2437
needs_fn(1is); //~ ERROR `core::ops::Fn(isize) -> isize`
2538
}

src/test/compile-fail/fully-qualified-type-name1.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,9 @@
1313
fn main() {
1414
let x: Option<usize>;
1515
x = 5;
16-
//~^ ERROR mismatched types: expected `core::option::Option<usize>`
16+
//~^ ERROR mismatched types
17+
//~| expected `core::option::Option<usize>`
18+
//~| found `_`
19+
//~| expected enum `core::option::Option`
20+
//~| found integral variable
1721
}

src/test/compile-fail/fully-qualified-type-name2.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ mod y {
2020

2121
fn bar(x: x::foo) -> y::foo {
2222
return x;
23-
//~^ ERROR mismatched types: expected `y::foo`, found `x::foo`
23+
//~^ ERROR mismatched types
24+
//~| expected `y::foo`
25+
//~| found `x::foo`
26+
//~| expected enum `y::foo`
27+
//~| found enum `x::foo`
2428
}
2529

2630
fn main() {

src/test/compile-fail/fully-qualified-type-name4.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ use std::option::Option;
1414

1515
fn bar(x: usize) -> Option<usize> {
1616
return x;
17-
//~^ ERROR mismatched types: expected `core::option::Option<usize>`
17+
//~^ ERROR mismatched types
18+
//~| expected `core::option::Option<usize>`
19+
//~| found `usize`
20+
//~| expected enum `core::option::Option`
21+
//~| found usize
1822
}
1923

2024
fn main() {

0 commit comments

Comments
 (0)