@@ -753,51 +753,6 @@ pub(crate) fn codegen_drop<'tcx>(
753753 fx. bcx . ins ( ) . call_indirect ( sig, drop_fn, & [ ptr] ) ;
754754 fx. bcx . ins ( ) . jump ( ret_block, & [ ] ) ;
755755 }
756- ty:: Dynamic ( _, _, ty:: DynStar ) => {
757- // IN THIS ARM, WE HAVE:
758- // ty = *mut (dyn* Trait)
759- // which is: *mut exists<T: sizeof(T) == sizeof(usize)> (T, Vtable<T: Trait>)
760- //
761- // args = [ * ]
762- // |
763- // v
764- // ( Data, Vtable )
765- // |
766- // v
767- // /-------\
768- // | ... |
769- // \-------/
770- //
771- //
772- // WE CAN CONVERT THIS INTO THE ABOVE LOGIC BY DOING
773- //
774- // data = &(*args[0]).0 // gives a pointer to Data above (really the same pointer)
775- // vtable = (*args[0]).1 // loads the vtable out
776- // (data, vtable) // an equivalent Rust `*mut dyn Trait`
777- //
778- // SO THEN WE CAN USE THE ABOVE CODE.
779- let ( data, vtable) = drop_place. to_cvalue ( fx) . dyn_star_force_data_on_stack ( fx) ;
780- let drop_fn = crate :: vtable:: drop_fn_of_obj ( fx, vtable) ;
781-
782- let is_null = fx. bcx . ins ( ) . icmp_imm ( IntCC :: Equal , drop_fn, 0 ) ;
783- let target_block = fx. get_block ( target) ;
784- let continued = fx. bcx . create_block ( ) ;
785- fx. bcx . ins ( ) . brif ( is_null, target_block, & [ ] , continued, & [ ] ) ;
786- fx. bcx . switch_to_block ( continued) ;
787-
788- let virtual_drop = Instance {
789- def : ty:: InstanceKind :: Virtual ( drop_instance. def_id ( ) , 0 ) ,
790- args : drop_instance. args ,
791- } ;
792- let fn_abi = FullyMonomorphizedLayoutCx ( fx. tcx )
793- . fn_abi_of_instance ( virtual_drop, ty:: List :: empty ( ) ) ;
794-
795- let sig = clif_sig_from_fn_abi ( fx. tcx , fx. target_config . default_call_conv , & fn_abi) ;
796- let sig = fx. bcx . import_signature ( sig) ;
797- fx. bcx . ins ( ) . call_indirect ( sig, drop_fn, & [ data] ) ;
798- // FIXME implement cleanup on exceptions
799- fx. bcx . ins ( ) . jump ( ret_block, & [ ] ) ;
800- }
801756 _ => {
802757 assert ! ( !matches!( drop_instance. def, InstanceKind :: Virtual ( _, _) ) ) ;
803758
0 commit comments