-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Do not recover when parsing stmt in cfg-eval. #111054
Conversation
r? @lcnr (rustbot has picked a reviewer for you, use r? to override) |
r? compiler |
@@ -166,7 +166,9 @@ impl CfgEval<'_, '_> { | |||
)) | |||
}, | |||
Annotatable::Stmt(_) => |parser| { | |||
Ok(Annotatable::Stmt(P(parser.parse_stmt(ForceCollect::Yes)?.unwrap()))) | |||
Ok(Annotatable::Stmt(P(parser | |||
.parse_stmt_without_recovery(false, ForceCollect::Yes)? |
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.
Not that familiar with the macro expansion code, so feel free to re-assign.
But I'm wondering why we even get into the expand
call if the parse for the Annotatable
failed in the first place. If I understand this correctly this parse is a re-parse (we also get a duplicated error message in the test). Why can't we prevent this to be called when the first parse failed?
@bors r+ rollup |
Do not recover when parsing stmt in cfg-eval. `parse_stmt` does recovery on its own. When parsing the statement fails, we always get `Ok(None)` instead of an `Err` variant with the diagnostic that we can emit. To avoid this behaviour, we need to opt-out of recovery for cfg_eval. Fixes rust-lang#105228
Rollup of 7 pull requests Successful merges: - rust-lang#110986 (Delay a bug when overwriting fed value.) - rust-lang#111054 (Do not recover when parsing stmt in cfg-eval.) - rust-lang#111685 (Fix typo in bootstrap command description) - rust-lang#111686 (Retire is_foreign_item query.) - rust-lang#111695 (Exclude inherent projections from some alias type `match`es) - rust-lang#111703 (Merge query property modules into one) - rust-lang#111707 (Remove unused `impl<T> WorkerLocal<Vec<T>>`.) r? `@ghost` `@rustbot` modify labels: rollup
parse_stmt
does recovery on its own. When parsing the statement fails, we always getOk(None)
instead of anErr
variant with the diagnostic that we can emit.To avoid this behaviour, we need to opt-out of recovery for cfg_eval.
Fixes #105228