Skip to content

Updated the help message to reduce the error iterations #79403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions src/test/ui/integer-literal-suffix-inference.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ help: you can convert an `i16` to an `i8` and panic if the converted value doesn
|
LL | id_i8(a16.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:41:11
Expand All @@ -19,6 +21,8 @@ help: you can convert an `i32` to an `i8` and panic if the converted value doesn
|
LL | id_i8(a32.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:44:11
Expand All @@ -30,6 +34,8 @@ help: you can convert an `i64` to an `i8` and panic if the converted value doesn
|
LL | id_i8(a64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:47:11
Expand All @@ -41,6 +47,8 @@ help: you can convert an `isize` to an `i8` and panic if the converted value doe
|
LL | id_i8(asize.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:51:12
Expand All @@ -61,6 +69,8 @@ help: you can convert an `i32` to an `i16` and panic if the converted value does
|
LL | id_i16(a32.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:58:12
Expand All @@ -72,6 +82,8 @@ help: you can convert an `i64` to an `i16` and panic if the converted value does
|
LL | id_i16(a64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:61:12
Expand All @@ -83,6 +95,8 @@ help: you can convert an `isize` to an `i16` and panic if the converted value do
|
LL | id_i16(asize.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:65:12
Expand Down Expand Up @@ -112,6 +126,8 @@ help: you can convert an `i64` to an `i32` and panic if the converted value does
|
LL | id_i32(a64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:75:12
Expand All @@ -123,6 +139,8 @@ help: you can convert an `isize` to an `i32` and panic if the converted value do
|
LL | id_i32(asize.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:79:12
Expand Down Expand Up @@ -161,6 +179,8 @@ help: you can convert an `isize` to an `i64` and panic if the converted value do
|
LL | id_i64(asize.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:93:14
Expand Down Expand Up @@ -190,6 +210,8 @@ help: you can convert an `i32` to an `isize` and panic if the converted value do
|
LL | id_isize(a32.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:102:14
Expand All @@ -201,6 +223,8 @@ help: you can convert an `i64` to an `isize` and panic if the converted value do
|
LL | id_isize(a64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:108:11
Expand All @@ -212,6 +236,8 @@ help: you can convert an `i16` to an `i8` and panic if the converted value doesn
|
LL | id_i8(c16.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:111:11
Expand All @@ -223,6 +249,8 @@ help: you can convert an `i32` to an `i8` and panic if the converted value doesn
|
LL | id_i8(c32.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:114:11
Expand All @@ -234,6 +262,8 @@ help: you can convert an `i64` to an `i8` and panic if the converted value doesn
|
LL | id_i8(c64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:118:12
Expand All @@ -254,6 +284,8 @@ help: you can convert an `i32` to an `i16` and panic if the converted value does
|
LL | id_i16(c32.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:125:12
Expand All @@ -265,6 +297,8 @@ help: you can convert an `i64` to an `i16` and panic if the converted value does
|
LL | id_i16(c64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:129:12
Expand Down Expand Up @@ -294,6 +328,8 @@ help: you can convert an `i64` to an `i32` and panic if the converted value does
|
LL | id_i32(c64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:140:12
Expand Down Expand Up @@ -332,6 +368,8 @@ help: you can convert a `u16` to a `u8` and panic if the converted value doesn't
|
LL | id_u8(b16.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:155:11
Expand All @@ -343,6 +381,8 @@ help: you can convert a `u32` to a `u8` and panic if the converted value doesn't
|
LL | id_u8(b32.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:158:11
Expand All @@ -354,6 +394,8 @@ help: you can convert a `u64` to a `u8` and panic if the converted value doesn't
|
LL | id_u8(b64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:161:11
Expand All @@ -365,6 +407,8 @@ help: you can convert a `usize` to a `u8` and panic if the converted value doesn
|
LL | id_u8(bsize.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:165:12
Expand All @@ -385,6 +429,8 @@ help: you can convert a `u32` to a `u16` and panic if the converted value doesn'
|
LL | id_u16(b32.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:172:12
Expand All @@ -396,6 +442,8 @@ help: you can convert a `u64` to a `u16` and panic if the converted value doesn'
|
LL | id_u16(b64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:175:12
Expand Down Expand Up @@ -436,6 +484,8 @@ help: you can convert a `u64` to a `u32` and panic if the converted value doesn'
|
LL | id_u32(b64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:189:12
Expand All @@ -447,6 +497,8 @@ help: you can convert a `usize` to a `u32` and panic if the converted value does
|
LL | id_u32(bsize.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:193:12
Expand Down Expand Up @@ -485,6 +537,8 @@ help: you can convert a `usize` to a `u64` and panic if the converted value does
|
LL | id_u64(bsize.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:207:14
Expand Down Expand Up @@ -514,6 +568,8 @@ help: you can convert a `u32` to a `usize` and panic if the converted value does
|
LL | id_usize(b32.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:216:14
Expand All @@ -525,6 +581,8 @@ help: you can convert a `u64` to a `usize` and panic if the converted value does
|
LL | id_usize(b64.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error: aborting due to 52 previous errors

Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/issues/issue-13359.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ help: you can convert an `isize` to an `i16` and panic if the converted value do
|
LL | foo((1*(1 as isize)).try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/issue-13359.rs:10:9
Expand All @@ -19,6 +21,8 @@ help: you can convert a `usize` to a `u32` and panic if the converted value does
|
LL | bar((1*(1 as usize)).try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error: aborting due to 2 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ help: you can convert an `isize` to a `usize` and panic if the converted value d
|
LL | let y: usize = x.foo().try_into().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error: aborting due to 2 previous errors

Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/numeric/const-scope.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ help: you can convert an `i32` to an `i8` and panic if the converted value doesn
|
LL | let d: i8 = c.try_into().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error: aborting due to 6 previous errors

Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/numeric/numeric-cast-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ help: you can convert an `i32` to a `u16` and panic if the converted value doesn
|
LL | let x: u16 = foo().try_into().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you have import `std::convert::TryInto;` before using `try_into()`

error[E0308]: mismatched types
--> $DIR/numeric-cast-2.rs:7:18
Expand Down
Loading