Skip to content

Instantly share code, notes, and snippets.

@zokier
Last active December 25, 2015 12:59
Show Gist options
  • Save zokier/6980278 to your computer and use it in GitHub Desktop.
Save zokier/6980278 to your computer and use it in GitHub Desktop.
trait Foo {}
struct Bar;
impl Foo for Bar {}
fn main() {
let a: @Foo = @Bar as @Foo;
let b = a as @Bar;
}
$ rustc non-scalar_cast.rs
non-scalar_cast.rs:9:12: 9:21 error: non-scalar cast: `@Foo:'static` as `@Bar`
non-scalar_cast.rs:9 let b = a as @Bar;
^~~~~~~~~
error: aborting due to previous error
task '<unnamed>' failed at 'explicit failure', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:98
task '<unnamed>' failed at 'explicit failure', /build/rust-git/src/rust/src/librustc/rustc.rs:391
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment