Created
November 14, 2019 14:39
-
-
Save nikomatsakis/cfa4a3bf7e04ade101e597211f539b48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run-pass | |
#![feature(trait_upcasting)] | |
trait Foo: PartialEq<i32> { | |
} | |
trait Bar1: Foo { | |
} | |
trait Bar2: Foo { | |
} | |
trait Baz: Bar1 + Bar2 { | |
} | |
impl Foo for i32 { | |
} | |
impl Bar1 for i32 { | |
} | |
impl Bar2 for i32 { | |
} | |
impl Baz for i32 { | |
} | |
fn main() { | |
let baz: &dyn Baz = &1; | |
let bar1: &dyn Bar1 = baz; | |
if *bar1 != 1 { | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment