From 66fbe4c22c9743aff642f06549ce5f503668f722 Mon Sep 17 00:00:00 2001 From: Jakub Bukaj Date: Thu, 23 Oct 2014 22:48:32 +0200 Subject: [PATCH] Update tests with the new diagnostic tweaks --- src/test/compile-fail/array-not-vector.rs | 4 ++-- .../explicit-self-lifetime-mismatch.rs | 8 ++++---- .../generic-type-params-name-repr.rs | 6 +++--- src/test/compile-fail/issue-13482.rs | 4 ++-- src/test/compile-fail/issue-16338.rs | 2 +- src/test/compile-fail/issue-16401.rs | 2 +- src/test/compile-fail/issue-3680.rs | 4 ++-- src/test/compile-fail/issue-4201.rs | 2 +- src/test/compile-fail/issue-4968.rs | 2 +- src/test/compile-fail/issue-5100.rs | 20 +++++++++---------- src/test/compile-fail/issue-5500.rs | 2 +- src/test/compile-fail/issue-7092.rs | 2 +- src/test/compile-fail/issue-7867.rs | 6 +++--- src/test/compile-fail/map-types.rs | 2 +- src/test/compile-fail/match-vec-mismatch-2.rs | 2 +- src/test/compile-fail/repeat_count.rs | 2 +- .../slightly-nice-generic-literal-messages.rs | 2 +- src/test/compile-fail/suppressed-error.rs | 2 +- src/test/compile-fail/tuple-arity-mismatch.rs | 3 +++ .../compile-fail/tuple-index-out-of-bounds.rs | 2 +- .../typeck_type_placeholder_mismatch.rs | 4 ++-- 21 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/test/compile-fail/array-not-vector.rs b/src/test/compile-fail/array-not-vector.rs index 79d4ada41e8..7edb4b8754a 100644 --- a/src/test/compile-fail/array-not-vector.rs +++ b/src/test/compile-fail/array-not-vector.rs @@ -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 } diff --git a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs b/src/test/compile-fail/explicit-self-lifetime-mismatch.rs index b5346a1c5d1..d1ae535d830 100644 --- a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs +++ b/src/test/compile-fail/explicit-self-lifetime-mismatch.rs @@ -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() {} diff --git a/src/test/compile-fail/generic-type-params-name-repr.rs b/src/test/compile-fail/generic-type-params-name-repr.rs index 87c865ab618..1c14644ec18 100644 --- a/src/test/compile-fail/generic-type-params-name-repr.rs +++ b/src/test/compile-fail/generic-type-params-name-repr.rs @@ -29,13 +29,13 @@ fn main() { // Including cases where the default is using previous type params. let _: HashMap = (); - //~^ ERROR mismatched types: expected `HashMap`, found `()` + //~^ ERROR mismatched types: expected `HashMap`, found `()` let _: HashMap> = (); - //~^ ERROR mismatched types: expected `HashMap`, found `()` + //~^ ERROR mismatched types: expected `HashMap`, found `()` // But not when there's a different type in between. let _: Foo = (); - //~^ ERROR mismatched types: expected `Foo`, found `()` + //~^ ERROR mismatched types: expected `Foo`, found `()` // And don't print <> at all when there's just defaults. let _: Foo = (); diff --git a/src/test/compile-fail/issue-13482.rs b/src/test/compile-fail/issue-13482.rs index 43c7f45e15a..0139a2ff710 100644 --- a/src/test/compile-fail/issue-13482.rs +++ b/src/test/compile-fail/issue-13482.rs @@ -12,8 +12,8 @@ fn main() { let x = [1,2]; let y = match x { [] => None, -//~^ ERROR mismatched types: expected `[, ..2]`, found `[, ..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) }; } diff --git a/src/test/compile-fail/issue-16338.rs b/src/test/compile-fail/issue-16338.rs index 537fc5aaa55..f62bccb22f3 100644 --- a/src/test/compile-fail/issue-16338.rs +++ b/src/test/compile-fail/issue-16338.rs @@ -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<>` + //~^ ERROR mismatched types: expected `&str`, found `core::raw::Slice<_>` // (expected &-ptr, found struct core::raw::Slice) } diff --git a/src/test/compile-fail/issue-16401.rs b/src/test/compile-fail/issue-16401.rs index deb2f5912b6..4890cc52c00 100644 --- a/src/test/compile-fail/issue-16401.rs +++ b/src/test/compile-fail/issue-16401.rs @@ -13,7 +13,7 @@ use std::raw::Slice; fn main() { match () { Slice { data: data, len: len } => (), - //~^ ERROR mismatched types: expected `()`, found `core::raw::Slice<>` + //~^ ERROR mismatched types: expected `()`, found `core::raw::Slice<_>` // (expected (), found struct core::raw::Slice) _ => unreachable!() } diff --git a/src/test/compile-fail/issue-3680.rs b/src/test/compile-fail/issue-3680.rs index 96a93c205fe..a23f76bd15b 100644 --- a/src/test/compile-fail/issue-3680.rs +++ b/src/test/compile-fail/issue-3680.rs @@ -11,7 +11,7 @@ fn main() { match None { Err(_) => () - //~^ ERROR mismatched types: expected `core::option::Option<>` - // , found `core::result::Result<,>` + //~^ ERROR mismatched types: expected `core::option::Option<_#1>` + // , found `core::result::Result<_#2, _#3>` } } diff --git a/src/test/compile-fail/issue-4201.rs b/src/test/compile-fail/issue-4201.rs index 4b2be9e58ac..69bcfc019c0 100644 --- a/src/test/compile-fail/issue-4201.rs +++ b/src/test/compile-fail/issue-4201.rs @@ -12,7 +12,7 @@ fn main() { let a = if true { 0 } else if false { -//~^ ERROR if may be missing an else clause: expected `()`, found `` +//~^ ERROR if may be missing an else clause: expected `()`, found `_#1i` 1 }; } diff --git a/src/test/compile-fail/issue-4968.rs b/src/test/compile-fail/issue-4968.rs index a181215f418..8311d6fd563 100644 --- a/src/test/compile-fail/issue-4968.rs +++ b/src/test/compile-fail/issue-4968.rs @@ -13,6 +13,6 @@ const A: (int,int) = (4,2); fn main() { match 42 { A => () } - //~^ ERROR mismatched types: expected ``, found `(int,int)` + //~^ ERROR mismatched types: expected `_#0i`, found `(int, int)` // (expected integral variable, found tuple) } diff --git a/src/test/compile-fail/issue-5100.rs b/src/test/compile-fail/issue-5100.rs index 3ddb713528c..be7bd248614 100644 --- a/src/test/compile-fail/issue-5100.rs +++ b/src/test/compile-fail/issue-5100.rs @@ -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 `(,,)` - // (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<>` - // (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 `&` - // (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')]; diff --git a/src/test/compile-fail/issue-5500.rs b/src/test/compile-fail/issue-5500.rs index 86ff29a52b0..56867349065 100644 --- a/src/test/compile-fail/issue-5500.rs +++ b/src/test/compile-fail/issue-5500.rs @@ -10,5 +10,5 @@ fn main() { &panic!() - //~^ ERROR mismatched types: expected `()`, found `&` (expected (), found &-ptr) + //~^ ERROR mismatched types: expected `()`, found `&_` (expected (), found &-ptr) } diff --git a/src/test/compile-fail/issue-7092.rs b/src/test/compile-fail/issue-7092.rs index cc7e8052920..116639f4945 100644 --- a/src/test/compile-fail/issue-7092.rs +++ b/src/test/compile-fail/issue-7092.rs @@ -14,7 +14,7 @@ enum Whatever { fn foo(x: Whatever) { match x { Some(field) => -//~^ ERROR: mismatched types: expected `Whatever`, found `core::option::Option<>` +//~^ ERROR: mismatched types: expected `Whatever`, found `core::option::Option<_>` field.access(), //~ ERROR the type of this value must be known in this context } } diff --git a/src/test/compile-fail/issue-7867.rs b/src/test/compile-fail/issue-7867.rs index 0ab551642a0..f3915634cc1 100644 --- a/src/test/compile-fail/issue-7867.rs +++ b/src/test/compile-fail/issue-7867.rs @@ -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`, - // found `core::option::Option<>` + // found `core::option::Option<_>` None => () //~ ERROR expected `&core::option::Option`, - // found `core::option::Option<>` + // found `core::option::Option<_>` } } diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index cbe39132479..6f032c5b1f0 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -18,5 +18,5 @@ fn main() { let x: Box> = box HashMap::new(); let x: Box> = x; let y: Box> = box x; - //~^ ERROR the trait `collections::Map` is not implemented + //~^ ERROR the trait `collections::Map` is not implemented } diff --git a/src/test/compile-fail/match-vec-mismatch-2.rs b/src/test/compile-fail/match-vec-mismatch-2.rs index 6d37eb8a636..6bb049f3ca5 100644 --- a/src/test/compile-fail/match-vec-mismatch-2.rs +++ b/src/test/compile-fail/match-vec-mismatch-2.rs @@ -11,6 +11,6 @@ fn main() { match () { [()] => { } -//~^ ERROR mismatched types: expected `()`, found `&[]` (expected (), found &-ptr) +//~^ ERROR mismatched types: expected `()`, found `&[_]` (expected (), found &-ptr) } } diff --git a/src/test/compile-fail/repeat_count.rs b/src/test/compile-fail/repeat_count.rs index 8a28819a736..6a1603fbfcb 100644 --- a/src/test/compile-fail/repeat_count.rs +++ b/src/test/compile-fail/repeat_count.rs @@ -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 `` + //~^ 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]; diff --git a/src/test/compile-fail/slightly-nice-generic-literal-messages.rs b/src/test/compile-fail/slightly-nice-generic-literal-messages.rs index aebe78b18e0..02ebbb134f0 100644 --- a/src/test/compile-fail/slightly-nice-generic-literal-messages.rs +++ b/src/test/compile-fail/slightly-nice-generic-literal-messages.rs @@ -13,7 +13,7 @@ struct Foo(T); fn main() { match Foo(1.1) { 1 => {} - //~^ ERROR expected `Foo<,>`, found `` + //~^ ERROR expected `Foo<_#0f, _#2>`, found `_#0i` } } diff --git a/src/test/compile-fail/suppressed-error.rs b/src/test/compile-fail/suppressed-error.rs index 54d6fa5bdd3..bd9f2c36328 100644 --- a/src/test/compile-fail/suppressed-error.rs +++ b/src/test/compile-fail/suppressed-error.rs @@ -10,6 +10,6 @@ fn main() { let (x, y) = (); -//~^ ERROR types: expected `()`, found `(,)` (expected (), found tuple) +//~^ ERROR expected `()`, found `(_#3, _#4)` (expected (), found tuple) return x; } diff --git a/src/test/compile-fail/tuple-arity-mismatch.rs b/src/test/compile-fail/tuple-arity-mismatch.rs index 1500a3cbe52..d0c2faed4b2 100644 --- a/src/test/compile-fail/tuple-arity-mismatch.rs +++ b/src/test/compile-fail/tuple-arity-mismatch.rs @@ -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,)` } diff --git a/src/test/compile-fail/tuple-index-out-of-bounds.rs b/src/test/compile-fail/tuple-index-out-of-bounds.rs index d16f950a5d4..f9bf2746794 100644 --- a/src/test/compile-fail/tuple-index-out-of-bounds.rs +++ b/src/test/compile-fail/tuple-index-out-of-bounds.rs @@ -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)` } diff --git a/src/test/compile-fail/typeck_type_placeholder_mismatch.rs b/src/test/compile-fail/typeck_type_placeholder_mismatch.rs index 29d32b10539..aa7b551afc5 100644 --- a/src/test/compile-fail/typeck_type_placeholder_mismatch.rs +++ b/src/test/compile-fail/typeck_type_placeholder_mismatch.rs @@ -19,11 +19,11 @@ pub fn main() { fn test1() { let x: Foo<_> = Bar::; - //~^ ERROR mismatched types: expected `Foo<>`, found `Bar` + //~^ ERROR mismatched types: expected `Foo<_>`, found `Bar` let y: Foo = x; } fn test2() { let x: Foo<_> = Bar::; - //~^ ERROR mismatched types: expected `Foo<>`, found `Bar` + //~^ ERROR mismatched types: expected `Foo<_>`, found `Bar` }