]> git.lizzy.rs Git - rust.git/blob - tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89436.rs
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / higher-rank-trait-bounds / normalize-under-binder / issue-89436.rs
1 // check-pass
2
3 #![allow(unused)]
4
5 trait MiniYokeable<'a> {
6     type Output;
7 }
8
9 struct MiniYoke<Y: for<'a> MiniYokeable<'a>> {
10     pub yokeable: Y,
11 }
12
13 fn map_project_broken<Y, P>(
14     source: MiniYoke<Y>,
15     f: impl for<'a> FnOnce(
16         <Y as MiniYokeable<'a>>::Output,
17         core::marker::PhantomData<&'a ()>,
18     ) -> <P as MiniYokeable<'a>>::Output,
19 ) -> MiniYoke<P>
20 where
21     Y: for<'a> MiniYokeable<'a>,
22     P: for<'a> MiniYokeable<'a>
23 {
24     unimplemented!()
25 }
26
27 struct Bar<'a> {
28     string_1: &'a str,
29     string_2: &'a str,
30 }
31
32 impl<'a> MiniYokeable<'a> for Bar<'static> {
33     type Output = Bar<'a>;
34 }
35
36 impl<'a> MiniYokeable<'a> for &'static str {
37     type Output = &'a str;
38 }
39
40 fn demo_broken(bar: MiniYoke<Bar<'static>>) -> MiniYoke<&'static str> {
41     map_project_broken(bar, |bar, _| bar.string_1)
42 }
43
44 fn main() {}