rust/tests/crashes/135470.rs

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

42 lines
695 B
Rust
Raw Normal View History

2025-01-25 22:30:38 +01:00
//@ known-bug: #135470
//@ compile-flags: -Copt-level=0
//@ edition: 2021
2025-01-25 22:30:38 +01:00
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();
}
}