@@ -6,6 +6,7 @@ use rustc::middle::lang_items::ExchangeMallocFnLangItem;
6
6
use rustc_apfloat:: { ieee, Float , Status , Round } ;
7
7
use std:: { u128, i128} ;
8
8
use syntax:: symbol:: sym;
9
+ use syntax:: source_map:: Span ;
9
10
10
11
use crate :: base;
11
12
use crate :: MemFlags ;
@@ -136,7 +137,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
136
137
}
137
138
138
139
_ => {
139
- assert ! ( self . rvalue_creates_operand( rvalue) ) ;
140
+ assert ! ( self . rvalue_creates_operand( rvalue, None ) ) ;
140
141
let ( mut bx, temp) = self . codegen_rvalue_operand ( bx, rvalue) ;
141
142
temp. val . store ( & mut bx, dest) ;
142
143
bx
@@ -169,7 +170,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
169
170
mut bx : Bx ,
170
171
rvalue : & mir:: Rvalue < ' tcx >
171
172
) -> ( 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
+ ) ;
173
178
174
179
match * rvalue {
175
180
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> {
691
696
}
692
697
693
698
impl < ' 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 {
695
700
match * rvalue {
696
701
mir:: Rvalue :: Ref ( ..) |
697
702
mir:: Rvalue :: Len ( ..) |
@@ -707,7 +712,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
707
712
mir:: Rvalue :: Aggregate ( ..) => {
708
713
let ty = rvalue. ty ( self . mir , self . cx . tcx ( ) ) ;
709
714
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()
711
717
}
712
718
}
713
719
0 commit comments