@@ -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 ;
1211use rustc_middle:: ty:: adjustment:: PointerCoercion ;
13- use rustc_middle:: ty:: layout:: { FnAbiOf , HasTypingEnv } ;
12+ use rustc_middle:: ty:: layout:: FnAbiOf ;
1413use 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
@@ -853,17 +853,6 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
853853 fx. bcx . ins ( ) . nop ( ) ;
854854 }
855855 }
856- Rvalue :: NullaryOp ( ref null_op) => {
857- assert ! ( lval. layout( ) . ty. is_sized( fx. tcx, fx. typing_env( ) ) ) ;
858- let val = match null_op {
859- NullOp :: RuntimeChecks ( kind) => kind. value ( fx. tcx . sess ) ,
860- } ;
861- let val = CValue :: by_val (
862- fx. bcx . ins ( ) . iconst ( types:: I8 , i64:: from ( val) ) ,
863- fx. layout_of ( fx. tcx . types . bool ) ,
864- ) ;
865- lval. write_cvalue ( fx, val) ;
866- }
867856 Rvalue :: Aggregate ( ref kind, ref operands)
868857 if matches ! ( * * kind, AggregateKind :: RawPtr ( ..) ) =>
869858 {
@@ -1050,6 +1039,12 @@ pub(crate) fn codegen_operand<'tcx>(
10501039 cplace. to_cvalue ( fx)
10511040 }
10521041 Operand :: Constant ( const_) => crate :: constant:: codegen_constant_operand ( fx, const_) ,
1042+ Operand :: RuntimeChecks ( checks) => {
1043+ let int = checks. value ( fx. tcx . sess ) ;
1044+ let int = ScalarInt :: try_from_uint ( int, Size :: from_bits ( 1 ) ) . unwrap ( ) ;
1045+ let layout = fx. layout_of ( fx. tcx . types . bool ) ;
1046+ return CValue :: const_val ( fx, layout, int) ;
1047+ }
10531048 }
10541049}
10551050
0 commit comments