Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions compiler/rustc_index/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2024"
rustc_index_macros = { path = "../rustc_index_macros" }
rustc_macros = { path = "../rustc_macros", optional = true }
rustc_serialize = { path = "../rustc_serialize", optional = true }
smallvec = { version = "1.8.1", optional = true }
smallvec = "1.8.1"
# tidy-alphabetical-end

[features]
Expand All @@ -17,7 +17,6 @@ default = ["nightly"]
nightly = [
"dep:rustc_macros",
"dep:rustc_serialize",
"dep:smallvec",
"rustc_index_macros/nightly",
]
rustc_randomized_layouts = []
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_index/src/bit_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{fmt, iter, slice};
use Chunk::*;
#[cfg(feature = "nightly")]
use rustc_macros::{Decodable_NoContext, Encodable_NoContext};
use smallvec::{SmallVec, smallvec};

use crate::{Idx, IndexVec};

Expand Down Expand Up @@ -115,7 +116,7 @@ macro_rules! bit_relations_inherent_impls {
#[derive(Eq, PartialEq, Hash)]
pub struct DenseBitSet<T> {
domain_size: usize,
words: Vec<Word>,
words: SmallVec<[Word; 2]>,
marker: PhantomData<T>,
}

Expand All @@ -131,15 +132,15 @@ impl<T: Idx> DenseBitSet<T> {
#[inline]
pub fn new_empty(domain_size: usize) -> DenseBitSet<T> {
let num_words = num_words(domain_size);
DenseBitSet { domain_size, words: vec![0; num_words], marker: PhantomData }
DenseBitSet { domain_size, words: smallvec![0; num_words], marker: PhantomData }
}

/// Creates a new, filled bitset with a given `domain_size`.
#[inline]
pub fn new_filled(domain_size: usize) -> DenseBitSet<T> {
let num_words = num_words(domain_size);
let mut result =
DenseBitSet { domain_size, words: vec![!0; num_words], marker: PhantomData };
DenseBitSet { domain_size, words: smallvec![!0; num_words], marker: PhantomData };
result.clear_excess_bits();
result
}
Expand Down
Loading