diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-05-29 08:16:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-29 08:16:02 +0200 |
| commit | 73530ff80b51ed58d9b66feb48a8b22f6077e886 (patch) | |
| tree | 7cbe2b6fbb7285cd744f849be33f59f62a6767ae /src/librustc_codegen_ssa | |
| parent | dcfc15b23cbb7fe5e3dc79e0bbc0c1d9ca38f09b (diff) | |
| parent | 0631d19c9a8d4b31828f0c980bec3d1699e5c10b (diff) | |
| download | rust-73530ff80b51ed58d9b66feb48a8b22f6077e886.tar.gz rust-73530ff80b51ed58d9b66feb48a8b22f6077e886.zip | |
Rollup merge of #61291 - spastorino:avoid-unneeded-bug-call, r=estebank
Avoid unneeded bug!() call r? @oli-obk
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/place.rs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs index 670b6c47269..cd32d6f484d 100644 --- a/src/librustc_codegen_ssa/mir/place.rs +++ b/src/librustc_codegen_ssa/mir/place.rs @@ -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) } |
