Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created November 14, 2019 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikomatsakis/cfa4a3bf7e04ade101e597211f539b48 to your computer and use it in GitHub Desktop.
Save nikomatsakis/cfa4a3bf7e04ade101e597211f539b48 to your computer and use it in GitHub Desktop.
// 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