Skip to content

Commit 9f70e78

Browse files
committed
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`.
1 parent 7faebe5 commit 9f70e78

File tree

5 files changed

+0
-6
lines changed

5 files changed

+0
-6
lines changed

compiler/rustc_mir_build/src/build/expr/as_place.rs

-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
184184
this.lower_closure_capture(block, capture_index, *upvar_id)
185185
}
186186

187-
ExprKind::SelfRef => block.and(PlaceBuilder::from(Local::new(1))),
188187
ExprKind::VarRef { id } => {
189188
let place_builder = if this.is_bound_var_in_guard(id) {
190189
let index = this.var_local_id(id, RefWithinGuard);

compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
250250
| ExprKind::Deref { .. }
251251
| ExprKind::Index { .. }
252252
| ExprKind::VarRef { .. }
253-
| ExprKind::SelfRef
254253
| ExprKind::UpvarRef { .. }
255254
| ExprKind::Break { .. }
256255
| ExprKind::Continue { .. }

compiler/rustc_mir_build/src/build/expr/category.rs

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ impl Category {
3838
ExprKind::Field { .. }
3939
| ExprKind::Deref { .. }
4040
| ExprKind::Index { .. }
41-
| ExprKind::SelfRef
4241
| ExprKind::UpvarRef { .. }
4342
| ExprKind::VarRef { .. }
4443
| ExprKind::PlaceTypeAscription { .. }

compiler/rustc_mir_build/src/build/expr/into.rs

-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
400400

401401
// Avoid creating a temporary
402402
ExprKind::VarRef { .. }
403-
| ExprKind::SelfRef
404403
| ExprKind::UpvarRef { .. }
405404
| ExprKind::PlaceTypeAscription { .. }
406405
| ExprKind::ValueTypeAscription { .. } => {

compiler/rustc_mir_build/src/thir/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ crate enum ExprKind<'tcx> {
219219
/// HirId of the root variable
220220
var_hir_id: hir::HirId,
221221
},
222-
/// first argument, used for self in a closure
223-
SelfRef,
224222
Borrow {
225223
borrow_kind: BorrowKind,
226224
arg: ExprRef<'tcx>,

0 commit comments

Comments
 (0)