Should a [..]
slice pattern constitute a discriminant read
#141825
Labels
A-patterns
Relating to patterns and pattern matching
A-slice-patterns
Area: Slice patterns, https://github.com/rust-lang/rust/issues/23121
C-discussion
Category: Discussion or questions that doesn't represent real issues.
I-lang-nominated
Nominated for discussion during a lang team meeting.
P-lang-drag-2
Lang team prioritization drag level 2.https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang.
T-lang
Relevant to the language team
As an unresolved question in the discussion around #138961, it's unclear whether matching
[..]
against a slice should constitute a read of the length (which would behave like a discriminant read), or if it should behave like a wildcard pattern_
.This affects borrow checking and closure captures.
The behavior implemented for closure captures in #138961 is that
[..]
does not read the length. @Nadrieril suggests that it would be more consistent to perform the read regardless.The purpose of this issue is to track the resolution of this spec question and subsequent implementation.
An example program affected by this would be:
The text was updated successfully, but these errors were encountered: