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

Deduplicate diagnostics in if-without-else-as-fn-expr.rs #60254

Closed
Tracked by #53667
Centril opened this issue Apr 25, 2019 · 0 comments · Fixed by #64049
Closed
Tracked by #53667

Deduplicate diagnostics in if-without-else-as-fn-expr.rs #60254

Centril opened this issue Apr 25, 2019 · 0 comments · Fixed by #64049
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints F-let_chains `#![feature(let_chains)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Centril
Copy link
Contributor

Centril commented Apr 25, 2019

#59288 introduces some duplicates in diagnostics in if-without-else-as-fn-expr.rs. Specifically, you have e.g.:

error[E0308]: mismatched types
  --> $DIR/if-without-else-as-fn-expr.rs:35:20
   |
LL |       let x: usize = if let 0 = 1 {
   |  ____________________^
LL | |         return 3;
LL | |     };
   | |_____^ expected usize, found ()
   |
   = note: expected type `usize`
              found type `()`

error[E0317]: if may be missing an else clause
  --> $DIR/if-without-else-as-fn-expr.rs:35:20
   |
LL |       let x: usize = if let 0 = 1 {
   |  _________-__________^
   | |         |
   | |         expected because of this assignment
LL | |         return 3;
LL | |     };
   | |_____^ expected usize, found ()
   |
   = note: expected type `usize`
              found type `()`
   = note: `if` expressions without `else` evaluate to `()`
   = help: consider adding an `else` block that evaluates to the expected type

We want to get rid of the first one since the second is better...

...but this is not done in #59288 since I wanted to avoid too many temporary changes for diagnostics that may get obsoleted quickly.

@Centril Centril added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 25, 2019
@Centril Centril self-assigned this Apr 25, 2019
Centril added a commit to Centril/rust that referenced this issue Sep 1, 2019
Emit a single error on if expr with expectation and no else clause

Fix rust-lang#60254.

r? @Centril
bors added a commit that referenced this issue Sep 2, 2019
Emit a single error on if expr with expectation and no else clause

Fix #60254.

r? @Centril
Centril added a commit to Centril/rust that referenced this issue Sep 3, 2019
Emit a single error on if expr with expectation and no else clause

Fix rust-lang#60254.

r? @Centril
Centril added a commit to Centril/rust that referenced this issue Sep 3, 2019
Emit a single error on if expr with expectation and no else clause

Fix rust-lang#60254.

r? @Centril
@bors bors closed this as completed in 4245be7 Sep 3, 2019
@Centril Centril added the F-let_chains `#![feature(let_chains)]` label Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints F-let_chains `#![feature(let_chains)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant