@@ -487,20 +487,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
487487 )
488488 }
489489
490- mir:: Rvalue :: NullaryOp ( mir:: NullOp :: SizeOf , ty) => {
491- let ty = self . monomorphize ( ty) ;
492- assert ! ( bx. cx( ) . type_is_sized( ty) ) ;
493- let val = bx. cx ( ) . const_usize ( bx. cx ( ) . layout_of ( ty) . size . bytes ( ) ) ;
494- let tcx = self . cx . tcx ( ) ;
495- (
496- bx,
497- OperandRef {
498- val : OperandValue :: Immediate ( val) ,
499- layout : self . cx . layout_of ( tcx. types . usize ) ,
500- } ,
501- )
502- }
503-
504490 mir:: Rvalue :: NullaryOp ( mir:: NullOp :: Box , content_ty) => {
505491 let content_ty = self . monomorphize ( content_ty) ;
506492 let content_layout = bx. cx ( ) . layout_of ( content_ty) ;
@@ -525,6 +511,27 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
525511 let operand = OperandRef { val : OperandValue :: Immediate ( val) , layout : box_layout } ;
526512 ( bx, operand)
527513 }
514+
515+ mir:: Rvalue :: NullaryOp ( null_op, ty) => {
516+ let ty = self . monomorphize ( ty) ;
517+ assert ! ( bx. cx( ) . type_is_sized( ty) ) ;
518+ let layout = bx. cx ( ) . layout_of ( ty) ;
519+ let val = match null_op {
520+ mir:: NullOp :: SizeOf => layout. size . bytes ( ) ,
521+ mir:: NullOp :: AlignOf => layout. align . abi . bytes ( ) ,
522+ mir:: NullOp :: Box => unreachable ! ( ) ,
523+ } ;
524+ let val = bx. cx ( ) . const_usize ( val) ;
525+ let tcx = self . cx . tcx ( ) ;
526+ (
527+ bx,
528+ OperandRef {
529+ val : OperandValue :: Immediate ( val) ,
530+ layout : self . cx . layout_of ( tcx. types . usize ) ,
531+ } ,
532+ )
533+ }
534+
528535 mir:: Rvalue :: ThreadLocalRef ( def_id) => {
529536 assert ! ( bx. cx( ) . tcx( ) . is_static( def_id) ) ;
530537 let static_ = bx. get_static ( def_id) ;
0 commit comments