diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/impl-trait/hidden-type-is-opaque-2.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/impl-trait/hidden-type-is-opaque-2.rs')
-rw-r--r-- | tests/ui/impl-trait/hidden-type-is-opaque-2.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/hidden-type-is-opaque-2.rs b/tests/ui/impl-trait/hidden-type-is-opaque-2.rs new file mode 100644 index 000000000..970d84120 --- /dev/null +++ b/tests/ui/impl-trait/hidden-type-is-opaque-2.rs @@ -0,0 +1,45 @@ +// This doesn't work, because we don't flow information from opaque types +// into function arguments via the function's generic parameters +// FIXME(oli-obk): make `expected_inputs_for_expected_output` support this + +#![feature(type_alias_impl_trait)] + +fn reify_as() -> Thunk<impl FnOnce(Continuation) -> Continuation> { + Thunk::new(|mut cont| { + cont.reify_as(); //~ ERROR type annotations needed + cont + }) +} + +type Tait = impl FnOnce(Continuation) -> Continuation; + +fn reify_as_tait() -> Thunk<Tait> { + Thunk::new(|mut cont| { + cont.reify_as(); //~ ERROR type annotations needed + cont + }) +} + +#[must_use] +struct Thunk<F>(F); + +impl<F> Thunk<F> { + fn new(f: F) -> Self + where + F: ContFn, + { + Thunk(f) + } +} + +trait ContFn {} + +impl<F: FnOnce(Continuation) -> Continuation> ContFn for F {} + +struct Continuation; + +impl Continuation { + fn reify_as(&mut self) {} +} + +fn main() {} |