Point to local place span on "type too big" error
This commit is contained in:
parent
2c5684208c
commit
db099fb491
14 changed files with 65 additions and 9 deletions
|
|
@ -182,13 +182,19 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
|
|||
rvalue: &mir::Rvalue<'tcx>,
|
||||
location: Location) {
|
||||
debug!("visit_assign(place={:?}, rvalue={:?})", place, rvalue);
|
||||
let mut decl_span = None;
|
||||
if let mir::PlaceBase::Local(local) = &place.base {
|
||||
if let Some(decl) = self.fx.mir.local_decls.get(*local) {
|
||||
decl_span = Some(decl.source_info.span);
|
||||
}
|
||||
}
|
||||
|
||||
if let mir::Place {
|
||||
base: mir::PlaceBase::Local(index),
|
||||
projection: None,
|
||||
} = *place {
|
||||
self.assign(index, location);
|
||||
if !self.fx.rvalue_creates_operand(rvalue) {
|
||||
if !self.fx.rvalue_creates_operand(rvalue, decl_span) {
|
||||
self.not_ssa(index);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use rustc::middle::lang_items::ExchangeMallocFnLangItem;
|
|||
use rustc_apfloat::{ieee, Float, Status, Round};
|
||||
use std::{u128, i128};
|
||||
use syntax::symbol::sym;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
use crate::base;
|
||||
use crate::MemFlags;
|
||||
|
|
@ -136,7 +137,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
}
|
||||
|
||||
_ => {
|
||||
assert!(self.rvalue_creates_operand(rvalue));
|
||||
assert!(self.rvalue_creates_operand(rvalue, None));
|
||||
let (mut bx, temp) = self.codegen_rvalue_operand(bx, rvalue);
|
||||
temp.val.store(&mut bx, dest);
|
||||
bx
|
||||
|
|
@ -169,7 +170,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
mut bx: Bx,
|
||||
rvalue: &mir::Rvalue<'tcx>
|
||||
) -> (Bx, OperandRef<'tcx, Bx::Value>) {
|
||||
assert!(self.rvalue_creates_operand(rvalue), "cannot codegen {:?} to operand", rvalue);
|
||||
assert!(
|
||||
self.rvalue_creates_operand(rvalue, None),
|
||||
"cannot codegen {:?} to operand",
|
||||
rvalue,
|
||||
);
|
||||
|
||||
match *rvalue {
|
||||
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> {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
pub fn rvalue_creates_operand(&self, rvalue: &mir::Rvalue<'tcx>) -> bool {
|
||||
pub fn rvalue_creates_operand(&self, rvalue: &mir::Rvalue<'tcx>, span: Option<Span>) -> bool {
|
||||
match *rvalue {
|
||||
mir::Rvalue::Ref(..) |
|
||||
mir::Rvalue::Len(..) |
|
||||
|
|
@ -707,7 +712,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
mir::Rvalue::Aggregate(..) => {
|
||||
let ty = rvalue.ty(self.mir, self.cx.tcx());
|
||||
let ty = self.monomorphize(&ty);
|
||||
self.cx.layout_of(ty).is_zst()
|
||||
self.cx.spanned_layout_of(ty, span).is_zst()
|
||||
// self.cx.layout_of(ty).is_zst()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue