Closed
Description
I'm running on a Mac, using a checkout of the github sources. I run this command:
RUST_LOG=rustc=1,::rt::backtrace ./inst/bin/rust run ~/Desktop/sample.rs
I get this error message:
task <unnamed> failed at 'assertion failed: !is_undef(wrapped)', /Users/cce/git/rust/src/librustc/middle/trans/adt.rs:562
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
task <unnamed> failed at 'explicit failure', /Users/cce/git/rust/src/librustc/rustc.rs:371
And the rest is the contents of ~/Desktop/sample.rs:
enum Sexp {
List(Sexp_List),
Number(int),
String(@str)
}
enum Sexp_List {
Null,
Cons{head:@Sexp,tail:@Sexp_List}
}
fn main () {
write_sexp( l(cons(n(1), cons(s(@"two"), null))) );
println("");
}
fn n(i:int) -> Sexp {Number(i)}
fn s(t:@str) -> Sexp {String(t)}
fn l(s:Sexp_List) -> Sexp{List(s)}
fn cons(x:Sexp, y:Sexp_List) -> Sexp_List {Cons{ head: @x, tail: @y }}
static null : Sexp_List = Null;
fn write_sexp (sexp : Sexp) {
match sexp {
List(list) => write_list(list),
Number(num) => print(std::int::to_str(num)),
String(st) => print(st),
}
}
fn write_list (list : Sexp_List) {
match list {
Null => print ("()"),
Cons{ head: hd, tail: tl } => {
print("(");
write_sexp(*hd);
let mut rest = tl;
loop {
match *rest {
Null => { break; }
Cons{ head: hd2, tail: tl2 } => {
print(" ");
write_sexp(*hd2);
rest = tl2;
loop;
}
}
}
print(")");
}
}
}