diff --git a/src/test/ui/type/type-check/point-at-inference-3.fixed b/src/test/ui/type/type-check/point-at-inference-3.fixed new file mode 100644 index 000000000000..ff299940a576 --- /dev/null +++ b/src/test/ui/type/type-check/point-at-inference-3.fixed @@ -0,0 +1,12 @@ +// run-rustfix +fn main() { + let mut v = Vec::new(); + v.push(0i32); + //~^ NOTE this is of type `i32`, which makes `v` to be inferred as `Vec` + v.push(0); + v.push(1i32); //~ ERROR mismatched types + //~^ NOTE expected `i32`, found `u32` + //~| NOTE arguments to this function are incorrect + //~| NOTE associated function defined here + //~| HELP change the type of the numeric literal from `u32` to `i32` +} diff --git a/src/test/ui/type/type-check/point-at-inference-3.rs b/src/test/ui/type/type-check/point-at-inference-3.rs index 893306d41054..812a39e4aaf3 100644 --- a/src/test/ui/type/type-check/point-at-inference-3.rs +++ b/src/test/ui/type/type-check/point-at-inference-3.rs @@ -1,10 +1,12 @@ +// run-rustfix fn main() { - let v = Vec::new(); + let mut v = Vec::new(); + v.push(0i32); + //~^ NOTE this is of type `i32`, which makes `v` to be inferred as `Vec` v.push(0); - //~^ NOTE this is of type `{integer}`, which makes `v` to be inferred as `Vec<{integer}>` - v.push(0); - v.push(""); //~ ERROR mismatched types - //~^ NOTE expected integer, found `&str` + v.push(1u32); //~ ERROR mismatched types + //~^ NOTE expected `i32`, found `u32` //~| NOTE arguments to this function are incorrect //~| NOTE associated function defined here + //~| HELP change the type of the numeric literal from `u32` to `i32` } diff --git a/src/test/ui/type/type-check/point-at-inference-3.stderr b/src/test/ui/type/type-check/point-at-inference-3.stderr index 01264edf6b6e..4e7779694669 100644 --- a/src/test/ui/type/type-check/point-at-inference-3.stderr +++ b/src/test/ui/type/type-check/point-at-inference-3.stderr @@ -1,16 +1,20 @@ error[E0308]: mismatched types - --> $DIR/point-at-inference-3.rs:6:12 + --> $DIR/point-at-inference-3.rs:7:12 | -LL | v.push(0); - | - this is of type `{integer}`, which makes `v` to be inferred as `Vec<{integer}>` +LL | v.push(0i32); + | ---- this is of type `i32`, which makes `v` to be inferred as `Vec` ... -LL | v.push(""); - | ---- ^^ expected integer, found `&str` +LL | v.push(1u32); + | ---- ^^^^ expected `i32`, found `u32` | | | arguments to this function are incorrect | note: associated function defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL +help: change the type of the numeric literal from `u32` to `i32` + | +LL | v.push(1i32); + | ~~~ error: aborting due to previous error