@@ -489,6 +489,38 @@ fn translate_terminator_kind_call<'tcx, S: BaseState<'tcx> + HasMir<'tcx> + HasO
489
489
}
490
490
}
491
491
492
+ #[ cfg( feature = "rustc" ) ]
493
+ fn translate_terminator_kind_drop < ' tcx , S : BaseState < ' tcx > + HasMir < ' tcx > + HasOwnerId > (
494
+ s : & S ,
495
+ terminator : & rustc_middle:: mir:: TerminatorKind < ' tcx > ,
496
+ ) -> TerminatorKind {
497
+ let tcx = s. base ( ) . tcx ;
498
+ let mir:: TerminatorKind :: Drop {
499
+ place,
500
+ target,
501
+ unwind,
502
+ ..
503
+ } = terminator
504
+ else {
505
+ unreachable ! ( )
506
+ } ;
507
+
508
+ let local_decls = & s. mir ( ) . local_decls ;
509
+ let place_ty = place. ty ( local_decls, tcx) . ty ;
510
+ let drop_trait = tcx. lang_items ( ) . drop_trait ( ) . unwrap ( ) ;
511
+ let impl_expr = solve_trait (
512
+ s,
513
+ ty:: Binder :: dummy ( ty:: TraitRef :: new ( tcx, drop_trait, [ place_ty] ) ) ,
514
+ ) ;
515
+
516
+ TerminatorKind :: Drop {
517
+ place : place. sinto ( s) ,
518
+ impl_expr,
519
+ target : target. sinto ( s) ,
520
+ unwind : unwind. sinto ( s) ,
521
+ }
522
+ }
523
+
492
524
// We don't use the LitIntType on purpose (we don't want the "unsuffixed" case)
493
525
#[ derive_group( Serializers ) ]
494
526
#[ derive( Clone , Copy , Debug , JsonSchema , Hash , PartialEq , Eq , PartialOrd , Ord ) ]
@@ -599,11 +631,17 @@ pub enum TerminatorKind {
599
631
} ,
600
632
Return ,
601
633
Unreachable ,
634
+ #[ custom_arm(
635
+ x @ rustc_middle:: mir:: TerminatorKind :: Drop { .. } => {
636
+ translate_terminator_kind_drop( s, x)
637
+ }
638
+ ) ]
602
639
Drop {
603
640
place : Place ,
641
+ /// Implementation of `place.ty(): Drop`.
642
+ impl_expr : ImplExpr ,
604
643
target : BasicBlock ,
605
644
unwind : UnwindAction ,
606
- replace : bool ,
607
645
} ,
608
646
#[ custom_arm(
609
647
x @ rustc_middle:: mir:: TerminatorKind :: Call { .. } => {
0 commit comments