-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Tweak diagnostics #92823
Tweak diagnostics #92823
Conversation
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
| | ||
help: try placing this code inside a block | ||
| | ||
LL | { std::mem::transmute::<f32, u32>(1.0); } |
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.
Does this work with multiple statements too?
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.
It should be working with multiple statements, yes, but because of the way it does so I'm sure we can come up with cases where the recovery doesn't work as good as we'd want when multiple places where the block could be closed.
@bors r+ sorry for the delay here |
📌 Commit 49479b4 has been approved by |
Tweak diagnostics * Recover from invalid `'label: ` before block. * Make suggestion to enclose statements in a block multipart. * Point at `match`, `while`, `loop` and `unsafe` keywords when failing to parse their expression. (Fix rust-lang#92705.) * Do not suggest `{ ; }`. * Do not suggest `|` when very unlikely to be what was wanted (in `let` statements).
@bors r- failed in a rollup |
compiler/rustc_parse/src/lib.rs
Outdated
#![feature(array_windows)] | ||
#![feature(crate_visibility_modifier)] | ||
#![feature(if_let_guard)] | ||
#![feature(let_else)] | ||
#![feature(box_patterns)] | ||
#![recursion_limit = "256"] | ||
|
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.
the let_else feature is already declared when bors rebases the PR before merge.
* Recover from invalid `'label: ` before block. * Make suggestion to enclose statements in a block multipart. * Point at `match`, `while`, `loop` and `unsafe` keywords when failing to parse their expression. * Do not suggest `{ ; }`. * Do not suggest `|` when very unlikely to be what was wanted (in `let` statements).
@bors r=jackh726 |
📌 Commit f42b4f5 has been approved by |
…askrgr Rollup of 6 pull requests Successful merges: - rust-lang#92399 (fix typo in btree/vec doc: Self -> self) - rust-lang#92823 (Tweak diagnostics) - rust-lang#94248 (Fix ICE when passing block to while-loop condition) - rust-lang#94414 (Fix ICE when using Box<T, A> with large A) - rust-lang#94445 (4 - Make more use of `let_chains`) - rust-lang#94449 (Add long explanation for E0726) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…ould-not-have-label, r=lcnr Don't silently eat label before block in block-like expr Fixes rust-lang#103983 cc rust-lang#92823 (where the regression was introduced)
'label:
before block.match
,while
,loop
andunsafe
keywords when failingto parse their expression. (Fix Using
while if let
triggers an error about mismatched curly brackets #92705.){ ; }
.|
when very unlikely to be what was wanted (inlet
statements).