Compiler cannot pretty print

c1dc31e
Opened by Mark Christiaens at 2014-07-17 22:47:42

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::<int>(fields[0]); let i2_opt = from_str::<int>(fields[1]); match (i1_opt, i2_opt) { (Some(a), Some(b)) => pairs.push((a,b)), _ => fail! () } } } Err (err) => { println!("error reading: {}", err); break; } } } pairs }

  1. I'm using a build from the master branch:

    rustc --version rustc 0.10-pre (8786405 2014-02-23 03:36:56 -0800) host: x86_64-unknown-linux-gnu

    Built from rev.

    8786405047cadcfb5ec3a2d711ca264d74843c13

    Mark Christiaens at 2014-02-26 22:27:04

  2. Seems like dup of #7754. (println! generates fixed-length arrays which currently cause errors with --pretty typed.)

    klutzy/defunct at 2014-05-30 12:01:46

  3. This is indeed a dupe.

    Lily Ballard at 2014-07-17 22:47:42