diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/cast/cast_lit_suffix-issue-138392.fixed | 6 | ||||
| -rw-r--r-- | tests/ui/cast/cast_lit_suffix-issue-138392.rs | 6 | ||||
| -rw-r--r-- | tests/ui/cast/cast_lit_suffix-issue-138392.stderr | 31 |
3 files changed, 43 insertions, 0 deletions
diff --git a/tests/ui/cast/cast_lit_suffix-issue-138392.fixed b/tests/ui/cast/cast_lit_suffix-issue-138392.fixed new file mode 100644 index 00000000000..c6fbd09f89c --- /dev/null +++ b/tests/ui/cast/cast_lit_suffix-issue-138392.fixed @@ -0,0 +1,6 @@ +//@ run-rustfix +#![allow(unused_parens)] +fn main() { + let _x: u8 = (4u8); //~ ERROR: mismatched types + let _y: u8 = (4u8); //~ ERROR: mismatched types +} diff --git a/tests/ui/cast/cast_lit_suffix-issue-138392.rs b/tests/ui/cast/cast_lit_suffix-issue-138392.rs new file mode 100644 index 00000000000..86dbbbbf126 --- /dev/null +++ b/tests/ui/cast/cast_lit_suffix-issue-138392.rs @@ -0,0 +1,6 @@ +//@ run-rustfix +#![allow(unused_parens)] +fn main() { + let _x: u8 = (4i32); //~ ERROR: mismatched types + let _y: u8 = (4.0f32); //~ ERROR: mismatched types +} diff --git a/tests/ui/cast/cast_lit_suffix-issue-138392.stderr b/tests/ui/cast/cast_lit_suffix-issue-138392.stderr new file mode 100644 index 00000000000..998fcfc36dc --- /dev/null +++ b/tests/ui/cast/cast_lit_suffix-issue-138392.stderr @@ -0,0 +1,31 @@ +error[E0308]: mismatched types + --> $DIR/cast_lit_suffix-issue-138392.rs:4:18 + | +LL | let _x: u8 = (4i32); + | -- ^^^^^^ expected `u8`, found `i32` + | | + | expected due to this + | +help: change the type of the numeric literal from `i32` to `u8` + | +LL - let _x: u8 = (4i32); +LL + let _x: u8 = (4u8); + | + +error[E0308]: mismatched types + --> $DIR/cast_lit_suffix-issue-138392.rs:5:18 + | +LL | let _y: u8 = (4.0f32); + | -- ^^^^^^^^ expected `u8`, found `f32` + | | + | expected due to this + | +help: change the type of the numeric literal from `f32` to `u8` + | +LL - let _y: u8 = (4.0f32); +LL + let _y: u8 = (4u8); + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. |
