]> git.lizzy.rs Git - rust.git/commitdiff
Remove THIR::ExprKind::SelfRef
authorAman Arora <me@aman-arora.com>
Tue, 17 Nov 2020 09:54:10 +0000 (04:54 -0500)
committerAman Arora <me@aman-arora.com>
Tue, 17 Nov 2020 22:49:42 +0000 (17:49 -0500)
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
compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
compiler/rustc_mir_build/src/build/expr/category.rs
compiler/rustc_mir_build/src/build/expr/into.rs
compiler/rustc_mir_build/src/thir/mod.rs

index 3f06aa1b131156e83d4bdd335f46753479b733fb..e6263e5d6cf9bdbdf39a6378daab00f90bf6d122 100644 (file)
@@ -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);
index 106ec1631e108c508feedfcbd6d529cc3b3bf049..b6728c6b2ce94ee8004a63de8bfdc6fc7630763d 100644 (file)
@@ -250,7 +250,6 @@ fn expr_as_rvalue(
             | ExprKind::Deref { .. }
             | ExprKind::Index { .. }
             | ExprKind::VarRef { .. }
-            | ExprKind::SelfRef
             | ExprKind::UpvarRef { .. }
             | ExprKind::Break { .. }
             | ExprKind::Continue { .. }
index 925c698111d8b8e2c4eb11669992ee34fbddd419..8561170856fd415708d02d6621f5f4d79b654487 100644 (file)
@@ -38,7 +38,6 @@ impl Category {
             ExprKind::Field { .. }
             | ExprKind::Deref { .. }
             | ExprKind::Index { .. }
-            | ExprKind::SelfRef
             | ExprKind::UpvarRef { .. }
             | ExprKind::VarRef { .. }
             | ExprKind::PlaceTypeAscription { .. }
index 9ff1134e67585f310484223ef07e546a64c410b6..50001c38dc73744fe512571a2b12f9a9785649ea 100644 (file)
@@ -400,7 +400,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
 
             // Avoid creating a temporary
             ExprKind::VarRef { .. }
-            | ExprKind::SelfRef
             | ExprKind::UpvarRef { .. }
             | ExprKind::PlaceTypeAscription { .. }
             | ExprKind::ValueTypeAscription { .. } => {
index d577ec6734fae55954842db3621e2f3cd8562207..1a901746d5086e971def252630d15dacd845a8d5 100644 (file)
         /// 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>,