Skip to content

Instantly share code, notes, and snippets.

@agrif
Created December 7, 2013 03:23
Show Gist options
  • Select an option

  • Save agrif/7836892 to your computer and use it in GitHub Desktop.

Select an option

Save agrif/7836892 to your computer and use it in GitHub Desktop.
enum Expression {
Symbol(~str),
Compound(~str, ~[Expression])
}
fn standard_form(expr: &Expression) -> ~str {
match (*expr) {
Compound(~"List", ref items) => ~"list",
Compound(~"Blank", []) => ~"_",
_ => ~"default"
}
}
fn main() {
let x = ~Symbol(~"x");
println(standard_form(x));
}
// error: internal compiler error: sequence_element_type called on non-sequence value
// This message reflects a bug in the Rust compiler.
// We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
// task 'rustc' failed at 'explicit failure', /var/tmp/portage/dev-lang/rust-9999/work/rust-9999/src/libsyntax/diagnostic.rs:102
// task '<main>' failed at 'explicit failure', /var/tmp/portage/dev-lang/rust-9999/work/rust-9999/src/librustc/lib.rs:394
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment