about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-06-10 19:42:28 -0700
committerCorey Richardson <corey@octayn.net>2013-06-28 10:44:16 -0400
commit3fcd4dca301d01c41a7db7f9023bc11be1025fc7 (patch)
treeabc5173630ace3daaf3a0aab1e1890f51f988ef8 /src
parent8cd40f9032fa15dc083646ba2105b3fae0a96eb5 (diff)
downloadrust-3fcd4dca301d01c41a7db7f9023bc11be1025fc7.tar.gz
rust-3fcd4dca301d01c41a7db7f9023bc11be1025fc7.zip
libsyntax: Remove "copy" pattern bindings from the language
Diffstat (limited to 'src')
-rw-r--r--src/libsyntax/parse/obsolete.rs5
-rw-r--r--src/libsyntax/parse/parser.rs4
-rw-r--r--src/test/compile-fail/rcmut-not-const-and-not-owned.rs8
3 files changed, 11 insertions, 6 deletions
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 383faf22037..7f2d06ee1e4 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -63,6 +63,7 @@ pub enum ObsoleteSyntax {
     ObsoleteNamedExternModule,
     ObsoleteMultipleLocalDecl,
     ObsoleteMutWithMultipleBindings,
+    ObsoletePatternCopyKeyword,
 }
 
 impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -229,6 +230,10 @@ impl Parser {
                 "use multiple local declarations instead of e.g. `let mut \
                  (x, y) = ...`."
             ),
+            ObsoletePatternCopyKeyword => (
+                "`copy` in patterns",
+                "`copy` in patterns no longer has any effect"
+            ),
         };
 
         self.report(sp, kind, kind_str, desc);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 5981e39abb7..ee5ef8dfa6b 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -84,6 +84,7 @@ use parse::obsolete::{ObsoletePurity, ObsoleteStaticMethod};
 use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType};
 use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl};
 use parse::obsolete::{ObsoleteMutWithMultipleBindings};
+use parse::obsolete::{ObsoletePatternCopyKeyword};
 use parse::token::{can_begin_expr, get_ident_interner, ident_to_str, is_ident};
 use parse::token::{is_ident_or_path};
 use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents};
@@ -2445,8 +2446,7 @@ impl Parser {
                 pat = self.parse_pat_ident(bind_by_ref(mutbl));
             } else if self.eat_keyword(keywords::Copy) {
                 // parse copy pat
-                self.warn("copy keyword in patterns no longer has any effect, \
-                           remove it");
+                self.obsolete(*self.span, ObsoletePatternCopyKeyword);
                 pat = self.parse_pat_ident(bind_infer);
             } else {
                 let can_be_enum_or_struct;
diff --git a/src/test/compile-fail/rcmut-not-const-and-not-owned.rs b/src/test/compile-fail/rcmut-not-const-and-not-owned.rs
index 9e7236a67d9..45cb137b084 100644
--- a/src/test/compile-fail/rcmut-not-const-and-not-owned.rs
+++ b/src/test/compile-fail/rcmut-not-const-and-not-owned.rs
@@ -10,11 +10,11 @@
 
 extern mod extra;
 
-fn o<T: Owned>(_: &T) {}
-fn c<T: Const>(_: &T) {}
+fn o<T: Send>(_: &T) {}
+fn c<T: Freeze>(_: &T) {}
 
 fn main() {
     let x = extra::rc::rc_mut_from_owned(0);
-    o(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Owned`
-    c(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Const`
+    o(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Send`
+    c(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Freeze`
 }