Skip to content

Commit 0631d19

Browse files
committed
Avoid unneeded bug!() call
1 parent 7da1185 commit 0631d19

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/librustc_codegen_ssa/mir/place.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -396,22 +396,20 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
396396
let cx = self.cx;
397397
let tcx = self.cx.tcx();
398398

399-
if let mir::Place::Base(mir::PlaceBase::Local(index)) = *place {
400-
match self.locals[index] {
401-
LocalRef::Place(place) => {
402-
return place;
403-
}
404-
LocalRef::UnsizedPlace(place) => {
405-
return bx.load_operand(place).deref(cx);
406-
}
407-
LocalRef::Operand(..) => {
408-
bug!("using operand local {:?} as place", place);
399+
let result = match *place {
400+
mir::Place::Base(mir::PlaceBase::Local(index)) => {
401+
match self.locals[index] {
402+
LocalRef::Place(place) => {
403+
return place;
404+
}
405+
LocalRef::UnsizedPlace(place) => {
406+
return bx.load_operand(place).deref(cx);
407+
}
408+
LocalRef::Operand(..) => {
409+
bug!("using operand local {:?} as place", place);
410+
}
409411
}
410412
}
411-
}
412-
413-
let result = match *place {
414-
mir::Place::Base(mir::PlaceBase::Local(_)) => bug!(), // handled above
415413
mir::Place::Base(
416414
mir::PlaceBase::Static(
417415
box mir::Static { ty, kind: mir::StaticKind::Promoted(promoted) }

0 commit comments

Comments
 (0)