]> git.lizzy.rs Git - rust.git/blob - tests/ui/const-generics/overlapping_impls.rs
Rollup merge of #107114 - Erk-:add-absolute-note-to-path-join, r=m-ou-se
[rust.git] / tests / ui / const-generics / overlapping_impls.rs
1 // check-pass
2 #![allow(incomplete_features)]
3 #![feature(adt_const_params)]
4 #![feature(generic_const_exprs)]
5 use std::marker::PhantomData;
6
7 struct Foo<const I: i32, const J: i32> {}
8
9 const ONE: i32 = 1;
10 const TWO: i32 = 2;
11
12 impl<const I: i32> Foo<I, ONE> {
13     pub fn foo() {}
14 }
15
16 impl<const I: i32> Foo<I, TWO> {
17     pub fn foo() {}
18 }
19
20
21 pub struct Foo2<const P: Protocol, T> {
22     _marker: PhantomData<T>,
23 }
24
25 #[derive(PartialEq, Eq)]
26 pub enum Protocol {
27     Variant1,
28     Variant2,
29 }
30
31 pub trait Bar {}
32
33 impl<T> Bar for Foo2<{ Protocol::Variant1 }, T> {}
34 impl<T> Bar for Foo2<{ Protocol::Variant2 }, T> {}
35
36 fn main() {}