-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
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() {
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.