]> git.proxmox.com Git - rustc.git/blame - src/test/ui/inherent-impls-overlap-check/no-overlap.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / inherent-impls-overlap-check / no-overlap.rs
CommitLineData
fc512014
XL
1// run-pass
2// aux-build:repeat.rs
3
4// This tests the allocating algo branch of the
5// inherent impls overlap checker.
6// This branch was added by PR:
7// https://github.com/rust-lang/rust/pull/78317
8// In this test, we repeat many impl blocks
9// to trigger the allocating branch.
10
11#![allow(unused)]
12
13extern crate repeat;
14
15// Simple case where each impl block is distinct
16
17struct Foo {}
18
19repeat::repeat_with_idents!(impl Foo { fn IDENT() {} });
20
21// There are overlapping impl blocks but due to generics,
22// they may overlap.
23
24struct Bar<T>(T);
25
26struct A;
27struct B;
28
29repeat::repeat_with_idents!(impl Bar<A> { fn IDENT() {} });
30
31impl Bar<A> { fn foo() {} }
32impl Bar<B> { fn foo() {} }
33
c295e0f8
XL
34// Regression test for issue #89820:
35
36impl Bar<u8> {
37 pub fn a() {}
38 pub fn aa() {}
39}
40
41impl Bar<u16> {
42 pub fn b() {}
43 pub fn bb() {}
44}
45
46impl Bar<u32> {
47 pub fn a() {}
48 pub fn aa() {}
49 pub fn bb() {}
50 pub fn b() {}
51}
52
fc512014 53fn main() {}