about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-10-28 15:09:12 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-10-28 15:25:33 +0200
commit7a0aee74bf15446a235830c0ea7a32ac1ea765a4 (patch)
tree5437e48772652930646fb5f8603c40752df6e79b /src
parent8e65dffc30b854179a366272957be661a6fdb7bd (diff)
Move to short type parameter keywords
Issue #1076
Diffstat (limited to 'src')
-rw-r--r--src/comp/middle/kind.rs4
-rw-r--r--src/comp/syntax/parse/parser.rs10
-rw-r--r--src/comp/syntax/print/pprust.rs4
-rw-r--r--src/lib/comm.rs20
-rw-r--r--src/lib/task.rs10
5 files changed, 24 insertions, 24 deletions
diff --git a/src/comp/middle/kind.rs b/src/comp/middle/kind.rs
index 149e463c111..e76c95b6560 100644
--- a/src/comp/middle/kind.rs
+++ b/src/comp/middle/kind.rs
@@ -26,9 +26,9 @@
 *
 * Since this forms a lattice, we denote the capabilites in terms of a
 * worst-case requirement. That is, if your function needs to move-and-send (or
-* copy) your T, you write fn<unique T>(...). If you need to move but not send,
+* copy) your T, you write fn<uniq T>(...). If you need to move but not send,
 * you write fn<T>(...). And if you need neither -- can work with any sort of
