Skip to content

Commit

Permalink
Remove THIR::ExprKind::SelfRef
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
arora-aman committed Nov 17, 2020
1 parent 7faebe5 commit 9f70e78
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 6 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_mir_build/src/build/expr/as_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
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);
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
| ExprKind::Deref { .. }
| ExprKind::Index { .. }
| ExprKind::VarRef { .. }
| ExprKind::SelfRef
| ExprKind::UpvarRef { .. }
| ExprKind::Break { .. }
| ExprKind::Continue { .. }
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_mir_build/src/build/expr/category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ impl Category {
ExprKind::Field { .. }
| ExprKind::Deref { .. }
| ExprKind::Index { .. }
| ExprKind::SelfRef
| ExprKind::UpvarRef { .. }
| ExprKind::VarRef { .. }
| ExprKind::PlaceTypeAscription { .. }
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_mir_build/src/build/expr/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {

// Avoid creating a temporary
ExprKind::VarRef { .. }
| ExprKind::SelfRef
| ExprKind::UpvarRef { .. }
| ExprKind::PlaceTypeAscription { .. }
| ExprKind::ValueTypeAscription { .. } => {
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_mir_build/src/thir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ crate enum ExprKind<'tcx> {
/// 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>,
Expand Down

0 comments on commit 9f70e78

Please sign in to comment.