File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
compiler/rustc_codegen_cranelift/src Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ use rustc_ast::InlineAsmOptions;
88use rustc_codegen_ssa:: base:: is_call_from_compiler_builtins_to_upstream_monomorphization;
99use rustc_data_structures:: profiling:: SelfProfilerRef ;
1010use rustc_index:: IndexVec ;
11+ use rustc_middle:: ty:: TypeVisitableExt ;
1112use rustc_middle:: ty:: adjustment:: PointerCoercion ;
1213use rustc_middle:: ty:: layout:: FnAbiOf ;
1314use rustc_middle:: ty:: print:: with_no_trimmed_paths;
14- use rustc_middle:: ty:: { ScalarInt , TypeVisitableExt } ;
1515use rustc_session:: config:: OutputFilenames ;
1616use rustc_span:: Symbol ;
1717
@@ -1040,10 +1040,9 @@ pub(crate) fn codegen_operand<'tcx>(
10401040 }
10411041 Operand :: Constant ( const_) => crate :: constant:: codegen_constant_operand ( fx, const_) ,
10421042 Operand :: RuntimeChecks ( checks) => {
1043- let int = checks. value ( fx. tcx . sess ) ;
1044- let int = ScalarInt :: try_from_uint ( int, Size :: from_bits ( 1 ) ) . unwrap ( ) ;
1043+ let val = checks. value ( fx. tcx . sess ) ;
10451044 let layout = fx. layout_of ( fx. tcx . types . bool ) ;
1046- return CValue :: const_val ( fx, layout, int ) ;
1045+ return CValue :: const_val ( fx, layout, val . into ( ) ) ;
10471046 }
10481047 }
10491048}
Original file line number Diff line number Diff line change @@ -540,10 +540,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
540540 operand : & Operand < ' tcx > ,
541541) -> Option < ScalarInt > {
542542 match operand {
543- Operand :: RuntimeChecks ( checks) => {
544- let int = checks. value ( fx. tcx . sess ) ;
545- ScalarInt :: try_from_uint ( int, Size :: from_bits ( 1 ) )
546- }
543+ Operand :: RuntimeChecks ( checks) => Some ( checks. value ( fx. tcx . sess ) . into ( ) ) ,
547544 Operand :: Constant ( const_) => eval_mir_constant ( fx, const_) . 0 . try_to_scalar_int ( ) ,
548545 // FIXME(rust-lang/rust#85105): Casts like `IMM8 as u32` result in the const being stored
549546 // inside a temporary before being passed to the intrinsic requiring the const argument.
You can’t perform that action at this time.
0 commit comments