rust/tests/ui/traits/upcast_reorder.rs

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

30 lines
460 B
Rust
Raw Normal View History

//@ 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();
}