Skip to content

Compiler cannot pretty print #12580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mark-christiaens opened this issue Feb 26, 2014 · 3 comments
Closed

Compiler cannot pretty print #12580

mark-christiaens opened this issue Feb 26, 2014 · 3 comments

Comments

@mark-christiaens
Copy link

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
}

@mark-christiaens
Copy link
Author

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.

8786405

@klutzy
Copy link
Contributor

klutzy commented May 30, 2014

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

@lilyball
Copy link
Contributor

This is indeed a dupe.

bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
internal: Move more things out of `CompletionContext::function_def` into more specific parts
flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 4, 2024
fix [`manual_unwrap_or_default`] suggestion ignoring side-effects

fixes: rust-lang#12569
closes: rust-lang#12580

change applicability to `MaybeIncorrect` base on suggestion in [this zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/.60manual_unwrap_or_default.60.20suggestion.20removes.20comments)

---

changelog: fix [`manual_unwrap_or_default`] suggestion ignoring side-effects, and adjust its applicability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants