@@ -21,7 +21,7 @@ use std::mem;
21
21
use std:: ops:: Deref ;
22
22
23
23
use super :: ops:: { self , NonConstOp , Status } ;
24
- use super :: qualifs:: { self , CustomEq , HasMutInterior , NeedsDrop , NeedsNonConstDrop } ;
24
+ use super :: qualifs:: { self , CustomEq , HasMutInterior , NeedsDrop } ;
25
25
use super :: resolver:: FlowSensitiveAnalysis ;
26
26
use super :: { ConstCx , Qualif } ;
27
27
use crate :: const_eval:: is_unstable_const_fn;
@@ -34,7 +34,7 @@ type QualifResults<'mir, 'tcx, Q> =
34
34
pub struct Qualifs < ' mir , ' tcx > {
35
35
has_mut_interior : Option < QualifResults < ' mir , ' tcx , HasMutInterior > > ,
36
36
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>>,
38
38
}
39
39
40
40
impl < ' mir , ' tcx > Qualifs < ' mir , ' tcx > {
@@ -77,22 +77,27 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
77
77
local : Local ,
78
78
location : Location ,
79
79
) -> bool {
80
+ // FIXME(effects) replace with `NeedsNonconstDrop` after const traits work again
81
+ /*
80
82
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) {
82
84
return false;
83
85
}
84
86
85
87
let needs_non_const_drop = self.needs_non_const_drop.get_or_insert_with(|| {
86
88
let ConstCx { tcx, body, .. } = *ccx;
87
89
88
- FlowSensitiveAnalysis :: new ( NeedsNonConstDrop , ccx)
90
+ FlowSensitiveAnalysis::new(NeedsDrop , ccx)
89
91
.into_engine(tcx, &body)
90
92
.iterate_to_fixpoint()
91
93
.into_results_cursor(&body)
92
94
});
93
95
94
96
needs_non_const_drop.seek_before_primary_effect(location);
95
97
needs_non_const_drop.get().contains(local)
98
+ */
99
+
100
+ self . needs_drop ( ccx, local, location)
96
101
}
97
102
98
103
/// Returns `true` if `local` is `HasMutInterior` at the given `Location`.
@@ -798,16 +803,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
798
803
}
799
804
Ok ( Some ( ImplSource :: UserDefined ( data) ) ) => {
800
805
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
- }
811
806
812
807
if let hir:: Constness :: NotConst = tcx. constness ( data. impl_def_id ) {
813
808
self . check_op ( ops:: FnCallNonConst {
@@ -820,6 +815,17 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
820
815
} ) ;
821
816
return ;
822
817
}
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
+ }
823
829
}
824
830
_ if !tcx. is_const_fn_raw ( callee) => {
825
831
// 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> {
996
1002
let mut err_span = self . span ;
997
1003
let ty_of_dropped_place = dropped_place. ty ( self . body , self . tcx ) . ty ;
998
1004
1005
+ // FIXME(effects) replace with `NeedsNonConstDrop` once we fix const traits
999
1006
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) ;
1001
1008
1002
1009
debug ! ( ?ty_of_dropped_place, ?ty_needs_non_const_drop) ;
1003
1010
0 commit comments