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
6 changes: 3 additions & 3 deletions compiler/rustc_abi/src/layout/coroutine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn coroutine_saved_local_eligibility<VariantIdx: Idx, FieldIdx: Idx, LocalIdx: I
"removing local {:?} in >1 variant ({:?}, {:?})",
local, variant_index, idx
);
ineligible_locals.insert(*local);
ineligible_locals.insert2(*local);
assignments[*local] = Ineligible(None);
}
Ineligible(_) => {}
Expand Down Expand Up @@ -98,7 +98,7 @@ fn coroutine_saved_local_eligibility<VariantIdx: Idx, FieldIdx: Idx, LocalIdx: I
let conflicts_b = storage_conflicts.count(local_b);
let (remove, other) =
if conflicts_a > conflicts_b { (local_a, local_b) } else { (local_b, local_a) };
ineligible_locals.insert(remove);
ineligible_locals.insert2(remove);
assignments[remove] = Ineligible(None);
trace!("removing local {:?} due to conflict with {:?}", remove, other);
}
Expand All @@ -113,7 +113,7 @@ fn coroutine_saved_local_eligibility<VariantIdx: Idx, FieldIdx: Idx, LocalIdx: I
let mut used_variants = DenseBitSet::new_empty(variant_fields.len());
for assignment in &assignments {
if let Assigned(idx) = assignment {
used_variants.insert(*idx);
used_variants.insert2(*idx);
}
}
if used_variants.count() < 2 {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub(crate) fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
let mut non_ssa_locals = DenseBitSet::new_empty(analyzer.locals.len());
for (local, kind) in analyzer.locals.iter_enumerated() {
if matches!(kind, LocalKind::Memory) {
non_ssa_locals.insert(local);
non_ssa_locals.insert2(local);
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
// NOTE(eddyb) actually, on second thought, those are always in the
// function scope, which always exists.
for var_debug_info in &self.mir.var_debug_info {
vars.insert(var_debug_info.source_info.scope);
vars.insert2(var_debug_info.source_info.scope);
}
Some(vars)
} else {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
let mut reachable = DenseBitSet::new_empty(mir.basic_blocks.len());
let mut to_visit = vec![mir::START_BLOCK];
while let Some(next) = to_visit.pop() {
if !reachable.insert(next) {
if !reachable.insert2(next) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2111,7 +2111,7 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD
&& let ty::Param(param) = leaf_ty.kind()
{
debug!("found use of ty param {:?}", param);
params_used.insert(param.index);
params_used.insert2(param.index);
}
}

Expand Down
12 changes: 12 additions & 0 deletions compiler/rustc_index/src/bit_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ impl<T: Idx> DenseBitSet<T> {
new_word != word
}

/// Insert `elem`. Returns whether the set has changed.
#[inline]
pub fn insert2(&mut self, elem: T) -> bool {
assert!(elem.index() < self.domain_size,);
let (word_index, mask) = word_index_and_mask(elem);
let word_ref = &mut self.words[word_index];
let word = *word_ref;
let new_word = word | mask;
*word_ref = new_word;
new_word != word
}

#[inline]
pub fn insert_range(&mut self, elems: impl RangeBounds<T>) {
let Some((start, end)) = inclusive_start_end(elems, self.domain_size) else {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ty_utils/src/representability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn params_in_repr_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, params_in_repr: &mut
ty::Array(ty, _) => params_in_repr_ty(tcx, ty, params_in_repr),
ty::Tuple(tys) => tys.iter().for_each(|ty| params_in_repr_ty(tcx, ty, params_in_repr)),
ty::Param(param) => {
params_in_repr.insert(param.index);
params_in_repr.insert2(param.index);
}
_ => {}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ty_utils/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ fn unsizing_params_for_adt<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> DenseBitSe
let mut unsizing_params = DenseBitSet::new_empty(num_params);
for arg in tcx.type_of(tail_field.did).instantiate_identity().skip_norm_wip().walk() {
if let Some(i) = maybe_unsizing_param_idx(arg) {
unsizing_params.insert(i);
unsizing_params.insert2(i);
}
}

Expand Down
Loading