You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Array patterns currently match on either &[T] or [T, ..n]:
let x:&[int] = &[1,2,3];let y:Box<[int]> = box [1,2,3];let z:[int, ..3] = [1,2,3];// Does not workmatch x {&[1,2,3] => {},
_ => {},}// Does not workmatch y {
box [1,2,3] => {},
_ => {},}// Does workmatch z {[1,2,3] => {},
_ => {},}// Does workmatch x {[1,2,3] => {},
_ => {},}
Logically, array patterns should only work on the bare array types, [T, ..n] and [T]. That would mean that all array patterns that match on &[T] would have to be prefixed by &, but it would also allow matching on Box<[T]> (and hypothetically, Rc<[T]>, Arc<[T]> etc. eventually). Has this already been considered (perhaps as part of DST)?
The text was updated successfully, but these errors were encountered:
Array patterns currently match on either
&[T]
or[T, ..n]
:Logically, array patterns should only work on the bare array types,
[T, ..n]
and[T]
. That would mean that all array patterns that match on&[T]
would have to be prefixed by&
, but it would also allow matching onBox<[T]>
(and hypothetically,Rc<[T]>
,Arc<[T]>
etc. eventually). Has this already been considered (perhaps as part of DST)?The text was updated successfully, but these errors were encountered: