From 7c90189e1331cea3eac0ab0e8959f664cffba1ae Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 24 Feb 2018 22:21:33 +0300 Subject: [PATCH] Stabilize slice patterns without `..` Merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)` --- .../advanced-slice-patterns.md | 35 ------------- .../src/language-features/slice-patterns.md | 28 ++++++----- src/liballoc/lib.rs | 1 - src/libcore/benches/lib.rs | 1 - src/libcore/tests/lib.rs | 1 + src/librustc/benches/lib.rs | 1 - src/librustc_apfloat/lib.rs | 2 +- src/librustc_const_eval/lib.rs | 1 - src/librustc_lint/lib.rs | 1 - src/librustc_trans/lib.rs | 2 +- src/librustc_trans_utils/lib.rs | 1 - src/librustc_typeck/diagnostics.rs | 6 --- src/librustc_typeck/lib.rs | 2 +- src/librustdoc/lib.rs | 2 +- src/libsyntax/feature_gate.rs | 16 ++---- src/libsyntax/parse/parser.rs | 2 +- .../borrowck/borrowck-describe-lvalue.rs | 1 - .../borrowck-match-binding-is-assignment.rs | 2 - .../borrowck/borrowck-move-out-from-array.rs | 3 +- .../borrowck-vec-pattern-element-loan.rs | 1 - src/test/compile-fail/issue-12369.rs | 1 - src/test/compile-fail/issue-13482-2.rs | 2 - src/test/compile-fail/issue-13482.rs | 2 - src/test/compile-fail/issue-15381.rs | 2 - src/test/compile-fail/issue-41255.rs | 1 - src/test/compile-fail/issue-6804.rs | 1 - .../match-byte-array-patterns-2.rs | 2 - .../compile-fail/match-byte-array-patterns.rs | 2 +- src/test/compile-fail/match-ref-ice.rs | 1 - src/test/compile-fail/match-slice-patterns.rs | 2 +- src/test/compile-fail/match-vec-fixed.rs | 1 - src/test/compile-fail/match-vec-mismatch-2.rs | 2 - .../compile-fail/match-vec-unreachable.rs | 1 - src/test/compile-fail/move-out-of-slice-1.rs | 2 +- .../regions-pattern-typing-issue-19552.rs | 2 - .../uninhabited-matches-feature-gated.rs | 2 - src/test/compile-fail/uninhabited-patterns.rs | 2 +- src/test/mir-opt/uniform_array_move_out.rs | 3 +- .../auxiliary/roman_numerals.rs | 1 - src/test/run-pass/destructure-array-1.rs | 3 -- src/test/run-pass/dynamic-drop.rs | 3 +- src/test/run-pass/ignore-all-the-things.rs | 11 ++-- src/test/run-pass/issue-13027.rs | 2 - src/test/run-pass/issue-15080.rs | 1 - src/test/run-pass/issue-15104.rs | 1 - src/test/run-pass/issue-16648.rs | 3 -- src/test/run-pass/issue-17877.rs | 1 - src/test/run-pass/issue-37598.rs | 2 +- src/test/run-pass/issue-38002.rs | 2 - src/test/run-pass/issue-46855.rs | 2 - src/test/run-pass/issue-7784.rs | 2 - src/test/run-pass/match-vec-alternatives.rs | 2 - .../rfc-2005-default-binding-mode/slice.rs | 2 +- src/test/run-pass/trailing-comma.rs | 1 - src/test/run-pass/vec-matching-autoslice.rs | 3 -- src/test/run-pass/vec-matching-fixed.rs | 2 - src/test/run-pass/vec-matching-fold.rs | 2 - src/test/run-pass/vec-matching.rs | 2 - src/test/run-pass/vec-tail-matching.rs | 2 - .../borrowck/borrowck-vec-pattern-nesting.rs | 1 - .../borrowck-vec-pattern-nesting.stderr | 16 +++--- src/test/ui/error-codes/E0527.rs | 2 - src/test/ui/error-codes/E0527.stderr | 2 +- src/test/ui/error-codes/E0529.rs | 2 - src/test/ui/error-codes/E0529.stderr | 2 +- .../feature-gate-advanced-slice-features.rs | 22 -------- ...eature-gate-advanced-slice-features.stderr | 19 ------- src/test/ui/feature-gate-slice-patterns.rs | 13 ++++- .../ui/feature-gate-slice-patterns.stderr | 50 +++++++++++++++++-- src/test/ui/mismatched_types/issue-38371.rs | 2 - .../ui/mismatched_types/issue-38371.stderr | 8 +-- src/test/ui/non-exhaustive-pattern-witness.rs | 1 - .../ui/non-exhaustive-pattern-witness.stderr | 14 +++--- src/test/ui/pat-slice-old-style.rs | 4 +- .../ui/rfc-2005-default-binding-mode/slice.rs | 2 +- 75 files changed, 124 insertions(+), 226 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/advanced-slice-patterns.md delete mode 100644 src/test/ui/feature-gate-advanced-slice-features.rs delete mode 100644 src/test/ui/feature-gate-advanced-slice-features.stderr diff --git a/src/doc/unstable-book/src/language-features/advanced-slice-patterns.md b/src/doc/unstable-book/src/language-features/advanced-slice-patterns.md deleted file mode 100644 index e8256469b14..00000000000 --- a/src/doc/unstable-book/src/language-features/advanced-slice-patterns.md +++ /dev/null @@ -1,35 +0,0 @@ -# `advanced_slice_patterns` - -The tracking issue for this feature is: [#23121] - -[#23121]: https://github.com/rust-lang/rust/issues/23121 - -See also [`slice_patterns`](language-features/slice-patterns.html). - ------------------------- - - -The `advanced_slice_patterns` gate lets you use `..` to indicate any number of -elements inside a pattern matching a slice. This wildcard can only be used once -for a given array. If there's an identifier before the `..`, the result of the -slice will be bound to that name. For example: - -```rust -#![feature(advanced_slice_patterns, slice_patterns)] - -fn is_symmetric(list: &[u32]) -> bool { - match list { - &[] | &[_] => true, - &[x, ref inside.., y] if x == y => is_symmetric(inside), - _ => false - } -} - -fn main() { - let sym = &[0, 1, 4, 2, 4, 1, 0]; - assert!(is_symmetric(sym)); - - let not_sym = &[0, 1, 7, 2, 4, 1, 0]; - assert!(!is_symmetric(not_sym)); -} -``` diff --git a/src/doc/unstable-book/src/language-features/slice-patterns.md b/src/doc/unstable-book/src/language-features/slice-patterns.md index 69857297582..133174268ef 100644 --- a/src/doc/unstable-book/src/language-features/slice-patterns.md +++ b/src/doc/unstable-book/src/language-features/slice-patterns.md @@ -4,25 +4,29 @@ The tracking issue for this feature is: [#23121] [#23121]: https://github.com/rust-lang/rust/issues/23121 -See also -[`advanced_slice_patterns`](language-features/advanced-slice-patterns.html). - ------------------------ - -If you want to match against a slice or array, you can use `&` with the -`slice_patterns` feature: +The `slice_patterns` feature gate lets you use `..` to indicate any number of +elements inside a pattern matching a slice. This wildcard can only be used once +for a given array. If there's an pattern before the `..`, the subslice will be +matched against that pattern. For example: ```rust #![feature(slice_patterns)] +fn is_symmetric(list: &[u32]) -> bool { + match list { + &[] | &[_] => true, + &[x, ref inside.., y] if x == y => is_symmetric(inside), + &[..] => false, + } +} + fn main() { - let v = vec!["match_this", "1"]; + let sym = &[0, 1, 4, 2, 4, 1, 0]; + assert!(is_symmetric(sym)); - match &v[..] { - &["match_this", second] => println!("The second element is {}", second), - _ => {}, - } + let not_sym = &[0, 1, 7, 2, 4, 1, 0]; + assert!(!is_symmetric(not_sym)); } ``` - diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 2727bcaa28a..45bb3885574 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -110,7 +110,6 @@ #![feature(ptr_internals)] #![feature(rustc_attrs)] #![feature(slice_get_slice)] -#![feature(slice_patterns)] #![feature(slice_rsplit)] #![feature(specialization)] #![feature(staged_api)] diff --git a/src/libcore/benches/lib.rs b/src/libcore/benches/lib.rs index 201064e823b..c947b003ccb 100644 --- a/src/libcore/benches/lib.rs +++ b/src/libcore/benches/lib.rs @@ -11,7 +11,6 @@ #![deny(warnings)] #![feature(flt2dec)] -#![feature(slice_patterns)] #![feature(test)] extern crate core; diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 1c876fa0bd7..e9a8113ef10 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -37,6 +37,7 @@ #![feature(raw)] #![feature(refcell_replace_swap)] #![feature(slice_patterns)] +#![feature(slice_rotate)] #![feature(sort_internals)] #![feature(specialization)] #![feature(step_trait)] diff --git a/src/librustc/benches/lib.rs b/src/librustc/benches/lib.rs index 24294ec49ce..278e0f9a26e 100644 --- a/src/librustc/benches/lib.rs +++ b/src/librustc/benches/lib.rs @@ -10,7 +10,6 @@ #![deny(warnings)] -#![feature(slice_patterns)] #![feature(test)] extern crate test; diff --git a/src/librustc_apfloat/lib.rs b/src/librustc_apfloat/lib.rs index 3afc2f68400..565658804b0 100644 --- a/src/librustc_apfloat/lib.rs +++ b/src/librustc_apfloat/lib.rs @@ -47,7 +47,7 @@ #![forbid(unsafe_code)] #![feature(i128_type)] -#![feature(slice_patterns)] +#![cfg_attr(stage0, feature(slice_patterns))] #![feature(try_from)] // See librustc_cratesio_shim/Cargo.toml for a comment explaining this. diff --git a/src/librustc_const_eval/lib.rs b/src/librustc_const_eval/lib.rs index 459aa9ea488..2b0775e8695 100644 --- a/src/librustc_const_eval/lib.rs +++ b/src/librustc_const_eval/lib.rs @@ -20,7 +20,6 @@ #![deny(warnings)] #![feature(rustc_diagnostic_macros)] -#![feature(slice_patterns)] #![feature(box_patterns)] #![feature(box_syntax)] #![feature(macro_lifetime_matcher)] diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 8b86c905489..ce896bfb701 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -31,7 +31,6 @@ #![feature(macro_vis_matcher)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(slice_patterns)] #![cfg_attr(stage0, feature(never_type))] #[macro_use] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 3645e728842..337f85a3813 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -30,7 +30,7 @@ #![feature(libc)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(slice_patterns)] +#![cfg_attr(stage0, feature(slice_patterns))] #![feature(conservative_impl_trait)] #![feature(optin_builtin_traits)] #![feature(inclusive_range_fields)] diff --git a/src/librustc_trans_utils/lib.rs b/src/librustc_trans_utils/lib.rs index 6a3fd21f3a7..0af5f467934 100644 --- a/src/librustc_trans_utils/lib.rs +++ b/src/librustc_trans_utils/lib.rs @@ -24,7 +24,6 @@ #![feature(i128_type)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(slice_patterns)] #![feature(conservative_impl_trait)] extern crate ar; diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 24044fd2d72..f5337118e30 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -3559,8 +3559,6 @@ fn fly(&self) {} // And now that's ok! Example of erroneous code: ```compile_fail,E0527 -#![feature(slice_patterns)] - let r = &[1, 2, 3, 4]; match r { &[a, b] => { // error: pattern requires 2 elements but array @@ -3625,8 +3623,6 @@ fn fly(&self) {} // And now that's ok! Example of erroneous code: ```compile_fail,E0529 -#![feature(slice_patterns)] - let r: f32 = 1.0; match r { [a, b] => { // error: expected an array or slice, found `f32` @@ -3639,8 +3635,6 @@ fn fly(&self) {} // And now that's ok! types: ``` -#![feature(slice_patterns)] - let r = [1.0, 2.0]; match r { [a, b] => { // ok! diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 964c0021133..9f98932f24b 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -72,7 +72,7 @@ #![allow(non_camel_case_types)] -#![feature(advanced_slice_patterns)] +#![cfg_attr(stage0, feature(advanced_slice_patterns))] #![feature(box_patterns)] #![feature(box_syntax)] #![feature(conservative_impl_trait)] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index da52fd5aa37..bec25a98227 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -20,7 +20,7 @@ #![feature(box_syntax)] #![feature(fs_read_write)] #![feature(set_stdio)] -#![feature(slice_patterns)] +#![cfg_attr(stage0, feature(slice_patterns))] #![feature(test)] #![feature(unicode)] #![feature(vec_remove_item)] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index fa600cd6860..915396d29fe 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -145,7 +145,6 @@ pub fn walk_feature_fields(&self, mut f: F) // rustc internal (active, rustc_diagnostic_macros, "1.0.0", None, None), (active, rustc_const_unstable, "1.0.0", None, None), - (active, advanced_slice_patterns, "1.0.0", Some(23121), None), (active, box_syntax, "1.0.0", Some(27779), None), (active, placement_in_syntax, "1.0.0", Some(27779), None), (active, unboxed_closures, "1.0.0", Some(29625), None), @@ -474,6 +473,8 @@ pub fn walk_feature_fields(&self, mut f: F) (removed, allocator, "1.0.0", None, None), // Allows the `#[simd]` attribute -- removed in favor of `#[repr(simd)]` (removed, simd, "1.0.0", Some(27731), None), + // Merged into `slice_patterns` + (removed, advanced_slice_patterns, "1.0.0", Some(23121), None), ); declare_features! ( @@ -1655,17 +1656,10 @@ fn visit_arm(&mut self, arm: &'a ast::Arm) { fn visit_pat(&mut self, pattern: &'a ast::Pat) { match pattern.node { - PatKind::Slice(_, Some(_), ref last) if !last.is_empty() => { - gate_feature_post!(&self, advanced_slice_patterns, - pattern.span, - "multiple-element slice matches anywhere \ - but at the end of a slice (e.g. \ - `[0, ..xs, 0]`) are experimental") - } - PatKind::Slice(..) => { + PatKind::Slice(_, Some(ref subslice), _) => { gate_feature_post!(&self, slice_patterns, - pattern.span, - "slice pattern syntax is experimental"); + subslice.span, + "syntax for subslices in slice patterns is not yet stabilized"); } PatKind::Box(..) => { gate_feature_post!(&self, box_patterns, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index cb5010a638d..6d8975197d5 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3618,7 +3618,7 @@ fn parse_pat_vec_elements( slice = Some(P(Pat { id: ast::DUMMY_NODE_ID, node: PatKind::Wild, - span: self.span, + span: self.prev_span, })); before_slice = false; } diff --git a/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs b/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs index 1d08b807465..fa475949b36 100644 --- a/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs +++ b/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs @@ -13,7 +13,6 @@ //[mir]compile-flags: -Z borrowck=mir #![feature(slice_patterns)] -#![feature(advanced_slice_patterns)] pub struct Foo { x: u32 diff --git a/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs b/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs index 32a573911ec..30047f84041 100644 --- a/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs +++ b/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs @@ -13,8 +13,6 @@ // Test that immutable pattern bindings cannot be reassigned. -#![feature(slice_patterns)] - enum E { Foo(isize) } diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs b/src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs index e0116173462..0db31cef0ed 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs +++ b/src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs @@ -11,7 +11,8 @@ // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir -#![feature(box_syntax, slice_patterns, advanced_slice_patterns)] +#![feature(box_syntax)] +#![feature(slice_patterns)] fn move_out_from_begin_and_end() { let a = [box 1, box 2]; diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-element-loan.rs b/src/test/compile-fail/borrowck/borrowck-vec-pattern-element-loan.rs index eb5d69d49bd..0fd6923326a 100644 --- a/src/test/compile-fail/borrowck/borrowck-vec-pattern-element-loan.rs +++ b/src/test/compile-fail/borrowck/borrowck-vec-pattern-element-loan.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(advanced_slice_patterns)] #![feature(slice_patterns)] fn a<'a>() -> &'a [isize] { diff --git a/src/test/compile-fail/issue-12369.rs b/src/test/compile-fail/issue-12369.rs index 4df1e24dcfb..1b9af393ccc 100644 --- a/src/test/compile-fail/issue-12369.rs +++ b/src/test/compile-fail/issue-12369.rs @@ -9,7 +9,6 @@ // except according to those terms. #![feature(slice_patterns)] -#![allow(unused_variables)] #![deny(unreachable_patterns)] fn main() { diff --git a/src/test/compile-fail/issue-13482-2.rs b/src/test/compile-fail/issue-13482-2.rs index 6885c8d94c6..fe7fbb176cc 100644 --- a/src/test/compile-fail/issue-13482-2.rs +++ b/src/test/compile-fail/issue-13482-2.rs @@ -10,8 +10,6 @@ // compile-flags:-Z verbose -#![feature(slice_patterns)] - fn main() { let x = [1,2]; let y = match x { diff --git a/src/test/compile-fail/issue-13482.rs b/src/test/compile-fail/issue-13482.rs index 82e82df3186..32a63b79a32 100644 --- a/src/test/compile-fail/issue-13482.rs +++ b/src/test/compile-fail/issue-13482.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] - fn main() { let x = [1,2]; let y = match x { diff --git a/src/test/compile-fail/issue-15381.rs b/src/test/compile-fail/issue-15381.rs index d0964d2aabe..1cdd803971b 100644 --- a/src/test/compile-fail/issue-15381.rs +++ b/src/test/compile-fail/issue-15381.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] - fn main() { let values: Vec = vec![1,2,3,4,5,6,7,8]; diff --git a/src/test/compile-fail/issue-41255.rs b/src/test/compile-fail/issue-41255.rs index ac85e43cf4f..bdd502d4420 100644 --- a/src/test/compile-fail/issue-41255.rs +++ b/src/test/compile-fail/issue-41255.rs @@ -10,7 +10,6 @@ // Matching against float literals should result in a linter error -#![feature(slice_patterns)] #![feature(exclusive_range_pattern)] #![allow(unused)] #![forbid(illegal_floating_point_literal_pattern)] diff --git a/src/test/compile-fail/issue-6804.rs b/src/test/compile-fail/issue-6804.rs index 9191dfa155c..fffa27ab842 100644 --- a/src/test/compile-fail/issue-6804.rs +++ b/src/test/compile-fail/issue-6804.rs @@ -10,7 +10,6 @@ // Matching against NaN should result in a warning -#![feature(slice_patterns)] #![allow(unused)] #![deny(illegal_floating_point_literal_pattern)] diff --git a/src/test/compile-fail/match-byte-array-patterns-2.rs b/src/test/compile-fail/match-byte-array-patterns-2.rs index ad7e931a0ec..abb770df107 100644 --- a/src/test/compile-fail/match-byte-array-patterns-2.rs +++ b/src/test/compile-fail/match-byte-array-patterns-2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(advanced_slice_patterns, slice_patterns)] - fn main() { let buf = &[0, 1, 2, 3]; diff --git a/src/test/compile-fail/match-byte-array-patterns.rs b/src/test/compile-fail/match-byte-array-patterns.rs index 1ff07eae1c9..9db4319b786 100644 --- a/src/test/compile-fail/match-byte-array-patterns.rs +++ b/src/test/compile-fail/match-byte-array-patterns.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(advanced_slice_patterns, slice_patterns)] +#![feature(slice_patterns)] #![deny(unreachable_patterns)] fn main() { diff --git a/src/test/compile-fail/match-ref-ice.rs b/src/test/compile-fail/match-ref-ice.rs index 1cdbba17f65..cb8f8fad532 100644 --- a/src/test/compile-fail/match-ref-ice.rs +++ b/src/test/compile-fail/match-ref-ice.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] #![deny(unreachable_patterns)] // The arity of `ref x` is always 1. If the pattern is compared to some non-structural type whose diff --git a/src/test/compile-fail/match-slice-patterns.rs b/src/test/compile-fail/match-slice-patterns.rs index fd4bd1c7b94..a8ec95da3d8 100644 --- a/src/test/compile-fail/match-slice-patterns.rs +++ b/src/test/compile-fail/match-slice-patterns.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(advanced_slice_patterns, slice_patterns)] +#![feature(slice_patterns)] fn check(list: &[Option<()>]) { match list { diff --git a/src/test/compile-fail/match-vec-fixed.rs b/src/test/compile-fail/match-vec-fixed.rs index dd9379c756d..05971d70167 100644 --- a/src/test/compile-fail/match-vec-fixed.rs +++ b/src/test/compile-fail/match-vec-fixed.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] #![deny(unreachable_patterns)] fn a() { diff --git a/src/test/compile-fail/match-vec-mismatch-2.rs b/src/test/compile-fail/match-vec-mismatch-2.rs index 375d855d1fd..52c5375f4e7 100644 --- a/src/test/compile-fail/match-vec-mismatch-2.rs +++ b/src/test/compile-fail/match-vec-mismatch-2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] - fn main() { match () { [()] => { } diff --git a/src/test/compile-fail/match-vec-unreachable.rs b/src/test/compile-fail/match-vec-unreachable.rs index 472b054b087..d6e3fdbe088 100644 --- a/src/test/compile-fail/match-vec-unreachable.rs +++ b/src/test/compile-fail/match-vec-unreachable.rs @@ -10,7 +10,6 @@ #![feature(slice_patterns)] #![deny(unreachable_patterns)] -#![allow(unused_variables)] fn main() { let x: Vec<(isize, isize)> = Vec::new(); diff --git a/src/test/compile-fail/move-out-of-slice-1.rs b/src/test/compile-fail/move-out-of-slice-1.rs index 9ca9e0984e4..5efbef549dd 100644 --- a/src/test/compile-fail/move-out-of-slice-1.rs +++ b/src/test/compile-fail/move-out-of-slice-1.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns, box_patterns)] +#![feature(box_patterns)] struct A; diff --git a/src/test/compile-fail/regions-pattern-typing-issue-19552.rs b/src/test/compile-fail/regions-pattern-typing-issue-19552.rs index 8e83177090b..3401dd1becd 100644 --- a/src/test/compile-fail/regions-pattern-typing-issue-19552.rs +++ b/src/test/compile-fail/regions-pattern-typing-issue-19552.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] - fn assert_static(_t: T) {} fn main() { diff --git a/src/test/compile-fail/uninhabited-matches-feature-gated.rs b/src/test/compile-fail/uninhabited-matches-feature-gated.rs index 0c3ea53a903..1d3f8ff12d8 100644 --- a/src/test/compile-fail/uninhabited-matches-feature-gated.rs +++ b/src/test/compile-fail/uninhabited-matches-feature-gated.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] - enum Void {} fn main() { diff --git a/src/test/compile-fail/uninhabited-patterns.rs b/src/test/compile-fail/uninhabited-patterns.rs index 9f943f08232..e130df5c845 100644 --- a/src/test/compile-fail/uninhabited-patterns.rs +++ b/src/test/compile-fail/uninhabited-patterns.rs @@ -9,9 +9,9 @@ // except according to those terms. #![feature(box_patterns)] -#![feature(slice_patterns)] #![feature(box_syntax)] #![feature(exhaustive_patterns)] +#![feature(slice_patterns)] #![deny(unreachable_patterns)] mod foo { diff --git a/src/test/mir-opt/uniform_array_move_out.rs b/src/test/mir-opt/uniform_array_move_out.rs index 482b69a59dd..fa5f62f89f6 100644 --- a/src/test/mir-opt/uniform_array_move_out.rs +++ b/src/test/mir-opt/uniform_array_move_out.rs @@ -8,7 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(box_syntax, slice_patterns, advanced_slice_patterns)] +#![feature(box_syntax)] +#![feature(slice_patterns)] fn move_out_from_end() { let a = [box 1, box 2]; diff --git a/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs b/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs index 26419a51513..17cf39372c0 100644 --- a/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs +++ b/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs @@ -12,7 +12,6 @@ #![crate_type="dylib"] #![feature(plugin_registrar, rustc_private)] -#![feature(slice_patterns)] extern crate syntax; extern crate syntax_pos; diff --git a/src/test/run-pass/destructure-array-1.rs b/src/test/run-pass/destructure-array-1.rs index 0d24f0bd0d7..43271162c18 100644 --- a/src/test/run-pass/destructure-array-1.rs +++ b/src/test/run-pass/destructure-array-1.rs @@ -11,9 +11,6 @@ // Ensure that we can do a destructuring bind of a fixed-size array, // even when the element type has a destructor. - -#![feature(slice_patterns)] - struct D { x: u8 } impl Drop for D { fn drop(&mut self) { } } diff --git a/src/test/run-pass/dynamic-drop.rs b/src/test/run-pass/dynamic-drop.rs index 4d0bd3f3412..1f543f7be0e 100644 --- a/src/test/run-pass/dynamic-drop.rs +++ b/src/test/run-pass/dynamic-drop.rs @@ -13,7 +13,8 @@ // ignore-wasm32-bare compiled with panic=abort by default -#![feature(generators, generator_trait, untagged_unions, slice_patterns, advanced_slice_patterns)] +#![feature(generators, generator_trait, untagged_unions)] +#![feature(slice_patterns)] use std::cell::{Cell, RefCell}; use std::ops::Generator; diff --git a/src/test/run-pass/ignore-all-the-things.rs b/src/test/run-pass/ignore-all-the-things.rs index 711f2dd6c66..c14f3dc7291 100644 --- a/src/test/run-pass/ignore-all-the-things.rs +++ b/src/test/run-pass/ignore-all-the-things.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![feature(advanced_slice_patterns)] #![feature(slice_patterns)] struct Foo(isize, isize, isize, isize); @@ -20,11 +19,11 @@ pub fn main() { let Foo(..) = Foo(5, 5, 5, 5); let Foo(..) = Foo(5, 5, 5, 5); let Bar{..} = Bar{a: 5, b: 5, c: 5, d: 5}; - //let (..) = (5, 5, 5, 5); - //let Foo(a, b, ..) = Foo(5, 5, 5, 5); - //let Foo(.., d) = Foo(5, 5, 5, 5); - //let (a, b, ..) = (5, 5, 5, 5); - //let (.., c, d) = (5, 5, 5, 5); + let (..) = (5, 5, 5, 5); + let Foo(a, b, ..) = Foo(5, 5, 5, 5); + let Foo(.., d) = Foo(5, 5, 5, 5); + let (a, b, ..) = (5, 5, 5, 5); + let (.., c, d) = (5, 5, 5, 5); let Bar{b: b, ..} = Bar{a: 5, b: 5, c: 5, d: 5}; match [5, 5, 5, 5] { [..] => { } diff --git a/src/test/run-pass/issue-13027.rs b/src/test/run-pass/issue-13027.rs index 14987484711..d28ea94ec1a 100644 --- a/src/test/run-pass/issue-13027.rs +++ b/src/test/run-pass/issue-13027.rs @@ -12,8 +12,6 @@ // Tests that match expression handles overlapped literal and range // properly in the presence of guard function. -#![feature(slice_patterns)] - fn val() -> usize { 1 } static CONST: usize = 1; diff --git a/src/test/run-pass/issue-15080.rs b/src/test/run-pass/issue-15080.rs index 14e00378846..59267f79e26 100644 --- a/src/test/run-pass/issue-15080.rs +++ b/src/test/run-pass/issue-15080.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - #![feature(slice_patterns)] fn main() { diff --git a/src/test/run-pass/issue-15104.rs b/src/test/run-pass/issue-15104.rs index 508360cb701..2878f2795c5 100644 --- a/src/test/run-pass/issue-15104.rs +++ b/src/test/run-pass/issue-15104.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - #![feature(slice_patterns)] fn main() { diff --git a/src/test/run-pass/issue-16648.rs b/src/test/run-pass/issue-16648.rs index e1b94179764..bf272308fa9 100644 --- a/src/test/run-pass/issue-16648.rs +++ b/src/test/run-pass/issue-16648.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(slice_patterns)] - fn main() { let x: (isize, &[isize]) = (2, &[1, 2]); assert_eq!(match x { diff --git a/src/test/run-pass/issue-17877.rs b/src/test/run-pass/issue-17877.rs index 6c87e8d35fb..d3fe0903a1d 100644 --- a/src/test/run-pass/issue-17877.rs +++ b/src/test/run-pass/issue-17877.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - #![feature(slice_patterns)] fn main() { diff --git a/src/test/run-pass/issue-37598.rs b/src/test/run-pass/issue-37598.rs index d32d2fc2954..e97c8d9f417 100644 --- a/src/test/run-pass/issue-37598.rs +++ b/src/test/run-pass/issue-37598.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(advanced_slice_patterns, slice_patterns)] +#![feature(slice_patterns)] fn check(list: &[u8]) { match list { diff --git a/src/test/run-pass/issue-38002.rs b/src/test/run-pass/issue-38002.rs index 489d35e9147..dd6ccec973f 100644 --- a/src/test/run-pass/issue-38002.rs +++ b/src/test/run-pass/issue-38002.rs @@ -10,8 +10,6 @@ // Check that constant ADTs are translated OK, part k of N. -#![feature(slice_patterns)] - enum Bar { C } diff --git a/src/test/run-pass/issue-46855.rs b/src/test/run-pass/issue-46855.rs index d864d55c939..28aa6c731ec 100644 --- a/src/test/run-pass/issue-46855.rs +++ b/src/test/run-pass/issue-46855.rs @@ -10,8 +10,6 @@ // compile-flags: -Zmir-opt-level=1 -#![feature(slice_patterns)] - use std::mem; #[derive(Copy, Clone)] diff --git a/src/test/run-pass/issue-7784.rs b/src/test/run-pass/issue-7784.rs index badc013cd62..8d21594aa12 100644 --- a/src/test/run-pass/issue-7784.rs +++ b/src/test/run-pass/issue-7784.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(advanced_slice_patterns)] #![feature(slice_patterns)] use std::ops::Add; diff --git a/src/test/run-pass/match-vec-alternatives.rs b/src/test/run-pass/match-vec-alternatives.rs index fa609593c24..7d03d9c2abe 100644 --- a/src/test/run-pass/match-vec-alternatives.rs +++ b/src/test/run-pass/match-vec-alternatives.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(advanced_slice_patterns)] #![feature(slice_patterns)] fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { diff --git a/src/test/run-pass/rfc-2005-default-binding-mode/slice.rs b/src/test/run-pass/rfc-2005-default-binding-mode/slice.rs index 1717d0d54c0..6178f613b4b 100644 --- a/src/test/run-pass/rfc-2005-default-binding-mode/slice.rs +++ b/src/test/run-pass/rfc-2005-default-binding-mode/slice.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] #![feature(match_default_bindings)] +#![feature(slice_patterns)] fn slice_pat() { let sl: &[u8] = b"foo"; diff --git a/src/test/run-pass/trailing-comma.rs b/src/test/run-pass/trailing-comma.rs index b9eda084653..02bae5aa455 100644 --- a/src/test/run-pass/trailing-comma.rs +++ b/src/test/run-pass/trailing-comma.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![feature(advanced_slice_patterns,)] #![feature(slice_patterns)] fn f(_: T,) {} diff --git a/src/test/run-pass/vec-matching-autoslice.rs b/src/test/run-pass/vec-matching-autoslice.rs index 9df777e7af0..7268536a51f 100644 --- a/src/test/run-pass/vec-matching-autoslice.rs +++ b/src/test/run-pass/vec-matching-autoslice.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(slice_patterns)] - pub fn main() { let x = [1, 2, 3]; match x { diff --git a/src/test/run-pass/vec-matching-fixed.rs b/src/test/run-pass/vec-matching-fixed.rs index 1ed6ddc4110..060d152488a 100644 --- a/src/test/run-pass/vec-matching-fixed.rs +++ b/src/test/run-pass/vec-matching-fixed.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(advanced_slice_patterns)] #![feature(slice_patterns)] fn a() { diff --git a/src/test/run-pass/vec-matching-fold.rs b/src/test/run-pass/vec-matching-fold.rs index ac80a4211ad..1a30f875580 100644 --- a/src/test/run-pass/vec-matching-fold.rs +++ b/src/test/run-pass/vec-matching-fold.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(advanced_slice_patterns)] #![feature(slice_patterns)] use std::fmt::Debug; diff --git a/src/test/run-pass/vec-matching.rs b/src/test/run-pass/vec-matching.rs index bd0731a555c..ace418f2160 100644 --- a/src/test/run-pass/vec-matching.rs +++ b/src/test/run-pass/vec-matching.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(advanced_slice_patterns)] #![feature(slice_patterns)] fn a() { diff --git a/src/test/run-pass/vec-tail-matching.rs b/src/test/run-pass/vec-tail-matching.rs index d123eb36a7d..4f31405ead5 100644 --- a/src/test/run-pass/vec-tail-matching.rs +++ b/src/test/run-pass/vec-tail-matching.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - #![feature(slice_patterns)] struct Foo { diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs index 07b268f1a4b..111968e9c93 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(advanced_slice_patterns)] #![feature(box_patterns)] #![feature(box_syntax)] #![feature(slice_patterns)] diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr index e11702df80a..6673549e239 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `vec[..]` because it is borrowed - --> $DIR/borrowck-vec-pattern-nesting.rs:21:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:20:13 | LL | [box ref _a, _, _] => { | ------ borrow of `vec[..]` occurs here @@ -8,7 +8,7 @@ LL | vec[0] = box 4; //~ ERROR cannot assign | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here error[E0506]: cannot assign to `vec[..]` because it is borrowed - --> $DIR/borrowck-vec-pattern-nesting.rs:33:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:32:13 | LL | &mut [ref _b..] => { | ------ borrow of `vec[..]` occurs here @@ -17,7 +17,7 @@ LL | vec[0] = box 4; //~ ERROR cannot assign | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:43:14 + --> $DIR/borrowck-vec-pattern-nesting.rs:42:14 | LL | &mut [_a, //~ ERROR cannot move out | ^-- hint: to prevent move, use `ref _a` or `ref mut _a` @@ -30,7 +30,7 @@ LL | | ] => { | |_________^ cannot move out of here error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:56:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:55:13 | LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ @@ -39,7 +39,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out | help: consider using a reference instead: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:64:14 + --> $DIR/borrowck-vec-pattern-nesting.rs:63:14 | LL | &mut [ //~ ERROR cannot move out | ______________^ @@ -50,7 +50,7 @@ LL | | _b] => {} | hint: to prevent move, use `ref _b` or `ref mut _b` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:69:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:68:13 | LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ @@ -59,7 +59,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out | help: consider using a reference instead: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:77:14 + --> $DIR/borrowck-vec-pattern-nesting.rs:76:14 | LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out | ^--^^--^^--^ @@ -70,7 +70,7 @@ LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out | cannot move out of here error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:81:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:80:13 | LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ diff --git a/src/test/ui/error-codes/E0527.rs b/src/test/ui/error-codes/E0527.rs index 67d222e867e..a90ccec9cf5 100644 --- a/src/test/ui/error-codes/E0527.rs +++ b/src/test/ui/error-codes/E0527.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] - fn main() { let r = &[1, 2, 3, 4]; match r { diff --git a/src/test/ui/error-codes/E0527.stderr b/src/test/ui/error-codes/E0527.stderr index 2060f1e69e0..1e764c18587 100644 --- a/src/test/ui/error-codes/E0527.stderr +++ b/src/test/ui/error-codes/E0527.stderr @@ -1,5 +1,5 @@ error[E0527]: pattern requires 2 elements but array has 4 - --> $DIR/E0527.rs:16:10 + --> $DIR/E0527.rs:14:10 | LL | &[a, b] => { | ^^^^^^ expected 4 elements diff --git a/src/test/ui/error-codes/E0529.rs b/src/test/ui/error-codes/E0529.rs index 5262ad7b716..2459054da89 100644 --- a/src/test/ui/error-codes/E0529.rs +++ b/src/test/ui/error-codes/E0529.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] - fn main() { let r: f32 = 1.0; match r { diff --git a/src/test/ui/error-codes/E0529.stderr b/src/test/ui/error-codes/E0529.stderr index fcada000790..b2e7ae23fb0 100644 --- a/src/test/ui/error-codes/E0529.stderr +++ b/src/test/ui/error-codes/E0529.stderr @@ -1,5 +1,5 @@ error[E0529]: expected an array or slice, found `f32` - --> $DIR/E0529.rs:16:9 + --> $DIR/E0529.rs:14:9 | LL | [a, b] => { | ^^^^^^ pattern cannot match with input type `f32` diff --git a/src/test/ui/feature-gate-advanced-slice-features.rs b/src/test/ui/feature-gate-advanced-slice-features.rs deleted file mode 100644 index dc9b4e634ab..00000000000 --- a/src/test/ui/feature-gate-advanced-slice-features.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 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. - -// gate-test-advanced_slice_patterns - -#![feature(slice_patterns)] - -fn main() { - let x = [ 1, 2, 3, 4, 5 ]; - match x { - [ xs.., 4, 5 ] => {} //~ ERROR multiple-element slice matches - [ 1, xs.., 5 ] => {} //~ ERROR multiple-element slice matches - [ 1, 2, xs.. ] => {} // OK without feature gate - } -} diff --git a/src/test/ui/feature-gate-advanced-slice-features.stderr b/src/test/ui/feature-gate-advanced-slice-features.stderr deleted file mode 100644 index 9d9e7554976..00000000000 --- a/src/test/ui/feature-gate-advanced-slice-features.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0658]: multiple-element slice matches anywhere but at the end of a slice (e.g. `[0, ..xs, 0]`) are experimental (see issue #23121) - --> $DIR/feature-gate-advanced-slice-features.rs:18:9 - | -LL | [ xs.., 4, 5 ] => {} //~ ERROR multiple-element slice matches - | ^^^^^^^^^^^^^^ - | - = help: add #![feature(advanced_slice_patterns)] to the crate attributes to enable - -error[E0658]: multiple-element slice matches anywhere but at the end of a slice (e.g. `[0, ..xs, 0]`) are experimental (see issue #23121) - --> $DIR/feature-gate-advanced-slice-features.rs:19:9 - | -LL | [ 1, xs.., 5 ] => {} //~ ERROR multiple-element slice matches - | ^^^^^^^^^^^^^^ - | - = help: add #![feature(advanced_slice_patterns)] to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gate-slice-patterns.rs b/src/test/ui/feature-gate-slice-patterns.rs index 625cb2d3515..fd058f65172 100644 --- a/src/test/ui/feature-gate-slice-patterns.rs +++ b/src/test/ui/feature-gate-slice-patterns.rs @@ -8,11 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test that slice pattern syntax is gated by `slice_patterns` feature gate +// Test that slice pattern syntax with `..` is gated by `slice_patterns` feature gate fn main() { let x = [1, 2, 3, 4, 5]; match x { - [1, 2, xs..] => {} //~ ERROR slice pattern syntax is experimental + [1, 2, ..] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + [1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + [.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + } + + let x = [ 1, 2, 3, 4, 5 ]; + match x { + [ xs.., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + [ 1, xs.., 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + [ 1, 2, xs.. ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized } } diff --git a/src/test/ui/feature-gate-slice-patterns.stderr b/src/test/ui/feature-gate-slice-patterns.stderr index 7c216fad933..d560dcd54ee 100644 --- a/src/test/ui/feature-gate-slice-patterns.stderr +++ b/src/test/ui/feature-gate-slice-patterns.stderr @@ -1,11 +1,51 @@ -error[E0658]: slice pattern syntax is experimental (see issue #23121) - --> $DIR/feature-gate-slice-patterns.rs:16:9 +error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) + --> $DIR/feature-gate-slice-patterns.rs:16:16 | -LL | [1, 2, xs..] => {} //~ ERROR slice pattern syntax is experimental - | ^^^^^^^^^^^^ +LL | [1, 2, ..] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable -error: aborting due to previous error +error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) + --> $DIR/feature-gate-slice-patterns.rs:17:13 + | +LL | [1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + | ^^ + | + = help: add #![feature(slice_patterns)] to the crate attributes to enable + +error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) + --> $DIR/feature-gate-slice-patterns.rs:18:10 + | +LL | [.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + | ^^ + | + = help: add #![feature(slice_patterns)] to the crate attributes to enable + +error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) + --> $DIR/feature-gate-slice-patterns.rs:23:11 + | +LL | [ xs.., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + | ^^ + | + = help: add #![feature(slice_patterns)] to the crate attributes to enable + +error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) + --> $DIR/feature-gate-slice-patterns.rs:24:14 + | +LL | [ 1, xs.., 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + | ^^ + | + = help: add #![feature(slice_patterns)] to the crate attributes to enable + +error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) + --> $DIR/feature-gate-slice-patterns.rs:25:17 + | +LL | [ 1, 2, xs.. ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized + | ^^ + | + = help: add #![feature(slice_patterns)] to the crate attributes to enable + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/mismatched_types/issue-38371.rs b/src/test/ui/mismatched_types/issue-38371.rs index b9b6b05996b..8e613d4edba 100644 --- a/src/test/ui/mismatched_types/issue-38371.rs +++ b/src/test/ui/mismatched_types/issue-38371.rs @@ -7,8 +7,6 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] - struct Foo { } diff --git a/src/test/ui/mismatched_types/issue-38371.stderr b/src/test/ui/mismatched_types/issue-38371.stderr index 1bf1521e39e..dd5da769075 100644 --- a/src/test/ui/mismatched_types/issue-38371.stderr +++ b/src/test/ui/mismatched_types/issue-38371.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-38371.rs:16:8 + --> $DIR/issue-38371.rs:14:8 | LL | fn foo(&foo: Foo) { //~ ERROR mismatched types | ^^^^ expected struct `Foo`, found reference @@ -9,7 +9,7 @@ LL | fn foo(&foo: Foo) { //~ ERROR mismatched types = help: did you mean `foo: &Foo`? error[E0308]: mismatched types - --> $DIR/issue-38371.rs:30:9 + --> $DIR/issue-38371.rs:28:9 | LL | fn agh(&&bar: &u32) { //~ ERROR mismatched types | ^^^^ expected u32, found reference @@ -19,7 +19,7 @@ LL | fn agh(&&bar: &u32) { //~ ERROR mismatched types = help: did you mean `bar: &u32`? error[E0308]: mismatched types - --> $DIR/issue-38371.rs:33:8 + --> $DIR/issue-38371.rs:31:8 | LL | fn bgh(&&bar: u32) { //~ ERROR mismatched types | ^^^^^ expected u32, found reference @@ -28,7 +28,7 @@ LL | fn bgh(&&bar: u32) { //~ ERROR mismatched types found type `&_` error[E0529]: expected an array or slice, found `u32` - --> $DIR/issue-38371.rs:36:9 + --> $DIR/issue-38371.rs:34:9 | LL | fn ugh(&[bar]: &u32) { //~ ERROR expected an array or slice | ^^^^^ pattern cannot match with input type `u32` diff --git a/src/test/ui/non-exhaustive-pattern-witness.rs b/src/test/ui/non-exhaustive-pattern-witness.rs index 0b12a9acbcb..dd14a10a2bc 100644 --- a/src/test/ui/non-exhaustive-pattern-witness.rs +++ b/src/test/ui/non-exhaustive-pattern-witness.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(advanced_slice_patterns)] #![feature(slice_patterns)] struct Foo { diff --git a/src/test/ui/non-exhaustive-pattern-witness.stderr b/src/test/ui/non-exhaustive-pattern-witness.stderr index 7179b4b135a..e364e822ea8 100644 --- a/src/test/ui/non-exhaustive-pattern-witness.stderr +++ b/src/test/ui/non-exhaustive-pattern-witness.stderr @@ -1,41 +1,41 @@ error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:20:11 + --> $DIR/non-exhaustive-pattern-witness.rs:19:11 | LL | match (Foo { first: true, second: None }) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered error[E0004]: non-exhaustive patterns: `Red` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:36:11 + --> $DIR/non-exhaustive-pattern-witness.rs:35:11 | LL | match Color::Red { | ^^^^^^^^^^ pattern `Red` not covered error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:48:11 + --> $DIR/non-exhaustive-pattern-witness.rs:47:11 | LL | match Direction::North { | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered - --> $DIR/non-exhaustive-pattern-witness.rs:59:11 + --> $DIR/non-exhaustive-pattern-witness.rs:58:11 | LL | match ExcessiveEnum::First { | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:67:11 + --> $DIR/non-exhaustive-pattern-witness.rs:66:11 | LL | match Color::Red { | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered error[E0004]: non-exhaustive patterns: `[Second(true), Second(false)]` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:83:11 + --> $DIR/non-exhaustive-pattern-witness.rs:82:11 | LL | match *x { | ^^ pattern `[Second(true), Second(false)]` not covered error[E0004]: non-exhaustive patterns: `((), false)` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:96:11 + --> $DIR/non-exhaustive-pattern-witness.rs:95:11 | LL | match ((), false) { | ^^^^^^^^^^^ pattern `((), false)` not covered diff --git a/src/test/ui/pat-slice-old-style.rs b/src/test/ui/pat-slice-old-style.rs index 4ff1e94b087..65578e76d6d 100644 --- a/src/test/ui/pat-slice-old-style.rs +++ b/src/test/ui/pat-slice-old-style.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] - // NB: this test was introduced in #23121 and will have to change when default match binding modes // stabilizes. +#![feature(slice_patterns)] + fn slice_pat(x: &[u8]) { // OLD! match x { diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.rs b/src/test/ui/rfc-2005-default-binding-mode/slice.rs index 40aa957242c..20ef0624bf9 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slice_patterns)] #![feature(match_default_bindings)] +#![feature(slice_patterns)] pub fn main() { let sl: &[u8] = b"foo"; -- GitLab