]> git.proxmox.com Git - rustc.git/blob - src/test/ui/associated-types/normalization-generality-2.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / associated-types / normalization-generality-2.rs
1 // build-pass
2
3 // Ensures that we don't regress on "implementation is not general enough" when
4 // normalizating under binders. Unlike `normalization-generality.rs`, this also produces
5 // type outlives predicates that we must ignore.
6
7 pub unsafe trait Yokeable<'a> {
8 type Output: 'a;
9 }
10 pub struct Yoke<Y: for<'a> Yokeable<'a>> {
11 _marker: std::marker::PhantomData<Y>,
12 }
13 impl<Y: for<'a> Yokeable<'a>> Yoke<Y> {
14 pub fn project<P>(
15 &self,
16 _f: for<'a> fn(&<Y as Yokeable<'a>>::Output, &'a ()) -> <P as Yokeable<'a>>::Output,
17 ) -> Yoke<P>
18 where
19 P: for<'a> Yokeable<'a>,
20 {
21 unimplemented!()
22 }
23 }
24 pub fn slice(y: Yoke<&'static str>) -> Yoke<&'static [u8]> {
25 y.project(move |yk, _| yk.as_bytes())
26 }
27 unsafe impl<'a, T: 'static + ?Sized> Yokeable<'a> for &'static T {
28 type Output = &'a T;
29 }
30 fn main() {}