Uh oh!
There was an error while loading. Please reload this page.
Clean up parse_bottom_expr to use list parsing utility - #64105
Conversation
rust-highfive
commented
Sep 2, 2019
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
rust-highfive
commented
Sep 3, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
There was a problem hiding this comment.
The order matters here. You've changed the parser to accept ( inner_attr* expr_0, ..., expr_n ) to accepting inner_attr* ( expr_0, ..., expr_n ).
To preserve the semantics you'll need to use parse_paren_comma_seq instead and then conditionally do parse_inner_attributes() on the first element. To avoid duplication, you'll also need to refactor the match p.parse_expr() { ... } bit in parse_paren_expr_seq into a different function.
To catch similar mistakes in the future, let's also add a test:
#![feature(stmt_expr_attributes)]fnmain(){let x = #;//~^ ERROR an inner attribute is not permitted in this context}There was a problem hiding this comment.
Ok, I have a test and a proper fix now.
My original refactoring of parse_paren_expr_seq is now unnecessary, and currently just contributes extra noise. I'd like to undo it. But if I back it out locally and force push I believe the current review comments will be lost -- is that ok? Or should I do something else?
There was a problem hiding this comment.
The comments themselves and the code snippet remain, it should be fine.
Centril
commented
Sep 3, 2019
As for the errors about r? @estebank |
bors
commented
Sep 7, 2019
☔ The latest upstream changes (presumably #64264) made this pull request unmergeable. Please resolve the merge conflicts. |
JohnCSimon
commented
Sep 14, 2019
Ping from triage |
achan1989
commented
Sep 16, 2019
I've re-pushed the code that I have so far. The errors about |
rust-highfive
commented
Sep 16, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Alexendoo
commented
Sep 25, 2019
Ping from triage, any updates? @estebank |
estebank
commented
Oct 4, 2019
I haven't had the free time to look at this,. I'll try to make some time this weekend. |
JohnCSimon
commented
Oct 12, 2019
Pinging again from triage - @estebank |
wirelessringo
commented
Oct 18, 2019
Ping from triage. @estebank any updates on this? Thanks. |
Finally took a look at this in a local branch. The new errors in the output are caused by interactions between this change and existing error recovery. |
JohnCSimon
commented
Oct 26, 2019
Ping from triage: |
Pinging again from triage: |
achan1989
commented
Nov 4, 2019
I'll take another look at the Parser, but I'm not super confident that I can make it work. |
JohnCSimon
commented
Nov 9, 2019
Pinging again from triage: |
achan1989
commented
Nov 9, 2019
Have tried to resolve the error recovery issues, but haven't been able to so far. Closing this pull request, will re-open if I manage to fix this. |
refactor expr & stmt parsing + improve recovery
Summary of important changes (best read commit-by-commit, ignoring whitespace changes):
- `AttrVec` is introduces as an alias for `ThinVec<Attribute>`
- `parse_expr_bottom` and `parse_stmt` are thoroughly refactored.
- Extract diagnostics logic for `vec![...]` in a pattern context.
- Recovery is added for `do catch { ... }`
- Recovery is added for `'label: non_block_expr`
- Recovery is added for `var $local`, `auto $local`, and `mut $local`. Fixes#65257.
- Recovery is added for `e1 and e2` and `e1 or e2`.
- ~~`macro_legacy_warnings` is turned into an error (has been a warning for 3 years!)~~
- Fixes#63396 by forward-porting #64105 which now works thanks to added recovery.
- `ui-fulldeps/ast_stmt_expr_attr.rs` is turned into UI and pretty tests.
- Recovery is fixed for `#[attr] if expr {}`
r? @estebank
Fixes#63396