提交 74bb5945 编写于 作者: V Vadim Petrochenkov

Stabilize `..` in tuple (struct) patterns

上级 0ca9967a
...@@ -2479,8 +2479,6 @@ The currently implemented features of the reference compiler are: ...@@ -2479,8 +2479,6 @@ The currently implemented features of the reference compiler are:
* - `abi_vectorcall` - Allows the usage of the vectorcall calling convention * - `abi_vectorcall` - Allows the usage of the vectorcall calling convention
(e.g. `extern "vectorcall" func fn_();`) (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 * - `abi_sysv64` - Allows the usage of the system V AMD64 calling convention
(e.g. `extern "sysv64" func fn_();`) (e.g. `extern "sysv64" func fn_();`)
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#![feature(conservative_impl_trait)] #![feature(conservative_impl_trait)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(enumset)] #![feature(enumset)]
#![feature(libc)] #![feature(libc)]
#![feature(nonzero)] #![feature(nonzero)]
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(quote)] #![feature(quote)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")] 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(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#![cfg_attr(not(stage0), deny(warnings))] #![cfg_attr(not(stage0), deny(warnings))]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(libc)] #![feature(libc)]
#![feature(quote)] #![feature(quote)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))] #![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))] #![cfg_attr(stage0, feature(question_mark))]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
......
...@@ -31,13 +31,12 @@ ...@@ -31,13 +31,12 @@
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(quote)] #![feature(quote)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(slice_patterns)] #![feature(slice_patterns)]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(dotdot_in_tuple_patterns)]
#[macro_use] #[macro_use]
extern crate syntax; extern crate syntax;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(conservative_impl_trait)] #![feature(conservative_impl_trait)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(proc_macro_internals)] #![feature(proc_macro_internals)]
#![feature(proc_macro_lib)] #![feature(proc_macro_lib)]
#![cfg_attr(stage0, feature(question_mark))] #![cfg_attr(stage0, feature(question_mark))]
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#![feature(associated_consts)] #![feature(associated_consts)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))] #![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_diagnostic_macros)]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(rustc_private)] #![feature(rustc_private)]
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))] #![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_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#![feature(associated_consts)] #![feature(associated_consts)]
#![feature(borrow_state)] #![feature(borrow_state)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#![cfg_attr(not(stage0), deny(warnings))] #![cfg_attr(not(stage0), deny(warnings))]
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![allow(unused_attributes)] #![allow(unused_attributes)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#![feature(cell_extras)] #![feature(cell_extras)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![allow(unused_attributes)] #![allow(unused_attributes)]
#![feature(libc)] #![feature(libc)]
#![feature(quote)] #![feature(quote)]
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(conservative_impl_trait)] #![feature(conservative_impl_trait)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(quote)] #![feature(quote)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(libc)] #![feature(libc)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(set_stdio)] #![feature(set_stdio)]
......
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
#![feature(const_fn)] #![feature(const_fn)]
#![feature(core_float)] #![feature(core_float)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
#![feature(dropck_parametricity)] #![feature(dropck_parametricity)]
#![feature(float_extras)] #![feature(float_extras)]
#![feature(float_from_str_radix)] #![feature(float_from_str_radix)]
......
...@@ -268,9 +268,6 @@ pub fn new() -> Features { ...@@ -268,9 +268,6 @@ pub fn new() -> Features {
// Allows cfg(target_has_atomic = "..."). // Allows cfg(target_has_atomic = "...").
(active, cfg_target_has_atomic, "1.9.0", Some(32976)), (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. // Allows `impl Trait` in function return types.
(active, conservative_impl_trait, "1.12.0", Some(34511)), (active, conservative_impl_trait, "1.12.0", Some(34511)),
...@@ -353,6 +350,8 @@ pub fn new() -> Features { ...@@ -353,6 +350,8 @@ pub fn new() -> Features {
(accepted, deprecated, "1.9.0", Some(29935)), (accepted, deprecated, "1.9.0", Some(29935)),
// `expr?` // `expr?`
(accepted, question_mark, "1.14.0", Some(31436)), (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) // (changing above list without updating src/doc/reference.md makes @cmr sad)
...@@ -1190,18 +1189,6 @@ fn visit_pat(&mut self, pattern: &ast::Pat) { ...@@ -1190,18 +1189,6 @@ fn visit_pat(&mut self, pattern: &ast::Pat) {
pattern.span, pattern.span,
"box pattern syntax is experimental"); "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) PatKind::TupleStruct(_, ref fields, ddpos)
if ddpos.is_none() && fields.is_empty() => { if ddpos.is_none() && fields.is_empty() => {
gate_feature_post!(&self, relaxed_adts, pattern.span, gate_feature_post!(&self, relaxed_adts, pattern.span,
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#![cfg_attr(stage0, feature(question_mark))] #![cfg_attr(stage0, feature(question_mark))]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(specialization)] #![feature(specialization)]
#![feature(dotdot_in_tuple_patterns)] #![cfg_attr(stage0, feature(dotdot_in_tuple_patterns))]
extern crate core; extern crate core;
extern crate serialize; extern crate serialize;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))] #![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_lib)]
#![feature(proc_macro_internals)] #![feature(proc_macro_internals)]
#![feature(rustc_private)] #![feature(rustc_private)]
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
// force-host // force-host
#![feature(dotdot_in_tuple_patterns)]
#![feature(plugin_registrar, quote, rustc_private)] #![feature(plugin_registrar, quote, rustc_private)]
extern crate syntax; extern crate syntax;
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(dotdot_in_tuple_patterns)]
fn main() { fn main() {
let x; let x;
......
// 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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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
}
}
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(dotdot_in_tuple_patterns)]
struct S(u8, u8, u8); struct S(u8, u8, u8);
fn main() { fn main() {
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#![ crate_name = "test" ] #![ crate_name = "test" ]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(rustc_private)] #![feature(rustc_private)]
extern crate graphviz; extern crate graphviz;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#![feature(plugin_registrar)] #![feature(plugin_registrar)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(rustc_private)] #![feature(rustc_private)]
extern crate syntax; extern crate syntax;
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
// force-host // force-host
#![feature(dotdot_in_tuple_patterns)]
#![feature(plugin_registrar, quote, rustc_private)] #![feature(plugin_registrar, quote, rustc_private)]
extern crate syntax; extern crate syntax;
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(dotdot_in_tuple_patterns)]
fn tuple() { fn tuple() {
let x = (1, 2, 3); let x = (1, 2, 3);
match x { match x {
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(dotdot_in_tuple_patterns)]
fn tuple() { fn tuple() {
let x = (1,); let x = (1,);
match x { match x {
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(dotdot_in_tuple_patterns)]
fn tuple() { fn tuple() {
let x = (1, 2, 3); let x = (1, 2, 3);
let branch = match x { let branch = match x {
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(dotdot_in_tuple_patterns)]
fn tuple() { fn tuple() {
let x = (1, 2, 3); let x = (1, 2, 3);
match x { match x {
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(dotdot_in_tuple_patterns)]
fn tuple() { fn tuple() {
struct S; struct S;
struct Z; struct Z;
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(dotdot_in_tuple_patterns)]
fn tuple() { fn tuple() {
let x = (1, 2, 3, 4, 5); let x = (1, 2, 3, 4, 5);
match x { match x {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册