Update tests with the new diagnostic tweaks
This commit is contained in:
parent
0c0365d33f
commit
66fbe4c22c
@ -9,8 +9,8 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let _x: int = [1i, 2, 3]; //~ ERROR expected int, found array
|
||||
let _x: int = [1i, 2, 3]; //~ ERROR expected int, found array of 3 elements
|
||||
|
||||
let x: &[int] = &[1, 2, 3];
|
||||
let _y: &int = x; //~ ERROR expected int, found unsized array
|
||||
let _y: &int = x; //~ ERROR expected int, found slice
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ struct Foo<'a,'b> {
|
||||
impl<'a,'b> Foo<'a,'b> {
|
||||
// The number of errors is related to the way invariance works.
|
||||
fn bar(self: Foo<'b,'a>) {}
|
||||
//~^ ERROR mismatched types: expected `Foo<'a,'b>`, found `Foo<'b,'a>`
|
||||
//~^^ ERROR mismatched types: expected `Foo<'a,'b>`, found `Foo<'b,'a>`
|
||||
//~^^^ ERROR mismatched types: expected `Foo<'b,'a>`, found `Foo<'a,'b>`
|
||||
//~^^^^ ERROR mismatched types: expected `Foo<'b,'a>`, found `Foo<'a,'b>`
|
||||
//~^ ERROR mismatched types: expected `Foo<'a, 'b>`, found `Foo<'b, 'a>`
|
||||
//~^^ ERROR mismatched types: expected `Foo<'a, 'b>`, found `Foo<'b, 'a>`
|
||||
//~^^^ ERROR mismatched types: expected `Foo<'b, 'a>`, found `Foo<'a, 'b>`
|
||||
//~^^^^ ERROR mismatched types: expected `Foo<'b, 'a>`, found `Foo<'a, 'b>`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -29,13 +29,13 @@ fn main() {
|
||||
|
||||
// Including cases where the default is using previous type params.
|
||||
let _: HashMap<String, int> = ();
|
||||
//~^ ERROR mismatched types: expected `HashMap<collections::string::String,int>`, found `()`
|
||||
//~^ ERROR mismatched types: expected `HashMap<collections::string::String, int>`, found `()`
|
||||
let _: HashMap<String, int, Hash<String>> = ();
|
||||
//~^ ERROR mismatched types: expected `HashMap<collections::string::String,int>`, found `()`
|
||||
//~^ ERROR mismatched types: expected `HashMap<collections::string::String, int>`, found `()`
|
||||
|
||||
// But not when there's a different type in between.
|
||||
let _: Foo<A, int, C> = ();
|
||||
//~^ ERROR mismatched types: expected `Foo<A,int>`, found `()`
|
||||
//~^ ERROR mismatched types: expected `Foo<A, int>`, found `()`
|
||||
|
||||
// And don't print <> at all when there's just defaults.
|
||||
let _: Foo<A, B, C> = ();
|
||||
|
@ -12,8 +12,8 @@ fn main() {
|
||||
let x = [1,2];
|
||||
let y = match x {
|
||||
[] => None,
|
||||
//~^ ERROR mismatched types: expected `[<generic integer #0>, ..2]`, found `[<generic #7>, ..0]`
|
||||
// (expected array, found array)
|
||||
//~^ ERROR types: expected `[_#0i, ..2]`, found `[_#7, ..0]`
|
||||
// (expected array of 2 elements, found array of 0 elements)
|
||||
[a,_] => Some(a)
|
||||
};
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ use std::raw::Slice;
|
||||
|
||||
fn main() {
|
||||
let Slice { data: data, len: len } = "foo";
|
||||
//~^ ERROR mismatched types: expected `&str`, found `core::raw::Slice<<generic #3>>`
|
||||
//~^ ERROR mismatched types: expected `&str`, found `core::raw::Slice<_>`
|
||||
// (expected &-ptr, found struct core::raw::Slice)
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ use std::raw::Slice;
|
||||
fn main() {
|
||||
match () {
|
||||
Slice { data: data, len: len } => (),
|
||||
//~^ ERROR mismatched types: expected `()`, found `core::raw::Slice<<generic #3>>`
|
||||
//~^ ERROR mismatched types: expected `()`, found `core::raw::Slice<_>`
|
||||
// (expected (), found struct core::raw::Slice)
|
||||
_ => unreachable!()
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
fn main() {
|
||||
match None {
|
||||
Err(_) => ()
|
||||
//~^ ERROR mismatched types: expected `core::option::Option<<generic #1>>`
|
||||
// , found `core::result::Result<<generic #2>,<generic #3>>`
|
||||
//~^ ERROR mismatched types: expected `core::option::Option<_#1>`
|
||||
// , found `core::result::Result<_#2, _#3>`
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ fn main() {
|
||||
let a = if true {
|
||||
0
|
||||
} else if false {
|
||||
//~^ ERROR if may be missing an else clause: expected `()`, found `<generic integer #1>`
|
||||
//~^ ERROR if may be missing an else clause: expected `()`, found `_#1i`
|
||||
1
|
||||
};
|
||||
}
|
||||
|
@ -13,6 +13,6 @@
|
||||
const A: (int,int) = (4,2);
|
||||
fn main() {
|
||||
match 42 { A => () }
|
||||
//~^ ERROR mismatched types: expected `<generic integer #0>`, found `(int,int)`
|
||||
//~^ ERROR mismatched types: expected `_#0i`, found `(int, int)`
|
||||
// (expected integral variable, found tuple)
|
||||
}
|
||||
|
@ -13,32 +13,32 @@ enum A { B, C }
|
||||
fn main() {
|
||||
match (true, false) {
|
||||
B => (),
|
||||
//~^ ERROR mismatched types: expected `(bool,bool)`, found `A`
|
||||
// (expected tuple, found enum A)
|
||||
//~^ ERROR mismatched types: expected `(bool, bool)`, found `A` (expected tuple, found enum A)
|
||||
_ => ()
|
||||
}
|
||||
|
||||
match (true, false) {
|
||||
(true, false, false) => ()
|
||||
//~^ ERROR mismatched types: expected `(bool,bool)`,
|
||||
// found `(<generic #7>,<generic #8>,<generic #9>)`
|
||||
// (expected a tuple with 2 elements, found one with 3 elements)
|
||||
//~^ ERROR mismatched types: expected `(bool, bool)`, found `(_#9, _#10, _#11)`
|
||||
}
|
||||
|
||||
match (true, false) {
|
||||
(true, false, false) => ()
|
||||
//~^ ERROR (expected a tuple with 2 elements, found one with 3 elements)
|
||||
}
|
||||
|
||||
match (true, false) {
|
||||
box (true, false) => ()
|
||||
//~^ ERROR mismatched types: expected `(bool,bool)`, found `Box<<generic #15>>`
|
||||
// (expected tuple, found box)
|
||||
//~^ ERROR mismatched types: expected `(bool, bool)`, found `Box<_>` (expected tuple, found box)
|
||||
}
|
||||
|
||||
match (true, false) {
|
||||
&(true, false) => ()
|
||||
//~^ ERROR mismatched types: expected `(bool,bool)`, found `&<generic #21>`
|
||||
// (expected tuple, found &-ptr)
|
||||
//~^ ERROR mismatched types: expected `(bool, bool)`, found `&_` (expected tuple, found &-ptr)
|
||||
}
|
||||
|
||||
|
||||
let v = [('a', 'b') //~ ERROR expected function, found `(char,char)`
|
||||
let v = [('a', 'b') //~ ERROR expected function, found `(char, char)`
|
||||
('c', 'd'),
|
||||
('e', 'f')];
|
||||
|
||||
|
@ -10,5 +10,5 @@
|
||||
|
||||
fn main() {
|
||||
&panic!()
|
||||
//~^ ERROR mismatched types: expected `()`, found `&<generic #2>` (expected (), found &-ptr)
|
||||
//~^ ERROR mismatched types: expected `()`, found `&_` (expected (), found &-ptr)
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ enum Whatever {
|
||||
fn foo(x: Whatever) {
|
||||
match x {
|
||||
Some(field) =>
|
||||
//~^ ERROR: mismatched types: expected `Whatever`, found `core::option::Option<<generic #3>>`
|
||||
//~^ ERROR: mismatched types: expected `Whatever`, found `core::option::Option<_>`
|
||||
field.access(), //~ ERROR the type of this value must be known in this context
|
||||
}
|
||||
}
|
||||
|
@ -14,14 +14,14 @@ mod foo { pub fn bar() {} }
|
||||
|
||||
fn main() {
|
||||
match (true, false) {
|
||||
B => (), //~ ERROR expected `(bool,bool)`, found `A` (expected tuple, found enum A)
|
||||
B => (), //~ ERROR expected `(bool, bool)`, found `A` (expected tuple, found enum A)
|
||||
_ => ()
|
||||
}
|
||||
|
||||
match &Some(42i) {
|
||||
Some(x) => (), //~ ERROR expected `&core::option::Option<int>`,
|
||||
// found `core::option::Option<<generic #4>>`
|
||||
// found `core::option::Option<_>`
|
||||
None => () //~ ERROR expected `&core::option::Option<int>`,
|
||||
// found `core::option::Option<<generic #5>>`
|
||||
// found `core::option::Option<_>`
|
||||
}
|
||||
}
|
||||
|
@ -18,5 +18,5 @@ fn main() {
|
||||
let x: Box<HashMap<int, int>> = box HashMap::new();
|
||||
let x: Box<Map<int, int>> = x;
|
||||
let y: Box<Map<uint, int>> = box x;
|
||||
//~^ ERROR the trait `collections::Map<uint,int>` is not implemented
|
||||
//~^ ERROR the trait `collections::Map<uint, int>` is not implemented
|
||||
}
|
||||
|
@ -11,6 +11,6 @@
|
||||
fn main() {
|
||||
match () {
|
||||
[()] => { }
|
||||
//~^ ERROR mismatched types: expected `()`, found `&[<generic #1>]` (expected (), found &-ptr)
|
||||
//~^ ERROR mismatched types: expected `()`, found `&[_]` (expected (), found &-ptr)
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ fn main() {
|
||||
let c = [0, ..true]; //~ ERROR expected positive integer for repeat count, found boolean
|
||||
//~^ ERROR: expected `uint`, found `bool`
|
||||
let d = [0, ..0.5]; //~ ERROR expected positive integer for repeat count, found float
|
||||
//~^ ERROR: expected `uint`, found `<generic float #0>`
|
||||
//~^ ERROR: expected `uint`, found `_#0f`
|
||||
let e = [0, .."foo"]; //~ ERROR expected positive integer for repeat count, found string
|
||||
//~^ ERROR: expected `uint`, found `&'static str`
|
||||
let f = [0, ..-4];
|
||||
|
@ -13,7 +13,7 @@ struct Foo<T,U>(T);
|
||||
fn main() {
|
||||
match Foo(1.1) {
|
||||
1 => {}
|
||||
//~^ ERROR expected `Foo<<generic float #0>,<generic #2>>`, found `<generic integer #0>`
|
||||
//~^ ERROR expected `Foo<_#0f, _#2>`, found `_#0i`
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,6 @@
|
||||
|
||||
fn main() {
|
||||
let (x, y) = ();
|
||||
//~^ ERROR types: expected `()`, found `(<generic #3>,<generic #4>)` (expected (), found tuple)
|
||||
//~^ ERROR expected `()`, found `(_#3, _#4)` (expected (), found tuple)
|
||||
return x;
|
||||
}
|
||||
|
@ -15,4 +15,7 @@ fn first((value, _): (int, f64)) -> int { value }
|
||||
fn main() {
|
||||
let y = first ((1,2.0,3));
|
||||
//~^ ERROR expected a tuple with 2 elements, found one with 3 elements
|
||||
|
||||
let y = first ((1,));
|
||||
//~^ ERROR expected `(int, f64)`, found `(int,)`
|
||||
}
|
||||
|
@ -22,5 +22,5 @@ fn main() {
|
||||
tuple.0;
|
||||
tuple.1;
|
||||
tuple.2;
|
||||
//~^ ERROR attempted out-of-bounds tuple index `2` on type `(int,int)`
|
||||
//~^ ERROR attempted out-of-bounds tuple index `2` on type `(int, int)`
|
||||
}
|
||||
|
@ -19,11 +19,11 @@ pub fn main() {
|
||||
|
||||
fn test1() {
|
||||
let x: Foo<_> = Bar::<uint>;
|
||||
//~^ ERROR mismatched types: expected `Foo<<generic #0>>`, found `Bar<uint>`
|
||||
//~^ ERROR mismatched types: expected `Foo<_>`, found `Bar<uint>`
|
||||
let y: Foo<uint> = x;
|
||||
}
|
||||
|
||||
fn test2() {
|
||||
let x: Foo<_> = Bar::<uint>;
|
||||
//~^ ERROR mismatched types: expected `Foo<<generic #0>>`, found `Bar<uint>`
|
||||
//~^ ERROR mismatched types: expected `Foo<_>`, found `Bar<uint>`
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user