about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2015-04-15 22:12:12 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2015-04-21 10:08:26 -0700
commitca0ee4c6454fd272457e98c20a461ec9f93b2ac4 (patch)
tree5f77166d75b390418365c6f16be787ca7a23f0ef /src/libsyntax/ext
parenta4541b02a33e7c4fdcc8f50459bad6ab99463919 (diff)
downloadrust-ca0ee4c6454fd272457e98c20a461ec9f93b2ac4.tar.gz
rust-ca0ee4c6454fd272457e98c20a461ec9f93b2ac4.zip
syntax: Remove uses of #[feature(slice_patterns)]
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/deriving/cmp/ord.rs4
-rw-r--r--src/libsyntax/ext/deriving/cmp/partial_eq.rs8
-rw-r--r--src/libsyntax/ext/deriving/cmp/partial_ord.rs8
-rw-r--r--src/libsyntax/ext/deriving/hash.rs4
-rw-r--r--src/libsyntax/ext/deriving/primitive.rs4
-rw-r--r--src/libsyntax/ext/expand.rs4
-rw-r--r--src/libsyntax/ext/trace_macros.rs7
7 files changed, 19 insertions, 20 deletions
diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs
index b2a4ef1dafb..94cc0d9c493 100644
--- a/src/libsyntax/ext/deriving/cmp/ord.rs
+++ b/src/libsyntax/ext/deriving/cmp/ord.rs
@@ -106,8 +106,8 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
             // }
 
             let new = {
-                let other_f = match other_fs {
-                    [ref o_f] => o_f,
+                let other_f = match (other_fs.len(), other_fs.get(0)) {
+                    (1, Some(o_f)) => o_f,
                     _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"),
                 };
 
diff --git a/src/libsyntax/ext/deriving/cmp/partial_eq.rs b/src/libsyntax/ext/deriving/cmp/partial_eq.rs
index f02e5ee1412..61eb81c6755 100644
--- a/src/libsyntax/ext/deriving/cmp/partial_eq.rs
+++ b/src/libsyntax/ext/deriving/cmp/partial_eq.rs
@@ -29,8 +29,8 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
         cs_fold(
             true,  // use foldl
             |cx, span, subexpr, self_f, other_fs| {
-                let other_f = match other_fs {
-                    [ref o_f] => o_f,
+                let other_f = match (other_fs.len(), other_fs.get(0)) {
+                    (1, Some(o_f)) => o_f,
                     _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`")
                 };
 
@@ -46,8 +46,8 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
         cs_fold(
             true,  // use foldl
             |cx, span, subexpr, self_f, other_fs| {
-                let other_f = match other_fs {
-                    [ref o_f] => o_f,
+                let other_f = match (other_fs.len(), other_fs.get(0)) {
+                    (1, Some(o_f)) => o_f,
                     _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`")
                 };
 
diff --git a/src/libsyntax/ext/deriving/cmp/partial_ord.rs b/src/libsyntax/ext/deriving/cmp/partial_ord.rs
index fe6a8fea78c..dbb779decac 100644
--- a/src/libsyntax/ext/deriving/cmp/partial_ord.rs
+++ b/src/libsyntax/ext/deriving/cmp/partial_ord.rs
@@ -150,8 +150,8 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
             // }
 
             let new = {
-                let other_f = match other_fs {
-                    [ref o_f] => o_f,
+                let other_f = match (other_fs.len(), other_fs.get(0)) {
+                    (1, Some(o_f)) => o_f,
                     _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"),
                 };
 
@@ -208,8 +208,8 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt,
             get use the binops to avoid auto-deref dereferencing too many
             layers of pointers, if the type includes pointers.
             */
-            let other_f = match other_fs {
-                [ref o_f] => o_f,
+            let other_f = match (other_fs.len(), other_fs.get(0)) {
+                (1, Some(o_f)) => o_f,
                 _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`")
             };
 
diff --git a/src/libsyntax/ext/deriving/hash.rs b/src/libsyntax/ext/deriving/hash.rs
index 915d9979615..b9835eda791 100644
--- a/src/libsyntax/ext/deriving/hash.rs
+++ b/src/libsyntax/ext/deriving/hash.rs
@@ -56,8 +56,8 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
 }
 
 fn hash_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<Expr> {
-    let state_expr = match substr.nonself_args {
-        [ref state_expr] => state_expr,
+    let state_expr = match (substr.nonself_args.len(), substr.nonself_args.get(0)) {
+        (1, Some(o_f)) => o_f,
         _ => cx.span_bug(trait_span, "incorrect number of arguments in `derive(Hash)`")
     };
     let call_hash = |span, thing_expr| {
diff --git a/src/libsyntax/ext/deriving/primitive.rs b/src/libsyntax/ext/deriving/primitive.rs
index 3d0645fd6e3..a972cfe1355 100644
--- a/src/libsyntax/ext/deriving/primitive.rs
+++ b/src/libsyntax/ext/deriving/primitive.rs
@@ -71,8 +71,8 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
 }
 
 fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<Expr> {
-    let n = match substr.nonself_args {
-        [ref n] => n,
+    let n = match (substr.nonself_args.len(), substr.nonself_args.get(0)) {
+        (1, Some(o_f)) => o_f,
         _ => cx.span_bug(trait_span, "incorrect number of arguments in `derive(FromPrimitive)`")
     };
 
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 0945f8dd021..d1db956adb3 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1962,8 +1962,8 @@ foo_module!();
                 "xx" == string
             }).collect();
         let cxbinds: &[&ast::Ident] = &cxbinds[..];
-        let cxbind = match cxbinds {
-            [b] => b,
+        let cxbind = match (cxbinds.len(), cxbinds.get(0)) {
+            (1, Some(b)) => *b,
             _ => panic!("expected just one binding for ext_cx")
         };
         let resolved_binding = mtwt::resolve(*cxbind);
diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs
index 3fcc6a8d692..646e6fec405 100644
--- a/src/libsyntax/ext/trace_macros.rs
+++ b/src/libsyntax/ext/trace_macros.rs
@@ -28,12 +28,11 @@ pub fn expand_trace_macros(cx: &mut ExtCtxt,
         return base::DummyResult::any(sp);
     }
 
-
-    match tt {
-        [ast::TtToken(_, ref tok)] if tok.is_keyword(keywords::True) => {
+    match (tt.len(), tt.first()) {
+        (1, Some(&ast::TtToken(_, ref tok))) if tok.is_keyword(keywords::True) => {
             cx.set_trace_macros(true);
         }
-        [ast::TtToken(_, ref tok)] if tok.is_keyword(keywords::False) => {
+        (1, Some(&ast::TtToken(_, ref tok))) if tok.is_keyword(keywords::False) => {
             cx.set_trace_macros(false);
         }
         _ => cx.span_err(sp, "trace_macros! accepts only `true` or `false`"),