Repository navigation
Stop suggesting missing semicolon with multiline indexing - #161207
Conversation
|
The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease |
|
Failed to set assignee to
|
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @kpreid (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Co-authored-by: Kevin Reid <kpreid@switchb.org>
56927f3 to
1971ad0
Compare
There was a problem hiding this comment.
Thanks, that's definitely an improvement!
I'm not a fan of this (preexisting) diagnostic / error recovery since it's so assertive despite having so many false positives.
This change seems like an improvement to me. I think ideally we would go farther by not making the semicolon suggestion when the expression is parenthesized or otherwise cannot be replaced by two statements, but that’s more work.
Agreed. I've pushed some FIXME comments to the branch (plus a bit of cleanup) outlining some of its issues.
…ion, r=fmease Stop suggesting missing semicolon with multiline indexing Making a change so that when the open bracket is on the same line as the thing being indexed, we don't suggest a semicolon. This does change some existing behaviour though: ``` foo[ 1, 2] ``` Before, this example would recommend `foo;[` and it will now suggest `foo![` which is probably what was intended. r? @kpreid Closes rust-lang#161147
…uwer Rollup of 21 pull requests Successful merges: - #165331 (miri subtree update) - #165356 (portable-simd subtree update) - #162916 (rustdoc: Improve `ItemKind`) - #161035 (Tweak error for stmt macro expansion in expression context) - #163762 (Tweak "value not found" error to show more context when items with the same name are found) - #164155 (Implement `Vec::retain_unstable` ACP) - #164786 (Add regression test for issue 156423) - #165103 (add TrySendError::into_inner) - #157584 (Misc. `fmt_type` cleanups) - #161207 (Stop suggesting missing semicolon with multiline indexing) - #162070 (Add regression test for associated const equality param out of range ICE) - #162537 (Remove outdated windows-gnu test ignores) - #162978 (add regression test for #142717) - #163333 (va_arg: force right-adjust on `aarch64_be`) - #163377 (Avoid ICE when checking casts from function items) - #163399 (Support `cfg_version` in `doc_cfg`) - #165015 (Autolabel library modules) - #165181 (Implement `Duration::display_seconds`) - #165185 (Add codegen test for enumerate index bounds check elimination) - #165193 (Do attribute target checking on parameters with the new system) - #165292 (DropGuard: remove leading newlines from examples)
Rollup merge of #161207 - hu-jeff:fix-comma-indexing-expression, r=fmease Stop suggesting missing semicolon with multiline indexing Making a change so that when the open bracket is on the same line as the thing being indexed, we don't suggest a semicolon. This does change some existing behaviour though: ``` foo[ 1, 2] ``` Before, this example would recommend `foo;[` and it will now suggest `foo![` which is probably what was intended. r? @kpreid Closes #161147
…uwer Rollup of 21 pull requests Successful merges: - rust-lang/rust#165331 (miri subtree update) - rust-lang/rust#165356 (portable-simd subtree update) - rust-lang/rust#162916 (rustdoc: Improve `ItemKind`) - rust-lang/rust#161035 (Tweak error for stmt macro expansion in expression context) - rust-lang/rust#163762 (Tweak "value not found" error to show more context when items with the same name are found) - rust-lang/rust#164155 (Implement `Vec::retain_unstable` ACP) - rust-lang/rust#164786 (Add regression test for issue 156423) - rust-lang/rust#165103 (add TrySendError::into_inner) - rust-lang/rust#157584 (Misc. `fmt_type` cleanups) - rust-lang/rust#161207 (Stop suggesting missing semicolon with multiline indexing) - rust-lang/rust#162070 (Add regression test for associated const equality param out of range ICE) - rust-lang/rust#162537 (Remove outdated windows-gnu test ignores) - rust-lang/rust#162978 (add regression test for rust-lang/rust#142717) - rust-lang/rust#163333 (va_arg: force right-adjust on `aarch64_be`) - rust-lang/rust#163377 (Avoid ICE when checking casts from function items) - rust-lang/rust#163399 (Support `cfg_version` in `doc_cfg`) - rust-lang/rust#165015 (Autolabel library modules) - rust-lang/rust#165181 (Implement `Duration::display_seconds`) - rust-lang/rust#165185 (Add codegen test for enumerate index bounds check elimination) - rust-lang/rust#165193 (Do attribute target checking on parameters with the new system) - rust-lang/rust#165292 (DropGuard: remove leading newlines from examples)
Making a change so that when the open bracket is on the same line as the thing being indexed, we don't suggest a semicolon. This does change some existing behaviour though:
Before, this example would recommend
foo;[and it will now suggestfoo![which is probably what was intended.r? @kpreid
Closes #161147