-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Confusing error now saying let (not if let) is an expression, rather than a statement, which contradicts the book #65254
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.F-let_chains`#![feature(let_chains)]``#![feature(let_chains)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.F-let_chains`#![feature(let_chains)]``#![feature(let_chains)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
cc @Centril
Code first. This code:
on current stable Rust 1.38, gives this set of error messages:
The part that I'm most concerned about is:
Before eRFC "if- and while-let-chains, take 2" (rust-lang/rfcs#2497, #53667, #53668), this code USED to result in this error message:
The reason I know this is because we have the old error message in the book, in the section where we're trying to explain the difference between statements and expressions. The error message I'm seeing now is muddying the waters by saying "
letexpressions".Based on my reading of the eRFC, it's only supposed to change
if let, but as kind of a side effectletis now sort-of an expression? The updates to the reference don't clear it up for me, as they only describeif let, not plainlets.What I expected is that even though the eRFC has been accepted and implemented, plain
let y = 6would still be considered a statement and the error message wouldn't talk about "letexpressions".If my expectation is valid, then the compiler error message is a bug. If my expectation is invalid, please let me know so that I can work on updating the book. Thanks!
This issue has been assigned to @jafern14 via this comment.