Skip to content

Commit

Permalink
stabilize slice_patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Jan 18, 2020
1 parent 35b5157 commit c41443a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
21 changes: 0 additions & 21 deletions src/librustc_ast_passes/feature_gate.rs
Expand Up @@ -470,29 +470,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
visit::walk_expr(self, e)
}

fn visit_arm(&mut self, arm: &'a ast::Arm) {
visit::walk_arm(self, arm)
}

fn visit_pat(&mut self, pattern: &'a ast::Pat) {
match &pattern.kind {
PatKind::Slice(pats) => {
for pat in &*pats {
let span = pat.span;
let inner_pat = match &pat.kind {
PatKind::Ident(.., Some(pat)) => pat,
_ => pat,
};
if inner_pat.is_rest() {
gate_feature_post!(
&self,
slice_patterns,
span,
"subslice patterns are unstable"
);
}
}
}
PatKind::Box(..) => {
gate_feature_post!(
&self,
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_feature/accepted.rs
Expand Up @@ -257,6 +257,8 @@ declare_features! (
/// Allows relaxing the coherence rules such that
/// `impl<T> ForeignTrait<LocalType> for ForeignType<T>` is permitted.
(accepted, re_rebalance_coherence, "1.41.0", Some(55437), None),
/// Allows using subslice patterns, `[a, .., b]` and `[a, xs @ .., b]`.
(accepted, slice_patterns, "1.42.0", Some(62254), None),

// -------------------------------------------------------------------------
// feature-group-end: accepted features
Expand Down
3 changes: 0 additions & 3 deletions src/librustc_feature/active.rs
Expand Up @@ -262,9 +262,6 @@ declare_features! (
/// Allows using non lexical lifetimes (RFC 2094).
(active, nll, "1.0.0", Some(43234), None),

/// Allows using slice patterns.
(active, slice_patterns, "1.0.0", Some(62254), None),

/// Allows the definition of `const` functions with some advanced features.
(active, const_fn, "1.2.0", Some(57563), None),

Expand Down

0 comments on commit c41443a

Please sign in to comment.