]> git.proxmox.com Git - rustc.git/blob - src/test/ui/type-alias-impl-trait/assoc-type-const.rs
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / ui / type-alias-impl-trait / assoc-type-const.rs
1 // Tests that we properly detect defining usages when using
2 // const generics in an associated opaque type
3 // check-pass
4
5 // revisions: min_tait full_tait
6 #![feature(min_type_alias_impl_trait)]
7 #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
8 //[full_tait]~^ WARN incomplete
9 #![feature(const_generics)]
10 //~^ WARN the feature `const_generics` is incomplete
11
12 trait UnwrapItemsExt<'a, const C: usize> {
13 type Iter;
14 fn unwrap_items(self) -> Self::Iter;
15 }
16
17 struct MyStruct<const C: usize> {}
18
19 trait MyTrait<'a, const C: usize> {
20 type MyItem;
21 const MY_CONST: usize;
22 }
23
24 impl<'a, const C: usize> MyTrait<'a, C> for MyStruct<C> {
25 type MyItem = u8;
26 const MY_CONST: usize = C;
27 }
28
29 impl<'a, I, const C: usize> UnwrapItemsExt<'a, C> for I {
30 type Iter = impl MyTrait<'a, C>;
31
32 fn unwrap_items(self) -> Self::Iter {
33 MyStruct::<C> {}
34 }
35 }
36
37 fn main() {}