Skip to content
New issue

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

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

Already on GitHub? # to your account

rustc hangs when printing block with no trailing newline #11493

Closed
lilyball opened this issue Jan 12, 2014 · 2 comments · Fixed by #14010
Closed

rustc hangs when printing block with no trailing newline #11493

lilyball opened this issue Jan 12, 2014 · 2 comments · Fixed by #14010
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@lilyball
Copy link
Contributor

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() {
@alexcrichton
Copy link
Member

This appears to have been fixed, flagging as needstest.

richo added a commit to richo/rust that referenced this issue May 7, 2014
@richo
Copy link
Contributor

richo commented May 7, 2014

I had a stab at a testcase for this.

bors added a commit that referenced this issue May 9, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 16, 2023
move `suspicious_doc_comments` to doc pass

This was my first lint. I've been meaning to move it over to `doc.rs` since that's a better place.
There weren't any changes made to the lint logic itself.

I guess this can be considered part of rust-lang#11493

changelog: none
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants