From 74bb5945635b5aaacd238632932baaa294694ce3 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Thu, 15 Sep 2016 00:51:46 +0300 Subject: [PATCH] Stabilize `..` in tuple (struct) patterns --- src/doc/reference.md | 2 -- src/librustc/lib.rs | 2 +- src/librustc_borrowck/lib.rs | 2 +- src/librustc_const_eval/lib.rs | 2 +- src/librustc_driver/lib.rs | 2 +- src/librustc_incremental/lib.rs | 2 +- src/librustc_lint/lib.rs | 3 +-- src/librustc_metadata/lib.rs | 2 +- src/librustc_mir/lib.rs | 2 +- src/librustc_passes/lib.rs | 2 +- src/librustc_privacy/lib.rs | 2 +- src/librustc_resolve/lib.rs | 2 +- src/librustc_save_analysis/lib.rs | 2 +- src/librustc_trans/lib.rs | 2 +- src/librustc_typeck/lib.rs | 2 +- src/librustdoc/lib.rs | 2 +- src/libstd/lib.rs | 2 +- src/libsyntax/feature_gate.rs | 17 ++--------------- src/libsyntax/lib.rs | 2 +- src/libsyntax_ext/lib.rs | 2 +- .../auxiliary/macro_crate_test.rs | 1 - src/test/compile-fail/pat-tuple-bad-type.rs | 2 -- src/test/compile-fail/pat-tuple-feature-gate.rs | 17 ----------------- src/test/compile-fail/pat-tuple-overfield.rs | 2 -- src/test/run-make/save-analysis/foo.rs | 1 - .../auxiliary/custom_derive_plugin_attr.rs | 1 - .../auxiliary/macro_crate_test.rs | 1 - src/test/run-pass/pat-tuple-1.rs | 2 -- src/test/run-pass/pat-tuple-2.rs | 2 -- src/test/run-pass/pat-tuple-3.rs | 2 -- src/test/run-pass/pat-tuple-4.rs | 2 -- src/test/run-pass/pat-tuple-5.rs | 2 -- src/test/run-pass/pat-tuple-6.rs | 2 -- 33 files changed, 20 insertions(+), 73 deletions(-) delete mode 100644 src/test/compile-fail/pat-tuple-feature-gate.rs diff --git a/src/doc/reference.md b/src/doc/reference.md index 4838ecd2d42e6..563d0f5d9572b 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -2479,8 +2479,6 @@ The currently implemented features of the reference compiler are: * - `abi_vectorcall` - Allows the usage of the vectorcall calling convention (e.g. `extern "vectorcall" func fn_();`) -* - `dotdot_in_tuple_patterns` - Allows `..` in tuple (struct) patterns. - * - `abi_sysv64` - Allows the usage of the system V AMD64 calling convention (e.g. `extern "sysv64" func fn_();`) diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index d17402d21342b..fa49e5c728951 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -31,7 +31,7 @@ #![feature(conservative_impl_trait)] #![feature(const_fn)] #![feature(core_intrinsics)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(enumset)] #![feature(libc)] #![feature(nonzero)] diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index da899714e9351..2cd709dbd36eb 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -19,7 +19,7 @@ #![allow(non_camel_case_types)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] diff --git a/src/librustc_const_eval/lib.rs b/src/librustc_const_eval/lib.rs index 1a07ece044ff2..3fa60f86c98c4 100644 --- a/src/librustc_const_eval/lib.rs +++ b/src/librustc_const_eval/lib.rs @@ -22,7 +22,7 @@ html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(rustc_private)] #![feature(staged_api)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index cb78baa12a6ad..6ddbce7dc72ab 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -24,7 +24,7 @@ #![cfg_attr(not(stage0), deny(warnings))] #![feature(box_syntax)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(libc)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index 577e50699bffd..4a5a6b9bea900 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -19,7 +19,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![cfg_attr(not(stage0), deny(warnings))] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![cfg_attr(stage0, feature(question_mark))] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 6f114e09a6c7d..42a893913b648 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -31,13 +31,12 @@ #![cfg_attr(test, feature(test))] #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(slice_patterns)] #![feature(staged_api)] -#![feature(dotdot_in_tuple_patterns)] #[macro_use] extern crate syntax; diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index ef81dbd7f29ec..2fd40181d7c74 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -20,7 +20,7 @@ #![feature(box_patterns)] #![feature(conservative_impl_trait)] #![feature(core_intrinsics)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(proc_macro_internals)] #![feature(proc_macro_lib)] #![cfg_attr(stage0, feature(question_mark))] diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 02f15602d708b..aa56daf888944 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -22,7 +22,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![feature(associated_consts)] #![feature(box_patterns)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index a4657251c9ce2..3cc7e32ed1f57 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -23,7 +23,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![cfg_attr(not(stage0), deny(warnings))] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(rustc_diagnostic_macros)] #![feature(staged_api)] #![feature(rustc_private)] diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 77b3e76fc541f..2f77d29260b03 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -17,7 +17,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![cfg_attr(not(stage0), deny(warnings))] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 0b382fcbfdd51..a52d59fce1662 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -19,7 +19,7 @@ #![feature(associated_consts)] #![feature(borrow_state)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 15c74f2ed6ab5..af266b3617cfe 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -18,7 +18,7 @@ #![cfg_attr(not(stage0), deny(warnings))] #![feature(custom_attribute)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![allow(unused_attributes)] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 07acc54962b87..1671e79daa4dc 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -28,7 +28,7 @@ #![feature(cell_extras)] #![feature(const_fn)] #![feature(custom_attribute)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![allow(unused_attributes)] #![feature(libc)] #![feature(quote)] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index d636baca248df..ddead08aeab56 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -77,7 +77,7 @@ This API is completely unstable and subject to change. #![feature(box_patterns)] #![feature(box_syntax)] #![feature(conservative_impl_trait)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index cf5e8e5e34a3c..ee395e0616b81 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -20,7 +20,7 @@ #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(libc)] #![feature(rustc_private)] #![feature(set_stdio)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 8d973fc1ade47..12dbbe3c46918 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -249,7 +249,7 @@ #![feature(const_fn)] #![feature(core_float)] #![feature(core_intrinsics)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(dropck_parametricity)] #![feature(float_extras)] #![feature(float_from_str_radix)] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 129e4a8233803..316f287f1cb31 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -268,9 +268,6 @@ declare_features! ( // Allows cfg(target_has_atomic = "..."). (active, cfg_target_has_atomic, "1.9.0", Some(32976)), - // Allows `..` in tuple (struct) patterns - (active, dotdot_in_tuple_patterns, "1.10.0", Some(33627)), - // Allows `impl Trait` in function return types. (active, conservative_impl_trait, "1.12.0", Some(34511)), @@ -353,6 +350,8 @@ declare_features! ( (accepted, deprecated, "1.9.0", Some(29935)), // `expr?` (accepted, question_mark, "1.14.0", Some(31436)), + // Allows `..` in tuple (struct) patterns + (accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)), ); // (changing above list without updating src/doc/reference.md makes @cmr sad) @@ -1190,18 +1189,6 @@ impl<'a> Visitor for PostExpansionVisitor<'a> { pattern.span, "box pattern syntax is experimental"); } - PatKind::Tuple(_, ddpos) - if ddpos.is_some() => { - gate_feature_post!(&self, dotdot_in_tuple_patterns, - pattern.span, - "`..` in tuple patterns is experimental"); - } - PatKind::TupleStruct(_, ref fields, ddpos) - if ddpos.is_some() && !fields.is_empty() => { - gate_feature_post!(&self, dotdot_in_tuple_patterns, - pattern.span, - "`..` in tuple struct patterns is experimental"); - } PatKind::TupleStruct(_, ref fields, ddpos) if ddpos.is_none() && fields.is_empty() => { gate_feature_post!(&self, relaxed_adts, pattern.span, diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index b86e508d89970..feed400897c0f 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -34,7 +34,7 @@ #![cfg_attr(stage0, feature(question_mark))] #![feature(rustc_diagnostic_macros)] #![feature(specialization)] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] extern crate core; extern crate serialize; diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index f336b26ae41f2..e1542c9e466aa 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -19,7 +19,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![cfg_attr(not(stage0), deny(warnings))] -#![feature(dotdot_in_tuple_patterns)] +#![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))] #![feature(proc_macro_lib)] #![feature(proc_macro_internals)] #![feature(rustc_private)] diff --git a/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs b/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs index 60697cc8b6ace..409f9dbf03c54 100644 --- a/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs +++ b/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs @@ -10,7 +10,6 @@ // force-host -#![feature(dotdot_in_tuple_patterns)] #![feature(plugin_registrar, quote, rustc_private)] extern crate syntax; diff --git a/src/test/compile-fail/pat-tuple-bad-type.rs b/src/test/compile-fail/pat-tuple-bad-type.rs index 0d50a30dd0526..fd4ab5d253158 100644 --- a/src/test/compile-fail/pat-tuple-bad-type.rs +++ b/src/test/compile-fail/pat-tuple-bad-type.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(dotdot_in_tuple_patterns)] - fn main() { let x; diff --git a/src/test/compile-fail/pat-tuple-feature-gate.rs b/src/test/compile-fail/pat-tuple-feature-gate.rs deleted file mode 100644 index 55ca05bdef381..0000000000000 --- a/src/test/compile-fail/pat-tuple-feature-gate.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - match 0 { - (..) => {} //~ ERROR `..` in tuple patterns is experimental - (pat, ..) => {} //~ ERROR `..` in tuple patterns is experimental - S(pat, ..) => {} //~ ERROR `..` in tuple struct patterns is experimental - } -} diff --git a/src/test/compile-fail/pat-tuple-overfield.rs b/src/test/compile-fail/pat-tuple-overfield.rs index 069c1dc0aea1b..851fa5c5be61f 100644 --- a/src/test/compile-fail/pat-tuple-overfield.rs +++ b/src/test/compile-fail/pat-tuple-overfield.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(dotdot_in_tuple_patterns)] - struct S(u8, u8, u8); fn main() { diff --git a/src/test/run-make/save-analysis/foo.rs b/src/test/run-make/save-analysis/foo.rs index 3f36ebe649234..e9ed897bf302b 100644 --- a/src/test/run-make/save-analysis/foo.rs +++ b/src/test/run-make/save-analysis/foo.rs @@ -10,7 +10,6 @@ #![ crate_name = "test" ] #![feature(box_syntax)] -#![feature(dotdot_in_tuple_patterns)] #![feature(rustc_private)] extern crate graphviz; diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs index 5df95ba5facbf..6b58fee157584 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs @@ -12,7 +12,6 @@ #![feature(plugin_registrar)] #![feature(box_syntax)] -#![feature(dotdot_in_tuple_patterns)] #![feature(rustc_private)] extern crate syntax; diff --git a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs index 15ec0ccae8fdd..7257444ee8703 100644 --- a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs +++ b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs @@ -10,7 +10,6 @@ // force-host -#![feature(dotdot_in_tuple_patterns)] #![feature(plugin_registrar, quote, rustc_private)] extern crate syntax; diff --git a/src/test/run-pass/pat-tuple-1.rs b/src/test/run-pass/pat-tuple-1.rs index c3796210a8e5b..45a9a2b303c9f 100644 --- a/src/test/run-pass/pat-tuple-1.rs +++ b/src/test/run-pass/pat-tuple-1.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(dotdot_in_tuple_patterns)] - fn tuple() { let x = (1, 2, 3); match x { diff --git a/src/test/run-pass/pat-tuple-2.rs b/src/test/run-pass/pat-tuple-2.rs index 881e96a9d788c..ee60d1c01cf84 100644 --- a/src/test/run-pass/pat-tuple-2.rs +++ b/src/test/run-pass/pat-tuple-2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(dotdot_in_tuple_patterns)] - fn tuple() { let x = (1,); match x { diff --git a/src/test/run-pass/pat-tuple-3.rs b/src/test/run-pass/pat-tuple-3.rs index 94d33d41899a4..7a46c1deb59bf 100644 --- a/src/test/run-pass/pat-tuple-3.rs +++ b/src/test/run-pass/pat-tuple-3.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(dotdot_in_tuple_patterns)] - fn tuple() { let x = (1, 2, 3); let branch = match x { diff --git a/src/test/run-pass/pat-tuple-4.rs b/src/test/run-pass/pat-tuple-4.rs index ffd82fea99622..1d75e1e9d14dd 100644 --- a/src/test/run-pass/pat-tuple-4.rs +++ b/src/test/run-pass/pat-tuple-4.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(dotdot_in_tuple_patterns)] - fn tuple() { let x = (1, 2, 3); match x { diff --git a/src/test/run-pass/pat-tuple-5.rs b/src/test/run-pass/pat-tuple-5.rs index 41c4d02abcbd3..1192932f13daf 100644 --- a/src/test/run-pass/pat-tuple-5.rs +++ b/src/test/run-pass/pat-tuple-5.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(dotdot_in_tuple_patterns)] - fn tuple() { struct S; struct Z; diff --git a/src/test/run-pass/pat-tuple-6.rs b/src/test/run-pass/pat-tuple-6.rs index 6f3f2b3aed550..9d3cd65b455cf 100644 --- a/src/test/run-pass/pat-tuple-6.rs +++ b/src/test/run-pass/pat-tuple-6.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(dotdot_in_tuple_patterns)] - fn tuple() { let x = (1, 2, 3, 4, 5); match x {