about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-07-16 20:17:57 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-07-16 20:18:18 -0700
commit0e42004babc7b965a10056084a8ae76c72140a44 (patch)
treedd0484f1854d0c059b61516ee42812f16751fd94 /src/libsyntax/parse
parentd809336d0f5f4efa11336878736aeefe1fbae895 (diff)
downloadrust-0e42004babc7b965a10056084a8ae76c72140a44.tar.gz
rust-0e42004babc7b965a10056084a8ae76c72140a44.zip
introduce an owned kind for data that contains no borrowed ptrs
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs17
-rw-r--r--src/libsyntax/parse/token.rs2
2 files changed, 12 insertions, 7 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index fa0361e797b..dcc8f7430ca 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -16,7 +16,8 @@ import dvec::{dvec, extensions};
 import vec::{push};
 import ast::{_mod, add, alt_check, alt_exhaustive, arg, arm, attribute,
              bitand, bitor, bitxor, blk, blk_check_mode, bound_const,
-             bound_copy, bound_send, bound_trait, box, by_copy, by_move,
+             bound_copy, bound_send, bound_trait, bound_owned,
+             box, by_copy, by_move,
              by_mutbl_ref, by_ref, by_val, capture_clause, capture_item,
              carg_base, carg_ident, cdir_dir_mod, cdir_src_mod,
              cdir_view_item, checked_expr, claimed_expr, class_immutable,
@@ -1935,12 +1936,16 @@ class parser {
         let ident = self.parse_ident();
         if self.eat(token::COLON) {
             while self.token != token::COMMA && self.token != token::GT {
-                if self.eat_keyword(~"send") { push(bounds, bound_send); }
-                else if self.eat_keyword(~"copy") { push(bounds, bound_copy) }
+                if self.eat_keyword(~"send") {
+                    push(bounds, bound_send); }
+                else if self.eat_keyword(~"copy") {
+                    push(bounds, bound_copy) }
                 else if self.eat_keyword(~"const") {
-                    push(bounds, bound_const)
-                }
-                else { push(bounds, bound_trait(self.parse_ty(false))); }
+                    push(bounds, bound_const);
+                } else if self.eat_keyword(~"owned") {
+                    push(bounds, bound_owned);
+                } else {
+                    push(bounds, bound_trait(self.parse_ty(false))); }
             }
         }
         ret {ident: ident, id: self.get_id(), bounds: @bounds};
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index eb8c5b65fa5..949b078d8f0 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -313,7 +313,7 @@ fn restricted_keyword_table() -> hashmap<~str, ()> {
         ~"if", ~"iface", ~"impl", ~"import",
         ~"let", ~"log", ~"loop",
         ~"mod", ~"mut",
-        ~"new",
+        ~"new", ~"owned",
         ~"pure", ~"ret",
         ~"true", ~"trait", ~"type",
         ~"unchecked", ~"unsafe",