Skip to content

Commit 722c687

Browse files
authored
Auto merge of #36843 - petrochenkov:dotstab, r=nikomatsakis
Stabilize `..` in tuple (struct) patterns I'd like to nominate `..` in tuple and tuple struct patterns for stabilization. This feature is a relatively small extension to existing stable functionality and doesn't have known blockers. The feature first appeared in Rust 1.10 6 months ago. An example of use: #36203 Closes #33627 r? @nikomatsakis
2 parents 57f971b + 74bb594 commit 722c687

File tree

33 files changed

+20
-73
lines changed

33 files changed

+20
-73
lines changed

src/doc/reference.md

-2
Original file line numberDiff line numberDiff line change
@@ -2479,8 +2479,6 @@ The currently implemented features of the reference compiler are:
24792479
* - `abi_vectorcall` - Allows the usage of the vectorcall calling convention
24802480
(e.g. `extern "vectorcall" func fn_();`)
24812481

2482-
* - `dotdot_in_tuple_patterns` - Allows `..` in tuple (struct) patterns.
2483-
24842482
* - `abi_sysv64` - Allows the usage of the system V AMD64 calling convention
24852483
(e.g. `extern "sysv64" func fn_();`)
24862484

src/librustc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#![feature(conservative_impl_trait)]
3232
#![feature(const_fn)]
3333
#![feature(core_intrinsics)]
34-
#![feature(dotdot_in_tuple_patterns)]
34+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
3535
#![feature(enumset)]
3636
#![feature(libc)]
3737
#![feature(nonzero)]

src/librustc_borrowck/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#![allow(non_camel_case_types)]
2121

22-
#![feature(dotdot_in_tuple_patterns)]
22+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2323
#![feature(quote)]
2424
#![feature(rustc_diagnostic_macros)]
2525
#![feature(rustc_private)]

src/librustc_const_eval/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2323
html_root_url = "https://doc.rust-lang.org/nightly/")]
2424

25-
#![feature(dotdot_in_tuple_patterns)]
25+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2626
#![feature(rustc_private)]
2727
#![feature(staged_api)]
2828
#![feature(rustc_diagnostic_macros)]

src/librustc_driver/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#![cfg_attr(not(stage0), deny(warnings))]
2525

2626
#![feature(box_syntax)]
27-
#![feature(dotdot_in_tuple_patterns)]
27+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2828
#![feature(libc)]
2929
#![feature(quote)]
3030
#![feature(rustc_diagnostic_macros)]

src/librustc_incremental/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
html_root_url = "https://doc.rust-lang.org/nightly/")]
2020
#![cfg_attr(not(stage0), deny(warnings))]
2121

22-
#![feature(dotdot_in_tuple_patterns)]
22+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2323
#![cfg_attr(stage0, feature(question_mark))]
2424
#![feature(rustc_private)]
2525
#![feature(staged_api)]

src/librustc_lint/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@
3131
#![cfg_attr(test, feature(test))]
3232
#![feature(box_patterns)]
3333
#![feature(box_syntax)]
34-
#![feature(dotdot_in_tuple_patterns)]
34+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
3535
#![feature(quote)]
3636
#![feature(rustc_diagnostic_macros)]
3737
#![feature(rustc_private)]
3838
#![feature(slice_patterns)]
3939
#![feature(staged_api)]
40-
#![feature(dotdot_in_tuple_patterns)]
4140

4241
#[macro_use]
4342
extern crate syntax;

src/librustc_metadata/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#![feature(box_patterns)]
2121
#![feature(conservative_impl_trait)]
2222
#![feature(core_intrinsics)]
23-
#![feature(dotdot_in_tuple_patterns)]
23+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2424
#![feature(proc_macro_internals)]
2525
#![feature(proc_macro_lib)]
2626
#![cfg_attr(stage0, feature(question_mark))]

src/librustc_mir/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
2222

