File tree Expand file tree Collapse file tree 3 files changed +28
-10
lines changed
src/test/ui/type/type-check Expand file tree Collapse file tree 3 files changed +28
-10
lines changed Original file line number Diff line number Diff line change 1+ // run-rustfix
2+ fn main() {
3+ let mut v = Vec::new();
4+ v.push(0i32);
5+ //~^ NOTE this is of type `i32`, which makes `v` to be inferred as `Vec<i32>`
6+ v.push(0);
7+ v.push(1i32); //~ ERROR mismatched types
8+ //~^ NOTE expected `i32`, found `u32`
9+ //~| NOTE arguments to this function are incorrect
10+ //~| NOTE associated function defined here
11+ //~| HELP change the type of the numeric literal from `u32` to `i32`
12+ }
Original file line number Diff line number Diff line change 1+ // run-rustfix
12fn main ( ) {
2- let v = Vec :: new ( ) ;
3+ let mut v = Vec :: new ( ) ;
4+ v. push ( 0i32 ) ;
5+ //~^ NOTE this is of type `i32`, which makes `v` to be inferred as `Vec<i32>`
36 v. push ( 0 ) ;
4- //~^ NOTE this is of type `{integer}`, which makes `v` to be inferred as `Vec<{integer}>`
5- v. push ( 0 ) ;
6- v. push ( "" ) ; //~ ERROR mismatched types
7- //~^ NOTE expected integer, found `&str`
7+ v. push ( 1u32 ) ; //~ ERROR mismatched types
8+ //~^ NOTE expected `i32`, found `u32`
89 //~| NOTE arguments to this function are incorrect
910 //~| NOTE associated function defined here
11+ //~| HELP change the type of the numeric literal from `u32` to `i32`
1012}
Original file line number Diff line number Diff line change 11error[E0308]: mismatched types
2- --> $DIR/point-at-inference-3.rs:6 :12
2+ --> $DIR/point-at-inference-3.rs:7 :12
33 |
4- LL | v.push(0 );
5- | - this is of type `{integer} `, which makes `v` to be inferred as `Vec<{integer} >`
4+ LL | v.push(0i32 );
5+ | ---- this is of type `i32 `, which makes `v` to be inferred as `Vec<i32 >`
66...
7- LL | v.push("" );
8- | ---- ^^ expected integer , found `&str `
7+ LL | v.push(1u32 );
8+ | ---- ^^^^ expected `i32` , found `u32 `
99 | |
1010 | arguments to this function are incorrect
1111 |
1212note: associated function defined here
1313 --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
14+ help: change the type of the numeric literal from `u32` to `i32`
15+ |
16+ LL | v.push(1i32);
17+ | ~~~
1418
1519error: aborting due to previous error
1620
You can’t perform that action at this time.
0 commit comments