Skip to content

Commit

Permalink
Deduplicate regions ids before merging them
Browse files Browse the repository at this point in the history
The merging code does not expect to see any duplicates.
  • Loading branch information
tmiasko committed Oct 13, 2021
1 parent 9475e60 commit 8aaf4ab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ impl ItemLikeVisitor<'v> for InherentOverlapChecker<'tcx> {
.collect::<SmallVec<[RegionId; 8]>>();
// Sort the id list so that the algorithm is deterministic
ids.sort_unstable();
ids.dedup();
let ids = ids;
match &ids[..] {
// Create a new connected region
Expand Down
19 changes: 19 additions & 0 deletions src/test/ui/inherent-impls-overlap-check/no-overlap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,23 @@ repeat::repeat_with_idents!(impl Bar<A> { fn IDENT() {} });
impl Bar<A> { fn foo() {} }
impl Bar<B> { fn foo() {} }

// Regression test for issue #89820:

impl Bar<u8> {
pub fn a() {}
pub fn aa() {}
}

impl Bar<u16> {
pub fn b() {}
pub fn bb() {}
}

impl Bar<u32> {
pub fn a() {}
pub fn aa() {}
pub fn bb() {}
pub fn b() {}
}

fn main() {}

0 comments on commit 8aaf4ab

Please sign in to comment.