@@ -365,11 +365,11 @@ impl Qualif for NeedsDrop {
365
365
}
366
366
}
367
367
368
- // Not constant at all - non-`const fn` calls, asm!,
368
+ // Not promotable at all - non-`const fn` calls, asm!,
369
369
// pointer comparisons, ptr-to-int casts, etc.
370
- struct IsNotConst ;
370
+ struct IsNotPromotable ;
371
371
372
- impl Qualif for IsNotConst {
372
+ impl Qualif for IsNotPromotable {
373
373
const IDX : usize = 2 ;
374
374
375
375
fn in_static ( cx : & ConstCx < ' _ , ' tcx > , static_ : & Static < ' tcx > ) -> bool {
@@ -548,14 +548,14 @@ macro_rules! static_assert_seq_qualifs {
548
548
static_assert!( SEQ_QUALIFS : QUALIF_COUNT == $i) ;
549
549
} ;
550
550
}
551
- static_assert_seq_qualifs ! ( 0 => HasMutInterior , NeedsDrop , IsNotConst , IsNotImplicitlyPromotable ) ;
551
+ static_assert_seq_qualifs ! ( 0 => HasMutInterior , NeedsDrop , IsNotPromotable , IsNotImplicitlyPromotable ) ;
552
552
553
553
impl ConstCx < ' _ , ' tcx > {
554
554
fn qualifs_in_any_value_of_ty ( & self , ty : Ty < ' tcx > ) -> PerQualif < bool > {
555
555
let mut qualifs = PerQualif :: default ( ) ;
556
556
qualifs[ HasMutInterior ] = HasMutInterior :: in_any_value_of_ty ( self , ty) . unwrap_or ( false ) ;
557
557
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 ) ;
559
559
qualifs[ IsNotImplicitlyPromotable ] = IsNotImplicitlyPromotable :: in_any_value_of_ty ( self , ty) . unwrap_or ( false ) ;
560
560
qualifs
561
561
}
@@ -564,7 +564,7 @@ impl ConstCx<'_, 'tcx> {
564
564
let mut qualifs = PerQualif :: default ( ) ;
565
565
qualifs[ HasMutInterior ] = HasMutInterior :: in_local ( self , local) ;
566
566
qualifs[ NeedsDrop ] = NeedsDrop :: in_local ( self , local) ;
567
- qualifs[ IsNotConst ] = IsNotConst :: in_local ( self , local) ;
567
+ qualifs[ IsNotPromotable ] = IsNotPromotable :: in_local ( self , local) ;
568
568
qualifs[ IsNotImplicitlyPromotable ] = IsNotImplicitlyPromotable :: in_local ( self , local) ;
569
569
qualifs
570
570
}
@@ -573,7 +573,7 @@ impl ConstCx<'_, 'tcx> {
573
573
let mut qualifs = PerQualif :: default ( ) ;
574
574
qualifs[ HasMutInterior ] = HasMutInterior :: in_value ( self , source) ;
575
575
qualifs[ NeedsDrop ] = NeedsDrop :: in_value ( self , source) ;
576
- qualifs[ IsNotConst ] = IsNotConst :: in_value ( self , source) ;
576
+ qualifs[ IsNotPromotable ] = IsNotPromotable :: in_value ( self , source) ;
577
577
qualifs[ IsNotImplicitlyPromotable ] = IsNotImplicitlyPromotable :: in_value ( self , source) ;
578
578
qualifs
579
579
}
@@ -638,12 +638,12 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
638
638
}
639
639
}
640
640
if !temps[ local] . is_promotable ( ) {
641
- cx. per_local [ IsNotConst ] . insert ( local) ;
641
+ cx. per_local [ IsNotPromotable ] . insert ( local) ;
642
642
}
643
643
if let LocalKind :: Var = mir. local_kind ( local) {
644
644
// Sanity check to prevent implicit and explicit promotion of
645
645
// named locals
646
- assert ! ( cx. per_local[ IsNotConst ] . contains( local) ) ;
646
+ assert ! ( cx. per_local[ IsNotPromotable ] . contains( local) ) ;
647
647
}
648
648
}
649
649
@@ -691,11 +691,11 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
691
691
// the borrowed place is disallowed from being borrowed,
692
692
// due to either a mutable borrow (with some exceptions),
693
693
// or an shared borrow of a value with interior mutability.
694
- // Then `HasMutInterior` is replaced with `IsNotConst `,
694
+ // Then `HasMutInterior` is replaced with `IsNotPromotable `,
695
695
// to avoid duplicate errors (e.g. from reborrowing).
696
696
if qualifs[ HasMutInterior ] {
697
697
qualifs[ HasMutInterior ] = false ;
698
- qualifs[ IsNotConst ] = true ;
698
+ qualifs[ IsNotPromotable ] = true ;
699
699
700
700
if self . mode != Mode :: Fn {
701
701
if let BorrowKind :: Mut { .. } = kind {
@@ -810,15 +810,15 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
810
810
}
811
811
}
812
812
813
- // Ensure the `IsNotConst ` qualification is preserved.
813
+ // Ensure the `IsNotPromotable ` qualification is preserved.
814
814
// NOTE(eddyb) this is actually unnecessary right now, as
815
815
// we never replace the local's qualif, but we might in
816
816
// the future, and so it serves to catch changes that unset
817
817
// important bits (in which case, asserting `contains` could
818
818
// be replaced with calling `insert` to re-set the bit).
819
819
if kind == LocalKind :: Temp {
820
820
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) ) ;
822
822
}
823
823
}
824
824
}
@@ -904,7 +904,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
904
904
905
905
// Account for errors in consts by using the
906
906
// conservative type qualification instead.
907
- if qualifs[ IsNotConst ] {
907
+ if qualifs[ IsNotPromotable ] {
908
908
qualifs = self . qualifs_in_any_value_of_ty ( mir. return_ty ( ) ) ;
909
909
}
910
910
@@ -1319,7 +1319,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
1319
1319
// which happens even without the user requesting it.
1320
1320
// We can error out with a hard error if the argument is not
1321
1321
// constant here.
1322
- if !IsNotConst :: in_operand ( self , arg) {
1322
+ if !IsNotPromotable :: in_operand ( self , arg) {
1323
1323
debug ! ( "visit_terminator_kind: candidate={:?}" , candidate) ;
1324
1324
self . promotion_candidates . push ( candidate) ;
1325
1325
} else {
@@ -1437,7 +1437,7 @@ fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1437
1437
1438
1438
if mir. return_ty ( ) . references_error ( ) {
1439
1439
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 ) ) ) ;
1441
1441
}
1442
1442
1443
1443
Checker :: new ( tcx, def_id, mir, Mode :: Const ) . check_const ( )
0 commit comments