Skip to content

Commit

Permalink
Fix testsuite errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mdinger committed Jan 12, 2015
1 parent 5616b92 commit 7b82a93
Show file tree
Hide file tree
Showing 95 changed files with 980 additions and 221 deletions.
14 changes: 12 additions & 2 deletions src/test/compile-fail/array-not-vector.rs
Expand Up @@ -9,8 +9,18 @@
// except according to those terms.

fn main() {
let _x: isize = [1is, 2, 3]; //~ ERROR expected isize, found array of 3 elements
let _x: isize = [1is, 2, 3];
//~^ ERROR mismatched types
//~| expected `isize`
//~| found `[isize; 3]`
//~| expected isize
//~| found array of 3 elements

let x: &[isize] = &[1, 2, 3];
let _y: &isize = x; //~ ERROR expected isize, found slice
let _y: &isize = x;
//~^ ERROR mismatched types
//~| expected `&isize`
//~| found `&[isize]`
//~| expected isize
//~| found slice
}
17 changes: 14 additions & 3 deletions src/test/compile-fail/associated-types-eq-3.rs
Expand Up @@ -30,7 +30,12 @@ fn foo1<I: Foo<A=Bar>>(x: I) {
}

fn foo2<I: Foo>(x: I) {
let _: Bar = x.boo(); //~ERROR mismatched types
let _: Bar = x.boo();
//~^ ERROR mismatched types
//~| expected `Bar`
//~| found `<I as Foo>::A`
//~| expected struct `Bar`
//~| found associated type
}


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

pub fn main() {
let a = 42is;
foo1(a); //~ERROR expected usize, found struct Bar
baz(&a); //~ERROR expected usize, found struct Bar
foo1(a);
//~^ ERROR type mismatch resolving
//~| expected usize
//~| found struct `Bar`
baz(&a);
//~^ ERROR type mismatch resolving
//~| expected usize
//~| found struct `Bar`
}
10 changes: 8 additions & 2 deletions src/test/compile-fail/associated-types-path-2.rs
Expand Up @@ -25,7 +25,9 @@ pub fn f2<T: Foo>(a: T) -> T::A {

pub fn f1_int_int() {
f1(2is, 4is);
//~^ ERROR expected usize, found isize
//~^ ERROR type mismatch resolving
//~| expected usize
//~| found isize
}

pub fn f1_int_uint() {
Expand All @@ -46,7 +48,11 @@ pub fn f1_uint_int() {

pub fn f2_int() {
let _: isize = f2(2is);
//~^ ERROR expected `isize`, found `usize`
//~^ ERROR mismatched types
//~| expected `isize`
//~| found `usize`
//~| expected isize
//~| found usize
}

pub fn main() { }
7 changes: 5 additions & 2 deletions src/test/compile-fail/bad-const-type.rs
Expand Up @@ -8,7 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:expected `collections::string::String`, found `isize`

static i: String = 10is;
//~^ ERROR mismatched types
//~| expected `collections::string::String`
//~| found `isize`
//~| expected struct `collections::string::String`
//~| found isize
fn main() { println!("{}", i); }
8 changes: 5 additions & 3 deletions src/test/compile-fail/block-must-not-have-result-do.rs
Expand Up @@ -8,10 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:mismatched types: expected `()`, found `bool`

fn main() {
loop {
true
true //~ ERROR mismatched types
//~| expected ()
//~| found bool
//~| expected ()
//~| found bool
}
}
8 changes: 5 additions & 3 deletions src/test/compile-fail/block-must-not-have-result-res.rs
Expand Up @@ -8,13 +8,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:mismatched types: expected `()`, found `bool`

struct r;

impl Drop for r {
fn drop(&mut self) {
true
true //~ ERROR mismatched types
//~| expected ()
//~| found bool
//~| expected ()
//~| found bool
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/test/compile-fail/block-must-not-have-result-while.rs
Expand Up @@ -8,10 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:mismatched types: expected `()`, found `bool`

fn main() {
while true {
true
true //~ ERROR mismatched types
//~| expected `()`
//~| found `bool`
//~| expected ()
//~| found bool
}
}
7 changes: 6 additions & 1 deletion src/test/compile-fail/coercion-slice.rs
Expand Up @@ -11,5 +11,10 @@
// Tests that we forbid coercion from `[T; n]` to `&[T]`

fn main() {
let _: &[isize] = [0is]; //~ERROR: mismatched types: expected `&[isize]`, found `[isize; 1]`
let _: &[isize] = [0is];
//~^ ERROR mismatched types
//~| expected `&[isize]`
//~| found `[isize; 1]`
//~| expected &-ptr
//~| found array of 1 elements
}
12 changes: 10 additions & 2 deletions src/test/compile-fail/const-cast-different-types.rs
Expand Up @@ -10,9 +10,17 @@

static a: &'static str = "foo";
static b: *const u8 = a as *const u8;
//~^ ERROR mismatched types: expected `*const u8`, found `&'static str`
//~^ ERROR mismatched types
//~| expected *const u8
//~| found &'static str
//~| expected u8
//~| found str
static c: *const u8 = &a as *const u8;
//~^ ERROR mismatched types: expected `*const u8`, found `&&'static str`
//~^ ERROR mismatched types
//~| expected *const u8
//~| found &&'static str
//~| expected u8
//~| found &-ptr

fn main() {
}
6 changes: 5 additions & 1 deletion src/test/compile-fail/cross-borrow-trait.rs
Expand Up @@ -19,6 +19,10 @@ impl Trait for Foo {}

pub fn main() {
let x: Box<Trait> = box Foo;
let _y: &Trait = x; //~ ERROR mismatched types: expected `&Trait`, found `Box<Trait>`
let _y: &Trait = x; //~ ERROR mismatched types
//~| expected `&Trait`
//~| found `Box<Trait>`
//~| expected &-ptr
//~| found box
}

21 changes: 18 additions & 3 deletions src/test/compile-fail/destructure-trait-ref.rs
Expand Up @@ -37,7 +37,22 @@ fn main() {
let box x = box 1is as Box<T>; //~ ERROR type `Box<T>` cannot be dereferenced

// n > m
let &&x = &1is as &T; //~ ERROR found &-ptr
let &&&x = &(&1is as &T); //~ ERROR found &-ptr
let box box x = box 1is as Box<T>; //~ ERROR found box
let &&x = &1is as &T;
//~^ ERROR mismatched types
//~| expected `T`
//~| found `&_`
//~| expected trait T
//~| found &-ptr
let &&&x = &(&1is as &T);
//~^ ERROR mismatched types
//~| expected `T`
//~| found `&_`
//~| expected trait T
//~| found &-ptr
let box box x = box 1is as Box<T>;
//~^ ERROR mismatched types
//~| expected `T`
//~| found `Box<_>`
//~| expected trait T
//~| found box
}
9 changes: 7 additions & 2 deletions src/test/compile-fail/dst-bad-assign.rs
Expand Up @@ -44,6 +44,11 @@ pub fn main() {
// Assignment.
let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} };
let z: Box<ToBar> = box Bar1 {f: 36};
f5.ptr = Bar1 {f: 36}; //~ ERROR mismatched types: expected `ToBar`, found `Bar1`
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `ToBar`
f5.ptr = Bar1 {f: 36};
//~^ ERROR mismatched types
//~| expected `ToBar`
//~| found `Bar1`
//~| expected trait ToBar
//~| found struct `Bar1`
//~| ERROR the trait `core::marker::Sized` is not implemented for the type `ToBar`
}
6 changes: 5 additions & 1 deletion src/test/compile-fail/dst-bad-coerce1.rs
Expand Up @@ -22,7 +22,11 @@ pub fn main() {
let f1 = Fat { ptr: [1, 2, 3] };
let f2: &Fat<[isize; 3]> = &f1;
let f3: &Fat<[usize]> = f2;
//~^ ERROR mismatched types: expected `&Fat<[usize]>`, found `&Fat<[isize; 3]>`
//~^ ERROR mismatched types
//~| expected `&Fat<[usize]>`
//~| found `&Fat<[isize; 3]>`
//~| expected usize
//~| found isize

// With a trait.
let f1 = Fat { ptr: Foo };
Expand Down
6 changes: 5 additions & 1 deletion src/test/compile-fail/dst-bad-coerce4.rs
Expand Up @@ -18,5 +18,9 @@ pub fn main() {
// With a vec of isizes.
let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] };
let f2: &Fat<[isize; 3]> = f1;
//~^ ERROR mismatched types: expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>`
//~^ ERROR mismatched types
//~| expected `&Fat<[isize; 3]>`
//~| found `&Fat<[isize]>`
//~| expected array of 3 elements
//~| found slice
}
10 changes: 8 additions & 2 deletions src/test/compile-fail/explicit-self-lifetime-mismatch.rs
Expand Up @@ -15,8 +15,14 @@ struct Foo<'a,'b> {

impl<'a,'b> Foo<'a,'b> {
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<'a, 'b>`
//~| found `Foo<'b, 'a>`
//~| lifetime mismatch
//~| ERROR mismatched types
//~| expected `Foo<'a, 'b>`
//~| found `Foo<'b, 'a>`
//~| lifetime mismatch
}

fn main() {}
Expand Down
12 changes: 10 additions & 2 deletions src/test/compile-fail/fn-item-type.rs
Expand Up @@ -18,8 +18,16 @@ fn eq<T>(x: T, y: T) { }

fn main() {
let f = if true { foo } else { bar };
//~^ ERROR expected fn item, found a different fn item
//~^ ERROR if and else have incompatible types
//~| expected `fn(isize) -> isize {foo}`
//~| found `fn(isize) -> isize {bar}`
//~| expected fn item,
//~| found a different fn item

eq(foo, bar);
//~^ ERROR expected fn item, found a different fn item
//~^ ERROR mismatched types
//~| expected `fn(isize) -> isize {foo}`
//~| found `fn(isize) -> isize {bar}`
//~| expected fn item
//~| found a different fn item
}
21 changes: 17 additions & 4 deletions src/test/compile-fail/fn-trait-formatting.rs
Expand Up @@ -14,12 +14,25 @@
fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}

fn main() {
let _: () = (box |:_: isize| {}) as Box<FnOnce(isize)>; //~ ERROR object-safe
//~^ ERROR Box<core::ops::FnOnce(isize)>
let _: () = (box |:_: isize| {}) as Box<FnOnce(isize)>;
//~^ ERROR object-safe
//~| ERROR mismatched types
//~| expected `()`
//~| found `Box<core::ops::FnOnce(isize)>`
//~| expected ()
//~| found box
let _: () = (box |&:_: isize, isize| {}) as Box<Fn(isize, isize)>;
//~^ ERROR Box<core::ops::Fn(isize, isize)>
//~^ ERROR mismatched types
//~| expected `()`
//~| found `Box<core::ops::Fn(isize, isize)>`
//~| expected ()
//~| found box
let _: () = (box |&mut:| -> isize unimplemented!()) as Box<FnMut() -> isize>;
//~^ ERROR Box<core::ops::FnMut() -> isize>
//~^ ERROR mismatched types
//~| expected `()`
//~| found `Box<core::ops::FnMut() -> isize>`
//~| expected ()
//~| found box

needs_fn(1is); //~ ERROR `core::ops::Fn(isize) -> isize`
}
6 changes: 5 additions & 1 deletion src/test/compile-fail/fully-qualified-type-name1.rs
Expand Up @@ -13,5 +13,9 @@
fn main() {
let x: Option<usize>;
x = 5;
//~^ ERROR mismatched types: expected `core::option::Option<usize>`
//~^ ERROR mismatched types
//~| expected `core::option::Option<usize>`
//~| found `_`
//~| expected enum `core::option::Option`
//~| found integral variable
}
6 changes: 5 additions & 1 deletion src/test/compile-fail/fully-qualified-type-name2.rs
Expand Up @@ -20,7 +20,11 @@ mod y {

fn bar(x: x::foo) -> y::foo {
return x;
//~^ ERROR mismatched types: expected `y::foo`, found `x::foo`
//~^ ERROR mismatched types
//~| expected `y::foo`
//~| found `x::foo`
//~| expected enum `y::foo`
//~| found enum `x::foo`
}

fn main() {
Expand Down
6 changes: 5 additions & 1 deletion src/test/compile-fail/fully-qualified-type-name4.rs
Expand Up @@ -14,7 +14,11 @@ use std::option::Option;

fn bar(x: usize) -> Option<usize> {
return x;
//~^ ERROR mismatched types: expected `core::option::Option<usize>`
//~^ ERROR mismatched types
//~| expected `core::option::Option<usize>`
//~| found `usize`
//~| expected enum `core::option::Option`
//~| found usize
}

fn main() {
Expand Down

7 comments on commit 7b82a93

@bors
Copy link
Contributor

@bors bors commented on 7b82a93 Jan 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from nick29581
at mdinger@7b82a93

@bors
Copy link
Contributor

@bors bors commented on 7b82a93 Jan 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging mdinger/rust/align_error = 7b82a93 into auto

@bors
Copy link
Contributor

@bors bors commented on 7b82a93 Jan 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "b21a6da340fd958de370d2b83c0f17fd8fa51f89"}

@bors
Copy link
Contributor

@bors bors commented on 7b82a93 Jan 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mdinger/rust/align_error = 7b82a93 merged ok, testing candidate = b21a6da

@bors
Copy link
Contributor

@bors bors commented on 7b82a93 Jan 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = b21a6da

@bors
Copy link
Contributor

@bors bors commented on 7b82a93 Jan 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = b21a6da

Please sign in to comment.