Skip to content

Instantly share code, notes, and snippets.

@erickt
Created April 20, 2012 06:12
Show Gist options
  • Save erickt/2426493 to your computer and use it in GitHub Desktop.
Save erickt/2426493 to your computer and use it in GitHub Desktop.
#[link(name = "a", vers = "0.1")];
#[crate_type = "lib"];
use std;
import std::map::{hashmap, str_hash};
enum t {
nil,
vec([t]),
map(hashmap<str, t>),
}
iface to_a {
fn to_a() -> t;
}
impl of to_a for str {
fn to_a() -> t { nil }
}
impl <T:to_a> of to_a for [T] {
fn to_a() -> t { nil }
}
impl <T:to_a copy> of to_a for hashmap<str, T> {
fn to_a() -> t {
let m = str_hash();
self.items { |k, v| m.insert(k, v.to_a()); }
map(m)
}
}
use std;
use a;
import std::map::{hashmap, str_hash};
import a::to_a;
fn main() {
let m: hashmap<str, [str]> = str_hash();
m.insert("", []);
m.to_a();
}
./run-rustc a.rs
warning: no debug symbols in executable (-arch x86_64)
./run-rustc b.rs
rust: upcall fail 'Assertion start <= end failed', ../src/rustc/rustc.rc:1
error: internal compiler error unexpected failure
note: The compiler hit an unexpected failure path. This is a bug. Try running with RUST_LOG=rustc=0,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: upcall fail 'explicit failure', ../src/rustc/driver/rustc.rs:190
rust: domain main @0x102829810 root task failed
leaked memory in rust main loop (1 objects)
Assertion failed: (false), function ~memory_region, file ../src/rt/memory_region.cpp, line 172.
make: *** [all] Abort trap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment