-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.
Description
Code
use std::ops::Range;
fn f(r: Range<u32>) {
let start..end = r;
}Current output
error[E0425]: cannot find value `start` in this scope
--> src/lib.rs:4:9
|
4 | let start..end = r;
| ^^^^^ not found in this scope
error[E0425]: cannot find value `end` in this scope
--> src/lib.rs:4:16
|
4 | let start..end = r;
| ^^^ not found in this scopeDesired output
A suggestion for `let Range { start, end } = r`Rationale and extra context
I had a Range and attempted to destructure it using a..b as if it were a shorthand for the struct pattern, forgetting about ranges being special patterns already
Other cases
Rust Version
1.91.1Anything else?
Not sure how common of a mistake this is to make
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.