-
Notifications
You must be signed in to change notification settings - Fork 924
handle recoverable submod parse errors correctly #4200
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fn foo() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I elected to stash the test files in a new directory under I'm open to another directory name and/or location, but I do think it's important to have negative scenario tests like this to help give us better protection against upstream changes in rustc parsing and prevent any regressions. |
||
if bar && if !baz { | ||
next_is_none = Some(true); | ||
} | ||
println!("foo"); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// rustfmt-recursive: true | ||
mod invalid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this (and the similar change in
parse_mod_items
below) could cause any unintended side effects.The only use case I could think of would be an instance where rustfmt is seeing, and deliberately swallowing, a parser error that the rustc parser was unable to recover from. Since this parsing logic is running on all submods now that the rustc parser doesn't parse out-of-line mods, I went ahead and changed this as I can't think of any reason why we would want to ignore such parsing errors.