From 65a5b082bc8c44c2281914381c07bd4dd9d11a2b Mon Sep 17 00:00:00 2001 From: SparrowLii Date: Wed, 8 Jun 2022 22:09:26 +0800 Subject: [PATCH] fix the impl error in `insert_all` --- compiler/rustc_index/src/interval.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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()); }