@@ -6,6 +6,7 @@ use rustc::middle::lang_items::ExchangeMallocFnLangItem;
66use rustc_apfloat:: { ieee, Float , Status , Round } ;
77use std:: { u128, i128} ;
88use syntax:: symbol:: sym;
9+ use syntax:: source_map:: Span ;
910
1011use crate :: base;
1112use crate :: MemFlags ;
@@ -136,7 +137,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
136137 }
137138
138139 _ => {
139- assert ! ( self . rvalue_creates_operand( rvalue) ) ;
140+ assert ! ( self . rvalue_creates_operand( rvalue, None ) ) ;
140141 let ( mut bx, temp) = self . codegen_rvalue_operand ( bx, rvalue) ;
141142 temp. val . store ( & mut bx, dest) ;
142143 bx
@@ -169,7 +170,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
169170 mut bx : Bx ,
170171 rvalue : & mir:: Rvalue < ' tcx >
171172 ) -> ( Bx , OperandRef < ' tcx , Bx :: Value > ) {
172- assert ! ( self . rvalue_creates_operand( rvalue) , "cannot codegen {:?} to operand" , rvalue) ;
173+ assert ! (
174+ self . rvalue_creates_operand( rvalue, None ) ,
175+ "cannot codegen {:?} to operand" ,
176+ rvalue,
177+ ) ;
173178
174179 match * rvalue {
175180 mir:: Rvalue :: Cast ( ref kind, ref source, mir_cast_ty) => {
@@ -691,7 +696,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
691696}
692697
693698impl < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > FunctionCx < ' a , ' tcx , Bx > {
694- pub fn rvalue_creates_operand ( & self , rvalue : & mir:: Rvalue < ' tcx > ) -> bool {
699+ pub fn rvalue_creates_operand ( & self , rvalue : & mir:: Rvalue < ' tcx > , span : Option < Span > ) -> bool {
695700 match * rvalue {
696701 mir:: Rvalue :: Ref ( ..) |
697702 mir:: Rvalue :: Len ( ..) |
@@ -707,7 +712,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
707712 mir:: Rvalue :: Aggregate ( ..) => {
708713 let ty = rvalue. ty ( self . mir , self . cx . tcx ( ) ) ;
709714 let ty = self . monomorphize ( & ty) ;
710- self . cx . layout_of ( ty) . is_zst ( )
715+ self . cx . spanned_layout_of ( ty, span) . is_zst ( )
716+ // self.cx.layout_of(ty).is_zst()
711717 }
712718 }
713719
0 commit comments