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

Stabilize `..` in tuple (struct) patterns

上级 0ca9967a
......@@ -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_();`)
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -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;
......
......@@ -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))]
......
......@@ -22,7 +22,7 @@
#![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)]
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -77,7 +77,7 @@
#![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)]
......
......@@ -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)]
......
......@@ -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)]
......
......@@ -268,9 +268,6 @@ pub fn new() -> 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 @@ pub fn new() -> 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 @@ fn visit_pat(&mut self, pattern: &ast::Pat) {
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,
......
......@@ -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;
......
......@@ -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)]
......
......@@ -10,7 +10,6 @@
// force-host
#![feature(dotdot_in_tuple_patterns)]
#![feature(plugin_registrar, quote, rustc_private)]
extern crate syntax;
......
......@@ -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;
......
// 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 @@
// 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() {
......
......@@ -10,7 +10,6 @@
#![ crate_name = "test" ]
#![feature(box_syntax)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(rustc_private)]
extern crate graphviz;
......
......@@ -12,7 +12,6 @@
#![feature(plugin_registrar)]
#![feature(box_syntax)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(rustc_private)]
extern crate syntax;
......
......@@ -10,7 +10,6 @@
// force-host
#![feature(dotdot_in_tuple_patterns)]
#![feature(plugin_registrar, quote, rustc_private)]
extern crate syntax;
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册