]> git.proxmox.com Git - rustc.git/blob - src/test/ui/associated-types/normalization-generality.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / associated-types / normalization-generality.rs
1 // build-pass
2
3 // Ensures that we don't regress on "implementation is not general enough" when
4 // normalizating under binders.
5
6 #![feature(no_core)]
7
8 pub trait Yokeable<'a> {
9 type Output: 'a;
10 }
11
12 pub struct Yoke<Y: for<'a> Yokeable<'a>> {
13 _yokeable: Y,
14 }
15
16 impl<Y: for<'a> Yokeable<'a>> Yoke<Y> {
17 pub fn project<'this, P>(
18 &'this self,
19 _f: for<'a> fn(<Y as Yokeable<'a>>::Output, &'a ()) -> <P as Yokeable<'a>>::Output,
20 ) -> Yoke<P>
21 where
22 P: for<'a> Yokeable<'a>,
23 {
24 unimplemented!()
25 }
26 }
27
28 pub fn slice(y: Yoke<&'static ()>) -> Yoke<&'static ()> {
29 y.project(move |yk, _| yk)
30 }
31
32 impl<'a, T> Yokeable<'a> for &'static T {
33 type Output = &'a T;
34 }
35
36 fn main() {}