]> git.lizzy.rs Git - rust.git/blob - tests/ui/generic-associated-types/cross-crate-bounds.rs
Rollup merge of #103702 - WaffleLapkin:lift-sized-bounds-from-pointer-methods-where...
[rust.git] / tests / ui / generic-associated-types / cross-crate-bounds.rs
1 // regression test for #73816
2 // We handled bounds differently when `feature(generic_associated_types)` was enabled
3
4 // edition:2018
5 // aux-build:foo_defn.rs
6
7 extern crate foo_defn;
8
9 use foo_defn::Foo;
10 use std::{future::Future, pin::Pin};
11
12 pub struct FooImpl;
13
14 impl Foo for FooImpl {
15     type Bar = ();
16     //~^ ERROR the trait bound `(): AsRef<()>` is not satisfied
17     fn foo(&self) -> Pin<Box<dyn Future<Output = Self::Bar> + '_>> {
18         panic!()
19     }
20 }
21
22 async fn foo() {
23     bar(&FooImpl).await;
24 }
25
26 async fn bar<F: Foo>(foo: &F) {
27     foo.foo().await.as_ref();
28 }
29
30 fn main() {
31     // futures::executor::block_on(foo());
32 }