Rollup merge of #61291 - spastorino:avoid-unneeded-bug-call, r=estebank

Avoid unneeded bug!() call

r? @oli-obk
This commit is contained in:
Mazdak Farrokhzad 2019-05-29 08:16:02 +02:00 committed by GitHub
commit 73530ff80b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -396,22 +396,20 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let cx = self.cx;
let tcx = self.cx.tcx();
if let mir::Place::Base(mir::PlaceBase::Local(index)) = *place {
match self.locals[index] {
LocalRef::Place(place) => {
return place;
}
LocalRef::UnsizedPlace(place) => {
return bx.load_operand(place).deref(cx);
}
LocalRef::Operand(..) => {
bug!("using operand local {:?} as place", place);
let result = match *place {
mir::Place::Base(mir::PlaceBase::Local(index)) => {
match self.locals[index] {
LocalRef::Place(place) => {
return place;
}
LocalRef::UnsizedPlace(place) => {
return bx.load_operand(place).deref(cx);
}
LocalRef::Operand(..) => {
bug!("using operand local {:?} as place", place);
}
}
}
}
let result = match *place {
mir::Place::Base(mir::PlaceBase::Local(_)) => bug!(), // handled above
mir::Place::Base(
mir::PlaceBase::Static(
box mir::Static { ty, kind: mir::StaticKind::Promoted(promoted) }