Uh oh!
There was an error while loading. Please reload this page.
Fix parsing of erroneously placed semicolons - #125276
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
gurry
commented
May 20, 2024
Don't worry and welome to rustc :) |
| break; | ||
| }; | ||
| items.push(item); | ||
| last = items.last().map(|x| &**x); |
There was a problem hiding this comment.
A ref on top of a deref seems redundant. Maybe replace &**x with just *x
There was a problem hiding this comment.
Reborrowing to convert the Option<&P<Item>> into an Option<&Item>. as_deref doesn't work here.
| while let Some(item) = self.parse_item(ForceCollect::No)? { | ||
| self.maybe_consume_incorrect_semicolon(Some(&item)); | ||
| // There shouldn't be any semicolons before or afer items. |
There was a problem hiding this comment.
| // There shouldn't be any semicolons before or afer items. | |
| // There shouldn't be any stray semicolons before or afer items. |
| // `parse_item` consumes the appropriate semicolons so any leftover is an error. | ||
| let mut last = None; | ||
| loop { | ||
| while self.maybe_consume_incorrect_semicolon(last) {} // Eat all bad semicolons |
There was a problem hiding this comment.
Can't we just do the following and remove the local binding last outright?
| whileself.maybe_consume_incorrect_semicolon(last){}// Eat all bad semicolons | |
| whileself.maybe_consume_incorrect_semicolon(items.last().as_deref()){}// Eat all bad semicolons |
oriongonza
commented
May 20, 2024
@rustbot ready |
oriongonza
commented
May 20, 2024
@rustbot ready |
fmease
commented
May 21, 2024
@bors r+ rollup |
bors
commented
May 21, 2024
Fix parsing of erroneously placed semicolons This closesrust-lang#124935, is a continuation of rust-lang#125245 after rebasing rust-lang#125117. Thanks `@gurry` for your code and sorry for making it confusing :P r? fmease
Fix parsing of erroneously placed semicolons This closesrust-lang#124935, is a continuation of rust-lang#125245 after rebasing rust-lang#125117. Thanks ``@gurry`` for your code and sorry for making it confusing :P r? fmease
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#122665 (Add some tests for public-private dependencies.) - rust-lang#123122 (Fix incorrect suggestion for undeclared hrtb lifetimes in where clauses.) - rust-lang#125276 (Fix parsing of erroneously placed semicolons) - rust-lang#125310 (Move ~100 tests from tests/ui to subdirs) - rust-lang#125357 (Migrate `run-make/rustdoc-scrape-examples-multiple` to `rmake.rs`) - rust-lang#125369 (Don't do cc detection for synthetic targets) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#123122 (Fix incorrect suggestion for undeclared hrtb lifetimes in where clauses.) - rust-lang#123492 (add pull request template asking for relevant tracking issues) - rust-lang#125276 (Fix parsing of erroneously placed semicolons) - rust-lang#125310 (Move ~100 tests from tests/ui to subdirs) - rust-lang#125357 (Migrate `run-make/rustdoc-scrape-examples-multiple` to `rmake.rs`) - rust-lang#125369 (Don't do cc detection for synthetic targets) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#125276 - dev-ardi:no-main-diag, r=fmease Fix parsing of erroneously placed semicolons This closesrust-lang#124935, is a continuation of rust-lang#125245 after rebasing rust-lang#125117. Thanks ```@gurry``` for your code and sorry for making it confusing :P r? fmease
This closes#124935, is a continuation of #125245 after rebasing #125117.
Thanks @gurry for your code and sorry for making it confusing :P
r? fmease