rust/tests/ui/async-await/higher-ranked-auto-trait-2.rs
2025-07-15 16:02:26 +00:00

24 lines
704 B
Rust

// Repro for <https://github.com/rust-lang/rust/issues/111105#issue-1692860759>.
//@ edition: 2021
//@ revisions: assumptions no_assumptions
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
//@[assumptions] check-pass
//@[no_assumptions] known-bug: #110338
use std::future::Future;
pub trait Foo: Sync {
fn run<'a, 'b: 'a, T: Sync>(&'a self, _: &'b T) -> impl Future<Output = ()> + 'a + Send;
}
pub trait FooExt: Foo {
fn run_via<'a, 'b: 'a, T: Sync>(&'a self, t: &'b T) -> impl Future<Output = ()> + 'a + Send {
async move {
// asks for an unspecified lifetime to outlive itself? weird diagnostics
self.run(t).await;
}
}
}
fn main() {}