Skip to content

Commit 171cbc0

Browse files
committed
Rename needs_drop to needs_non_const_drop
1 parent 5dab47d commit 171cbc0

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

compiler/rustc_const_eval/src/transform/check_consts/check.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type QualifResults<'mir, 'tcx, Q> =
3939
#[derive(Default)]
4040
pub struct Qualifs<'mir, 'tcx> {
4141
has_mut_interior: Option<QualifResults<'mir, 'tcx, HasMutInterior>>,
42-
needs_drop: Option<QualifResults<'mir, 'tcx, NeedsNonConstDrop>>,
42+
needs_non_const_drop: Option<QualifResults<'mir, 'tcx, NeedsNonConstDrop>>,
4343
indirectly_mutable: Option<IndirectlyMutableResults<'mir, 'tcx>>,
4444
}
4545

@@ -70,10 +70,10 @@ impl Qualifs<'mir, 'tcx> {
7070
indirectly_mutable.get().contains(local)
7171
}
7272

73-
/// Returns `true` if `local` is `NeedsDrop` at the given `Location`.
73+
/// Returns `true` if `local` is `NeedsNonConstDrop` at the given `Location`.
7474
///
7575
/// Only updates the cursor if absolutely necessary
76-
pub fn needs_drop(
76+
pub fn needs_non_const_drop(
7777
&mut self,
7878
ccx: &'mir ConstCx<'mir, 'tcx>,
7979
local: Local,
@@ -84,7 +84,7 @@ impl Qualifs<'mir, 'tcx> {
8484
return false;
8585
}
8686

87-
let needs_drop = self.needs_drop.get_or_insert_with(|| {
87+
let needs_non_const_drop = self.needs_non_const_drop.get_or_insert_with(|| {
8888
let ConstCx { tcx, body, .. } = *ccx;
8989

9090
FlowSensitiveAnalysis::new(NeedsNonConstDrop, ccx)
@@ -93,8 +93,8 @@ impl Qualifs<'mir, 'tcx> {
9393
.into_results_cursor(&body)
9494
});
9595

96-
needs_drop.seek_before_primary_effect(location);
97-
needs_drop.get().contains(local) || self.indirectly_mutable(ccx, local, location)
96+
needs_non_const_drop.seek_before_primary_effect(location);
97+
needs_non_const_drop.get().contains(local) || self.indirectly_mutable(ccx, local, location)
9898
}
9999

100100
/// Returns `true` if `local` is `HasMutInterior` at the given `Location`.
@@ -172,7 +172,7 @@ impl Qualifs<'mir, 'tcx> {
172172
};
173173

174174
ConstQualifs {
175-
needs_drop: self.needs_drop(ccx, RETURN_PLACE, return_loc),
175+
needs_non_const_drop: self.needs_non_const_drop(ccx, RETURN_PLACE, return_loc),
176176
has_mut_interior: self.has_mut_interior(ccx, RETURN_PLACE, return_loc),
177177
custom_eq,
178178
error_occured,
@@ -999,7 +999,7 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> {
999999
}
10001000

10011001
// Forbid all `Drop` terminators unless the place being dropped is a local with no
1002-
// projections that cannot be `NeedsDrop`.
1002+
// projections that cannot be `NeedsNonConstDrop`.
10031003
TerminatorKind::Drop { place: dropped_place, .. }
10041004
| TerminatorKind::DropAndReplace { place: dropped_place, .. } => {
10051005
// If we are checking live drops after drop-elaboration, don't emit duplicate
@@ -1019,15 +1019,15 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> {
10191019
return;
10201020
}
10211021

1022-
let needs_drop = if let Some(local) = dropped_place.as_local() {
1022+
let needs_non_const_drop = if let Some(local) = dropped_place.as_local() {
10231023
// Use the span where the local was declared as the span of the drop error.
10241024
err_span = self.body.local_decls[local].source_info.span;
1025-
self.qualifs.needs_drop(self.ccx, local, location)
1025+
self.qualifs.needs_non_const_drop(self.ccx, local, location)
10261026
} else {
10271027
true
10281028
};
10291029

1030-
if needs_drop {
1030+
if needs_non_const_drop {
10311031
self.check_op_spanned(
10321032
ops::LiveDrop { dropped_at: Some(terminator.source_info.span) },
10331033
err_span,

compiler/rustc_const_eval/src/transform/check_consts/post_drop_elaboration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl Visitor<'tcx> for CheckLiveDrops<'mir, 'tcx> {
9797
// `src/test/ui/consts/control-flow/drop-pass.rs`; e.g., when an `Option<Vec<T>>` is
9898
// initialized with `None` and never changed, it still emits drop glue.
9999
// Hence we additionally check the qualifs here to allow more code to pass.
100-
if self.qualifs.needs_drop(self.ccx, dropped_place.local, location) {
100+
if self.qualifs.needs_non_const_drop(self.ccx, dropped_place.local, location) {
101101
// Use the span where the dropped local was declared for the error.
102102
let span = self.body.local_decls[dropped_place.local].source_info.span;
103103
self.check_live_drop(span);

compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn in_any_value_of_ty(
2121
) -> ConstQualifs {
2222
ConstQualifs {
2323
has_mut_interior: HasMutInterior::in_any_value_of_ty(cx, ty),
24-
needs_drop: NeedsNonConstDrop::in_any_value_of_ty(cx, ty),
24+
needs_non_const_drop: NeedsNonConstDrop::in_any_value_of_ty(cx, ty),
2525
custom_eq: CustomEq::in_any_value_of_ty(cx, ty),
2626
error_occured,
2727
}
@@ -108,7 +108,7 @@ impl Qualif for NeedsNonConstDrop {
108108
const IS_CLEARED_ON_MOVE: bool = true;
109109

110110
fn in_qualifs(qualifs: &ConstQualifs) -> bool {
111-
qualifs.needs_drop
111+
qualifs.needs_non_const_drop
112112
}
113113

114114
fn in_any_value_of_ty(cx: &ConstCx<'_, 'tcx>, mut ty: Ty<'tcx>) -> bool {

compiler/rustc_middle/src/mir/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub struct BorrowCheckResult<'tcx> {
224224
#[derive(Clone, Copy, Debug, Default, TyEncodable, TyDecodable, HashStable)]
225225
pub struct ConstQualifs {
226226
pub has_mut_interior: bool,
227-
pub needs_drop: bool,
227+
pub needs_non_const_drop: bool,
228228
pub custom_eq: bool,
229229
pub error_occured: Option<ErrorReported>,
230230
}

0 commit comments

Comments
 (0)