Skip to content

Commit 1639e51

Browse files
committed
Feature gate *all* slice patterns. #23121
Until some backwards-compatibility hazards are fixed in #23121, these need to be unstable. [breaking-change]
1 parent 199bdcf commit 1639e51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+93
-3
lines changed

src/doc/reference.md

Lines changed: 7 additions & 3 deletions

src/doc/trpl/patterns.md

Lines changed: 1 addition & 0 deletions

src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#![feature(step_by)]
4141
#![feature(str_char)]
4242
#![feature(convert)]
43+
#![feature(slice_patterns)]
4344
#![cfg_attr(test, feature(rand, rustc_private, test, hash, collections))]
4445
#![cfg_attr(test, allow(deprecated))] // rand
4546

src/libcoretest/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#![feature(debug_builders)]
2727
#![feature(unique)]
2828
#![feature(step_by)]
29+
#![feature(slice_patterns)]
2930
#![allow(deprecated)] // rand
3031

3132
extern crate core;

src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#![feature(str_char)]
4646
#![feature(convert)]
4747
#![feature(into_cow)]
48+
#![feature(slice_patterns)]
4849
#![cfg_attr(test, feature(test))]
4950

5051
#![allow(trivial_casts)]

src/librustdoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#![feature(path_ext)]
4040
#![feature(path_relative_from)]
4141
#![feature(convert)]
42+
#![feature(slice_patterns)]
4243

4344
extern crate arena;
4445
extern crate getopts;

src/libstd/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
#![feature(allow_internal_unstable)]
130130
#![feature(str_char)]
131131
#![feature(into_cow)]
132+
#![feature(slice_patterns)]
132133
#![cfg_attr(test, feature(test, rustc_private, std_misc))]
133134

134135
// Don't link to std. We are std.

src/libsyntax/feature_gate.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
153153
// below (it has to be checked before expansion possibly makes
154154
// macros disappear).
155155
("allow_internal_unstable", "1.0.0", Active),
156+
157+
// #23121. Array patterns have some hazards yet.
158+
("slice_patterns", "1.0.0", Active),
156159
];
157160
// (changing above list without updating src/doc/reference.md makes @cmr sad)
158161

@@ -694,6 +697,11 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
694697
but at the end of a slice (e.g. \
695698
`[0, ..xs, 0]` are experimental")
696699
}
700+
ast::PatVec(..) => {
701+
self.gate_feature("slice_patterns",
702+
pattern.span,
703+
"slice pattern syntax is experimental");
704+
}
697705
ast::PatBox(..) => {
698706
self.gate_feature("box_patterns",
699707
pattern.span,

src/libsyntax/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#![feature(str_char)]
4242
#![feature(convert)]
4343
#![feature(into_cow)]
44+
#![feature(slice_patterns)]
4445

4546
extern crate arena;
4647
extern crate fmt_macros;

src/test/auxiliary/roman_numerals.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#![crate_type="dylib"]
1414
#![feature(plugin_registrar, rustc_private)]
15+
#![feature(slice_patterns)]
1516

1617
extern crate syntax;
1718
extern crate rustc;

0 commit comments

Comments
 (0)