From 7f86311a11372c94aed586c5f8e150a9f130199f Mon Sep 17 00:00:00 2001 From: panstromek Date: Mon, 24 Aug 2026 22:11:26 +0200 Subject: [PATCH] experiment - use insert with simpler assert only in unspecialize to test whether that callsite is the culprit --- compiler/rustc_index/src/bit_set.rs | 11 +++++++++++ compiler/rustc_pattern_analysis/src/usefulness.rs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_index/src/bit_set.rs b/compiler/rustc_index/src/bit_set.rs index aa3c759a6adbd..ff92a96fcffd9 100644 --- a/compiler/rustc_index/src/bit_set.rs +++ b/compiler/rustc_index/src/bit_set.rs @@ -145,6 +145,17 @@ impl DenseBitSet { } /// 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(&mut self, elem: T) -> bool { assert!( diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index 1f19bfd732892..b5249af65a4ba 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -1327,7 +1327,7 @@ impl<'p, Cx: PatCx> Matrix<'p, Cx> { let parent_intersection = specialized.rows[child_intersection].parent_row; // Note: self-intersection can happen with or-patterns. if parent_intersection != parent_row_id { - parent_row.intersects_at_least.insert(parent_intersection); + parent_row.intersects_at_least.insert2(parent_intersection); } } }