about summary refs log tree commit diff
path: root/tests/crashes/135470.rs
blob: efa017b5457cf706dc135eded3966e73527c8d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//@ known-bug: #135470
//@ compile-flags: -Copt-level=0
//@ edition: 2021

use std::future::Future;
trait Access {
    type Lister;

    fn list() -> impl Future<Output = Self::Lister> {
        async { todo!() }
    }
}

trait Foo {}
impl Access for dyn Foo {
    type Lister = ();
}

fn main() {
    let svc = async {
        async { <dyn Foo>::list() }.await;
    };
    &svc as &dyn Service;
}

trait UnaryService {
    fn call2() {}
}
trait Unimplemented {}
impl<T: Unimplemented> UnaryService for T {}
struct Wrap<T>(T);
impl<T: Send> UnaryService for Wrap<T> {}

trait Service {
    fn call(&self);
}
impl<T: Send> Service for T {
    fn call(&self) {
        Wrap::<T>::call2();
    }
}