2323
#![feature(associated_consts)]
2424
#![feature(box_patterns)]
25-
#![feature(dotdot_in_tuple_patterns)]
25+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2626
#![feature(rustc_diagnostic_macros)]
2727
#![feature(rustc_private)]
2828
#![feature(staged_api)]

src/librustc_passes/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
html_root_url = "https://doc.rust-lang.org/nightly/")]
2424
#![cfg_attr(not(stage0), deny(warnings))]
2525

26-
#![feature(dotdot_in_tuple_patterns)]
26+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2727
#![feature(rustc_diagnostic_macros)]
2828
#![feature(staged_api)]
2929
#![feature(rustc_private)]

src/librustc_privacy/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
html_root_url = "https://doc.rust-lang.org/nightly/")]
1818
#![cfg_attr(not(stage0), deny(warnings))]
1919

20-
#![feature(dotdot_in_tuple_patterns)]
20+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2121
#![feature(rustc_diagnostic_macros)]
2222
#![feature(rustc_private)]
2323
#![feature(staged_api)]

src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#![feature(associated_consts)]
2121
#![feature(borrow_state)]
22-
#![feature(dotdot_in_tuple_patterns)]
22+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2323
#![feature(rustc_diagnostic_macros)]
2424
#![feature(rustc_private)]
2525
#![feature(staged_api)]

src/librustc_save_analysis/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![cfg_attr(not(stage0), deny(warnings))]
1919

2020
#![feature(custom_attribute)]
21-
#![feature(dotdot_in_tuple_patterns)]
21+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2222
#![allow(unused_attributes)]
2323
#![feature(rustc_private)]
2424
#![feature(staged_api)]

src/librustc_trans/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#![feature(cell_extras)]
2929
#![feature(const_fn)]
3030
#![feature(custom_attribute)]
31-
#![feature(dotdot_in_tuple_patterns)]
31+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
3232
#![allow(unused_attributes)]
3333
#![feature(libc)]
3434
#![feature(quote)]

src/librustc_typeck/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ This API is completely unstable and subject to change.
7777
#![feature(box_patterns)]
7878
#![feature(box_syntax)]
7979
#![feature(conservative_impl_trait)]
80-
#![feature(dotdot_in_tuple_patterns)]
80+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
8181
#![feature(quote)]
8282
#![feature(rustc_diagnostic_macros)]
8383
#![feature(rustc_private)]

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#![feature(box_patterns)]
2222
#![feature(box_syntax)]
23-
#![feature(dotdot_in_tuple_patterns)]
23+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2424
#![feature(libc)]
2525
#![feature(rustc_private)]
2626
#![feature(set_stdio)]

src/libstd/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@
249249
#![feature(const_fn)]
250250
#![feature(core_float)]
251251
#![feature(core_intrinsics)]
252-
#![feature(dotdot_in_tuple_patterns)]
252+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
253253
#![feature(dropck_parametricity)]
254254
#![feature(float_extras)]
255255
#![feature(float_from_str_radix)]

src/libsyntax/feature_gate.rs

+2-15
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,6 @@ declare_features! (
268268
// Allows cfg(target_has_atomic = "...").
269269
(active, cfg_target_has_atomic, "1.9.0", Some(32976)),
270270

271-
// Allows `..` in tuple (struct) patterns
272-
(active, dotdot_in_tuple_patterns, "1.10.0", Some(33627)),
273-
274271
// Allows `impl Trait` in function return types.
275272
(active, conservative_impl_trait, "1.12.0", Some(34511)),
276273

@@ -359,6 +356,8 @@ declare_features! (
359356
(accepted, deprecated, "1.9.0", Some(29935)),
360357
// `expr?`
361358
(accepted, question_mark, "1.14.0", Some(31436)),
359+
// Allows `..` in tuple (struct) patterns
360+
(accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)),
362361
);
363362
// (changing above list without updating src/doc/reference.md makes @cmr sad)
364363