-* pinned data at all -- then you write fn<pinned T>(...).
+* pinned data at all -- then you write fn<pin T>(...).
 *
 * Most types are unique or shared. Other possible name combinations for these
 * two: (tree, graph; pruned, pooled; message, local; owned, common) are
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index ee308c55af5..9c33901741a 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -1735,11 +1735,11 @@ fn parse_block_tail(p: parser, lo: uint, s: ast::blk_check_mode) -> ast::blk {
 }
 
 fn parse_ty_param(p: parser) -> ast::ty_param {
-    let k = if eat_word(p, "pinned") || eat_word(p, "pin") {
-        ast::kind_pinned
-    } else if eat_word(p, "unique") || eat_word(p, "uniq") {
-        ast::kind_unique
-    } else { eat_word(p, "shar"); ast::kind_shared };
+    let k = if eat_word(p, "pin") { ast::kind_pinned }
+            else if eat_word(p, "uniq") { ast::kind_unique }
+            else if eat_word(p, "shar") { ast::kind_shared }
+            // FIXME distinguish implied shared from explicit
+            else { ast::kind_shared };
     ret {ident: parse_ident(p), kind: k};
 }
 
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index e95ce36252f..f30688f7ee5 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -1193,8 +1193,8 @@ fn print_arg_mode(s: ps, m: ast::mode) {
 
 fn print_kind(s: ps, kind: ast::kind) {
     alt kind {
-      ast::kind_unique. { word_nbsp(s, "unique"); }
-      ast::kind_pinned. { word_nbsp(s, "pinned"); }
+      ast::kind_unique. { word_nbsp(s, "uniq"); }
+      ast::kind_pinned. { word_nbsp(s, "pin"); }
       _ {/* fallthrough */ }
     }
 }
diff --git a/src/lib/comm.rs b/src/lib/comm.rs
index f6d150bc295..7599bb24185 100644
--- a/src/lib/comm.rs
+++ b/src/lib/comm.rs
@@ -41,9 +41,9 @@ native "c-stack-cdecl" mod rustrt {
     type void;
     type rust_port;
 
-    fn chan_id_send<unique T>(t: *sys::type_desc,
-                              target_task: task::task, target_port: port_id,
-                              -data: T);
+    fn chan_id_send<uniq T>(t: *sys::type_desc,
+                            target_task: task::task, target_port: port_id,
+                            -data: T);
 
     fn new_port(unit_sz: uint) -> *rust_port;
     fn del_port(po: *rust_port);
@@ -52,7 +52,7 @@ native "c-stack-cdecl" mod rustrt {
 }
 
 native "rust-intrinsic" mod rusti {
-    fn recv<unique T>(port: *rustrt::rust_port) -> T;
+    fn recv<uniq T>(port: *rustrt::rust_port) -> T;
 }
 
 type port_id = int;
@@ -75,7 +75,7 @@ dropped.
 
 Channels may be duplicated and themselves transmitted over other channels.
 */
-tag chan<unique T> {
+tag chan<uniq T> {
     chan_t(task::task, port_id);
 }
 
@@ -95,7 +95,7 @@ transmitted. If a port value is copied, both copies refer to the same port.
 
 Ports may be associated with multiple <chan>s.
 */
-tag port<unique T> { port_t(@port_ptr); }
+tag port<uniq T> { port_t(@port_ptr); }
 
 /*
 Function: send
@@ -105,7 +105,7 @@ Sends data over a channel.
 The sent data is moved into the channel, whereupon the caller loses access
 to it.
 */
-fn send<unique T>(ch: chan<T>, -data: T) {
+fn send<uniq T>(ch: chan<T>, -data: T) {
     let chan_t(t, p) = ch;
     rustrt::chan_id_send(sys::get_type_desc::<T>(), t, p, data);
     task::yield();
@@ -116,7 +116,7 @@ Function: port
 
 Constructs a port.
 */
-fn port<unique T>() -> port<T> {
+fn port<uniq T>() -> port<T> {
     port_t(@port_ptr(rustrt::new_port(sys::size_of::<T>())))
 }
 
@@ -128,7 +128,7 @@ Receive from a port.
 If no data is available on the port then the task will block until data
 becomes available.
 */
-fn recv<unique T>(p: port<T>) -> T { ret rusti::recv(***p) }
+fn recv<uniq T>(p: port<T>) -> T { ret rusti::recv(***p) }
 
 /*
 Function: chan
@@ -137,6 +137,6 @@ Constructs a channel.
 
 The channel is bound to the port used to construct it.
 */
-fn chan<unique T>(p: port<T>) -> chan<T> {
+fn chan<uniq T>(p: port<T>) -> chan<T> {
     chan_t(task::get_task(), rustrt::get_port_id(***p))
 }
diff --git a/src/lib/task.rs b/src/lib/task.rs
index 41585684720..1b5ebb999cf 100644
--- a/src/lib/task.rs
+++ b/src/lib/task.rs
@@ -228,7 +228,7 @@ Returns:
 
 A handle to the new task
 */
-fn spawn<unique T>(-data: T, f: fn(T)) -> task {
+fn spawn<uniq T>(-data: T, f: fn(T)) -> task {
     spawn_inner(data, f, none)
 }
 
@@ -241,7 +241,7 @@ termination
 Immediately before termination, either on success or failure, the spawned
 task will send a <task_notification> message on the provided channel.
 */
-fn spawn_notify<unique T>(-data: T, f: fn(T),
+fn spawn_notify<uniq T>(-data: T, f: fn(T),
                          notify: comm::chan<task_notification>) -> task {
     spawn_inner(data, f, some(notify))
 }
@@ -255,7 +255,7 @@ This is a convenience wrapper around spawn_notify which, when paired
 with <join> can be easily used to spawn a task then wait for it to
 complete.
 */
-fn spawn_joinable<unique T>(-data: T, f: fn(T)) -> joinable_task {
+fn spawn_joinable<uniq T>(-data: T, f: fn(T)) -> joinable_task {
     let p = comm::port::<task_notification>();
     let id = spawn_notify(data, f, comm::chan::<task_notification>(p));
     ret (id, p);
@@ -271,11 +271,11 @@ fn spawn_joinable<unique T>(-data: T, f: fn(T)) -> joinable_task {
 //
 // After the transition this should all be rewritten.
 
-fn spawn_inner<unique T>(-data: T, f: fn(T),
+fn spawn_inner<uniq T>(-data: T, f: fn(T),
                           notify: option<comm::chan<task_notification>>)
     -> task {
 
-    fn wrapper<unique T>(-data: *u8, f: fn(T)) {
+    fn wrapper<uniq T>(-data: *u8, f: fn(T)) {
         let data: ~T = unsafe::reinterpret_cast(data);
         f(*data);
     }