Suggest if-let chain continuation on unclosed delimiter - #160592
Conversation
|
The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease |
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @JohnTitor (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 (
Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
87cc2ee to
68e51b9
Compare
This comment has been minimized.
This comment has been minimized.
68e51b9 to
39b3ad8
Compare
|
I seriously thought getting something working was going to be more complex than this ^_^' We'd want to add some complexity later to better customize the message (there are some cases where this wasn't a let chain), but I'm ok with this for now. @bors r+ |
…im-hint, r=estebank Suggest if-let chain continuation on unclosed delimiter Meant to fix rust-lang#160550. When an unclosed brace-delimited block begins with && or ||, the "unclosed delimiter" error now points at that line, suggesting the user may have meant to continue an if-let chain. - Records the leading `&&`/`||` span during lexing (in lex_token_tree_open_delim) and surfaces it in report_suspicious_mismatch_block. - Adds a `tests/ui/parser` regression test.
…im-hint, r=estebank Suggest if-let chain continuation on unclosed delimiter Meant to fix rust-lang#160550. When an unclosed brace-delimited block begins with && or ||, the "unclosed delimiter" error now points at that line, suggesting the user may have meant to continue an if-let chain. - Records the leading `&&`/`||` span during lexing (in lex_token_tree_open_delim) and surfaces it in report_suspicious_mismatch_block. - Adds a `tests/ui/parser` regression test.
…im-hint, r=estebank Suggest if-let chain continuation on unclosed delimiter Meant to fix rust-lang#160550. When an unclosed brace-delimited block begins with && or ||, the "unclosed delimiter" error now points at that line, suggesting the user may have meant to continue an if-let chain. - Records the leading `&&`/`||` span during lexing (in lex_token_tree_open_delim) and surfaces it in report_suspicious_mismatch_block. - Adds a `tests/ui/parser` regression test.
@estebank Hehe, thanks for the approval. This is my first PR. It did take me a while to come up with this, and I realise the messages need more fine-tuning for certain cases, as you mentioned. But I'm glad it's up to satisfaction. Happy to contribute the new customisations as well, just let me know what you'd like. |
…im-hint, r=estebank Suggest if-let chain continuation on unclosed delimiter Meant to fix rust-lang#160550. When an unclosed brace-delimited block begins with && or ||, the "unclosed delimiter" error now points at that line, suggesting the user may have meant to continue an if-let chain. - Records the leading `&&`/`||` span during lexing (in lex_token_tree_open_delim) and surfaces it in report_suspicious_mismatch_block. - Adds a `tests/ui/parser` regression test.
…uwer Rollup of 17 pull requests Successful merges: - #159530 (Cap socket send length to c_int::MAX on Apple targets) - #159506 (Allow associated const equality constraints with GCA) - #160006 (Account for desugaring in method call move errors) - #160415 (Split `aarch64-apple{,-macos-26}` => `aarch64-apple{,-macos-26}-{1,2}` jobs) - #160464 (fix: Check the fallback map before queueing child in `visible_parent_map` breadth-first search) - #160555 (Split `apply_primary_terminator_effect`) - #160592 (Suggest if-let chain continuation on unclosed delimiter) - #160600 (Avoid the std DLL copy alongside rustc) - #160156 (check_consts: exhaustively match on CastKind) - #160211 (Rename `#[unroll]` => `#[rustc_unroll]` to mitigate nameres ambiguity) - #160304 (Add tests for fixed new solver issues) - #160398 (rustc_abi: Add `LayoutData::is_variant_uninhabited` method) - #160546 (Update error message in documentation comments) - #160568 (Use `VisitorResult` helper macros) - #160571 (Add regression test for array type recovery in generic arguments) - #160588 (add a test showing polonius alpha is not a subset of datalog polonius) - #160617 (Add a suggestion to MissingUnsafeOnExtern diagnostic)
Rollup merge of #160592 - Diacod-I:if-let-chain-unclosed-delim-hint, r=estebank Suggest if-let chain continuation on unclosed delimiter Meant to fix #160550. When an unclosed brace-delimited block begins with && or ||, the "unclosed delimiter" error now points at that line, suggesting the user may have meant to continue an if-let chain. - Records the leading `&&`/`||` span during lexing (in lex_token_tree_open_delim) and surfaces it in report_suspicious_mismatch_block. - Adds a `tests/ui/parser` regression test.
|
@rust-timer build 406d594 |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (406d594): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.2%, secondary -2.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 458.35s -> 460.343s (0.43%) |
Meant to fix #160550. When an unclosed brace-delimited block begins with && or ||, the "unclosed delimiter" error now points at that line, suggesting the user may have meant to continue an if-let chain.
&&/||span during lexing (in lex_token_tree_open_delim) and surfaces it in report_suspicious_mismatch_block.tests/ui/parserregression test.