Closed
Description
If rustc attempts to print an error message for a block that has no trailing newline, because it ends on the very last line of a file with no trailing newline, then rustc will hang forever attempting to print the block.
To test, the following code should print a lifetime error:
fn main() {
let x = Some(3);
let y = x.as_ref().unwrap_or(&5);
}
If the file has a trailing newline, it prints just fine. But without the trailing newline, it hangs forever after printing:
foo.rs:3:34: 3:36 error: borrowed value does not live long enough
foo.rs:3 let y = x.as_ref().unwrap_or(&5);
^~
foo.rs:1:11: 1:1 note: reference must be valid for the block at 1:10...
foo.rs:1 fn main() {