Skip to content

Instantly share code, notes, and snippets.

@wilkie
Created May 8, 2013 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wilkie/5537339 to your computer and use it in GitHub Desktop.
Save wilkie/5537339 to your computer and use it in GitHub Desktop.
Compiles to a program that segfaults upon execution.
pub enum Thing {
A(u64),
B(~Foo)
}
pub trait Foo {
fn foo();
}
pub struct Struct {
a: u64
}
impl Foo for Struct {
pub fn foo() {}
}
pub fn new() -> Thing {
B(~Struct{a: 5} as ~Foo)
}
fn main() {
let foo = match new() {
A(a) => 0,
B(b) => 1
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment