rust/tests/ui/impl-trait/issues/issue-86800.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.1 KiB
Rust
Raw Normal View History

2022-02-17 07:55:58 -06:00
#![feature(type_alias_impl_trait)]
// edition:2021
// compile-flags:-Z treat-err-as-bug=1
// error-pattern: aborting due to `-Z treat-err-as-bug=1`
// failure-status:101
// normalize-stderr-test ".*note: .*\n\n" -> ""
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
// rustc-env:RUST_BACKTRACE=0
2022-02-17 07:55:58 -06:00
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,
2022-03-11 04:58:59 -06:00
) -> impl FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O>
2022-02-17 07:55:58 -06:00
where
2022-03-11 04:58:59 -06:00
F: FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O> + 'f
2022-02-17 07:55:58 -06:00
{
f
}
impl Context {
async fn do_transaction<O>(
2022-03-11 04:58:59 -06:00
&self, f: impl FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O>
2022-02-17 07:55:58 -06:00
) -> TransactionResult<O>
{
let mut conn = Connection {};
let mut transaction = TestTransaction { conn: &mut conn };
f(&mut transaction).await
}
}
fn main() {}