about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-05-10 15:15:06 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-05-12 16:35:18 -0700
commit5d3559e6455757c5508bba5b5add69477ebac53e (patch)
tree71e166364df7f828c4c98c5853597d2c62c37fac /src/libcore
parent06ef889cdc77db862d526bf6a607ecdf3ee80beb (diff)
downloadrust-5d3559e6455757c5508bba5b5add69477ebac53e.tar.gz
rust-5d3559e6455757c5508bba5b5add69477ebac53e.zip
librustc: Make `self` and `static` into keywords
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/cell.rs12
-rw-r--r--src/libcore/old_iter.rs64
-rw-r--r--src/libcore/rt/sched/mod.rs40
-rw-r--r--src/libcore/rt/uv/net.rs4
-rw-r--r--src/libcore/rt/uvio.rs4
5 files changed, 63 insertions, 61 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index 18e75fb1aa9..6f0e03fb895 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -44,21 +44,21 @@ pub fn empty_cell<T>() -> Cell<T> {
 pub impl<T> Cell<T> {
     /// Yields the value, failing if the cell is empty.
     fn take(&self) -> T {
-        let self = unsafe { transmute_mut(self) };
-        if self.is_empty() {
+        let this = unsafe { transmute_mut(self) };
+        if this.is_empty() {
             fail!(~"attempt to take an empty cell");
         }
 
-        replace(&mut self.value, None).unwrap()
+        replace(&mut this.value, None).unwrap()
     }
 
     /// Returns the value, failing if the cell is full.
     fn put_back(&self, value: T) {
-        let self = unsafe { transmute_mut(self) };
-        if !self.is_empty() {
+        let this = unsafe { transmute_mut(self) };
+        if !this.is_empty() {
             fail!(~"attempt to put a value back into a full cell");
         }
-        self.value = Some(value);
+        this.value = Some(value);
     }
 
     /// Returns true if the cell is empty and false if the cell is full.
diff --git a/src/libcore/old_iter.rs b/src/libcore/old_iter.rs
index a596b07dc78..95bc8872c91 100644
--- a/src/libcore/old_iter.rs
+++ b/src/libcore/old_iter.rs
@@ -116,10 +116,12 @@ pub trait Buildable<A> {
 }
 
 #[inline(always)]
-pub fn _eachi<A,IA:BaseIter<A>>(self: &IA, blk: &fn(uint, &A) -> bool) -> bool {
+pub fn _eachi<A,IA:BaseIter<A>>(this: &IA, blk: &fn(uint, &A) -> bool) -> bool {
     let mut i = 0;
-    for self.each |a| {
-        if !blk(i, a) { return false; }
+    for this.each |a| {
+        if !blk(i, a) {
+            return false;
+        }
         i += 1;
     }
     return true;
@@ -135,47 +137,47 @@ pub fn eachi<A,IA:BaseIter<A>>(self: &IA, blk: &fn(uint, &A) -> bool) -> bool {
 }
 
 #[inline(always)]
-pub fn all<A,IA:BaseIter<A>>(self: &IA, blk: &fn(&A) -> bool) -> bool {
-    for self.each |a| {
+pub fn all<A,IA:BaseIter<A>>(this: &IA, blk: &fn(&A) -> bool) -> bool {
+    for this.each |a| {
         if !blk(a) { return false; }
     }
     return true;
 }
 
 #[inline(always)]
-pub fn any<A,IA:BaseIter<A>>(self: &IA, blk: &fn(&A) -> bool) -> bool {
-    for self.each |a| {
+pub fn any<A,IA:BaseIter<A>>(this: &IA, blk: &fn(&A) -> bool) -> bool {
+    for this.each |a| {
         if blk(a) { return true; }
     }
     return false;
 }
 
 #[inline(always)]
-pub fn filter_to_vec<A:Copy,IA:BaseIter<A>>(self: &IA,
+pub fn filter_to_vec<A:Copy,IA:BaseIter<A>>(this: &IA,
                                             prd: &fn(&A) -> bool)
                                          -> ~[A] {
-    do vec::build_sized_opt(self.size_hint()) |push| {
-        for self.each |a| {
+    do vec::build_sized_opt(this.size_hint()) |push| {
+        for this.each |a| {
             if prd(a) { push(*a); }
         }
     }
 }
 
 #[inline(always)]
-pub fn map_to_vec<A,B,IA:BaseIter<A>>(self: &IA, op: &fn(&A) -> B) -> ~[B] {
-    do vec::build_sized_opt(self.size_hint()) |push| {
-        for self.each |a| {
+pub fn map_to_vec<A,B,IA:BaseIter<A>>(this: &IA, op: &fn(&A) -> B) -> ~[B] {
+    do vec::build_sized_opt(this.size_hint()) |push| {
+        for this.each |a| {
             push(op(a));
         }
     }
 }
 
 #[inline(always)]
-pub fn flat_map_to_vec<A,B,IA:BaseIter<A>,IB:BaseIter<B>>(self: &IA,
+pub fn flat_map_to_vec<A,B,IA:BaseIter<A>,IB:BaseIter<B>>(this: &IA,
                                                           op: &fn(&A) -> IB)
                                                        -> ~[B] {
     do vec::build |push| {
-        for self.each |a| {
+        for this.each |a| {
             for op(a).each |&b| {
                 push(b);
             }
@@ -184,31 +186,31 @@ pub fn flat_map_to_vec<A,B,IA:BaseIter<A>,IB:BaseIter<B>>(self: &IA,
 }
 
 #[inline(always)]
-pub fn foldl<A,B,IA:BaseIter<A>>(self: &IA, b0: B, blk: &fn(&B, &A) -> B)
+pub fn foldl<A,B,IA:BaseIter<A>>(this: &IA, b0: B, blk: &fn(&B, &A) -> B)
                               -> B {
     let mut b = b0;
-    for self.each |a| {
+    for this.each |a| {
         b = blk(&b, a);
     }
     b
 }
 
 #[inline(always)]
-pub fn to_vec<A:Copy,IA:BaseIter<A>>(self: &IA) -> ~[A] {
-    map_to_vec(self, |&x| x)
+pub fn to_vec<A:Copy,IA:BaseIter<A>>(this: &IA) -> ~[A] {
+    map_to_vec(this, |&x| x)
 }
 
 #[inline(always)]
-pub fn contains<A:Eq,IA:BaseIter<A>>(self: &IA, x: &A) -> bool {
-    for self.each |a| {
+pub fn contains<A:Eq,IA:BaseIter<A>>(this: &IA, x: &A) -> bool {
+    for this.each |a| {
         if *a == *x { return true; }
     }
     return false;
 }
 
 #[inline(always)]
-pub fn count<A:Eq,IA:BaseIter<A>>(self: &IA, x: &A) -> uint {
-    do foldl(self, 0) |count, value| {
+pub fn count<A:Eq,IA:BaseIter<A>>(this: &IA, x: &A) -> uint {
+    do foldl(this, 0) |count, value| {
         if *value == *x {
             *count + 1
         } else {
@@ -218,10 +220,10 @@ pub fn count<A:Eq,IA:BaseIter<A>>(self: &IA, x: &A) -> uint {
 }
 
 #[inline(always)]
-pub fn position<A,IA:BaseIter<A>>(self: &IA, f: &fn(&A) -> bool)
+pub fn position<A,IA:BaseIter<A>>(this: &IA, f: &fn(&A) -> bool)
                                -> Option<uint> {
     let mut i = 0;
-    for self.each |a| {
+    for this.each |a| {
         if f(a) { return Some(i); }
         i += 1;
     }
@@ -253,8 +255,8 @@ pub fn repeat(times: uint, blk: &fn() -> bool) -> bool {
 }
 
 #[inline(always)]
-pub fn min<A:Copy + Ord,IA:BaseIter<A>>(self: &IA) -> A {
-    match do foldl::<A,Option<A>,IA>(self, None) |a, b| {
+pub fn min<A:Copy + Ord,IA:BaseIter<A>>(this: &IA) -> A {
+    match do foldl::<A,Option<A>,IA>(this, None) |a, b| {
         match a {
           &Some(ref a_) if *a_ < *b => {
              *(a)
@@ -268,8 +270,8 @@ pub fn min<A:Copy + Ord,IA:BaseIter<A>>(self: &IA) -> A {
 }
 
 #[inline(always)]
-pub fn max<A:Copy + Ord,IA:BaseIter<A>>(self: &IA) -> A {
-    match do foldl::<A,Option<A>,IA>(self, None) |a, b| {
+pub fn max<A:Copy + Ord,IA:BaseIter<A>>(this: &IA) -> A {
+    match do foldl::<A,Option<A>,IA>(this, None) |a, b| {
         match a {
           &Some(ref a_) if *a_ > *b => {
               *(a)
@@ -283,9 +285,9 @@ pub fn max<A:Copy + Ord,IA:BaseIter<A>>(self: &IA) -> A {
 }
 
 #[inline(always)]
-pub fn find<A:Copy,IA:BaseIter<A>>(self: &IA, f: &fn(&A) -> bool)
+pub fn find<A:Copy,IA:BaseIter<A>>(this: &IA, f: &fn(&A) -> bool)
                                 -> Option<A> {
-    for self.each |i| {
+    for this.each |i| {
         if f(i) { return Some(*i) }
     }
     return None;
diff --git a/src/libcore/rt/sched/mod.rs b/src/libcore/rt/sched/mod.rs
index 663fe3e62d0..ba057254583 100644
--- a/src/libcore/rt/sched/mod.rs
+++ b/src/libcore/rt/sched/mod.rs
@@ -118,15 +118,15 @@ pub impl Scheduler {
     fn resume_task_from_queue(~self) -> bool {
         assert!(!self.in_task_context());
 
-        let mut self = self;
-        match self.task_queue.pop_front() {
+        let mut this = self;
+        match this.task_queue.pop_front() {
             Some(task) => {
-                self.resume_task_immediately(task);
+                this.resume_task_immediately(task);
                 return true;
             }
             None => {
                 rtdebug!("no tasks in queue");
-                local_sched::put(self);
+                local_sched::put(this);
                 return false;
             }
         }
@@ -165,16 +165,16 @@ pub impl Scheduler {
     // Core scheduling ops
 
     fn resume_task_immediately(~self, task: ~Task) {
-        let mut self = self;
-        assert!(!self.in_task_context());
+        let mut this = self;
+        assert!(!this.in_task_context());
 
         rtdebug!("scheduling a task");
 
         // Store the task in the scheduler so it can be grabbed later
-        self.current_task = Some(task);
-        self.enqueue_cleanup_job(DoNothing);
+        this.current_task = Some(task);
+        this.enqueue_cleanup_job(DoNothing);
 
-        local_sched::put(self);
+        local_sched::put(this);
 
         // Take pointers to both the task and scheduler's saved registers.
         unsafe {
@@ -203,17 +203,17 @@ pub impl Scheduler {
     /// running task.  It gets transmuted to the scheduler's lifetime
     /// and called while the task is blocked.
     fn deschedule_running_task_and_then(~self, f: &fn(~Task)) {
-        let mut self = self;
-        assert!(self.in_task_context());
+        let mut this = self;
+        assert!(this.in_task_context());
 
         rtdebug!("blocking task");
 
-        let blocked_task = self.current_task.swap_unwrap();
+        let blocked_task = this.current_task.swap_unwrap();
         let f_fake_region = unsafe { transmute::<&fn(~Task), &fn(~Task)>(f) };
         let f_opaque = ClosureConverter::from_fn(f_fake_region);
-        self.enqueue_cleanup_job(GiveTask(blocked_task, f_opaque));
+        this.enqueue_cleanup_job(GiveTask(blocked_task, f_opaque));
 
-        local_sched::put(self);
+        local_sched::put(this);
 
         let sched = unsafe { local_sched::unsafe_borrow() };
         let (sched_context, last_task_context, _) = sched.get_contexts();
@@ -229,18 +229,18 @@ pub impl Scheduler {
     /// You would want to think hard about doing this, e.g. if there are
     /// pending I/O events it would be a bad idea.
     fn switch_running_tasks_and_then(~self, next_task: ~Task, f: &fn(~Task)) {
-        let mut self = self;
-        assert!(self.in_task_context());
+        let mut this = self;
+        assert!(this.in_task_context());
 
         rtdebug!("switching tasks");
 
-        let old_running_task = self.current_task.swap_unwrap();
+        let old_running_task = this.current_task.swap_unwrap();
         let f_fake_region = unsafe { transmute::<&fn(~Task), &fn(~Task)>(f) };
         let f_opaque = ClosureConverter::from_fn(f_fake_region);
-        self.enqueue_cleanup_job(GiveTask(old_running_task, f_opaque));
-        self.current_task = Some(next_task);
+        this.enqueue_cleanup_job(GiveTask(old_running_task, f_opaque));
+        this.current_task = Some(next_task);
 
-        local_sched::put(self);
+        local_sched::put(this);
 
         unsafe {
             let sched = local_sched::unsafe_borrow();
diff --git a/src/libcore/rt/uv/net.rs b/src/libcore/rt/uv/net.rs
index 068d6db2a43..376231e3b27 100644
--- a/src/libcore/rt/uv/net.rs
+++ b/src/libcore/rt/uv/net.rs
@@ -141,8 +141,8 @@ pub impl StreamWatcher {
 
     fn close(self, cb: NullCallback) {
         {
-            let mut self = self;
-            let data = get_watcher_data(&mut self);
+            let mut this = self;
+            let data = get_watcher_data(&mut this);
             assert!(data.close_cb.is_none());
             data.close_cb = Some(cb);
         }
diff --git a/src/libcore/rt/uvio.rs b/src/libcore/rt/uvio.rs
index 62a165b6d77..8f1a6ea0d34 100644
--- a/src/libcore/rt/uvio.rs
+++ b/src/libcore/rt/uvio.rs
@@ -43,10 +43,10 @@ pub impl UvEventLoop {
 impl Drop for UvEventLoop {
     fn finalize(&self) {
         // XXX: Need mutable finalizer
-        let self = unsafe {
+        let this = unsafe {
             transmute::<&UvEventLoop, &mut UvEventLoop>(self)
         };
-        self.uvio.uv_loop().close();
+        this.uvio.uv_loop().close();
     }
 }