]> git.proxmox.com Git - rustc.git/blob - tests/ui/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / rfc-2632-const-trait-impl / specialization / issue-95187-same-trait-bound-different-constness.rs
1 // Tests that `T: ~const Foo` in a specializing impl is treated as equivalent to
2 // `T: Foo` in the default impl for the purposes of specialization (i.e., it
3 // does not think that the user is attempting to specialize on trait `Foo`).
4
5 // check-pass
6
7 #![feature(rustc_attrs)]
8 #![feature(min_specialization)]
9 #![feature(const_trait_impl)]
10
11 #[rustc_specialization_trait]
12 trait Specialize {}
13
14 #[const_trait]
15 trait Foo {}
16
17 #[const_trait]
18 trait Bar {}
19
20 impl<T> Bar for T
21 where
22 T: Foo,
23 {}
24
25 impl<T> const Bar for T
26 where
27 T: ~const Foo,
28 T: Specialize,
29 {}
30
31 #[const_trait]
32 trait Baz {}
33
34 impl<T> const Baz for T
35 where
36 T: Foo,
37 {}
38
39 impl<T> const Baz for T
40 where
41 T: ~const Foo,
42 T: Specialize,
43 {}
44
45 fn main() {}