This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree 2 files changed +9
-4
lines changed 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -726,15 +726,20 @@ fn codegen_stmt<'tcx>(
726
726
let ptr = fx. bcx . inst_results ( call) [ 0 ] ;
727
727
lval. write_cvalue ( fx, CValue :: by_val ( ptr, box_layout) ) ;
728
728
}
729
- Rvalue :: NullaryOp ( NullOp :: SizeOf , ty) => {
729
+ Rvalue :: NullaryOp ( null_op , ty) => {
730
730
assert ! (
731
731
lval. layout( )
732
732
. ty
733
733
. is_sized( fx. tcx. at( stmt. source_info. span) , ParamEnv :: reveal_all( ) )
734
734
) ;
735
- let ty_size = fx. layout_of ( fx. monomorphize ( ty) ) . size . bytes ( ) ;
735
+ let layout = fx. layout_of ( fx. monomorphize ( ty) ) ;
736
+ let val = match null_op {
737
+ NullOp :: SizeOf => layout. size . bytes ( ) ,
738
+ NullOp :: AlignOf => layout. align . abi . bytes ( ) ,
739
+ NullOp :: Box => unreachable ! ( ) ,
740
+ } ;
736
741
let val =
737
- CValue :: const_val ( fx, fx. layout_of ( fx. tcx . types . usize ) , ty_size . into ( ) ) ;
742
+ CValue :: const_val ( fx, fx. layout_of ( fx. tcx . types . usize ) , val . into ( ) ) ;
738
743
lval. write_cvalue ( fx, val) ;
739
744
}
740
745
Rvalue :: Aggregate ( ref kind, ref operands) => match kind. as_ref ( ) {
Original file line number Diff line number Diff line change @@ -823,7 +823,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
823
823
dest. write_cvalue( fx, val) ;
824
824
} ;
825
825
826
- pref_align_of | min_align_of | needs_drop | type_id | type_name | variant_count, ( ) {
826
+ pref_align_of | needs_drop | type_id | type_name | variant_count, ( ) {
827
827
let const_val =
828
828
fx. tcx. const_eval_instance( ParamEnv :: reveal_all( ) , instance, None ) . unwrap( ) ;
829
829
let val = crate :: constant:: codegen_const_value(
You can’t perform that action at this time.
0 commit comments