diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/impl-trait/issues/issue-86800.rs | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/impl-trait/issues/issue-86800.rs')
-rw-r--r-- | src/test/ui/impl-trait/issues/issue-86800.rs | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/issues/issue-86800.rs b/src/test/ui/impl-trait/issues/issue-86800.rs new file mode 100644 index 000000000..351243c67 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-86800.rs @@ -0,0 +1,55 @@ +#![feature(type_alias_impl_trait)] + +// edition:2021 +// unset-rustc-env:RUST_BACKTRACE +// compile-flags:-Z treat-err-as-bug=1 +// error-pattern:stack backtrace: +// failure-status:101 +// normalize-stderr-test "note: .*" -> "" +// normalize-stderr-test "thread 'rustc' .*" -> "" +// normalize-stderr-test " +[0-9]+:.*\n" -> "" +// normalize-stderr-test " +at .*\n" -> "" + +use std::future::Future; + +struct Connection { +} + +trait Transaction { +} + +struct TestTransaction<'conn> { + conn: &'conn Connection +} + +impl<'conn> Transaction for TestTransaction<'conn> { +} + +struct Context { +} + +type TransactionResult<O> = Result<O, ()>; + +type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>; + +fn execute_transaction_fut<'f, F, O>( + f: F, +) -> impl FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O> +where + F: FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O> + 'f +{ + f +} + +impl Context { + async fn do_transaction<O>( + &self, f: impl FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O> + ) -> TransactionResult<O> + { + let mut conn = Connection {}; + let mut transaction = TestTransaction { conn: &mut conn }; + f(&mut transaction).await + } +} + +fn main() {} |