From 8d6786cd6c95b80dbca281953e4ea6db9e033af5 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 27 Jan 2015 09:39:53 -0500 Subject: [PATCH] Adjust error messages due to having more type information available. --- .../associated-type-projection-from-supertrait.rs | 4 ++-- src/test/compile-fail/associated-types-path-2.rs | 4 +--- src/test/compile-fail/issue-18400.rs | 5 ++++- src/test/compile-fail/issue-21160.rs | 2 +- src/test/compile-fail/shift-various-bad-types.rs | 2 +- src/test/compile-fail/slice-mut.rs | 3 ++- src/test/compile-fail/traits-multidispatch-bad.rs | 2 +- src/test/run-pass/issue-21245.rs | 2 +- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/test/compile-fail/associated-type-projection-from-supertrait.rs b/src/test/compile-fail/associated-type-projection-from-supertrait.rs index abaf79fb4cb..b388b6a28e3 100644 --- a/src/test/compile-fail/associated-type-projection-from-supertrait.rs +++ b/src/test/compile-fail/associated-type-projection-from-supertrait.rs @@ -40,8 +40,8 @@ impl Car for ModelU { } fn dent(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); } /////////////////////////////////////////////////////////////////////////// diff --git a/src/test/compile-fail/associated-types-path-2.rs b/src/test/compile-fail/associated-types-path-2.rs index 5cb9aca8beb..55ba65d6102 100644 --- a/src/test/compile-fail/associated-types-path-2.rs +++ b/src/test/compile-fail/associated-types-path-2.rs @@ -25,7 +25,7 @@ pub fn f2(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() { } diff --git a/src/test/compile-fail/issue-18400.rs b/src/test/compile-fail/issue-18400.rs index a6662e78f3e..f3b2b3d5667 100644 --- a/src/test/compile-fail/issue-18400.rs +++ b/src/test/compile-fail/issue-18400.rs @@ -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 } diff --git a/src/test/compile-fail/issue-21160.rs b/src/test/compile-fail/issue-21160.rs index 0ee38166935..45b7fbbd0b4 100644 --- a/src/test/compile-fail/issue-21160.rs +++ b/src/test/compile-fail/issue-21160.rs @@ -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() {} diff --git a/src/test/compile-fail/shift-various-bad-types.rs b/src/test/compile-fail/shift-various-bad-types.rs index 66aef0ec3a1..901ae1d5e2a 100644 --- a/src/test/compile-fail/shift-various-bad-types.rs +++ b/src/test/compile-fail/shift-various-bad-types.rs @@ -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 diff --git a/src/test/compile-fail/slice-mut.rs b/src/test/compile-fail/slice-mut.rs index a1747f3b6bd..e6acc325451 100644 --- a/src/test/compile-fail/slice-mut.rs +++ b/src/test/compile-fail/slice-mut.rs @@ -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 } diff --git a/src/test/compile-fail/traits-multidispatch-bad.rs b/src/test/compile-fail/traits-multidispatch-bad.rs index e9a4005b4b4..2e29a61846e 100644 --- a/src/test/compile-fail/traits-multidispatch-bad.rs +++ b/src/test/compile-fail/traits-multidispatch-bad.rs @@ -26,7 +26,7 @@ where T : Convert } fn a() { - test(22is, 44is); //~ ERROR not implemented + test(22is, 44is); //~ ERROR mismatched types } fn main() {} diff --git a/src/test/run-pass/issue-21245.rs b/src/test/run-pass/issue-21245.rs index 1ed939cbaca..9205b247e13 100644 --- a/src/test/run-pass/issue-21245.rs +++ b/src/test/run-pass/issue-21245.rs @@ -45,7 +45,7 @@ fn desugared_for_loop_bad(v: Vec) { } fn desugared_for_loop_good(v: Vec) { - 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) {