@@ -218,68 +218,6 @@ impl<'tcx> ThirBuildCx<'tcx> {
218218 base : AdtExprBase :: None ,
219219 } ) ) ;
220220
221- debug ! ( ?kind) ;
222- kind
223- }
224- Adjust :: ReborrowPin ( mutbl) => {
225- debug ! ( "apply ReborrowPin adjustment" ) ;
226- // Rewrite `$expr` as `Pin { __pointer: &(mut)? *($expr).__pointer }`
227-
228- // We'll need these types later on
229- let pin_ty_args = match expr. ty . kind ( ) {
230- ty:: Adt ( _, args) => args,
231- _ => bug ! ( "ReborrowPin with non-Pin type" ) ,
232- } ;
233- let pin_ty = pin_ty_args. iter ( ) . next ( ) . unwrap ( ) . expect_ty ( ) ;
234- let ptr_target_ty = match pin_ty. kind ( ) {
235- ty:: Ref ( _, ty, _) => * ty,
236- _ => bug ! ( "ReborrowPin with non-Ref type" ) ,
237- } ;
238-
239- // pointer = ($expr).__pointer
240- let pointer_target = ExprKind :: Field {
241- lhs : self . thir . exprs . push ( expr) ,
242- variant_index : FIRST_VARIANT ,
243- name : FieldIdx :: ZERO ,
244- } ;
245- let arg = Expr { temp_scope_id, ty : pin_ty, span, kind : pointer_target } ;
246- let arg = self . thir . exprs . push ( arg) ;
247-
248- // arg = *pointer
249- let expr = ExprKind :: Deref { arg } ;
250- let arg = self . thir . exprs . push ( Expr {
251- temp_scope_id,
252- ty : ptr_target_ty,
253- span,
254- kind : expr,
255- } ) ;
256-
257- // expr = &mut target
258- let borrow_kind = match mutbl {
259- hir:: Mutability :: Mut => BorrowKind :: Mut { kind : mir:: MutBorrowKind :: Default } ,
260- hir:: Mutability :: Not => BorrowKind :: Shared ,
261- } ;
262- let new_pin_target =
263- Ty :: new_ref ( self . tcx , self . tcx . lifetimes . re_erased , ptr_target_ty, mutbl) ;
264- let expr = self . thir . exprs . push ( Expr {
265- temp_scope_id,
266- ty : new_pin_target,
267- span,
268- kind : ExprKind :: Borrow { borrow_kind, arg } ,
269- } ) ;
270-
271- // kind = Pin { __pointer: pointer }
272- let pin_did = self . tcx . require_lang_item ( rustc_hir:: LangItem :: Pin , span) ;
273- let args = self . tcx . mk_args ( & [ new_pin_target. into ( ) ] ) ;
274- let kind = ExprKind :: Adt ( Box :: new ( AdtExpr {
275- adt_def : self . tcx . adt_def ( pin_did) ,
276- variant_index : FIRST_VARIANT ,
277- args,
278- fields : Box :: new ( [ FieldExpr { name : FieldIdx :: ZERO , expr } ] ) ,
279- user_ty : None ,
280- base : AdtExprBase :: None ,
281- } ) ) ;
282-
283221 debug ! ( ?kind) ;
284222 kind
285223 }
0 commit comments