Skip to content
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

Merged
merged 1 commit into from
Feb 28, 2022
Merged

Tweak diagnostics #92823

merged 1 commit into from
Feb 28, 2022

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Jan 12, 2022

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 12, 2022
@rust-highfive
Copy link
Collaborator

r? @jackh726

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 12, 2022
@rust-log-analyzer

This comment has been minimized.

|
help: try placing this code inside a block
|
LL | { std::mem::transmute::<f32, u32>(1.0); }
Copy link
Member

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?

Copy link
Contributor Author

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.

@jackh726
Copy link
Member

@bors r+

sorry for the delay here

@bors
Copy link
Contributor

bors commented Feb 25, 2022

📌 Commit 49479b4 has been approved by jackh726

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 25, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 25, 2022
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).
@matthiaskrgr
Copy link
Member

matthiaskrgr commented Feb 25, 2022

@bors r- failed in a rollup

#94383 (comment)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 25, 2022
Comment on lines 3 to 9
#![feature(array_windows)]
#![feature(crate_visibility_modifier)]
#![feature(if_let_guard)]
#![feature(let_else)]
#![feature(box_patterns)]
#![recursion_limit = "256"]

Copy link
Member

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).
@estebank
Copy link
Contributor Author

@bors r=jackh726

@bors
Copy link
Contributor

bors commented Feb 28, 2022

📌 Commit f42b4f5 has been approved by jackh726

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 28, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 28, 2022
…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
@bors bors merged commit a040e2f into rust-lang:master Feb 28, 2022
@rustbot rustbot added this to the 1.61.0 milestone Feb 28, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Nov 7, 2022
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using while if let triggers an error about mismatched curly brackets
8 participants