@@ -1202,18 +1201,6 @@ impl<'a> Visitor for PostExpansionVisitor<'a> {
12021201
pattern.span,
12031202
"box pattern syntax is experimental");
12041203
}
1205-
PatKind::Tuple(_, ddpos)
1206-
if ddpos.is_some() => {
1207-
gate_feature_post!(&self, dotdot_in_tuple_patterns,
1208-
pattern.span,
1209-
"`..` in tuple patterns is experimental");
1210-
}
1211-
PatKind::TupleStruct(_, ref fields, ddpos)
1212-
if ddpos.is_some() && !fields.is_empty() => {
1213-
gate_feature_post!(&self, dotdot_in_tuple_patterns,
1214-
pattern.span,
1215-
"`..` in tuple struct patterns is experimental");
1216-
}
12171204
PatKind::TupleStruct(_, ref fields, ddpos)
12181205
if ddpos.is_none() && fields.is_empty() => {
12191206
gate_feature_post!(&self, relaxed_adts, pattern.span,

src/libsyntax/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#![cfg_attr(stage0, feature(question_mark))]
3535
#![feature(rustc_diagnostic_macros)]
3636
#![feature(specialization)]
37-
#![feature(dotdot_in_tuple_patterns)]
37+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
3838

3939
extern crate core;
4040
extern crate serialize;

src/libsyntax_ext/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
html_root_url = "https://doc.rust-lang.org/nightly/")]
2020
#![cfg_attr(not(stage0), deny(warnings))]
2121

22-
#![feature(dotdot_in_tuple_patterns)]
22+
#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
2323
#![feature(proc_macro_lib)]
2424
#![feature(proc_macro_internals)]
2525
#![feature(rustc_private)]

src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// force-host
1212

13-
#![feature(dotdot_in_tuple_patterns)]
1413
#![feature(plugin_registrar, quote, rustc_private)]
1514

1615
extern crate syntax;

src/test/compile-fail/pat-tuple-bad-type.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(dotdot_in_tuple_patterns)]
12-
1311
fn main() {
1412
let x;
1513

src/test/compile-fail/pat-tuple-feature-gate.rs

-17
This file was deleted.

src/test/compile-fail/pat-tuple-overfield.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(dotdot_in_tuple_patterns)]
12-
1311
struct S(u8, u8, u8);
1412

1513
fn main() {

src/test/run-make/save-analysis/foo.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#![ crate_name = "test" ]
1212
#![feature(box_syntax)]
13-
#![feature(dotdot_in_tuple_patterns)]
1413
#![feature(rustc_private)]
1514

1615
extern crate graphviz;

src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
#![feature(plugin_registrar)]
1414
#![feature(box_syntax)]
15-
#![feature(dotdot_in_tuple_patterns)]
1615
#![feature(rustc_private)]
1716

1817
extern crate syntax;

src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// force-host
1212

13-
#![feature(dotdot_in_tuple_patterns)]
1413
#![feature(plugin_registrar, quote, rustc_private)]
1514

1615
extern crate syntax;

src/test/run-pass/pat-tuple-1.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(dotdot_in_tuple_patterns)]
12-
1311
fn tuple() {
1412
let x = (1, 2, 3);
1513
match x {

src/test/run-pass/pat-tuple-2.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(dotdot_in_tuple_patterns)]
12-
1311
fn tuple() {
1412
let x = (1,);
1513
match x {

src/test/run-pass/pat-tuple-3.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(dotdot_in_tuple_patterns)]
12-
1311
fn tuple() {
1412
let x = (1, 2, 3);
1513
let branch = match x {

src/test/run-pass/pat-tuple-4.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(dotdot_in_tuple_patterns)]
12-
1311
fn tuple() {
1412
let x = (1, 2, 3);
1513
match x {

src/test/run-pass/pat-tuple-5.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(dotdot_in_tuple_patterns)]
12-
1311
fn tuple() {
1412
struct S;
1513
struct Z;

src/test/run-pass/pat-tuple-6.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(dotdot_in_tuple_patterns)]
12-
1311
fn tuple() {
1412
let x = (1, 2, 3, 4, 5);
1513
match x {

0 commit comments

Comments
 (0)