File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -569,3 +569,16 @@ fn issue12721() {
569
569
( 255 % 999999u64 ) as u8 ;
570
570
//~^ cast_possible_truncation
571
571
}
572
+
573
+ mod issue14150 {
574
+ #[ clippy:: msrv = "1.87" ]
575
+ fn msrv_supports_cast_signed ( ) {
576
+ _ = 1u8 as i8 ;
577
+ //~^ cast_possible_wrap
578
+ }
579
+ #[ clippy:: msrv = "1.86" ]
580
+ fn msrv_doesnt_supports_cast_signed ( ) {
581
+ _ = 1u8 as i8 ;
582
+ //~^ cast_possible_wrap
583
+ }
584
+ }
Original file line number Diff line number Diff line change @@ -752,5 +752,17 @@ LL - (255 % 999999u64) as u8;
752
752
LL + u8::try_from(255 % 999999u64);
753
753
|
754
754
755
- error: aborting due to 92 previous errors
755
+ error: casting `u8` to `i8` may wrap around the value
756
+ --> tests/ui/cast.rs:576:13
757
+ |
758
+ LL | _ = 1u8 as i8;
759
+ | ^^^^^^^^^ help: if this is intentional, consider using `cast_signed()` instead: `1u8.cast_signed()`
760
+
761
+ error: casting `u8` to `i8` may wrap around the value
762
+ --> tests/ui/cast.rs:581:13
763
+ |
764
+ LL | _ = 1u8 as i8;
765
+ | ^^^^^^^^^
766
+
767
+ error: aborting due to 94 previous errors
756
768
You can’t perform that action at this time.
0 commit comments