Skip to content

Commit d3d5673

Browse files
committed
Get rid of "is not const" naming
1 parent ec52065 commit d3d5673

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,11 @@ impl Qualif for NeedsDrop {
365365
}
366366
}
367367

368-
// Not constant at all - non-`const fn` calls, asm!,
368+
// Not promotable at all - non-`const fn` calls, asm!,
369369
// pointer comparisons, ptr-to-int casts, etc.
370-
struct IsNotConst;
370+
struct IsNotPromotable;
371371

372-
impl Qualif for IsNotConst {
372+
impl Qualif for IsNotPromotable {
373373
const IDX: usize = 2;
374374

375375
fn in_static(cx: &ConstCx<'_, 'tcx>, static_: &Static<'tcx>) -> bool {
@@ -548,14 +548,14 @@ macro_rules! static_assert_seq_qualifs {
548548
static_assert!(SEQ_QUALIFS: QUALIF_COUNT == $i);
549549
};
550550
}
551-
static_assert_seq_qualifs!(0 => HasMutInterior, NeedsDrop, IsNotConst, IsNotImplicitlyPromotable);
551+
static_assert_seq_qualifs!(0 => HasMutInterior, NeedsDrop, IsNotPromotable, IsNotImplicitlyPromotable);
552552

553553
impl ConstCx<'_, 'tcx> {
554554
fn qualifs_in_any_value_of_ty(&self, ty: Ty<'tcx>) -> PerQualif<bool> {
555555
let mut qualifs = PerQualif::default();
556556
qualifs[HasMutInterior] = HasMutInterior::in_any_value_of_ty(self, ty).unwrap_or(false);
557557
qualifs[NeedsDrop] = NeedsDrop::in_any_value_of_ty(self, ty).unwrap_or(false);
558-
qualifs[IsNotConst] = IsNotConst::in_any_value_of_ty(self, ty).unwrap_or(false);
558+
qualifs[IsNotPromotable] = IsNotPromotable::in_any_value_of_ty(self, ty).unwrap_or(false);
559559
qualifs[IsNotImplicitlyPromotable] = IsNotImplicitlyPromotable::in_any_value_of_ty(self, ty).unwrap_or(false);
560560
qualifs
561561
}
@@ -564,7 +564,7 @@ impl ConstCx<'_, 'tcx> {
564564
let mut qualifs = PerQualif::default();
565565
qualifs[HasMutInterior] = HasMutInterior::in_local(self, local);
566566
qualifs[NeedsDrop] = NeedsDrop::in_local(self, local);
567-
qualifs[IsNotConst] = IsNotConst::in_local(self, local);
567+
qualifs[IsNotPromotable] = IsNotPromotable::in_local(self, local);
568568
qualifs[IsNotImplicitlyPromotable] = IsNotImplicitlyPromotable::in_local(self, local);
569569
qualifs
570570
}
@@ -573,7 +573,7 @@ impl ConstCx<'_, 'tcx> {
573573
let mut qualifs = PerQualif::default();
574574
qualifs[HasMutInterior] = HasMutInterior::in_value(self, source);
575575
qualifs[NeedsDrop] = NeedsDrop::in_value(self, source);
576-
qualifs[IsNotConst] = IsNotConst::in_value(self, source);
576+
qualifs[IsNotPromotable] = IsNotPromotable::in_value(self, source);
577577
qualifs[IsNotImplicitlyPromotable] = IsNotImplicitlyPromotable::in_value(self, source);
578578
qualifs
579579
}
@@ -638,12 +638,12 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
638638
}
639639
}
640640
if !temps[local].is_promotable() {
641-
cx.per_local[IsNotConst].insert(local);
641+
cx.per_local[IsNotPromotable].insert(local);
642642
}
643643
if let LocalKind::Var = mir.local_kind(local) {
644644
// Sanity check to prevent implicit and explicit promotion of
645645
// named locals
646-
assert!(cx.per_local[IsNotConst].contains(local));
646+
assert!(cx.per_local[IsNotPromotable].contains(local));
647647
}
648648
}
649649

@@ -691,11 +691,11 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
691691
// the borrowed place is disallowed from being borrowed,
692692
// due to either a mutable borrow (with some exceptions),
693693
// or an shared borrow of a value with interior mutability.
694-
// Then `HasMutInterior` is replaced with `IsNotConst`,
694+
// Then `HasMutInterior` is replaced with `IsNotPromotable`,
695695
// to avoid duplicate errors (e.g. from reborrowing).
696696
if qualifs[HasMutInterior] {
697697
qualifs[HasMutInterior] = false;
698-
qualifs[IsNotConst] = true;
698+
qualifs[IsNotPromotable] = true;
699699

700700
if self.mode != Mode::Fn {
701701
if let BorrowKind::Mut { .. } = kind {
@@ -810,15 +810,15 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
810810
}
811811
}
812812

813-
// Ensure the `IsNotConst` qualification is preserved.
813+
// Ensure the `IsNotPromotable` qualification is preserved.
814814
// NOTE(eddyb) this is actually unnecessary right now, as
815815
// we never replace the local's qualif, but we might in
816816
// the future, and so it serves to catch changes that unset
817817
// important bits (in which case, asserting `contains` could
818818
// be replaced with calling `insert` to re-set the bit).
819819
if kind == LocalKind::Temp {
820820
if !self.temp_promotion_state[index].is_promotable() {
821-
assert!(self.cx.per_local[IsNotConst].contains(index));
821+
assert!(self.cx.per_local[IsNotPromotable].contains(index));
822822
}
823823
}
824824
}
@@ -904,7 +904,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
904904

905905
// Account for errors in consts by using the
906906
// conservative type qualification instead.
907-
if qualifs[IsNotConst] {
907+
if qualifs[IsNotPromotable] {
908908
qualifs = self.qualifs_in_any_value_of_ty(mir.return_ty());
909909
}
910910

@@ -1319,7 +1319,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
13191319
// which happens even without the user requesting it.
13201320
// We can error out with a hard error if the argument is not
13211321
// constant here.
1322-
if !IsNotConst::in_operand(self, arg) {
1322+
if !IsNotPromotable::in_operand(self, arg) {
13231323
debug!("visit_terminator_kind: candidate={:?}", candidate);
13241324
self.promotion_candidates.push(candidate);
13251325
} else {
@@ -1437,7 +1437,7 @@ fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
14371437

14381438
if mir.return_ty().references_error() {
14391439
tcx.sess.delay_span_bug(mir.span, "mir_const_qualif: Mir had errors");
1440-
return (1 << IsNotConst::IDX, Lrc::new(BitSet::new_empty(0)));
1440+
return (1 << IsNotPromotable::IDX, Lrc::new(BitSet::new_empty(0)));
14411441
}
14421442

14431443
Checker::new(tcx, def_id, mir, Mode::Const).check_const()

0 commit comments

Comments
 (0)