summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastian Kauschke <bastian_kauschke@hotmail.de>2020-10-21 23:52:41 +0200
committerBastian Kauschke <bastian_kauschke@hotmail.de>2020-10-21 23:59:35 +0200
commit17825c93ff548fbcb8be2b0151c69bec974ee11b (patch)
tree6ab8e626acebb0622804b562c8d720baae11676d
parent8752a560b9f50e04c38ab75e2b5c37d03d3214d9 (diff)
downloadrust-17825c93ff548fbcb8be2b0151c69bec974ee11b.tar.gz
review
-rw-r--r--compiler/rustc_middle/src/ty/structural_impls.rs6
-rw-r--r--compiler/rustc_mir/src/borrow_check/mod.rs21
2 files changed, 6 insertions, 21 deletions
diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs
index a82a8c895bb..d9ec6bb20fd 100644
--- a/compiler/rustc_middle/src/ty/structural_impls.rs
+++ b/compiler/rustc_middle/src/ty/structural_impls.rs
@@ -333,16 +333,14 @@ CloneTypeFoldableAndLiftImpls! {
impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>> Lift<'tcx> for (A, B) {
type Lifted = (A::Lifted, B::Lifted);
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
- let (a, b) = self;
- tcx.lift(a).and_then(|a| tcx.lift(b).map(|b| (a, b)))
+ Some((tcx.lift(self.0)?, tcx.lift(self.1)?))
}
}
impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>, C: Lift<'tcx>> Lift<'tcx> for (A, B, C) {
type Lifted = (A::Lifted, B::Lifted, C::Lifted);
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
- let (a, b, c) = self;
- tcx.lift(a).and_then(|a| tcx.lift(b).and_then(|b| tcx.lift(c).map(|c| (a, b, c))))
+ Some((tcx.lift(self.0)?, tcx.lift(self.1)?, tcx.lift(self.2)?))
}
}
diff --git a/compiler/rustc_mir/src/borrow_check/mod.rs b/compiler/rustc_mir/src/borrow_check/mod.rs
index 42f7aa1fb0f..de54c5582e0 100644
--- a/compiler/rustc_mir/src/borrow_check/mod.rs
+++ b/compiler/rustc_mir/src/borrow_check/mod.rs
@@ -674,29 +674,16 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc
TerminatorKind::SwitchInt { ref discr, switch_ty: _, targets: _ } => {
self.consume_operand(loc, (discr, span), flow_state);
}
- TerminatorKind::Drop { place: ref drop_place, target: _, unwind: _ } => {
- let tcx = self.infcx.tcx;
-
- // Compute the type with accurate region information.
- let drop_place_ty = drop_place.ty(self.body, self.infcx.tcx);
-
- // Erase the regions.
- let drop_place_ty = self.infcx.tcx.erase_regions(&drop_place_ty).ty;
-
- // "Lift" into the tcx -- once regions are erased, this type should be in the
- // global arenas; this "lift" operation basically just asserts that is true, but
- // that is useful later.
- tcx.lift(drop_place_ty).unwrap();
-
+ TerminatorKind::Drop { place, target: _, unwind: _ } => {
debug!(
"visit_terminator_drop \
- loc: {:?} term: {:?} drop_place: {:?} drop_place_ty: {:?} span: {:?}",
- loc, term, drop_place, drop_place_ty, span
+ loc: {:?} term: {:?} place: {:?} span: {:?}",
+ loc, term, place, span
);
self.access_place(
loc,
- (*drop_place, span),
+ (place, span),
(AccessDepth::Drop, Write(WriteKind::StorageDeadOrDrop)),
LocalMutationIsAllowed::Yes,
flow_state,