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