summaryrefslogtreecommitdiffstats
path: root/tests/ui/numeric
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/numeric
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/numeric')
-rw-r--r--tests/ui/numeric/const-scope.rs12
-rw-r--r--tests/ui/numeric/const-scope.stderr67
-rw-r--r--tests/ui/numeric/integer-literal-suffix-inference.rs220
-rw-r--r--tests/ui/numeric/integer-literal-suffix-inference.stderr939
-rw-r--r--tests/ui/numeric/len.rs8
-rw-r--r--tests/ui/numeric/len.stderr21
-rw-r--r--tests/ui/numeric/numeric-cast-2.rs11
-rw-r--r--tests/ui/numeric/numeric-cast-2.stderr42
-rw-r--r--tests/ui/numeric/numeric-cast-binop.fixed320
-rw-r--r--tests/ui/numeric/numeric-cast-binop.rs320
-rw-r--r--tests/ui/numeric/numeric-cast-binop.stderr1719
-rw-r--r--tests/ui/numeric/numeric-cast-no-fix.rs87
-rw-r--r--tests/ui/numeric/numeric-cast-no-fix.stderr396
-rw-r--r--tests/ui/numeric/numeric-cast-without-suggestion.rs38
-rw-r--r--tests/ui/numeric/numeric-cast-without-suggestion.stderr297
-rw-r--r--tests/ui/numeric/numeric-cast.fixed293
-rw-r--r--tests/ui/numeric/numeric-cast.rs293
-rw-r--r--tests/ui/numeric/numeric-cast.stderr2037
-rw-r--r--tests/ui/numeric/numeric-fields.rs10
-rw-r--r--tests/ui/numeric/numeric-fields.stderr27
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-i32.fixed73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-i32.rs73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr201
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-i64.fixed73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-i64.rs73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr201
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-isize.fixed73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-isize.rs73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr201
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-u32.fixed73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-u32.rs73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr201
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-u64.fixed73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-u64.rs73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr201
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-usize.fixed73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-usize.rs73
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr201
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix.fixed427
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix.rs427
-rw-r--r--tests/ui/numeric/numeric-suffix/numeric-suffix.stderr1227
-rw-r--r--tests/ui/numeric/uppercase-base-prefix-invalid-no-fix.rs34
-rw-r--r--tests/ui/numeric/uppercase-base-prefix-invalid-no-fix.stderr50
-rw-r--r--tests/ui/numeric/uppercase-base-prefix.fixed77
-rw-r--r--tests/ui/numeric/uppercase-base-prefix.rs77
-rw-r--r--tests/ui/numeric/uppercase-base-prefix.stderr98
46 files changed, 11656 insertions, 0 deletions
diff --git a/tests/ui/numeric/const-scope.rs b/tests/ui/numeric/const-scope.rs
new file mode 100644
index 000000000..053599a9b
--- /dev/null
+++ b/tests/ui/numeric/const-scope.rs
@@ -0,0 +1,12 @@
+const C: i32 = 1i8; //~ ERROR mismatched types
+const D: i8 = C; //~ ERROR mismatched types
+
+const fn foo() {
+ let c: i32 = 1i8; //~ ERROR mismatched types
+ let d: i8 = c; //~ ERROR mismatched types
+}
+
+fn main() {
+ let c: i32 = 1i8; //~ ERROR mismatched types
+ let d: i8 = c; //~ ERROR mismatched types
+}
diff --git a/tests/ui/numeric/const-scope.stderr b/tests/ui/numeric/const-scope.stderr
new file mode 100644
index 000000000..4e4bcdf23
--- /dev/null
+++ b/tests/ui/numeric/const-scope.stderr
@@ -0,0 +1,67 @@
+error[E0308]: mismatched types
+ --> $DIR/const-scope.rs:1:16
+ |
+LL | const C: i32 = 1i8;
+ | ^^^ expected `i32`, found `i8`
+ |
+help: change the type of the numeric literal from `i8` to `i32`
+ |
+LL | const C: i32 = 1i32;
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/const-scope.rs:2:15
+ |
+LL | const D: i8 = C;
+ | ^ expected `i8`, found `i32`
+
+error[E0308]: mismatched types
+ --> $DIR/const-scope.rs:5:18
+ |
+LL | let c: i32 = 1i8;
+ | --- ^^^ expected `i32`, found `i8`
+ | |
+ | expected due to this
+ |
+help: change the type of the numeric literal from `i8` to `i32`
+ |
+LL | let c: i32 = 1i32;
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/const-scope.rs:6:17
+ |
+LL | let d: i8 = c;
+ | -- ^ expected `i8`, found `i32`
+ | |
+ | expected due to this
+
+error[E0308]: mismatched types
+ --> $DIR/const-scope.rs:10:18
+ |
+LL | let c: i32 = 1i8;
+ | --- ^^^ expected `i32`, found `i8`
+ | |
+ | expected due to this
+ |
+help: change the type of the numeric literal from `i8` to `i32`
+ |
+LL | let c: i32 = 1i32;
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/const-scope.rs:11:17
+ |
+LL | let d: i8 = c;
+ | -- ^ expected `i8`, found `i32`
+ | |
+ | expected due to this
+ |
+help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | let d: i8 = c.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/integer-literal-suffix-inference.rs b/tests/ui/numeric/integer-literal-suffix-inference.rs
new file mode 100644
index 000000000..c320f2bb7
--- /dev/null
+++ b/tests/ui/numeric/integer-literal-suffix-inference.rs
@@ -0,0 +1,220 @@
+fn main() {
+
+ // the smallest positive values that need these types
+ let a8: i8 = 8;
+ let a16: i16 = 128;
+ let a32: i32 = 32_768;
+ let a64: i64 = 2_147_483_648;
+
+ // the smallest negative values that need these types
+ let c8: i8 = -9;
+ let c16: i16 = -129;
+ let c32: i32 = -32_769;
+ let c64: i64 = -2_147_483_649;
+
+ fn id_i8(n: i8) -> i8 { n }
+ fn id_i16(n: i16) -> i16 { n }
+ fn id_i32(n: i32) -> i32 { n }
+ fn id_i64(n: i64) -> i64 { n }
+ fn id_isize(n: isize) -> isize { n }
+
+ // the smallest values that need these types
+ let b8: u8 = 16;
+ let b16: u16 = 256;
+ let b32: u32 = 65_536;
+ let b64: u64 = 4_294_967_296;
+
+ fn id_u8(n: u8) -> u8 { n }
+ fn id_u16(n: u16) -> u16 { n }
+ fn id_u32(n: u32) -> u32 { n }
+ fn id_u64(n: u64) -> u64 { n }
+ fn id_usize(n: usize) -> usize { n }
+
+ // Values for testing *size
+ let asize: isize = 1;
+ let bsize: usize = 3;
+
+ id_i8(a8); // ok
+ id_i8(a16);
+ //~^ ERROR mismatched types
+ //~| expected `i8`, found `i16`
+ id_i8(a32);
+ //~^ ERROR mismatched types
+ //~| expected `i8`, found `i32`
+ id_i8(a64);
+ //~^ ERROR mismatched types
+ //~| expected `i8`, found `i64`
+ id_i8(asize);
+ //~^ ERROR mismatched types
+ //~| expected `i8`, found `isize`
+
+ id_i16(a8);
+ //~^ ERROR mismatched types
+ //~| expected `i16`, found `i8`
+ id_i16(a16); // ok
+ id_i16(a32);
+ //~^ ERROR mismatched types
+ //~| expected `i16`, found `i32`
+ id_i16(a64);
+ //~^ ERROR mismatched types
+ //~| expected `i16`, found `i64`
+ id_i16(asize);
+ //~^ ERROR mismatched types
+ //~| expected `i16`, found `isize`
+
+ id_i32(a8);
+ //~^ ERROR mismatched types
+ //~| expected `i32`, found `i8`
+ id_i32(a16);
+ //~^ ERROR mismatched types
+ //~| expected `i32`, found `i16`
+ id_i32(a32); // ok
+ id_i32(a64);
+ //~^ ERROR mismatched types
+ //~| expected `i32`, found `i64`
+ id_i32(asize);
+ //~^ ERROR mismatched types
+ //~| expected `i32`, found `isize`
+
+ id_i64(a8);
+ //~^ ERROR mismatched types
+ //~| expected `i64`, found `i8`
+ id_i64(a16);
+ //~^ ERROR mismatched types
+ //~| expected `i64`, found `i16`
+ id_i64(a32);
+ //~^ ERROR mismatched types
+ //~| expected `i64`, found `i32`
+ id_i64(a64); // ok
+ id_i64(asize);
+ //~^ ERROR mismatched types
+ //~| expected `i64`, found `isize`
+
+ id_isize(a8);
+ //~^ ERROR mismatched types
+ //~| expected `isize`, found `i8`
+ id_isize(a16);
+ //~^ ERROR mismatched types
+ //~| expected `isize`, found `i16`
+ id_isize(a32);
+ //~^ ERROR mismatched types
+ //~| expected `isize`, found `i32`
+ id_isize(a64);
+ //~^ ERROR mismatched types
+ //~| expected `isize`, found `i64`
+ id_isize(asize); //ok
+
+ id_i8(c8); // ok
+ id_i8(c16);
+ //~^ ERROR mismatched types
+ //~| expected `i8`, found `i16`
+ id_i8(c32);
+ //~^ ERROR mismatched types
+ //~| expected `i8`, found `i32`
+ id_i8(c64);
+ //~^ ERROR mismatched types
+ //~| expected `i8`, found `i64`
+
+ id_i16(c8);
+ //~^ ERROR mismatched types
+ //~| expected `i16`, found `i8`
+ id_i16(c16); // ok
+ id_i16(c32);
+ //~^ ERROR mismatched types
+ //~| expected `i16`, found `i32`
+ id_i16(c64);
+ //~^ ERROR mismatched types
+ //~| expected `i16`, found `i64`
+
+ id_i32(c8);
+ //~^ ERROR mismatched types
+ //~| expected `i32`, found `i8`
+ id_i32(c16);
+ //~^ ERROR mismatched types
+ //~| expected `i32`, found `i16`
+ id_i32(c32); // ok
+ id_i32(c64);
+ //~^ ERROR mismatched types
+ //~| expected `i32`, found `i64`
+
+ id_i64(a8);
+ //~^ ERROR mismatched types
+ //~| expected `i64`, found `i8`
+ id_i64(a16);
+ //~^ ERROR mismatched types
+ //~| expected `i64`, found `i16`
+ id_i64(a32);
+ //~^ ERROR mismatched types
+ //~| expected `i64`, found `i32`
+ id_i64(a64); // ok
+
+ id_u8(b8); // ok
+ id_u8(b16);
+ //~^ ERROR mismatched types
+ //~| expected `u8`, found `u16`
+ id_u8(b32);
+ //~^ ERROR mismatched types
+ //~| expected `u8`, found `u32`
+ id_u8(b64);
+ //~^ ERROR mismatched types
+ //~| expected `u8`, found `u64`
+ id_u8(bsize);
+ //~^ ERROR mismatched types
+ //~| expected `u8`, found `usize`
+
+ id_u16(b8);
+ //~^ ERROR mismatched types
+ //~| expected `u16`, found `u8`
+ id_u16(b16); // ok
+ id_u16(b32);
+ //~^ ERROR mismatched types
+ //~| expected `u16`, found `u32`
+ id_u16(b64);
+ //~^ ERROR mismatched types
+ //~| expected `u16`, found `u64`
+ id_u16(bsize);
+ //~^ ERROR mismatched types
+ //~| expected `u16`, found `usize`
+
+ id_u32(b8);
+ //~^ ERROR mismatched types
+ //~| expected `u32`, found `u8`
+ id_u32(b16);
+ //~^ ERROR mismatched types
+ //~| expected `u32`, found `u16`
+ id_u32(b32); // ok
+ id_u32(b64);
+ //~^ ERROR mismatched types
+ //~| expected `u32`, found `u64`
+ id_u32(bsize);
+ //~^ ERROR mismatched types
+ //~| expected `u32`, found `usize`
+
+ id_u64(b8);
+ //~^ ERROR mismatched types
+ //~| expected `u64`, found `u8`
+ id_u64(b16);
+ //~^ ERROR mismatched types
+ //~| expected `u64`, found `u16`
+ id_u64(b32);
+ //~^ ERROR mismatched types
+ //~| expected `u64`, found `u32`
+ id_u64(b64); // ok
+ id_u64(bsize);
+ //~^ ERROR mismatched types
+ //~| expected `u64`, found `usize`
+
+ id_usize(b8);
+ //~^ ERROR mismatched types
+ //~| expected `usize`, found `u8`
+ id_usize(b16);
+ //~^ ERROR mismatched types
+ //~| expected `usize`, found `u16`
+ id_usize(b32);
+ //~^ ERROR mismatched types
+ //~| expected `usize`, found `u32`
+ id_usize(b64);
+ //~^ ERROR mismatched types
+ //~| expected `usize`, found `u64`
+ id_usize(bsize); //ok
+}
diff --git a/tests/ui/numeric/integer-literal-suffix-inference.stderr b/tests/ui/numeric/integer-literal-suffix-inference.stderr
new file mode 100644
index 000000000..5045f584c
--- /dev/null
+++ b/tests/ui/numeric/integer-literal-suffix-inference.stderr
@@ -0,0 +1,939 @@
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:38:11
+ |
+LL | id_i8(a16);
+ | ----- ^^^ expected `i8`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:15:8
+ |
+LL | fn id_i8(n: i8) -> i8 { n }
+ | ^^^^^ -----
+help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | id_i8(a16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:41:11
+ |
+LL | id_i8(a32);
+ | ----- ^^^ expected `i8`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:15:8
+ |
+LL | fn id_i8(n: i8) -> i8 { n }
+ | ^^^^^ -----
+help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | id_i8(a32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:44:11
+ |
+LL | id_i8(a64);
+ | ----- ^^^ expected `i8`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:15:8
+ |
+LL | fn id_i8(n: i8) -> i8 { n }
+ | ^^^^^ -----
+help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | id_i8(a64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:47:11
+ |
+LL | id_i8(asize);
+ | ----- ^^^^^ expected `i8`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:15:8
+ |
+LL | fn id_i8(n: i8) -> i8 { n }
+ | ^^^^^ -----
+help: you can convert an `isize` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | id_i8(asize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:51:12
+ |
+LL | id_i16(a8);
+ | ------ ^^ expected `i16`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:16:8
+ |
+LL | fn id_i16(n: i16) -> i16 { n }
+ | ^^^^^^ ------
+help: you can convert an `i8` to an `i16`
+ |
+LL | id_i16(a8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:55:12
+ |
+LL | id_i16(a32);
+ | ------ ^^^ expected `i16`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:16:8
+ |
+LL | fn id_i16(n: i16) -> i16 { n }
+ | ^^^^^^ ------
+help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | id_i16(a32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:58:12
+ |
+LL | id_i16(a64);
+ | ------ ^^^ expected `i16`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:16:8
+ |
+LL | fn id_i16(n: i16) -> i16 { n }
+ | ^^^^^^ ------
+help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | id_i16(a64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:61:12
+ |
+LL | id_i16(asize);
+ | ------ ^^^^^ expected `i16`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:16:8
+ |
+LL | fn id_i16(n: i16) -> i16 { n }
+ | ^^^^^^ ------
+help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | id_i16(asize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:65:12
+ |
+LL | id_i32(a8);
+ | ------ ^^ expected `i32`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:17:8
+ |
+LL | fn id_i32(n: i32) -> i32 { n }
+ | ^^^^^^ ------
+help: you can convert an `i8` to an `i32`
+ |
+LL | id_i32(a8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:68:12
+ |
+LL | id_i32(a16);
+ | ------ ^^^ expected `i32`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:17:8
+ |
+LL | fn id_i32(n: i32) -> i32 { n }
+ | ^^^^^^ ------
+help: you can convert an `i16` to an `i32`
+ |
+LL | id_i32(a16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:72:12
+ |
+LL | id_i32(a64);
+ | ------ ^^^ expected `i32`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:17:8
+ |
+LL | fn id_i32(n: i32) -> i32 { n }
+ | ^^^^^^ ------
+help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | id_i32(a64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:75:12
+ |
+LL | id_i32(asize);
+ | ------ ^^^^^ expected `i32`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:17:8
+ |
+LL | fn id_i32(n: i32) -> i32 { n }
+ | ^^^^^^ ------
+help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | id_i32(asize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:79:12
+ |
+LL | id_i64(a8);
+ | ------ ^^ expected `i64`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:18:8
+ |
+LL | fn id_i64(n: i64) -> i64 { n }
+ | ^^^^^^ ------
+help: you can convert an `i8` to an `i64`
+ |
+LL | id_i64(a8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:82:12
+ |
+LL | id_i64(a16);
+ | ------ ^^^ expected `i64`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:18:8
+ |
+LL | fn id_i64(n: i64) -> i64 { n }
+ | ^^^^^^ ------
+help: you can convert an `i16` to an `i64`
+ |
+LL | id_i64(a16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:85:12
+ |
+LL | id_i64(a32);
+ | ------ ^^^ expected `i64`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:18:8
+ |
+LL | fn id_i64(n: i64) -> i64 { n }
+ | ^^^^^^ ------
+help: you can convert an `i32` to an `i64`
+ |
+LL | id_i64(a32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:89:12
+ |
+LL | id_i64(asize);
+ | ------ ^^^^^ expected `i64`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:18:8
+ |
+LL | fn id_i64(n: i64) -> i64 { n }
+ | ^^^^^^ ------
+help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit
+ |
+LL | id_i64(asize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:93:14
+ |
+LL | id_isize(a8);
+ | -------- ^^ expected `isize`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:19:8
+ |
+LL | fn id_isize(n: isize) -> isize { n }
+ | ^^^^^^^^ --------
+help: you can convert an `i8` to an `isize`
+ |
+LL | id_isize(a8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:96:14
+ |
+LL | id_isize(a16);
+ | -------- ^^^ expected `isize`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:19:8
+ |
+LL | fn id_isize(n: isize) -> isize { n }
+ | ^^^^^^^^ --------
+help: you can convert an `i16` to an `isize`
+ |
+LL | id_isize(a16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:99:14
+ |
+LL | id_isize(a32);
+ | -------- ^^^ expected `isize`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:19:8
+ |
+LL | fn id_isize(n: isize) -> isize { n }
+ | ^^^^^^^^ --------
+help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | id_isize(a32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:102:14
+ |
+LL | id_isize(a64);
+ | -------- ^^^ expected `isize`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:19:8
+ |
+LL | fn id_isize(n: isize) -> isize { n }
+ | ^^^^^^^^ --------
+help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | id_isize(a64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:108:11
+ |
+LL | id_i8(c16);
+ | ----- ^^^ expected `i8`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:15:8
+ |
+LL | fn id_i8(n: i8) -> i8 { n }
+ | ^^^^^ -----
+help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | id_i8(c16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:111:11
+ |
+LL | id_i8(c32);
+ | ----- ^^^ expected `i8`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:15:8
+ |
+LL | fn id_i8(n: i8) -> i8 { n }
+ | ^^^^^ -----
+help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | id_i8(c32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:114:11
+ |
+LL | id_i8(c64);
+ | ----- ^^^ expected `i8`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:15:8
+ |
+LL | fn id_i8(n: i8) -> i8 { n }
+ | ^^^^^ -----
+help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | id_i8(c64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:118:12
+ |
+LL | id_i16(c8);
+ | ------ ^^ expected `i16`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:16:8
+ |
+LL | fn id_i16(n: i16) -> i16 { n }
+ | ^^^^^^ ------
+help: you can convert an `i8` to an `i16`
+ |
+LL | id_i16(c8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:122:12
+ |
+LL | id_i16(c32);
+ | ------ ^^^ expected `i16`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:16:8
+ |
+LL | fn id_i16(n: i16) -> i16 { n }
+ | ^^^^^^ ------
+help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | id_i16(c32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:125:12
+ |
+LL | id_i16(c64);
+ | ------ ^^^ expected `i16`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:16:8
+ |
+LL | fn id_i16(n: i16) -> i16 { n }
+ | ^^^^^^ ------
+help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | id_i16(c64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:129:12
+ |
+LL | id_i32(c8);
+ | ------ ^^ expected `i32`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:17:8
+ |
+LL | fn id_i32(n: i32) -> i32 { n }
+ | ^^^^^^ ------
+help: you can convert an `i8` to an `i32`
+ |
+LL | id_i32(c8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:132:12
+ |
+LL | id_i32(c16);
+ | ------ ^^^ expected `i32`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:17:8
+ |
+LL | fn id_i32(n: i32) -> i32 { n }
+ | ^^^^^^ ------
+help: you can convert an `i16` to an `i32`
+ |
+LL | id_i32(c16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:136:12
+ |
+LL | id_i32(c64);
+ | ------ ^^^ expected `i32`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:17:8
+ |
+LL | fn id_i32(n: i32) -> i32 { n }
+ | ^^^^^^ ------
+help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | id_i32(c64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:140:12
+ |
+LL | id_i64(a8);
+ | ------ ^^ expected `i64`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:18:8
+ |
+LL | fn id_i64(n: i64) -> i64 { n }
+ | ^^^^^^ ------
+help: you can convert an `i8` to an `i64`
+ |
+LL | id_i64(a8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:143:12
+ |
+LL | id_i64(a16);
+ | ------ ^^^ expected `i64`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:18:8
+ |
+LL | fn id_i64(n: i64) -> i64 { n }
+ | ^^^^^^ ------
+help: you can convert an `i16` to an `i64`
+ |
+LL | id_i64(a16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:146:12
+ |
+LL | id_i64(a32);
+ | ------ ^^^ expected `i64`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:18:8
+ |
+LL | fn id_i64(n: i64) -> i64 { n }
+ | ^^^^^^ ------
+help: you can convert an `i32` to an `i64`
+ |
+LL | id_i64(a32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:152:11
+ |
+LL | id_u8(b16);
+ | ----- ^^^ expected `u8`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:27:8
+ |
+LL | fn id_u8(n: u8) -> u8 { n }
+ | ^^^^^ -----
+help: you can convert a `u16` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | id_u8(b16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:155:11
+ |
+LL | id_u8(b32);
+ | ----- ^^^ expected `u8`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:27:8
+ |
+LL | fn id_u8(n: u8) -> u8 { n }
+ | ^^^^^ -----
+help: you can convert a `u32` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | id_u8(b32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:158:11
+ |
+LL | id_u8(b64);
+ | ----- ^^^ expected `u8`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:27:8
+ |
+LL | fn id_u8(n: u8) -> u8 { n }
+ | ^^^^^ -----
+help: you can convert a `u64` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | id_u8(b64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:161:11
+ |
+LL | id_u8(bsize);
+ | ----- ^^^^^ expected `u8`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:27:8
+ |
+LL | fn id_u8(n: u8) -> u8 { n }
+ | ^^^^^ -----
+help: you can convert a `usize` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | id_u8(bsize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:165:12
+ |
+LL | id_u16(b8);
+ | ------ ^^ expected `u16`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:28:8
+ |
+LL | fn id_u16(n: u16) -> u16 { n }
+ | ^^^^^^ ------
+help: you can convert a `u8` to a `u16`
+ |
+LL | id_u16(b8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:169:12
+ |
+LL | id_u16(b32);
+ | ------ ^^^ expected `u16`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:28:8
+ |
+LL | fn id_u16(n: u16) -> u16 { n }
+ | ^^^^^^ ------
+help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | id_u16(b32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:172:12
+ |
+LL | id_u16(b64);
+ | ------ ^^^ expected `u16`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:28:8
+ |
+LL | fn id_u16(n: u16) -> u16 { n }
+ | ^^^^^^ ------
+help: you can convert a `u64` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | id_u16(b64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:175:12
+ |
+LL | id_u16(bsize);
+ | ------ ^^^^^ expected `u16`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:28:8
+ |
+LL | fn id_u16(n: u16) -> u16 { n }
+ | ^^^^^^ ------
+help: you can convert a `usize` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | id_u16(bsize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:179:12
+ |
+LL | id_u32(b8);
+ | ------ ^^ expected `u32`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:29:8
+ |
+LL | fn id_u32(n: u32) -> u32 { n }
+ | ^^^^^^ ------
+help: you can convert a `u8` to a `u32`
+ |
+LL | id_u32(b8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:182:12
+ |
+LL | id_u32(b16);
+ | ------ ^^^ expected `u32`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:29:8
+ |
+LL | fn id_u32(n: u32) -> u32 { n }
+ | ^^^^^^ ------
+help: you can convert a `u16` to a `u32`
+ |
+LL | id_u32(b16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:186:12
+ |
+LL | id_u32(b64);
+ | ------ ^^^ expected `u32`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:29:8
+ |
+LL | fn id_u32(n: u32) -> u32 { n }
+ | ^^^^^^ ------
+help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | id_u32(b64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:189:12
+ |
+LL | id_u32(bsize);
+ | ------ ^^^^^ expected `u32`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:29:8
+ |
+LL | fn id_u32(n: u32) -> u32 { n }
+ | ^^^^^^ ------
+help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | id_u32(bsize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:193:12
+ |
+LL | id_u64(b8);
+ | ------ ^^ expected `u64`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:30:8
+ |
+LL | fn id_u64(n: u64) -> u64 { n }
+ | ^^^^^^ ------
+help: you can convert a `u8` to a `u64`
+ |
+LL | id_u64(b8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:196:12
+ |
+LL | id_u64(b16);
+ | ------ ^^^ expected `u64`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:30:8
+ |
+LL | fn id_u64(n: u64) -> u64 { n }
+ | ^^^^^^ ------
+help: you can convert a `u16` to a `u64`
+ |
+LL | id_u64(b16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:199:12
+ |
+LL | id_u64(b32);
+ | ------ ^^^ expected `u64`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:30:8
+ |
+LL | fn id_u64(n: u64) -> u64 { n }
+ | ^^^^^^ ------
+help: you can convert a `u32` to a `u64`
+ |
+LL | id_u64(b32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:203:12
+ |
+LL | id_u64(bsize);
+ | ------ ^^^^^ expected `u64`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:30:8
+ |
+LL | fn id_u64(n: u64) -> u64 { n }
+ | ^^^^^^ ------
+help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | id_u64(bsize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:207:14
+ |
+LL | id_usize(b8);
+ | -------- ^^ expected `usize`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:31:8
+ |
+LL | fn id_usize(n: usize) -> usize { n }
+ | ^^^^^^^^ --------
+help: you can convert a `u8` to a `usize`
+ |
+LL | id_usize(b8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:210:14
+ |
+LL | id_usize(b16);
+ | -------- ^^^ expected `usize`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:31:8
+ |
+LL | fn id_usize(n: usize) -> usize { n }
+ | ^^^^^^^^ --------
+help: you can convert a `u16` to a `usize`
+ |
+LL | id_usize(b16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:213:14
+ |
+LL | id_usize(b32);
+ | -------- ^^^ expected `usize`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:31:8
+ |
+LL | fn id_usize(n: usize) -> usize { n }
+ | ^^^^^^^^ --------
+help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | id_usize(b32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:216:14
+ |
+LL | id_usize(b64);
+ | -------- ^^^ expected `usize`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/integer-literal-suffix-inference.rs:31:8
+ |
+LL | fn id_usize(n: usize) -> usize { n }
+ | ^^^^^^^^ --------
+help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | id_usize(b64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error: aborting due to 52 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/len.rs b/tests/ui/numeric/len.rs
new file mode 100644
index 000000000..a72540988
--- /dev/null
+++ b/tests/ui/numeric/len.rs
@@ -0,0 +1,8 @@
+fn main() {
+ let array = [1, 2, 3];
+ test(array.len()); //~ ERROR mismatched types
+}
+
+fn test(length: u32) {
+ println!("{}", length);
+}
diff --git a/tests/ui/numeric/len.stderr b/tests/ui/numeric/len.stderr
new file mode 100644
index 000000000..55a61b5e4
--- /dev/null
+++ b/tests/ui/numeric/len.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/len.rs:3:10
+ |
+LL | test(array.len());
+ | ---- ^^^^^^^^^^^ expected `u32`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/len.rs:6:4
+ |
+LL | fn test(length: u32) {
+ | ^^^^ -----------
+help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | test(array.len().try_into().unwrap());
+ | ++++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-cast-2.rs b/tests/ui/numeric/numeric-cast-2.rs
new file mode 100644
index 000000000..ad2de5d2b
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast-2.rs
@@ -0,0 +1,11 @@
+fn foo() -> i32 {
+ 4
+}
+fn main() {
+ let x: u16 = foo();
+ //~^ ERROR mismatched types
+ let y: i64 = x + x;
+ //~^ ERROR mismatched types
+ let z: i32 = x + x;
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/numeric/numeric-cast-2.stderr b/tests/ui/numeric/numeric-cast-2.stderr
new file mode 100644
index 000000000..a7b342739
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast-2.stderr
@@ -0,0 +1,42 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-2.rs:5:18
+ |
+LL | let x: u16 = foo();
+ | --- ^^^^^ expected `u16`, found `i32`
+ | |
+ | expected due to this
+ |
+help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | let x: u16 = foo().try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-2.rs:7:18
+ |
+LL | let y: i64 = x + x;
+ | --- ^^^^^ expected `i64`, found `u16`
+ | |
+ | expected due to this
+ |
+help: you can convert a `u16` to an `i64`
+ |
+LL | let y: i64 = (x + x).into();
+ | + ++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-2.rs:9:18
+ |
+LL | let z: i32 = x + x;
+ | --- ^^^^^ expected `i32`, found `u16`
+ | |
+ | expected due to this
+ |
+help: you can convert a `u16` to an `i32`
+ |
+LL | let z: i32 = (x + x).into();
+ | + ++++++++
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-cast-binop.fixed b/tests/ui/numeric/numeric-cast-binop.fixed
new file mode 100644
index 000000000..edb085e71
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast-binop.fixed
@@ -0,0 +1,320 @@
+// run-rustfix
+
+// The `try_into` suggestion doesn't include this, but we do suggest it after applying it
+use std::convert::TryInto;
+
+#[allow(unused_must_use)]
+fn main() {
+ let x_usize: usize = 1;
+ let x_u128: u128 = 2;
+ let x_u64: u64 = 3;
+ let x_u32: u32 = 4;
+ let x_u16: u16 = 5;
+ let x_u8: u8 = 6;
+ let x_isize: isize = 7;
+ let x_i64: i64 = 8;
+ let x_i32: i32 = 9;
+ let x_i16: i16 = 10;
+ let x_i8: i8 = 11;
+ let x_i128: i128 = 12;
+
+ /* u<->u */
+ {
+ u16::from(x_u8) > x_u16;
+ //~^ ERROR mismatched types
+ u32::from(x_u8) > x_u32;
+ //~^ ERROR mismatched types
+ u64::from(x_u8) > x_u64;
+ //~^ ERROR mismatched types
+ u128::from(x_u8) > x_u128;
+ //~^ ERROR mismatched types
+ usize::from(x_u8) > x_usize;
+ //~^ ERROR mismatched types
+
+ x_u16 > x_u8.into();
+ //~^ ERROR mismatched types
+ u32::from(x_u16) > x_u32;
+ //~^ ERROR mismatched types
+ u64::from(x_u16) > x_u64;
+ //~^ ERROR mismatched types
+ u128::from(x_u16) > x_u128;
+ //~^ ERROR mismatched types
+ usize::from(x_u16) > x_usize;
+ //~^ ERROR mismatched types
+
+ x_u32 > x_u8.into();
+ //~^ ERROR mismatched types
+ x_u32 > x_u16.into();
+ //~^ ERROR mismatched types
+ u64::from(x_u32) > x_u64;
+ //~^ ERROR mismatched types
+ u128::from(x_u32) > x_u128;
+ //~^ ERROR mismatched types
+ x_u32 > x_usize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_u64 > x_u8.into();
+ //~^ ERROR mismatched types
+ x_u64 > x_u16.into();
+ //~^ ERROR mismatched types
+ x_u64 > x_u32.into();
+ //~^ ERROR mismatched types
+ u128::from(x_u64) > x_u128;
+ //~^ ERROR mismatched types
+ x_u64 > x_usize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_u128 > x_u8.into();
+ //~^ ERROR mismatched types
+ x_u128 > x_u16.into();
+ //~^ ERROR mismatched types
+ x_u128 > x_u32.into();
+ //~^ ERROR mismatched types
+ x_u128 > x_u64.into();
+ //~^ ERROR mismatched types
+ x_u128 > x_usize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_usize > x_u8.into();
+ //~^ ERROR mismatched types
+ x_usize > x_u16.into();
+ //~^ ERROR mismatched types
+ x_usize > x_u32.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_usize > x_u64.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_usize > x_u128.try_into().unwrap();
+ //~^ ERROR mismatched types
+ }
+
+ /* i<->i */
+ {
+ i16::from(x_i8) > x_i16;
+ //~^ ERROR mismatched types
+ i32::from(x_i8) > x_i32;
+ //~^ ERROR mismatched types
+ i64::from(x_i8) > x_i64;
+ //~^ ERROR mismatched types
+ i128::from(x_i8) > x_i128;
+ //~^ ERROR mismatched types
+ isize::from(x_i8) > x_isize;
+ //~^ ERROR mismatched types
+
+ x_i16 > x_i8.into();
+ //~^ ERROR mismatched types
+ i32::from(x_i16) > x_i32;
+ //~^ ERROR mismatched types
+ i64::from(x_i16) > x_i64;
+ //~^ ERROR mismatched types
+ i128::from(x_i16) > x_i128;
+ //~^ ERROR mismatched types
+ isize::from(x_i16) > x_isize;
+ //~^ ERROR mismatched types
+
+ x_i32 > x_i8.into();
+ //~^ ERROR mismatched types
+ x_i32 > x_i16.into();
+ //~^ ERROR mismatched types
+ i64::from(x_i32) > x_i64;
+ //~^ ERROR mismatched types
+ i128::from(x_i32) > x_i128;
+ //~^ ERROR mismatched types
+ x_i32 > x_isize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_i64 > x_i8.into();
+ //~^ ERROR mismatched types
+ x_i64 > x_i16.into();
+ //~^ ERROR mismatched types
+ x_i64 > x_i32.into();
+ //~^ ERROR mismatched types
+ i128::from(x_i64) > x_i128;
+ //~^ ERROR mismatched types
+ x_i64 > x_isize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_i128 > x_i8.into();
+ //~^ ERROR mismatched types
+ x_i128 > x_i16.into();
+ //~^ ERROR mismatched types
+ x_i128 > x_i32.into();
+ //~^ ERROR mismatched types
+ x_i128 > x_i64.into();
+ //~^ ERROR mismatched types
+ x_i128 > x_isize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_isize > x_i8.into();
+ //~^ ERROR mismatched types
+ x_isize > x_i16.into();
+ //~^ ERROR mismatched types
+ x_isize > x_i32.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_isize > x_i64.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_isize > x_i128.try_into().unwrap();
+ //~^ ERROR mismatched types
+ }
+
+ /* u<->i */
+ {
+ x_u8 > x_i8.try_into().unwrap();
+ //~^ ERROR mismatched types
+ i16::from(x_u8) > x_i16;
+ //~^ ERROR mismatched types
+ i32::from(x_u8) > x_i32;
+ //~^ ERROR mismatched types
+ i64::from(x_u8) > x_i64;
+ //~^ ERROR mismatched types
+ i128::from(x_u8) > x_i128;
+ //~^ ERROR mismatched types
+ isize::from(x_u8) > x_isize;
+ //~^ ERROR mismatched types
+
+ x_u16 > x_i8.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u16 > x_i16.try_into().unwrap();
+ //~^ ERROR mismatched types
+ i32::from(x_u16) > x_i32;
+ //~^ ERROR mismatched types
+ i64::from(x_u16) > x_i64;
+ //~^ ERROR mismatched types
+ i128::from(x_u16) > x_i128;
+ //~^ ERROR mismatched types
+ x_u16 > x_isize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_u32 > x_i8.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u32 > x_i16.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u32 > x_i32.try_into().unwrap();
+ //~^ ERROR mismatched types
+ i64::from(x_u32) > x_i64;
+ //~^ ERROR mismatched types
+ i128::from(x_u32) > x_i128;
+ //~^ ERROR mismatched types
+ x_u32 > x_isize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_u64 > x_i8.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u64 > x_i16.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u64 > x_i32.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u64 > x_i64.try_into().unwrap();
+ //~^ ERROR mismatched types
+ i128::from(x_u64) > x_i128;
+ //~^ ERROR mismatched types
+ x_u64 > x_isize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_u128 > x_i8.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u128 > x_i16.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u128 > x_i32.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u128 > x_i64.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u128 > x_i128.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_u128 > x_isize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_usize > x_i8.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_usize > x_i16.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_usize > x_i32.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_usize > x_i64.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_usize > x_i128.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_usize > x_isize.try_into().unwrap();
+ //~^ ERROR mismatched types
+ }
+
+ /* i<->u */
+ {
+ x_i8 > x_u8.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i8 > x_u16.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i8 > x_u32.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i8 > x_u64.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i8 > x_u128.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i8 > x_usize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_i16 > x_u8.into();
+ //~^ ERROR mismatched types
+ x_i16 > x_u16.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i16 > x_u32.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i16 > x_u64.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i16 > x_u128.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i16 > x_usize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_i32 > x_u8.into();
+ //~^ ERROR mismatched types
+ x_i32 > x_u16.into();
+ //~^ ERROR mismatched types
+ x_i32 > x_u32.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i32 > x_u64.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i32 > x_u128.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i32 > x_usize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_i64 > x_u8.into();
+ //~^ ERROR mismatched types
+ x_i64 > x_u16.into();
+ //~^ ERROR mismatched types
+ x_i64 > x_u32.into();
+ //~^ ERROR mismatched types
+ x_i64 > x_u64.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i64 > x_u128.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i64 > x_usize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_i128 > x_u8.into();
+ //~^ ERROR mismatched types
+ x_i128 > x_u16.into();
+ //~^ ERROR mismatched types
+ x_i128 > x_u32.into();
+ //~^ ERROR mismatched types
+ x_i128 > x_u64.into();
+ //~^ ERROR mismatched types
+ x_i128 > x_u128.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_i128 > x_usize.try_into().unwrap();
+ //~^ ERROR mismatched types
+
+ x_isize > x_u8.into();
+ //~^ ERROR mismatched types
+ x_isize > x_u16.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_isize > x_u32.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_isize > x_u64.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_isize > x_u128.try_into().unwrap();
+ //~^ ERROR mismatched types
+ x_isize > x_usize.try_into().unwrap();
+ //~^ ERROR mismatched types
+ }
+}
diff --git a/tests/ui/numeric/numeric-cast-binop.rs b/tests/ui/numeric/numeric-cast-binop.rs
new file mode 100644
index 000000000..c1ed8de8a
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast-binop.rs
@@ -0,0 +1,320 @@
+// run-rustfix
+
+// The `try_into` suggestion doesn't include this, but we do suggest it after applying it
+use std::convert::TryInto;
+
+#[allow(unused_must_use)]
+fn main() {
+ let x_usize: usize = 1;
+ let x_u128: u128 = 2;
+ let x_u64: u64 = 3;
+ let x_u32: u32 = 4;
+ let x_u16: u16 = 5;
+ let x_u8: u8 = 6;
+ let x_isize: isize = 7;
+ let x_i64: i64 = 8;
+ let x_i32: i32 = 9;
+ let x_i16: i16 = 10;
+ let x_i8: i8 = 11;
+ let x_i128: i128 = 12;
+
+ /* u<->u */
+ {
+ x_u8 > x_u16;
+ //~^ ERROR mismatched types
+ x_u8 > x_u32;
+ //~^ ERROR mismatched types
+ x_u8 > x_u64;
+ //~^ ERROR mismatched types
+ x_u8 > x_u128;
+ //~^ ERROR mismatched types
+ x_u8 > x_usize;
+ //~^ ERROR mismatched types
+
+ x_u16 > x_u8;
+ //~^ ERROR mismatched types
+ x_u16 > x_u32;
+ //~^ ERROR mismatched types
+ x_u16 > x_u64;
+ //~^ ERROR mismatched types
+ x_u16 > x_u128;
+ //~^ ERROR mismatched types
+ x_u16 > x_usize;
+ //~^ ERROR mismatched types
+
+ x_u32 > x_u8;
+ //~^ ERROR mismatched types
+ x_u32 > x_u16;
+ //~^ ERROR mismatched types
+ x_u32 > x_u64;
+ //~^ ERROR mismatched types
+ x_u32 > x_u128;
+ //~^ ERROR mismatched types
+ x_u32 > x_usize;
+ //~^ ERROR mismatched types
+
+ x_u64 > x_u8;
+ //~^ ERROR mismatched types
+ x_u64 > x_u16;
+ //~^ ERROR mismatched types
+ x_u64 > x_u32;
+ //~^ ERROR mismatched types
+ x_u64 > x_u128;
+ //~^ ERROR mismatched types
+ x_u64 > x_usize;
+ //~^ ERROR mismatched types
+
+ x_u128 > x_u8;
+ //~^ ERROR mismatched types
+ x_u128 > x_u16;
+ //~^ ERROR mismatched types
+ x_u128 > x_u32;
+ //~^ ERROR mismatched types
+ x_u128 > x_u64;
+ //~^ ERROR mismatched types
+ x_u128 > x_usize;
+ //~^ ERROR mismatched types
+
+ x_usize > x_u8;
+ //~^ ERROR mismatched types
+ x_usize > x_u16;
+ //~^ ERROR mismatched types
+ x_usize > x_u32;
+ //~^ ERROR mismatched types
+ x_usize > x_u64;
+ //~^ ERROR mismatched types
+ x_usize > x_u128;
+ //~^ ERROR mismatched types
+ }
+
+ /* i<->i */
+ {
+ x_i8 > x_i16;
+ //~^ ERROR mismatched types
+ x_i8 > x_i32;
+ //~^ ERROR mismatched types
+ x_i8 > x_i64;
+ //~^ ERROR mismatched types
+ x_i8 > x_i128;
+ //~^ ERROR mismatched types
+ x_i8 > x_isize;
+ //~^ ERROR mismatched types
+
+ x_i16 > x_i8;
+ //~^ ERROR mismatched types
+ x_i16 > x_i32;
+ //~^ ERROR mismatched types
+ x_i16 > x_i64;
+ //~^ ERROR mismatched types
+ x_i16 > x_i128;
+ //~^ ERROR mismatched types
+ x_i16 > x_isize;
+ //~^ ERROR mismatched types
+
+ x_i32 > x_i8;
+ //~^ ERROR mismatched types
+ x_i32 > x_i16;
+ //~^ ERROR mismatched types
+ x_i32 > x_i64;
+ //~^ ERROR mismatched types
+ x_i32 > x_i128;
+ //~^ ERROR mismatched types
+ x_i32 > x_isize;
+ //~^ ERROR mismatched types
+
+ x_i64 > x_i8;
+ //~^ ERROR mismatched types
+ x_i64 > x_i16;
+ //~^ ERROR mismatched types
+ x_i64 > x_i32;
+ //~^ ERROR mismatched types
+ x_i64 > x_i128;
+ //~^ ERROR mismatched types
+ x_i64 > x_isize;
+ //~^ ERROR mismatched types
+
+ x_i128 > x_i8;
+ //~^ ERROR mismatched types
+ x_i128 > x_i16;
+ //~^ ERROR mismatched types
+ x_i128 > x_i32;
+ //~^ ERROR mismatched types
+ x_i128 > x_i64;
+ //~^ ERROR mismatched types
+ x_i128 > x_isize;
+ //~^ ERROR mismatched types
+
+ x_isize > x_i8;
+ //~^ ERROR mismatched types
+ x_isize > x_i16;
+ //~^ ERROR mismatched types
+ x_isize > x_i32;
+ //~^ ERROR mismatched types
+ x_isize > x_i64;
+ //~^ ERROR mismatched types
+ x_isize > x_i128;
+ //~^ ERROR mismatched types
+ }
+
+ /* u<->i */
+ {
+ x_u8 > x_i8;
+ //~^ ERROR mismatched types
+ x_u8 > x_i16;
+ //~^ ERROR mismatched types
+ x_u8 > x_i32;
+ //~^ ERROR mismatched types
+ x_u8 > x_i64;
+ //~^ ERROR mismatched types
+ x_u8 > x_i128;
+ //~^ ERROR mismatched types
+ x_u8 > x_isize;
+ //~^ ERROR mismatched types
+
+ x_u16 > x_i8;
+ //~^ ERROR mismatched types
+ x_u16 > x_i16;
+ //~^ ERROR mismatched types
+ x_u16 > x_i32;
+ //~^ ERROR mismatched types
+ x_u16 > x_i64;
+ //~^ ERROR mismatched types
+ x_u16 > x_i128;
+ //~^ ERROR mismatched types
+ x_u16 > x_isize;
+ //~^ ERROR mismatched types
+
+ x_u32 > x_i8;
+ //~^ ERROR mismatched types
+ x_u32 > x_i16;
+ //~^ ERROR mismatched types
+ x_u32 > x_i32;
+ //~^ ERROR mismatched types
+ x_u32 > x_i64;
+ //~^ ERROR mismatched types
+ x_u32 > x_i128;
+ //~^ ERROR mismatched types
+ x_u32 > x_isize;
+ //~^ ERROR mismatched types
+
+ x_u64 > x_i8;
+ //~^ ERROR mismatched types
+ x_u64 > x_i16;
+ //~^ ERROR mismatched types
+ x_u64 > x_i32;
+ //~^ ERROR mismatched types
+ x_u64 > x_i64;
+ //~^ ERROR mismatched types
+ x_u64 > x_i128;
+ //~^ ERROR mismatched types
+ x_u64 > x_isize;
+ //~^ ERROR mismatched types
+
+ x_u128 > x_i8;
+ //~^ ERROR mismatched types
+ x_u128 > x_i16;
+ //~^ ERROR mismatched types
+ x_u128 > x_i32;
+ //~^ ERROR mismatched types
+ x_u128 > x_i64;
+ //~^ ERROR mismatched types
+ x_u128 > x_i128;
+ //~^ ERROR mismatched types
+ x_u128 > x_isize;
+ //~^ ERROR mismatched types
+
+ x_usize > x_i8;
+ //~^ ERROR mismatched types
+ x_usize > x_i16;
+ //~^ ERROR mismatched types
+ x_usize > x_i32;
+ //~^ ERROR mismatched types
+ x_usize > x_i64;
+ //~^ ERROR mismatched types
+ x_usize > x_i128;
+ //~^ ERROR mismatched types
+ x_usize > x_isize;
+ //~^ ERROR mismatched types
+ }
+
+ /* i<->u */
+ {
+ x_i8 > x_u8;
+ //~^ ERROR mismatched types
+ x_i8 > x_u16;
+ //~^ ERROR mismatched types
+ x_i8 > x_u32;
+ //~^ ERROR mismatched types
+ x_i8 > x_u64;
+ //~^ ERROR mismatched types
+ x_i8 > x_u128;
+ //~^ ERROR mismatched types
+ x_i8 > x_usize;
+ //~^ ERROR mismatched types
+
+ x_i16 > x_u8;
+ //~^ ERROR mismatched types
+ x_i16 > x_u16;
+ //~^ ERROR mismatched types
+ x_i16 > x_u32;
+ //~^ ERROR mismatched types
+ x_i16 > x_u64;
+ //~^ ERROR mismatched types
+ x_i16 > x_u128;
+ //~^ ERROR mismatched types
+ x_i16 > x_usize;
+ //~^ ERROR mismatched types
+
+ x_i32 > x_u8;
+ //~^ ERROR mismatched types
+ x_i32 > x_u16;
+ //~^ ERROR mismatched types
+ x_i32 > x_u32;
+ //~^ ERROR mismatched types
+ x_i32 > x_u64;
+ //~^ ERROR mismatched types
+ x_i32 > x_u128;
+ //~^ ERROR mismatched types
+ x_i32 > x_usize;
+ //~^ ERROR mismatched types
+
+ x_i64 > x_u8;
+ //~^ ERROR mismatched types
+ x_i64 > x_u16;
+ //~^ ERROR mismatched types
+ x_i64 > x_u32;
+ //~^ ERROR mismatched types
+ x_i64 > x_u64;
+ //~^ ERROR mismatched types
+ x_i64 > x_u128;
+ //~^ ERROR mismatched types
+ x_i64 > x_usize;
+ //~^ ERROR mismatched types
+
+ x_i128 > x_u8;
+ //~^ ERROR mismatched types
+ x_i128 > x_u16;
+ //~^ ERROR mismatched types
+ x_i128 > x_u32;
+ //~^ ERROR mismatched types
+ x_i128 > x_u64;
+ //~^ ERROR mismatched types
+ x_i128 > x_u128;
+ //~^ ERROR mismatched types
+ x_i128 > x_usize;
+ //~^ ERROR mismatched types
+
+ x_isize > x_u8;
+ //~^ ERROR mismatched types
+ x_isize > x_u16;
+ //~^ ERROR mismatched types
+ x_isize > x_u32;
+ //~^ ERROR mismatched types
+ x_isize > x_u64;
+ //~^ ERROR mismatched types
+ x_isize > x_u128;
+ //~^ ERROR mismatched types
+ x_isize > x_usize;
+ //~^ ERROR mismatched types
+ }
+}
diff --git a/tests/ui/numeric/numeric-cast-binop.stderr b/tests/ui/numeric/numeric-cast-binop.stderr
new file mode 100644
index 000000000..d5213e3f5
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast-binop.stderr
@@ -0,0 +1,1719 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:23:16
+ |
+LL | x_u8 > x_u16;
+ | ---- ^^^^^ expected `u8`, found `u16`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `u16`, matching the type of `x_u16`
+ |
+LL | u16::from(x_u8) > x_u16;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:25:16
+ |
+LL | x_u8 > x_u32;
+ | ---- ^^^^^ expected `u8`, found `u32`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `u32`, matching the type of `x_u32`
+ |
+LL | u32::from(x_u8) > x_u32;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:27:16
+ |
+LL | x_u8 > x_u64;
+ | ---- ^^^^^ expected `u8`, found `u64`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `u64`, matching the type of `x_u64`
+ |
+LL | u64::from(x_u8) > x_u64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:29:16
+ |
+LL | x_u8 > x_u128;
+ | ---- ^^^^^^ expected `u8`, found `u128`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `u128`, matching the type of `x_u128`
+ |
+LL | u128::from(x_u8) > x_u128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:31:16
+ |
+LL | x_u8 > x_usize;
+ | ---- ^^^^^^^ expected `u8`, found `usize`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `usize`, matching the type of `x_usize`
+ |
+LL | usize::from(x_u8) > x_usize;
+ | ++++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:34:17
+ |
+LL | x_u16 > x_u8;
+ | ----- ^^^^ expected `u16`, found `u8`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert a `u8` to a `u16`
+ |
+LL | x_u16 > x_u8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:36:17
+ |
+LL | x_u16 > x_u32;
+ | ----- ^^^^^ expected `u16`, found `u32`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert `x_u16` from `u16` to `u32`, matching the type of `x_u32`
+ |
+LL | u32::from(x_u16) > x_u32;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:38:17
+ |
+LL | x_u16 > x_u64;
+ | ----- ^^^^^ expected `u16`, found `u64`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert `x_u16` from `u16` to `u64`, matching the type of `x_u64`
+ |
+LL | u64::from(x_u16) > x_u64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:40:17
+ |
+LL | x_u16 > x_u128;
+ | ----- ^^^^^^ expected `u16`, found `u128`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert `x_u16` from `u16` to `u128`, matching the type of `x_u128`
+ |
+LL | u128::from(x_u16) > x_u128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:42:17
+ |
+LL | x_u16 > x_usize;
+ | ----- ^^^^^^^ expected `u16`, found `usize`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert `x_u16` from `u16` to `usize`, matching the type of `x_usize`
+ |
+LL | usize::from(x_u16) > x_usize;
+ | ++++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:45:17
+ |
+LL | x_u32 > x_u8;
+ | ----- ^^^^ expected `u32`, found `u8`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert a `u8` to a `u32`
+ |
+LL | x_u32 > x_u8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:47:17
+ |
+LL | x_u32 > x_u16;
+ | ----- ^^^^^ expected `u32`, found `u16`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert a `u16` to a `u32`
+ |
+LL | x_u32 > x_u16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:49:17
+ |
+LL | x_u32 > x_u64;
+ | ----- ^^^^^ expected `u32`, found `u64`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert `x_u32` from `u32` to `u64`, matching the type of `x_u64`
+ |
+LL | u64::from(x_u32) > x_u64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:51:17
+ |
+LL | x_u32 > x_u128;
+ | ----- ^^^^^^ expected `u32`, found `u128`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert `x_u32` from `u32` to `u128`, matching the type of `x_u128`
+ |
+LL | u128::from(x_u32) > x_u128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:53:17
+ |
+LL | x_u32 > x_usize;
+ | ----- ^^^^^^^ expected `u32`, found `usize`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | x_u32 > x_usize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:56:17
+ |
+LL | x_u64 > x_u8;
+ | ----- ^^^^ expected `u64`, found `u8`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert a `u8` to a `u64`
+ |
+LL | x_u64 > x_u8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:58:17
+ |
+LL | x_u64 > x_u16;
+ | ----- ^^^^^ expected `u64`, found `u16`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert a `u16` to a `u64`
+ |
+LL | x_u64 > x_u16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:60:17
+ |
+LL | x_u64 > x_u32;
+ | ----- ^^^^^ expected `u64`, found `u32`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert a `u32` to a `u64`
+ |
+LL | x_u64 > x_u32.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:62:17
+ |
+LL | x_u64 > x_u128;
+ | ----- ^^^^^^ expected `u64`, found `u128`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert `x_u64` from `u64` to `u128`, matching the type of `x_u128`
+ |
+LL | u128::from(x_u64) > x_u128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:64:17
+ |
+LL | x_u64 > x_usize;
+ | ----- ^^^^^^^ expected `u64`, found `usize`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | x_u64 > x_usize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:67:18
+ |
+LL | x_u128 > x_u8;
+ | ------ ^^^^ expected `u128`, found `u8`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert a `u8` to a `u128`
+ |
+LL | x_u128 > x_u8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:69:18
+ |
+LL | x_u128 > x_u16;
+ | ------ ^^^^^ expected `u128`, found `u16`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert a `u16` to a `u128`
+ |
+LL | x_u128 > x_u16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:71:18
+ |
+LL | x_u128 > x_u32;
+ | ------ ^^^^^ expected `u128`, found `u32`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert a `u32` to a `u128`
+ |
+LL | x_u128 > x_u32.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:73:18
+ |
+LL | x_u128 > x_u64;
+ | ------ ^^^^^ expected `u128`, found `u64`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert a `u64` to a `u128`
+ |
+LL | x_u128 > x_u64.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:75:18
+ |
+LL | x_u128 > x_usize;
+ | ------ ^^^^^^^ expected `u128`, found `usize`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert a `usize` to a `u128` and panic if the converted value doesn't fit
+ |
+LL | x_u128 > x_usize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:78:19
+ |
+LL | x_usize > x_u8;
+ | ------- ^^^^ expected `usize`, found `u8`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert a `u8` to a `usize`
+ |
+LL | x_usize > x_u8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:80:19
+ |
+LL | x_usize > x_u16;
+ | ------- ^^^^^ expected `usize`, found `u16`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert a `u16` to a `usize`
+ |
+LL | x_usize > x_u16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:82:19
+ |
+LL | x_usize > x_u32;
+ | ------- ^^^^^ expected `usize`, found `u32`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | x_usize > x_u32.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:84:19
+ |
+LL | x_usize > x_u64;
+ | ------- ^^^^^ expected `usize`, found `u64`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | x_usize > x_u64.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:86:19
+ |
+LL | x_usize > x_u128;
+ | ------- ^^^^^^ expected `usize`, found `u128`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert a `u128` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | x_usize > x_u128.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:92:16
+ |
+LL | x_i8 > x_i16;
+ | ---- ^^^^^ expected `i8`, found `i16`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert `x_i8` from `i8` to `i16`, matching the type of `x_i16`
+ |
+LL | i16::from(x_i8) > x_i16;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:94:16
+ |
+LL | x_i8 > x_i32;
+ | ---- ^^^^^ expected `i8`, found `i32`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert `x_i8` from `i8` to `i32`, matching the type of `x_i32`
+ |
+LL | i32::from(x_i8) > x_i32;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:96:16
+ |
+LL | x_i8 > x_i64;
+ | ---- ^^^^^ expected `i8`, found `i64`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert `x_i8` from `i8` to `i64`, matching the type of `x_i64`
+ |
+LL | i64::from(x_i8) > x_i64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:98:16
+ |
+LL | x_i8 > x_i128;
+ | ---- ^^^^^^ expected `i8`, found `i128`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert `x_i8` from `i8` to `i128`, matching the type of `x_i128`
+ |
+LL | i128::from(x_i8) > x_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:100:16
+ |
+LL | x_i8 > x_isize;
+ | ---- ^^^^^^^ expected `i8`, found `isize`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert `x_i8` from `i8` to `isize`, matching the type of `x_isize`
+ |
+LL | isize::from(x_i8) > x_isize;
+ | ++++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:103:17
+ |
+LL | x_i16 > x_i8;
+ | ----- ^^^^ expected `i16`, found `i8`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert an `i8` to an `i16`
+ |
+LL | x_i16 > x_i8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:105:17
+ |
+LL | x_i16 > x_i32;
+ | ----- ^^^^^ expected `i16`, found `i32`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert `x_i16` from `i16` to `i32`, matching the type of `x_i32`
+ |
+LL | i32::from(x_i16) > x_i32;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:107:17
+ |
+LL | x_i16 > x_i64;
+ | ----- ^^^^^ expected `i16`, found `i64`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert `x_i16` from `i16` to `i64`, matching the type of `x_i64`
+ |
+LL | i64::from(x_i16) > x_i64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:109:17
+ |
+LL | x_i16 > x_i128;
+ | ----- ^^^^^^ expected `i16`, found `i128`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert `x_i16` from `i16` to `i128`, matching the type of `x_i128`
+ |
+LL | i128::from(x_i16) > x_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:111:17
+ |
+LL | x_i16 > x_isize;
+ | ----- ^^^^^^^ expected `i16`, found `isize`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert `x_i16` from `i16` to `isize`, matching the type of `x_isize`
+ |
+LL | isize::from(x_i16) > x_isize;
+ | ++++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:114:17
+ |
+LL | x_i32 > x_i8;
+ | ----- ^^^^ expected `i32`, found `i8`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert an `i8` to an `i32`
+ |
+LL | x_i32 > x_i8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:116:17
+ |
+LL | x_i32 > x_i16;
+ | ----- ^^^^^ expected `i32`, found `i16`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert an `i16` to an `i32`
+ |
+LL | x_i32 > x_i16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:118:17
+ |
+LL | x_i32 > x_i64;
+ | ----- ^^^^^ expected `i32`, found `i64`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert `x_i32` from `i32` to `i64`, matching the type of `x_i64`
+ |
+LL | i64::from(x_i32) > x_i64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:120:17
+ |
+LL | x_i32 > x_i128;
+ | ----- ^^^^^^ expected `i32`, found `i128`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert `x_i32` from `i32` to `i128`, matching the type of `x_i128`
+ |
+LL | i128::from(x_i32) > x_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:122:17
+ |
+LL | x_i32 > x_isize;
+ | ----- ^^^^^^^ expected `i32`, found `isize`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | x_i32 > x_isize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:125:17
+ |
+LL | x_i64 > x_i8;
+ | ----- ^^^^ expected `i64`, found `i8`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert an `i8` to an `i64`
+ |
+LL | x_i64 > x_i8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:127:17
+ |
+LL | x_i64 > x_i16;
+ | ----- ^^^^^ expected `i64`, found `i16`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert an `i16` to an `i64`
+ |
+LL | x_i64 > x_i16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:129:17
+ |
+LL | x_i64 > x_i32;
+ | ----- ^^^^^ expected `i64`, found `i32`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert an `i32` to an `i64`
+ |
+LL | x_i64 > x_i32.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:131:17
+ |
+LL | x_i64 > x_i128;
+ | ----- ^^^^^^ expected `i64`, found `i128`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert `x_i64` from `i64` to `i128`, matching the type of `x_i128`
+ |
+LL | i128::from(x_i64) > x_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:133:17
+ |
+LL | x_i64 > x_isize;
+ | ----- ^^^^^^^ expected `i64`, found `isize`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit
+ |
+LL | x_i64 > x_isize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:136:18
+ |
+LL | x_i128 > x_i8;
+ | ------ ^^^^ expected `i128`, found `i8`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert an `i8` to an `i128`
+ |
+LL | x_i128 > x_i8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:138:18
+ |
+LL | x_i128 > x_i16;
+ | ------ ^^^^^ expected `i128`, found `i16`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert an `i16` to an `i128`
+ |
+LL | x_i128 > x_i16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:140:18
+ |
+LL | x_i128 > x_i32;
+ | ------ ^^^^^ expected `i128`, found `i32`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert an `i32` to an `i128`
+ |
+LL | x_i128 > x_i32.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:142:18
+ |
+LL | x_i128 > x_i64;
+ | ------ ^^^^^ expected `i128`, found `i64`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert an `i64` to an `i128`
+ |
+LL | x_i128 > x_i64.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:144:18
+ |
+LL | x_i128 > x_isize;
+ | ------ ^^^^^^^ expected `i128`, found `isize`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert an `isize` to an `i128` and panic if the converted value doesn't fit
+ |
+LL | x_i128 > x_isize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:147:19
+ |
+LL | x_isize > x_i8;
+ | ------- ^^^^ expected `isize`, found `i8`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert an `i8` to an `isize`
+ |
+LL | x_isize > x_i8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:149:19
+ |
+LL | x_isize > x_i16;
+ | ------- ^^^^^ expected `isize`, found `i16`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert an `i16` to an `isize`
+ |
+LL | x_isize > x_i16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:151:19
+ |
+LL | x_isize > x_i32;
+ | ------- ^^^^^ expected `isize`, found `i32`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | x_isize > x_i32.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:153:19
+ |
+LL | x_isize > x_i64;
+ | ------- ^^^^^ expected `isize`, found `i64`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | x_isize > x_i64.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:155:19
+ |
+LL | x_isize > x_i128;
+ | ------- ^^^^^^ expected `isize`, found `i128`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert an `i128` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | x_isize > x_i128.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:161:16
+ |
+LL | x_u8 > x_i8;
+ | ---- ^^^^ expected `u8`, found `i8`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert an `i8` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | x_u8 > x_i8.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:163:16
+ |
+LL | x_u8 > x_i16;
+ | ---- ^^^^^ expected `u8`, found `i16`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `i16`, matching the type of `x_i16`
+ |
+LL | i16::from(x_u8) > x_i16;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:165:16
+ |
+LL | x_u8 > x_i32;
+ | ---- ^^^^^ expected `u8`, found `i32`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `i32`, matching the type of `x_i32`
+ |
+LL | i32::from(x_u8) > x_i32;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:167:16
+ |
+LL | x_u8 > x_i64;
+ | ---- ^^^^^ expected `u8`, found `i64`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `i64`, matching the type of `x_i64`
+ |
+LL | i64::from(x_u8) > x_i64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:169:16
+ |
+LL | x_u8 > x_i128;
+ | ---- ^^^^^^ expected `u8`, found `i128`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `i128`, matching the type of `x_i128`
+ |
+LL | i128::from(x_u8) > x_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:171:16
+ |
+LL | x_u8 > x_isize;
+ | ---- ^^^^^^^ expected `u8`, found `isize`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `isize`, matching the type of `x_isize`
+ |
+LL | isize::from(x_u8) > x_isize;
+ | ++++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:174:17
+ |
+LL | x_u16 > x_i8;
+ | ----- ^^^^ expected `u16`, found `i8`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert an `i8` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | x_u16 > x_i8.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:176:17
+ |
+LL | x_u16 > x_i16;
+ | ----- ^^^^^ expected `u16`, found `i16`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert an `i16` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | x_u16 > x_i16.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:178:17
+ |
+LL | x_u16 > x_i32;
+ | ----- ^^^^^ expected `u16`, found `i32`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert `x_u16` from `u16` to `i32`, matching the type of `x_i32`
+ |
+LL | i32::from(x_u16) > x_i32;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:180:17
+ |
+LL | x_u16 > x_i64;
+ | ----- ^^^^^ expected `u16`, found `i64`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert `x_u16` from `u16` to `i64`, matching the type of `x_i64`
+ |
+LL | i64::from(x_u16) > x_i64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:182:17
+ |
+LL | x_u16 > x_i128;
+ | ----- ^^^^^^ expected `u16`, found `i128`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert `x_u16` from `u16` to `i128`, matching the type of `x_i128`
+ |
+LL | i128::from(x_u16) > x_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:184:17
+ |
+LL | x_u16 > x_isize;
+ | ----- ^^^^^^^ expected `u16`, found `isize`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | x_u16 > x_isize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:187:17
+ |
+LL | x_u32 > x_i8;
+ | ----- ^^^^ expected `u32`, found `i8`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert an `i8` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | x_u32 > x_i8.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:189:17
+ |
+LL | x_u32 > x_i16;
+ | ----- ^^^^^ expected `u32`, found `i16`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert an `i16` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | x_u32 > x_i16.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:191:17
+ |
+LL | x_u32 > x_i32;
+ | ----- ^^^^^ expected `u32`, found `i32`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | x_u32 > x_i32.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:193:17
+ |
+LL | x_u32 > x_i64;
+ | ----- ^^^^^ expected `u32`, found `i64`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert `x_u32` from `u32` to `i64`, matching the type of `x_i64`
+ |
+LL | i64::from(x_u32) > x_i64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:195:17
+ |
+LL | x_u32 > x_i128;
+ | ----- ^^^^^^ expected `u32`, found `i128`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert `x_u32` from `u32` to `i128`, matching the type of `x_i128`
+ |
+LL | i128::from(x_u32) > x_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:197:17
+ |
+LL | x_u32 > x_isize;
+ | ----- ^^^^^^^ expected `u32`, found `isize`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert an `isize` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | x_u32 > x_isize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:200:17
+ |
+LL | x_u64 > x_i8;
+ | ----- ^^^^ expected `u64`, found `i8`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert an `i8` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | x_u64 > x_i8.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:202:17
+ |
+LL | x_u64 > x_i16;
+ | ----- ^^^^^ expected `u64`, found `i16`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert an `i16` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | x_u64 > x_i16.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:204:17
+ |
+LL | x_u64 > x_i32;
+ | ----- ^^^^^ expected `u64`, found `i32`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert an `i32` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | x_u64 > x_i32.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:206:17
+ |
+LL | x_u64 > x_i64;
+ | ----- ^^^^^ expected `u64`, found `i64`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | x_u64 > x_i64.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:208:17
+ |
+LL | x_u64 > x_i128;
+ | ----- ^^^^^^ expected `u64`, found `i128`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert `x_u64` from `u64` to `i128`, matching the type of `x_i128`
+ |
+LL | i128::from(x_u64) > x_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:210:17
+ |
+LL | x_u64 > x_isize;
+ | ----- ^^^^^^^ expected `u64`, found `isize`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert an `isize` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | x_u64 > x_isize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:213:18
+ |
+LL | x_u128 > x_i8;
+ | ------ ^^^^ expected `u128`, found `i8`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert an `i8` to a `u128` and panic if the converted value doesn't fit
+ |
+LL | x_u128 > x_i8.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:215:18
+ |
+LL | x_u128 > x_i16;
+ | ------ ^^^^^ expected `u128`, found `i16`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert an `i16` to a `u128` and panic if the converted value doesn't fit
+ |
+LL | x_u128 > x_i16.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:217:18
+ |
+LL | x_u128 > x_i32;
+ | ------ ^^^^^ expected `u128`, found `i32`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert an `i32` to a `u128` and panic if the converted value doesn't fit
+ |
+LL | x_u128 > x_i32.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:219:18
+ |
+LL | x_u128 > x_i64;
+ | ------ ^^^^^ expected `u128`, found `i64`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert an `i64` to a `u128` and panic if the converted value doesn't fit
+ |
+LL | x_u128 > x_i64.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:221:18
+ |
+LL | x_u128 > x_i128;
+ | ------ ^^^^^^ expected `u128`, found `i128`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert an `i128` to a `u128` and panic if the converted value doesn't fit
+ |
+LL | x_u128 > x_i128.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:223:18
+ |
+LL | x_u128 > x_isize;
+ | ------ ^^^^^^^ expected `u128`, found `isize`
+ | |
+ | expected because this is `u128`
+ |
+help: you can convert an `isize` to a `u128` and panic if the converted value doesn't fit
+ |
+LL | x_u128 > x_isize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:226:19
+ |
+LL | x_usize > x_i8;
+ | ------- ^^^^ expected `usize`, found `i8`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert an `i8` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | x_usize > x_i8.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:228:19
+ |
+LL | x_usize > x_i16;
+ | ------- ^^^^^ expected `usize`, found `i16`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert an `i16` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | x_usize > x_i16.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:230:19
+ |
+LL | x_usize > x_i32;
+ | ------- ^^^^^ expected `usize`, found `i32`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | x_usize > x_i32.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:232:19
+ |
+LL | x_usize > x_i64;
+ | ------- ^^^^^ expected `usize`, found `i64`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert an `i64` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | x_usize > x_i64.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:234:19
+ |
+LL | x_usize > x_i128;
+ | ------- ^^^^^^ expected `usize`, found `i128`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert an `i128` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | x_usize > x_i128.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:236:19
+ |
+LL | x_usize > x_isize;
+ | ------- ^^^^^^^ expected `usize`, found `isize`
+ | |
+ | expected because this is `usize`
+ |
+help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | x_usize > x_isize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:242:16
+ |
+LL | x_i8 > x_u8;
+ | ---- ^^^^ expected `i8`, found `u8`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | x_i8 > x_u8.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:244:16
+ |
+LL | x_i8 > x_u16;
+ | ---- ^^^^^ expected `i8`, found `u16`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert a `u16` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | x_i8 > x_u16.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:246:16
+ |
+LL | x_i8 > x_u32;
+ | ---- ^^^^^ expected `i8`, found `u32`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert a `u32` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | x_i8 > x_u32.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:248:16
+ |
+LL | x_i8 > x_u64;
+ | ---- ^^^^^ expected `i8`, found `u64`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert a `u64` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | x_i8 > x_u64.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:250:16
+ |
+LL | x_i8 > x_u128;
+ | ---- ^^^^^^ expected `i8`, found `u128`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert a `u128` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | x_i8 > x_u128.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:252:16
+ |
+LL | x_i8 > x_usize;
+ | ---- ^^^^^^^ expected `i8`, found `usize`
+ | |
+ | expected because this is `i8`
+ |
+help: you can convert a `usize` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | x_i8 > x_usize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:255:17
+ |
+LL | x_i16 > x_u8;
+ | ----- ^^^^ expected `i16`, found `u8`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert a `u8` to an `i16`
+ |
+LL | x_i16 > x_u8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:257:17
+ |
+LL | x_i16 > x_u16;
+ | ----- ^^^^^ expected `i16`, found `u16`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert a `u16` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | x_i16 > x_u16.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:259:17
+ |
+LL | x_i16 > x_u32;
+ | ----- ^^^^^ expected `i16`, found `u32`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert a `u32` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | x_i16 > x_u32.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:261:17
+ |
+LL | x_i16 > x_u64;
+ | ----- ^^^^^ expected `i16`, found `u64`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert a `u64` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | x_i16 > x_u64.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:263:17
+ |
+LL | x_i16 > x_u128;
+ | ----- ^^^^^^ expected `i16`, found `u128`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert a `u128` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | x_i16 > x_u128.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:265:17
+ |
+LL | x_i16 > x_usize;
+ | ----- ^^^^^^^ expected `i16`, found `usize`
+ | |
+ | expected because this is `i16`
+ |
+help: you can convert a `usize` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | x_i16 > x_usize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:268:17
+ |
+LL | x_i32 > x_u8;
+ | ----- ^^^^ expected `i32`, found `u8`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert a `u8` to an `i32`
+ |
+LL | x_i32 > x_u8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:270:17
+ |
+LL | x_i32 > x_u16;
+ | ----- ^^^^^ expected `i32`, found `u16`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert a `u16` to an `i32`
+ |
+LL | x_i32 > x_u16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:272:17
+ |
+LL | x_i32 > x_u32;
+ | ----- ^^^^^ expected `i32`, found `u32`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | x_i32 > x_u32.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:274:17
+ |
+LL | x_i32 > x_u64;
+ | ----- ^^^^^ expected `i32`, found `u64`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | x_i32 > x_u64.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:276:17
+ |
+LL | x_i32 > x_u128;
+ | ----- ^^^^^^ expected `i32`, found `u128`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert a `u128` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | x_i32 > x_u128.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:278:17
+ |
+LL | x_i32 > x_usize;
+ | ----- ^^^^^^^ expected `i32`, found `usize`
+ | |
+ | expected because this is `i32`
+ |
+help: you can convert a `usize` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | x_i32 > x_usize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:281:17
+ |
+LL | x_i64 > x_u8;
+ | ----- ^^^^ expected `i64`, found `u8`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert a `u8` to an `i64`
+ |
+LL | x_i64 > x_u8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:283:17
+ |
+LL | x_i64 > x_u16;
+ | ----- ^^^^^ expected `i64`, found `u16`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert a `u16` to an `i64`
+ |
+LL | x_i64 > x_u16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:285:17
+ |
+LL | x_i64 > x_u32;
+ | ----- ^^^^^ expected `i64`, found `u32`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert a `u32` to an `i64`
+ |
+LL | x_i64 > x_u32.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:287:17
+ |
+LL | x_i64 > x_u64;
+ | ----- ^^^^^ expected `i64`, found `u64`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert a `u64` to an `i64` and panic if the converted value doesn't fit
+ |
+LL | x_i64 > x_u64.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:289:17
+ |
+LL | x_i64 > x_u128;
+ | ----- ^^^^^^ expected `i64`, found `u128`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert a `u128` to an `i64` and panic if the converted value doesn't fit
+ |
+LL | x_i64 > x_u128.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:291:17
+ |
+LL | x_i64 > x_usize;
+ | ----- ^^^^^^^ expected `i64`, found `usize`
+ | |
+ | expected because this is `i64`
+ |
+help: you can convert a `usize` to an `i64` and panic if the converted value doesn't fit
+ |
+LL | x_i64 > x_usize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:294:18
+ |
+LL | x_i128 > x_u8;
+ | ------ ^^^^ expected `i128`, found `u8`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert a `u8` to an `i128`
+ |
+LL | x_i128 > x_u8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:296:18
+ |
+LL | x_i128 > x_u16;
+ | ------ ^^^^^ expected `i128`, found `u16`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert a `u16` to an `i128`
+ |
+LL | x_i128 > x_u16.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:298:18
+ |
+LL | x_i128 > x_u32;
+ | ------ ^^^^^ expected `i128`, found `u32`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert a `u32` to an `i128`
+ |
+LL | x_i128 > x_u32.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:300:18
+ |
+LL | x_i128 > x_u64;
+ | ------ ^^^^^ expected `i128`, found `u64`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert a `u64` to an `i128`
+ |
+LL | x_i128 > x_u64.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:302:18
+ |
+LL | x_i128 > x_u128;
+ | ------ ^^^^^^ expected `i128`, found `u128`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert a `u128` to an `i128` and panic if the converted value doesn't fit
+ |
+LL | x_i128 > x_u128.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:304:18
+ |
+LL | x_i128 > x_usize;
+ | ------ ^^^^^^^ expected `i128`, found `usize`
+ | |
+ | expected because this is `i128`
+ |
+help: you can convert a `usize` to an `i128` and panic if the converted value doesn't fit
+ |
+LL | x_i128 > x_usize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:307:19
+ |
+LL | x_isize > x_u8;
+ | ------- ^^^^ expected `isize`, found `u8`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert a `u8` to an `isize`
+ |
+LL | x_isize > x_u8.into();
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:309:19
+ |
+LL | x_isize > x_u16;
+ | ------- ^^^^^ expected `isize`, found `u16`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert a `u16` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | x_isize > x_u16.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:311:19
+ |
+LL | x_isize > x_u32;
+ | ------- ^^^^^ expected `isize`, found `u32`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert a `u32` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | x_isize > x_u32.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:313:19
+ |
+LL | x_isize > x_u64;
+ | ------- ^^^^^ expected `isize`, found `u64`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert a `u64` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | x_isize > x_u64.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:315:19
+ |
+LL | x_isize > x_u128;
+ | ------- ^^^^^^ expected `isize`, found `u128`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert a `u128` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | x_isize > x_u128.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-binop.rs:317:19
+ |
+LL | x_isize > x_usize;
+ | ------- ^^^^^^^ expected `isize`, found `usize`
+ | |
+ | expected because this is `isize`
+ |
+help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | x_isize > x_usize.try_into().unwrap();
+ | ++++++++++++++++++++
+
+error: aborting due to 132 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-cast-no-fix.rs b/tests/ui/numeric/numeric-cast-no-fix.rs
new file mode 100644
index 000000000..63e5f098a
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast-no-fix.rs
@@ -0,0 +1,87 @@
+#[allow(unused_must_use)]
+fn main() {
+ let x_usize: usize = 1;
+ let x_u128: u128 = 2;
+ let x_u64: u64 = 3;
+ let x_u32: u32 = 4;
+ let x_u16: u16 = 5;
+ let x_u8: u8 = 6;
+
+ x_usize > -1_isize;
+ //~^ ERROR mismatched types
+ x_u128 > -1_isize;
+ //~^ ERROR mismatched types
+ x_u64 > -1_isize;
+ //~^ ERROR mismatched types
+ x_u32 > -1_isize;
+ //~^ ERROR mismatched types
+ x_u16 > -1_isize;
+ //~^ ERROR mismatched types
+ x_u8 > -1_isize;
+ //~^ ERROR mismatched types
+
+ x_usize > -1_i128;
+ //~^ ERROR mismatched types
+ x_u128 > -1_i128;
+ //~^ ERROR mismatched types
+ x_u64 > -1_i128;
+ //~^ ERROR mismatched types
+ x_u32 > -1_i128;
+ //~^ ERROR mismatched types
+ x_u16 > -1_i128;
+ //~^ ERROR mismatched types
+ x_u8 > -1_i128;
+ //~^ ERROR mismatched types
+
+ x_usize > -1_i64;
+ //~^ ERROR mismatched types
+ x_u128 > -1_i64;
+ //~^ ERROR mismatched types
+ x_u64 > -1_i64;
+ //~^ ERROR mismatched types
+ x_u32 > -1_i64;
+ //~^ ERROR mismatched types
+ x_u16 > -1_i64;
+ //~^ ERROR mismatched types
+ x_u8 > -1_i64;
+ //~^ ERROR mismatched types
+
+ x_usize > -1_i32;
+ //~^ ERROR mismatched types
+ x_u128 > -1_i32;
+ //~^ ERROR mismatched types
+ x_u64 > -1_i32;
+ //~^ ERROR mismatched types
+ x_u32 > -1_i32;
+ //~^ ERROR mismatched types
+ x_u16 > -1_i32;
+ //~^ ERROR mismatched types
+ x_u8 > -1_i32;
+ //~^ ERROR mismatched types
+
+ x_usize > -1_i16;
+ //~^ ERROR mismatched types
+ x_u128 > -1_i16;
+ //~^ ERROR mismatched types
+ x_u64 > -1_i16;
+ //~^ ERROR mismatched types
+ x_u32 > -1_i16;
+ //~^ ERROR mismatched types
+ x_u16 > -1_i16;
+ //~^ ERROR mismatched types
+ x_u8 > -1_i16;
+ //~^ ERROR mismatched types
+
+ x_usize > -1_i8;
+ //~^ ERROR mismatched types
+ x_u128 > -1_i8;
+ //~^ ERROR mismatched types
+ x_u64 > -1_i8;
+ //~^ ERROR mismatched types
+ x_u32 > -1_i8;
+ //~^ ERROR mismatched types
+ x_u16 > -1_i8;
+ //~^ ERROR mismatched types
+ x_u8 > -1_i8;
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/numeric/numeric-cast-no-fix.stderr b/tests/ui/numeric/numeric-cast-no-fix.stderr
new file mode 100644
index 000000000..c244e479d
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast-no-fix.stderr
@@ -0,0 +1,396 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:10:15
+ |
+LL | x_usize > -1_isize;
+ | ------- ^^^^^^^^ expected `usize`, found `isize`
+ | |
+ | expected because this is `usize`
+ |
+ = note: `-1_isize` cannot fit into type `usize`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:12:14
+ |
+LL | x_u128 > -1_isize;
+ | ------ ^^^^^^^^ expected `u128`, found `isize`
+ | |
+ | expected because this is `u128`
+ |
+ = note: `-1_isize` cannot fit into type `u128`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:14:13
+ |
+LL | x_u64 > -1_isize;
+ | ----- ^^^^^^^^ expected `u64`, found `isize`
+ | |
+ | expected because this is `u64`
+ |
+ = note: `-1_isize` cannot fit into type `u64`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:16:13
+ |
+LL | x_u32 > -1_isize;
+ | ----- ^^^^^^^^ expected `u32`, found `isize`
+ | |
+ | expected because this is `u32`
+ |
+ = note: `-1_isize` cannot fit into type `u32`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:18:13
+ |
+LL | x_u16 > -1_isize;
+ | ----- ^^^^^^^^ expected `u16`, found `isize`
+ | |
+ | expected because this is `u16`
+ |
+ = note: `-1_isize` cannot fit into type `u16`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:20:12
+ |
+LL | x_u8 > -1_isize;
+ | ---- ^^^^^^^^ expected `u8`, found `isize`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `isize`, matching the type of `-1_isize`
+ |
+LL | isize::from(x_u8) > -1_isize;
+ | ++++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:23:15
+ |
+LL | x_usize > -1_i128;
+ | ------- ^^^^^^^ expected `usize`, found `i128`
+ | |
+ | expected because this is `usize`
+ |
+ = note: `-1_i128` cannot fit into type `usize`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:25:14
+ |
+LL | x_u128 > -1_i128;
+ | ------ ^^^^^^^ expected `u128`, found `i128`
+ | |
+ | expected because this is `u128`
+ |
+ = note: `-1_i128` cannot fit into type `u128`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:27:13
+ |
+LL | x_u64 > -1_i128;
+ | ----- ^^^^^^^ expected `u64`, found `i128`
+ | |
+ | expected because this is `u64`
+ |
+help: you can convert `x_u64` from `u64` to `i128`, matching the type of `-1_i128`
+ |
+LL | i128::from(x_u64) > -1_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:29:13
+ |
+LL | x_u32 > -1_i128;
+ | ----- ^^^^^^^ expected `u32`, found `i128`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert `x_u32` from `u32` to `i128`, matching the type of `-1_i128`
+ |
+LL | i128::from(x_u32) > -1_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:31:13
+ |
+LL | x_u16 > -1_i128;
+ | ----- ^^^^^^^ expected `u16`, found `i128`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert `x_u16` from `u16` to `i128`, matching the type of `-1_i128`
+ |
+LL | i128::from(x_u16) > -1_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:33:12
+ |
+LL | x_u8 > -1_i128;
+ | ---- ^^^^^^^ expected `u8`, found `i128`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `i128`, matching the type of `-1_i128`
+ |
+LL | i128::from(x_u8) > -1_i128;
+ | +++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:36:15
+ |
+LL | x_usize > -1_i64;
+ | ------- ^^^^^^ expected `usize`, found `i64`
+ | |
+ | expected because this is `usize`
+ |
+ = note: `-1_i64` cannot fit into type `usize`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:38:14
+ |
+LL | x_u128 > -1_i64;
+ | ------ ^^^^^^ expected `u128`, found `i64`
+ | |
+ | expected because this is `u128`
+ |
+ = note: `-1_i64` cannot fit into type `u128`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:40:13
+ |
+LL | x_u64 > -1_i64;
+ | ----- ^^^^^^ expected `u64`, found `i64`
+ | |
+ | expected because this is `u64`
+ |
+ = note: `-1_i64` cannot fit into type `u64`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:42:13
+ |
+LL | x_u32 > -1_i64;
+ | ----- ^^^^^^ expected `u32`, found `i64`
+ | |
+ | expected because this is `u32`
+ |
+help: you can convert `x_u32` from `u32` to `i64`, matching the type of `-1_i64`
+ |
+LL | i64::from(x_u32) > -1_i64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:44:13
+ |
+LL | x_u16 > -1_i64;
+ | ----- ^^^^^^ expected `u16`, found `i64`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert `x_u16` from `u16` to `i64`, matching the type of `-1_i64`
+ |
+LL | i64::from(x_u16) > -1_i64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:46:12
+ |
+LL | x_u8 > -1_i64;
+ | ---- ^^^^^^ expected `u8`, found `i64`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `i64`, matching the type of `-1_i64`
+ |
+LL | i64::from(x_u8) > -1_i64;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:49:15
+ |
+LL | x_usize > -1_i32;
+ | ------- ^^^^^^ expected `usize`, found `i32`
+ | |
+ | expected because this is `usize`
+ |
+ = note: `-1_i32` cannot fit into type `usize`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:51:14
+ |
+LL | x_u128 > -1_i32;
+ | ------ ^^^^^^ expected `u128`, found `i32`
+ | |
+ | expected because this is `u128`
+ |
+ = note: `-1_i32` cannot fit into type `u128`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:53:13
+ |
+LL | x_u64 > -1_i32;
+ | ----- ^^^^^^ expected `u64`, found `i32`
+ | |
+ | expected because this is `u64`
+ |
+ = note: `-1_i32` cannot fit into type `u64`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:55:13
+ |
+LL | x_u32 > -1_i32;
+ | ----- ^^^^^^ expected `u32`, found `i32`
+ | |
+ | expected because this is `u32`
+ |
+ = note: `-1_i32` cannot fit into type `u32`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:57:13
+ |
+LL | x_u16 > -1_i32;
+ | ----- ^^^^^^ expected `u16`, found `i32`
+ | |
+ | expected because this is `u16`
+ |
+help: you can convert `x_u16` from `u16` to `i32`, matching the type of `-1_i32`
+ |
+LL | i32::from(x_u16) > -1_i32;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:59:12
+ |
+LL | x_u8 > -1_i32;
+ | ---- ^^^^^^ expected `u8`, found `i32`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `i32`, matching the type of `-1_i32`
+ |
+LL | i32::from(x_u8) > -1_i32;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:62:15
+ |
+LL | x_usize > -1_i16;
+ | ------- ^^^^^^ expected `usize`, found `i16`
+ | |
+ | expected because this is `usize`
+ |
+ = note: `-1_i16` cannot fit into type `usize`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:64:14
+ |
+LL | x_u128 > -1_i16;
+ | ------ ^^^^^^ expected `u128`, found `i16`
+ | |
+ | expected because this is `u128`
+ |
+ = note: `-1_i16` cannot fit into type `u128`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:66:13
+ |
+LL | x_u64 > -1_i16;
+ | ----- ^^^^^^ expected `u64`, found `i16`
+ | |
+ | expected because this is `u64`
+ |
+ = note: `-1_i16` cannot fit into type `u64`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:68:13
+ |
+LL | x_u32 > -1_i16;
+ | ----- ^^^^^^ expected `u32`, found `i16`
+ | |
+ | expected because this is `u32`
+ |
+ = note: `-1_i16` cannot fit into type `u32`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:70:13
+ |
+LL | x_u16 > -1_i16;
+ | ----- ^^^^^^ expected `u16`, found `i16`
+ | |
+ | expected because this is `u16`
+ |
+ = note: `-1_i16` cannot fit into type `u16`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:72:12
+ |
+LL | x_u8 > -1_i16;
+ | ---- ^^^^^^ expected `u8`, found `i16`
+ | |
+ | expected because this is `u8`
+ |
+help: you can convert `x_u8` from `u8` to `i16`, matching the type of `-1_i16`
+ |
+LL | i16::from(x_u8) > -1_i16;
+ | ++++++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:75:15
+ |
+LL | x_usize > -1_i8;
+ | ------- ^^^^^ expected `usize`, found `i8`
+ | |
+ | expected because this is `usize`
+ |
+ = note: `-1_i8` cannot fit into type `usize`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:77:14
+ |
+LL | x_u128 > -1_i8;
+ | ------ ^^^^^ expected `u128`, found `i8`
+ | |
+ | expected because this is `u128`
+ |
+ = note: `-1_i8` cannot fit into type `u128`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:79:13
+ |
+LL | x_u64 > -1_i8;
+ | ----- ^^^^^ expected `u64`, found `i8`
+ | |
+ | expected because this is `u64`
+ |
+ = note: `-1_i8` cannot fit into type `u64`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:81:13
+ |
+LL | x_u32 > -1_i8;
+ | ----- ^^^^^ expected `u32`, found `i8`
+ | |
+ | expected because this is `u32`
+ |
+ = note: `-1_i8` cannot fit into type `u32`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:83:13
+ |
+LL | x_u16 > -1_i8;
+ | ----- ^^^^^ expected `u16`, found `i8`
+ | |
+ | expected because this is `u16`
+ |
+ = note: `-1_i8` cannot fit into type `u16`
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-no-fix.rs:85:12
+ |
+LL | x_u8 > -1_i8;
+ | ---- ^^^^^ expected `u8`, found `i8`
+ | |
+ | expected because this is `u8`
+ |
+ = note: `-1_i8` cannot fit into type `u8`
+
+error: aborting due to 36 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-cast-without-suggestion.rs b/tests/ui/numeric/numeric-cast-without-suggestion.rs
new file mode 100644
index 000000000..faf24a8c1
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast-without-suggestion.rs
@@ -0,0 +1,38 @@
+fn foo<N>(_x: N) {}
+
+fn main() {
+ let x_usize: usize = 1;
+ let x_u64: u64 = 2;
+ let x_u32: u32 = 3;
+ let x_u16: u16 = 4;
+ let x_u8: u8 = 5;
+ let x_isize: isize = 6;
+ let x_i64: i64 = 7;
+ let x_i32: i32 = 8;
+ let x_i16: i16 = 9;
+ let x_i8: i8 = 10;
+ let x_f64: f64 = 11.0;
+ let x_f32: f32 = 12.0;
+
+ foo::<usize>(x_f64); //~ ERROR mismatched types
+ foo::<usize>(x_f32); //~ ERROR mismatched types
+ foo::<isize>(x_f64); //~ ERROR mismatched types
+ foo::<isize>(x_f32); //~ ERROR mismatched types
+ foo::<u64>(x_f64); //~ ERROR mismatched types
+ foo::<u64>(x_f32); //~ ERROR mismatched types
+ foo::<i64>(x_f64); //~ ERROR mismatched types
+ foo::<i64>(x_f32); //~ ERROR mismatched types
+ foo::<u32>(x_f64); //~ ERROR mismatched types
+ foo::<u32>(x_f32); //~ ERROR mismatched types
+ foo::<i32>(x_f64); //~ ERROR mismatched types
+ foo::<i32>(x_f32); //~ ERROR mismatched types
+ foo::<u16>(x_f64); //~ ERROR mismatched types
+ foo::<u16>(x_f32); //~ ERROR mismatched types
+ foo::<i16>(x_f64); //~ ERROR mismatched types
+ foo::<i16>(x_f32); //~ ERROR mismatched types
+ foo::<u8>(x_f64); //~ ERROR mismatched types
+ foo::<u8>(x_f32); //~ ERROR mismatched types
+ foo::<i8>(x_f64); //~ ERROR mismatched types
+ foo::<i8>(x_f32); //~ ERROR mismatched types
+ foo::<f32>(x_f64); //~ ERROR mismatched types
+}
diff --git a/tests/ui/numeric/numeric-cast-without-suggestion.stderr b/tests/ui/numeric/numeric-cast-without-suggestion.stderr
new file mode 100644
index 000000000..581b548ab
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast-without-suggestion.stderr
@@ -0,0 +1,297 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:17:18
+ |
+LL | foo::<usize>(x_f64);
+ | ------------ ^^^^^ expected `usize`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:18:18
+ |
+LL | foo::<usize>(x_f32);
+ | ------------ ^^^^^ expected `usize`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:19:18
+ |
+LL | foo::<isize>(x_f64);
+ | ------------ ^^^^^ expected `isize`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:20:18
+ |
+LL | foo::<isize>(x_f32);
+ | ------------ ^^^^^ expected `isize`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:21:16
+ |
+LL | foo::<u64>(x_f64);
+ | ---------- ^^^^^ expected `u64`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:22:16
+ |
+LL | foo::<u64>(x_f32);
+ | ---------- ^^^^^ expected `u64`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:23:16
+ |
+LL | foo::<i64>(x_f64);
+ | ---------- ^^^^^ expected `i64`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:24:16
+ |
+LL | foo::<i64>(x_f32);
+ | ---------- ^^^^^ expected `i64`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:25:16
+ |
+LL | foo::<u32>(x_f64);
+ | ---------- ^^^^^ expected `u32`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:26:16
+ |
+LL | foo::<u32>(x_f32);
+ | ---------- ^^^^^ expected `u32`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:27:16
+ |
+LL | foo::<i32>(x_f64);
+ | ---------- ^^^^^ expected `i32`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:28:16
+ |
+LL | foo::<i32>(x_f32);
+ | ---------- ^^^^^ expected `i32`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:29:16
+ |
+LL | foo::<u16>(x_f64);
+ | ---------- ^^^^^ expected `u16`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:30:16
+ |
+LL | foo::<u16>(x_f32);
+ | ---------- ^^^^^ expected `u16`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:31:16
+ |
+LL | foo::<i16>(x_f64);
+ | ---------- ^^^^^ expected `i16`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:32:16
+ |
+LL | foo::<i16>(x_f32);
+ | ---------- ^^^^^ expected `i16`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:33:15
+ |
+LL | foo::<u8>(x_f64);
+ | --------- ^^^^^ expected `u8`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:34:15
+ |
+LL | foo::<u8>(x_f32);
+ | --------- ^^^^^ expected `u8`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:35:15
+ |
+LL | foo::<i8>(x_f64);
+ | --------- ^^^^^ expected `i8`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:36:15
+ |
+LL | foo::<i8>(x_f32);
+ | --------- ^^^^^ expected `i8`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast-without-suggestion.rs:37:16
+ |
+LL | foo::<f32>(x_f64);
+ | ---------- ^^^^^ expected `f32`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast-without-suggestion.rs:1:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+
+error: aborting due to 21 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-cast.fixed b/tests/ui/numeric/numeric-cast.fixed
new file mode 100644
index 000000000..cf0560a10
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast.fixed
@@ -0,0 +1,293 @@
+// run-rustfix
+
+// The `try_into` suggestion doesn't include this, but we do suggest it after applying it
+use std::convert::TryInto;
+
+fn foo<N>(_x: N) {}
+
+fn main() {
+ let x_usize: usize = 1;
+ let x_u64: u64 = 2;
+ let x_u32: u32 = 3;
+ let x_u16: u16 = 4;
+ let x_u8: u8 = 5;
+ let x_isize: isize = 6;
+ let x_i64: i64 = 7;
+ let x_i32: i32 = 8;
+ let x_i16: i16 = 9;
+ let x_i8: i8 = 10;
+ let x_f64: f64 = 11.0;
+ let x_f32: f32 = 12.0;
+
+ foo::<usize>(x_usize);
+ foo::<usize>(x_u64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<usize>(x_u32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<usize>(x_u16.into());
+ //~^ ERROR mismatched types
+ foo::<usize>(x_u8.into());
+ //~^ ERROR mismatched types
+ foo::<usize>(x_isize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<usize>(x_i64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<usize>(x_i32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<usize>(x_i16.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<usize>(x_i8.try_into().unwrap());
+ //~^ ERROR mismatched types
+ // foo::<usize>(x_f64);
+ // foo::<usize>(x_f32);
+
+ foo::<isize>(x_usize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<isize>(x_u64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<isize>(x_u32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<isize>(x_u16.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<isize>(x_u8.into());
+ //~^ ERROR mismatched types
+ foo::<isize>(x_isize);
+ foo::<isize>(x_i64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<isize>(x_i32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<isize>(x_i16.into());
+ //~^ ERROR mismatched types
+ foo::<isize>(x_i8.into());
+ //~^ ERROR mismatched types
+ // foo::<isize>(x_f64);
+ // foo::<isize>(x_f32);
+
+ foo::<u64>(x_usize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u64>(x_u64);
+ foo::<u64>(x_u32.into());
+ //~^ ERROR mismatched types
+ foo::<u64>(x_u16.into());
+ //~^ ERROR mismatched types
+ foo::<u64>(x_u8.into());
+ //~^ ERROR mismatched types
+ foo::<u64>(x_isize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u64>(x_i64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u64>(x_i32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u64>(x_i16.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u64>(x_i8.try_into().unwrap());
+ //~^ ERROR mismatched types
+ // foo::<u64>(x_f64);
+ // foo::<u64>(x_f32);
+
+ foo::<i64>(x_usize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i64>(x_u64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i64>(x_u32.into());
+ //~^ ERROR mismatched types
+ foo::<i64>(x_u16.into());
+ //~^ ERROR mismatched types
+ foo::<i64>(x_u8.into());
+ //~^ ERROR mismatched types
+ foo::<i64>(x_isize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i64>(x_i64);
+ foo::<i64>(x_i32.into());
+ //~^ ERROR mismatched types
+ foo::<i64>(x_i16.into());
+ //~^ ERROR mismatched types
+ foo::<i64>(x_i8.into());
+ //~^ ERROR mismatched types
+ // foo::<i64>(x_f64);
+ // foo::<i64>(x_f32);
+
+ foo::<u32>(x_usize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u32>(x_u64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u32>(x_u32);
+ foo::<u32>(x_u16.into());
+ //~^ ERROR mismatched types
+ foo::<u32>(x_u8.into());
+ //~^ ERROR mismatched types
+ foo::<u32>(x_isize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u32>(x_i64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u32>(x_i32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u32>(x_i16.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u32>(x_i8.try_into().unwrap());
+ //~^ ERROR mismatched types
+ // foo::<u32>(x_f64);
+ // foo::<u32>(x_f32);
+
+ foo::<i32>(x_usize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i32>(x_u64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i32>(x_u32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i32>(x_u16.into());
+ //~^ ERROR mismatched types
+ foo::<i32>(x_u8.into());
+ //~^ ERROR mismatched types
+ foo::<i32>(x_isize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i32>(x_i64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i32>(x_i32);
+ foo::<i32>(x_i16.into());
+ //~^ ERROR mismatched types
+ foo::<i32>(x_i8.into());
+ //~^ ERROR mismatched types
+ // foo::<i32>(x_f64);
+ // foo::<i32>(x_f32);
+
+ foo::<u16>(x_usize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u16>(x_u64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u16>(x_u32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u16>(x_u16);
+ foo::<u16>(x_u8.into());
+ //~^ ERROR mismatched types
+ foo::<u16>(x_isize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u16>(x_i64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u16>(x_i32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u16>(x_i16.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u16>(x_i8.try_into().unwrap());
+ //~^ ERROR mismatched types
+ // foo::<u16>(x_f64);
+ // foo::<u16>(x_f32);
+
+ foo::<i16>(x_usize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i16>(x_u64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i16>(x_u32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i16>(x_u16.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i16>(x_u8.into());
+ //~^ ERROR mismatched types
+ foo::<i16>(x_isize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i16>(x_i64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i16>(x_i32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i16>(x_i16);
+ foo::<i16>(x_i8.into());
+ //~^ ERROR mismatched types
+ // foo::<i16>(x_f64);
+ // foo::<i16>(x_f32);
+
+ foo::<u8>(x_usize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u8>(x_u64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u8>(x_u32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u8>(x_u16.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u8>(x_u8);
+ foo::<u8>(x_isize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u8>(x_i64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u8>(x_i32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u8>(x_i16.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<u8>(x_i8.try_into().unwrap());
+ //~^ ERROR mismatched types
+ // foo::<u8>(x_f64);
+ // foo::<u8>(x_f32);
+
+ foo::<i8>(x_usize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i8>(x_u64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i8>(x_u32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i8>(x_u16.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i8>(x_u8.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i8>(x_isize.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i8>(x_i64.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i8>(x_i32.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i8>(x_i16.try_into().unwrap());
+ //~^ ERROR mismatched types
+ foo::<i8>(x_i8);
+ // foo::<i8>(x_f64);
+ // foo::<i8>(x_f32);
+
+ foo::<f64>(x_usize as f64);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_u64 as f64);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_u32.into());
+ //~^ ERROR mismatched types
+ foo::<f64>(x_u16.into());
+ //~^ ERROR mismatched types
+ foo::<f64>(x_u8.into());
+ //~^ ERROR mismatched types
+ foo::<f64>(x_isize as f64);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_i64 as f64);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_i32.into());
+ //~^ ERROR mismatched types
+ foo::<f64>(x_i16.into());
+ //~^ ERROR mismatched types
+ foo::<f64>(x_i8.into());
+ //~^ ERROR mismatched types
+ foo::<f64>(x_f64);
+ foo::<f64>(x_f32.into());
+ //~^ ERROR mismatched types
+
+ foo::<f32>(x_usize as f32);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_u64 as f32);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_u32 as f32);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_u16.into());
+ //~^ ERROR mismatched types
+ foo::<f32>(x_u8.into());
+ //~^ ERROR mismatched types
+ foo::<f32>(x_isize as f32);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_i64 as f32);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_i32 as f32);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_i16.into());
+ //~^ ERROR mismatched types
+ foo::<f32>(x_i8.into());
+ //~^ ERROR mismatched types
+ // foo::<f32>(x_f64);
+ foo::<f32>(x_f32);
+
+ foo::<u32>((x_u8 as u16).into());
+ //~^ ERROR mismatched types
+ foo::<i32>((-x_i8).into());
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/numeric/numeric-cast.rs b/tests/ui/numeric/numeric-cast.rs
new file mode 100644
index 000000000..7bddfc509
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast.rs
@@ -0,0 +1,293 @@
+// run-rustfix
+
+// The `try_into` suggestion doesn't include this, but we do suggest it after applying it
+use std::convert::TryInto;
+
+fn foo<N>(_x: N) {}
+
+fn main() {
+ let x_usize: usize = 1;
+ let x_u64: u64 = 2;
+ let x_u32: u32 = 3;
+ let x_u16: u16 = 4;
+ let x_u8: u8 = 5;
+ let x_isize: isize = 6;
+ let x_i64: i64 = 7;
+ let x_i32: i32 = 8;
+ let x_i16: i16 = 9;
+ let x_i8: i8 = 10;
+ let x_f64: f64 = 11.0;
+ let x_f32: f32 = 12.0;
+
+ foo::<usize>(x_usize);
+ foo::<usize>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<usize>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<usize>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<usize>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<usize>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<usize>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<usize>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<usize>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<usize>(x_i8);
+ //~^ ERROR mismatched types
+ // foo::<usize>(x_f64);
+ // foo::<usize>(x_f32);
+
+ foo::<isize>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<isize>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<isize>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<isize>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<isize>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<isize>(x_isize);
+ foo::<isize>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<isize>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<isize>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<isize>(x_i8);
+ //~^ ERROR mismatched types
+ // foo::<isize>(x_f64);
+ // foo::<isize>(x_f32);
+
+ foo::<u64>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<u64>(x_u64);
+ foo::<u64>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<u64>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<u64>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<u64>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<u64>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<u64>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<u64>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<u64>(x_i8);
+ //~^ ERROR mismatched types
+ // foo::<u64>(x_f64);
+ // foo::<u64>(x_f32);
+
+ foo::<i64>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<i64>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<i64>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<i64>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<i64>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<i64>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<i64>(x_i64);
+ foo::<i64>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<i64>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<i64>(x_i8);
+ //~^ ERROR mismatched types
+ // foo::<i64>(x_f64);
+ // foo::<i64>(x_f32);
+
+ foo::<u32>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<u32>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<u32>(x_u32);
+ foo::<u32>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<u32>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<u32>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<u32>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<u32>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<u32>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<u32>(x_i8);
+ //~^ ERROR mismatched types
+ // foo::<u32>(x_f64);
+ // foo::<u32>(x_f32);
+
+ foo::<i32>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<i32>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<i32>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<i32>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<i32>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<i32>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<i32>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<i32>(x_i32);
+ foo::<i32>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<i32>(x_i8);
+ //~^ ERROR mismatched types
+ // foo::<i32>(x_f64);
+ // foo::<i32>(x_f32);
+
+ foo::<u16>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<u16>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<u16>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<u16>(x_u16);
+ foo::<u16>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<u16>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<u16>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<u16>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<u16>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<u16>(x_i8);
+ //~^ ERROR mismatched types
+ // foo::<u16>(x_f64);
+ // foo::<u16>(x_f32);
+
+ foo::<i16>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<i16>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<i16>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<i16>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<i16>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<i16>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<i16>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<i16>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<i16>(x_i16);
+ foo::<i16>(x_i8);
+ //~^ ERROR mismatched types
+ // foo::<i16>(x_f64);
+ // foo::<i16>(x_f32);
+
+ foo::<u8>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<u8>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<u8>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<u8>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<u8>(x_u8);
+ foo::<u8>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<u8>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<u8>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<u8>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<u8>(x_i8);
+ //~^ ERROR mismatched types
+ // foo::<u8>(x_f64);
+ // foo::<u8>(x_f32);
+
+ foo::<i8>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<i8>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<i8>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<i8>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<i8>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<i8>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<i8>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<i8>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<i8>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<i8>(x_i8);
+ // foo::<i8>(x_f64);
+ // foo::<i8>(x_f32);
+
+ foo::<f64>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_i8);
+ //~^ ERROR mismatched types
+ foo::<f64>(x_f64);
+ foo::<f64>(x_f32);
+ //~^ ERROR mismatched types
+
+ foo::<f32>(x_usize);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_u64);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_u32);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_u16);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_u8);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_isize);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_i64);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_i32);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_i16);
+ //~^ ERROR mismatched types
+ foo::<f32>(x_i8);
+ //~^ ERROR mismatched types
+ // foo::<f32>(x_f64);
+ foo::<f32>(x_f32);
+
+ foo::<u32>(x_u8 as u16);
+ //~^ ERROR mismatched types
+ foo::<i32>(-x_i8);
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/numeric/numeric-cast.stderr b/tests/ui/numeric/numeric-cast.stderr
new file mode 100644
index 000000000..d347875d5
--- /dev/null
+++ b/tests/ui/numeric/numeric-cast.stderr
@@ -0,0 +1,2037 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:23:18
+ |
+LL | foo::<usize>(x_u64);
+ | ------------ ^^^^^ expected `usize`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | foo::<usize>(x_u64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:25:18
+ |
+LL | foo::<usize>(x_u32);
+ | ------------ ^^^^^ expected `usize`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | foo::<usize>(x_u32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:27:18
+ |
+LL | foo::<usize>(x_u16);
+ | ------------ ^^^^^ expected `usize`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to a `usize`
+ |
+LL | foo::<usize>(x_u16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:29:18
+ |
+LL | foo::<usize>(x_u8);
+ | ------------ ^^^^ expected `usize`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to a `usize`
+ |
+LL | foo::<usize>(x_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:31:18
+ |
+LL | foo::<usize>(x_isize);
+ | ------------ ^^^^^^^ expected `usize`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | foo::<usize>(x_isize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:33:18
+ |
+LL | foo::<usize>(x_i64);
+ | ------------ ^^^^^ expected `usize`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | foo::<usize>(x_i64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:35:18
+ |
+LL | foo::<usize>(x_i32);
+ | ------------ ^^^^^ expected `usize`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | foo::<usize>(x_i32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:37:18
+ |
+LL | foo::<usize>(x_i16);
+ | ------------ ^^^^^ expected `usize`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | foo::<usize>(x_i16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:39:18
+ |
+LL | foo::<usize>(x_i8);
+ | ------------ ^^^^ expected `usize`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to a `usize` and panic if the converted value doesn't fit
+ |
+LL | foo::<usize>(x_i8.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:44:18
+ |
+LL | foo::<isize>(x_usize);
+ | ------------ ^^^^^^^ expected `isize`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | foo::<isize>(x_usize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:46:18
+ |
+LL | foo::<isize>(x_u64);
+ | ------------ ^^^^^ expected `isize`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u64` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | foo::<isize>(x_u64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:48:18
+ |
+LL | foo::<isize>(x_u32);
+ | ------------ ^^^^^ expected `isize`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | foo::<isize>(x_u32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:50:18
+ |
+LL | foo::<isize>(x_u16);
+ | ------------ ^^^^^ expected `isize`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | foo::<isize>(x_u16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:52:18
+ |
+LL | foo::<isize>(x_u8);
+ | ------------ ^^^^ expected `isize`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to an `isize`
+ |
+LL | foo::<isize>(x_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:55:18
+ |
+LL | foo::<isize>(x_i64);
+ | ------------ ^^^^^ expected `isize`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | foo::<isize>(x_i64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:57:18
+ |
+LL | foo::<isize>(x_i32);
+ | ------------ ^^^^^ expected `isize`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit
+ |
+LL | foo::<isize>(x_i32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:59:18
+ |
+LL | foo::<isize>(x_i16);
+ | ------------ ^^^^^ expected `isize`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to an `isize`
+ |
+LL | foo::<isize>(x_i16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:61:18
+ |
+LL | foo::<isize>(x_i8);
+ | ------------ ^^^^ expected `isize`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to an `isize`
+ |
+LL | foo::<isize>(x_i8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:66:16
+ |
+LL | foo::<u64>(x_usize);
+ | ---------- ^^^^^^^ expected `u64`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | foo::<u64>(x_usize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:69:16
+ |
+LL | foo::<u64>(x_u32);
+ | ---------- ^^^^^ expected `u64`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to a `u64`
+ |
+LL | foo::<u64>(x_u32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:71:16
+ |
+LL | foo::<u64>(x_u16);
+ | ---------- ^^^^^ expected `u64`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to a `u64`
+ |
+LL | foo::<u64>(x_u16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:73:16
+ |
+LL | foo::<u64>(x_u8);
+ | ---------- ^^^^ expected `u64`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to a `u64`
+ |
+LL | foo::<u64>(x_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:75:16
+ |
+LL | foo::<u64>(x_isize);
+ | ---------- ^^^^^^^ expected `u64`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | foo::<u64>(x_isize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:77:16
+ |
+LL | foo::<u64>(x_i64);
+ | ---------- ^^^^^ expected `u64`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | foo::<u64>(x_i64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:79:16
+ |
+LL | foo::<u64>(x_i32);
+ | ---------- ^^^^^ expected `u64`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | foo::<u64>(x_i32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:81:16
+ |
+LL | foo::<u64>(x_i16);
+ | ---------- ^^^^^ expected `u64`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | foo::<u64>(x_i16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:83:16
+ |
+LL | foo::<u64>(x_i8);
+ | ---------- ^^^^ expected `u64`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to a `u64` and panic if the converted value doesn't fit
+ |
+LL | foo::<u64>(x_i8.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:88:16
+ |
+LL | foo::<i64>(x_usize);
+ | ---------- ^^^^^^^ expected `i64`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `usize` to an `i64` and panic if the converted value doesn't fit
+ |
+LL | foo::<i64>(x_usize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:90:16
+ |
+LL | foo::<i64>(x_u64);
+ | ---------- ^^^^^ expected `i64`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u64` to an `i64` and panic if the converted value doesn't fit
+ |
+LL | foo::<i64>(x_u64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:92:16
+ |
+LL | foo::<i64>(x_u32);
+ | ---------- ^^^^^ expected `i64`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to an `i64`
+ |
+LL | foo::<i64>(x_u32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:94:16
+ |
+LL | foo::<i64>(x_u16);
+ | ---------- ^^^^^ expected `i64`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to an `i64`
+ |
+LL | foo::<i64>(x_u16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:96:16
+ |
+LL | foo::<i64>(x_u8);
+ | ---------- ^^^^ expected `i64`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to an `i64`
+ |
+LL | foo::<i64>(x_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:98:16
+ |
+LL | foo::<i64>(x_isize);
+ | ---------- ^^^^^^^ expected `i64`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit
+ |
+LL | foo::<i64>(x_isize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:101:16
+ |
+LL | foo::<i64>(x_i32);
+ | ---------- ^^^^^ expected `i64`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to an `i64`
+ |
+LL | foo::<i64>(x_i32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:103:16
+ |
+LL | foo::<i64>(x_i16);
+ | ---------- ^^^^^ expected `i64`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to an `i64`
+ |
+LL | foo::<i64>(x_i16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:105:16
+ |
+LL | foo::<i64>(x_i8);
+ | ---------- ^^^^ expected `i64`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to an `i64`
+ |
+LL | foo::<i64>(x_i8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:110:16
+ |
+LL | foo::<u32>(x_usize);
+ | ---------- ^^^^^^^ expected `u32`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | foo::<u32>(x_usize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:112:16
+ |
+LL | foo::<u32>(x_u64);
+ | ---------- ^^^^^ expected `u32`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | foo::<u32>(x_u64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:115:16
+ |
+LL | foo::<u32>(x_u16);
+ | ---------- ^^^^^ expected `u32`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to a `u32`
+ |
+LL | foo::<u32>(x_u16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:117:16
+ |
+LL | foo::<u32>(x_u8);
+ | ---------- ^^^^ expected `u32`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to a `u32`
+ |
+LL | foo::<u32>(x_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:119:16
+ |
+LL | foo::<u32>(x_isize);
+ | ---------- ^^^^^^^ expected `u32`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | foo::<u32>(x_isize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:121:16
+ |
+LL | foo::<u32>(x_i64);
+ | ---------- ^^^^^ expected `u32`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | foo::<u32>(x_i64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:123:16
+ |
+LL | foo::<u32>(x_i32);
+ | ---------- ^^^^^ expected `u32`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | foo::<u32>(x_i32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:125:16
+ |
+LL | foo::<u32>(x_i16);
+ | ---------- ^^^^^ expected `u32`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | foo::<u32>(x_i16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:127:16
+ |
+LL | foo::<u32>(x_i8);
+ | ---------- ^^^^ expected `u32`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to a `u32` and panic if the converted value doesn't fit
+ |
+LL | foo::<u32>(x_i8.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:132:16
+ |
+LL | foo::<i32>(x_usize);
+ | ---------- ^^^^^^^ expected `i32`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `usize` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | foo::<i32>(x_usize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:134:16
+ |
+LL | foo::<i32>(x_u64);
+ | ---------- ^^^^^ expected `i32`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | foo::<i32>(x_u64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:136:16
+ |
+LL | foo::<i32>(x_u32);
+ | ---------- ^^^^^ expected `i32`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | foo::<i32>(x_u32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:138:16
+ |
+LL | foo::<i32>(x_u16);
+ | ---------- ^^^^^ expected `i32`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to an `i32`
+ |
+LL | foo::<i32>(x_u16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:140:16
+ |
+LL | foo::<i32>(x_u8);
+ | ---------- ^^^^ expected `i32`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to an `i32`
+ |
+LL | foo::<i32>(x_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:142:16
+ |
+LL | foo::<i32>(x_isize);
+ | ---------- ^^^^^^^ expected `i32`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | foo::<i32>(x_isize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:144:16
+ |
+LL | foo::<i32>(x_i64);
+ | ---------- ^^^^^ expected `i32`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
+ |
+LL | foo::<i32>(x_i64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:147:16
+ |
+LL | foo::<i32>(x_i16);
+ | ---------- ^^^^^ expected `i32`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to an `i32`
+ |
+LL | foo::<i32>(x_i16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:149:16
+ |
+LL | foo::<i32>(x_i8);
+ | ---------- ^^^^ expected `i32`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to an `i32`
+ |
+LL | foo::<i32>(x_i8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:154:16
+ |
+LL | foo::<u16>(x_usize);
+ | ---------- ^^^^^^^ expected `u16`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `usize` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | foo::<u16>(x_usize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:156:16
+ |
+LL | foo::<u16>(x_u64);
+ | ---------- ^^^^^ expected `u16`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u64` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | foo::<u16>(x_u64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:158:16
+ |
+LL | foo::<u16>(x_u32);
+ | ---------- ^^^^^ expected `u16`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | foo::<u16>(x_u32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:161:16
+ |
+LL | foo::<u16>(x_u8);
+ | ---------- ^^^^ expected `u16`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to a `u16`
+ |
+LL | foo::<u16>(x_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:163:16
+ |
+LL | foo::<u16>(x_isize);
+ | ---------- ^^^^^^^ expected `u16`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | foo::<u16>(x_isize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:165:16
+ |
+LL | foo::<u16>(x_i64);
+ | ---------- ^^^^^ expected `u16`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | foo::<u16>(x_i64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:167:16
+ |
+LL | foo::<u16>(x_i32);
+ | ---------- ^^^^^ expected `u16`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | foo::<u16>(x_i32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:169:16
+ |
+LL | foo::<u16>(x_i16);
+ | ---------- ^^^^^ expected `u16`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | foo::<u16>(x_i16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:171:16
+ |
+LL | foo::<u16>(x_i8);
+ | ---------- ^^^^ expected `u16`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to a `u16` and panic if the converted value doesn't fit
+ |
+LL | foo::<u16>(x_i8.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:176:16
+ |
+LL | foo::<i16>(x_usize);
+ | ---------- ^^^^^^^ expected `i16`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `usize` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | foo::<i16>(x_usize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:178:16
+ |
+LL | foo::<i16>(x_u64);
+ | ---------- ^^^^^ expected `i16`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u64` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | foo::<i16>(x_u64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:180:16
+ |
+LL | foo::<i16>(x_u32);
+ | ---------- ^^^^^ expected `i16`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | foo::<i16>(x_u32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:182:16
+ |
+LL | foo::<i16>(x_u16);
+ | ---------- ^^^^^ expected `i16`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | foo::<i16>(x_u16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:184:16
+ |
+LL | foo::<i16>(x_u8);
+ | ---------- ^^^^ expected `i16`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to an `i16`
+ |
+LL | foo::<i16>(x_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:186:16
+ |
+LL | foo::<i16>(x_isize);
+ | ---------- ^^^^^^^ expected `i16`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | foo::<i16>(x_isize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:188:16
+ |
+LL | foo::<i16>(x_i64);
+ | ---------- ^^^^^ expected `i16`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | foo::<i16>(x_i64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:190:16
+ |
+LL | foo::<i16>(x_i32);
+ | ---------- ^^^^^ expected `i16`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
+ |
+LL | foo::<i16>(x_i32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:193:16
+ |
+LL | foo::<i16>(x_i8);
+ | ---------- ^^^^ expected `i16`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to an `i16`
+ |
+LL | foo::<i16>(x_i8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:198:15
+ |
+LL | foo::<u8>(x_usize);
+ | --------- ^^^^^^^ expected `u8`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `usize` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | foo::<u8>(x_usize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:200:15
+ |
+LL | foo::<u8>(x_u64);
+ | --------- ^^^^^ expected `u8`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u64` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | foo::<u8>(x_u64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:202:15
+ |
+LL | foo::<u8>(x_u32);
+ | --------- ^^^^^ expected `u8`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | foo::<u8>(x_u32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:204:15
+ |
+LL | foo::<u8>(x_u16);
+ | --------- ^^^^^ expected `u8`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | foo::<u8>(x_u16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:207:15
+ |
+LL | foo::<u8>(x_isize);
+ | --------- ^^^^^^^ expected `u8`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | foo::<u8>(x_isize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:209:15
+ |
+LL | foo::<u8>(x_i64);
+ | --------- ^^^^^ expected `u8`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | foo::<u8>(x_i64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:211:15
+ |
+LL | foo::<u8>(x_i32);
+ | --------- ^^^^^ expected `u8`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | foo::<u8>(x_i32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:213:15
+ |
+LL | foo::<u8>(x_i16);
+ | --------- ^^^^^ expected `u8`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | foo::<u8>(x_i16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:215:15
+ |
+LL | foo::<u8>(x_i8);
+ | --------- ^^^^ expected `u8`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to a `u8` and panic if the converted value doesn't fit
+ |
+LL | foo::<u8>(x_i8.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:220:15
+ |
+LL | foo::<i8>(x_usize);
+ | --------- ^^^^^^^ expected `i8`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `usize` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | foo::<i8>(x_usize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:222:15
+ |
+LL | foo::<i8>(x_u64);
+ | --------- ^^^^^ expected `i8`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u64` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | foo::<i8>(x_u64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:224:15
+ |
+LL | foo::<i8>(x_u32);
+ | --------- ^^^^^ expected `i8`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | foo::<i8>(x_u32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:226:15
+ |
+LL | foo::<i8>(x_u16);
+ | --------- ^^^^^ expected `i8`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | foo::<i8>(x_u16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:228:15
+ |
+LL | foo::<i8>(x_u8);
+ | --------- ^^^^ expected `i8`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | foo::<i8>(x_u8.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:230:15
+ |
+LL | foo::<i8>(x_isize);
+ | --------- ^^^^^^^ expected `i8`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | foo::<i8>(x_isize.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:232:15
+ |
+LL | foo::<i8>(x_i64);
+ | --------- ^^^^^ expected `i8`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | foo::<i8>(x_i64.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:234:15
+ |
+LL | foo::<i8>(x_i32);
+ | --------- ^^^^^ expected `i8`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | foo::<i8>(x_i32.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:236:15
+ |
+LL | foo::<i8>(x_i16);
+ | --------- ^^^^^ expected `i8`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
+ |
+LL | foo::<i8>(x_i16.try_into().unwrap());
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:242:16
+ |
+LL | foo::<f64>(x_usize);
+ | ---------- ^^^^^^^ expected `f64`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can cast a `usize` to an `f64`, producing the floating point representation of the integer, rounded if necessary
+ |
+LL | foo::<f64>(x_usize as f64);
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:244:16
+ |
+LL | foo::<f64>(x_u64);
+ | ---------- ^^^^^ expected `f64`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can cast a `u64` to an `f64`, producing the floating point representation of the integer, rounded if necessary
+ |
+LL | foo::<f64>(x_u64 as f64);
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:246:16
+ |
+LL | foo::<f64>(x_u32);
+ | ---------- ^^^^^ expected `f64`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(x_u32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:248:16
+ |
+LL | foo::<f64>(x_u16);
+ | ---------- ^^^^^ expected `f64`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(x_u16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:250:16
+ |
+LL | foo::<f64>(x_u8);
+ | ---------- ^^^^ expected `f64`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(x_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:252:16
+ |
+LL | foo::<f64>(x_isize);
+ | ---------- ^^^^^^^ expected `f64`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to an `f64`, producing the floating point representation of the integer, rounded if necessary
+ |
+LL | foo::<f64>(x_isize as f64);
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:254:16
+ |
+LL | foo::<f64>(x_i64);
+ | ---------- ^^^^^ expected `f64`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to an `f64`, producing the floating point representation of the integer, rounded if necessary
+ |
+LL | foo::<f64>(x_i64 as f64);
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:256:16
+ |
+LL | foo::<f64>(x_i32);
+ | ---------- ^^^^^ expected `f64`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(x_i32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:258:16
+ |
+LL | foo::<f64>(x_i16);
+ | ---------- ^^^^^ expected `f64`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(x_i16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:260:16
+ |
+LL | foo::<f64>(x_i8);
+ | ---------- ^^^^ expected `f64`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(x_i8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:263:16
+ |
+LL | foo::<f64>(x_f32);
+ | ---------- ^^^^^ expected `f64`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `f32` to an `f64`
+ |
+LL | foo::<f64>(x_f32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:266:16
+ |
+LL | foo::<f32>(x_usize);
+ | ---------- ^^^^^^^ expected `f32`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can cast a `usize` to an `f32`, producing the floating point representation of the integer, rounded if necessary
+ |
+LL | foo::<f32>(x_usize as f32);
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:268:16
+ |
+LL | foo::<f32>(x_u64);
+ | ---------- ^^^^^ expected `f32`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can cast a `u64` to an `f32`, producing the floating point representation of the integer, rounded if necessary
+ |
+LL | foo::<f32>(x_u64 as f32);
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:270:16
+ |
+LL | foo::<f32>(x_u32);
+ | ---------- ^^^^^ expected `f32`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can cast a `u32` to an `f32`, producing the floating point representation of the integer, rounded if necessary
+ |
+LL | foo::<f32>(x_u32 as f32);
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:272:16
+ |
+LL | foo::<f32>(x_u16);
+ | ---------- ^^^^^ expected `f32`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to an `f32`, producing the floating point representation of the integer
+ |
+LL | foo::<f32>(x_u16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:274:16
+ |
+LL | foo::<f32>(x_u8);
+ | ---------- ^^^^ expected `f32`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to an `f32`, producing the floating point representation of the integer
+ |
+LL | foo::<f32>(x_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:276:16
+ |
+LL | foo::<f32>(x_isize);
+ | ---------- ^^^^^^^ expected `f32`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `isize` to an `f32`, producing the floating point representation of the integer, rounded if necessary
+ |
+LL | foo::<f32>(x_isize as f32);
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:278:16
+ |
+LL | foo::<f32>(x_i64);
+ | ---------- ^^^^^ expected `f32`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i64` to an `f32`, producing the floating point representation of the integer, rounded if necessary
+ |
+LL | foo::<f32>(x_i64 as f32);
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:280:16
+ |
+LL | foo::<f32>(x_i32);
+ | ---------- ^^^^^ expected `f32`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to an `f32`, producing the floating point representation of the integer, rounded if necessary
+ |
+LL | foo::<f32>(x_i32 as f32);
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:282:16
+ |
+LL | foo::<f32>(x_i16);
+ | ---------- ^^^^^ expected `f32`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to an `f32`, producing the floating point representation of the integer
+ |
+LL | foo::<f32>(x_i16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:284:16
+ |
+LL | foo::<f32>(x_i8);
+ | ---------- ^^^^ expected `f32`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to an `f32`, producing the floating point representation of the integer
+ |
+LL | foo::<f32>(x_i8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:289:16
+ |
+LL | foo::<u32>(x_u8 as u16);
+ | ---------- ^^^^^^^^^^^ expected `u32`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to a `u32`
+ |
+LL | foo::<u32>((x_u8 as u16).into());
+ | + ++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-cast.rs:291:16
+ |
+LL | foo::<i32>(-x_i8);
+ | ---------- ^^^^^ expected `i32`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-cast.rs:6:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to an `i32`
+ |
+LL | foo::<i32>((-x_i8).into());
+ | + ++++++++
+
+error: aborting due to 113 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-fields.rs b/tests/ui/numeric/numeric-fields.rs
new file mode 100644
index 000000000..28234bbdf
--- /dev/null
+++ b/tests/ui/numeric/numeric-fields.rs
@@ -0,0 +1,10 @@
+struct S(u8, u16);
+
+fn main() {
+ let s = S{0b1: 10, 0: 11};
+ //~^ ERROR struct `S` has no field named `0b1`
+ match s {
+ S{0: a, 0x1: b, ..} => {}
+ //~^ ERROR does not have a field named `0x1`
+ }
+}
diff --git a/tests/ui/numeric/numeric-fields.stderr b/tests/ui/numeric/numeric-fields.stderr
new file mode 100644
index 000000000..668405ed6
--- /dev/null
+++ b/tests/ui/numeric/numeric-fields.stderr
@@ -0,0 +1,27 @@
+error[E0560]: struct `S` has no field named `0b1`
+ --> $DIR/numeric-fields.rs:4:15
+ |
+LL | struct S(u8, u16);
+ | - `S` defined here
+...
+LL | let s = S{0b1: 10, 0: 11};
+ | ^^^ field does not exist
+ |
+help: `S` is a tuple struct, use the appropriate syntax
+ |
+LL | let s = S(/* fields */);
+ | ~~~~~~~~~~~~~~~
+
+error[E0026]: struct `S` does not have a field named `0x1`
+ --> $DIR/numeric-fields.rs:7:17
+ |
+LL | S{0: a, 0x1: b, ..} => {}
+ | ^^^
+ | |
+ | struct `S` does not have this field
+ | help: `S` has a field named `1`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0026, E0560.
+For more information about an error, try `rustc --explain E0026`.
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.fixed b/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.fixed
new file mode 100644
index 000000000..6e8c54df4
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.fixed
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<i32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i32);
+ foo::<i32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.rs b/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.rs
new file mode 100644
index 000000000..b47b0ed02
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.rs
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<i32>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i32);
+ foo::<i32>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr
new file mode 100644
index 000000000..f4fb14e79
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr
@@ -0,0 +1,201 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:28:16
+ |
+LL | foo::<i32>(42_usize);
+ | ---------- ^^^^^^^^ expected `i32`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `i32`
+ |
+LL | foo::<i32>(42_i32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:32:16
+ |
+LL | foo::<i32>(42_u64);
+ | ---------- ^^^^^^ expected `i32`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `i32`
+ |
+LL | foo::<i32>(42_i32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:36:16
+ |
+LL | foo::<i32>(42_u32);
+ | ---------- ^^^^^^ expected `i32`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u32` to `i32`
+ |
+LL | foo::<i32>(42_i32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:40:16
+ |
+LL | foo::<i32>(42_u16);
+ | ---------- ^^^^^^ expected `i32`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u16` to `i32`
+ |
+LL | foo::<i32>(42_i32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:44:16
+ |
+LL | foo::<i32>(42_u8);
+ | ---------- ^^^^^ expected `i32`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u8` to `i32`
+ |
+LL | foo::<i32>(42_i32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:48:16
+ |
+LL | foo::<i32>(42_isize);
+ | ---------- ^^^^^^^^ expected `i32`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `i32`
+ |
+LL | foo::<i32>(42_i32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:52:16
+ |
+LL | foo::<i32>(42_i64);
+ | ---------- ^^^^^^ expected `i32`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `i32`
+ |
+LL | foo::<i32>(42_i32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:57:16
+ |
+LL | foo::<i32>(42_i16);
+ | ---------- ^^^^^^ expected `i32`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i16` to `i32`
+ |
+LL | foo::<i32>(42_i32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:61:16
+ |
+LL | foo::<i32>(42_i8);
+ | ---------- ^^^^^ expected `i32`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i8` to `i32`
+ |
+LL | foo::<i32>(42_i32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:65:16
+ |
+LL | foo::<i32>(42.0_f64);
+ | ---------- ^^^^^^^^ expected `i32`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `i32`
+ |
+LL | foo::<i32>(42i32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i32.rs:69:16
+ |
+LL | foo::<i32>(42.0_f32);
+ | ---------- ^^^^^^^^ expected `i32`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `i32`
+ |
+LL | foo::<i32>(42i32);
+ | ~~~
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.fixed b/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.fixed
new file mode 100644
index 000000000..03821cd44
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.fixed
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<i64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i64);
+ foo::<i64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.rs b/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.rs
new file mode 100644
index 000000000..629fe7e74
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.rs
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<i64>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i64);
+ foo::<i64>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i64>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr
new file mode 100644
index 000000000..47efe9f08
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr
@@ -0,0 +1,201 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:28:16
+ |
+LL | foo::<i64>(42_usize);
+ | ---------- ^^^^^^^^ expected `i64`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `i64`
+ |
+LL | foo::<i64>(42_i64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:32:16
+ |
+LL | foo::<i64>(42_u64);
+ | ---------- ^^^^^^ expected `i64`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `i64`
+ |
+LL | foo::<i64>(42_i64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:36:16
+ |
+LL | foo::<i64>(42_u32);
+ | ---------- ^^^^^^ expected `i64`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u32` to `i64`
+ |
+LL | foo::<i64>(42_i64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:40:16
+ |
+LL | foo::<i64>(42_u16);
+ | ---------- ^^^^^^ expected `i64`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u16` to `i64`
+ |
+LL | foo::<i64>(42_i64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:44:16
+ |
+LL | foo::<i64>(42_u8);
+ | ---------- ^^^^^ expected `i64`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u8` to `i64`
+ |
+LL | foo::<i64>(42_i64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:48:16
+ |
+LL | foo::<i64>(42_isize);
+ | ---------- ^^^^^^^^ expected `i64`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `i64`
+ |
+LL | foo::<i64>(42_i64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:53:16
+ |
+LL | foo::<i64>(42_i32);
+ | ---------- ^^^^^^ expected `i64`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i32` to `i64`
+ |
+LL | foo::<i64>(42_i64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:57:16
+ |
+LL | foo::<i64>(42_i16);
+ | ---------- ^^^^^^ expected `i64`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i16` to `i64`
+ |
+LL | foo::<i64>(42_i64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:61:16
+ |
+LL | foo::<i64>(42_i8);
+ | ---------- ^^^^^ expected `i64`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i8` to `i64`
+ |
+LL | foo::<i64>(42_i64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:65:16
+ |
+LL | foo::<i64>(42.0_f64);
+ | ---------- ^^^^^^^^ expected `i64`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `i64`
+ |
+LL | foo::<i64>(42i64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-i64.rs:69:16
+ |
+LL | foo::<i64>(42.0_f32);
+ | ---------- ^^^^^^^^ expected `i64`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-i64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `i64`
+ |
+LL | foo::<i64>(42i64);
+ | ~~~
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.fixed b/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.fixed
new file mode 100644
index 000000000..faed65ca4
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.fixed
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<isize>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_isize);
+ foo::<isize>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.rs b/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.rs
new file mode 100644
index 000000000..df0b4cb62
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.rs
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<isize>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_isize);
+ foo::<isize>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<isize>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr
new file mode 100644
index 000000000..28b79413f
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr
@@ -0,0 +1,201 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:28:18
+ |
+LL | foo::<isize>(42_usize);
+ | ------------ ^^^^^^^^ expected `isize`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `isize`
+ |
+LL | foo::<isize>(42_isize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:32:18
+ |
+LL | foo::<isize>(42_u64);
+ | ------------ ^^^^^^ expected `isize`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `isize`
+ |
+LL | foo::<isize>(42_isize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:36:18
+ |
+LL | foo::<isize>(42_u32);
+ | ------------ ^^^^^^ expected `isize`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u32` to `isize`
+ |
+LL | foo::<isize>(42_isize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:40:18
+ |
+LL | foo::<isize>(42_u16);
+ | ------------ ^^^^^^ expected `isize`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u16` to `isize`
+ |
+LL | foo::<isize>(42_isize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:44:18
+ |
+LL | foo::<isize>(42_u8);
+ | ------------ ^^^^^ expected `isize`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u8` to `isize`
+ |
+LL | foo::<isize>(42_isize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:49:18
+ |
+LL | foo::<isize>(42_i64);
+ | ------------ ^^^^^^ expected `isize`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `isize`
+ |
+LL | foo::<isize>(42_isize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:53:18
+ |
+LL | foo::<isize>(42_i32);
+ | ------------ ^^^^^^ expected `isize`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i32` to `isize`
+ |
+LL | foo::<isize>(42_isize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:57:18
+ |
+LL | foo::<isize>(42_i16);
+ | ------------ ^^^^^^ expected `isize`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i16` to `isize`
+ |
+LL | foo::<isize>(42_isize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:61:18
+ |
+LL | foo::<isize>(42_i8);
+ | ------------ ^^^^^ expected `isize`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i8` to `isize`
+ |
+LL | foo::<isize>(42_isize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:65:18
+ |
+LL | foo::<isize>(42.0_f64);
+ | ------------ ^^^^^^^^ expected `isize`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `isize`
+ |
+LL | foo::<isize>(42isize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-isize.rs:69:18
+ |
+LL | foo::<isize>(42.0_f32);
+ | ------------ ^^^^^^^^ expected `isize`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-isize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `isize`
+ |
+LL | foo::<isize>(42isize);
+ | ~~~~~
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.fixed b/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.fixed
new file mode 100644
index 000000000..5955829e7
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.fixed
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<u32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u32);
+ foo::<u32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.rs b/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.rs
new file mode 100644
index 000000000..5c303036a
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.rs
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<u32>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u32);
+ foo::<u32>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u32>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr
new file mode 100644
index 000000000..d966893a8
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr
@@ -0,0 +1,201 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:28:16
+ |
+LL | foo::<u32>(42_usize);
+ | ---------- ^^^^^^^^ expected `u32`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `u32`
+ |
+LL | foo::<u32>(42_u32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:32:16
+ |
+LL | foo::<u32>(42_u64);
+ | ---------- ^^^^^^ expected `u32`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `u32`
+ |
+LL | foo::<u32>(42_u32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:37:16
+ |
+LL | foo::<u32>(42_u16);
+ | ---------- ^^^^^^ expected `u32`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u16` to `u32`
+ |
+LL | foo::<u32>(42_u32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:41:16
+ |
+LL | foo::<u32>(42_u8);
+ | ---------- ^^^^^ expected `u32`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u8` to `u32`
+ |
+LL | foo::<u32>(42_u32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:45:16
+ |
+LL | foo::<u32>(42_isize);
+ | ---------- ^^^^^^^^ expected `u32`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `u32`
+ |
+LL | foo::<u32>(42_u32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:49:16
+ |
+LL | foo::<u32>(42_i64);
+ | ---------- ^^^^^^ expected `u32`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `u32`
+ |
+LL | foo::<u32>(42_u32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:53:16
+ |
+LL | foo::<u32>(42_i32);
+ | ---------- ^^^^^^ expected `u32`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i32` to `u32`
+ |
+LL | foo::<u32>(42_u32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:57:16
+ |
+LL | foo::<u32>(42_i16);
+ | ---------- ^^^^^^ expected `u32`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i16` to `u32`
+ |
+LL | foo::<u32>(42_u32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:61:16
+ |
+LL | foo::<u32>(42_i8);
+ | ---------- ^^^^^ expected `u32`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i8` to `u32`
+ |
+LL | foo::<u32>(42_u32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:65:16
+ |
+LL | foo::<u32>(42.0_f64);
+ | ---------- ^^^^^^^^ expected `u32`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `u32`
+ |
+LL | foo::<u32>(42u32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u32.rs:69:16
+ |
+LL | foo::<u32>(42.0_f32);
+ | ---------- ^^^^^^^^ expected `u32`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u32.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `u32`
+ |
+LL | foo::<u32>(42u32);
+ | ~~~
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.fixed b/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.fixed
new file mode 100644
index 000000000..4623c211c
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.fixed
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<u64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u64);
+ foo::<u64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.rs b/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.rs
new file mode 100644
index 000000000..3e9995c74
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.rs
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<u64>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u64);
+ foo::<u64>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u64>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr
new file mode 100644
index 000000000..ff332fa91
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr
@@ -0,0 +1,201 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:28:16
+ |
+LL | foo::<u64>(42_usize);
+ | ---------- ^^^^^^^^ expected `u64`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `u64`
+ |
+LL | foo::<u64>(42_u64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:33:16
+ |
+LL | foo::<u64>(42_u32);
+ | ---------- ^^^^^^ expected `u64`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u32` to `u64`
+ |
+LL | foo::<u64>(42_u64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:37:16
+ |
+LL | foo::<u64>(42_u16);
+ | ---------- ^^^^^^ expected `u64`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u16` to `u64`
+ |
+LL | foo::<u64>(42_u64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:41:16
+ |
+LL | foo::<u64>(42_u8);
+ | ---------- ^^^^^ expected `u64`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u8` to `u64`
+ |
+LL | foo::<u64>(42_u64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:45:16
+ |
+LL | foo::<u64>(42_isize);
+ | ---------- ^^^^^^^^ expected `u64`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `u64`
+ |
+LL | foo::<u64>(42_u64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:49:16
+ |
+LL | foo::<u64>(42_i64);
+ | ---------- ^^^^^^ expected `u64`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `u64`
+ |
+LL | foo::<u64>(42_u64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:53:16
+ |
+LL | foo::<u64>(42_i32);
+ | ---------- ^^^^^^ expected `u64`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i32` to `u64`
+ |
+LL | foo::<u64>(42_u64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:57:16
+ |
+LL | foo::<u64>(42_i16);
+ | ---------- ^^^^^^ expected `u64`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i16` to `u64`
+ |
+LL | foo::<u64>(42_u64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:61:16
+ |
+LL | foo::<u64>(42_i8);
+ | ---------- ^^^^^ expected `u64`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i8` to `u64`
+ |
+LL | foo::<u64>(42_u64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:65:16
+ |
+LL | foo::<u64>(42.0_f64);
+ | ---------- ^^^^^^^^ expected `u64`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `u64`
+ |
+LL | foo::<u64>(42u64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-u64.rs:69:16
+ |
+LL | foo::<u64>(42.0_f32);
+ | ---------- ^^^^^^^^ expected `u64`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-u64.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `u64`
+ |
+LL | foo::<u64>(42u64);
+ | ~~~
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.fixed b/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.fixed
new file mode 100644
index 000000000..6cb5243ca
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.fixed
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<usize>(42_usize);
+ foo::<usize>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.rs b/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.rs
new file mode 100644
index 000000000..a2304ba26
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.rs
@@ -0,0 +1,73 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+fn main() {
+ foo::<usize>(42_usize);
+ foo::<usize>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<usize>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr
new file mode 100644
index 000000000..4889abee6
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr
@@ -0,0 +1,201 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:29:18
+ |
+LL | foo::<usize>(42_u64);
+ | ------------ ^^^^^^ expected `usize`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `usize`
+ |
+LL | foo::<usize>(42_usize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:33:18
+ |
+LL | foo::<usize>(42_u32);
+ | ------------ ^^^^^^ expected `usize`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u32` to `usize`
+ |
+LL | foo::<usize>(42_usize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:37:18
+ |
+LL | foo::<usize>(42_u16);
+ | ------------ ^^^^^^ expected `usize`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u16` to `usize`
+ |
+LL | foo::<usize>(42_usize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:41:18
+ |
+LL | foo::<usize>(42_u8);
+ | ------------ ^^^^^ expected `usize`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u8` to `usize`
+ |
+LL | foo::<usize>(42_usize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:45:18
+ |
+LL | foo::<usize>(42_isize);
+ | ------------ ^^^^^^^^ expected `usize`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `usize`
+ |
+LL | foo::<usize>(42_usize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:49:18
+ |
+LL | foo::<usize>(42_i64);
+ | ------------ ^^^^^^ expected `usize`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `usize`
+ |
+LL | foo::<usize>(42_usize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:53:18
+ |
+LL | foo::<usize>(42_i32);
+ | ------------ ^^^^^^ expected `usize`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i32` to `usize`
+ |
+LL | foo::<usize>(42_usize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:57:18
+ |
+LL | foo::<usize>(42_i16);
+ | ------------ ^^^^^^ expected `usize`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i16` to `usize`
+ |
+LL | foo::<usize>(42_usize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:61:18
+ |
+LL | foo::<usize>(42_i8);
+ | ------------ ^^^^^ expected `usize`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i8` to `usize`
+ |
+LL | foo::<usize>(42_usize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:65:18
+ |
+LL | foo::<usize>(42.0_f64);
+ | ------------ ^^^^^^^^ expected `usize`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `usize`
+ |
+LL | foo::<usize>(42usize);
+ | ~~~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix-usize.rs:69:18
+ |
+LL | foo::<usize>(42.0_f32);
+ | ------------ ^^^^^^^^ expected `usize`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix-usize.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `usize`
+ |
+LL | foo::<usize>(42usize);
+ | ~~~~~
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix.fixed b/tests/ui/numeric/numeric-suffix/numeric-suffix.fixed
new file mode 100644
index 000000000..69934db21
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix.fixed
@@ -0,0 +1,427 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+
+fn main() {
+ foo::<u16>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u16);
+ foo::<u16>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+
+ foo::<i16>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i16);
+ foo::<i16>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+
+ foo::<u8>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u8);
+ foo::<u8>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+
+ foo::<i8>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i8);
+ foo::<i8>(42i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+
+ foo::<f64>(42_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_u32.into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_u16.into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_u8.into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_i32.into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_i16.into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_i8.into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42.0_f64);
+ foo::<f64>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+
+ foo::<f32>(42_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_u16.into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_u8.into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_i16.into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_i8.into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42.0_f32);
+
+ foo::<u32>((42_u8 as u16).into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>((-42_i8).into());
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix.rs b/tests/ui/numeric/numeric-suffix/numeric-suffix.rs
new file mode 100644
index 000000000..dabf43f82
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix.rs
@@ -0,0 +1,427 @@
+// run-rustfix
+
+fn foo<N>(_x: N) {}
+//~^ NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE function defined here
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+//~| NOTE
+
+
+fn main() {
+ foo::<u16>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_u16);
+ foo::<u16>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u16>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+
+ foo::<i16>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42_i16);
+ foo::<i16>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i16>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+
+ foo::<u8>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_u8);
+ foo::<u8>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<u8>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+
+ foo::<i8>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42_i8);
+ foo::<i8>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i8>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+
+ foo::<f64>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f64>(42.0_f64);
+ foo::<f64>(42.0_f32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+
+ foo::<f32>(42_usize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_u64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_u32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_u8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_isize);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_i64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_i32);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_i16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42.0_f64);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<f32>(42.0_f32);
+
+ foo::<u32>(42_u8 as u16);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+ foo::<i32>(-42_i8);
+ //~^ ERROR mismatched types
+ //~| NOTE expected
+ //~| NOTE arguments
+}
diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr
new file mode 100644
index 000000000..e05913b9c
--- /dev/null
+++ b/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr
@@ -0,0 +1,1227 @@
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:143:16
+ |
+LL | foo::<u16>(42_usize);
+ | ---------- ^^^^^^^^ expected `u16`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `u16`
+ |
+LL | foo::<u16>(42_u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:147:16
+ |
+LL | foo::<u16>(42_u64);
+ | ---------- ^^^^^^ expected `u16`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `u16`
+ |
+LL | foo::<u16>(42_u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:151:16
+ |
+LL | foo::<u16>(42_u32);
+ | ---------- ^^^^^^ expected `u16`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u32` to `u16`
+ |
+LL | foo::<u16>(42_u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:156:16
+ |
+LL | foo::<u16>(42_u8);
+ | ---------- ^^^^^ expected `u16`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u8` to `u16`
+ |
+LL | foo::<u16>(42_u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:160:16
+ |
+LL | foo::<u16>(42_isize);
+ | ---------- ^^^^^^^^ expected `u16`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `u16`
+ |
+LL | foo::<u16>(42_u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:164:16
+ |
+LL | foo::<u16>(42_i64);
+ | ---------- ^^^^^^ expected `u16`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `u16`
+ |
+LL | foo::<u16>(42_u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:168:16
+ |
+LL | foo::<u16>(42_i32);
+ | ---------- ^^^^^^ expected `u16`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i32` to `u16`
+ |
+LL | foo::<u16>(42_u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:172:16
+ |
+LL | foo::<u16>(42_i16);
+ | ---------- ^^^^^^ expected `u16`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i16` to `u16`
+ |
+LL | foo::<u16>(42_u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:176:16
+ |
+LL | foo::<u16>(42_i8);
+ | ---------- ^^^^^ expected `u16`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i8` to `u16`
+ |
+LL | foo::<u16>(42_u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:180:16
+ |
+LL | foo::<u16>(42.0_f64);
+ | ---------- ^^^^^^^^ expected `u16`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `u16`
+ |
+LL | foo::<u16>(42u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:184:16
+ |
+LL | foo::<u16>(42.0_f32);
+ | ---------- ^^^^^^^^ expected `u16`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `u16`
+ |
+LL | foo::<u16>(42u16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:189:16
+ |
+LL | foo::<i16>(42_usize);
+ | ---------- ^^^^^^^^ expected `i16`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `i16`
+ |
+LL | foo::<i16>(42_i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:193:16
+ |
+LL | foo::<i16>(42_u64);
+ | ---------- ^^^^^^ expected `i16`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `i16`
+ |
+LL | foo::<i16>(42_i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:197:16
+ |
+LL | foo::<i16>(42_u32);
+ | ---------- ^^^^^^ expected `i16`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u32` to `i16`
+ |
+LL | foo::<i16>(42_i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:201:16
+ |
+LL | foo::<i16>(42_u16);
+ | ---------- ^^^^^^ expected `i16`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u16` to `i16`
+ |
+LL | foo::<i16>(42_i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:205:16
+ |
+LL | foo::<i16>(42_u8);
+ | ---------- ^^^^^ expected `i16`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u8` to `i16`
+ |
+LL | foo::<i16>(42_i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:209:16
+ |
+LL | foo::<i16>(42_isize);
+ | ---------- ^^^^^^^^ expected `i16`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `i16`
+ |
+LL | foo::<i16>(42_i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:213:16
+ |
+LL | foo::<i16>(42_i64);
+ | ---------- ^^^^^^ expected `i16`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `i16`
+ |
+LL | foo::<i16>(42_i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:217:16
+ |
+LL | foo::<i16>(42_i32);
+ | ---------- ^^^^^^ expected `i16`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i32` to `i16`
+ |
+LL | foo::<i16>(42_i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:222:16
+ |
+LL | foo::<i16>(42_i8);
+ | ---------- ^^^^^ expected `i16`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i8` to `i16`
+ |
+LL | foo::<i16>(42_i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:226:16
+ |
+LL | foo::<i16>(42.0_f64);
+ | ---------- ^^^^^^^^ expected `i16`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `i16`
+ |
+LL | foo::<i16>(42i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:230:16
+ |
+LL | foo::<i16>(42.0_f32);
+ | ---------- ^^^^^^^^ expected `i16`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `i16`
+ |
+LL | foo::<i16>(42i16);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:235:15
+ |
+LL | foo::<u8>(42_usize);
+ | --------- ^^^^^^^^ expected `u8`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `u8`
+ |
+LL | foo::<u8>(42_u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:239:15
+ |
+LL | foo::<u8>(42_u64);
+ | --------- ^^^^^^ expected `u8`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `u8`
+ |
+LL | foo::<u8>(42_u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:243:15
+ |
+LL | foo::<u8>(42_u32);
+ | --------- ^^^^^^ expected `u8`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u32` to `u8`
+ |
+LL | foo::<u8>(42_u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:247:15
+ |
+LL | foo::<u8>(42_u16);
+ | --------- ^^^^^^ expected `u8`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u16` to `u8`
+ |
+LL | foo::<u8>(42_u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:252:15
+ |
+LL | foo::<u8>(42_isize);
+ | --------- ^^^^^^^^ expected `u8`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `u8`
+ |
+LL | foo::<u8>(42_u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:256:15
+ |
+LL | foo::<u8>(42_i64);
+ | --------- ^^^^^^ expected `u8`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `u8`
+ |
+LL | foo::<u8>(42_u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:260:15
+ |
+LL | foo::<u8>(42_i32);
+ | --------- ^^^^^^ expected `u8`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i32` to `u8`
+ |
+LL | foo::<u8>(42_u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:264:15
+ |
+LL | foo::<u8>(42_i16);
+ | --------- ^^^^^^ expected `u8`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i16` to `u8`
+ |
+LL | foo::<u8>(42_u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:268:15
+ |
+LL | foo::<u8>(42_i8);
+ | --------- ^^^^^ expected `u8`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i8` to `u8`
+ |
+LL | foo::<u8>(42_u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:272:15
+ |
+LL | foo::<u8>(42.0_f64);
+ | --------- ^^^^^^^^ expected `u8`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `u8`
+ |
+LL | foo::<u8>(42u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:276:15
+ |
+LL | foo::<u8>(42.0_f32);
+ | --------- ^^^^^^^^ expected `u8`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `u8`
+ |
+LL | foo::<u8>(42u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:281:15
+ |
+LL | foo::<i8>(42_usize);
+ | --------- ^^^^^^^^ expected `i8`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `i8`
+ |
+LL | foo::<i8>(42_i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:285:15
+ |
+LL | foo::<i8>(42_u64);
+ | --------- ^^^^^^ expected `i8`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `i8`
+ |
+LL | foo::<i8>(42_i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:289:15
+ |
+LL | foo::<i8>(42_u32);
+ | --------- ^^^^^^ expected `i8`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u32` to `i8`
+ |
+LL | foo::<i8>(42_i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:293:15
+ |
+LL | foo::<i8>(42_u16);
+ | --------- ^^^^^^ expected `i8`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u16` to `i8`
+ |
+LL | foo::<i8>(42_i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:297:15
+ |
+LL | foo::<i8>(42_u8);
+ | --------- ^^^^^ expected `i8`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u8` to `i8`
+ |
+LL | foo::<i8>(42_i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:301:15
+ |
+LL | foo::<i8>(42_isize);
+ | --------- ^^^^^^^^ expected `i8`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `i8`
+ |
+LL | foo::<i8>(42_i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:305:15
+ |
+LL | foo::<i8>(42_i64);
+ | --------- ^^^^^^ expected `i8`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `i8`
+ |
+LL | foo::<i8>(42_i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:309:15
+ |
+LL | foo::<i8>(42_i32);
+ | --------- ^^^^^^ expected `i8`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i32` to `i8`
+ |
+LL | foo::<i8>(42_i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:313:15
+ |
+LL | foo::<i8>(42_i16);
+ | --------- ^^^^^^ expected `i8`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i16` to `i8`
+ |
+LL | foo::<i8>(42_i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:318:15
+ |
+LL | foo::<i8>(42.0_f64);
+ | --------- ^^^^^^^^ expected `i8`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `i8`
+ |
+LL | foo::<i8>(42i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:322:15
+ |
+LL | foo::<i8>(42.0_f32);
+ | --------- ^^^^^^^^ expected `i8`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `i8`
+ |
+LL | foo::<i8>(42i8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:327:16
+ |
+LL | foo::<f64>(42_usize);
+ | ---------- ^^^^^^^^ expected `f64`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `f64`
+ |
+LL | foo::<f64>(42_f64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:331:16
+ |
+LL | foo::<f64>(42_u64);
+ | ---------- ^^^^^^ expected `f64`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `f64`
+ |
+LL | foo::<f64>(42_f64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:335:16
+ |
+LL | foo::<f64>(42_u32);
+ | ---------- ^^^^^^ expected `f64`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u32` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(42_u32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:339:16
+ |
+LL | foo::<f64>(42_u16);
+ | ---------- ^^^^^^ expected `f64`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(42_u16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:343:16
+ |
+LL | foo::<f64>(42_u8);
+ | ---------- ^^^^^ expected `f64`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(42_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:347:16
+ |
+LL | foo::<f64>(42_isize);
+ | ---------- ^^^^^^^^ expected `f64`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `f64`
+ |
+LL | foo::<f64>(42_f64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:351:16
+ |
+LL | foo::<f64>(42_i64);
+ | ---------- ^^^^^^ expected `f64`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `f64`
+ |
+LL | foo::<f64>(42_f64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:355:16
+ |
+LL | foo::<f64>(42_i32);
+ | ---------- ^^^^^^ expected `f64`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i32` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(42_i32.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:359:16
+ |
+LL | foo::<f64>(42_i16);
+ | ---------- ^^^^^^ expected `f64`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(42_i16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:363:16
+ |
+LL | foo::<f64>(42_i8);
+ | ---------- ^^^^^ expected `f64`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to an `f64`, producing the floating point representation of the integer
+ |
+LL | foo::<f64>(42_i8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:368:16
+ |
+LL | foo::<f64>(42.0_f32);
+ | ---------- ^^^^^^^^ expected `f64`, found `f32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f32` to `f64`
+ |
+LL | foo::<f64>(42.0_f64);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:373:16
+ |
+LL | foo::<f32>(42_usize);
+ | ---------- ^^^^^^^^ expected `f32`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `usize` to `f32`
+ |
+LL | foo::<f32>(42_f32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:377:16
+ |
+LL | foo::<f32>(42_u64);
+ | ---------- ^^^^^^ expected `f32`, found `u64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u64` to `f32`
+ |
+LL | foo::<f32>(42_f32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:381:16
+ |
+LL | foo::<f32>(42_u32);
+ | ---------- ^^^^^^ expected `f32`, found `u32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `u32` to `f32`
+ |
+LL | foo::<f32>(42_f32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:385:16
+ |
+LL | foo::<f32>(42_u16);
+ | ---------- ^^^^^^ expected `f32`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to an `f32`, producing the floating point representation of the integer
+ |
+LL | foo::<f32>(42_u16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:389:16
+ |
+LL | foo::<f32>(42_u8);
+ | ---------- ^^^^^ expected `f32`, found `u8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u8` to an `f32`, producing the floating point representation of the integer
+ |
+LL | foo::<f32>(42_u8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:393:16
+ |
+LL | foo::<f32>(42_isize);
+ | ---------- ^^^^^^^^ expected `f32`, found `isize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `isize` to `f32`
+ |
+LL | foo::<f32>(42_f32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:397:16
+ |
+LL | foo::<f32>(42_i64);
+ | ---------- ^^^^^^ expected `f32`, found `i64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i64` to `f32`
+ |
+LL | foo::<f32>(42_f32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:401:16
+ |
+LL | foo::<f32>(42_i32);
+ | ---------- ^^^^^^ expected `f32`, found `i32`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `i32` to `f32`
+ |
+LL | foo::<f32>(42_f32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:405:16
+ |
+LL | foo::<f32>(42_i16);
+ | ---------- ^^^^^^ expected `f32`, found `i16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i16` to an `f32`, producing the floating point representation of the integer
+ |
+LL | foo::<f32>(42_i16.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:409:16
+ |
+LL | foo::<f32>(42_i8);
+ | ---------- ^^^^^ expected `f32`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to an `f32`, producing the floating point representation of the integer
+ |
+LL | foo::<f32>(42_i8.into());
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:413:16
+ |
+LL | foo::<f32>(42.0_f64);
+ | ---------- ^^^^^^^^ expected `f32`, found `f64`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: change the type of the numeric literal from `f64` to `f32`
+ |
+LL | foo::<f32>(42.0_f32);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:419:16
+ |
+LL | foo::<u32>(42_u8 as u16);
+ | ---------- ^^^^^^^^^^^^ expected `u32`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert a `u16` to a `u32`
+ |
+LL | foo::<u32>((42_u8 as u16).into());
+ | + ++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/numeric-suffix.rs:423:16
+ |
+LL | foo::<i32>(-42_i8);
+ | ---------- ^^^^^^ expected `i32`, found `i8`
+ | |
+ | arguments to this function are incorrect
+ |
+note: function defined here
+ --> $DIR/numeric-suffix.rs:3:4
+ |
+LL | fn foo<N>(_x: N) {}
+ | ^^^ -----
+help: you can convert an `i8` to an `i32`
+ |
+LL | foo::<i32>((-42_i8).into());
+ | + ++++++++
+
+error: aborting due to 68 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/numeric/uppercase-base-prefix-invalid-no-fix.rs b/tests/ui/numeric/uppercase-base-prefix-invalid-no-fix.rs
new file mode 100644
index 000000000..f00cde4a7
--- /dev/null
+++ b/tests/ui/numeric/uppercase-base-prefix-invalid-no-fix.rs
@@ -0,0 +1,34 @@
+// Checks that integers with seeming uppercase base prefixes do not get bogus capitalization
+// suggestions.
+
+fn main() {
+ _ = 123X1a3;
+ //~^ ERROR invalid suffix `X1a3` for number literal
+ //~| NOTE invalid suffix `X1a3`
+ //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+ _ = 456O123;
+ //~^ ERROR invalid suffix `O123` for number literal
+ //~| NOTE invalid suffix `O123`
+ //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+ _ = 789B101;
+ //~^ ERROR invalid suffix `B101` for number literal
+ //~| NOTE invalid suffix `B101`
+ //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+ _ = 0XYZ;
+ //~^ ERROR invalid suffix `XYZ` for number literal
+ //~| NOTE invalid suffix `XYZ`
+ //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+ _ = 0OPQ;
+ //~^ ERROR invalid suffix `OPQ` for number literal
+ //~| NOTE invalid suffix `OPQ`
+ //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+ _ = 0BCD;
+ //~^ ERROR invalid suffix `BCD` for number literal
+ //~| NOTE invalid suffix `BCD`
+ //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+}
diff --git a/tests/ui/numeric/uppercase-base-prefix-invalid-no-fix.stderr b/tests/ui/numeric/uppercase-base-prefix-invalid-no-fix.stderr
new file mode 100644
index 000000000..380c16ca7
--- /dev/null
+++ b/tests/ui/numeric/uppercase-base-prefix-invalid-no-fix.stderr
@@ -0,0 +1,50 @@
+error: invalid suffix `X1a3` for number literal
+ --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:5:9
+ |
+LL | _ = 123X1a3;
+ | ^^^^^^^ invalid suffix `X1a3`
+ |
+ = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+error: invalid suffix `O123` for number literal
+ --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:10:9
+ |
+LL | _ = 456O123;
+ | ^^^^^^^ invalid suffix `O123`
+ |
+ = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+error: invalid suffix `B101` for number literal
+ --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:15:9
+ |
+LL | _ = 789B101;
+ | ^^^^^^^ invalid suffix `B101`
+ |
+ = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+error: invalid suffix `XYZ` for number literal
+ --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:20:9
+ |
+LL | _ = 0XYZ;
+ | ^^^^ invalid suffix `XYZ`
+ |
+ = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+error: invalid suffix `OPQ` for number literal
+ --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:25:9
+ |
+LL | _ = 0OPQ;
+ | ^^^^ invalid suffix `OPQ`
+ |
+ = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+error: invalid suffix `BCD` for number literal
+ --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:30:9
+ |
+LL | _ = 0BCD;
+ | ^^^^ invalid suffix `BCD`
+ |
+ = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+error: aborting due to 6 previous errors
+
diff --git a/tests/ui/numeric/uppercase-base-prefix.fixed b/tests/ui/numeric/uppercase-base-prefix.fixed
new file mode 100644
index 000000000..1b1c837ec
--- /dev/null
+++ b/tests/ui/numeric/uppercase-base-prefix.fixed
@@ -0,0 +1,77 @@
+// run-rustfix
+// Checks that integers with an uppercase base prefix (0B, 0X, 0O) have a nice error
+#![allow(unused_variables)]
+
+fn main() {
+ let a = 0xABCDEF;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0xABCDEF
+
+ let b = 0o755;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0o755
+
+ let c = 0b10101010;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0b10101010
+
+ let d = 0xABC_DEF;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0xABC_DEF
+
+ let e = 0o7_55;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0o7_55
+
+ let f = 0b1010_1010;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0b1010_1010
+
+ let g = 0xABC_DEF_u64;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0xABC_DEF_u64
+
+ let h = 0o7_55_u32;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0o7_55_u32
+
+ let i = 0b1010_1010_u8;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0b1010_1010_u8
+ //
+ let j = 0xABCDEFu64;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0xABCDEFu64
+
+ let k = 0o755u32;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0o755u32
+
+ let l = 0b10101010u8;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0b10101010u8
+}
diff --git a/tests/ui/numeric/uppercase-base-prefix.rs b/tests/ui/numeric/uppercase-base-prefix.rs
new file mode 100644
index 000000000..233d553da
--- /dev/null
+++ b/tests/ui/numeric/uppercase-base-prefix.rs
@@ -0,0 +1,77 @@
+// run-rustfix
+// Checks that integers with an uppercase base prefix (0B, 0X, 0O) have a nice error
+#![allow(unused_variables)]
+
+fn main() {
+ let a = 0XABCDEF;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0xABCDEF
+
+ let b = 0O755;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0o755
+
+ let c = 0B10101010;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0b10101010
+
+ let d = 0XABC_DEF;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0xABC_DEF
+
+ let e = 0O7_55;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0o7_55
+
+ let f = 0B1010_1010;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0b1010_1010
+
+ let g = 0XABC_DEF_u64;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0xABC_DEF_u64
+
+ let h = 0O7_55_u32;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0o7_55_u32
+
+ let i = 0B1010_1010_u8;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0b1010_1010_u8
+ //
+ let j = 0XABCDEFu64;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0xABCDEFu64
+
+ let k = 0O755u32;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0o755u32
+
+ let l = 0B10101010u8;
+ //~^ ERROR invalid base prefix for number literal
+ //~| NOTE base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ //~| HELP try making the prefix lowercase
+ //~| SUGGESTION 0b10101010u8
+}
diff --git a/tests/ui/numeric/uppercase-base-prefix.stderr b/tests/ui/numeric/uppercase-base-prefix.stderr
new file mode 100644
index 000000000..4ba8d5224
--- /dev/null
+++ b/tests/ui/numeric/uppercase-base-prefix.stderr
@@ -0,0 +1,98 @@
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:6:13
+ |
+LL | let a = 0XABCDEF;
+ | ^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0xABCDEF`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:12:13
+ |
+LL | let b = 0O755;
+ | ^^^^^ help: try making the prefix lowercase (notice the capitalization): `0o755`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:18:13
+ |
+LL | let c = 0B10101010;
+ | ^^^^^^^^^^ help: try making the prefix lowercase: `0b10101010`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:24:13
+ |
+LL | let d = 0XABC_DEF;
+ | ^^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0xABC_DEF`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:30:13
+ |
+LL | let e = 0O7_55;
+ | ^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0o7_55`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:36:13
+ |
+LL | let f = 0B1010_1010;
+ | ^^^^^^^^^^^ help: try making the prefix lowercase: `0b1010_1010`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:42:13
+ |
+LL | let g = 0XABC_DEF_u64;
+ | ^^^^^^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0xABC_DEF_u64`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:48:13
+ |
+LL | let h = 0O7_55_u32;
+ | ^^^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0o7_55_u32`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:54:13
+ |
+LL | let i = 0B1010_1010_u8;
+ | ^^^^^^^^^^^^^^ help: try making the prefix lowercase: `0b1010_1010_u8`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:60:13
+ |
+LL | let j = 0XABCDEFu64;
+ | ^^^^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0xABCDEFu64`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:66:13
+ |
+LL | let k = 0O755u32;
+ | ^^^^^^^^ help: try making the prefix lowercase (notice the capitalization): `0o755u32`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: invalid base prefix for number literal
+ --> $DIR/uppercase-base-prefix.rs:72:13
+ |
+LL | let l = 0B10101010u8;
+ | ^^^^^^^^^^^^ help: try making the prefix lowercase: `0b10101010u8`
+ |
+ = note: base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+
+error: aborting due to 12 previous errors
+