]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/hidden-type-is-opaque-2.rs
Rollup merge of #92242 - compiler-errors:layout-modulo-regions, r=matthewjasper
[rust.git] / src / test / ui / impl-trait / hidden-type-is-opaque-2.rs
1 // This doesn't work, because we don't flow information from opaque types
2 // into function arguments via the function's generic parameters
3 // FIXME(oli-obk): make `expected_inputs_for_expected_output` support this
4
5 fn reify_as() -> Thunk<impl FnOnce(Continuation) -> Continuation> {
6     Thunk::new(|mut cont| { //~ ERROR type annotations needed
7         cont.reify_as();
8         cont
9     })
10 }
11
12 #[must_use]
13 struct Thunk<F>(F);
14
15 impl<F> Thunk<F> {
16     fn new(f: F) -> Self
17     where
18         F: ContFn,
19     {
20         Thunk(f)
21     }
22 }
23
24 trait ContFn {}
25
26 impl<F: FnOnce(Continuation) -> Continuation> ContFn for F {}
27
28 struct Continuation;
29
30 impl Continuation {
31     fn reify_as(&mut self) {}
32 }
33
34 fn main() {}