mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
40 lines
540 B
Rust
40 lines
540 B
Rust
//@ known-bug: #123134
|
|
trait Api: Sized {
|
|
type Device: ?Sized;
|
|
}
|
|
|
|
struct OpenDevice<A: Api>
|
|
where
|
|
A::Device: Sized,
|
|
{
|
|
device: A::Device,
|
|
queue: (),
|
|
}
|
|
|
|
trait Adapter {
|
|
type A: Api;
|
|
|
|
fn open() -> OpenDevice<Self::A>
|
|
where
|
|
<Self::A as Api>::Device: Sized;
|
|
}
|
|
|
|
struct ApiS;
|
|
|
|
impl Api for ApiS {
|
|
type Device = [u8];
|
|
}
|
|
|
|
impl<T> Adapter for T {
|
|
type A = ApiS;
|
|
|
|
fn open() -> OpenDevice<Self::A>
|
|
where
|
|
<Self::A as Api>::Device: Sized,
|
|
{
|
|
unreachable!()
|
|
}
|
|
}
|
|
|
|
pub fn main() {}
|