]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/issue-88856.rs
Auto merge of #91255 - b-naber:normalization-ice, r=jackh276
[rust.git] / src / test / ui / associated-types / issue-88856.rs
1 // check-pass
2
3 #![feature(generic_const_exprs)]
4 #![allow(incomplete_features)]
5
6 pub trait Trait{
7     type R;
8     fn func(self)->Self::R;
9 }
10
11 pub struct TraitImpl<const N:usize>(pub i32);
12
13 impl<const N:usize> Trait for TraitImpl<N>
14 where [();N/2]:,
15 {
16     type R = Self;
17     fn func(self)->Self::R {
18         self
19     }
20 }
21
22 fn sample<P,Convert>(p:P,f:Convert) -> i32
23 where
24     P:Trait,Convert:Fn(P::R)->i32
25 {
26     f(p.func())
27 }
28
29 fn main() {
30     let t = TraitImpl::<10>(4);
31     sample(t,|x|x.0);
32 }