mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
30 lines
460 B
Rust
30 lines
460 B
Rust
//@ run-pass
|
|
//
|
|
// issue: <https://github.com/rust-lang/rust/issues/131813>
|
|
|
|
#![feature(trait_upcasting)]
|
|
|
|
trait Pollable {
|
|
#[allow(unused)]
|
|
fn poll(&self) {}
|
|
}
|
|
trait FileIo: Pollable + Send + Sync {
|
|
fn read(&self) {}
|
|
}
|
|
trait Terminal: Send + Sync + FileIo {}
|
|
|
|
struct A;
|
|
|
|
impl Pollable for A {}
|
|
impl FileIo for A {}
|
|
impl Terminal for A {}
|
|
|
|
fn main() {
|
|
let a = A;
|
|
|
|
let b = &a as &dyn Terminal;
|
|
let c = b as &dyn FileIo;
|
|
|
|
c.read();
|
|
}
|