diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-10-13 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-10-13 00:00:00 +0000 |
| commit | 8aaf4ab59aacdc910ea132dbb13a67c8d69a1607 (patch) | |
| tree | 2f7c492fadb8c67e8b55f8bc143ad2b7eeb8657b | |
| parent | 9475e609b8458fff9e444934a6017d2e590642cf (diff) | |
| download | rust-8aaf4ab59aacdc910ea132dbb13a67c8d69a1607.tar.gz rust-8aaf4ab59aacdc910ea132dbb13a67c8d69a1607.zip | |
Deduplicate regions ids before merging them
The merging code does not expect to see any duplicates.
| -rw-r--r-- | compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/inherent-impls-overlap-check/no-overlap.rs | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs b/compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs index 0373035a09a..beacf301cae 100644 --- a/compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs +++ b/compiler/rustc_typeck/src/coherence/inherent_impls_overlap.rs @@ -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 diff --git a/src/test/ui/inherent-impls-overlap-check/no-overlap.rs b/src/test/ui/inherent-impls-overlap-check/no-overlap.rs index 341bfc7b605..450e6d4202c 100644 --- a/src/test/ui/inherent-impls-overlap-check/no-overlap.rs +++ b/src/test/ui/inherent-impls-overlap-check/no-overlap.rs @@ -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() {} |
