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() {
569569 ( 255 % 999999u64 ) as u8 ;
570570 //~^ cast_possible_truncation
571571}
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;
752752LL + u8::try_from(255 % 999999u64);
753753 |
754754
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
756768
You can’t perform that action at this time.
0 commit comments