Skip to content

Commit 12250a2

Browse files
committed
Adjust feature gating of subslice patterns accordingly.
1 parent 633c997 commit 12250a2

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/libsyntax/feature_gate.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,11 +2151,23 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
21512151
}
21522152

21532153
fn visit_pat(&mut self, pattern: &'a ast::Pat) {
2154-
match pattern.node {
2155-
PatKind::Slice(_, Some(ref subslice), _) => {
2156-
gate_feature_post!(&self, slice_patterns,
2157-
subslice.span,
2158-
"syntax for subslices in slice patterns is not yet stabilized");
2154+
match &pattern.node {
2155+
PatKind::Slice(pats) => {
2156+
for pat in &*pats {
2157+
let span = pat.span;
2158+
let inner_pat = match &pat.node {
2159+
PatKind::Ident(.., Some(pat)) => pat,
2160+
_ => pat,
2161+
};
2162+
if inner_pat.is_rest() {
2163+
gate_feature_post!(
2164+
&self,
2165+
slice_patterns,
2166+
span,
2167+
"subslice patterns are unstable"
2168+
);
2169+
}
2170+
}
21592171
}
21602172
PatKind::Box(..) => {
21612173
gate_feature_post!(&self, box_patterns,

0 commit comments

Comments
 (0)