Adjust error messages due to having more type information available.

This commit is contained in:
Niko Matsakis 2015-01-27 09:39:53 -05:00
parent 45e5627ef9
commit 8d6786cd6c
8 changed files with 13 additions and 11 deletions

View File

@ -40,8 +40,8 @@ impl Car for ModelU { }
fn dent<C:Car>(c: C, color: C::Color) { c.chip_paint(color) }
fn a() { dent(ModelT, Black); }
fn b() { dent(ModelT, Blue); } //~ ERROR type mismatch
fn c() { dent(ModelU, Black); } //~ ERROR type mismatch
fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types
fn c() { dent(ModelU, Black); } //~ ERROR mismatched types
fn d() { dent(ModelU, Blue); }
///////////////////////////////////////////////////////////////////////////

View File

@ -25,7 +25,7 @@ pub fn f2<T: Foo>(a: T) -> T::A {
pub fn f1_int_int() {
f1(2is, 4is);
//~^ ERROR type mismatch resolving
//~^ ERROR mismatched types
//~| expected usize
//~| found isize
}
@ -51,8 +51,6 @@ pub fn f2_int() {
//~^ ERROR mismatched types
//~| expected `isize`
//~| found `usize`
//~| expected isize
//~| found usize
}
pub fn main() { }

View File

@ -32,5 +32,8 @@ fn main() {
let bits: &[_] = &[0, 1];
0.contains(bits);
//~^ ERROR the trait `Set<_>` is not implemented for the type `_`
//~^ ERROR overflow
//~| ERROR overflow
//~| ERROR overflow
//~| ERROR mismatched types
}

View File

@ -16,6 +16,6 @@ impl Bar {
#[derive(Hash)]
struct Foo(Bar);
//~^ error: the trait `core::hash::Hash<__S>` is not implemented for the type `Bar`
//~^ error: the trait `core::hash::Hash<_>` is not implemented for the type `Bar`
fn main() {}

View File

@ -29,7 +29,7 @@ fn foo(p: &Panolpy) {
// known to be an integer, but meh.
let x;
22 >> x;
//~^ ERROR right-hand-side of a shift operation must have integral type
//~^ ERROR the type of this value must be known in this context
22 >> 1;
// Integer literal types are OK

View File

@ -13,9 +13,10 @@
fn main() {
let x: &[isize] = &[1, 2, 3, 4, 5];
// Immutable slices are not mutable.
let y: &mut[_] = &x[2..4];
//~^ ERROR mismatched types
//~| expected `&mut [_]`
//~| found `&_`
//~| found `&[isize]`
//~| values differ in mutability
}

View File

@ -26,7 +26,7 @@ where T : Convert<U>
}
fn a() {
test(22is, 44is); //~ ERROR not implemented
test(22is, 44is); //~ ERROR mismatched types
}
fn main() {}

View File

@ -45,7 +45,7 @@ fn desugared_for_loop_bad<T>(v: Vec<T>) {
}
fn desugared_for_loop_good<T>(v: Vec<T>) {
match v.iter().into_iter() { // NB method call instead of UFCS
match v.iter().into_iter() {
mut iter => {
loop {
match ::std::iter::Iterator::next(&mut iter) {