Skip to content

Commit

Permalink
Auto merge of rust-lang#89822 - tmiasko:overflap-duplicates, r=cjgillot
Browse files Browse the repository at this point in the history
Deduplicate regions ids before merging them

The merging code does not expect to see any duplicates.

Fixes rust-lang#89820.

r? `@cjgillot`
  • Loading branch information
bors committed Oct 13, 2021
2 parents 81117ff + 8aaf4ab commit eeb16a2
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 eeb16a2

Please sign in to comment.