Skip to content

Compiler cannot pretty print #12580

Closed
Closed
@mark-christiaens

Description

@mark-christiaens

I'm trying "rustc --pretty typed example.rs > example.typed.rs" and the compiler gives up with "error: internal compiler error: node_id_to_type: no type for node expr 1u (id=23)"

The input program is:

use std::io::BufferedReader;
use std::io::File;
use std::task::try;

fn main() {
let result = try (proc () {
println!("Reading pairs");
let pairs = read_int_pairs();
println!("Printing {} pairs", pairs.len());
for &(a,b) in pairs.iter() {
println!("{:4.4d}, {:4.4d}", a, b);
}
});

if result.is_err() {
println!("parsing failed");
}
}

fn read_int_pairs() -> ~[(int,int)] {
let mut pairs = ~[];
let path = Path::new(&"foo.txt");
let mut reader = BufferedReader::new(File::open(&path));

loop {
let line_err = reader.read_line ();
match line_err {
Ok (line) => {
let fields = line.words().to_owned_vec();
if fields.len () == 2 {
let i1_opt = from_str::(fields[0]);
let i2_opt = from_str::(fields[1]);
match (i1_opt, i2_opt) {
(Some(a), Some(b)) => pairs.push((a,b)),
_ => fail! ()
}
}
}
Err (err) => {
println!("error reading: {}", err);
break;
}
}
}
pairs
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions