diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2024-03-30 16:18:18 +0100 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2024-03-30 16:22:43 +0100 |
| commit | e1b8441899b87e52d0b368f55fc921ec668cde1f (patch) | |
| tree | b2cafd63762d6eacbaa43fc35f3aaf0a82bfd564 /compiler/rustc_pattern_analysis/src/constructor.rs | |
| parent | 10a7aa14fed9b528b74b0f098c4899c37c09a9c7 (diff) | |
| download | rust-e1b8441899b87e52d0b368f55fc921ec668cde1f.tar.gz rust-e1b8441899b87e52d0b368f55fc921ec668cde1f.zip | |
Require enum indices to be contiguous
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/constructor.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/constructor.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 95c5556410d..1c9a9ab0f72 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -155,13 +155,13 @@ use std::iter::once; use smallvec::SmallVec; use rustc_apfloat::ieee::{DoubleS, IeeeFloat, SingleS}; -use rustc_index::bit_set::GrowableBitSet; +use rustc_index::bit_set::{BitSet, GrowableBitSet}; +use rustc_index::IndexVec; use self::Constructor::*; use self::MaybeInfiniteInt::*; use self::SliceKind::*; -use crate::index; use crate::PatCx; /// Whether we have seen a constructor in the column or not. @@ -920,10 +920,7 @@ pub enum ConstructorSet<Cx: PatCx> { Struct { empty: bool }, /// This type has the following list of constructors. If `variants` is empty and /// `non_exhaustive` is false, don't use this; use `NoConstructors` instead. - Variants { - variants: index::IdxContainer<Cx::VariantIdx, VariantVisibility>, - non_exhaustive: bool, - }, + Variants { variants: IndexVec<Cx::VariantIdx, VariantVisibility>, non_exhaustive: bool }, /// The type is `&T`. Ref, /// The type is a union. @@ -1025,7 +1022,7 @@ impl<Cx: PatCx> ConstructorSet<Cx> { } } ConstructorSet::Variants { variants, non_exhaustive } => { - let mut seen_set = index::IdxSet::new_empty(variants.len()); + let mut seen_set = BitSet::new_empty(variants.len()); for idx in seen.iter().filter_map(|c| c.as_variant()) { seen_set.insert(idx); } |
