From 9f70e782f7ee7c67c4ea693639c0e87b984d0234 Mon Sep 17 00:00:00 2001 From: Aman Arora Date: Tue, 17 Nov 2020 04:54:10 -0500 Subject: [PATCH 1/1] Remove THIR::ExprKind::SelfRef ExprKind::SelfRef was used to express accessing `self` in the desugared Closure/Generator struct when lowering captures in THIR. Since we handle captures in MIR now, we don't need `ExprKind::Self`. --- compiler/rustc_mir_build/src/build/expr/as_place.rs | 1 - compiler/rustc_mir_build/src/build/expr/as_rvalue.rs | 1 - compiler/rustc_mir_build/src/build/expr/category.rs | 1 - compiler/rustc_mir_build/src/build/expr/into.rs | 1 - compiler/rustc_mir_build/src/thir/mod.rs | 2 -- 5 files changed, 6 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/expr/as_place.rs b/compiler/rustc_mir_build/src/build/expr/as_place.rs index 3f06aa1b131..e6263e5d6cf 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_place.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_place.rs @@ -184,7 +184,6 @@ fn expr_as_place( this.lower_closure_capture(block, capture_index, *upvar_id) } - ExprKind::SelfRef => block.and(PlaceBuilder::from(Local::new(1))), ExprKind::VarRef { id } => { let place_builder = if this.is_bound_var_in_guard(id) { let index = this.var_local_id(id, RefWithinGuard); diff --git a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs index 106ec1631e1..b6728c6b2ce 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs @@ -250,7 +250,6 @@ fn expr_as_rvalue( | ExprKind::Deref { .. } | ExprKind::Index { .. } | ExprKind::VarRef { .. } - | ExprKind::SelfRef | ExprKind::UpvarRef { .. } | ExprKind::Break { .. } | ExprKind::Continue { .. } diff --git a/compiler/rustc_mir_build/src/build/expr/category.rs b/compiler/rustc_mir_build/src/build/expr/category.rs index 925c698111d..8561170856f 100644 --- a/compiler/rustc_mir_build/src/build/expr/category.rs +++ b/compiler/rustc_mir_build/src/build/expr/category.rs @@ -38,7 +38,6 @@ impl Category { ExprKind::Field { .. } | ExprKind::Deref { .. } | ExprKind::Index { .. } - | ExprKind::SelfRef | ExprKind::UpvarRef { .. } | ExprKind::VarRef { .. } | ExprKind::PlaceTypeAscription { .. } diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index 9ff1134e675..50001c38dc7 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -400,7 +400,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // Avoid creating a temporary ExprKind::VarRef { .. } - | ExprKind::SelfRef | ExprKind::UpvarRef { .. } | ExprKind::PlaceTypeAscription { .. } | ExprKind::ValueTypeAscription { .. } => { diff --git a/compiler/rustc_mir_build/src/thir/mod.rs b/compiler/rustc_mir_build/src/thir/mod.rs index d577ec6734f..1a901746d50 100644 --- a/compiler/rustc_mir_build/src/thir/mod.rs +++ b/compiler/rustc_mir_build/src/thir/mod.rs @@ -219,8 +219,6 @@ /// HirId of the root variable var_hir_id: hir::HirId, }, - /// first argument, used for self in a closure - SelfRef, Borrow { borrow_kind: BorrowKind, arg: ExprRef<'tcx>, -- 2.44.0