From 549f861f7d53811521cf929cf58fb6828a2a88d9 Mon Sep 17 00:00:00 2001 From: Camelid Date: Sun, 27 Sep 2020 13:36:48 -0700 Subject: [PATCH] Use correct article in help message for conversion or cast Before it always used `an`; now it uses the correct article for the type. --- compiler/rustc_middle/src/ty/sty.rs | 12 ++ compiler/rustc_typeck/src/check/demand.rs | 14 ++- .../associated-types-path-2.stderr | 2 +- src/test/ui/indexing-requires-a-uint.stderr | 2 +- .../integer-literal-suffix-inference.stderr | 40 +++---- src/test/ui/issues/issue-13359.stderr | 2 +- .../ui/mismatched_types/issue-26480.stderr | 2 +- src/test/ui/numeric/len.stderr | 2 +- src/test/ui/numeric/numeric-cast-2.stderr | 4 +- src/test/ui/numeric/numeric-cast-binop.stderr | 108 ++++++++--------- src/test/ui/numeric/numeric-cast.stderr | 112 +++++++++--------- src/test/ui/numeric/numeric-suffix.stderr | 12 +- src/test/ui/tail-typeck.stderr | 2 +- .../ui/tutorial-suffix-inference-test.stderr | 2 +- 14 files changed, 169 insertions(+), 147 deletions(-) diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 724ec101b23..9e60253106b 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -210,6 +210,18 @@ impl TyKind<'tcx> { _ => false, } } + + /// Get the article ("a" or "an") to use with this type. + /// + /// **Panics if `self` is [`TyKind::Error`].** + pub fn article(&self) -> &'static str { + match self { + Int(_) | Float(_) | Array(_, _) => "an", + Adt(def, _) if def.is_enum() => "an", + Error(_) => panic!(), + _ => "a", + } + } } // `TyKind` is used a lot. Make sure it doesn't unintentionally get bigger. diff --git a/compiler/rustc_typeck/src/check/demand.rs b/compiler/rustc_typeck/src/check/demand.rs index 247bbf637ce..cd7b692c588 100644 --- a/compiler/rustc_typeck/src/check/demand.rs +++ b/compiler/rustc_typeck/src/check/demand.rs @@ -752,8 +752,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - let msg = format!("you can convert an `{}` to `{}`", checked_ty, expected_ty); - let cast_msg = format!("you can cast an `{} to `{}`", checked_ty, expected_ty); + let msg = format!( + "you can convert {} `{}` to `{}`", + checked_ty.kind().article(), + checked_ty, + expected_ty + ); + let cast_msg = format!( + "you can cast {} `{} to `{}`", + checked_ty.kind().article(), + checked_ty, + expected_ty + ); let lit_msg = format!( "change the type of the numeric literal from `{}` to `{}`", checked_ty, expected_ty, diff --git a/src/test/ui/associated-types/associated-types-path-2.stderr b/src/test/ui/associated-types/associated-types-path-2.stderr index b2599410f05..dfe7e4da22d 100644 --- a/src/test/ui/associated-types/associated-types-path-2.stderr +++ b/src/test/ui/associated-types/associated-types-path-2.stderr @@ -47,7 +47,7 @@ LL | let _: i32 = f2(2i32); | | | expected due to this | -help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `i32` and panic if the converted value wouldn't fit | LL | let _: i32 = f2(2i32).try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/indexing-requires-a-uint.stderr b/src/test/ui/indexing-requires-a-uint.stderr index 31fcd4b1c2e..f290c0e632d 100644 --- a/src/test/ui/indexing-requires-a-uint.stderr +++ b/src/test/ui/indexing-requires-a-uint.stderr @@ -13,7 +13,7 @@ error[E0308]: mismatched types LL | bar::(i); // i should not be re-coerced back to an isize | ^ expected `isize`, found `usize` | -help: you can convert an `usize` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `isize` and panic if the converted value wouldn't fit | LL | bar::(i.try_into().unwrap()); // i should not be re-coerced back to an isize | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/integer-literal-suffix-inference.stderr b/src/test/ui/integer-literal-suffix-inference.stderr index b8502768e1d..8b541e6de06 100644 --- a/src/test/ui/integer-literal-suffix-inference.stderr +++ b/src/test/ui/integer-literal-suffix-inference.stderr @@ -328,7 +328,7 @@ error[E0308]: mismatched types LL | id_u8(b16); | ^^^ expected `u8`, found `u16` | -help: you can convert an `u16` to `u8` and panic if the converted value wouldn't fit +help: you can convert a `u16` to `u8` and panic if the converted value wouldn't fit | LL | id_u8(b16.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -339,7 +339,7 @@ error[E0308]: mismatched types LL | id_u8(b32); | ^^^ expected `u8`, found `u32` | -help: you can convert an `u32` to `u8` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `u8` and panic if the converted value wouldn't fit | LL | id_u8(b32.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -350,7 +350,7 @@ error[E0308]: mismatched types LL | id_u8(b64); | ^^^ expected `u8`, found `u64` | -help: you can convert an `u64` to `u8` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `u8` and panic if the converted value wouldn't fit | LL | id_u8(b64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -361,7 +361,7 @@ error[E0308]: mismatched types LL | id_u8(bsize); | ^^^^^ expected `u8`, found `usize` | -help: you can convert an `usize` to `u8` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u8` and panic if the converted value wouldn't fit | LL | id_u8(bsize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -373,7 +373,7 @@ LL | id_u16(b8); | ^^ | | | expected `u16`, found `u8` - | help: you can convert an `u8` to `u16`: `b8.into()` + | help: you can convert a `u8` to `u16`: `b8.into()` error[E0308]: mismatched types --> $DIR/integer-literal-suffix-inference.rs:169:12 @@ -381,7 +381,7 @@ error[E0308]: mismatched types LL | id_u16(b32); | ^^^ expected `u16`, found `u32` | -help: you can convert an `u32` to `u16` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `u16` and panic if the converted value wouldn't fit | LL | id_u16(b32.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -392,7 +392,7 @@ error[E0308]: mismatched types LL | id_u16(b64); | ^^^ expected `u16`, found `u64` | -help: you can convert an `u64` to `u16` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `u16` and panic if the converted value wouldn't fit | LL | id_u16(b64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -403,7 +403,7 @@ error[E0308]: mismatched types LL | id_u16(bsize); | ^^^^^ expected `u16`, found `usize` | -help: you can convert an `usize` to `u16` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u16` and panic if the converted value wouldn't fit | LL | id_u16(bsize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -415,7 +415,7 @@ LL | id_u32(b8); | ^^ | | | expected `u32`, found `u8` - | help: you can convert an `u8` to `u32`: `b8.into()` + | help: you can convert a `u8` to `u32`: `b8.into()` error[E0308]: mismatched types --> $DIR/integer-literal-suffix-inference.rs:182:12 @@ -424,7 +424,7 @@ LL | id_u32(b16); | ^^^ | | | expected `u32`, found `u16` - | help: you can convert an `u16` to `u32`: `b16.into()` + | help: you can convert a `u16` to `u32`: `b16.into()` error[E0308]: mismatched types --> $DIR/integer-literal-suffix-inference.rs:186:12 @@ -432,7 +432,7 @@ error[E0308]: mismatched types LL | id_u32(b64); | ^^^ expected `u32`, found `u64` | -help: you can convert an `u64` to `u32` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `u32` and panic if the converted value wouldn't fit | LL | id_u32(b64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -443,7 +443,7 @@ error[E0308]: mismatched types LL | id_u32(bsize); | ^^^^^ expected `u32`, found `usize` | -help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u32` and panic if the converted value wouldn't fit | LL | id_u32(bsize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -455,7 +455,7 @@ LL | id_u64(b8); | ^^ | | | expected `u64`, found `u8` - | help: you can convert an `u8` to `u64`: `b8.into()` + | help: you can convert a `u8` to `u64`: `b8.into()` error[E0308]: mismatched types --> $DIR/integer-literal-suffix-inference.rs:196:12 @@ -464,7 +464,7 @@ LL | id_u64(b16); | ^^^ | | | expected `u64`, found `u16` - | help: you can convert an `u16` to `u64`: `b16.into()` + | help: you can convert a `u16` to `u64`: `b16.into()` error[E0308]: mismatched types --> $DIR/integer-literal-suffix-inference.rs:199:12 @@ -473,7 +473,7 @@ LL | id_u64(b32); | ^^^ | | | expected `u64`, found `u32` - | help: you can convert an `u32` to `u64`: `b32.into()` + | help: you can convert a `u32` to `u64`: `b32.into()` error[E0308]: mismatched types --> $DIR/integer-literal-suffix-inference.rs:203:12 @@ -481,7 +481,7 @@ error[E0308]: mismatched types LL | id_u64(bsize); | ^^^^^ expected `u64`, found `usize` | -help: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u64` and panic if the converted value wouldn't fit | LL | id_u64(bsize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -493,7 +493,7 @@ LL | id_usize(b8); | ^^ | | | expected `usize`, found `u8` - | help: you can convert an `u8` to `usize`: `b8.into()` + | help: you can convert a `u8` to `usize`: `b8.into()` error[E0308]: mismatched types --> $DIR/integer-literal-suffix-inference.rs:210:14 @@ -502,7 +502,7 @@ LL | id_usize(b16); | ^^^ | | | expected `usize`, found `u16` - | help: you can convert an `u16` to `usize`: `b16.into()` + | help: you can convert a `u16` to `usize`: `b16.into()` error[E0308]: mismatched types --> $DIR/integer-literal-suffix-inference.rs:213:14 @@ -510,7 +510,7 @@ error[E0308]: mismatched types LL | id_usize(b32); | ^^^ expected `usize`, found `u32` | -help: you can convert an `u32` to `usize` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `usize` and panic if the converted value wouldn't fit | LL | id_usize(b32.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -521,7 +521,7 @@ error[E0308]: mismatched types LL | id_usize(b64); | ^^^ expected `usize`, found `u64` | -help: you can convert an `u64` to `usize` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `usize` and panic if the converted value wouldn't fit | LL | id_usize(b64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-13359.stderr b/src/test/ui/issues/issue-13359.stderr index 68258a8888a..e99554ec684 100644 --- a/src/test/ui/issues/issue-13359.stderr +++ b/src/test/ui/issues/issue-13359.stderr @@ -15,7 +15,7 @@ error[E0308]: mismatched types LL | bar(1*(1 as usize)); | ^^^^^^^^^^^^^^ expected `u32`, found `usize` | -help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u32` and panic if the converted value wouldn't fit | LL | bar((1*(1 as usize)).try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/mismatched_types/issue-26480.stderr b/src/test/ui/mismatched_types/issue-26480.stderr index d39b0a32077..35080716f28 100644 --- a/src/test/ui/mismatched_types/issue-26480.stderr +++ b/src/test/ui/mismatched_types/issue-26480.stderr @@ -8,7 +8,7 @@ LL | write!(hello); | -------------- in this macro invocation | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -help: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u64` and panic if the converted value wouldn't fit | LL | ($arr.len() * size_of($arr[0])).try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/numeric/len.stderr b/src/test/ui/numeric/len.stderr index dba6c723829..c0469f74d45 100644 --- a/src/test/ui/numeric/len.stderr +++ b/src/test/ui/numeric/len.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | test(array.len()); | ^^^^^^^^^^^ expected `u32`, found `usize` | -help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u32` and panic if the converted value wouldn't fit | LL | test(array.len().try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/numeric/numeric-cast-2.stderr b/src/test/ui/numeric/numeric-cast-2.stderr index 3f900062cbb..fc9124be2a7 100644 --- a/src/test/ui/numeric/numeric-cast-2.stderr +++ b/src/test/ui/numeric/numeric-cast-2.stderr @@ -18,7 +18,7 @@ LL | let y: i64 = x + x; | --- ^^^^^ | | | | | expected `i64`, found `u16` - | | help: you can convert an `u16` to `i64`: `(x + x).into()` + | | help: you can convert a `u16` to `i64`: `(x + x).into()` | expected due to this error[E0308]: mismatched types @@ -28,7 +28,7 @@ LL | let z: i32 = x + x; | --- ^^^^^ | | | | | expected `i32`, found `u16` - | | help: you can convert an `u16` to `i32`: `(x + x).into()` + | | help: you can convert a `u16` to `i32`: `(x + x).into()` | expected due to this error: aborting due to 3 previous errors diff --git a/src/test/ui/numeric/numeric-cast-binop.stderr b/src/test/ui/numeric/numeric-cast-binop.stderr index 47be817b789..6523f31edbf 100644 --- a/src/test/ui/numeric/numeric-cast-binop.stderr +++ b/src/test/ui/numeric/numeric-cast-binop.stderr @@ -60,7 +60,7 @@ LL | x_u16 > x_u8; | ^^^^ | | | expected `u16`, found `u8` - | help: you can convert an `u8` to `u16`: `x_u8.into()` + | help: you can convert a `u8` to `u16`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:36:17 @@ -113,7 +113,7 @@ LL | x_u32 > x_u8; | ^^^^ | | | expected `u32`, found `u8` - | help: you can convert an `u8` to `u32`: `x_u8.into()` + | help: you can convert a `u8` to `u32`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:47:17 @@ -122,7 +122,7 @@ LL | x_u32 > x_u16; | ^^^^^ | | | expected `u32`, found `u16` - | help: you can convert an `u16` to `u32`: `x_u16.into()` + | help: you can convert a `u16` to `u32`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:49:17 @@ -152,7 +152,7 @@ error[E0308]: mismatched types LL | x_u32 > x_usize; | ^^^^^^^ expected `u32`, found `usize` | -help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u32` and panic if the converted value wouldn't fit | LL | x_u32 > x_usize.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -164,7 +164,7 @@ LL | x_u64 > x_u8; | ^^^^ | | | expected `u64`, found `u8` - | help: you can convert an `u8` to `u64`: `x_u8.into()` + | help: you can convert a `u8` to `u64`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:58:17 @@ -173,7 +173,7 @@ LL | x_u64 > x_u16; | ^^^^^ | | | expected `u64`, found `u16` - | help: you can convert an `u16` to `u64`: `x_u16.into()` + | help: you can convert a `u16` to `u64`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:60:17 @@ -182,7 +182,7 @@ LL | x_u64 > x_u32; | ^^^^^ | | | expected `u64`, found `u32` - | help: you can convert an `u32` to `u64`: `x_u32.into()` + | help: you can convert a `u32` to `u64`: `x_u32.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:62:17 @@ -201,7 +201,7 @@ error[E0308]: mismatched types LL | x_u64 > x_usize; | ^^^^^^^ expected `u64`, found `usize` | -help: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u64` and panic if the converted value wouldn't fit | LL | x_u64 > x_usize.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -213,7 +213,7 @@ LL | x_u128 > x_u8; | ^^^^ | | | expected `u128`, found `u8` - | help: you can convert an `u8` to `u128`: `x_u8.into()` + | help: you can convert a `u8` to `u128`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:69:18 @@ -222,7 +222,7 @@ LL | x_u128 > x_u16; | ^^^^^ | | | expected `u128`, found `u16` - | help: you can convert an `u16` to `u128`: `x_u16.into()` + | help: you can convert a `u16` to `u128`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:71:18 @@ -231,7 +231,7 @@ LL | x_u128 > x_u32; | ^^^^^ | | | expected `u128`, found `u32` - | help: you can convert an `u32` to `u128`: `x_u32.into()` + | help: you can convert a `u32` to `u128`: `x_u32.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:73:18 @@ -240,7 +240,7 @@ LL | x_u128 > x_u64; | ^^^^^ | | | expected `u128`, found `u64` - | help: you can convert an `u64` to `u128`: `x_u64.into()` + | help: you can convert a `u64` to `u128`: `x_u64.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:75:18 @@ -248,7 +248,7 @@ error[E0308]: mismatched types LL | x_u128 > x_usize; | ^^^^^^^ expected `u128`, found `usize` | -help: you can convert an `usize` to `u128` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u128` and panic if the converted value wouldn't fit | LL | x_u128 > x_usize.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -260,7 +260,7 @@ LL | x_usize > x_u8; | ^^^^ | | | expected `usize`, found `u8` - | help: you can convert an `u8` to `usize`: `x_u8.into()` + | help: you can convert a `u8` to `usize`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:80:19 @@ -269,7 +269,7 @@ LL | x_usize > x_u16; | ^^^^^ | | | expected `usize`, found `u16` - | help: you can convert an `u16` to `usize`: `x_u16.into()` + | help: you can convert a `u16` to `usize`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:82:19 @@ -277,7 +277,7 @@ error[E0308]: mismatched types LL | x_usize > x_u32; | ^^^^^ expected `usize`, found `u32` | -help: you can convert an `u32` to `usize` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `usize` and panic if the converted value wouldn't fit | LL | x_usize > x_u32.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -288,7 +288,7 @@ error[E0308]: mismatched types LL | x_usize > x_u64; | ^^^^^ expected `usize`, found `u64` | -help: you can convert an `u64` to `usize` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `usize` and panic if the converted value wouldn't fit | LL | x_usize > x_u64.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -299,7 +299,7 @@ error[E0308]: mismatched types LL | x_usize > x_u128; | ^^^^^^ expected `usize`, found `u128` | -help: you can convert an `u128` to `usize` and panic if the converted value wouldn't fit +help: you can convert a `u128` to `usize` and panic if the converted value wouldn't fit | LL | x_usize > x_u128.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1012,7 +1012,7 @@ error[E0308]: mismatched types LL | x_i8 > x_u8; | ^^^^ expected `i8`, found `u8` | -help: you can convert an `u8` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `u8` to `i8` and panic if the converted value wouldn't fit | LL | x_i8 > x_u8.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1023,7 +1023,7 @@ error[E0308]: mismatched types LL | x_i8 > x_u16; | ^^^^^ expected `i8`, found `u16` | -help: you can convert an `u16` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `u16` to `i8` and panic if the converted value wouldn't fit | LL | x_i8 > x_u16.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1034,7 +1034,7 @@ error[E0308]: mismatched types LL | x_i8 > x_u32; | ^^^^^ expected `i8`, found `u32` | -help: you can convert an `u32` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `i8` and panic if the converted value wouldn't fit | LL | x_i8 > x_u32.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1045,7 +1045,7 @@ error[E0308]: mismatched types LL | x_i8 > x_u64; | ^^^^^ expected `i8`, found `u64` | -help: you can convert an `u64` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `i8` and panic if the converted value wouldn't fit | LL | x_i8 > x_u64.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1056,7 +1056,7 @@ error[E0308]: mismatched types LL | x_i8 > x_u128; | ^^^^^^ expected `i8`, found `u128` | -help: you can convert an `u128` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `u128` to `i8` and panic if the converted value wouldn't fit | LL | x_i8 > x_u128.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1067,7 +1067,7 @@ error[E0308]: mismatched types LL | x_i8 > x_usize; | ^^^^^^^ expected `i8`, found `usize` | -help: you can convert an `usize` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `i8` and panic if the converted value wouldn't fit | LL | x_i8 > x_usize.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1079,7 +1079,7 @@ LL | x_i16 > x_u8; | ^^^^ | | | expected `i16`, found `u8` - | help: you can convert an `u8` to `i16`: `x_u8.into()` + | help: you can convert a `u8` to `i16`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:257:17 @@ -1087,7 +1087,7 @@ error[E0308]: mismatched types LL | x_i16 > x_u16; | ^^^^^ expected `i16`, found `u16` | -help: you can convert an `u16` to `i16` and panic if the converted value wouldn't fit +help: you can convert a `u16` to `i16` and panic if the converted value wouldn't fit | LL | x_i16 > x_u16.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1098,7 +1098,7 @@ error[E0308]: mismatched types LL | x_i16 > x_u32; | ^^^^^ expected `i16`, found `u32` | -help: you can convert an `u32` to `i16` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `i16` and panic if the converted value wouldn't fit | LL | x_i16 > x_u32.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1109,7 +1109,7 @@ error[E0308]: mismatched types LL | x_i16 > x_u64; | ^^^^^ expected `i16`, found `u64` | -help: you can convert an `u64` to `i16` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `i16` and panic if the converted value wouldn't fit | LL | x_i16 > x_u64.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1120,7 +1120,7 @@ error[E0308]: mismatched types LL | x_i16 > x_u128; | ^^^^^^ expected `i16`, found `u128` | -help: you can convert an `u128` to `i16` and panic if the converted value wouldn't fit +help: you can convert a `u128` to `i16` and panic if the converted value wouldn't fit | LL | x_i16 > x_u128.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1131,7 +1131,7 @@ error[E0308]: mismatched types LL | x_i16 > x_usize; | ^^^^^^^ expected `i16`, found `usize` | -help: you can convert an `usize` to `i16` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `i16` and panic if the converted value wouldn't fit | LL | x_i16 > x_usize.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1143,7 +1143,7 @@ LL | x_i32 > x_u8; | ^^^^ | | | expected `i32`, found `u8` - | help: you can convert an `u8` to `i32`: `x_u8.into()` + | help: you can convert a `u8` to `i32`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:270:17 @@ -1152,7 +1152,7 @@ LL | x_i32 > x_u16; | ^^^^^ | | | expected `i32`, found `u16` - | help: you can convert an `u16` to `i32`: `x_u16.into()` + | help: you can convert a `u16` to `i32`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:272:17 @@ -1160,7 +1160,7 @@ error[E0308]: mismatched types LL | x_i32 > x_u32; | ^^^^^ expected `i32`, found `u32` | -help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `i32` and panic if the converted value wouldn't fit | LL | x_i32 > x_u32.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1171,7 +1171,7 @@ error[E0308]: mismatched types LL | x_i32 > x_u64; | ^^^^^ expected `i32`, found `u64` | -help: you can convert an `u64` to `i32` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `i32` and panic if the converted value wouldn't fit | LL | x_i32 > x_u64.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1182,7 +1182,7 @@ error[E0308]: mismatched types LL | x_i32 > x_u128; | ^^^^^^ expected `i32`, found `u128` | -help: you can convert an `u128` to `i32` and panic if the converted value wouldn't fit +help: you can convert a `u128` to `i32` and panic if the converted value wouldn't fit | LL | x_i32 > x_u128.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1193,7 +1193,7 @@ error[E0308]: mismatched types LL | x_i32 > x_usize; | ^^^^^^^ expected `i32`, found `usize` | -help: you can convert an `usize` to `i32` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `i32` and panic if the converted value wouldn't fit | LL | x_i32 > x_usize.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1205,7 +1205,7 @@ LL | x_i64 > x_u8; | ^^^^ | | | expected `i64`, found `u8` - | help: you can convert an `u8` to `i64`: `x_u8.into()` + | help: you can convert a `u8` to `i64`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:283:17 @@ -1214,7 +1214,7 @@ LL | x_i64 > x_u16; | ^^^^^ | | | expected `i64`, found `u16` - | help: you can convert an `u16` to `i64`: `x_u16.into()` + | help: you can convert a `u16` to `i64`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:285:17 @@ -1223,7 +1223,7 @@ LL | x_i64 > x_u32; | ^^^^^ | | | expected `i64`, found `u32` - | help: you can convert an `u32` to `i64`: `x_u32.into()` + | help: you can convert a `u32` to `i64`: `x_u32.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:287:17 @@ -1231,7 +1231,7 @@ error[E0308]: mismatched types LL | x_i64 > x_u64; | ^^^^^ expected `i64`, found `u64` | -help: you can convert an `u64` to `i64` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `i64` and panic if the converted value wouldn't fit | LL | x_i64 > x_u64.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1242,7 +1242,7 @@ error[E0308]: mismatched types LL | x_i64 > x_u128; | ^^^^^^ expected `i64`, found `u128` | -help: you can convert an `u128` to `i64` and panic if the converted value wouldn't fit +help: you can convert a `u128` to `i64` and panic if the converted value wouldn't fit | LL | x_i64 > x_u128.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1253,7 +1253,7 @@ error[E0308]: mismatched types LL | x_i64 > x_usize; | ^^^^^^^ expected `i64`, found `usize` | -help: you can convert an `usize` to `i64` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `i64` and panic if the converted value wouldn't fit | LL | x_i64 > x_usize.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1265,7 +1265,7 @@ LL | x_i128 > x_u8; | ^^^^ | | | expected `i128`, found `u8` - | help: you can convert an `u8` to `i128`: `x_u8.into()` + | help: you can convert a `u8` to `i128`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:296:18 @@ -1274,7 +1274,7 @@ LL | x_i128 > x_u16; | ^^^^^ | | | expected `i128`, found `u16` - | help: you can convert an `u16` to `i128`: `x_u16.into()` + | help: you can convert a `u16` to `i128`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:298:18 @@ -1283,7 +1283,7 @@ LL | x_i128 > x_u32; | ^^^^^ | | | expected `i128`, found `u32` - | help: you can convert an `u32` to `i128`: `x_u32.into()` + | help: you can convert a `u32` to `i128`: `x_u32.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:300:18 @@ -1292,7 +1292,7 @@ LL | x_i128 > x_u64; | ^^^^^ | | | expected `i128`, found `u64` - | help: you can convert an `u64` to `i128`: `x_u64.into()` + | help: you can convert a `u64` to `i128`: `x_u64.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:302:18 @@ -1300,7 +1300,7 @@ error[E0308]: mismatched types LL | x_i128 > x_u128; | ^^^^^^ expected `i128`, found `u128` | -help: you can convert an `u128` to `i128` and panic if the converted value wouldn't fit +help: you can convert a `u128` to `i128` and panic if the converted value wouldn't fit | LL | x_i128 > x_u128.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1311,7 +1311,7 @@ error[E0308]: mismatched types LL | x_i128 > x_usize; | ^^^^^^^ expected `i128`, found `usize` | -help: you can convert an `usize` to `i128` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `i128` and panic if the converted value wouldn't fit | LL | x_i128 > x_usize.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1323,7 +1323,7 @@ LL | x_isize > x_u8; | ^^^^ | | | expected `isize`, found `u8` - | help: you can convert an `u8` to `isize`: `x_u8.into()` + | help: you can convert a `u8` to `isize`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:309:19 @@ -1331,7 +1331,7 @@ error[E0308]: mismatched types LL | x_isize > x_u16; | ^^^^^ expected `isize`, found `u16` | -help: you can convert an `u16` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `u16` to `isize` and panic if the converted value wouldn't fit | LL | x_isize > x_u16.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1342,7 +1342,7 @@ error[E0308]: mismatched types LL | x_isize > x_u32; | ^^^^^ expected `isize`, found `u32` | -help: you can convert an `u32` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `isize` and panic if the converted value wouldn't fit | LL | x_isize > x_u32.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1353,7 +1353,7 @@ error[E0308]: mismatched types LL | x_isize > x_u64; | ^^^^^ expected `isize`, found `u64` | -help: you can convert an `u64` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `isize` and panic if the converted value wouldn't fit | LL | x_isize > x_u64.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1364,7 +1364,7 @@ error[E0308]: mismatched types LL | x_isize > x_u128; | ^^^^^^ expected `isize`, found `u128` | -help: you can convert an `u128` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `u128` to `isize` and panic if the converted value wouldn't fit | LL | x_isize > x_u128.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1375,7 +1375,7 @@ error[E0308]: mismatched types LL | x_isize > x_usize; | ^^^^^^^ expected `isize`, found `usize` | -help: you can convert an `usize` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `isize` and panic if the converted value wouldn't fit | LL | x_isize > x_usize.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/numeric/numeric-cast.stderr b/src/test/ui/numeric/numeric-cast.stderr index cc1aa72d214..3c78ea9e08a 100644 --- a/src/test/ui/numeric/numeric-cast.stderr +++ b/src/test/ui/numeric/numeric-cast.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `usize`, found `u64` | -help: you can convert an `u64` to `usize` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `usize` and panic if the converted value wouldn't fit | LL | foo::(x_u64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ error[E0308]: mismatched types LL | foo::(x_u32); | ^^^^^ expected `usize`, found `u32` | -help: you can convert an `u32` to `usize` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `usize` and panic if the converted value wouldn't fit | LL | foo::(x_u32.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -27,7 +27,7 @@ LL | foo::(x_u16); | ^^^^^ | | | expected `usize`, found `u16` - | help: you can convert an `u16` to `usize`: `x_u16.into()` + | help: you can convert a `u16` to `usize`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:29:18 @@ -36,7 +36,7 @@ LL | foo::(x_u8); | ^^^^ | | | expected `usize`, found `u8` - | help: you can convert an `u8` to `usize`: `x_u8.into()` + | help: you can convert a `u8` to `usize`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:31:18 @@ -99,7 +99,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `isize`, found `usize` | -help: you can convert an `usize` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `isize` and panic if the converted value wouldn't fit | LL | foo::(x_usize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -110,7 +110,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `isize`, found `u64` | -help: you can convert an `u64` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `isize` and panic if the converted value wouldn't fit | LL | foo::(x_u64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ error[E0308]: mismatched types LL | foo::(x_u32); | ^^^^^ expected `isize`, found `u32` | -help: you can convert an `u32` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `isize` and panic if the converted value wouldn't fit | LL | foo::(x_u32.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -132,7 +132,7 @@ error[E0308]: mismatched types LL | foo::(x_u16); | ^^^^^ expected `isize`, found `u16` | -help: you can convert an `u16` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `u16` to `isize` and panic if the converted value wouldn't fit | LL | foo::(x_u16.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -144,7 +144,7 @@ LL | foo::(x_u8); | ^^^^ | | | expected `isize`, found `u8` - | help: you can convert an `u8` to `isize`: `x_u8.into()` + | help: you can convert a `u8` to `isize`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:55:18 @@ -192,7 +192,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `u64`, found `usize` | -help: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u64` and panic if the converted value wouldn't fit | LL | foo::(x_usize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -204,7 +204,7 @@ LL | foo::(x_u32); | ^^^^^ | | | expected `u64`, found `u32` - | help: you can convert an `u32` to `u64`: `x_u32.into()` + | help: you can convert a `u32` to `u64`: `x_u32.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:71:16 @@ -213,7 +213,7 @@ LL | foo::(x_u16); | ^^^^^ | | | expected `u64`, found `u16` - | help: you can convert an `u16` to `u64`: `x_u16.into()` + | help: you can convert a `u16` to `u64`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:73:16 @@ -222,7 +222,7 @@ LL | foo::(x_u8); | ^^^^ | | | expected `u64`, found `u8` - | help: you can convert an `u8` to `u64`: `x_u8.into()` + | help: you can convert a `u8` to `u64`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:75:16 @@ -285,7 +285,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `i64`, found `usize` | -help: you can convert an `usize` to `i64` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `i64` and panic if the converted value wouldn't fit | LL | foo::(x_usize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -296,7 +296,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `i64`, found `u64` | -help: you can convert an `u64` to `i64` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `i64` and panic if the converted value wouldn't fit | LL | foo::(x_u64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -308,7 +308,7 @@ LL | foo::(x_u32); | ^^^^^ | | | expected `i64`, found `u32` - | help: you can convert an `u32` to `i64`: `x_u32.into()` + | help: you can convert a `u32` to `i64`: `x_u32.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:94:16 @@ -317,7 +317,7 @@ LL | foo::(x_u16); | ^^^^^ | | | expected `i64`, found `u16` - | help: you can convert an `u16` to `i64`: `x_u16.into()` + | help: you can convert a `u16` to `i64`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:96:16 @@ -326,7 +326,7 @@ LL | foo::(x_u8); | ^^^^ | | | expected `i64`, found `u8` - | help: you can convert an `u8` to `i64`: `x_u8.into()` + | help: you can convert a `u8` to `i64`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:98:16 @@ -372,7 +372,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `u32`, found `usize` | -help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u32` and panic if the converted value wouldn't fit | LL | foo::(x_usize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -383,7 +383,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `u32`, found `u64` | -help: you can convert an `u64` to `u32` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `u32` and panic if the converted value wouldn't fit | LL | foo::(x_u64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -395,7 +395,7 @@ LL | foo::(x_u16); | ^^^^^ | | | expected `u32`, found `u16` - | help: you can convert an `u16` to `u32`: `x_u16.into()` + | help: you can convert a `u16` to `u32`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:117:16 @@ -404,7 +404,7 @@ LL | foo::(x_u8); | ^^^^ | | | expected `u32`, found `u8` - | help: you can convert an `u8` to `u32`: `x_u8.into()` + | help: you can convert a `u8` to `u32`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:119:16 @@ -467,7 +467,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `i32`, found `usize` | -help: you can convert an `usize` to `i32` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `i32` and panic if the converted value wouldn't fit | LL | foo::(x_usize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -478,7 +478,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `i32`, found `u64` | -help: you can convert an `u64` to `i32` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `i32` and panic if the converted value wouldn't fit | LL | foo::(x_u64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -489,7 +489,7 @@ error[E0308]: mismatched types LL | foo::(x_u32); | ^^^^^ expected `i32`, found `u32` | -help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `i32` and panic if the converted value wouldn't fit | LL | foo::(x_u32.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -501,7 +501,7 @@ LL | foo::(x_u16); | ^^^^^ | | | expected `i32`, found `u16` - | help: you can convert an `u16` to `i32`: `x_u16.into()` + | help: you can convert a `u16` to `i32`: `x_u16.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:140:16 @@ -510,7 +510,7 @@ LL | foo::(x_u8); | ^^^^ | | | expected `i32`, found `u8` - | help: you can convert an `u8` to `i32`: `x_u8.into()` + | help: you can convert a `u8` to `i32`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:142:16 @@ -558,7 +558,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `u16`, found `usize` | -help: you can convert an `usize` to `u16` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u16` and panic if the converted value wouldn't fit | LL | foo::(x_usize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -569,7 +569,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `u16`, found `u64` | -help: you can convert an `u64` to `u16` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `u16` and panic if the converted value wouldn't fit | LL | foo::(x_u64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -580,7 +580,7 @@ error[E0308]: mismatched types LL | foo::(x_u32); | ^^^^^ expected `u16`, found `u32` | -help: you can convert an `u32` to `u16` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `u16` and panic if the converted value wouldn't fit | LL | foo::(x_u32.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -592,7 +592,7 @@ LL | foo::(x_u8); | ^^^^ | | | expected `u16`, found `u8` - | help: you can convert an `u8` to `u16`: `x_u8.into()` + | help: you can convert a `u8` to `u16`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:163:16 @@ -655,7 +655,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `i16`, found `usize` | -help: you can convert an `usize` to `i16` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `i16` and panic if the converted value wouldn't fit | LL | foo::(x_usize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -666,7 +666,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `i16`, found `u64` | -help: you can convert an `u64` to `i16` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `i16` and panic if the converted value wouldn't fit | LL | foo::(x_u64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -677,7 +677,7 @@ error[E0308]: mismatched types LL | foo::(x_u32); | ^^^^^ expected `i16`, found `u32` | -help: you can convert an `u32` to `i16` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `i16` and panic if the converted value wouldn't fit | LL | foo::(x_u32.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -688,7 +688,7 @@ error[E0308]: mismatched types LL | foo::(x_u16); | ^^^^^ expected `i16`, found `u16` | -help: you can convert an `u16` to `i16` and panic if the converted value wouldn't fit +help: you can convert a `u16` to `i16` and panic if the converted value wouldn't fit | LL | foo::(x_u16.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -700,7 +700,7 @@ LL | foo::(x_u8); | ^^^^ | | | expected `i16`, found `u8` - | help: you can convert an `u8` to `i16`: `x_u8.into()` + | help: you can convert a `u8` to `i16`: `x_u8.into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:186:16 @@ -750,7 +750,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `u8`, found `usize` | -help: you can convert an `usize` to `u8` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `u8` and panic if the converted value wouldn't fit | LL | foo::(x_usize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -761,7 +761,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `u8`, found `u64` | -help: you can convert an `u64` to `u8` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `u8` and panic if the converted value wouldn't fit | LL | foo::(x_u64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -772,7 +772,7 @@ error[E0308]: mismatched types LL | foo::(x_u32); | ^^^^^ expected `u8`, found `u32` | -help: you can convert an `u32` to `u8` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `u8` and panic if the converted value wouldn't fit | LL | foo::(x_u32.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -783,7 +783,7 @@ error[E0308]: mismatched types LL | foo::(x_u16); | ^^^^^ expected `u8`, found `u16` | -help: you can convert an `u16` to `u8` and panic if the converted value wouldn't fit +help: you can convert a `u16` to `u8` and panic if the converted value wouldn't fit | LL | foo::(x_u16.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -849,7 +849,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `i8`, found `usize` | -help: you can convert an `usize` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `i8` and panic if the converted value wouldn't fit | LL | foo::(x_usize.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -860,7 +860,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `i8`, found `u64` | -help: you can convert an `u64` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `u64` to `i8` and panic if the converted value wouldn't fit | LL | foo::(x_u64.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -871,7 +871,7 @@ error[E0308]: mismatched types LL | foo::(x_u32); | ^^^^^ expected `i8`, found `u32` | -help: you can convert an `u32` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `u32` to `i8` and panic if the converted value wouldn't fit | LL | foo::(x_u32.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -882,7 +882,7 @@ error[E0308]: mismatched types LL | foo::(x_u16); | ^^^^^ expected `i8`, found `u16` | -help: you can convert an `u16` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `u16` to `i8` and panic if the converted value wouldn't fit | LL | foo::(x_u16.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -893,7 +893,7 @@ error[E0308]: mismatched types LL | foo::(x_u8); | ^^^^ expected `i8`, found `u8` | -help: you can convert an `u8` to `i8` and panic if the converted value wouldn't fit +help: you can convert a `u8` to `i8` and panic if the converted value wouldn't fit | LL | foo::(x_u8.try_into().unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -948,7 +948,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `f64`, found `usize` | -help: you can cast an `usize to `f64`, producing the floating point representation of the integer, +help: you can cast a `usize to `f64`, producing the floating point representation of the integer, | rounded if necessary LL | foo::(x_usize as f64); | ^^^^^^^^^^^^^^ @@ -959,7 +959,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `f64`, found `u64` | -help: you can cast an `u64 to `f64`, producing the floating point representation of the integer, +help: you can cast a `u64 to `f64`, producing the floating point representation of the integer, | rounded if necessary LL | foo::(x_u64 as f64); | ^^^^^^^^^^^^ @@ -970,7 +970,7 @@ error[E0308]: mismatched types LL | foo::(x_u32); | ^^^^^ expected `f64`, found `u32` | -help: you can convert an `u32` to `f64`, producing the floating point representation of the integer +help: you can convert a `u32` to `f64`, producing the floating point representation of the integer | LL | foo::(x_u32.into()); | ^^^^^^^^^^^^ @@ -981,7 +981,7 @@ error[E0308]: mismatched types LL | foo::(x_u16); | ^^^^^ expected `f64`, found `u16` | -help: you can convert an `u16` to `f64`, producing the floating point representation of the integer +help: you can convert a `u16` to `f64`, producing the floating point representation of the integer | LL | foo::(x_u16.into()); | ^^^^^^^^^^^^ @@ -992,7 +992,7 @@ error[E0308]: mismatched types LL | foo::(x_u8); | ^^^^ expected `f64`, found `u8` | -help: you can convert an `u8` to `f64`, producing the floating point representation of the integer +help: you can convert a `u8` to `f64`, producing the floating point representation of the integer | LL | foo::(x_u8.into()); | ^^^^^^^^^^^ @@ -1067,7 +1067,7 @@ error[E0308]: mismatched types LL | foo::(x_usize); | ^^^^^^^ expected `f32`, found `usize` | -help: you can cast an `usize to `f32`, producing the floating point representation of the integer, +help: you can cast a `usize to `f32`, producing the floating point representation of the integer, | rounded if necessary LL | foo::(x_usize as f32); | ^^^^^^^^^^^^^^ @@ -1078,7 +1078,7 @@ error[E0308]: mismatched types LL | foo::(x_u64); | ^^^^^ expected `f32`, found `u64` | -help: you can cast an `u64 to `f32`, producing the floating point representation of the integer, +help: you can cast a `u64 to `f32`, producing the floating point representation of the integer, | rounded if necessary LL | foo::(x_u64 as f32); | ^^^^^^^^^^^^ @@ -1089,7 +1089,7 @@ error[E0308]: mismatched types LL | foo::(x_u32); | ^^^^^ expected `f32`, found `u32` | -help: you can cast an `u32 to `f32`, producing the floating point representation of the integer, +help: you can cast a `u32 to `f32`, producing the floating point representation of the integer, | rounded if necessary LL | foo::(x_u32 as f32); | ^^^^^^^^^^^^ @@ -1100,7 +1100,7 @@ error[E0308]: mismatched types LL | foo::(x_u16); | ^^^^^ expected `f32`, found `u16` | -help: you can convert an `u16` to `f32`, producing the floating point representation of the integer +help: you can convert a `u16` to `f32`, producing the floating point representation of the integer | LL | foo::(x_u16.into()); | ^^^^^^^^^^^^ @@ -1111,7 +1111,7 @@ error[E0308]: mismatched types LL | foo::(x_u8); | ^^^^ expected `f32`, found `u8` | -help: you can convert an `u8` to `f32`, producing the floating point representation of the integer +help: you can convert a `u8` to `f32`, producing the floating point representation of the integer | LL | foo::(x_u8.into()); | ^^^^^^^^^^^ @@ -1178,7 +1178,7 @@ LL | foo::(x_u8 as u16); | ^^^^^^^^^^^ | | | expected `u32`, found `u16` - | help: you can convert an `u16` to `u32`: `(x_u8 as u16).into()` + | help: you can convert a `u16` to `u32`: `(x_u8 as u16).into()` error[E0308]: mismatched types --> $DIR/numeric-cast.rs:291:16 diff --git a/src/test/ui/numeric/numeric-suffix.stderr b/src/test/ui/numeric/numeric-suffix.stderr index 00f6e1abe43..890686f7737 100644 --- a/src/test/ui/numeric/numeric-suffix.stderr +++ b/src/test/ui/numeric/numeric-suffix.stderr @@ -1236,7 +1236,7 @@ error[E0308]: mismatched types LL | foo::(42_u32); | ^^^^^^ expected `f64`, found `u32` | -help: you can convert an `u32` to `f64`, producing the floating point representation of the integer +help: you can convert a `u32` to `f64`, producing the floating point representation of the integer | LL | foo::(42_u32.into()); | ^^^^^^^^^^^^^ @@ -1247,7 +1247,7 @@ error[E0308]: mismatched types LL | foo::(42_u16); | ^^^^^^ expected `f64`, found `u16` | -help: you can convert an `u16` to `f64`, producing the floating point representation of the integer +help: you can convert a `u16` to `f64`, producing the floating point representation of the integer | LL | foo::(42_u16.into()); | ^^^^^^^^^^^^^ @@ -1258,7 +1258,7 @@ error[E0308]: mismatched types LL | foo::(42_u8); | ^^^^^ expected `f64`, found `u8` | -help: you can convert an `u8` to `f64`, producing the floating point representation of the integer +help: you can convert a `u8` to `f64`, producing the floating point representation of the integer | LL | foo::(42_u8.into()); | ^^^^^^^^^^^^ @@ -1368,7 +1368,7 @@ error[E0308]: mismatched types LL | foo::(42_u16); | ^^^^^^ expected `f32`, found `u16` | -help: you can convert an `u16` to `f32`, producing the floating point representation of the integer +help: you can convert a `u16` to `f32`, producing the floating point representation of the integer | LL | foo::(42_u16.into()); | ^^^^^^^^^^^^^ @@ -1379,7 +1379,7 @@ error[E0308]: mismatched types LL | foo::(42_u8); | ^^^^^ expected `f32`, found `u8` | -help: you can convert an `u8` to `f32`, producing the floating point representation of the integer +help: you can convert a `u8` to `f32`, producing the floating point representation of the integer | LL | foo::(42_u8.into()); | ^^^^^^^^^^^^ @@ -1457,7 +1457,7 @@ LL | foo::(42_u8 as u16); | ^^^^^^^^^^^^ | | | expected `u32`, found `u16` - | help: you can convert an `u16` to `u32`: `(42_u8 as u16).into()` + | help: you can convert a `u16` to `u32`: `(42_u8 as u16).into()` error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:296:16 diff --git a/src/test/ui/tail-typeck.stderr b/src/test/ui/tail-typeck.stderr index 69f8ffa581b..4dc969e76ed 100644 --- a/src/test/ui/tail-typeck.stderr +++ b/src/test/ui/tail-typeck.stderr @@ -6,7 +6,7 @@ LL | fn f() -> isize { return g(); } | | | expected `isize` because of return type | -help: you can convert an `usize` to `isize` and panic if the converted value wouldn't fit +help: you can convert a `usize` to `isize` and panic if the converted value wouldn't fit | LL | fn f() -> isize { return g().try_into().unwrap(); } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/tutorial-suffix-inference-test.stderr b/src/test/ui/tutorial-suffix-inference-test.stderr index c6c7ba26794..4f36357598d 100644 --- a/src/test/ui/tutorial-suffix-inference-test.stderr +++ b/src/test/ui/tutorial-suffix-inference-test.stderr @@ -5,7 +5,7 @@ LL | identity_u16(x); | ^ | | | expected `u16`, found `u8` - | help: you can convert an `u8` to `u16`: `x.into()` + | help: you can convert a `u8` to `u16`: `x.into()` error[E0308]: mismatched types --> $DIR/tutorial-suffix-inference-test.rs:12:18