]> git.lizzy.rs Git - rust.git/blob - src/test/ui/inherent-impls-overlap-check/no-overlap.rs
Rollup merge of #105555 - krasimirgg:llvm-int-opt-2, r=cuviper
[rust.git] / src / test / ui / inherent-impls-overlap-check / no-overlap.rs
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
13 extern crate repeat;
14
15 // Simple case where each impl block is distinct
16
17 struct Foo {}
18
19 repeat::repeat_with_idents!(impl Foo { fn IDENT() {} });
20
21 // There are overlapping impl blocks but due to generics,
22 // they may overlap.
23
24 struct Bar<T>(T);
25
26 struct A;
27 struct B;
28
29 repeat::repeat_with_idents!(impl Bar<A> { fn IDENT() {} });
30
31 impl Bar<A> { fn foo() {} }
32 impl Bar<B> { fn foo() {} }
33
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
53 fn main() {}