Adjust error messages due to having more type information available.
This commit is contained in:
parent
45e5627ef9
commit
8d6786cd6c
8 changed files with 13 additions and 11 deletions
|
@ -40,8 +40,8 @@ impl Car for ModelU { }
|
||||||
|
|
||||||
fn dent<C:Car>(c: C, color: C::Color) { c.chip_paint(color) }
|
fn dent<C:Car>(c: C, color: C::Color) { c.chip_paint(color) }
|
||||||
fn a() { dent(ModelT, Black); }
|
fn a() { dent(ModelT, Black); }
|
||||||
fn b() { dent(ModelT, Blue); } //~ ERROR type mismatch
|
fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types
|
||||||
fn c() { dent(ModelU, Black); } //~ ERROR type mismatch
|
fn c() { dent(ModelU, Black); } //~ ERROR mismatched types
|
||||||
fn d() { dent(ModelU, Blue); }
|
fn d() { dent(ModelU, Blue); }
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub fn f2<T: Foo>(a: T) -> T::A {
|
||||||
|
|
||||||
pub fn f1_int_int() {
|
pub fn f1_int_int() {
|
||||||
f1(2is, 4is);
|
f1(2is, 4is);
|
||||||
//~^ ERROR type mismatch resolving
|
//~^ ERROR mismatched types
|
||||||
//~| expected usize
|
//~| expected usize
|
||||||
//~| found isize
|
//~| found isize
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,6 @@ pub fn f2_int() {
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `isize`
|
//~| expected `isize`
|
||||||
//~| found `usize`
|
//~| found `usize`
|
||||||
//~| expected isize
|
|
||||||
//~| found usize
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() { }
|
pub fn main() { }
|
||||||
|
|
|
@ -32,5 +32,8 @@ fn main() {
|
||||||
let bits: &[_] = &[0, 1];
|
let bits: &[_] = &[0, 1];
|
||||||
|
|
||||||
0.contains(bits);
|
0.contains(bits);
|
||||||
//~^ ERROR the trait `Set<_>` is not implemented for the type `_`
|
//~^ ERROR overflow
|
||||||
|
//~| ERROR overflow
|
||||||
|
//~| ERROR overflow
|
||||||
|
//~| ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,6 @@ impl Bar {
|
||||||
|
|
||||||
#[derive(Hash)]
|
#[derive(Hash)]
|
||||||
struct Foo(Bar);
|
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() {}
|
fn main() {}
|
||||||
|
|
|
@ -29,7 +29,7 @@ fn foo(p: &Panolpy) {
|
||||||
// known to be an integer, but meh.
|
// known to be an integer, but meh.
|
||||||
let x;
|
let x;
|
||||||
22 >> 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;
|
22 >> 1;
|
||||||
// Integer literal types are OK
|
// Integer literal types are OK
|
||||||
|
|
|
@ -13,9 +13,10 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: &[isize] = &[1, 2, 3, 4, 5];
|
let x: &[isize] = &[1, 2, 3, 4, 5];
|
||||||
// Immutable slices are not mutable.
|
// Immutable slices are not mutable.
|
||||||
|
|
||||||
let y: &mut[_] = &x[2..4];
|
let y: &mut[_] = &x[2..4];
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected `&mut [_]`
|
//~| expected `&mut [_]`
|
||||||
//~| found `&_`
|
//~| found `&[isize]`
|
||||||
//~| values differ in mutability
|
//~| values differ in mutability
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ where T : Convert<U>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
test(22is, 44is); //~ ERROR not implemented
|
test(22is, 44is); //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -45,7 +45,7 @@ fn desugared_for_loop_bad<T>(v: Vec<T>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn desugared_for_loop_good<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 => {
|
mut iter => {
|
||||||
loop {
|
loop {
|
||||||
match ::std::iter::Iterator::next(&mut iter) {
|
match ::std::iter::Iterator::next(&mut iter) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue