Files
rust/tests/ui/async-await/higher-ranked-auto-trait-4.rs

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

35 lines
763 B
Rust
Raw Normal View History

2025-07-13 23:17:21 +00:00
// Repro for <https://github.com/rust-lang/rust/issues/102211#issuecomment-2891975128>.
//@ edition: 2021
//@ revisions: assumptions no_assumptions
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
//@[assumptions] check-pass
//@[no_assumptions] known-bug: #110338
use std::future::Future;
trait BoringTrait {}
trait TraitWithAssocType<I> {
type Assoc;
}
impl<T> TraitWithAssocType<()> for T
where
T: ?Sized + 'static,
{
type Assoc = ();
}
fn evil_function<T: TraitWithAssocType<I> + ?Sized, I>()
-> impl Future<Output = Result<(), T::Assoc>> {
async { Ok(()) }
}
fn fails_to_compile() -> impl std::future::Future<Output = ()> + Send {
async {
let _ = evil_function::<dyn BoringTrait, _>().await;
}
}
fn main() {}