diff --git a/compiler/rustc_index/src/interval.rs b/compiler/rustc_index/src/interval.rs index b444fb724e8..3592fb33077 100644 --- a/compiler/rustc_index/src/interval.rs +++ b/compiler/rustc_index/src/interval.rs @@ -203,7 +203,9 @@ impl IntervalSet { pub fn insert_all(&mut self) { self.clear(); - self.map.push((0, self.domain.try_into().unwrap())); + if let Some(end) = self.domain.checked_sub(1) { + self.map.push((0, end.try_into().unwrap())); + } debug_assert!(self.check_invariants()); }