Skip to content

Commit 8aaf4ab

Browse files
committed
Deduplicate regions ids before merging them
The merging code does not expect to see any duplicates.
1 parent 9475e60 commit 8aaf4ab

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ impl ItemLikeVisitor<'v> for InherentOverlapChecker<'tcx> {
192192
.collect::<SmallVec<[RegionId; 8]>>();
193193
// Sort the id list so that the algorithm is deterministic
194194
ids.sort_unstable();
195+
ids.dedup();
195196
let ids = ids;
196197
match &ids[..] {
197198
// Create a new connected region

src/test/ui/inherent-impls-overlap-check/no-overlap.rs

+19
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,23 @@ repeat::repeat_with_idents!(impl Bar<A> { fn IDENT() {} });
3131
impl Bar<A> { fn foo() {} }
3232
impl Bar<B> { fn foo() {} }
3333

34+
// Regression test for issue #89820:
35+
36+
impl Bar<u8> {
37+
pub fn a() {}
38+
pub fn aa() {}
39+
}
40+
41+
impl Bar<u16> {
42+
pub fn b() {}
43+
pub fn bb() {}
44+
}
45+
46+
impl Bar<u32> {
47+
pub fn a() {}
48+
pub fn aa() {}
49+
pub fn bb() {}
50+
pub fn b() {}
51+
}
52+
3453
fn main() {}

0 commit comments

Comments
 (0)