diff options
Diffstat (limited to 'tests/ui/async-await/higher-ranked-auto-trait-4.rs')
| -rw-r--r-- | tests/ui/async-await/higher-ranked-auto-trait-4.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/async-await/higher-ranked-auto-trait-4.rs b/tests/ui/async-await/higher-ranked-auto-trait-4.rs new file mode 100644 index 00000000000..0586af41e9e --- /dev/null +++ b/tests/ui/async-await/higher-ranked-auto-trait-4.rs @@ -0,0 +1,34 @@ +// 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() {} |
