File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -582,3 +582,13 @@ mod issue14150 {
582582 //~^ cast_possible_wrap
583583 }
584584}
585+
586+ fn issue16045 ( ) {
587+ fn f ( ) -> Result < ( ) , ( ) > {
588+ let val = Ok :: < _ , ( ) > ( 0u8 ) ;
589+ _ = val? as i8 ;
590+ //~^ cast_possible_wrap
591+
592+ Ok ( ( ) )
593+ }
594+ }
Original file line number Diff line number Diff line change @@ -764,5 +764,11 @@ error: casting `u8` to `i8` may wrap around the value
764764LL | _ = 1u8 as i8;
765765 | ^^^^^^^^^
766766
767- error: aborting due to 94 previous errors
767+ error: casting `u8` to `i8` may wrap around the value
768+ --> tests/ui/cast.rs:589:13
769+ |
770+ LL | _ = val? as i8;
771+ | ^^^^^^^^^^ help: if this is intentional, use `cast_signed()` instead: `val?.cast_signed()`
772+
773+ error: aborting due to 95 previous errors
768774
You can’t perform that action at this time.
0 commit comments