Issue 1:
Hi

I am currently writing a pretty simple implementation of a binary tree and appear to have stumbled upon an internal compiler error that only occurs when compiling with the debugInfo (-g) flag the compiler insisted i report it. :)

p.s. I am running under windows 7 on a 32 bit machine

heres the compiler output

task 'rustc' failed at 'Box<Any>', C:\bot\slave\nightly-win\build\src\libsyntax\diagnostic.rs:162

2.rs:19 let tree = Branch(20,box Branch(5,box Leaf(2),box Leaf(9)),box Branch(40, box Leaf(35),box Null));
^~~~
hello2.rs:46:1: 53:2 warning: code is never used: `areListsEqual`, #[warn(dead_code)] on by default
hello2.rs:46 fn areListsEqual<T: PartialEq>(xs: &List<T>, ys: &List<T>) -> bool{
hello2.rs:47 match (xs,ys) {
hello2.rs:48 (&Nil,&Nil) => true,
hello2.rs:49 (&Cons(ref x,box ref nextXs),&Cons(ref y,box ref nextYs)) if x == y =>
hello2.rs:50 areListsEqual(nextXs,nextYs),
hello2.rs:51 _ => false
...
hello2.rs:46:1: 53:2 warning: function `areListsEqual` should have a snake case name such as `are_lists_equal`, #[warn(non_snake_case_functions)] on by default
hello2.rs:46 fn areListsEqual<T: PartialEq>(xs: &List<T>, ys: &List<T>) -> bool{
hello2.rs:47 match (xs,ys) {
hello2.rs:48 (&Nil,&Nil) => true,
hello2.rs:49 (&Cons(ref x,box ref nextXs),&Cons(ref y,box ref nextYs)) if x == y =>
hello2.rs:50 areListsEqual(nextXs,nextYs),
hello2.rs:51 _ => false
...
hello2.rs:55:1: 57:2 warning: code is never used: `prependList`, #[warn(dead_code)] on by default
hello2.rs:55 fn prependList<T> (xs: List<T>, v: T) -> List<T>{
hello2.rs:56 Cons(v, box xs)
hello2.rs:57 }
hello2.rs:55:1: 57:2 warning: function `prependList` should have a snake case name such as `prepend_list`, #[warn(non_snake_case_functions)] on by default
hello2.rs:55 fn prependList<T> (xs: List<T>, v: T) -> List<T>{
hello2.rs:56 Cons(v, box xs)
hello2.rs:57 }
hello2.rs:59:1: 61:2 warning: code is never used: `scaleVector`, #[warn(dead_code)] on by default
hello2.rs:59 fn scaleVector(scale: int,xs: Vec<int>) -> Vec<int> {
hello2.rs:60 xs.move_iter().map(|i| i + scale).collect()
hello2.rs:61 }
hello2.rs:59:1: 61:2 warning: function `scaleVector` should have a snake case name such as `scale_vector`, #[warn(non_snake_case_functions)] on by default
hello2.rs:59 fn scaleVector(scale: int,xs: Vec<int>) -> Vec<int> {
hello2.rs:60 xs.move_iter().map(|i| i + scale).collect()
hello2.rs:61 }
hello2.rs:63:1: 85:2 warning: function `createBinarySearchTree` should have a snake case name such as `create_binary_search_tree`, #[warn(non_snake_case_functions)] on by default
hello2.rs:63 fn createBinarySearchTree(vector : Vec<int>) -> BinaryTree<int>{
hello2.rs:64
hello2.rs:65 fn placeNode(val: int, btree: &mut BinaryTree<int>) -> BinaryTree<int> {
hello2.rs:66 match btree {
hello2.rs:67 &Leaf(tval) if val > tval => Branch(tval,box Null,box Leaf(val)),
hello2.rs:68 &Leaf(tval) if val < tval => Branch(tval,box Leaf(val),box Null),
...
hello2.rs:69:21: 69:29 warning: unused variable: `left`, #[warn(unused_variable)] on by default
hello2.rs:69 &Branch(tval,box ref left,box ref mut right) if val > tval => placeNode(val,right) ,
^~~~~~~~
hello2.rs:70:38: 70:47 warning: unused variable: `right`, #[warn(unused_variable)] on by default
hello2.rs:70 &Branch(tval,box ref mut left,box ref right) if val < tval => placeNode(val,left),
^~~~~~~~~
hello2.rs:73:21: 73:29 warning: unused variable: `left`, #[warn(unused_variable)] on by default
hello2.rs:73 &Branch(lval,box ref left,box ref right) if val == lval => fail!("already has a node with {}",lval),
^~~~~~~~
hello2.rs:73:34: 73:43 warning: unused variable: `right`, #[warn(unused_variable)] on by default
hello2.rs:73 &Branch(lval,box ref left,box ref right) if val == lval => fail!("already has a node with {}",lval),
^~~~~~~~~
hello2.rs:65:2: 76:3 warning: function `placeNode` should have a snake case name such as `place_node`, #[warn(non_snake_case_functions)] on by default
hello2.rs:65 fn placeNode(val: int, btree: &mut BinaryTree<int>) -> BinaryTree<int> {
hello2.rs:66 match btree {
hello2.rs:67 &Leaf(tval) if val > tval => Branch(tval,box Null,box Leaf(val)),
hello2.rs:68 &Leaf(tval) if val < tval => Branch(tval,box Leaf(val),box Null),
hello2.rs:69 &Branch(tval,box ref left,box ref mut right) if val > tval => placeNode(val,right) ,
hello2.rs:70 &Branch(tval,box ref mut left,box ref right) if val < tval => placeNode(val,left),
...
hello2.rs:87:1: 101:2 warning: function `printTree` should have a snake case name such as `print_tree`, #[warn(non_snake_case_functions)] on by default
hello2.rs:87 fn printTree(tree : &BinaryTree<int>){
hello2.rs:88 fn innerPrint(foreword : &str,tree : &BinaryTree<int>, level : int) {
hello2.rs:89 let lvDesc = format!("lv {}",level);
hello2.rs:90 match tree{
hello2.rs:91 &Leaf(val) => println!("{}-{} leaf: {}",lvDesc,foreword,val),
hello2.rs:92 &Branch(val,box ref left, box ref right) => {
...
hello2.rs:88:2: 99:3 warning: function `innerPrint` should have a snake case name such as `inner_print`, #[warn(non_snake_case_functions)] on by default
hello2.rs:88 fn innerPrint(foreword : &str,tree : &BinaryTree<int>, level : int) {
hello2.rs:89 let lvDesc = format!("lv {}",level);
hello2.rs:90 match tree{
hello2.rs:91 &Leaf(val) => println!("{}-{} leaf: {}",lvDesc,foreword,val),
hello2.rs:92 &Branch(val,box ref left, box ref right) => {
hello2.rs:93 println!("{}-{} node: {}",lvDesc,foreword,val);
...
hello2.rs:103:1: 107:2 warning: code is never used: `displayVector`, #[warn(dead_code)] on by default
hello2.rs:103 fn displayVector(vector: Vec<int>){
hello2.rs:104 for v in vector.iter() {
hello2.rs:105 println!("{}",v)
hello2.rs:106 }
hello2.rs:107 }
hello2.rs:103:1: 107:2 warning: function `displayVector` should have a snake case name such as `display_vector`, #[warn(non_snake_case_functions)] on by default
hello2.rs:103 fn displayVector(vector: Vec<int>){
hello2.rs:104 for v in vector.iter() {
hello2.rs:105 println!("{}",v)
hello2.rs:106 }
hello2.rs:107 }
hello2.rs:109:1: 117:2 warning: code is never used: `displayList`, #[warn(dead_code)] on by default
hello2.rs:109 fn displayList<int> (xs: &List<int>){
hello2.rs:110 match xs{
hello2.rs:111 &Cons(v,box ref rest) => {
hello2.rs:112 println!("{}",v);
hello2.rs:113 displayList::<int>(rest)
hello2.rs:114 },
...
hello2.rs:109:1: 117:2 warning: function `displayList` should have a snake case name such as `display_list`, #[warn(non_snake_case_functions)] on by default
hello2.rs:109 fn displayList<int> (xs: &List<int>){
hello2.rs:110 match xs{
hello2.rs:111 &Cons(v,box ref rest) => {
hello2.rs:112 println!("{}",v);
hello2.rs:113 displayList::<int>(rest)
hello2.rs:114 },
...
error: internal compiler error: Type metadata for unique id '{&{&[]{struct d517309cb671f9ac/2157e}}}' is already in the TypeMap!
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace

Issue 2:
Compiling libcore with -g leads to the following error:

error: internal compiler error: Type metadata for ty::t '&[core::fmt::rt::Piece<>]' is already in the TypeMap!

This is due to the vec slice in question occurring multiple times along a type reference chain and the code path for vec slices doesn't take that possibility into account. This is also a potential problem for other kinds of types, e.g. fixed length vector types or function types. For regular pointer types this is already handled correctly.