@@ -21,7 +21,7 @@ use std::mem;
2121use std:: ops:: Deref ;
2222
2323use super :: ops:: { self , NonConstOp , Status } ;
24- use super :: qualifs:: { self , CustomEq , HasMutInterior , NeedsDrop , NeedsNonConstDrop } ;
24+ use super :: qualifs:: { self , CustomEq , HasMutInterior , NeedsDrop } ;
2525use super :: resolver:: FlowSensitiveAnalysis ;
2626use super :: { ConstCx , Qualif } ;
2727use crate :: const_eval:: is_unstable_const_fn;
@@ -34,7 +34,7 @@ type QualifResults<'mir, 'tcx, Q> =
3434pub struct Qualifs < ' mir , ' tcx > {
3535 has_mut_interior : Option < QualifResults < ' mir , ' tcx , HasMutInterior > > ,
3636 needs_drop : Option < QualifResults < ' mir , ' tcx , NeedsDrop > > ,
37- needs_non_const_drop : Option < QualifResults < ' mir , ' tcx , NeedsNonConstDrop > > ,
37+ // needs_non_const_drop: Option<QualifResults<'mir, 'tcx, NeedsNonConstDrop>>,
3838}
3939
4040impl < ' mir , ' tcx > Qualifs < ' mir , ' tcx > {
@@ -77,22 +77,27 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
7777 local : Local ,
7878 location : Location ,
7979 ) -> bool {
80+ // FIXME(effects) replace with `NeedsNonconstDrop` after const traits work again
81+ /*
8082 let ty = ccx.body.local_decls[local].ty;
81- if !NeedsNonConstDrop :: in_any_value_of_ty ( ccx, ty) {
83+ if !NeedsDrop ::in_any_value_of_ty(ccx, ty) {
8284 return false;
8385 }
8486
8587 let needs_non_const_drop = self.needs_non_const_drop.get_or_insert_with(|| {
8688 let ConstCx { tcx, body, .. } = *ccx;
8789
88- FlowSensitiveAnalysis :: new ( NeedsNonConstDrop , ccx)
90+ FlowSensitiveAnalysis::new(NeedsDrop , ccx)
8991 .into_engine(tcx, &body)
9092 .iterate_to_fixpoint()
9193 .into_results_cursor(&body)
9294 });
9395
9496 needs_non_const_drop.seek_before_primary_effect(location);
9597 needs_non_const_drop.get().contains(local)
98+ */
99+
100+ self . needs_drop ( ccx, local, location)
96101 }
97102
98103 /// Returns `true` if `local` is `HasMutInterior` at the given `Location`.
@@ -798,16 +803,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
798803 }
799804 Ok ( Some ( ImplSource :: UserDefined ( data) ) ) => {
800805 let callee_name = tcx. item_name ( callee) ;
801- if let Some ( & did) = tcx
802- . associated_item_def_ids ( data. impl_def_id )
803- . iter ( )
804- . find ( |did| tcx. item_name ( * * did) == callee_name)
805- {
806- // using internal args is ok here, since this is only
807- // used for the `resolve` call below
808- fn_args = GenericArgs :: identity_for_item ( tcx, did) ;
809- callee = did;
810- }
811806
812807 if let hir:: Constness :: NotConst = tcx. constness ( data. impl_def_id ) {
813808 self . check_op ( ops:: FnCallNonConst {
@@ -820,6 +815,17 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
820815 } ) ;
821816 return ;
822817 }
818+
819+ if let Some ( & did) = tcx
820+ . associated_item_def_ids ( data. impl_def_id )
821+ . iter ( )
822+ . find ( |did| tcx. item_name ( * * did) == callee_name)
823+ {
824+ // using internal args is ok here, since this is only
825+ // used for the `resolve` call below
826+ fn_args = GenericArgs :: identity_for_item ( tcx, did) ;
827+ callee = did;
828+ }
823829 }
824830 _ if !tcx. is_const_fn_raw ( callee) => {
825831 // At this point, it is only legal when the caller is in a trait
@@ -996,8 +1002,9 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
9961002 let mut err_span = self . span ;
9971003 let ty_of_dropped_place = dropped_place. ty ( self . body , self . tcx ) . ty ;
9981004
1005+ // FIXME(effects) replace with `NeedsNonConstDrop` once we fix const traits
9991006 let ty_needs_non_const_drop =
1000- qualifs:: NeedsNonConstDrop :: in_any_value_of_ty ( self . ccx , ty_of_dropped_place) ;
1007+ qualifs:: NeedsDrop :: in_any_value_of_ty ( self . ccx , ty_of_dropped_place) ;
10011008
10021009 debug ! ( ?ty_of_dropped_place, ?ty_needs_non_const_drop) ;
10031010
0 commit comments