]> git.lizzy.rs Git - rust.git/commitdiff
Remove all uses of `pub impl`. rs=style
authorPatrick Walton <pcwalton@mimiga.net>
Fri, 31 May 2013 22:17:22 +0000 (15:17 -0700)
committerPatrick Walton <pcwalton@mimiga.net>
Sat, 1 Jun 2013 16:18:27 +0000 (09:18 -0700)
181 files changed:
src/libextra/arc.rs
src/libextra/arena.rs
src/libextra/bitv.rs
src/libextra/comm.rs
src/libextra/deque.rs
src/libextra/dlist.rs
src/libextra/ebml.rs
src/libextra/flatpipes.rs
src/libextra/future.rs
src/libextra/json.rs
src/libextra/net_tcp.rs
src/libextra/net_url.rs
src/libextra/num/bigint.rs
src/libextra/priority_queue.rs
src/libextra/rc.rs
src/libextra/smallintmap.rs
src/libextra/sync.rs
src/libextra/task_pool.rs
src/libextra/test.rs
src/libextra/time.rs
src/libextra/treemap.rs
src/libextra/workcache.rs
src/librustc/driver/session.rs
src/librustc/middle/astencode.rs
src/librustc/middle/borrowck/check_loans.rs
src/librustc/middle/borrowck/gather_loans/mod.rs
src/librustc/middle/borrowck/mod.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/liveness.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/moves.rs
src/librustc/middle/region.rs
src/librustc/middle/resolve.rs
src/librustc/middle/trans/cabi.rs
src/librustc/middle/trans/closure.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/datum.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/reflect.rs
src/librustc/middle/trans/tvec.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/regionck.rs
src/librustc/middle/typeck/check/vtable.rs
src/librustc/middle/typeck/coherence.rs
src/librustc/middle/typeck/infer/coercion.rs
src/librustc/middle/typeck/infer/lattice.rs
src/librustc/middle/typeck/infer/lub.rs
src/librustc/middle/typeck/infer/mod.rs
src/librustc/middle/typeck/infer/region_inference.rs
src/librustc/middle/typeck/infer/resolve.rs
src/librustc/middle/typeck/infer/test.rs
src/librustc/middle/typeck/infer/unify.rs
src/librustc/util/enum_set.rs
src/librustdoc/doc.rs
src/librustdoc/prune_private_pass.rs
src/librustdoc/sort_item_type_pass.rs
src/librustpkg/rustpkg.rc
src/librustpkg/util.rs
src/libstd/cell.rs
src/libstd/comm.rs
src/libstd/condition.rs
src/libstd/either.rs
src/libstd/hashmap.rs
src/libstd/option.rs
src/libstd/path.rs
src/libstd/pipes.rs
src/libstd/rand.rs
src/libstd/reflect.rs
src/libstd/repr.rs
src/libstd/result.rs
src/libstd/rt/context.rs
src/libstd/rt/sched.rs
src/libstd/rt/stack.rs
src/libstd/rt/thread.rs
src/libstd/rt/uv/idle.rs
src/libstd/rt/uv/mod.rs
src/libstd/rt/uv/net.rs
src/libstd/rt/uv/uvio.rs
src/libstd/rt/uvio.rs
src/libstd/rt/work_queue.rs
src/libstd/run.rs
src/libstd/str/ascii.rs
src/libstd/task/mod.rs
src/libstd/trie.rs
src/libstd/unstable/extfmt.rs
src/libstd/unstable/sync.rs
src/libstd/util.rs
src/libsyntax/abi.rs
src/libsyntax/ast.rs
src/libsyntax/ast_util.rs
src/libsyntax/codemap.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/deriving/ty.rs
src/libsyntax/ext/pipes/proto.rs
src/libsyntax/parse/common.rs
src/libsyntax/parse/obsolete.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pp.rs
src/libsyntax/util/interner.rs
src/test/auxiliary/anon_trait_static_method_lib.rs
src/test/auxiliary/cci_class_2.rs
src/test/auxiliary/cci_class_3.rs
src/test/auxiliary/cci_class_4.rs
src/test/auxiliary/cci_class_5.rs
src/test/auxiliary/cci_class_6.rs
src/test/auxiliary/cci_class_cast.rs
src/test/auxiliary/impl_privacy_xc_1.rs
src/test/auxiliary/issue_2472_b.rs
src/test/bench/core-set.rs
src/test/bench/noise.rs
src/test/bench/sudoku.rs
src/test/compile-fail/assign-to-method.rs
src/test/compile-fail/borrowck-auto-mut-ref-to-immut-var.rs
src/test/compile-fail/borrowck-autoref-3261.rs
src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs
src/test/compile-fail/borrowck-insert-during-each.rs
src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
src/test/compile-fail/class-cast-to-trait.rs
src/test/compile-fail/class-missing-self.rs
src/test/compile-fail/issue-2356.rs
src/test/compile-fail/issue-2766-a.rs
src/test/compile-fail/issue-3021-b.rs
src/test/compile-fail/issue-3080.rs
src/test/compile-fail/issue-3707.rs
src/test/compile-fail/issue-3763.rs
src/test/compile-fail/mutable-class-fields-2.rs
src/test/compile-fail/private-impl-method.rs
src/test/compile-fail/private-method.rs
src/test/compile-fail/regions-addr-of-self.rs
src/test/compile-fail/regions-addr-of-upvar-self.rs
src/test/compile-fail/regions-glb-free-free.rs
src/test/compile-fail/trait-or-new-type-instead.rs
src/test/compile-fail/use-after-move-self-based-on-type.rs
src/test/compile-fail/use-after-move-self.rs
src/test/run-pass/anon-trait-static-method.rs
src/test/run-pass/auto-ref-newtype.rs
src/test/run-pass/autoderef-and-borrow-method-receiver.rs
src/test/run-pass/borrowck-nested-calls.rs
src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs
src/test/run-pass/class-cast-to-trait-multiple-types.rs
src/test/run-pass/class-cast-to-trait.rs
src/test/run-pass/class-exports.rs
src/test/run-pass/class-impl-very-parameterized-trait.rs
src/test/run-pass/class-implement-trait-cross-crate.rs
src/test/run-pass/class-implement-traits.rs
src/test/run-pass/class-methods.rs
src/test/run-pass/class-poly-methods.rs
src/test/run-pass/class-separate-impl.rs
src/test/run-pass/class-typarams.rs
src/test/run-pass/classes-simple-method.rs
src/test/run-pass/classes.rs
src/test/run-pass/coerce-reborrow-imm-ptr-rcvr.rs
src/test/run-pass/coerce-reborrow-mut-ptr-rcvr.rs
src/test/run-pass/const-enum-byref-self.rs
src/test/run-pass/explicit-self-closures.rs
src/test/run-pass/explicit-self-generic.rs
src/test/run-pass/explicit-self.rs
src/test/run-pass/impl-implicit-trait.rs
src/test/run-pass/issue-2311-2.rs
src/test/run-pass/issue-2312.rs
src/test/run-pass/issue-2445-b.rs
src/test/run-pass/issue-2445.rs
src/test/run-pass/issue-2487-a.rs
src/test/run-pass/issue-2502.rs
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-3220.rs
src/test/run-pass/issue-3447.rs
src/test/run-pass/issue-3753.rs
src/test/run-pass/issue-3860.rs
src/test/run-pass/issue-3904.rs
src/test/run-pass/max-min-classes.rs
src/test/run-pass/move-self.rs
src/test/run-pass/nested-class.rs
src/test/run-pass/private-class-field.rs
src/test/run-pass/private-method.rs
src/test/run-pass/reflect-visit-data.rs
src/test/run-pass/regions-expl-self.rs
src/test/run-pass/resource-destruct.rs

index 1de2003aa99d592dda4aa143056a22367478601d..f4259afcaa3c17888a1e89c70dd0102fbc588fef 100644 (file)
@@ -56,10 +56,10 @@ pub struct Condvar<'self> {
     cond: &'self sync::Condvar<'self>
 }
 
-pub impl<'self> Condvar<'self> {
+impl<'self> Condvar<'self> {
     /// Atomically exit the associated ARC and block until a signal is sent.
     #[inline(always)]
-    fn wait(&self) { self.wait_on(0) }
+    pub fn wait(&self) { self.wait_on(0) }
 
     /**
      * Atomically exit the associated ARC and block on a specified condvar
@@ -68,7 +68,7 @@ fn wait(&self) { self.wait_on(0) }
      * wait() is equivalent to wait_on(0).
      */
     #[inline(always)]
-    fn wait_on(&self, condvar_id: uint) {
+    pub fn wait_on(&self, condvar_id: uint) {
         assert!(!*self.failed);
         self.cond.wait_on(condvar_id);
         // This is why we need to wrap sync::condvar.
@@ -77,28 +77,28 @@ fn wait_on(&self, condvar_id: uint) {
 
     /// Wake up a blocked task. Returns false if there was no blocked task.
     #[inline(always)]
-    fn signal(&self) -> bool { self.signal_on(0) }
+    pub fn signal(&self) -> bool { self.signal_on(0) }
 
     /**
      * Wake up a blocked task on a specified condvar (as
      * sync::cond.signal_on). Returns false if there was no blocked task.
      */
     #[inline(always)]
-    fn signal_on(&self, condvar_id: uint) -> bool {
+    pub fn signal_on(&self, condvar_id: uint) -> bool {
         assert!(!*self.failed);
         self.cond.signal_on(condvar_id)
     }
 
     /// Wake up all blocked tasks. Returns the number of tasks woken.
     #[inline(always)]
-    fn broadcast(&self) -> uint { self.broadcast_on(0) }
+    pub fn broadcast(&self) -> uint { self.broadcast_on(0) }
 
     /**
      * Wake up all blocked tasks on a specified condvar (as
      * sync::cond.broadcast_on). Returns Returns the number of tasks woken.
      */
     #[inline(always)]
-    fn broadcast_on(&self, condvar_id: uint) -> uint {
+    pub fn broadcast_on(&self, condvar_id: uint) -> uint {
         assert!(!*self.failed);
         self.cond.broadcast_on(condvar_id)
     }
@@ -120,8 +120,8 @@ pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
  * Access the underlying data in an atomically reference counted
  * wrapper.
  */
-pub impl<T:Const+Owned> ARC<T> {
-    fn get<'a>(&'a self) -> &'a T {
+impl<T:Const+Owned> ARC<T> {
+    pub fn get<'a>(&'a self) -> &'a T {
         unsafe { &*self.x.get_immut() }
     }
 }
@@ -173,7 +173,7 @@ fn clone(&self) -> MutexARC<T> {
     }
 }
 
-pub impl<T:Owned> MutexARC<T> {
+impl<T:Owned> MutexARC<T> {
 
     /**
      * Access the underlying mutable data with mutual exclusion from other
@@ -199,7 +199,7 @@ pub impl<T:Owned> MutexARC<T> {
      * blocked on the mutex) will also fail immediately.
      */
     #[inline(always)]
-    unsafe fn access<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
+    pub unsafe fn access<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
         unsafe {
             let state = self.x.get();
             // Borrowck would complain about this if the function were
@@ -214,10 +214,10 @@ unsafe fn access<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
 
     /// As access(), but with a condvar, as sync::mutex.lock_cond().
     #[inline(always)]
-    unsafe fn access_cond<'x, 'c, U>(
-        &self,
-        blk: &fn(x: &'x mut T, c: &'c Condvar) -> U) -> U
-    {
+    pub unsafe fn access_cond<'x, 'c, U>(&self,
+                                         blk: &fn(x: &'x mut T,
+                                                  c: &'c Condvar) -> U)
+                                         -> U {
         let state = self.x.get();
         do (&(*state).lock).lock_cond |cond| {
             check_poison(true, (*state).failed);
@@ -302,16 +302,18 @@ pub fn rw_arc_with_condvars<T:Const + Owned>(
     RWARC { x: UnsafeAtomicRcBox::new(data), cant_nest: () }
 }
 
-pub impl<T:Const + Owned> RWARC<T> {
+impl<T:Const + Owned> RWARC<T> {
     /// Duplicate a rwlock-protected ARC, as arc::clone.
-    fn clone(&self) -> RWARC<T> {
-        RWARC { x: self.x.clone(),
-                cant_nest: () }
+    pub fn clone(&self) -> RWARC<T> {
+        RWARC {
+            x: self.x.clone(),
+            cant_nest: (),
+        }
     }
 
 }
 
-pub impl<T:Const + Owned> RWARC<T> {
+impl<T:Const + Owned> RWARC<T> {
     /**
      * Access the underlying data mutably. Locks the rwlock in write mode;
      * other readers and writers will block.
@@ -323,7 +325,7 @@ pub impl<T:Const + Owned> RWARC<T> {
      * poison the ARC, so subsequent readers and writers will both also fail.
      */
     #[inline(always)]
-    fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
+    pub fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
         unsafe {
             let state = self.x.get();
             do (*borrow_rwlock(state)).write {
@@ -333,11 +335,12 @@ fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
             }
         }
     }
+
     /// As write(), but with a condvar, as sync::rwlock.write_cond().
     #[inline(always)]
-    fn write_cond<'x, 'c, U>(&self,
-                             blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
-                          -> U {
+    pub fn write_cond<'x, 'c, U>(&self,
+                                 blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
+                                 -> U {
         unsafe {
             let state = self.x.get();
             do (*borrow_rwlock(state)).write_cond |cond| {
@@ -350,6 +353,7 @@ fn write_cond<'x, 'c, U>(&self,
             }
         }
     }
+
     /**
      * Access the underlying data immutably. May run concurrently with other
      * reading tasks.
@@ -359,7 +363,7 @@ fn write_cond<'x, 'c, U>(&self,
      * Failing will unlock the ARC while unwinding. However, unlike all other
      * access modes, this will not poison the ARC.
      */
-    fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
+    pub fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
         unsafe {
             let state = self.x.get();
             do (*state).lock.read {
@@ -389,7 +393,7 @@ fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
      * }
      * ~~~
      */
-    fn write_downgrade<U>(&self, blk: &fn(v: RWWriteMode<T>) -> U) -> U {
+    pub fn write_downgrade<U>(&self, blk: &fn(v: RWWriteMode<T>) -> U) -> U {
         unsafe {
             let state = self.x.get();
             do (*borrow_rwlock(state)).write_downgrade |write_mode| {
@@ -404,7 +408,8 @@ fn write_downgrade<U>(&self, blk: &fn(v: RWWriteMode<T>) -> U) -> U {
     }
 
     /// To be called inside of the write_downgrade block.
-    fn downgrade<'a>(&self, token: RWWriteMode<'a, T>) -> RWReadMode<'a, T> {
+    pub fn downgrade<'a>(&self, token: RWWriteMode<'a, T>)
+                         -> RWReadMode<'a, T> {
         unsafe {
             // The rwlock should assert that the token belongs to us for us.
             let state = self.x.get();
@@ -451,9 +456,9 @@ pub struct RWReadMode<'self, T> {
     token: sync::RWlockReadMode<'self>,
 }
 
-pub impl<'self, T:Const + Owned> RWWriteMode<'self, T> {
+impl<'self, T:Const + Owned> RWWriteMode<'self, T> {
     /// Access the pre-downgrade RWARC in write mode.
-    fn write<U>(&mut self, blk: &fn(x: &mut T) -> U) -> U {
+    pub fn write<U>(&mut self, blk: &fn(x: &mut T) -> U) -> U {
         match *self {
             RWWriteMode {
                 data: &ref mut data,
@@ -466,10 +471,11 @@ fn write<U>(&mut self, blk: &fn(x: &mut T) -> U) -> U {
             }
         }
     }
+
     /// Access the pre-downgrade RWARC in write mode with a condvar.
-    fn write_cond<'x, 'c, U>(&mut self,
-                             blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
-                          -> U {
+    pub fn write_cond<'x, 'c, U>(&mut self,
+                                 blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
+                                 -> U {
         match *self {
             RWWriteMode {
                 data: &ref mut data,
@@ -491,9 +497,9 @@ fn write_cond<'x, 'c, U>(&mut self,
     }
 }
 
-pub impl<'self, T:Const + Owned> RWReadMode<'self, T> {
+impl<'self, T:Const + Owned> RWReadMode<'self, T> {
     /// Access the post-downgrade rwlock in read mode.
-    fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
+    pub fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
         match *self {
             RWReadMode {
                 data: data,
index 7cd63cd03b1aaa7efb7677b33c2e2be06649cc84..57c2152490fb601265f348b0780bc2a073bee70d 100644 (file)
@@ -166,9 +166,9 @@ unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) {
     (transmute(p & !1), p & 1 == 1)
 }
 
-pub impl Arena {
+impl Arena {
     // Functions for the POD part of the arena
-    priv fn alloc_pod_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
+    fn alloc_pod_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
         // Allocate a new chunk.
         let chunk_size = at_vec::capacity(self.pod_head.data);
         let new_min_chunk_size = uint::max(n_bytes, chunk_size);
@@ -180,7 +180,7 @@ pub impl Arena {
     }
 
     #[inline(always)]
-    priv fn alloc_pod_inner(&mut self, n_bytes: uint, align: uint) -> *u8 {
+    fn alloc_pod_inner(&mut self, n_bytes: uint, align: uint) -> *u8 {
         unsafe {
             // XXX: Borrow check
             let head = transmute_mut_region(&mut self.pod_head);
@@ -200,7 +200,7 @@ pub impl Arena {
     }
 
     #[inline(always)]
-    priv fn alloc_pod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
+    fn alloc_pod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
         unsafe {
             let tydesc = sys::get_type_desc::<T>();
             let ptr = self.alloc_pod_inner((*tydesc).size, (*tydesc).align);
@@ -211,8 +211,8 @@ pub impl Arena {
     }
 
     // Functions for the non-POD part of the arena
-    priv fn alloc_nonpod_grow(&mut self, n_bytes: uint, align: uint)
-                             -> (*u8, *u8) {
+    fn alloc_nonpod_grow(&mut self, n_bytes: uint, align: uint)
+                         -> (*u8, *u8) {
         // Allocate a new chunk.
         let chunk_size = at_vec::capacity(self.head.data);
         let new_min_chunk_size = uint::max(n_bytes, chunk_size);
@@ -224,8 +224,8 @@ pub impl Arena {
     }
 
     #[inline(always)]
-    priv fn alloc_nonpod_inner(&mut self, n_bytes: uint, align: uint)
-                               -> (*u8, *u8) {
+    fn alloc_nonpod_inner(&mut self, n_bytes: uint, align: uint)
+                          -> (*u8, *u8) {
         unsafe {
             let head = transmute_mut_region(&mut self.head);
 
@@ -247,7 +247,7 @@ pub impl Arena {
     }
 
     #[inline(always)]
-    priv fn alloc_nonpod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
+    fn alloc_nonpod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
         unsafe {
             let tydesc = sys::get_type_desc::<T>();
             let (ty_ptr, ptr) =
@@ -269,7 +269,7 @@ pub impl Arena {
 
     // The external interface
     #[inline(always)]
-    fn alloc<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
+    pub fn alloc<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
         unsafe {
             // XXX: Borrow check
             let this = transmute_mut_region(self);
index 0891d2308109467eecbba117a9754617119d9c2e..e3a15f76c786bed62621675aed22869fb152e47d 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::cmp;
@@ -26,14 +28,17 @@ fn small_mask(nbits: uint) -> uint {
     (1 << nbits) - 1
 }
 
-pub impl SmallBitv {
-    fn new(bits: uint) -> SmallBitv {
+impl SmallBitv {
+    pub fn new(bits: uint) -> SmallBitv {
         SmallBitv {bits: bits}
     }
 
     #[inline(always)]
-    fn bits_op(&mut self, right_bits: uint, nbits: uint,
-               f: &fn(uint, uint) -> uint) -> bool {
+    pub fn bits_op(&mut self,
+                   right_bits: uint,
+                   nbits: uint,
+                   f: &fn(uint, uint) -> uint)
+                   -> bool {
         let mask = small_mask(nbits);
         let old_b: uint = self.bits;
         let new_b = f(old_b, right_bits);
@@ -42,32 +47,32 @@ fn bits_op(&mut self, right_bits: uint, nbits: uint,
     }
 
     #[inline(always)]
-    fn union(&mut self, s: &SmallBitv, nbits: uint) -> bool {
+    pub fn union(&mut self, s: &SmallBitv, nbits: uint) -> bool {
         self.bits_op(s.bits, nbits, |u1, u2| u1 | u2)
     }
 
     #[inline(always)]
-    fn intersect(&mut self, s: &SmallBitv, nbits: uint) -> bool {
+    pub fn intersect(&mut self, s: &SmallBitv, nbits: uint) -> bool {
         self.bits_op(s.bits, nbits, |u1, u2| u1 & u2)
     }
 
     #[inline(always)]
-    fn become(&mut self, s: &SmallBitv, nbits: uint) -> bool {
+    pub fn become(&mut self, s: &SmallBitv, nbits: uint) -> bool {
         self.bits_op(s.bits, nbits, |_u1, u2| u2)
     }
 
     #[inline(always)]
-    fn difference(&mut self, s: &SmallBitv, nbits: uint) -> bool {
+    pub fn difference(&mut self, s: &SmallBitv, nbits: uint) -> bool {
         self.bits_op(s.bits, nbits, |u1, u2| u1 & !u2)
     }
 
     #[inline(always)]
-    fn get(&self, i: uint) -> bool {
+    pub fn get(&self, i: uint) -> bool {
         (self.bits & (1 << i)) != 0
     }
 
     #[inline(always)]
-    fn set(&mut self, i: uint, x: bool) {
+    pub fn set(&mut self, i: uint, x: bool) {
         if x {
             self.bits |= 1<<i;
         }
@@ -77,30 +82,29 @@ fn set(&mut self, i: uint, x: bool) {
     }
 
     #[inline(always)]
-    fn equals(&self, b: &SmallBitv, nbits: uint) -> bool {
+    pub fn equals(&self, b: &SmallBitv, nbits: uint) -> bool {
         let mask = small_mask(nbits);
         mask & self.bits == mask & b.bits
     }
 
     #[inline(always)]
-    fn clear(&mut self) { self.bits = 0; }
+    pub fn clear(&mut self) { self.bits = 0; }
 
     #[inline(always)]
-    fn set_all(&mut self) { self.bits = !0; }
+    pub fn set_all(&mut self) { self.bits = !0; }
 
     #[inline(always)]
-    fn is_true(&self, nbits: uint) -> bool {
+    pub fn is_true(&self, nbits: uint) -> bool {
         small_mask(nbits) & !self.bits == 0
     }
 
     #[inline(always)]
-    fn is_false(&self, nbits: uint) -> bool {
+    pub fn is_false(&self, nbits: uint) -> bool {
         small_mask(nbits) & self.bits == 0
     }
 
     #[inline(always)]
-    fn invert(&mut self) { self.bits = !self.bits; }
-
+    pub fn invert(&mut self) { self.bits = !self.bits; }
 }
 
 struct BigBitv {
@@ -123,14 +127,17 @@ fn big_mask(nbits: uint, elem: uint) -> uint {
     }
 }
 
-pub impl BigBitv {
-    fn new(storage: ~[uint]) -> BigBitv {
+impl BigBitv {
+    pub fn new(storage: ~[uint]) -> BigBitv {
         BigBitv {storage: storage}
     }
 
     #[inline(always)]
-    fn process(&mut self, b: &BigBitv, nbits: uint,
-               op: &fn(uint, uint) -> uint) -> bool {
+    pub fn process(&mut self,
+                   b: &BigBitv,
+                   nbits: uint,
+                   op: &fn(uint, uint) -> uint)
+                   -> bool {
         let len = b.storage.len();
         assert_eq!(self.storage.len(), len);
         let mut changed = false;
@@ -148,35 +155,35 @@ fn process(&mut self, b: &BigBitv, nbits: uint,
     }
 
     #[inline(always)]
-    fn each_storage(&mut self, op: &fn(v: &mut uint) -> bool) -> bool {
+    pub fn each_storage(&mut self, op: &fn(v: &mut uint) -> bool) -> bool {
         uint::range(0, self.storage.len(), |i| op(&mut self.storage[i]))
     }
 
     #[inline(always)]
-    fn invert(&mut self) { for self.each_storage |w| { *w = !*w } }
+    pub fn invert(&mut self) { for self.each_storage |w| { *w = !*w } }
 
     #[inline(always)]
-    fn union(&mut self, b: &BigBitv, nbits: uint) -> bool {
+    pub fn union(&mut self, b: &BigBitv, nbits: uint) -> bool {
         self.process(b, nbits, |w1, w2| w1 | w2)
     }
 
     #[inline(always)]
-    fn intersect(&mut self, b: &BigBitv, nbits: uint) -> bool {
+    pub fn intersect(&mut self, b: &BigBitv, nbits: uint) -> bool {
         self.process(b, nbits, |w1, w2| w1 & w2)
     }
 
     #[inline(always)]
-    fn become(&mut self, b: &BigBitv, nbits: uint) -> bool {
+    pub fn become(&mut self, b: &BigBitv, nbits: uint) -> bool {
         self.process(b, nbits, |_, w| w)
     }
 
     #[inline(always)]
-    fn difference(&mut self, b: &BigBitv, nbits: uint) -> bool {
+    pub fn difference(&mut self, b: &BigBitv, nbits: uint) -> bool {
         self.process(b, nbits, |w1, w2| w1 & !w2)
     }
 
     #[inline(always)]
-    fn get(&self, i: uint) -> bool {
+    pub fn get(&self, i: uint) -> bool {
         let w = i / uint::bits;
         let b = i % uint::bits;
         let x = 1 & self.storage[w] >> b;
@@ -184,7 +191,7 @@ fn get(&self, i: uint) -> bool {
     }
 
     #[inline(always)]
-    fn set(&mut self, i: uint, x: bool) {
+    pub fn set(&mut self, i: uint, x: bool) {
         let w = i / uint::bits;
         let b = i % uint::bits;
         let flag = 1 << b;
@@ -193,7 +200,7 @@ fn set(&mut self, i: uint, x: bool) {
     }
 
     #[inline(always)]
-    fn equals(&self, b: &BigBitv, nbits: uint) -> bool {
+    pub fn equals(&self, b: &BigBitv, nbits: uint) -> bool {
         let len = b.storage.len();
         for uint::iterate(0, len) |i| {
             let mask = big_mask(nbits, i);
@@ -203,7 +210,6 @@ fn equals(&self, b: &BigBitv, nbits: uint) -> bool {
         }
         return true;
     }
-
 }
 
 enum BitvVariant { Big(~BigBitv), Small(~SmallBitv) }
@@ -222,8 +228,7 @@ fn die() -> ! {
     fail!("Tried to do operation on bit vectors with different sizes");
 }
 
-priv impl Bitv {
-
+impl Bitv {
     #[inline(always)]
     fn do_op(&mut self, op: Op, other: &Bitv) -> bool {
         if self.nbits != other.nbits {
@@ -253,8 +258,8 @@ fn do_op(&mut self, op: Op, other: &Bitv) -> bool {
 
 }
 
-pub impl Bitv {
-    fn new(nbits: uint, init: bool) -> Bitv {
+impl Bitv {
+    pub fn new(nbits: uint, init: bool) -> Bitv {
         let rep = if nbits <= uint::bits {
             Small(~SmallBitv::new(if init {!0} else {0}))
         }
@@ -275,7 +280,7 @@ fn new(nbits: uint, init: bool) -> Bitv {
      * the same length. Returns 'true' if `self` changed.
     */
     #[inline(always)]
-    fn union(&mut self, v1: &Bitv) -> bool { self.do_op(Union, v1) }
+    pub fn union(&mut self, v1: &Bitv) -> bool { self.do_op(Union, v1) }
 
     /**
      * Calculates the intersection of two bitvectors
@@ -284,7 +289,9 @@ fn union(&mut self, v1: &Bitv) -> bool { self.do_op(Union, v1) }
      * must be the same length. Returns 'true' if `self` changed.
     */
     #[inline(always)]
-    fn intersect(&mut self, v1: &Bitv) -> bool { self.do_op(Intersect, v1) }
+    pub fn intersect(&mut self, v1: &Bitv) -> bool {
+        self.do_op(Intersect, v1)
+    }
 
     /**
      * Assigns the value of `v1` to `self`
@@ -293,16 +300,16 @@ fn intersect(&mut self, v1: &Bitv) -> bool { self.do_op(Intersect, v1) }
      * changed
      */
     #[inline(always)]
-    fn assign(&mut self, v: &Bitv) -> bool { self.do_op(Assign, v) }
+    pub fn assign(&mut self, v: &Bitv) -> bool { self.do_op(Assign, v) }
 
     /// Retrieve the value at index `i`
     #[inline(always)]
-    fn get(&self, i: uint) -> bool {
-       assert!((i < self.nbits));
-       match self.rep {
-         Big(ref b)   => b.get(i),
-         Small(ref s) => s.get(i)
-       }
+    pub fn get(&self, i: uint) -> bool {
+        assert!((i < self.nbits));
+        match self.rep {
+            Big(ref b)   => b.get(i),
+            Small(ref s) => s.get(i)
+        }
     }
 
     /**
@@ -311,7 +318,7 @@ fn get(&self, i: uint) -> bool {
      * `i` must be less than the length of the bitvector.
      */
     #[inline(always)]
-    fn set(&mut self, i: uint, x: bool) {
+    pub fn set(&mut self, i: uint, x: bool) {
       assert!((i < self.nbits));
       match self.rep {
         Big(ref mut b)   => b.set(i, x),
@@ -326,7 +333,7 @@ fn set(&mut self, i: uint, x: bool) {
      * bitvectors contain identical elements.
      */
     #[inline(always)]
-    fn equal(&self, v1: &Bitv) -> bool {
+    pub fn equal(&self, v1: &Bitv) -> bool {
       if self.nbits != v1.nbits { return false; }
       match self.rep {
         Small(ref b) => match v1.rep {
@@ -342,7 +349,7 @@ fn equal(&self, v1: &Bitv) -> bool {
 
     /// Set all bits to 0
     #[inline(always)]
-    fn clear(&mut self) {
+    pub fn clear(&mut self) {
         match self.rep {
           Small(ref mut b) => b.clear(),
           Big(ref mut s) => for s.each_storage() |w| { *w = 0u }
@@ -351,7 +358,7 @@ fn clear(&mut self) {
 
     /// Set all bits to 1
     #[inline(always)]
-    fn set_all(&mut self) {
+    pub fn set_all(&mut self) {
       match self.rep {
         Small(ref mut b) => b.set_all(),
         Big(ref mut s) => for s.each_storage() |w| { *w = !0u } }
@@ -359,7 +366,7 @@ fn set_all(&mut self) {
 
     /// Invert all bits
     #[inline(always)]
-    fn invert(&mut self) {
+    pub fn invert(&mut self) {
       match self.rep {
         Small(ref mut b) => b.invert(),
         Big(ref mut s) => for s.each_storage() |w| { *w = !*w } }
@@ -375,11 +382,13 @@ fn invert(&mut self) {
      * Returns `true` if `v0` was changed.
      */
     #[inline(always)]
-    fn difference(&mut self, v: &Bitv) -> bool { self.do_op(Difference, v) }
+    pub fn difference(&mut self, v: &Bitv) -> bool {
+        self.do_op(Difference, v)
+    }
 
     /// Returns true if all bits are 1
     #[inline(always)]
-    fn is_true(&self) -> bool {
+    pub fn is_true(&self) -> bool {
       match self.rep {
         Small(ref b) => b.is_true(self.nbits),
         _ => {
@@ -390,7 +399,7 @@ fn is_true(&self) -> bool {
     }
 
     #[inline(always)]
-    fn each(&self, f: &fn(bool) -> bool) -> bool {
+    pub fn each(&self, f: &fn(bool) -> bool) -> bool {
         let mut i = 0;
         while i < self.nbits {
             if !f(self.get(i)) { return false; }
@@ -400,7 +409,7 @@ fn each(&self, f: &fn(bool) -> bool) -> bool {
     }
 
     /// Returns true if all bits are 0
-    fn is_false(&self) -> bool {
+    pub fn is_false(&self) -> bool {
       match self.rep {
         Small(ref b) => b.is_false(self.nbits),
         Big(_) => {
@@ -410,7 +419,7 @@ fn is_false(&self) -> bool {
       }
     }
 
-    fn init_to_vec(&self, i: uint) -> uint {
+    pub fn init_to_vec(&self, i: uint) -> uint {
       return if self.get(i) { 1 } else { 0 };
     }
 
@@ -419,7 +428,7 @@ fn init_to_vec(&self, i: uint) -> uint {
      *
      * Each uint in the resulting vector has either value 0u or 1u.
      */
-    fn to_vec(&self) -> ~[uint] {
+    pub fn to_vec(&self) -> ~[uint] {
         vec::from_fn(self.nbits, |x| self.init_to_vec(x))
     }
 
@@ -429,8 +438,7 @@ fn to_vec(&self) -> ~[uint] {
      * size of the bitv is not a multiple of 8 then trailing bits
      * will be filled-in with false/0
      */
-    fn to_bytes(&self) -> ~[u8] {
-
+    pub fn to_bytes(&self) -> ~[u8] {
         fn bit (bitv: &Bitv, byte: uint, bit: uint) -> u8 {
             let offset = byte * 8 + bit;
             if offset >= bitv.nbits {
@@ -457,7 +465,7 @@ fn bit (bitv: &Bitv, byte: uint, bit: uint) -> u8 {
     /**
      * Transform self into a [bool] by turning each bit into a bool
      */
-    fn to_bools(&self) -> ~[bool] {
+    pub fn to_bools(&self) -> ~[bool] {
         vec::from_fn(self.nbits, |i| self[i])
     }
 
@@ -467,7 +475,7 @@ fn to_bools(&self) -> ~[bool] {
      * The resulting string has the same length as `self`, and each
      * character is either '0' or '1'.
      */
-     fn to_str(&self) -> ~str {
+     pub fn to_str(&self) -> ~str {
        let mut rs = ~"";
        for self.each() |i| { if i { rs += "1"; } else { rs += "0"; } };
        rs
@@ -480,7 +488,7 @@ fn to_str(&self) -> ~str {
      * The uint vector is expected to only contain the values 0u and 1u. Both
      * the bitvector and vector must have the same length
      */
-    fn eq_vec(&self, v: ~[uint]) -> bool {
+    pub fn eq_vec(&self, v: ~[uint]) -> bool {
         assert_eq!(self.nbits, v.len());
         let mut i = 0;
         while i < self.nbits {
@@ -492,7 +500,7 @@ fn eq_vec(&self, v: ~[uint]) -> bool {
         true
     }
 
-    fn ones(&self, f: &fn(uint) -> bool) -> bool {
+    pub fn ones(&self, f: &fn(uint) -> bool) -> bool {
         uint::range(0, self.nbits, |i| !self.get(i) || f(i))
     }
 
@@ -514,7 +522,6 @@ fn clone(&self) -> Bitv {
           }
         }
     }
-
 }
 
 /**
@@ -585,14 +592,14 @@ pub struct BitvSet {
     priv bitv: BigBitv
 }
 
-pub impl BitvSet {
+impl BitvSet {
     /// Creates a new bit vector set with initially no contents
-    fn new() -> BitvSet {
+    pub fn new() -> BitvSet {
         BitvSet{ size: 0, bitv: BigBitv::new(~[0]) }
     }
 
     /// Creates a new bit vector set from the given bit vector
-    fn from_bitv(bitv: Bitv) -> BitvSet {
+    pub fn from_bitv(bitv: Bitv) -> BitvSet {
         let mut size = 0;
         for bitv.ones |_| {
             size += 1;
@@ -607,17 +614,17 @@ fn from_bitv(bitv: Bitv) -> BitvSet {
 
     /// Returns the capacity in bits for this bit vector. Inserting any
     /// element less than this amount will not trigger a resizing.
-    fn capacity(&self) -> uint { self.bitv.storage.len() * uint::bits }
+    pub fn capacity(&self) -> uint { self.bitv.storage.len() * uint::bits }
 
     /// Consumes this set to return the underlying bit vector
-    fn unwrap(self) -> Bitv {
+    pub fn unwrap(self) -> Bitv {
         let cap = self.capacity();
         let BitvSet{bitv, _} = self;
         return Bitv{ nbits:cap, rep: Big(~bitv) };
     }
 
     #[inline(always)]
-    priv fn other_op(&mut self, other: &BitvSet, f: &fn(uint, uint) -> uint) {
+    fn other_op(&mut self, other: &BitvSet, f: &fn(uint, uint) -> uint) {
         fn nbits(mut w: uint) -> uint {
             let mut bits = 0;
             for uint::bits.times {
@@ -641,22 +648,22 @@ fn nbits(mut w: uint) -> uint {
     }
 
     /// Union in-place with the specified other bit vector
-    fn union_with(&mut self, other: &BitvSet) {
+    pub fn union_with(&mut self, other: &BitvSet) {
         self.other_op(other, |w1, w2| w1 | w2);
     }
 
     /// Intersect in-place with the specified other bit vector
-    fn intersect_with(&mut self, other: &BitvSet) {
+    pub fn intersect_with(&mut self, other: &BitvSet) {
         self.other_op(other, |w1, w2| w1 & w2);
     }
 
     /// Difference in-place with the specified other bit vector
-    fn difference_with(&mut self, other: &BitvSet) {
+    pub fn difference_with(&mut self, other: &BitvSet) {
         self.other_op(other, |w1, w2| w1 & !w2);
     }
 
     /// Symmetric difference in-place with the specified other bit vector
-    fn symmetric_difference_with(&mut self, other: &BitvSet) {
+    pub fn symmetric_difference_with(&mut self, other: &BitvSet) {
         self.other_op(other, |w1, w2| w1 ^ w2);
     }
 }
@@ -810,7 +817,7 @@ fn union(&self, other: &BitvSet, f: &fn(&uint) -> bool) -> bool {
     }
 }
 
-priv impl BitvSet {
+impl BitvSet {
     /// Visits each of the words that the two bit vectors (self and other)
     /// both have in common. The three yielded arguments are (bit location,
     /// w1, w2) where the bit location is the number of bits offset so far,
index 1ef61926c92002e3e8c2fd2de0d8030cf9d3a432..1001d4f6ac9ed26ef484a37637f42c0624589a09 100644 (file)
@@ -14,6 +14,8 @@
 
 */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::comm::{GenericChan, GenericSmartChan, GenericPort};
@@ -28,20 +30,20 @@ pub struct DuplexStream<T, U> {
 }
 
 // Allow these methods to be used without import:
-pub impl<T:Owned,U:Owned> DuplexStream<T, U> {
-    fn send(&self, x: T) {
+impl<T:Owned,U:Owned> DuplexStream<T, U> {
+    pub fn send(&self, x: T) {
         self.chan.send(x)
     }
-    fn try_send(&self, x: T) -> bool {
+    pub fn try_send(&self, x: T) -> bool {
         self.chan.try_send(x)
     }
-    fn recv(&self, ) -> U {
+    pub fn recv(&self, ) -> U {
         self.port.recv()
     }
-    fn try_recv(&self) -> Option<U> {
+    pub fn try_recv(&self) -> Option<U> {
         self.port.try_recv()
     }
-    fn peek(&self) -> bool {
+    pub fn peek(&self) -> bool {
         self.port.peek()
     }
 }
index 08dc2436c9339a684cdf6a6fdc188d16eeffd4d1..a8accc50eab01969fc9cbee95fd8675450b85ee3 100644 (file)
@@ -44,9 +44,9 @@ fn clear(&mut self) {
     }
 }
 
-pub impl<T> Deque<T> {
+impl<T> Deque<T> {
     /// Create an empty Deque
-    fn new() -> Deque<T> {
+    pub fn new() -> Deque<T> {
         Deque{nelts: 0, lo: 0, hi: 0,
               elts: vec::from_fn(initial_capacity, |_| None)}
     }
@@ -54,35 +54,35 @@ fn new() -> Deque<T> {
     /// Return a reference to the first element in the deque
     ///
     /// Fails if the deque is empty
-    fn peek_front<'a>(&'a self) -> &'a T { get(self.elts, self.lo) }
+    pub fn peek_front<'a>(&'a self) -> &'a T { get(self.elts, self.lo) }
 
     /// Return a reference to the last element in the deque
     ///
     /// Fails if the deque is empty
-    fn peek_back<'a>(&'a self) -> &'a T { get(self.elts, self.hi - 1u) }
+    pub fn peek_back<'a>(&'a self) -> &'a T { get(self.elts, self.hi - 1u) }
 
     /// Retrieve an element in the deque by index
     ///
     /// Fails if there is no element with the given index
-    fn get<'a>(&'a self, i: int) -> &'a T {
+    pub fn get<'a>(&'a self, i: int) -> &'a T {
         let idx = (self.lo + (i as uint)) % self.elts.len();
         get(self.elts, idx)
     }
 
     /// Iterate over the elements in the deque
-    fn each(&self, f: &fn(&T) -> bool) -> bool {
+    pub fn each(&self, f: &fn(&T) -> bool) -> bool {
         self.eachi(|_i, e| f(e))
     }
 
     /// Iterate over the elements in the deque by index
-    fn eachi(&self, f: &fn(uint, &T) -> bool) -> bool {
+    pub fn eachi(&self, f: &fn(uint, &T) -> bool) -> bool {
         uint::range(0, self.nelts, |i| f(i, self.get(i as int)))
     }
 
     /// Remove and return the first element in the deque
     ///
     /// Fails if the deque is empty
-    fn pop_front(&mut self) -> T {
+    pub fn pop_front(&mut self) -> T {
         let result = self.elts[self.lo].swap_unwrap();
         self.lo = (self.lo + 1u) % self.elts.len();
         self.nelts -= 1u;
@@ -92,7 +92,7 @@ fn pop_front(&mut self) -> T {
     /// Remove and return the last element in the deque
     ///
     /// Fails if the deque is empty
-    fn pop_back(&mut self) -> T {
+    pub fn pop_back(&mut self) -> T {
         if self.hi == 0u {
             self.hi = self.elts.len() - 1u;
         } else { self.hi -= 1u; }
@@ -103,7 +103,7 @@ fn pop_back(&mut self) -> T {
     }
 
     /// Prepend an element to the deque
-    fn add_front(&mut self, t: T) {
+    pub fn add_front(&mut self, t: T) {
         let oldlo = self.lo;
         if self.lo == 0u {
             self.lo = self.elts.len() - 1u;
@@ -118,7 +118,7 @@ fn add_front(&mut self, t: T) {
     }
 
     /// Append an element to the deque
-    fn add_back(&mut self, t: T) {
+    pub fn add_back(&mut self, t: T) {
         if self.lo == self.hi && self.nelts != 0u {
             self.elts = grow(self.nelts, self.lo, self.elts);
             self.lo = 0u;
@@ -136,7 +136,7 @@ fn add_back(&mut self, t: T) {
     /// # Arguments
     ///
     /// * n - The number of elements to reserve space for
-    fn reserve(&mut self, n: uint) {
+    pub fn reserve(&mut self, n: uint) {
         vec::reserve(&mut self.elts, n);
     }
 
@@ -150,7 +150,7 @@ fn reserve(&mut self, n: uint) {
     /// # Arguments
     ///
     /// * n - The number of elements to reserve space for
-    fn reserve_at_least(&mut self, n: uint) {
+    pub fn reserve_at_least(&mut self, n: uint) {
         vec::reserve_at_least(&mut self.elts, n);
     }
 }
index 5581c6d5ac9d9bb92eefef0436bddf2240659f1f..52e2b75d6b6d33cb63eba8efd8445028605bfee7 100644 (file)
@@ -41,7 +41,7 @@ pub struct DList<T> {
     tl: DListLink<T>,
 }
 
-priv impl<T> DListNode<T> {
+impl<T> DListNode<T> {
     fn assert_links(@mut self) {
         match self.next {
             Some(neighbour) => match neighbour.prev {
@@ -64,26 +64,26 @@ fn assert_links(@mut self) {
     }
 }
 
-pub impl<T> DListNode<T> {
+impl<T> DListNode<T> {
     /// Get the next node in the list, if there is one.
-    fn next_link(@mut self) -> DListLink<T> {
+    pub fn next_link(@mut self) -> DListLink<T> {
         self.assert_links();
         self.next
     }
     /// Get the next node in the list, failing if there isn't one.
-    fn next_node(@mut self) -> @mut DListNode<T> {
+    pub fn next_node(@mut self) -> @mut DListNode<T> {
         match self.next_link() {
             Some(nobe) => nobe,
             None       => fail!("This dlist node has no next neighbour.")
         }
     }
     /// Get the previous node in the list, if there is one.
-    fn prev_link(@mut self) -> DListLink<T> {
+    pub fn prev_link(@mut self) -> DListLink<T> {
         self.assert_links();
         self.prev
     }
     /// Get the previous node in the list, failing if there isn't one.
-    fn prev_node(@mut self) -> @mut DListNode<T> {
+    pub fn prev_node(@mut self) -> @mut DListNode<T> {
         match self.prev_link() {
             Some(nobe) => nobe,
             None       => fail!("This dlist node has no previous neighbour.")
@@ -126,7 +126,7 @@ pub fn concat<T>(lists: @mut DList<@mut DList<T>>) -> @mut DList<T> {
     result
 }
 
-priv impl<T> DList<T> {
+impl<T> DList<T> {
     fn new_link(data: T) -> DListLink<T> {
         Some(@mut DListNode {
             data: data,
@@ -211,34 +211,34 @@ fn insert_right(@mut self,
     }
 }
 
-pub impl<T> DList<T> {
+impl<T> DList<T> {
     /// Get the size of the list. O(1).
-    fn len(@mut self) -> uint { self.size }
+    pub fn len(@mut self) -> uint { self.size }
     /// Returns true if the list is empty. O(1).
-    fn is_empty(@mut self) -> bool { self.len() == 0 }
+    pub fn is_empty(@mut self) -> bool { self.len() == 0 }
 
     /// Add data to the head of the list. O(1).
-    fn push_head(@mut self, data: T) {
+    pub fn push_head(@mut self, data: T) {
         self.add_head(DList::new_link(data));
     }
     /**
      * Add data to the head of the list, and get the new containing
      * node. O(1).
      */
-    fn push_head_n(@mut self, data: T) -> @mut DListNode<T> {
+    pub fn push_head_n(@mut self, data: T) -> @mut DListNode<T> {
         let nobe = DList::new_link(data);
         self.add_head(nobe);
         nobe.get()
     }
     /// Add data to the tail of the list. O(1).
-    fn push(@mut self, data: T) {
+    pub fn push(@mut self, data: T) {
         self.add_tail(DList::new_link(data));
     }
     /**
      * Add data to the tail of the list, and get the new containing
      * node. O(1).
      */
-    fn push_n(@mut self, data: T) -> @mut DListNode<T> {
+    pub fn push_n(@mut self, data: T) -> @mut DListNode<T> {
         let nobe = DList::new_link(data);
         self.add_tail(nobe);
         nobe.get()
@@ -247,16 +247,16 @@ fn push_n(@mut self, data: T) -> @mut DListNode<T> {
      * Insert data into the middle of the list, left of the given node.
      * O(1).
      */
-    fn insert_before(@mut self, data: T, neighbour: @mut DListNode<T>) {
+    pub fn insert_before(@mut self, data: T, neighbour: @mut DListNode<T>) {
         self.insert_left(DList::new_link(data), neighbour);
     }
     /**
      * Insert an existing node in the middle of the list, left of the
      * given node. O(1).
      */
-    fn insert_n_before(@mut self,
-                       nobe: @mut DListNode<T>,
-                       neighbour: @mut DListNode<T>) {
+    pub fn insert_n_before(@mut self,
+                           nobe: @mut DListNode<T>,
+                           neighbour: @mut DListNode<T>) {
         self.make_mine(nobe);
         self.insert_left(Some(nobe), neighbour);
     }
@@ -264,11 +264,10 @@ fn insert_n_before(@mut self,
      * Insert data in the middle of the list, left of the given node,
      * and get its containing node. O(1).
      */
-    fn insert_before_n(
-        @mut self,
-        data: T,
-        neighbour: @mut DListNode<T>
-    ) -> @mut DListNode<T> {
+    pub fn insert_before_n(@mut self,
+                           data: T,
+                           neighbour: @mut DListNode<T>)
+                           -> @mut DListNode<T> {
         let nobe = DList::new_link(data);
         self.insert_left(nobe, neighbour);
         nobe.get()
@@ -277,16 +276,16 @@ fn insert_before_n(
      * Insert data into the middle of the list, right of the given node.
      * O(1).
      */
-    fn insert_after(@mut self, data: T, neighbour: @mut DListNode<T>) {
+    pub fn insert_after(@mut self, data: T, neighbour: @mut DListNode<T>) {
         self.insert_right(neighbour, DList::new_link(data));
     }
     /**
      * Insert an existing node in the middle of the list, right of the
      * given node. O(1).
      */
-    fn insert_n_after(@mut self,
-                      nobe: @mut DListNode<T>,
-                      neighbour: @mut DListNode<T>) {
+    pub fn insert_n_after(@mut self,
+                          nobe: @mut DListNode<T>,
+                          neighbour: @mut DListNode<T>) {
         self.make_mine(nobe);
         self.insert_right(neighbour, Some(nobe));
     }
@@ -294,42 +293,41 @@ fn insert_n_after(@mut self,
      * Insert data in the middle of the list, right of the given node,
      * and get its containing node. O(1).
      */
-    fn insert_after_n(
-        @mut self,
-        data: T,
-        neighbour: @mut DListNode<T>
-    ) -> @mut DListNode<T> {
+    pub fn insert_after_n(@mut self,
+                          data: T,
+                          neighbour: @mut DListNode<T>)
+                          -> @mut DListNode<T> {
         let nobe = DList::new_link(data);
         self.insert_right(neighbour, nobe);
         nobe.get()
     }
 
     /// Remove a node from the head of the list. O(1).
-    fn pop_n(@mut self) -> DListLink<T> {
+    pub fn pop_n(@mut self) -> DListLink<T> {
         let hd = self.peek_n();
         hd.map(|nobe| self.unlink(*nobe));
         hd
     }
     /// Remove a node from the tail of the list. O(1).
-    fn pop_tail_n(@mut self) -> DListLink<T> {
+    pub fn pop_tail_n(@mut self) -> DListLink<T> {
         let tl = self.peek_tail_n();
         tl.map(|nobe| self.unlink(*nobe));
         tl
     }
     /// Get the node at the list's head. O(1).
-    fn peek_n(@mut self) -> DListLink<T> { self.hd }
+    pub fn peek_n(@mut self) -> DListLink<T> { self.hd }
     /// Get the node at the list's tail. O(1).
-    fn peek_tail_n(@mut self) -> DListLink<T> { self.tl }
+    pub fn peek_tail_n(@mut self) -> DListLink<T> { self.tl }
 
     /// Get the node at the list's head, failing if empty. O(1).
-    fn head_n(@mut self) -> @mut DListNode<T> {
+    pub fn head_n(@mut self) -> @mut DListNode<T> {
         match self.hd {
             Some(nobe) => nobe,
             None       => fail!("Attempted to get the head of an empty dlist.")
         }
     }
     /// Get the node at the list's tail, failing if empty. O(1).
-    fn tail_n(@mut self) -> @mut DListNode<T> {
+    pub fn tail_n(@mut self) -> @mut DListNode<T> {
         match self.tl {
             Some(nobe) => nobe,
             None       => fail!("Attempted to get the tail of an empty dlist.")
@@ -337,13 +335,13 @@ fn tail_n(@mut self) -> @mut DListNode<T> {
     }
 
     /// Remove a node from anywhere in the list. O(1).
-    fn remove(@mut self, nobe: @mut DListNode<T>) { self.unlink(nobe); }
+    pub fn remove(@mut self, nobe: @mut DListNode<T>) { self.unlink(nobe); }
 
     /**
      * Empty another list onto the end of this list, joining this list's tail
      * to the other list's head. O(1).
      */
-    fn append(@mut self, them: @mut DList<T>) {
+    pub fn append(@mut self, them: @mut DList<T>) {
         if managed::mut_ptr_eq(self, them) {
             fail!("Cannot append a dlist to itself!")
         }
@@ -360,7 +358,7 @@ fn append(@mut self, them: @mut DList<T>) {
      * Empty another list onto the start of this list, joining the other
      * list's tail to this list's head. O(1).
      */
-    fn prepend(@mut self, them: @mut DList<T>) {
+    pub fn prepend(@mut self, them: @mut DList<T>) {
         if managed::mut_ptr_eq(self, them) {
             fail!("Cannot prepend a dlist to itself!")
         }
@@ -375,7 +373,7 @@ fn prepend(@mut self, them: @mut DList<T>) {
     }
 
     /// Reverse the list's elements in place. O(n).
-    fn reverse(@mut self) {
+    pub fn reverse(@mut self) {
         do self.hd.while_some |nobe| {
             let next_nobe = nobe.next;
             self.remove(nobe);
@@ -389,7 +387,7 @@ fn reverse(@mut self) {
      * Remove everything from the list. This is important because the cyclic
      * links won't otherwise be automatically refcounted-collected. O(n).
      */
-    fn clear(@mut self) {
+    pub fn clear(@mut self) {
         // Cute as it would be to simply detach the list and proclaim "O(1)!",
         // the GC would still be a hidden O(n). Better to be honest about it.
         while !self.is_empty() {
@@ -398,7 +396,7 @@ fn clear(@mut self) {
     }
 
     /// Iterate over nodes.
-    fn each_node(@mut self, f: &fn(@mut DListNode<T>) -> bool) -> bool {
+    pub fn each_node(@mut self, f: &fn(@mut DListNode<T>) -> bool) -> bool {
         let mut link = self.peek_n();
         while link.is_some() {
             let nobe = link.get();
@@ -409,7 +407,7 @@ fn each_node(@mut self, f: &fn(@mut DListNode<T>) -> bool) -> bool {
     }
 
     /// Check data structure integrity. O(n).
-    fn assert_consistent(@mut self) {
+    pub fn assert_consistent(@mut self) {
         if self.hd.is_none() || self.tl.is_none() {
             assert!(self.hd.is_none() && self.tl.is_none());
         }
@@ -459,35 +457,35 @@ fn assert_consistent(@mut self) {
     }
 }
 
-pub impl<T:Copy> DList<T> {
+impl<T:Copy> DList<T> {
     /// Remove data from the head of the list. O(1).
-    fn pop(@mut self) -> Option<T> {
+    pub fn pop(@mut self) -> Option<T> {
         self.pop_n().map(|nobe| nobe.data)
     }
 
     /// Remove data from the tail of the list. O(1).
-    fn pop_tail(@mut self) -> Option<T> {
+    pub fn pop_tail(@mut self) -> Option<T> {
         self.pop_tail_n().map(|nobe| nobe.data)
     }
 
     /// Get data at the list's head. O(1).
-    fn peek(@mut self) -> Option<T> {
+    pub fn peek(@mut self) -> Option<T> {
         self.peek_n().map(|nobe| nobe.data)
     }
 
     /// Get data at the list's tail. O(1).
-    fn peek_tail(@mut self) -> Option<T> {
+    pub fn peek_tail(@mut self) -> Option<T> {
         self.peek_tail_n().map (|nobe| nobe.data)
     }
 
     /// Get data at the list's head, failing if empty. O(1).
-    fn head(@mut self) -> T { self.head_n().data }
+    pub fn head(@mut self) -> T { self.head_n().data }
 
     /// Get data at the list's tail, failing if empty. O(1).
-    fn tail(@mut self) -> T { self.tail_n().data }
+    pub fn tail(@mut self) -> T { self.tail_n().data }
 
     /// Get the elements of the list as a vector. O(n).
-    fn to_vec(@mut self) -> ~[T] {
+    pub fn to_vec(@mut self) -> ~[T] {
         let mut v = vec::with_capacity(self.size);
         for old_iter::eachi(&self) |index,data| {
             v[index] = *data;
index 641f01dfb0b6ede1b9c1da7c368d204812972d6a..47b0b4f6c974b5199193e8cf6faa3084b70d3478 100644 (file)
@@ -89,8 +89,8 @@ pub mod reader {
 
     // ebml reading
 
-    pub impl Doc {
-        fn get(&self, tag: uint) -> Doc {
+    impl Doc {
+        pub fn get(&self, tag: uint) -> Doc {
             get_doc(*self, tag)
         }
     }
@@ -286,7 +286,7 @@ pub fn Decoder(d: Doc) -> Decoder {
         }
     }
 
-    priv impl Decoder {
+    impl Decoder {
         fn _check_label(&mut self, lbl: &str) {
             if self.pos < self.parent.end {
                 let TaggedDoc { tag: r_tag, doc: r_doc } =
@@ -343,8 +343,9 @@ fn _next_uint(&mut self, exp_tag: EbmlEncoderTag) -> uint {
         }
     }
 
-    pub impl Decoder {
-        fn read_opaque<R>(&mut self, op: &fn(&mut Decoder, Doc) -> R) -> R {
+    impl Decoder {
+        pub fn read_opaque<R>(&mut self, op: &fn(&mut Decoder, Doc) -> R)
+                              -> R {
             let doc = self.next_doc(EsOpaque);
 
             let (old_parent, old_pos) = (self.parent, self.pos);
@@ -638,8 +639,8 @@ pub fn Encoder(w: @io::Writer) -> Encoder {
     }
 
     // FIXME (#2741): Provide a function to write the standard ebml header.
-    pub impl Encoder {
-        fn start_tag(&mut self, tag_id: uint) {
+    impl Encoder {
+        pub fn start_tag(&mut self, tag_id: uint) {
             debug!("Start tag %u", tag_id);
 
             // Write the enum ID:
@@ -651,7 +652,7 @@ fn start_tag(&mut self, tag_id: uint) {
             self.writer.write(zeroes);
         }
 
-        fn end_tag(&mut self) {
+        pub fn end_tag(&mut self) {
             let last_size_pos = self.size_positions.pop();
             let cur_pos = self.writer.tell();
             self.writer.seek(last_size_pos as int, io::SeekSet);
@@ -662,72 +663,72 @@ fn end_tag(&mut self) {
             debug!("End tag (size = %u)", size);
         }
 
-        fn wr_tag(&mut self, tag_id: uint, blk: &fn()) {
+        pub fn wr_tag(&mut self, tag_id: uint, blk: &fn()) {
             self.start_tag(tag_id);
             blk();
             self.end_tag();
         }
 
-        fn wr_tagged_bytes(&mut self, tag_id: uint, b: &[u8]) {
+        pub fn wr_tagged_bytes(&mut self, tag_id: uint, b: &[u8]) {
             write_vuint(self.writer, tag_id);
             write_vuint(self.writer, b.len());
             self.writer.write(b);
         }
 
-        fn wr_tagged_u64(&mut self, tag_id: uint, v: u64) {
+        pub fn wr_tagged_u64(&mut self, tag_id: uint, v: u64) {
             do io::u64_to_be_bytes(v, 8u) |v| {
                 self.wr_tagged_bytes(tag_id, v);
             }
         }
 
-        fn wr_tagged_u32(&mut self, tag_id: uint, v: u32) {
+        pub fn wr_tagged_u32(&mut self, tag_id: uint, v: u32) {
             do io::u64_to_be_bytes(v as u64, 4u) |v| {
                 self.wr_tagged_bytes(tag_id, v);
             }
         }
 
-        fn wr_tagged_u16(&mut self, tag_id: uint, v: u16) {
+        pub fn wr_tagged_u16(&mut self, tag_id: uint, v: u16) {
             do io::u64_to_be_bytes(v as u64, 2u) |v| {
                 self.wr_tagged_bytes(tag_id, v);
             }
         }
 
-        fn wr_tagged_u8(&mut self, tag_id: uint, v: u8) {
+        pub fn wr_tagged_u8(&mut self, tag_id: uint, v: u8) {
             self.wr_tagged_bytes(tag_id, &[v]);
         }
 
-        fn wr_tagged_i64(&mut self, tag_id: uint, v: i64) {
+        pub fn wr_tagged_i64(&mut self, tag_id: uint, v: i64) {
             do io::u64_to_be_bytes(v as u64, 8u) |v| {
                 self.wr_tagged_bytes(tag_id, v);
             }
         }
 
-        fn wr_tagged_i32(&mut self, tag_id: uint, v: i32) {
+        pub fn wr_tagged_i32(&mut self, tag_id: uint, v: i32) {
             do io::u64_to_be_bytes(v as u64, 4u) |v| {
                 self.wr_tagged_bytes(tag_id, v);
             }
         }
 
-        fn wr_tagged_i16(&mut self, tag_id: uint, v: i16) {
+        pub fn wr_tagged_i16(&mut self, tag_id: uint, v: i16) {
             do io::u64_to_be_bytes(v as u64, 2u) |v| {
                 self.wr_tagged_bytes(tag_id, v);
             }
         }
 
-        fn wr_tagged_i8(&mut self, tag_id: uint, v: i8) {
+        pub fn wr_tagged_i8(&mut self, tag_id: uint, v: i8) {
             self.wr_tagged_bytes(tag_id, &[v as u8]);
         }
 
-        fn wr_tagged_str(&mut self, tag_id: uint, v: &str) {
+        pub fn wr_tagged_str(&mut self, tag_id: uint, v: &str) {
             str::byte_slice(v, |b| self.wr_tagged_bytes(tag_id, b));
         }
 
-        fn wr_bytes(&mut self, b: &[u8]) {
+        pub fn wr_bytes(&mut self, b: &[u8]) {
             debug!("Write %u bytes", b.len());
             self.writer.write(b);
         }
 
-        fn wr_str(&mut self, s: &str) {
+        pub fn wr_str(&mut self, s: &str) {
             debug!("Write str: %?", s);
             self.writer.write(str::to_bytes(s));
         }
@@ -740,7 +741,7 @@ fn wr_str(&mut self, s: &str) {
     // Totally lame approach.
     static debug: bool = true;
 
-    priv impl Encoder {
+    impl Encoder {
         // used internally to emit things like the vector length and so on
         fn _emit_tagged_uint(&mut self, t: EbmlEncoderTag, v: uint) {
             assert!(v <= 0xFFFF_FFFF_u);
@@ -758,8 +759,8 @@ fn _emit_label(&mut self, label: &str) {
         }
     }
 
-    pub impl Encoder {
-        fn emit_opaque(&mut self, f: &fn(&mut Encoder)) {
+    impl Encoder {
+        pub fn emit_opaque(&mut self, f: &fn(&mut Encoder)) {
             self.start_tag(EsOpaque as uint);
             f(self);
             self.end_tag();
index 2f5a43d8e84dde674ec31de67b39ae376b23efa0..31218ca9a0a54086fd55f597e0686de58d04e6e0 100644 (file)
@@ -317,8 +317,8 @@ fn send(&self, val: T) {
     }
 }
 
-pub impl<T,U:Unflattener<T>,P:BytePort> FlatPort<T, U, P> {
-    fn new(u: U, p: P) -> FlatPort<T, U, P> {
+impl<T,U:Unflattener<T>,P:BytePort> FlatPort<T, U, P> {
+    pub fn new(u: U, p: P) -> FlatPort<T, U, P> {
         FlatPort {
             unflattener: u,
             byte_port: p
@@ -326,8 +326,8 @@ fn new(u: U, p: P) -> FlatPort<T, U, P> {
     }
 }
 
-pub impl<T,F:Flattener<T>,C:ByteChan> FlatChan<T, F, C> {
-    fn new(f: F, c: C) -> FlatChan<T, F, C> {
+impl<T,F:Flattener<T>,C:ByteChan> FlatChan<T, F, C> {
+    pub fn new(f: F, c: C) -> FlatChan<T, F, C> {
         FlatChan {
             flattener: f,
             byte_chan: c
@@ -380,16 +380,16 @@ fn flatten(&self, val: T) -> ~[u8] {
         }
     }
 
-    pub impl<T:Copy + Owned> PodUnflattener<T> {
-        fn new() -> PodUnflattener<T> {
+    impl<T:Copy + Owned> PodUnflattener<T> {
+        pub fn new() -> PodUnflattener<T> {
             PodUnflattener {
                 bogus: ()
             }
         }
     }
 
-    pub impl<T:Copy + Owned> PodFlattener<T> {
-        fn new() -> PodFlattener<T> {
+    impl<T:Copy + Owned> PodFlattener<T> {
+        pub fn new() -> PodFlattener<T> {
             PodFlattener {
                 bogus: ()
             }
@@ -423,8 +423,8 @@ fn flatten(&self, val: T) -> ~[u8] {
         }
     }
 
-    pub impl<D:Decoder,T:Decodable<D>> DeserializingUnflattener<D, T> {
-        fn new(deserialize_buffer: DeserializeBuffer<T>)
+    impl<D:Decoder,T:Decodable<D>> DeserializingUnflattener<D, T> {
+        pub fn new(deserialize_buffer: DeserializeBuffer<T>)
                    -> DeserializingUnflattener<D, T> {
             DeserializingUnflattener {
                 deserialize_buffer: deserialize_buffer
@@ -432,8 +432,8 @@ fn new(deserialize_buffer: DeserializeBuffer<T>)
         }
     }
 
-    pub impl<S:Encoder,T:Encodable<S>> SerializingFlattener<S, T> {
-        fn new(serialize_value: SerializeValue<T>)
+    impl<S:Encoder,T:Encodable<S>> SerializingFlattener<S, T> {
+        pub fn new(serialize_value: SerializeValue<T>)
                    -> SerializingFlattener<S, T> {
             SerializingFlattener {
                 serialize_value: serialize_value
@@ -554,16 +554,16 @@ fn send(&self, val: ~[u8]) {
         }
     }
 
-    pub impl<R:Reader> ReaderBytePort<R> {
-        fn new(r: R) -> ReaderBytePort<R> {
+    impl<R:Reader> ReaderBytePort<R> {
+        pub fn new(r: R) -> ReaderBytePort<R> {
             ReaderBytePort {
                 reader: r
             }
         }
     }
 
-    pub impl<W:Writer> WriterByteChan<W> {
-        fn new(w: W) -> WriterByteChan<W> {
+    impl<W:Writer> WriterByteChan<W> {
+        pub fn new(w: W) -> WriterByteChan<W> {
             WriterByteChan {
                 writer: w
             }
@@ -619,8 +619,8 @@ fn send(&self, val: ~[u8]) {
         }
     }
 
-    pub impl PipeBytePort {
-        fn new(p: Port<~[u8]>) -> PipeBytePort {
+    impl PipeBytePort {
+        pub fn new(p: Port<~[u8]>) -> PipeBytePort {
             PipeBytePort {
                 port: p,
                 buf: @mut ~[]
@@ -628,8 +628,8 @@ fn new(p: Port<~[u8]>) -> PipeBytePort {
         }
     }
 
-    pub impl PipeByteChan {
-        fn new(c: Chan<~[u8]>) -> PipeByteChan {
+    impl PipeByteChan {
+        pub fn new(c: Chan<~[u8]>) -> PipeByteChan {
             PipeByteChan {
                 chan: c
             }
index 4d3a757e80ed4b926df6bf7b46682f10b6555ac3..25a3259c69654eaec7e5f65d903f37bb272652f9 100644 (file)
@@ -54,15 +54,15 @@ fn finalize(&self) {}
 }
 
 /// Methods on the `future` type
-pub impl<A:Copy> Future<A> {
-    fn get(&mut self) -> A {
+impl<A:Copy> Future<A> {
+    pub fn get(&mut self) -> A {
         //! Get the value of the future.
         *(self.get_ref())
     }
 }
 
-pub impl<A> Future<A> {
-    fn get_ref<'a>(&'a mut self) -> &'a A {
+impl<A> Future<A> {
+    pub fn get_ref<'a>(&'a mut self) -> &'a A {
         /*!
         * Executes the future's closure and then returns a borrowed
         * pointer to the result.  The borrowed pointer lasts as long as
index d69548c6f9d2d2192840660640675f40746105fe..22abe0edbb94eaa018637720e8c5793d9aa4ac33 100644 (file)
@@ -10,7 +10,9 @@
 
 // Rust JSON serialization library
 // Copyright (c) 2011 Google Inc.
+
 #[forbid(non_camel_case_types)];
+#[allow(missing_doc)];
 
 //! json serialization
 
@@ -497,8 +499,8 @@ pub fn Parser(rdr: @io::Reader) -> Parser {
     }
 }
 
-pub impl Parser {
-    fn parse(&mut self) -> Result<Json, Error> {
+impl Parser {
+    pub fn parse(&mut self) -> Result<Json, Error> {
         match self.parse_value() {
           Ok(value) => {
             // Skip trailing whitespaces.
@@ -515,7 +517,7 @@ fn parse(&mut self) -> Result<Json, Error> {
     }
 }
 
-priv impl Parser {
+impl Parser {
     fn eof(&self) -> bool { self.ch == -1 as char }
 
     fn bump(&mut self) {
index d658ad6551f241bae06bfa064c349709473df014..960319b9c3f99ab68b347729723a458d4eb977d6 100644 (file)
@@ -826,7 +826,7 @@ pub fn socket_buf(sock: TcpSocket) -> TcpSocketBuf {
 }
 
 /// Convenience methods extending `net::tcp::TcpSocket`
-pub impl TcpSocket {
+impl TcpSocket {
     pub fn read_start(&self) -> result::Result<@Port<
         result::Result<~[u8], TcpErrData>>, TcpErrData> {
         read_start(self)
@@ -835,11 +835,11 @@ pub fn read_stop(&self) ->
         result::Result<(), TcpErrData> {
         read_stop(self)
     }
-    fn read(&self, timeout_msecs: uint) ->
+    pub fn read(&self, timeout_msecs: uint) ->
         result::Result<~[u8], TcpErrData> {
         read(self, timeout_msecs)
     }
-    fn read_future(&self, timeout_msecs: uint) ->
+    pub fn read_future(&self, timeout_msecs: uint) ->
         future::Future<result::Result<~[u8], TcpErrData>> {
         read_future(self, timeout_msecs)
     }
index 80957a8c8ef966fdf0d2fb95cd5fd2a4691e2ce5..58930692965dd6145a9a5323c6aad3c444c1fc62 100644 (file)
@@ -41,16 +41,15 @@ struct UserInfo {
 
 pub type Query = ~[(~str, ~str)];
 
-pub impl Url {
-    fn new(
-        scheme: ~str,
-        user: Option<UserInfo>,
-        host: ~str,
-        port: Option<~str>,
-        path: ~str,
-        query: Query,
-        fragment: Option<~str>
-    ) -> Url {
+impl Url {
+    pub fn new(scheme: ~str,
+               user: Option<UserInfo>,
+               host: ~str,
+               port: Option<~str>,
+               path: ~str,
+               query: Query,
+               fragment: Option<~str>)
+               -> Url {
         Url {
             scheme: scheme,
             user: user,
@@ -63,8 +62,8 @@ fn new(
     }
 }
 
-pub impl UserInfo {
-    fn new(user: ~str, pass: Option<~str>) -> UserInfo {
+impl UserInfo {
+    pub fn new(user: ~str, pass: Option<~str>) -> UserInfo {
         UserInfo { user: user, pass: pass }
     }
 }
index adbaf89e16c470e76a0132aef49d985c7318a221..82f706e8f3f384e77a4aff7fd84fba7b68e76b30 100644 (file)
@@ -16,6 +16,8 @@
 A BigInt is a combination of BigUint and Sign.
 */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
@@ -1095,9 +1097,8 @@ fn from_str_radix(s: &str, radix: uint)
     }
 }
 
-pub impl BigInt {
+impl BigInt {
     /// Creates and initializes an BigInt.
-
     pub fn new(sign: Sign, v: ~[BigDigit]) -> BigInt {
         BigInt::from_biguint(sign, BigUint::new(v))
     }
@@ -1139,8 +1140,7 @@ pub fn parse_bytes(buf: &[u8], radix: uint)
             .map_consume(|bu| BigInt::from_biguint(sign, bu));
     }
 
-
-    fn to_uint(&self) -> uint {
+    pub fn to_uint(&self) -> uint {
         match self.sign {
             Plus  => self.data.to_uint(),
             Zero  => 0,
index 49fbf06406f4e4175704125c3b8ae2a5ae57d68e..b58f90beb3122c8dc3bff2a8028e899969a6770b 100644 (file)
@@ -10,6 +10,8 @@
 
 //! A priority queue implemented with a binary heap
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::old_iter::BaseIter;
@@ -44,26 +46,26 @@ impl<T:Ord> Mutable for PriorityQueue<T> {
     fn clear(&mut self) { self.data.truncate(0) }
 }
 
-pub impl <T:Ord> PriorityQueue<T> {
+impl<T:Ord> PriorityQueue<T> {
     /// Returns the greatest item in the queue - fails if empty
-    fn top<'a>(&'a self) -> &'a T { &self.data[0] }
+    pub fn top<'a>(&'a self) -> &'a T { &self.data[0] }
 
     /// Returns the greatest item in the queue - None if empty
-    fn maybe_top<'a>(&'a self) -> Option<&'a T> {
+    pub fn maybe_top<'a>(&'a self) -> Option<&'a T> {
         if self.is_empty() { None } else { Some(self.top()) }
     }
 
     /// Returns the number of elements the queue can hold without reallocating
-    fn capacity(&self) -> uint { vec::capacity(&self.data) }
+    pub fn capacity(&self) -> uint { vec::capacity(&self.data) }
 
-    fn reserve(&mut self, n: uint) { vec::reserve(&mut self.data, n) }
+    pub fn reserve(&mut self, n: uint) { vec::reserve(&mut self.data, n) }
 
-    fn reserve_at_least(&mut self, n: uint) {
+    pub fn reserve_at_least(&mut self, n: uint) {
         vec::reserve_at_least(&mut self.data, n)
     }
 
     /// Pop the greatest item from the queue - fails if empty
-    fn pop(&mut self) -> T {
+    pub fn pop(&mut self) -> T {
         let mut item = self.data.pop();
         if !self.is_empty() {
             swap(&mut item, &mut self.data[0]);
@@ -73,19 +75,19 @@ fn pop(&mut self) -> T {
     }
 
     /// Pop the greatest item from the queue - None if empty
-    fn maybe_pop(&mut self) -> Option<T> {
+    pub fn maybe_pop(&mut self) -> Option<T> {
         if self.is_empty() { None } else { Some(self.pop()) }
     }
 
     /// Push an item onto the queue
-    fn push(&mut self, item: T) {
+    pub fn push(&mut self, item: T) {
         self.data.push(item);
         let new_len = self.len() - 1;
         self.siftup(0, new_len);
     }
 
     /// Optimized version of a push followed by a pop
-    fn push_pop(&mut self, mut item: T) -> T {
+    pub fn push_pop(&mut self, mut item: T) -> T {
         if !self.is_empty() && self.data[0] > item {
             swap(&mut item, &mut self.data[0]);
             self.siftdown(0);
@@ -94,18 +96,18 @@ fn push_pop(&mut self, mut item: T) -> T {
     }
 
     /// Optimized version of a pop followed by a push - fails if empty
-    fn replace(&mut self, mut item: T) -> T {
+    pub fn replace(&mut self, mut item: T) -> T {
         swap(&mut item, &mut self.data[0]);
         self.siftdown(0);
         item
     }
 
     /// Consume the PriorityQueue and return the underlying vector
-    fn to_vec(self) -> ~[T] { let PriorityQueue{data: v} = self; v }
+    pub fn to_vec(self) -> ~[T] { let PriorityQueue{data: v} = self; v }
 
     /// Consume the PriorityQueue and return a vector in sorted
     /// (ascending) order
-    fn to_sorted_vec(self) -> ~[T] {
+    pub fn to_sorted_vec(self) -> ~[T] {
         let mut q = self;
         let mut end = q.len();
         while end > 1 {
@@ -117,10 +119,10 @@ fn to_sorted_vec(self) -> ~[T] {
     }
 
     /// Create an empty PriorityQueue
-    fn new() -> PriorityQueue<T> { PriorityQueue{data: ~[],} }
+    pub fn new() -> PriorityQueue<T> { PriorityQueue{data: ~[],} }
 
     /// Create a PriorityQueue from a vector (heapify)
-    fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
+    pub fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
         let mut q = PriorityQueue{data: xs,};
         let mut n = q.len() / 2;
         while n > 0 {
@@ -135,8 +137,7 @@ fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
     // zeroed element), shift along the others and move it back into the
     // vector over the junk element.  This reduces the constant factor
     // compared to using swaps, which involves twice as many moves.
-
-    priv fn siftup(&mut self, start: uint, mut pos: uint) {
+    fn siftup(&mut self, start: uint, mut pos: uint) {
         unsafe {
             let new = replace(&mut self.data[pos], init());
 
@@ -154,7 +155,7 @@ fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
         }
     }
 
-    priv fn siftdown_range(&mut self, mut pos: uint, end: uint) {
+    fn siftdown_range(&mut self, mut pos: uint, end: uint) {
         unsafe {
             let start = pos;
             let new = replace(&mut self.data[pos], init());
@@ -176,7 +177,7 @@ fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
         }
     }
 
-    priv fn siftdown(&mut self, pos: uint) {
+    fn siftdown(&mut self, pos: uint) {
         let len = self.len();
         self.siftdown_range(pos, len);
     }
index 8cd1c893bb6f04ed8d4b66221aec53eb75135b1a..1ec72f2ea9f6595f0eb830e8ece3ce34893c6cad 100644 (file)
@@ -40,7 +40,7 @@ pub struct Rc<T> {
     priv ptr: *mut RcBox<T>,
 }
 
-priv impl<T> Rc<T> {
+impl<T> Rc<T> {
     unsafe fn new(value: T) -> Rc<T> {
         let ptr = malloc(sys::size_of::<RcBox<T>>() as size_t) as *mut RcBox<T>;
         assert!(!ptr::is_null(ptr));
@@ -59,9 +59,9 @@ pub fn rc_from_const<T: Const>(value: T) -> Rc<T> {
     unsafe { Rc::new(value) }
 }
 
-pub impl<T> Rc<T> {
+impl<T> Rc<T> {
     #[inline(always)]
-    fn borrow<'r>(&'r self) -> &'r T {
+    pub fn borrow<'r>(&'r self) -> &'r T {
         unsafe { cast::copy_lifetime(self, &(*self.ptr).value) }
     }
 }
@@ -170,7 +170,7 @@ pub struct RcMut<T> {
     priv ptr: *mut RcMutBox<T>,
 }
 
-priv impl<T> RcMut<T> {
+impl<T> RcMut<T> {
     unsafe fn new(value: T) -> RcMut<T> {
         let ptr = malloc(sys::size_of::<RcMutBox<T>>() as size_t) as *mut RcMutBox<T>;
         assert!(!ptr::is_null(ptr));
@@ -189,10 +189,10 @@ pub fn rc_mut_from_const<T: Const>(value: T) -> RcMut<T> {
     unsafe { RcMut::new(value) }
 }
 
-pub impl<T> RcMut<T> {
+impl<T> RcMut<T> {
     /// Fails if there is already a mutable borrow of the box
     #[inline]
-    fn with_borrow<U>(&self, f: &fn(&T) -> U) -> U {
+    pub fn with_borrow<U>(&self, f: &fn(&T) -> U) -> U {
         unsafe {
             assert!((*self.ptr).borrow != Mutable);
             let previous = (*self.ptr).borrow;
@@ -205,7 +205,7 @@ fn with_borrow<U>(&self, f: &fn(&T) -> U) -> U {
 
     /// Fails if there is already a mutable or immutable borrow of the box
     #[inline]
-    fn with_mut_borrow<U>(&self, f: &fn(&mut T) -> U) -> U {
+    pub fn with_mut_borrow<U>(&self, f: &fn(&mut T) -> U) -> U {
         unsafe {
             assert_eq!((*self.ptr).borrow, Nothing);
             (*self.ptr).borrow = Mutable;
index 98392fc41e1bcf3ba7d03dfebebc88afe2dc76a9..7f566bc16e7321614a2f6930ed6cea5c57ad6b86 100644 (file)
@@ -13,6 +13,8 @@
  * are O(highest integer key).
  */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::cmp;
@@ -152,12 +154,12 @@ fn pop(&mut self, key: &uint) -> Option<V> {
     }
 }
 
-pub impl<V> SmallIntMap<V> {
+impl<V> SmallIntMap<V> {
     /// Create an empty SmallIntMap
-    fn new() -> SmallIntMap<V> { SmallIntMap{v: ~[]} }
+    pub fn new() -> SmallIntMap<V> { SmallIntMap{v: ~[]} }
 
     /// Visit all key-value pairs in reverse order
-    fn each_reverse<'a>(&'a self, it: &fn(uint, &'a V) -> bool) -> bool {
+    pub fn each_reverse<'a>(&'a self, it: &fn(uint, &'a V) -> bool) -> bool {
         for uint::range_rev(self.v.len(), 0) |i| {
             match self.v[i - 1] {
               Some(ref elt) => if !it(i - 1, elt) { return false; },
@@ -167,14 +169,14 @@ fn each_reverse<'a>(&'a self, it: &fn(uint, &'a V) -> bool) -> bool {
         return true;
     }
 
-    fn get<'a>(&'a self, key: &uint) -> &'a V {
+    pub fn get<'a>(&'a self, key: &uint) -> &'a V {
         self.find(key).expect("key not present")
     }
 }
 
-pub impl<V:Copy> SmallIntMap<V> {
-    fn update_with_key(&mut self, key: uint, val: V,
-                       ff: &fn(uint, V, V) -> V) -> bool {
+impl<V:Copy> SmallIntMap<V> {
+    pub fn update_with_key(&mut self, key: uint, val: V,
+                           ff: &fn(uint, V, V) -> V) -> bool {
         let new_val = match self.find(&key) {
             None => val,
             Some(orig) => ff(key, *orig, val)
@@ -182,7 +184,8 @@ fn update_with_key(&mut self, key: uint, val: V,
         self.insert(key, new_val)
     }
 
-    fn update(&mut self, key: uint, newval: V, ff: &fn(V, V) -> V) -> bool {
+    pub fn update(&mut self, key: uint, newval: V, ff: &fn(V, V) -> V)
+                  -> bool {
         self.update_with_key(key, newval, |_k, v, v1| ff(v,v1))
     }
 }
@@ -280,9 +283,9 @@ fn union(&self, other: &SmallIntSet, f: &fn(&uint) -> bool) -> bool {
     }
 }
 
-pub impl SmallIntSet {
+impl SmallIntSet {
     /// Create an empty SmallIntSet
-    fn new() -> SmallIntSet { SmallIntSet{map: SmallIntMap::new()} }
+    pub fn new() -> SmallIntSet { SmallIntSet{map: SmallIntMap::new()} }
 }
 
 #[cfg(test)]
index 5a1982d830d650ce2293af2975d5cf35ad79eac8..29a2dec38ab671d9dde15268523786848ffa7824 100644 (file)
@@ -99,8 +99,8 @@ fn new_sem_and_signal(count: int, num_condvars: uint)
 }
 
 #[doc(hidden)]
-pub impl<Q:Owned> Sem<Q> {
-    fn acquire(&self) {
+impl<Q:Owned> Sem<Q> {
+    pub fn acquire(&self) {
         unsafe {
             let mut waiter_nobe = None;
             do (**self).with |state| {
@@ -122,7 +122,8 @@ fn acquire(&self) {
             }
         }
     }
-    fn release(&self) {
+
+    pub fn release(&self) {
         unsafe {
             do (**self).with |state| {
                 state.count += 1;
@@ -135,8 +136,8 @@ fn release(&self) {
 }
 // FIXME(#3154) move both copies of this into Sem<Q>, and unify the 2 structs
 #[doc(hidden)]
-pub impl Sem<()> {
-    fn access<U>(&self, blk: &fn() -> U) -> U {
+impl Sem<()> {
+    pub fn access<U>(&self, blk: &fn() -> U) -> U {
         let mut release = None;
         unsafe {
             do task::unkillable {
@@ -147,9 +148,10 @@ fn access<U>(&self, blk: &fn() -> U) -> U {
         blk()
     }
 }
+
 #[doc(hidden)]
-pub impl Sem<~[Waitqueue]> {
-    fn access<U>(&self, blk: &fn() -> U) -> U {
+impl Sem<~[Waitqueue]> {
+    pub fn access<U>(&self, blk: &fn() -> U) -> U {
         let mut release = None;
         unsafe {
             do task::unkillable {
@@ -193,7 +195,7 @@ pub struct Condvar<'self> { priv sem: &'self Sem<~[Waitqueue]> }
 #[unsafe_destructor]
 impl<'self> Drop for Condvar<'self> { fn finalize(&self) {} }
 
-pub impl<'self> Condvar<'self> {
+impl<'self> Condvar<'self> {
     /**
      * Atomically drop the associated lock, and block until a signal is sent.
      *
@@ -202,7 +204,7 @@ pub impl<'self> Condvar<'self> {
      * while waiting on a condition variable will wake up, fail, and unlock
      * the associated lock as it unwinds.
      */
-    fn wait(&self) { self.wait_on(0) }
+    pub fn wait(&self) { self.wait_on(0) }
 
     /**
      * As wait(), but can specify which of multiple condition variables to
@@ -215,7 +217,7 @@ fn wait(&self) { self.wait_on(0) }
      *
      * wait() is equivalent to wait_on(0).
      */
-    fn wait_on(&self, condvar_id: uint) {
+    pub fn wait_on(&self, condvar_id: uint) {
         // Create waiter nobe.
         let (WaitEnd, SignalEnd) = comm::oneshot();
         let mut WaitEnd   = Some(WaitEnd);
@@ -284,10 +286,10 @@ fn SemAndSignalReacquire<'r>(sem: &'r Sem<~[Waitqueue]>)
     }
 
     /// Wake up a blocked task. Returns false if there was no blocked task.
-    fn signal(&self) -> bool { self.signal_on(0) }
+    pub fn signal(&self) -> bool { self.signal_on(0) }
 
     /// As signal, but with a specified condvar_id. See wait_on.
-    fn signal_on(&self, condvar_id: uint) -> bool {
+    pub fn signal_on(&self, condvar_id: uint) -> bool {
         unsafe {
             let mut out_of_bounds = None;
             let mut result = false;
@@ -305,10 +307,10 @@ fn signal_on(&self, condvar_id: uint) -> bool {
     }
 
     /// Wake up all blocked tasks. Returns the number of tasks woken.
-    fn broadcast(&self) -> uint { self.broadcast_on(0) }
+    pub fn broadcast(&self) -> uint { self.broadcast_on(0) }
 
     /// As broadcast, but with a specified condvar_id. See wait_on.
-    fn broadcast_on(&self, condvar_id: uint) -> uint {
+    pub fn broadcast_on(&self, condvar_id: uint) -> uint {
         let mut out_of_bounds = None;
         let mut queue = None;
         unsafe {
@@ -347,9 +349,9 @@ fn check_cvar_bounds<U>(out_of_bounds: Option<uint>, id: uint, act: &str,
 }
 
 #[doc(hidden)]
-pub impl Sem<~[Waitqueue]> {
+impl Sem<~[Waitqueue]> {
     // The only other place that condvars get built is rwlock_write_mode.
-    fn access_cond<U>(&self, blk: &fn(c: &Condvar) -> U) -> U {
+    pub fn access_cond<U>(&self, blk: &fn(c: &Condvar) -> U) -> U {
         do self.access { blk(&Condvar { sem: self }) }
     }
 }
@@ -373,21 +375,21 @@ fn clone(&self) -> Semaphore {
     }
 }
 
-pub impl Semaphore {
+impl Semaphore {
     /**
      * Acquire a resource represented by the semaphore. Blocks if necessary
      * until resource(s) become available.
      */
-    fn acquire(&self) { (&self.sem).acquire() }
+    pub fn acquire(&self) { (&self.sem).acquire() }
 
     /**
      * Release a held resource represented by the semaphore. Wakes a blocked
      * contending task, if any exist. Won't block the caller.
      */
-    fn release(&self) { (&self.sem).release() }
+    pub fn release(&self) { (&self.sem).release() }
 
     /// Run a function with ownership of one of the semaphore's resources.
-    fn access<U>(&self, blk: &fn() -> U) -> U { (&self.sem).access(blk) }
+    pub fn access<U>(&self, blk: &fn() -> U) -> U { (&self.sem).access(blk) }
 }
 
 /****************************************************************************
@@ -421,12 +423,12 @@ impl Clone for Mutex {
     fn clone(&self) -> Mutex { Mutex { sem: Sem((*self.sem).clone()) } }
 }
 
-pub impl Mutex {
+impl Mutex {
     /// Run a function with ownership of the mutex.
-    fn lock<U>(&self, blk: &fn() -> U) -> U { (&self.sem).access(blk) }
+    pub fn lock<U>(&self, blk: &fn() -> U) -> U { (&self.sem).access(blk) }
 
     /// Run a function with ownership of the mutex and a handle to a condvar.
-    fn lock_cond<U>(&self, blk: &fn(c: &Condvar) -> U) -> U {
+    pub fn lock_cond<U>(&self, blk: &fn(c: &Condvar) -> U) -> U {
         (&self.sem).access_cond(blk)
     }
 }
@@ -470,9 +472,9 @@ pub fn rwlock_with_condvars(num_condvars: uint) -> RWlock {
                                              read_count: 0 }) }
 }
 
-pub impl RWlock {
+impl RWlock {
     /// Create a new handle to the rwlock.
-    fn clone(&self) -> RWlock {
+    pub fn clone(&self) -> RWlock {
         RWlock { order_lock:  (&(self.order_lock)).clone(),
                  access_lock: Sem((*self.access_lock).clone()),
                  state:       self.state.clone() }
@@ -482,7 +484,7 @@ fn clone(&self) -> RWlock {
      * Run a function with the rwlock in read mode. Calls to 'read' from other
      * tasks may run concurrently with this one.
      */
-    fn read<U>(&self, blk: &fn() -> U) -> U {
+    pub fn read<U>(&self, blk: &fn() -> U) -> U {
         let mut release = None;
         unsafe {
             do task::unkillable {
@@ -513,7 +515,7 @@ fn read<U>(&self, blk: &fn() -> U) -> U {
      * Run a function with the rwlock in write mode. No calls to 'read' or
      * 'write' from other tasks will run concurrently with this one.
      */
-    fn write<U>(&self, blk: &fn() -> U) -> U {
+    pub fn write<U>(&self, blk: &fn() -> U) -> U {
         unsafe {
             do task::unkillable {
                 (&self.order_lock).acquire();
@@ -531,7 +533,7 @@ fn write<U>(&self, blk: &fn() -> U) -> U {
      * the waiting task is signalled. (Note: a writer that waited and then
      * was signalled might reacquire the lock before other waiting writers.)
      */
-    fn write_cond<U>(&self, blk: &fn(c: &Condvar) -> U) -> U {
+    pub fn write_cond<U>(&self, blk: &fn(c: &Condvar) -> U) -> U {
         // NB: You might think I should thread the order_lock into the cond
         // wait call, so that it gets waited on before access_lock gets
         // reacquired upon being woken up. However, (a) this would be not
@@ -569,7 +571,7 @@ fn write_cond<U>(&self, blk: &fn(c: &Condvar) -> U) -> U {
      * }
      * ~~~
      */
-    fn write_downgrade<U>(&self, blk: &fn(v: RWlockWriteMode) -> U) -> U {
+    pub fn write_downgrade<U>(&self, blk: &fn(v: RWlockWriteMode) -> U) -> U {
         // Implementation slightly different from the slicker 'write's above.
         // The exit path is conditional on whether the caller downgrades.
         let mut _release = None;
@@ -585,9 +587,8 @@ fn write_downgrade<U>(&self, blk: &fn(v: RWlockWriteMode) -> U) -> U {
     }
 
     /// To be called inside of the write_downgrade block.
-    fn downgrade<'a>(&self,
-                     token: RWlockWriteMode<'a>)
-                  -> RWlockReadMode<'a> {
+    pub fn downgrade<'a>(&self, token: RWlockWriteMode<'a>)
+                         -> RWlockReadMode<'a> {
         if !ptr::ref_eq(self, token.lock) {
             fail!("Can't downgrade() with a different rwlock's write_mode!");
         }
@@ -703,18 +704,18 @@ pub struct RWlockReadMode<'self> { priv lock: &'self RWlock }
 #[unsafe_destructor]
 impl<'self> Drop for RWlockReadMode<'self> { fn finalize(&self) {} }
 
-pub impl<'self> RWlockWriteMode<'self> {
+impl<'self> RWlockWriteMode<'self> {
     /// Access the pre-downgrade rwlock in write mode.
-    fn write<U>(&self, blk: &fn() -> U) -> U { blk() }
+    pub fn write<U>(&self, blk: &fn() -> U) -> U { blk() }
     /// Access the pre-downgrade rwlock in write mode with a condvar.
-    fn write_cond<U>(&self, blk: &fn(c: &Condvar) -> U) -> U {
+    pub fn write_cond<U>(&self, blk: &fn(c: &Condvar) -> U) -> U {
         blk(&Condvar { sem: &self.lock.access_lock })
     }
 }
 
-pub impl<'self> RWlockReadMode<'self> {
+impl<'self> RWlockReadMode<'self> {
     /// Access the post-downgrade rwlock in read mode.
-    fn read<U>(&self, blk: &fn() -> U) -> U { blk() }
+    pub fn read<U>(&self, blk: &fn() -> U) -> U { blk() }
 }
 
 /****************************************************************************
index 06bc3167040d2fc45e16b651cd3aa92751df147d..b88bbff2a6668fa127ac5d6efdfe91a1dbac8cb7 100644 (file)
@@ -42,16 +42,16 @@ fn finalize(&self) {
     }
 }
 
-pub impl<T> TaskPool<T> {
+impl<T> TaskPool<T> {
     /// Spawns a new task pool with `n_tasks` tasks. If the `sched_mode`
     /// is None, the tasks run on this scheduler; otherwise, they run on a
     /// new scheduler with the given mode. The provided `init_fn_factory`
     /// returns a function which, given the index of the task, should return
     /// local data to be kept around in that task.
-    fn new(n_tasks: uint,
-           opt_sched_mode: Option<SchedMode>,
-           init_fn_factory: ~fn() -> ~fn(uint) -> T)
-        -> TaskPool<T> {
+    pub fn new(n_tasks: uint,
+               opt_sched_mode: Option<SchedMode>,
+               init_fn_factory: ~fn() -> ~fn(uint) -> T)
+               -> TaskPool<T> {
         assert!(n_tasks >= 1);
 
         let channels = do vec::from_fn(n_tasks) |i| {
@@ -89,7 +89,7 @@ fn new(n_tasks: uint,
 
     /// Executes the function `f` on a task in the pool. The function
     /// receives a reference to the local data returned by the `init_fn`.
-    fn execute(&mut self, f: ~fn(&T)) {
+    pub fn execute(&mut self, f: ~fn(&T)) {
         self.channels[self.next_index].send(Execute(f));
         self.next_index += 1;
         if self.next_index == self.channels.len() { self.next_index = 0; }
index 141700bd0b3a3d43f245ba60bd4fa2386281c7e8..16743d27a17cccb66848c06e624192f0242d8859 100644 (file)
@@ -617,8 +617,7 @@ pub mod bench {
     use test::{BenchHarness, BenchSamples};
     use time::precise_time_ns;
 
-    pub impl BenchHarness {
-
+    impl BenchHarness {
         /// Callback for benchmark functions to run in their body.
         pub fn iter(&mut self, inner:&fn()) {
             self.ns_start = precise_time_ns();
@@ -629,7 +628,7 @@ pub fn iter(&mut self, inner:&fn()) {
             self.ns_end = precise_time_ns();
         }
 
-        fn ns_elapsed(&mut self) -> u64 {
+        pub fn ns_elapsed(&mut self) -> u64 {
             if self.ns_start == 0 || self.ns_end == 0 {
                 0
             } else {
@@ -637,7 +636,7 @@ fn ns_elapsed(&mut self) -> u64 {
             }
         }
 
-        fn ns_per_iter(&mut self) -> u64 {
+        pub fn ns_per_iter(&mut self) -> u64 {
             if self.iterations == 0 {
                 0
             } else {
@@ -645,7 +644,7 @@ fn ns_per_iter(&mut self) -> u64 {
             }
         }
 
-        fn bench_n(&mut self, n: u64, f: &fn(&mut BenchHarness)) {
+        pub fn bench_n(&mut self, n: u64, f: &fn(&mut BenchHarness)) {
             self.iterations = n;
             debug!("running benchmark for %u iterations",
                    n as uint);
index 1a3a5db66aef9b67c1e75468cedbda4f0bf6a901..758181980a832fef53f11af3cef81c65a1885394 100644 (file)
@@ -49,8 +49,8 @@ pub struct Timespec { sec: i64, nsec: i32 }
  * -1.2 seconds before the epoch is represented by `Timespec { sec: -2_i64,
  * nsec: 800_000_000_i32 }`.
  */
-pub impl Timespec {
-    fn new(sec: i64, nsec: i32) -> Timespec {
+impl Timespec {
+    pub fn new(sec: i64, nsec: i32) -> Timespec {
         assert!(nsec >= 0 && nsec < NSEC_PER_SEC);
         Timespec { sec: sec, nsec: nsec }
     }
@@ -180,9 +180,9 @@ pub fn strftime(format: &str, tm: &Tm) -> ~str {
     do_strftime(format, tm)
 }
 
-pub impl Tm {
+impl Tm {
     /// Convert time to the seconds from January 1, 1970
-    fn to_timespec(&self) -> Timespec {
+    pub fn to_timespec(&self) -> Timespec {
         unsafe {
             let sec = match self.tm_gmtoff {
                 0_i32 => rustrt::rust_timegm(self),
@@ -194,12 +194,12 @@ fn to_timespec(&self) -> Timespec {
     }
 
     /// Convert time to the local timezone
-    fn to_local(&self) -> Tm {
+    pub fn to_local(&self) -> Tm {
         at(self.to_timespec())
     }
 
     /// Convert time to the UTC
-    fn to_utc(&self) -> Tm {
+    pub fn to_utc(&self) -> Tm {
         at_utc(self.to_timespec())
     }
 
@@ -207,10 +207,10 @@ fn to_utc(&self) -> Tm {
      * Return a string of the current time in the form
      * "Thu Jan  1 00:00:00 1970".
      */
-    fn ctime(&self) -> ~str { self.strftime("%c") }
+    pub fn ctime(&self) -> ~str { self.strftime("%c") }
 
     /// Formats the time according to the format string.
-    fn strftime(&self, format: &str) -> ~str {
+    pub fn strftime(&self, format: &str) -> ~str {
         strftime(format, self)
     }
 
@@ -220,7 +220,7 @@ fn strftime(&self, format: &str) -> ~str {
      * local: "Thu, 22 Mar 2012 07:53:18 PST"
      * utc:   "Thu, 22 Mar 2012 14:53:18 UTC"
      */
-    fn rfc822(&self) -> ~str {
+    pub fn rfc822(&self) -> ~str {
         if self.tm_gmtoff == 0_i32 {
             self.strftime("%a, %d %b %Y %T GMT")
         } else {
@@ -234,7 +234,7 @@ fn rfc822(&self) -> ~str {
      * local: "Thu, 22 Mar 2012 07:53:18 -0700"
      * utc:   "Thu, 22 Mar 2012 14:53:18 -0000"
      */
-    fn rfc822z(&self) -> ~str {
+    pub fn rfc822z(&self) -> ~str {
         self.strftime("%a, %d %b %Y %T %z")
     }
 
@@ -244,7 +244,7 @@ fn rfc822z(&self) -> ~str {
      * local: "2012-02-22T07:53:18-07:00"
      * utc:   "2012-02-22T14:53:18Z"
      */
-    fn rfc3339(&self) -> ~str {
+    pub fn rfc3339(&self) -> ~str {
         if self.tm_gmtoff == 0_i32 {
             self.strftime("%Y-%m-%dT%H:%M:%SZ")
         } else {
index e6db84e855cf5cd83bf0065fc1f618e39c20e78f..c39984791689c893e62ad5f68f6c48a9b1d0ebef 100644 (file)
@@ -181,28 +181,28 @@ fn pop(&mut self, key: &K) -> Option<V> {
     }
 }
 
-pub impl<K: TotalOrd, V> TreeMap<K, V> {
+impl<K: TotalOrd, V> TreeMap<K, V> {
     /// Create an empty TreeMap
-    fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
+    pub fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
 
     /// Visit all key-value pairs in reverse order
-    fn each_reverse<'a>(&'a self, f: &fn(&'a K, &'a V) -> bool) -> bool {
+    pub fn each_reverse<'a>(&'a self, f: &fn(&'a K, &'a V) -> bool) -> bool {
         each_reverse(&self.root, f)
     }
 
     /// Visit all keys in reverse order
-    fn each_key_reverse(&self, f: &fn(&K) -> bool) -> bool {
+    pub fn each_key_reverse(&self, f: &fn(&K) -> bool) -> bool {
         self.each_reverse(|k, _| f(k))
     }
 
     /// Visit all values in reverse order
-    fn each_value_reverse(&self, f: &fn(&V) -> bool) -> bool {
+    pub fn each_value_reverse(&self, f: &fn(&V) -> bool) -> bool {
         self.each_reverse(|_, v| f(v))
     }
 
     /// Get a lazy iterator over the key-value pairs in the map.
     /// Requires that it be frozen (immutable).
-    fn iter<'a>(&'a self) -> TreeMapIterator<'a, K, V> {
+    pub fn iter<'a>(&'a self) -> TreeMapIterator<'a, K, V> {
         TreeMapIterator{stack: ~[], node: &self.root}
     }
 }
@@ -489,15 +489,15 @@ fn union(&self, other: &TreeSet<T>, f: &fn(&T) -> bool) -> bool {
     }
 }
 
-pub impl <T: TotalOrd> TreeSet<T> {
+impl<T: TotalOrd> TreeSet<T> {
     /// Create an empty TreeSet
     #[inline(always)]
-    fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} }
+    pub fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} }
 
     /// Get a lazy iterator over the values in the set.
     /// Requires that it be frozen (immutable).
     #[inline(always)]
-    fn iter<'a>(&'a self) -> TreeSetIterator<'a, T> {
+    pub fn iter<'a>(&'a self) -> TreeSetIterator<'a, T> {
         TreeSetIterator{iter: self.map.iter()}
     }
 }
@@ -517,9 +517,10 @@ struct TreeNode<K, V> {
     level: uint
 }
 
-pub impl<K: TotalOrd, V> TreeNode<K, V> {
+impl<K: TotalOrd, V> TreeNode<K, V> {
+    /// Creates a new tree node.
     #[inline(always)]
-    fn new(key: K, value: V) -> TreeNode<K, V> {
+    pub fn new(key: K, value: V) -> TreeNode<K, V> {
         TreeNode{key: key, value: value, left: None, right: None, level: 1}
     }
 }
index 47a717a56a58e17a8c70e43956c36289246b65e5..5d494b1b9165b3a7986d7b707a2af2ec2b7bceab 100644 (file)
@@ -127,9 +127,12 @@ fn gt(&self, other: &WorkKey) -> bool {
     }
 }
 
-pub impl WorkKey {
-    fn new(kind: &str, name: &str) -> WorkKey {
-    WorkKey { kind: kind.to_owned(), name: name.to_owned() }
+impl WorkKey {
+    pub fn new(kind: &str, name: &str) -> WorkKey {
+        WorkKey {
+            kind: kind.to_owned(),
+            name: name.to_owned(),
+        }
     }
 }
 
@@ -167,11 +170,11 @@ struct Database {
     db_dirty: bool
 }
 
-pub impl Database {
-    fn prepare(&mut self,
-               fn_name: &str,
-               declared_inputs: &WorkMap)
-               -> Option<(WorkMap, WorkMap, ~str)> {
+impl Database {
+    pub fn prepare(&mut self,
+                   fn_name: &str,
+                   declared_inputs: &WorkMap)
+                   -> Option<(WorkMap, WorkMap, ~str)> {
         let k = json_encode(&(fn_name, declared_inputs));
         match self.db_cache.find(&k) {
             None => None,
@@ -179,12 +182,12 @@ fn prepare(&mut self,
         }
     }
 
-    fn cache(&mut self,
-             fn_name: &str,
-             declared_inputs: &WorkMap,
-             discovered_inputs: &WorkMap,
-             discovered_outputs: &WorkMap,
-             result: &str) {
+    pub fn cache(&mut self,
+                 fn_name: &str,
+                 declared_inputs: &WorkMap,
+                 discovered_inputs: &WorkMap,
+                 discovered_outputs: &WorkMap,
+                 result: &str) {
         let k = json_encode(&(fn_name, declared_inputs));
         let v = json_encode(&(discovered_inputs,
                               discovered_outputs,
@@ -199,8 +202,8 @@ struct Logger {
     a: ()
 }
 
-pub impl Logger {
-    fn info(&self, i: &str) {
+impl Logger {
+    pub fn info(&self, i: &str) {
         io::println(~"workcache: " + i);
     }
 }
@@ -257,11 +260,9 @@ fn digest_file(path: &Path) -> ~str {
     sha.result_str()
 }
 
-pub impl Context {
-
-    fn new(db: @mut Database,
-                  lg: @mut Logger,
-                  cfg: @json::Object) -> Context {
+impl Context {
+    pub fn new(db: @mut Database, lg: @mut Logger, cfg: @json::Object)
+               -> Context {
         Context {
             db: db,
             logger: lg,
@@ -270,12 +271,12 @@ fn new(db: @mut Database,
         }
     }
 
-    fn prep<T:Owned +
-              Encodable<json::Encoder> +
-              Decodable<json::Decoder>>( // FIXME(#5121)
-                  @self,
-                  fn_name:&str,
-                  blk: &fn(@mut Prep)->Work<T>) -> Work<T> {
+    pub fn prep<T:Owned +
+                  Encodable<json::Encoder> +
+                  Decodable<json::Decoder>>(@self, // FIXME(#5121)
+                                            fn_name:&str,
+                                            blk: &fn(@mut Prep)->Work<T>)
+                                            -> Work<T> {
         let p = @mut Prep {
             ctxt: self,
             fn_name: fn_name.to_owned(),
@@ -363,10 +364,10 @@ fn exec<T:Owned +
     }
 }
 
-pub impl<T:Owned +
-         Encodable<json::Encoder> +
-         Decodable<json::Decoder>> Work<T> { // FIXME(#5121)
-    fn new(p: @mut Prep, e: Either<T,PortOne<(Exec,T)>>) -> Work<T> {
+impl<T:Owned +
+       Encodable<json::Encoder> +
+       Decodable<json::Decoder>> Work<T> { // FIXME(#5121)
+    pub fn new(p: @mut Prep, e: Either<T,PortOne<(Exec,T)>>) -> Work<T> {
         Work { prep: p, res: Some(e) }
     }
 }
index 25c860ab2f0a8c7932fb9d5d89b586a88e77e8af..ab895221de1337939bf7e3db31d43de3d065dcc9 100644 (file)
@@ -188,112 +188,116 @@ pub struct Session_ {
 
 pub type Session = @Session_;
 
-pub impl Session_ {
-    fn span_fatal(@self, sp: span, msg: &str) -> ! {
+impl Session_ {
+    pub fn span_fatal(@self, sp: span, msg: &str) -> ! {
         self.span_diagnostic.span_fatal(sp, msg)
     }
-    fn fatal(@self, msg: &str) -> ! {
+    pub fn fatal(@self, msg: &str) -> ! {
         self.span_diagnostic.handler().fatal(msg)
     }
-    fn span_err(@self, sp: span, msg: &str) {
+    pub fn span_err(@self, sp: span, msg: &str) {
         self.span_diagnostic.span_err(sp, msg)
     }
-    fn err(@self, msg: &str) {
+    pub fn err(@self, msg: &str) {
         self.span_diagnostic.handler().err(msg)
     }
-    fn err_count(@self) -> uint {
+    pub fn err_count(@self) -> uint {
         self.span_diagnostic.handler().err_count()
     }
-    fn has_errors(@self) -> bool {
+    pub fn has_errors(@self) -> bool {
         self.span_diagnostic.handler().has_errors()
     }
-    fn abort_if_errors(@self) {
+    pub fn abort_if_errors(@self) {
         self.span_diagnostic.handler().abort_if_errors()
     }
-    fn span_warn(@self, sp: span, msg: &str) {
+    pub fn span_warn(@self, sp: span, msg: &str) {
         self.span_diagnostic.span_warn(sp, msg)
     }
-    fn warn(@self, msg: &str) {
+    pub fn warn(@self, msg: &str) {
         self.span_diagnostic.handler().warn(msg)
     }
-    fn span_note(@self, sp: span, msg: &str) {
+    pub fn span_note(@self, sp: span, msg: &str) {
         self.span_diagnostic.span_note(sp, msg)
     }
-    fn note(@self, msg: &str) {
+    pub fn note(@self, msg: &str) {
         self.span_diagnostic.handler().note(msg)
     }
-    fn span_bug(@self, sp: span, msg: &str) -> ! {
+    pub fn span_bug(@self, sp: span, msg: &str) -> ! {
         self.span_diagnostic.span_bug(sp, msg)
     }
-    fn bug(@self, msg: &str) -> ! {
+    pub fn bug(@self, msg: &str) -> ! {
         self.span_diagnostic.handler().bug(msg)
     }
-    fn span_unimpl(@self, sp: span, msg: &str) -> ! {
+    pub fn span_unimpl(@self, sp: span, msg: &str) -> ! {
         self.span_diagnostic.span_unimpl(sp, msg)
     }
-    fn unimpl(@self, msg: &str) -> ! {
+    pub fn unimpl(@self, msg: &str) -> ! {
         self.span_diagnostic.handler().unimpl(msg)
     }
-    fn add_lint(@self, lint: lint::lint, id: ast::node_id, sp: span, msg: ~str) {
+    pub fn add_lint(@self,
+                    lint: lint::lint,
+                    id: ast::node_id,
+                    sp: span,
+                    msg: ~str) {
         match self.lints.find_mut(&id) {
             Some(arr) => { arr.push((lint, sp, msg)); return; }
             None => {}
         }
         self.lints.insert(id, ~[(lint, sp, msg)]);
     }
-    fn next_node_id(@self) -> ast::node_id {
+    pub fn next_node_id(@self) -> ast::node_id {
         return syntax::parse::next_node_id(self.parse_sess);
     }
-    fn diagnostic(@self) -> @diagnostic::span_handler {
+    pub fn diagnostic(@self) -> @diagnostic::span_handler {
         self.span_diagnostic
     }
-    fn debugging_opt(@self, opt: uint) -> bool {
+    pub fn debugging_opt(@self, opt: uint) -> bool {
         (self.opts.debugging_opts & opt) != 0u
     }
     // This exists to help with refactoring to eliminate impossible
     // cases later on
-    fn impossible_case(@self, sp: span, msg: &str) -> ! {
+    pub fn impossible_case(@self, sp: span, msg: &str) -> ! {
         self.span_bug(sp, fmt!("Impossible case reached: %s", msg));
     }
-    fn verbose(@self) -> bool { self.debugging_opt(verbose) }
-    fn time_passes(@self) -> bool { self.debugging_opt(time_passes) }
-    fn count_llvm_insns(@self) -> bool {
+    pub fn verbose(@self) -> bool { self.debugging_opt(verbose) }
+    pub fn time_passes(@self) -> bool { self.debugging_opt(time_passes) }
+    pub fn count_llvm_insns(@self) -> bool {
         self.debugging_opt(count_llvm_insns)
     }
-    fn count_type_sizes(@self) -> bool {
+    pub fn count_type_sizes(@self) -> bool {
         self.debugging_opt(count_type_sizes)
     }
-    fn time_llvm_passes(@self) -> bool {
+    pub fn time_llvm_passes(@self) -> bool {
         self.debugging_opt(time_llvm_passes)
     }
-    fn trans_stats(@self) -> bool { self.debugging_opt(trans_stats) }
-    fn meta_stats(@self) -> bool { self.debugging_opt(meta_stats) }
-    fn asm_comments(@self) -> bool { self.debugging_opt(asm_comments) }
-    fn no_verify(@self) -> bool { self.debugging_opt(no_verify) }
-    fn lint_llvm(@self) -> bool { self.debugging_opt(lint_llvm) }
-    fn trace(@self) -> bool { self.debugging_opt(trace) }
-    fn coherence(@self) -> bool { self.debugging_opt(coherence) }
-    fn borrowck_stats(@self) -> bool { self.debugging_opt(borrowck_stats) }
-    fn borrowck_note_pure(@self) -> bool {
+    pub fn trans_stats(@self) -> bool { self.debugging_opt(trans_stats) }
+    pub fn meta_stats(@self) -> bool { self.debugging_opt(meta_stats) }
+    pub fn asm_comments(@self) -> bool { self.debugging_opt(asm_comments) }
+    pub fn no_verify(@self) -> bool { self.debugging_opt(no_verify) }
+    pub fn lint_llvm(@self) -> bool { self.debugging_opt(lint_llvm) }
+    pub fn trace(@self) -> bool { self.debugging_opt(trace) }
+    pub fn coherence(@self) -> bool { self.debugging_opt(coherence) }
+    pub fn borrowck_stats(@self) -> bool { self.debugging_opt(borrowck_stats) }
+    pub fn borrowck_note_pure(@self) -> bool {
         self.debugging_opt(borrowck_note_pure)
     }
-    fn borrowck_note_loan(@self) -> bool {
+    pub fn borrowck_note_loan(@self) -> bool {
         self.debugging_opt(borrowck_note_loan)
     }
-    fn no_monomorphic_collapse(@self) -> bool {
+    pub fn no_monomorphic_collapse(@self) -> bool {
         self.debugging_opt(no_monomorphic_collapse)
     }
-    fn debug_borrows(@self) -> bool {
+    pub fn debug_borrows(@self) -> bool {
         self.opts.optimize == No && !self.debugging_opt(no_debug_borrows)
     }
 
-    fn str_of(@self, id: ast::ident) -> @~str {
+    pub fn str_of(@self, id: ast::ident) -> @~str {
         self.parse_sess.interner.get(id)
     }
-    fn ident_of(@self, st: &str) -> ast::ident {
+    pub fn ident_of(@self, st: &str) -> ast::ident {
         self.parse_sess.interner.intern(st)
     }
-    fn intr(@self) -> @syntax::parse::token::ident_interner {
+    pub fn intr(@self) -> @syntax::parse::token::ident_interner {
         self.parse_sess.interner
     }
 }
index 276b78d2e12d0e5d17ac69c69403de96bbfa0f1c..c26e91cc5ec8406e1f685bb17c578ca92a1a7b3f 100644 (file)
@@ -163,8 +163,8 @@ fn reserve_id_range(sess: Session,
     ast_util::id_range { min: to_id_min, max: to_id_min }
 }
 
-pub impl ExtendedDecodeContext {
-    fn tr_id(&self, id: ast::node_id) -> ast::node_id {
+impl ExtendedDecodeContext {
+    pub fn tr_id(&self, id: ast::node_id) -> ast::node_id {
         /*!
          * Translates an internal id, meaning a node id that is known
          * to refer to some part of the item currently being inlined,
@@ -179,7 +179,7 @@ fn tr_id(&self, id: ast::node_id) -> ast::node_id {
         assert!(!self.from_id_range.empty());
         (id - self.from_id_range.min + self.to_id_range.min)
     }
-    fn tr_def_id(&self, did: ast::def_id) -> ast::def_id {
+    pub fn tr_def_id(&self, did: ast::def_id) -> ast::def_id {
         /*!
          * Translates an EXTERNAL def-id, converting the crate number
          * from the one used in the encoded data to the current crate
@@ -203,7 +203,7 @@ fn tr_def_id(&self, did: ast::def_id) -> ast::def_id {
 
         decoder::translate_def_id(self.dcx.cdata, did)
     }
-    fn tr_intern_def_id(&self, did: ast::def_id) -> ast::def_id {
+    pub fn tr_intern_def_id(&self, did: ast::def_id) -> ast::def_id {
         /*!
          * Translates an INTERNAL def-id, meaning a def-id that is
          * known to refer to some part of the item currently being
@@ -214,7 +214,7 @@ fn tr_intern_def_id(&self, did: ast::def_id) -> ast::def_id {
         assert_eq!(did.crate, ast::local_crate);
         ast::def_id { crate: ast::local_crate, node: self.tr_id(did.node) }
     }
-    fn tr_span(&self, _span: span) -> span {
+    pub fn tr_span(&self, _span: span) -> span {
         codemap::dummy_sp() // FIXME (#1972): handle span properly
     }
 }
index 1801585900b645c8bd8732c6474aecec12047e4e..5d0def6f60a88bccbb526735721d4d2b4b6699d7 100644 (file)
@@ -69,13 +69,13 @@ enum MoveError {
     MoveWhileBorrowed(/*move*/@LoanPath, /*loan*/@LoanPath, /*loan*/span)
 }
 
-pub impl<'self> CheckLoanCtxt<'self> {
-    fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
+impl<'self> CheckLoanCtxt<'self> {
+    pub fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
 
-    fn each_issued_loan(&self,
-                        scope_id: ast::node_id,
-                        op: &fn(&Loan) -> bool) -> bool
-    {
+    pub fn each_issued_loan(&self,
+                            scope_id: ast::node_id,
+                            op: &fn(&Loan) -> bool)
+                            -> bool {
         //! Iterates over each loan that that has been issued
         //! on entrance to `scope_id`, regardless of whether it is
         //! actually *in scope* at that point.  Sometimes loans
@@ -91,10 +91,10 @@ fn each_issued_loan(&self,
         return true;
     }
 
-    fn each_in_scope_loan(&self,
-                          scope_id: ast::node_id,
-                          op: &fn(&Loan) -> bool) -> bool
-    {
+    pub fn each_in_scope_loan(&self,
+                              scope_id: ast::node_id,
+                              op: &fn(&Loan) -> bool)
+                              -> bool {
         //! Like `each_issued_loan()`, but only considers loans that are
         //! currently in scope.
 
@@ -109,11 +109,11 @@ fn each_in_scope_loan(&self,
         return true;
     }
 
-    fn each_in_scope_restriction(&self,
-                                 scope_id: ast::node_id,
-                                 loan_path: @LoanPath,
-                                 op: &fn(&Loan, &Restriction) -> bool) -> bool
-    {
+    pub fn each_in_scope_restriction(&self,
+                                     scope_id: ast::node_id,
+                                     loan_path: @LoanPath,
+                                     op: &fn(&Loan, &Restriction) -> bool)
+                                     -> bool {
         //! Iterates through all the in-scope restrictions for the
         //! given `loan_path`
 
@@ -129,7 +129,7 @@ fn each_in_scope_restriction(&self,
         return true;
     }
 
-    fn loans_generated_by(&self, scope_id: ast::node_id) -> ~[uint] {
+    pub fn loans_generated_by(&self, scope_id: ast::node_id) -> ~[uint] {
         //! Returns a vector of the loans that are generated as
         //! we encounter `scope_id`.
 
@@ -140,7 +140,7 @@ fn loans_generated_by(&self, scope_id: ast::node_id) -> ~[uint] {
         return result;
     }
 
-    fn check_for_conflicting_loans(&mut self, scope_id: ast::node_id) {
+    pub fn check_for_conflicting_loans(&mut self, scope_id: ast::node_id) {
         //! Checks to see whether any of the loans that are issued
         //! by `scope_id` conflict with loans that have already been
         //! issued when we enter `scope_id` (for example, we do not
@@ -167,9 +167,9 @@ fn check_for_conflicting_loans(&mut self, scope_id: ast::node_id) {
         }
     }
 
-    fn report_error_if_loans_conflict(&self,
-                                      old_loan: &Loan,
-                                      new_loan: &Loan) {
+    pub fn report_error_if_loans_conflict(&self,
+                                          old_loan: &Loan,
+                                          new_loan: &Loan) {
         //! Checks whether `old_loan` and `new_loan` can safely be issued
         //! simultaneously.
 
@@ -188,11 +188,12 @@ fn report_error_if_loans_conflict(&self,
             new_loan, old_loan, old_loan, new_loan);
     }
 
-    fn report_error_if_loan_conflicts_with_restriction(&self,
-                                                       loan1: &Loan,
-                                                       loan2: &Loan,
-                                                       old_loan: &Loan,
-                                                       new_loan: &Loan) -> bool {
+    pub fn report_error_if_loan_conflicts_with_restriction(&self,
+                                                           loan1: &Loan,
+                                                           loan2: &Loan,
+                                                           old_loan: &Loan,
+                                                           new_loan: &Loan)
+                                                           -> bool {
         //! Checks whether the restrictions introduced by `loan1` would
         //! prohibit `loan2`. Returns false if an error is reported.
 
@@ -247,18 +248,18 @@ fn report_error_if_loan_conflicts_with_restriction(&self,
         true
     }
 
-    fn is_local_variable(&self, cmt: mc::cmt) -> bool {
+    pub fn is_local_variable(&self, cmt: mc::cmt) -> bool {
         match cmt.cat {
           mc::cat_local(_) => true,
           _ => false
         }
     }
 
-    fn check_if_path_is_moved(&self,
-                              id: ast::node_id,
-                              span: span,
-                              use_kind: MovedValueUseKind,
-                              lp: @LoanPath) {
+    pub fn check_if_path_is_moved(&self,
+                                  id: ast::node_id,
+                                  span: span,
+                                  use_kind: MovedValueUseKind,
+                                  lp: @LoanPath) {
         /*!
          * Reports an error if `expr` (which should be a path)
          * is using a moved/uninitialized value
@@ -277,7 +278,7 @@ fn check_if_path_is_moved(&self,
         }
     }
 
-    fn check_assignment(&self, expr: @ast::expr) {
+    pub fn check_assignment(&self, expr: @ast::expr) {
         // We don't use cat_expr() here because we don't want to treat
         // auto-ref'd parameters in overloaded operators as rvalues.
         let cmt = match self.bccx.tcx.adjustments.find(&expr.id) {
@@ -533,10 +534,10 @@ fn check_for_assignment_to_restricted_or_frozen_location(
         }
     }
 
-    fn report_illegal_mutation(&self,
-                               expr: @ast::expr,
-                               loan_path: &LoanPath,
-                               loan: &Loan) {
+    pub fn report_illegal_mutation(&self,
+                                   expr: @ast::expr,
+                                   loan_path: &LoanPath,
+                                   loan: &Loan) {
         self.bccx.span_err(
             expr.span,
             fmt!("cannot assign to `%s` because it is borrowed",
@@ -547,7 +548,7 @@ fn report_illegal_mutation(&self,
                  self.bccx.loan_path_to_str(loan_path)));
     }
 
-    fn check_move_out_from_expr(&self, ex: @ast::expr) {
+    pub fn check_move_out_from_expr(&self, ex: @ast::expr) {
         match ex.node {
             ast::expr_paren(*) => {
                 /* In the case of an expr_paren(), the expression inside
@@ -574,7 +575,7 @@ fn check_move_out_from_expr(&self, ex: @ast::expr) {
         }
     }
 
-    fn analyze_move_out_from_cmt(&self, cmt: mc::cmt) -> MoveError {
+    pub fn analyze_move_out_from_cmt(&self, cmt: mc::cmt) -> MoveError {
         debug!("analyze_move_out_from_cmt(cmt=%s)", cmt.repr(self.tcx()));
 
         // FIXME(#4384) inadequare if/when we permit `move a.b`
@@ -590,13 +591,12 @@ fn analyze_move_out_from_cmt(&self, cmt: mc::cmt) -> MoveError {
         return MoveOk;
     }
 
-    fn check_call(&mut self,
-                  _expr: @ast::expr,
-                  _callee: Option<@ast::expr>,
-                  _callee_id: ast::node_id,
-                  _callee_span: span,
-                  _args: &[@ast::expr])
-    {
+    pub fn check_call(&mut self,
+                      _expr: @ast::expr,
+                      _callee: Option<@ast::expr>,
+                      _callee_id: ast::node_id,
+                      _callee_span: span,
+                      _args: &[@ast::expr]) {
         // NB: This call to check for conflicting loans is not truly
         // necessary, because the callee_id never issues new loans.
         // However, I added it for consistency and lest the system
index 552476d25d6f4bcff2ea6950036c736ced8e32bc..83d039b75200f4014513583d677b0d1162183167 100644 (file)
@@ -273,21 +273,21 @@ fn gather_loans_in_expr(ex: @ast::expr,
     }
 }
 
-pub impl GatherLoanCtxt {
-    fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
+impl GatherLoanCtxt {
+    pub fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
 
-    fn push_repeating_id(&mut self, id: ast::node_id) {
+    pub fn push_repeating_id(&mut self, id: ast::node_id) {
         self.repeating_ids.push(id);
     }
 
-    fn pop_repeating_id(&mut self, id: ast::node_id) {
+    pub fn pop_repeating_id(&mut self, id: ast::node_id) {
         let popped = self.repeating_ids.pop();
         assert_eq!(id, popped);
     }
 
-    fn guarantee_adjustments(&mut self,
-                             expr: @ast::expr,
-                             adjustment: &ty::AutoAdjustment) {
+    pub fn guarantee_adjustments(&mut self,
+                                 expr: @ast::expr,
+                                 adjustment: &ty::AutoAdjustment) {
         debug!("guarantee_adjustments(expr=%s, adjustment=%?)",
                expr.repr(self.tcx()), adjustment);
         let _i = indenter();
@@ -350,13 +350,12 @@ fn guarantee_adjustments(&mut self,
     // out loans, which will be added to the `req_loan_map`.  This can
     // also entail "rooting" GC'd pointers, which means ensuring
     // dynamically that they are not freed.
-    fn guarantee_valid(&mut self,
-                       borrow_id: ast::node_id,
-                       borrow_span: span,
-                       cmt: mc::cmt,
-                       req_mutbl: ast::mutability,
-                       loan_region: ty::Region)
-    {
+    pub fn guarantee_valid(&mut self,
+                           borrow_id: ast::node_id,
+                           borrow_span: span,
+                           cmt: mc::cmt,
+                           req_mutbl: ast::mutability,
+                           loan_region: ty::Region) {
         debug!("guarantee_valid(borrow_id=%?, cmt=%s, \
                 req_mutbl=%?, loan_region=%?)",
                borrow_id,
@@ -514,7 +513,8 @@ fn check_mutability(bccx: @BorrowckCtxt,
         }
     }
 
-    fn restriction_set(&self, req_mutbl: ast::mutability) -> RestrictionSet {
+    pub fn restriction_set(&self, req_mutbl: ast::mutability)
+                           -> RestrictionSet {
         match req_mutbl {
             m_const => RESTR_EMPTY,
             m_imm   => RESTR_EMPTY | RESTR_MUTATE | RESTR_CLAIM,
@@ -522,7 +522,7 @@ fn restriction_set(&self, req_mutbl: ast::mutability) -> RestrictionSet {
         }
     }
 
-    fn mark_loan_path_as_mutated(&self, loan_path: @LoanPath) {
+    pub fn mark_loan_path_as_mutated(&self, loan_path: @LoanPath) {
         //! For mutable loans of content whose mutability derives
         //! from a local variable, mark the mutability decl as necessary.
 
@@ -540,9 +540,10 @@ fn mark_loan_path_as_mutated(&self, loan_path: @LoanPath) {
         }
     }
 
-    fn compute_gen_scope(&self,
-                         borrow_id: ast::node_id,
-                         loan_scope: ast::node_id) -> ast::node_id {
+    pub fn compute_gen_scope(&self,
+                             borrow_id: ast::node_id,
+                             loan_scope: ast::node_id)
+                             -> ast::node_id {
         //! Determine when to introduce the loan. Typically the loan
         //! is introduced at the point of the borrow, but in some cases,
         //! notably method arguments, the loan may be introduced only
@@ -556,9 +557,8 @@ fn compute_gen_scope(&self,
         }
     }
 
-    fn compute_kill_scope(&self,
-                          loan_scope: ast::node_id,
-                          lp: @LoanPath) -> ast::node_id {
+    pub fn compute_kill_scope(&self, loan_scope: ast::node_id, lp: @LoanPath)
+                              -> ast::node_id {
         //! Determine when the loan restrictions go out of scope.
         //! This is either when the lifetime expires or when the
         //! local variable which roots the loan-path goes out of scope,
@@ -588,11 +588,11 @@ fn compute_kill_scope(&self,
         }
     }
 
-    fn gather_pat(&mut self,
-                  discr_cmt: mc::cmt,
-                  root_pat: @ast::pat,
-                  arm_body_id: ast::node_id,
-                  match_id: ast::node_id) {
+    pub fn gather_pat(&mut self,
+                      discr_cmt: mc::cmt,
+                      root_pat: @ast::pat,
+                      arm_body_id: ast::node_id,
+                      match_id: ast::node_id) {
         do self.bccx.cat_pattern(discr_cmt, root_pat) |cmt, pat| {
             match pat.node {
               ast::pat_ident(bm, _, _) if self.pat_is_binding(pat) => {
@@ -653,9 +653,8 @@ fn gather_pat(&mut self,
         }
     }
 
-    fn vec_slice_info(&self,
-                      pat: @ast::pat,
-                      slice_ty: ty::t) -> (ast::mutability, ty::Region) {
+    pub fn vec_slice_info(&self, pat: @ast::pat, slice_ty: ty::t)
+                          -> (ast::mutability, ty::Region) {
         /*!
          *
          * In a pattern like [a, b, ..c], normally `c` has slice type,
@@ -681,11 +680,11 @@ fn vec_slice_info(&self,
         }
     }
 
-    fn pat_is_variant_or_struct(&self, pat: @ast::pat) -> bool {
+    pub fn pat_is_variant_or_struct(&self, pat: @ast::pat) -> bool {
         pat_util::pat_is_variant_or_struct(self.bccx.tcx.def_map, pat)
     }
 
-    fn pat_is_binding(&self, pat: @ast::pat) -> bool {
+    pub fn pat_is_binding(&self, pat: @ast::pat) -> bool {
         pat_util::pat_is_binding(self.bccx.tcx.def_map, pat)
     }
 }
index 066d0189fcb1073fe844dbbc6762d439e5c8a4dc..0834d0360832ae965c867ad0e0d840b02e09f8b2 100644 (file)
@@ -248,8 +248,8 @@ pub enum LoanPathElem {
     LpInterior(mc::InteriorKind) // `LV.f` in doc.rs
 }
 
-pub impl LoanPath {
-    fn node_id(&self) -> ast::node_id {
+impl LoanPath {
+    pub fn node_id(&self) -> ast::node_id {
         match *self {
             LpVar(local_id) => local_id,
             LpExtend(base, _, _) => base.node_id()
@@ -327,12 +327,12 @@ pub struct RestrictionSet {
 pub static RESTR_FREEZE: RestrictionSet = RestrictionSet {bits: 0b0100};
 pub static RESTR_ALIAS: RestrictionSet  = RestrictionSet {bits: 0b1000};
 
-pub impl RestrictionSet {
-    fn intersects(&self, restr: RestrictionSet) -> bool {
+impl RestrictionSet {
+    pub fn intersects(&self, restr: RestrictionSet) -> bool {
         (self.bits & restr.bits) != 0
     }
 
-    fn contains_all(&self, restr: RestrictionSet) -> bool {
+    pub fn contains_all(&self, restr: RestrictionSet) -> bool {
         (self.bits & restr.bits) == restr.bits
     }
 }
@@ -427,29 +427,33 @@ pub enum MovedValueUseKind {
 ///////////////////////////////////////////////////////////////////////////
 // Misc
 
-pub impl BorrowckCtxt {
-    fn is_subregion_of(&self, r_sub: ty::Region, r_sup: ty::Region) -> bool {
+impl BorrowckCtxt {
+    pub fn is_subregion_of(&self, r_sub: ty::Region, r_sup: ty::Region)
+                           -> bool {
         self.tcx.region_maps.is_subregion_of(r_sub, r_sup)
     }
 
-    fn is_subscope_of(&self, r_sub: ast::node_id, r_sup: ast::node_id) -> bool {
+    pub fn is_subscope_of(&self, r_sub: ast::node_id, r_sup: ast::node_id)
+                          -> bool {
         self.tcx.region_maps.is_subscope_of(r_sub, r_sup)
     }
 
-    fn is_move(&self, id: ast::node_id) -> bool {
+    pub fn is_move(&self, id: ast::node_id) -> bool {
         self.moves_map.contains(&id)
     }
 
-    fn cat_expr(&self, expr: @ast::expr) -> mc::cmt {
+    pub fn cat_expr(&self, expr: @ast::expr) -> mc::cmt {
         mc::cat_expr(self.tcx, self.method_map, expr)
     }
 
-    fn cat_expr_unadjusted(&self, expr: @ast::expr) -> mc::cmt {
+    pub fn cat_expr_unadjusted(&self, expr: @ast::expr) -> mc::cmt {
         mc::cat_expr_unadjusted(self.tcx, self.method_map, expr)
     }
 
-    fn cat_expr_autoderefd(&self, expr: @ast::expr,
-                           adj: @ty::AutoAdjustment) -> mc::cmt {
+    pub fn cat_expr_autoderefd(&self,
+                               expr: @ast::expr,
+                               adj: @ty::AutoAdjustment)
+                               -> mc::cmt {
         match *adj {
             ty::AutoAddEnv(*) => {
                 // no autoderefs
@@ -465,46 +469,47 @@ fn cat_expr_autoderefd(&self, expr: @ast::expr,
         }
     }
 
-    fn cat_def(&self,
-               id: ast::node_id,
-               span: span,
-               ty: ty::t,
-               def: ast::def) -> mc::cmt {
+    pub fn cat_def(&self,
+                   id: ast::node_id,
+                   span: span,
+                   ty: ty::t,
+                   def: ast::def)
+                   -> mc::cmt {
         mc::cat_def(self.tcx, self.method_map, id, span, ty, def)
     }
 
-    fn cat_discr(&self, cmt: mc::cmt, match_id: ast::node_id) -> mc::cmt {
+    pub fn cat_discr(&self, cmt: mc::cmt, match_id: ast::node_id) -> mc::cmt {
         @mc::cmt_ {cat:mc::cat_discr(cmt, match_id),
                    mutbl:cmt.mutbl.inherit(),
                    ..*cmt}
     }
 
-    fn mc_ctxt(&self) -> mc::mem_categorization_ctxt {
+    pub fn mc_ctxt(&self) -> mc::mem_categorization_ctxt {
         mc::mem_categorization_ctxt {tcx: self.tcx,
                                  method_map: self.method_map}
     }
 
-    fn cat_pattern(&self,
-                   cmt: mc::cmt,
-                   pat: @ast::pat,
-                   op: &fn(mc::cmt, @ast::pat)) {
+    pub fn cat_pattern(&self,
+                       cmt: mc::cmt,
+                       pat: @ast::pat,
+                       op: &fn(mc::cmt, @ast::pat)) {
         let mc = self.mc_ctxt();
         mc.cat_pattern(cmt, pat, op);
     }
 
-    fn report(&self, err: BckError) {
+    pub fn report(&self, err: BckError) {
         self.span_err(
             err.span,
             self.bckerr_to_str(err));
         self.note_and_explain_bckerr(err);
     }
 
-    fn report_use_of_moved_value(&self,
-                                 use_span: span,
-                                 use_kind: MovedValueUseKind,
-                                 lp: @LoanPath,
-                                 move: &move_data::Move,
-                                 moved_lp: @LoanPath) {
+    pub fn report_use_of_moved_value(&self,
+                                     use_span: span,
+                                     use_kind: MovedValueUseKind,
+                                     lp: @LoanPath,
+                                     move: &move_data::Move,
+                                     moved_lp: @LoanPath) {
         let verb = match use_kind {
             MovedInUse => "use",
             MovedInCapture => "capture",
@@ -563,10 +568,11 @@ fn report_use_of_moved_value(&self,
         }
     }
 
-    fn report_reassigned_immutable_variable(&self,
-                                            span: span,
-                                            lp: @LoanPath,
-                                            assign: &move_data::Assignment) {
+    pub fn report_reassigned_immutable_variable(&self,
+                                                span: span,
+                                                lp: @LoanPath,
+                                                assign:
+                                                &move_data::Assignment) {
         self.tcx.sess.span_err(
             span,
             fmt!("re-assignment of immutable variable `%s`",
@@ -576,15 +582,15 @@ fn report_reassigned_immutable_variable(&self,
             fmt!("prior assignment occurs here"));
     }
 
-    fn span_err(&self, s: span, m: &str) {
+    pub fn span_err(&self, s: span, m: &str) {
         self.tcx.sess.span_err(s, m);
     }
 
-    fn span_note(&self, s: span, m: &str) {
+    pub fn span_note(&self, s: span, m: &str) {
         self.tcx.sess.span_note(s, m);
     }
 
-    fn bckerr_to_str(&self, err: BckError) -> ~str {
+    pub fn bckerr_to_str(&self, err: BckError) -> ~str {
         match err.code {
             err_mutbl(lk) => {
                 fmt!("cannot borrow %s %s as %s",
@@ -608,10 +614,10 @@ fn bckerr_to_str(&self, err: BckError) -> ~str {
         }
     }
 
-    fn report_aliasability_violation(&self,
-                                     span: span,
-                                     kind: AliasableViolationKind,
-                                     cause: mc::AliasableReason) {
+    pub fn report_aliasability_violation(&self,
+                                         span: span,
+                                         kind: AliasableViolationKind,
+                                         cause: mc::AliasableReason) {
         let prefix = match kind {
             MutabilityViolation => "cannot assign to an `&mut`",
             BorrowViolation => "cannot borrow an `&mut`"
@@ -649,7 +655,7 @@ fn report_aliasability_violation(&self,
         }
     }
 
-    fn note_and_explain_bckerr(&self, err: BckError) {
+    pub fn note_and_explain_bckerr(&self, err: BckError) {
         let code = err.code;
         match code {
             err_mutbl(*) | err_freeze_aliasable_const(*) => {}
@@ -682,9 +688,9 @@ fn note_and_explain_bckerr(&self, err: BckError) {
         }
     }
 
-    fn append_loan_path_to_str_from_interior(&self,
-                                             loan_path: &LoanPath,
-                                             out: &mut ~str) {
+    pub fn append_loan_path_to_str_from_interior(&self,
+                                                 loan_path: &LoanPath,
+                                                 out: &mut ~str) {
         match *loan_path {
             LpExtend(_, _, LpDeref) => {
                 str::push_char(out, '(');
@@ -698,7 +704,9 @@ fn append_loan_path_to_str_from_interior(&self,
         }
     }
 
-    fn append_loan_path_to_str(&self, loan_path: &LoanPath, out: &mut ~str) {
+    pub fn append_loan_path_to_str(&self,
+                                   loan_path: &LoanPath,
+                                   out: &mut ~str) {
         match *loan_path {
             LpVar(id) => {
                 match self.tcx.items.find(&id) {
@@ -739,25 +747,25 @@ fn append_loan_path_to_str(&self, loan_path: &LoanPath, out: &mut ~str) {
         }
     }
 
-    fn loan_path_to_str(&self, loan_path: &LoanPath) -> ~str {
+    pub fn loan_path_to_str(&self, loan_path: &LoanPath) -> ~str {
         let mut result = ~"";
         self.append_loan_path_to_str(loan_path, &mut result);
         result
     }
 
-    fn cmt_to_str(&self, cmt: mc::cmt) -> ~str {
+    pub fn cmt_to_str(&self, cmt: mc::cmt) -> ~str {
         let mc = &mc::mem_categorization_ctxt {tcx: self.tcx,
                                                method_map: self.method_map};
         mc.cmt_to_str(cmt)
     }
 
-    fn mut_to_str(&self, mutbl: ast::mutability) -> ~str {
+    pub fn mut_to_str(&self, mutbl: ast::mutability) -> ~str {
         let mc = &mc::mem_categorization_ctxt {tcx: self.tcx,
                                                method_map: self.method_map};
         mc.mut_to_str(mutbl)
     }
 
-    fn mut_to_keyword(&self, mutbl: ast::mutability) -> &'static str {
+    pub fn mut_to_keyword(&self, mutbl: ast::mutability) -> &'static str {
         match mutbl {
             ast::m_imm => "",
             ast::m_const => "const",
index be1aa957666fa6d0dcfd2eac88b6ea5e82878f2e..798cba236297b60a762be0d9f9dda31dc3d87843 100644 (file)
@@ -82,14 +82,14 @@ pub struct LanguageItems {
     items: [Option<def_id>, ..38]
 }
 
-pub impl LanguageItems {
+impl LanguageItems {
     pub fn new() -> LanguageItems {
         LanguageItems {
             items: [ None, ..38 ]
         }
     }
 
-    fn each_item(&self, f: &fn(def_id: def_id, i: uint) -> bool) -> bool {
+    pub fn each_item(&self, f: &fn(def_id: def_id, i: uint) -> bool) -> bool {
         self.items.eachi(|i, &item| f(item.get(), i))
     }
 
@@ -331,9 +331,10 @@ struct LanguageItemCollector {
     item_refs: HashMap<@~str, uint>,
 }
 
-pub impl LanguageItemCollector {
-    fn match_and_collect_meta_item(&mut self, item_def_id: def_id,
-                                   meta_item: @meta_item) {
+impl LanguageItemCollector {
+    pub fn match_and_collect_meta_item(&mut self,
+                                       item_def_id: def_id,
+                                       meta_item: @meta_item) {
         match meta_item.node {
             meta_name_value(key, literal) => {
                 match literal.node {
@@ -347,7 +348,7 @@ fn match_and_collect_meta_item(&mut self, item_def_id: def_id,
         }
     }
 
-    fn collect_item(&mut self, item_index: uint, item_def_id: def_id) {
+    pub fn collect_item(&mut self, item_index: uint, item_def_id: def_id) {
         // Check for duplicates.
         match self.items.items[item_index] {
             Some(original_def_id) if original_def_id != item_def_id => {
@@ -363,8 +364,10 @@ fn collect_item(&mut self, item_index: uint, item_def_id: def_id) {
         self.items.items[item_index] = Some(item_def_id);
     }
 
-    fn match_and_collect_item(&mut self,
-                              item_def_id: def_id, key: @~str, value: @~str) {
+    pub fn match_and_collect_item(&mut self,
+                                  item_def_id: def_id,
+                                  key: @~str,
+                                  value: @~str) {
         if *key != ~"lang" {
             return;    // Didn't match.
         }
@@ -384,7 +387,7 @@ fn match_and_collect_item(&mut self,
         }
     }
 
-    fn collect_local_language_items(&mut self) {
+    pub fn collect_local_language_items(&mut self) {
         let this: *mut LanguageItemCollector = &mut *self;
         visit_crate(self.crate, (), mk_simple_visitor(@SimpleVisitor {
             visit_item: |item| {
@@ -401,7 +404,7 @@ fn collect_local_language_items(&mut self) {
         }));
     }
 
-    fn collect_external_language_items(&mut self) {
+    pub fn collect_external_language_items(&mut self) {
         let crate_store = self.session.cstore;
         do iter_crate_data(crate_store) |crate_number, _crate_metadata| {
             for each_lang_item(crate_store, crate_number)
@@ -412,7 +415,7 @@ fn collect_external_language_items(&mut self) {
         }
     }
 
-    fn check_completeness(&self) {
+    pub fn check_completeness(&self) {
         for self.item_refs.each |&key, &item_ref| {
             match self.items.items[item_ref] {
                 None => {
@@ -425,7 +428,7 @@ fn check_completeness(&self) {
         }
     }
 
-    fn collect(&mut self) {
+    pub fn collect(&mut self) {
         self.collect_local_language_items();
         self.collect_external_language_items();
         self.check_completeness();
index ee7b21638b24089c8b5e458e2811204efa3d7905..a9d9d55563a61c6bc679a4c12eefab9abb64464e 100644 (file)
@@ -197,8 +197,10 @@ fn to_str(&self) -> ~str { fmt!("v(%u)", **self) }
 // variable must not be assigned if there is some successor
 // assignment.  And so forth.
 
-pub impl LiveNode {
-    fn is_valid(&self) -> bool { **self != uint::max_value }
+impl LiveNode {
+    pub fn is_valid(&self) -> bool {
+        **self != uint::max_value
+    }
 }
 
 fn invalid_node() -> LiveNode { LiveNode(uint::max_value) }
@@ -260,8 +262,8 @@ fn IrMaps(tcx: ty::ctxt,
     }
 }
 
-pub impl IrMaps {
-    fn add_live_node(&mut self, lnk: LiveNodeKind) -> LiveNode {
+impl IrMaps {
+    pub fn add_live_node(&mut self, lnk: LiveNodeKind) -> LiveNode {
         let ln = LiveNode(self.num_live_nodes);
         self.lnks.push(lnk);
         self.num_live_nodes += 1;
@@ -272,16 +274,16 @@ fn add_live_node(&mut self, lnk: LiveNodeKind) -> LiveNode {
         ln
     }
 
-    fn add_live_node_for_node(&mut self,
-                              node_id: node_id,
-                              lnk: LiveNodeKind) {
+    pub fn add_live_node_for_node(&mut self,
+                                  node_id: node_id,
+                                  lnk: LiveNodeKind) {
         let ln = self.add_live_node(lnk);
         self.live_node_map.insert(node_id, ln);
 
         debug!("%s is node %d", ln.to_str(), node_id);
     }
 
-    fn add_variable(&mut self, vk: VarKind) -> Variable {
+    pub fn add_variable(&mut self, vk: VarKind) -> Variable {
         let v = Variable(self.num_vars);
         self.var_kinds.push(vk);
         self.num_vars += 1;
@@ -298,7 +300,7 @@ fn add_variable(&mut self, vk: VarKind) -> Variable {
         v
     }
 
-    fn variable(&mut self, node_id: node_id, span: span) -> Variable {
+    pub fn variable(&mut self, node_id: node_id, span: span) -> Variable {
         match self.variable_map.find(&node_id) {
           Some(&var) => var,
           None => {
@@ -308,7 +310,7 @@ fn variable(&mut self, node_id: node_id, span: span) -> Variable {
         }
     }
 
-    fn variable_name(&mut self, var: Variable) -> @~str {
+    pub fn variable_name(&mut self, var: Variable) -> @~str {
         match self.var_kinds[*var] {
             Local(LocalInfo { ident: nm, _ }) | Arg(_, nm) => {
                 self.tcx.sess.str_of(nm)
@@ -317,11 +319,11 @@ fn variable_name(&mut self, var: Variable) -> @~str {
         }
     }
 
-    fn set_captures(&mut self, node_id: node_id, cs: ~[CaptureInfo]) {
+    pub fn set_captures(&mut self, node_id: node_id, cs: ~[CaptureInfo]) {
         self.capture_info_map.insert(node_id, @cs);
     }
 
-    fn captures(&mut self, expr: @expr) -> @~[CaptureInfo] {
+    pub fn captures(&mut self, expr: @expr) -> @~[CaptureInfo] {
         match self.capture_info_map.find(&expr.id) {
           Some(&caps) => caps,
           None => {
@@ -330,7 +332,7 @@ fn captures(&mut self, expr: @expr) -> @~[CaptureInfo] {
         }
     }
 
-    fn lnk(&mut self, ln: LiveNode) -> LiveNodeKind {
+    pub fn lnk(&mut self, ln: LiveNode) -> LiveNodeKind {
         self.lnks[*ln]
     }
 }
@@ -578,8 +580,8 @@ fn Liveness(ir: @mut IrMaps, specials: Specials) -> Liveness {
     }
 }
 
-pub impl Liveness {
-    fn live_node(&self, node_id: node_id, span: span) -> LiveNode {
+impl Liveness {
+    pub fn live_node(&self, node_id: node_id, span: span) -> LiveNode {
         let ir: &mut IrMaps = self.ir;
         match ir.live_node_map.find(&node_id) {
           Some(&ln) => ln,
@@ -595,7 +597,7 @@ fn live_node(&self, node_id: node_id, span: span) -> LiveNode {
         }
     }
 
-    fn variable_from_path(&self, expr: @expr) -> Option<Variable> {
+    pub fn variable_from_path(&self, expr: @expr) -> Option<Variable> {
         match expr.node {
           expr_path(_) => {
             let def = self.tcx.def_map.get_copy(&expr.id);
@@ -607,12 +609,12 @@ fn variable_from_path(&self, expr: @expr) -> Option<Variable> {
         }
     }
 
-    fn variable(&self, node_id: node_id, span: span) -> Variable {
+    pub fn variable(&self, node_id: node_id, span: span) -> Variable {
         self.ir.variable(node_id, span)
     }
 
-    fn variable_from_def_map(&self, node_id: node_id,
-                             span: span) -> Option<Variable> {
+    pub fn variable_from_def_map(&self, node_id: node_id, span: span)
+                                 -> Option<Variable> {
         match self.tcx.def_map.find(&node_id) {
           Some(&def) => {
             moves::moved_variable_node_id_from_def(def).map(
@@ -626,8 +628,9 @@ fn variable_from_def_map(&self, node_id: node_id,
         }
     }
 
-    fn pat_bindings(&self, pat: @pat,
-                    f: &fn(LiveNode, Variable, span, node_id)) {
+    pub fn pat_bindings(&self,
+                        pat: @pat,
+                        f: &fn(LiveNode, Variable, span, node_id)) {
         let def_map = self.tcx.def_map;
         do pat_util::pat_bindings(def_map, pat) |_bm, p_id, sp, _n| {
             let ln = self.live_node(p_id, sp);
@@ -636,9 +639,9 @@ fn pat_bindings(&self, pat: @pat,
         }
     }
 
-    fn arm_pats_bindings(&self,
-                         pats: &[@pat],
-                         f: &fn(LiveNode, Variable, span, node_id)) {
+    pub fn arm_pats_bindings(&self,
+                             pats: &[@pat],
+                             f: &fn(LiveNode, Variable, span, node_id)) {
         // only consider the first pattern; any later patterns must have
         // the same bindings, and we also consider the first pattern to be
         // the "authoratative" set of ids
@@ -647,12 +650,13 @@ fn arm_pats_bindings(&self,
         }
     }
 
-    fn define_bindings_in_pat(&self, pat: @pat, succ: LiveNode) -> LiveNode {
+    pub fn define_bindings_in_pat(&self, pat: @pat, succ: LiveNode)
+                                  -> LiveNode {
         self.define_bindings_in_arm_pats([pat], succ)
     }
 
-    fn define_bindings_in_arm_pats(&self, pats: &[@pat],
-                                   succ: LiveNode) -> LiveNode {
+    pub fn define_bindings_in_arm_pats(&self, pats: &[@pat], succ: LiveNode)
+                                       -> LiveNode {
         let mut succ = succ;
         do self.arm_pats_bindings(pats) |ln, var, _sp, _id| {
             self.init_from_succ(ln, succ);
@@ -662,13 +666,12 @@ fn define_bindings_in_arm_pats(&self, pats: &[@pat],
         succ
     }
 
-    fn idx(&self, ln: LiveNode, var: Variable) -> uint {
+    pub fn idx(&self, ln: LiveNode, var: Variable) -> uint {
         *ln * self.ir.num_vars + *var
     }
 
-    fn live_on_entry(&self, ln: LiveNode, var: Variable)
-        -> Option<LiveNodeKind> {
-
+    pub fn live_on_entry(&self, ln: LiveNode, var: Variable)
+                         -> Option<LiveNodeKind> {
         assert!(ln.is_valid());
         let reader = self.users[self.idx(ln, var)].reader;
         if reader.is_valid() {Some(self.ir.lnk(reader))} else {None}
@@ -677,39 +680,39 @@ fn live_on_entry(&self, ln: LiveNode, var: Variable)
     /*
     Is this variable live on entry to any of its successor nodes?
     */
-    fn live_on_exit(&self, ln: LiveNode, var: Variable)
-        -> Option<LiveNodeKind> {
-
+    pub fn live_on_exit(&self, ln: LiveNode, var: Variable)
+                        -> Option<LiveNodeKind> {
         self.live_on_entry(copy self.successors[*ln], var)
     }
 
-    fn used_on_entry(&self, ln: LiveNode, var: Variable) -> bool {
+    pub fn used_on_entry(&self, ln: LiveNode, var: Variable) -> bool {
         assert!(ln.is_valid());
         self.users[self.idx(ln, var)].used
     }
 
-    fn assigned_on_entry(&self, ln: LiveNode, var: Variable)
-        -> Option<LiveNodeKind> {
-
+    pub fn assigned_on_entry(&self, ln: LiveNode, var: Variable)
+                             -> Option<LiveNodeKind> {
         assert!(ln.is_valid());
         let writer = self.users[self.idx(ln, var)].writer;
         if writer.is_valid() {Some(self.ir.lnk(writer))} else {None}
     }
 
-    fn assigned_on_exit(&self, ln: LiveNode, var: Variable)
-        -> Option<LiveNodeKind> {
-
+    pub fn assigned_on_exit(&self, ln: LiveNode, var: Variable)
+                            -> Option<LiveNodeKind> {
         self.assigned_on_entry(copy self.successors[*ln], var)
     }
 
-    fn indices(&self, ln: LiveNode, op: &fn(uint)) {
+    pub fn indices(&self, ln: LiveNode, op: &fn(uint)) {
         let node_base_idx = self.idx(ln, Variable(0));
         for uint::range(0, self.ir.num_vars) |var_idx| {
             op(node_base_idx + var_idx)
         }
     }
 
-    fn indices2(&self, ln: LiveNode, succ_ln: LiveNode, op: &fn(uint, uint)) {
+    pub fn indices2(&self,
+                    ln: LiveNode,
+                    succ_ln: LiveNode,
+                    op: &fn(uint, uint)) {
         let node_base_idx = self.idx(ln, Variable(0u));
         let succ_base_idx = self.idx(succ_ln, Variable(0u));
         for uint::range(0u, self.ir.num_vars) |var_idx| {
@@ -717,10 +720,10 @@ fn indices2(&self, ln: LiveNode, succ_ln: LiveNode, op: &fn(uint, uint)) {
         }
     }
 
-    fn write_vars(&self,
-                  wr: @io::Writer,
-                  ln: LiveNode,
-                  test: &fn(uint) -> LiveNode) {
+    pub fn write_vars(&self,
+                      wr: @io::Writer,
+                      ln: LiveNode,
+                      test: &fn(uint) -> LiveNode) {
         let node_base_idx = self.idx(ln, Variable(0));
         for uint::range(0, self.ir.num_vars) |var_idx| {
             let idx = node_base_idx + var_idx;
@@ -731,8 +734,11 @@ fn write_vars(&self,
         }
     }
 
-    fn find_loop_scope(&self, opt_label: Option<ident>, id: node_id, sp: span)
-        -> node_id {
+    pub fn find_loop_scope(&self,
+                           opt_label: Option<ident>,
+                           id: node_id,
+                           sp: span)
+                           -> node_id {
         match opt_label {
             Some(_) => // Refers to a labeled loop. Use the results of resolve
                       // to find with one
@@ -758,12 +764,12 @@ fn find_loop_scope(&self, opt_label: Option<ident>, id: node_id, sp: span)
         }
     }
 
-    fn last_loop_scope(&self) -> node_id {
+    pub fn last_loop_scope(&self) -> node_id {
         let loop_scope = &mut *self.loop_scope;
         *loop_scope.last()
     }
 
-    fn ln_str(&self, ln: LiveNode) -> ~str {
+    pub fn ln_str(&self, ln: LiveNode) -> ~str {
         do io::with_str_writer |wr| {
             wr.write_str("[ln(");
             wr.write_uint(*ln);
@@ -780,7 +786,7 @@ fn ln_str(&self, ln: LiveNode) -> ~str {
         }
     }
 
-    fn init_empty(&self, ln: LiveNode, succ_ln: LiveNode) {
+    pub fn init_empty(&self, ln: LiveNode, succ_ln: LiveNode) {
         self.successors[*ln] = succ_ln;
 
         // It is not necessary to initialize the
@@ -793,7 +799,7 @@ fn init_empty(&self, ln: LiveNode, succ_ln: LiveNode) {
         // }
     }
 
-    fn init_from_succ(&self, ln: LiveNode, succ_ln: LiveNode) {
+    pub fn init_from_succ(&self, ln: LiveNode, succ_ln: LiveNode) {
         // more efficient version of init_empty() / merge_from_succ()
         self.successors[*ln] = succ_ln;
         self.indices2(ln, succ_ln, |idx, succ_idx| {
@@ -803,8 +809,11 @@ fn init_from_succ(&self, ln: LiveNode, succ_ln: LiveNode) {
                self.ln_str(ln), self.ln_str(succ_ln));
     }
 
-    fn merge_from_succ(&self, ln: LiveNode, succ_ln: LiveNode,
-                       first_merge: bool) -> bool {
+    pub fn merge_from_succ(&self,
+                           ln: LiveNode,
+                           succ_ln: LiveNode,
+                           first_merge: bool)
+                           -> bool {
         if ln == succ_ln { return false; }
 
         let mut changed = false;
@@ -838,7 +847,7 @@ fn copy_if_invalid(src: LiveNode, dst: &mut LiveNode) -> bool {
     // Indicates that a local variable was *defined*; we know that no
     // uses of the variable can precede the definition (resolve checks
     // this) so we just clear out all the data.
-    fn define(&self, writer: LiveNode, var: Variable) {
+    pub fn define(&self, writer: LiveNode, var: Variable) {
         let idx = self.idx(writer, var);
         self.users[idx].reader = invalid_node();
         self.users[idx].writer = invalid_node();
@@ -848,7 +857,7 @@ fn define(&self, writer: LiveNode, var: Variable) {
     }
 
     // Either read, write, or both depending on the acc bitset
-    fn acc(&self, ln: LiveNode, var: Variable, acc: uint) {
+    pub fn acc(&self, ln: LiveNode, var: Variable, acc: uint) {
         let idx = self.idx(ln, var);
         let users = &mut *self.users;
         let user = &mut users[idx];
@@ -874,7 +883,7 @@ fn acc(&self, ln: LiveNode, var: Variable, acc: uint) {
 
     // _______________________________________________________________________
 
-    fn compute(&self, decl: &fn_decl, body: &blk) -> LiveNode {
+    pub fn compute(&self, decl: &fn_decl, body: &blk) -> LiveNode {
         // if there is a `break` or `again` at the top level, then it's
         // effectively a return---this only occurs in `for` loops,
         // where the body is really a closure.
@@ -899,8 +908,8 @@ fn compute(&self, decl: &fn_decl, body: &blk) -> LiveNode {
         entry_ln
     }
 
-    fn propagate_through_fn_block(&self, _: &fn_decl, blk: &blk)
-                                  -> LiveNode {
+    pub fn propagate_through_fn_block(&self, _: &fn_decl, blk: &blk)
+                                      -> LiveNode {
         // the fallthrough exit is only for those cases where we do not
         // explicitly return:
         self.init_from_succ(self.s.fallthrough_ln, self.s.exit_ln);
@@ -911,15 +920,16 @@ fn propagate_through_fn_block(&self, _: &fn_decl, blk: &blk)
         self.propagate_through_block(blk, self.s.fallthrough_ln)
     }
 
-    fn propagate_through_block(&self, blk: &blk, succ: LiveNode) -> LiveNode {
+    pub fn propagate_through_block(&self, blk: &blk, succ: LiveNode)
+                                   -> LiveNode {
         let succ = self.propagate_through_opt_expr(blk.node.expr, succ);
         do blk.node.stmts.foldr(succ) |stmt, succ| {
             self.propagate_through_stmt(*stmt, succ)
         }
     }
 
-    fn propagate_through_stmt(&self, stmt: @stmt, succ: LiveNode)
-                             -> LiveNode {
+    pub fn propagate_through_stmt(&self, stmt: @stmt, succ: LiveNode)
+                                  -> LiveNode {
         match stmt.node {
           stmt_decl(decl, _) => {
             return self.propagate_through_decl(decl, succ);
@@ -935,8 +945,8 @@ fn propagate_through_stmt(&self, stmt: @stmt, succ: LiveNode)
         }
     }
 
-    fn propagate_through_decl(&self, decl: @decl, succ: LiveNode)
-                             -> LiveNode {
+    pub fn propagate_through_decl(&self, decl: @decl, succ: LiveNode)
+                                  -> LiveNode {
         match decl.node {
           decl_local(ref locals) => {
             do locals.foldr(succ) |local, succ| {
@@ -949,8 +959,8 @@ fn propagate_through_decl(&self, decl: @decl, succ: LiveNode)
         }
     }
 
-    fn propagate_through_local(&self, local: @local, succ: LiveNode)
-                              -> LiveNode {
+    pub fn propagate_through_local(&self, local: @local, succ: LiveNode)
+                                   -> LiveNode {
         // Note: we mark the variable as defined regardless of whether
         // there is an initializer.  Initially I had thought to only mark
         // the live variable as defined if it was initialized, and then we
@@ -969,22 +979,24 @@ fn propagate_through_local(&self, local: @local, succ: LiveNode)
         self.define_bindings_in_pat(local.node.pat, succ)
     }
 
-    fn propagate_through_exprs(&self, exprs: &[@expr],
-                               succ: LiveNode) -> LiveNode {
+    pub fn propagate_through_exprs(&self, exprs: &[@expr], succ: LiveNode)
+                                   -> LiveNode {
         do exprs.foldr(succ) |expr, succ| {
             self.propagate_through_expr(*expr, succ)
         }
     }
 
-    fn propagate_through_opt_expr(&self, opt_expr: Option<@expr>,
-                                  succ: LiveNode) -> LiveNode {
+    pub fn propagate_through_opt_expr(&self,
+                                      opt_expr: Option<@expr>,
+                                      succ: LiveNode)
+                                      -> LiveNode {
         do old_iter::foldl(&opt_expr, succ) |succ, expr| {
             self.propagate_through_expr(*expr, *succ)
         }
     }
 
-    fn propagate_through_expr(&self, expr: @expr, succ: LiveNode)
-                             -> LiveNode {
+    pub fn propagate_through_expr(&self, expr: @expr, succ: LiveNode)
+                                  -> LiveNode {
         debug!("propagate_through_expr: %s",
              expr_to_str(expr, self.tcx.sess.intr()));
 
@@ -1230,8 +1242,10 @@ fn propagate_through_expr(&self, expr: @expr, succ: LiveNode)
         }
     }
 
-    fn propagate_through_lvalue_components(&self, expr: @expr,
-                                           succ: LiveNode) -> LiveNode {
+    pub fn propagate_through_lvalue_components(&self,
+                                               expr: @expr,
+                                               succ: LiveNode)
+                                               -> LiveNode {
         // # Lvalues
         //
         // In general, the full flow graph structure for an
@@ -1289,9 +1303,8 @@ fn propagate_through_lvalue_components(&self, expr: @expr,
     }
 
     // see comment on propagate_through_lvalue()
-    fn write_lvalue(&self, expr: @expr,
-                    succ: LiveNode,
-                    acc: uint) -> LiveNode {
+    pub fn write_lvalue(&self, expr: @expr, succ: LiveNode, acc: uint)
+                        -> LiveNode {
         match expr.node {
           expr_path(_) => self.access_path(expr, succ, acc),
 
@@ -1303,8 +1316,8 @@ fn write_lvalue(&self, expr: @expr,
         }
     }
 
-    fn access_path(&self, expr: @expr, succ: LiveNode, acc: uint)
-                  -> LiveNode {
+    pub fn access_path(&self, expr: @expr, succ: LiveNode, acc: uint)
+                       -> LiveNode {
         let def = self.tcx.def_map.get_copy(&expr.id);
         match moves::moved_variable_node_id_from_def(def) {
           Some(nid) => {
@@ -1320,10 +1333,12 @@ fn access_path(&self, expr: @expr, succ: LiveNode, acc: uint)
         }
     }
 
-    fn propagate_through_loop(&self, expr: @expr,
-                              cond: Option<@expr>,
-                              body: &blk,
-                              succ: LiveNode) -> LiveNode {
+    pub fn propagate_through_loop(&self,
+                                  expr: @expr,
+                                  cond: Option<@expr>,
+                                  body: &blk,
+                                  succ: LiveNode)
+                                  -> LiveNode {
 
         /*
 
@@ -1377,10 +1392,12 @@ fn propagate_through_loop(&self, expr: @expr,
         cond_ln
     }
 
-    fn with_loop_nodes<R>(&self, loop_node_id: node_id,
-                          break_ln: LiveNode,
-                          cont_ln: LiveNode,
-                          f: &fn() -> R) -> R {
+    pub fn with_loop_nodes<R>(&self,
+                              loop_node_id: node_id,
+                              break_ln: LiveNode,
+                              cont_ln: LiveNode,
+                              f: &fn() -> R)
+                              -> R {
       debug!("with_loop_nodes: %d %u", loop_node_id, *break_ln);
         self.loop_scope.push(loop_node_id);
         self.break_ln.insert(loop_node_id, break_ln);
@@ -1491,9 +1508,12 @@ enum ReadKind {
     PartiallyMovedValue
 }
 
-pub impl Liveness {
-    fn check_ret(&self, id: node_id, sp: span, _fk: &visit::fn_kind,
-                 entry_ln: LiveNode) {
+impl Liveness {
+    pub fn check_ret(&self,
+                     id: node_id,
+                     sp: span,
+                     _fk: &visit::fn_kind,
+                     entry_ln: LiveNode) {
         if self.live_on_entry(entry_ln, self.s.no_ret_var).is_some() {
             // if no_ret_var is live, then we fall off the end of the
             // function without any kind of return expression:
@@ -1512,7 +1532,7 @@ fn check_ret(&self, id: node_id, sp: span, _fk: &visit::fn_kind,
         }
     }
 
-    fn check_lvalue(@self, expr: @expr, vt: vt<@Liveness>) {
+    pub fn check_lvalue(@self, expr: @expr, vt: vt<@Liveness>) {
         match expr.node {
           expr_path(_) => {
             match self.tcx.def_map.get_copy(&expr.id) {
@@ -1546,11 +1566,11 @@ fn check_lvalue(@self, expr: @expr, vt: vt<@Liveness>) {
        }
     }
 
-    fn report_illegal_read(&self,
-                           chk_span: span,
-                           lnk: LiveNodeKind,
-                           var: Variable,
-                           rk: ReadKind) {
+    pub fn report_illegal_read(&self,
+                               chk_span: span,
+                               lnk: LiveNodeKind,
+                               var: Variable,
+                               rk: ReadKind) {
         let msg = match rk {
             PossiblyUninitializedVariable => "possibly uninitialized \
                                               variable",
@@ -1578,12 +1598,12 @@ fn report_illegal_read(&self,
         }
     }
 
-    fn should_warn(&self, var: Variable) -> Option<@~str> {
+    pub fn should_warn(&self, var: Variable) -> Option<@~str> {
         let name = self.ir.variable_name(var);
         if name[0] == ('_' as u8) { None } else { Some(name) }
     }
 
-    fn warn_about_unused_args(&self, decl: &fn_decl, entry_ln: LiveNode) {
+    pub fn warn_about_unused_args(&self, decl: &fn_decl, entry_ln: LiveNode) {
         for decl.inputs.each |arg| {
             do pat_util::pat_bindings(self.tcx.def_map, arg.pat)
                     |_bm, p_id, sp, _n| {
@@ -1593,7 +1613,7 @@ fn warn_about_unused_args(&self, decl: &fn_decl, entry_ln: LiveNode) {
         }
     }
 
-    fn warn_about_unused_or_dead_vars_in_pat(&self, pat: @pat) {
+    pub fn warn_about_unused_or_dead_vars_in_pat(&self, pat: @pat) {
         do self.pat_bindings(pat) |ln, var, sp, id| {
             if !self.warn_about_unused(sp, id, ln, var) {
                 self.warn_about_dead_assign(sp, id, ln, var);
@@ -1601,8 +1621,12 @@ fn warn_about_unused_or_dead_vars_in_pat(&self, pat: @pat) {
         }
     }
 
-    fn warn_about_unused(&self, sp: span, id: node_id,
-                         ln: LiveNode, var: Variable) -> bool {
+    pub fn warn_about_unused(&self,
+                             sp: span,
+                             id: node_id,
+                             ln: LiveNode,
+                             var: Variable)
+                             -> bool {
         if !self.used_on_entry(ln, var) {
             for self.should_warn(var).each |name| {
 
@@ -1629,8 +1653,11 @@ fn warn_about_unused(&self, sp: span, id: node_id,
         return false;
     }
 
-    fn warn_about_dead_assign(&self, sp: span, id: node_id,
-                              ln: LiveNode, var: Variable) {
+    pub fn warn_about_dead_assign(&self,
+                                  sp: span,
+                                  id: node_id,
+                                  ln: LiveNode,
+                                  var: Variable) {
         if self.live_on_exit(ln, var).is_none() {
             for self.should_warn(var).each |name| {
                 self.tcx.sess.add_lint(dead_assignment, id, sp,
index 3a14a6816289e17c1fb04506d26058309a1a6965..194ea9ac32d6fd30956bbc1ce3404bbc816e098c 100644 (file)
@@ -290,8 +290,8 @@ fn to_str(&self) -> ~str {
     }
 }
 
-pub impl MutabilityCategory {
-    fn from_mutbl(m: ast::mutability) -> MutabilityCategory {
+impl MutabilityCategory {
+    pub fn from_mutbl(m: ast::mutability) -> MutabilityCategory {
         match m {
             m_imm => McImmutable,
             m_const => McReadOnly,
@@ -299,7 +299,7 @@ fn from_mutbl(m: ast::mutability) -> MutabilityCategory {
         }
     }
 
-    fn inherit(&self) -> MutabilityCategory {
+    pub fn inherit(&self) -> MutabilityCategory {
         match *self {
             McImmutable => McImmutable,
             McReadOnly => McReadOnly,
@@ -308,21 +308,21 @@ fn inherit(&self) -> MutabilityCategory {
         }
     }
 
-    fn is_mutable(&self) -> bool {
+    pub fn is_mutable(&self) -> bool {
         match *self {
             McImmutable | McReadOnly => false,
             McDeclared | McInherited => true
         }
     }
 
-    fn is_immutable(&self) -> bool {
+    pub fn is_immutable(&self) -> bool {
         match *self {
             McImmutable => true,
             McReadOnly | McDeclared | McInherited => false
         }
     }
 
-    fn to_user_str(&self) -> &'static str {
+    pub fn to_user_str(&self) -> &'static str {
         match *self {
             McDeclared | McInherited => "mutable",
             McImmutable => "immutable",
@@ -331,16 +331,16 @@ fn to_user_str(&self) -> &'static str {
     }
 }
 
-pub impl mem_categorization_ctxt {
-    fn expr_ty(&self, expr: @ast::expr) -> ty::t {
+impl mem_categorization_ctxt {
+    pub fn expr_ty(&self, expr: @ast::expr) -> ty::t {
         ty::expr_ty(self.tcx, expr)
     }
 
-    fn pat_ty(&self, pat: @ast::pat) -> ty::t {
+    pub fn pat_ty(&self, pat: @ast::pat) -> ty::t {
         ty::node_id_to_type(self.tcx, pat.id)
     }
 
-    fn cat_expr(&self, expr: @ast::expr) -> cmt {
+    pub fn cat_expr(&self, expr: @ast::expr) -> cmt {
         match self.tcx.adjustments.find(&expr.id) {
             None => {
                 // No adjustments.
@@ -374,9 +374,8 @@ fn cat_expr(&self, expr: @ast::expr) -> cmt {
         }
     }
 
-    fn cat_expr_autoderefd(&self,
-                           expr: @ast::expr,
-                           autoderefs: uint) -> cmt {
+    pub fn cat_expr_autoderefd(&self, expr: @ast::expr, autoderefs: uint)
+                               -> cmt {
         let mut cmt = self.cat_expr_unadjusted(expr);
         for uint::range(1, autoderefs+1) |deref| {
             cmt = self.cat_deref(expr, cmt, deref);
@@ -384,7 +383,7 @@ fn cat_expr_autoderefd(&self,
         return cmt;
     }
 
-    fn cat_expr_unadjusted(&self, expr: @ast::expr) -> cmt {
+    pub fn cat_expr_unadjusted(&self, expr: @ast::expr) -> cmt {
         debug!("cat_expr: id=%d expr=%s",
                expr.id, pprust::expr_to_str(expr, self.tcx.sess.intr()));
 
@@ -440,11 +439,12 @@ fn cat_expr_unadjusted(&self, expr: @ast::expr) -> cmt {
         }
     }
 
-    fn cat_def(&self,
-               id: ast::node_id,
-               span: span,
-               expr_ty: ty::t,
-               def: ast::def) -> cmt {
+    pub fn cat_def(&self,
+                   id: ast::node_id,
+                   span: span,
+                   expr_ty: ty::t,
+                   def: ast::def)
+                   -> cmt {
         match def {
           ast::def_fn(*) | ast::def_static_method(*) | ast::def_mod(_) |
           ast::def_foreign_mod(_) | ast::def_const(_) |
@@ -557,7 +557,7 @@ fn cat_def(&self,
         }
     }
 
-    fn cat_rvalue<N:ast_node>(&self, elt: N, expr_ty: ty::t) -> cmt {
+    pub fn cat_rvalue<N:ast_node>(&self, elt: N, expr_ty: ty::t) -> cmt {
         @cmt_ {
             id:elt.id(),
             span:elt.span(),
@@ -571,10 +571,10 @@ fn cat_rvalue<N:ast_node>(&self, elt: N, expr_ty: ty::t) -> cmt {
     /// component is inherited from the base it is a part of. For
     /// example, a record field is mutable if it is declared mutable
     /// or if the container is mutable.
-    fn inherited_mutability(&self,
-                            base_m: MutabilityCategory,
-                            interior_m: ast::mutability) -> MutabilityCategory
-    {
+    pub fn inherited_mutability(&self,
+                                base_m: MutabilityCategory,
+                                interior_m: ast::mutability)
+                                -> MutabilityCategory {
         match interior_m {
             m_imm => base_m.inherit(),
             m_const => McReadOnly,
@@ -582,11 +582,12 @@ fn inherited_mutability(&self,
         }
     }
 
-    fn cat_field<N:ast_node>(&self,
-                             node: N,
-                             base_cmt: cmt,
-                             f_name: ast::ident,
-                             f_ty: ty::t) -> cmt {
+    pub fn cat_field<N:ast_node>(&self,
+                                 node: N,
+                                 base_cmt: cmt,
+                                 f_name: ast::ident,
+                                 f_ty: ty::t)
+                                 -> cmt {
         @cmt_ {
             id: node.id(),
             span: node.span(),
@@ -596,11 +597,11 @@ fn cat_field<N:ast_node>(&self,
         }
     }
 
-    fn cat_deref_fn<N:ast_node>(&self,
-                                node: N,
-                                base_cmt: cmt,
-                                deref_cnt: uint) -> cmt
-    {
+    pub fn cat_deref_fn<N:ast_node>(&self,
+                                    node: N,
+                                    base_cmt: cmt,
+                                    deref_cnt: uint)
+                                    -> cmt {
         // Bit of a hack: the "dereference" of a function pointer like
         // `@fn()` is a mere logical concept. We interpret it as
         // dereferencing the environment pointer; of course, we don't
@@ -612,11 +613,11 @@ fn cat_deref_fn<N:ast_node>(&self,
         return self.cat_deref_common(node, base_cmt, deref_cnt, mt);
     }
 
-    fn cat_deref<N:ast_node>(&self,
-                             node: N,
-                             base_cmt: cmt,
-                             deref_cnt: uint) -> cmt
-    {
+    pub fn cat_deref<N:ast_node>(&self,
+                                 node: N,
+                                 base_cmt: cmt,
+                                 deref_cnt: uint)
+                                 -> cmt {
         let mt = match ty::deref(self.tcx, base_cmt.ty, true) {
             Some(mt) => mt,
             None => {
@@ -630,12 +631,12 @@ fn cat_deref<N:ast_node>(&self,
         return self.cat_deref_common(node, base_cmt, deref_cnt, mt);
     }
 
-    fn cat_deref_common<N:ast_node>(&self,
-                                    node: N,
-                                    base_cmt: cmt,
-                                    deref_cnt: uint,
-                                    mt: ty::mt) -> cmt
-    {
+    pub fn cat_deref_common<N:ast_node>(&self,
+                                        node: N,
+                                        base_cmt: cmt,
+                                        deref_cnt: uint,
+                                        mt: ty::mt)
+                                        -> cmt {
         match deref_kind(self.tcx, base_cmt.ty) {
             deref_ptr(ptr) => {
                 // for unique ptrs, we inherit mutability from the
@@ -671,10 +672,11 @@ fn cat_deref_common<N:ast_node>(&self,
         }
     }
 
-    fn cat_index<N:ast_node>(&self,
-                             elt: N,
-                             base_cmt: cmt,
-                             derefs: uint) -> cmt {
+    pub fn cat_index<N:ast_node>(&self,
+                                 elt: N,
+                                 base_cmt: cmt,
+                                 derefs: uint)
+                                 -> cmt {
         //! Creates a cmt for an indexing operation (`[]`); this
         //! indexing operation may occurs as part of an
         //! AutoBorrowVec, which when converting a `~[]` to an `&[]`
@@ -764,11 +766,12 @@ fn interior<N: ast_node>(elt: N,
         }
     }
 
-    fn cat_imm_interior<N:ast_node>(&self,
-                                    node: N,
-                                    base_cmt: cmt,
-                                    interior_ty: ty::t,
-                                    interior: InteriorKind) -> cmt {
+    pub fn cat_imm_interior<N:ast_node>(&self,
+                                        node: N,
+                                        base_cmt: cmt,
+                                        interior_ty: ty::t,
+                                        interior: InteriorKind)
+                                        -> cmt {
         @cmt_ {
             id: node.id(),
             span: node.span(),
@@ -778,10 +781,11 @@ fn cat_imm_interior<N:ast_node>(&self,
         }
     }
 
-    fn cat_downcast<N:ast_node>(&self,
-                                node: N,
-                                base_cmt: cmt,
-                                downcast_ty: ty::t) -> cmt {
+    pub fn cat_downcast<N:ast_node>(&self,
+                                    node: N,
+                                    base_cmt: cmt,
+                                    downcast_ty: ty::t)
+                                    -> cmt {
         @cmt_ {
             id: node.id(),
             span: node.span(),
@@ -791,11 +795,10 @@ fn cat_downcast<N:ast_node>(&self,
         }
     }
 
-    fn cat_pattern(&self,
-                   cmt: cmt,
-                   pat: @ast::pat,
-                   op: &fn(cmt, @ast::pat))
-    {
+    pub fn cat_pattern(&self,
+                       cmt: cmt,
+                       pat: @ast::pat,
+                       op: &fn(cmt, @ast::pat)) {
         // Here, `cmt` is the categorization for the value being
         // matched and pat is the pattern it is being matched against.
         //
@@ -961,7 +964,7 @@ fn cat_pattern(&self,
         }
     }
 
-    fn mut_to_str(&self, mutbl: ast::mutability) -> ~str {
+    pub fn mut_to_str(&self, mutbl: ast::mutability) -> ~str {
         match mutbl {
           m_mutbl => ~"mutable",
           m_const => ~"const",
@@ -969,7 +972,7 @@ fn mut_to_str(&self, mutbl: ast::mutability) -> ~str {
         }
     }
 
-    fn cmt_to_str(&self, cmt: cmt) -> ~str {
+    pub fn cmt_to_str(&self, cmt: cmt) -> ~str {
         match cmt.cat {
           cat_static_item => {
               ~"static item"
@@ -1022,7 +1025,7 @@ fn cmt_to_str(&self, cmt: cmt) -> ~str {
         }
     }
 
-    fn region_to_str(&self, r: ty::Region) -> ~str {
+    pub fn region_to_str(&self, r: ty::Region) -> ~str {
         region_to_str(self.tcx, r)
     }
 }
@@ -1068,8 +1071,8 @@ pub enum AliasableReason {
     AliasableOther
 }
 
-pub impl cmt_ {
-    fn guarantor(@self) -> cmt {
+impl cmt_ {
+    pub fn guarantor(@self) -> cmt {
         //! Returns `self` after stripping away any owned pointer derefs or
         //! interior content. The return value is basically the `cmt` which
         //! determines how long the value in `self` remains live.
@@ -1097,11 +1100,11 @@ fn guarantor(@self) -> cmt {
         }
     }
 
-    fn is_freely_aliasable(&self) -> bool {
+    pub fn is_freely_aliasable(&self) -> bool {
         self.freely_aliasable().is_some()
     }
 
-    fn freely_aliasable(&self) -> Option<AliasableReason> {
+    pub fn freely_aliasable(&self) -> Option<AliasableReason> {
         //! True if this lvalue resides in an area that is
         //! freely aliasable, meaning that rustc cannot track
         //! the alias//es with precision.
index d2f6d6527738885cda6979fa57520cc6f7efe005..2e7ceba33663d38e55d92d3723ea02537407fe53 100644 (file)
@@ -230,20 +230,14 @@ fn compute_modes_for_expr(expr: @expr,
     cx.consume_expr(expr, v);
 }
 
-pub impl VisitContext {
-    fn consume_exprs(&self,
-                     exprs: &[@expr],
-                     visitor: vt<VisitContext>)
-    {
+impl VisitContext {
+    pub fn consume_exprs(&self, exprs: &[@expr], visitor: vt<VisitContext>) {
         for exprs.each |expr| {
             self.consume_expr(*expr, visitor);
         }
     }
 
-    fn consume_expr(&self,
-                    expr: @expr,
-                    visitor: vt<VisitContext>)
-    {
+    pub fn consume_expr(&self, expr: @expr, visitor: vt<VisitContext>) {
         /*!
          * Indicates that the value of `expr` will be consumed,
          * meaning either copied or moved depending on its type.
@@ -261,10 +255,7 @@ fn consume_expr(&self,
         };
     }
 
-    fn consume_block(&self,
-                     blk: &blk,
-                     visitor: vt<VisitContext>)
-    {
+    pub fn consume_block(&self, blk: &blk, visitor: vt<VisitContext>) {
         /*!
          * Indicates that the value of `blk` will be consumed,
          * meaning either copied or moved depending on its type.
@@ -281,11 +272,10 @@ fn consume_block(&self,
         }
     }
 
-    fn use_expr(&self,
-                expr: @expr,
-                expr_mode: UseMode,
-                visitor: vt<VisitContext>)
-    {
+    pub fn use_expr(&self,
+                    expr: @expr,
+                    expr_mode: UseMode,
+                    visitor: vt<VisitContext>) {
         /*!
          * Indicates that `expr` is used with a given mode.  This will
          * in turn trigger calls to the subcomponents of `expr`.
@@ -529,12 +519,12 @@ fn use_expr(&self,
         }
     }
 
-    fn use_overloaded_operator(&self,
-                               expr: @expr,
-                               receiver_expr: @expr,
-                               arg_exprs: &[@expr],
-                               visitor: vt<VisitContext>) -> bool
-    {
+    pub fn use_overloaded_operator(&self,
+                                   expr: @expr,
+                                   receiver_expr: @expr,
+                                   arg_exprs: &[@expr],
+                                   visitor: vt<VisitContext>)
+                                   -> bool {
         if !self.method_map.contains_key(&expr.id) {
             return false;
         }
@@ -550,10 +540,7 @@ fn use_overloaded_operator(&self,
         return true;
     }
 
-    fn consume_arm(&self,
-                   arm: &arm,
-                   visitor: vt<VisitContext>)
-    {
+    pub fn consume_arm(&self, arm: &arm, visitor: vt<VisitContext>) {
         for arm.pats.each |pat| {
             self.use_pat(*pat);
         }
@@ -565,9 +552,7 @@ fn consume_arm(&self,
         self.consume_block(&arm.body, visitor);
     }
 
-    fn use_pat(&self,
-               pat: @pat)
-    {
+    pub fn use_pat(&self, pat: @pat) {
         /*!
          *
          * Decides whether each binding in a pattern moves the value
@@ -594,32 +579,31 @@ fn use_pat(&self,
         }
     }
 
-    fn use_receiver(&self,
-                    receiver_expr: @expr,
-                    visitor: vt<VisitContext>)
-    {
+    pub fn use_receiver(&self,
+                        receiver_expr: @expr,
+                        visitor: vt<VisitContext>) {
         self.use_fn_arg(receiver_expr, visitor);
     }
 
-    fn use_fn_args(&self,
-                   _: node_id,
-                   arg_exprs: &[@expr],
-                   visitor: vt<VisitContext>) {
+    pub fn use_fn_args(&self,
+                       _: node_id,
+                       arg_exprs: &[@expr],
+                       visitor: vt<VisitContext>) {
         //! Uses the argument expressions.
         for arg_exprs.each |arg_expr| {
             self.use_fn_arg(*arg_expr, visitor);
         }
     }
 
-    fn use_fn_arg(&self, arg_expr: @expr, visitor: vt<VisitContext>) {
+    pub fn use_fn_arg(&self, arg_expr: @expr, visitor: vt<VisitContext>) {
         //! Uses the argument.
         self.consume_expr(arg_expr, visitor)
     }
 
-    fn arms_have_by_move_bindings(&self,
-                                  moves_map: MovesMap,
-                                  arms: &[arm]) -> Option<@pat>
-    {
+    pub fn arms_have_by_move_bindings(&self,
+                                      moves_map: MovesMap,
+                                      arms: &[arm])
+                                      -> Option<@pat> {
         for arms.each |arm| {
             for arm.pats.each |&pat| {
                 for ast_util::walk_pat(pat) |p| {
@@ -632,7 +616,7 @@ fn arms_have_by_move_bindings(&self,
         return None;
     }
 
-    fn compute_captures(&self, fn_expr_id: node_id) -> @[CaptureVar] {
+    pub fn compute_captures(&self, fn_expr_id: node_id) -> @[CaptureVar] {
         debug!("compute_capture_vars(fn_expr_id=%?)", fn_expr_id);
         let _indenter = indenter();
 
index 1731ced634f296b29469f31cd3d0b0db96975024..ce229092323307996f67be05b0ed8a1a60070481 100644 (file)
@@ -73,11 +73,8 @@ pub struct Context {
     parent: parent,
 }
 
-pub impl RegionMaps {
-    fn relate_free_regions(&mut self,
-                           sub: FreeRegion,
-                           sup: FreeRegion)
-    {
+impl RegionMaps {
+    pub fn relate_free_regions(&mut self, sub: FreeRegion, sup: FreeRegion) {
         match self.free_region_map.find_mut(&sub) {
             Some(sups) => {
                 if !sups.contains(&sup) {
@@ -93,19 +90,14 @@ fn relate_free_regions(&mut self,
         self.free_region_map.insert(sub, ~[sup]);
     }
 
-    fn record_parent(&mut self,
-                     sub: ast::node_id,
-                     sup: ast::node_id)
-    {
+    pub fn record_parent(&mut self, sub: ast::node_id, sup: ast::node_id) {
         debug!("record_parent(sub=%?, sup=%?)", sub, sup);
         assert!(sub != sup);
 
         self.scope_map.insert(sub, sup);
     }
 
-    pub fn record_cleanup_scope(&mut self,
-                                scope_id: ast::node_id)
-    {
+    pub fn record_cleanup_scope(&mut self, scope_id: ast::node_id) {
         //! Records that a scope is a CLEANUP SCOPE.  This is invoked
         //! from within regionck.  We wait until regionck because we do
         //! not know which operators are overloaded until that point,
@@ -114,17 +106,13 @@ pub fn record_cleanup_scope(&mut self,
         self.cleanup_scopes.insert(scope_id);
     }
 
-    fn opt_encl_scope(&self,
-                      id: ast::node_id) -> Option<ast::node_id>
-    {
+    pub fn opt_encl_scope(&self, id: ast::node_id) -> Option<ast::node_id> {
         //! Returns the narrowest scope that encloses `id`, if any.
 
         self.scope_map.find(&id).map(|&x| *x)
     }
 
-    fn encl_scope(&self,
-                  id: ast::node_id) -> ast::node_id
-    {
+    pub fn encl_scope(&self, id: ast::node_id) -> ast::node_id {
         //! Returns the narrowest scope that encloses `id`, if any.
 
         match self.scope_map.find(&id) {
@@ -133,13 +121,11 @@ fn encl_scope(&self,
         }
     }
 
-    fn is_cleanup_scope(&self, scope_id: ast::node_id) -> bool {
+    pub fn is_cleanup_scope(&self, scope_id: ast::node_id) -> bool {
         self.cleanup_scopes.contains(&scope_id)
     }
 
-    fn cleanup_scope(&self,
-                     expr_id: ast::node_id) -> ast::node_id
-    {
+    pub fn cleanup_scope(&self, expr_id: ast::node_id) -> ast::node_id {
         //! Returns the scope when temps in expr will be cleaned up
 
         let mut id = self.encl_scope(expr_id);
@@ -149,25 +135,22 @@ fn cleanup_scope(&self,
         return id;
     }
 
-    fn encl_region(&self,
-                   id: ast::node_id) -> ty::Region
-    {
+    pub fn encl_region(&self, id: ast::node_id) -> ty::Region {
         //! Returns the narrowest scope region that encloses `id`, if any.
 
         ty::re_scope(self.encl_scope(id))
     }
 
-    pub fn scopes_intersect(&self,
-                            scope1: ast::node_id,
-                            scope2: ast::node_id) -> bool
-    {
-        self.is_subscope_of(scope1, scope2) || self.is_subscope_of(scope2, scope1)
+    pub fn scopes_intersect(&self, scope1: ast::node_id, scope2: ast::node_id)
+                            -> bool {
+        self.is_subscope_of(scope1, scope2) ||
+        self.is_subscope_of(scope2, scope1)
     }
 
-    fn is_subscope_of(&self,
-                      subscope: ast::node_id,
-                      superscope: ast::node_id) -> bool
-    {
+    pub fn is_subscope_of(&self,
+                          subscope: ast::node_id,
+                          superscope: ast::node_id)
+                          -> bool {
         /*!
          * Returns true if `subscope` is equal to or is lexically
          * nested inside `superscope` and false otherwise.
@@ -192,10 +175,7 @@ fn is_subscope_of(&self,
         return true;
     }
 
-    fn sub_free_region(&self,
-                       sub: FreeRegion,
-                       sup: FreeRegion) -> bool
-    {
+    pub fn sub_free_region(&self, sub: FreeRegion, sup: FreeRegion) -> bool {
         /*!
          * Determines whether two free regions have a subregion relationship
          * by walking the graph encoded in `free_region_map`.  Note that
@@ -233,10 +213,10 @@ fn sub_free_region(&self,
         return false;
     }
 
-    fn is_subregion_of(&self,
-                       sub_region: ty::Region,
-                       super_region: ty::Region) -> bool
-    {
+    pub fn is_subregion_of(&self,
+                           sub_region: ty::Region,
+                           super_region: ty::Region)
+                           -> bool {
         /*!
          * Determines whether one region is a subregion of another.  This is
          * intended to run *after inference* and sadly the logic is somewhat
@@ -271,10 +251,10 @@ fn is_subregion_of(&self,
         }
     }
 
-    fn nearest_common_ancestor(&self,
-                               scope_a: ast::node_id,
-                               scope_b: ast::node_id) -> Option<ast::node_id>
-    {
+    pub fn nearest_common_ancestor(&self,
+                                   scope_a: ast::node_id,
+                                   scope_b: ast::node_id)
+                                   -> Option<ast::node_id> {
         /*!
          * Finds the nearest common ancestor (if any) of two scopes.  That
          * is, finds the smallest scope which is greater than or equal to
@@ -588,15 +568,15 @@ pub fn add_variance(ambient_variance: region_variance,
     }
 }
 
-pub impl DetermineRpCtxt {
-    fn add_variance(&self, variance: region_variance) -> region_variance {
+impl DetermineRpCtxt {
+    pub fn add_variance(&self, variance: region_variance) -> region_variance {
         add_variance(self.ambient_variance, variance)
     }
 
     /// Records that item `id` is region-parameterized with the
     /// variance `variance`.  If `id` was already parameterized, then
     /// the new variance is joined with the old variance.
-    fn add_rp(&mut self, id: ast::node_id, variance: region_variance) {
+    pub fn add_rp(&mut self, id: ast::node_id, variance: region_variance) {
         assert!(id != 0);
         let old_variance = self.region_paramd_items.find(&id).
                                 map_consume(|x| *x);
@@ -622,7 +602,7 @@ fn add_rp(&mut self, id: ast::node_id, variance: region_variance) {
     /// `from`.  Put another way, it indicates that the current item
     /// contains a value of type `from`, so if `from` is
     /// region-parameterized, so is the current item.
-    fn add_dep(&mut self, from: ast::node_id) {
+    pub fn add_dep(&mut self, from: ast::node_id) {
         debug!("add dependency from %d -> %d (%s -> %s) with variance %?",
                from, self.item_id,
                ast_map::node_id_to_str(self.ast_map, from,
@@ -682,7 +662,7 @@ fn add_dep(&mut self, from: ast::node_id) {
     // with &self type, &self is also bound.  We detect those last two
     // cases via flags (anon_implies_rp and self_implies_rp) that are
     // true when the anon or self region implies RP.
-    fn region_is_relevant(&self, r: Option<@ast::Lifetime>) -> bool {
+    pub fn region_is_relevant(&self, r: Option<@ast::Lifetime>) -> bool {
         match r {
             None => {
                 self.anon_implies_rp
@@ -699,10 +679,10 @@ fn region_is_relevant(&self, r: Option<@ast::Lifetime>) -> bool {
         }
     }
 
-    fn with(@mut self,
-            item_id: ast::node_id,
-            anon_implies_rp: bool,
-            f: &fn()) {
+    pub fn with(@mut self,
+                item_id: ast::node_id,
+                anon_implies_rp: bool,
+                f: &fn()) {
         let old_item_id = self.item_id;
         let old_anon_implies_rp = self.anon_implies_rp;
         self.item_id = item_id;
@@ -716,7 +696,9 @@ fn with(@mut self,
         self.anon_implies_rp = old_anon_implies_rp;
     }
 
-    fn with_ambient_variance(@mut self, variance: region_variance, f: &fn()) {
+    pub fn with_ambient_variance(@mut self,
+                                 variance: region_variance,
+                                 f: &fn()) {
         let old_ambient_variance = self.ambient_variance;
         self.ambient_variance = self.add_variance(variance);
         f();
index 4d7105585778405ce6cb1e0b6b4e37543a4d61f0..b8faa0740b8ba27a5a56d282d1ea6e3d6c206ab3 100644 (file)
@@ -117,8 +117,8 @@ pub enum NamespaceResult {
     BoundResult(@mut Module, @mut NameBindings)
 }
 
-pub impl NamespaceResult {
-    fn is_unknown(&self) -> bool {
+impl NamespaceResult {
+    pub fn is_unknown(&self) -> bool {
         match *self {
             UnknownResult => true,
             _ => false
@@ -162,11 +162,11 @@ pub enum ResolveResult<T> {
     Success(T)      // Successfully resolved the import.
 }
 
-pub impl<T> ResolveResult<T> {
-    fn failed(&self) -> bool {
+impl<T> ResolveResult<T> {
+    pub fn failed(&self) -> bool {
         match *self { Failed => true, _ => false }
     }
-    fn indeterminate(&self) -> bool {
+    pub fn indeterminate(&self) -> bool {
         match *self { Indeterminate => true, _ => false }
     }
 }
@@ -390,8 +390,9 @@ pub fn ImportResolution(privacy: Privacy,
     }
 }
 
-pub impl ImportResolution {
-    fn target_for_namespace(&self, namespace: Namespace) -> Option<Target> {
+impl ImportResolution {
+    pub fn target_for_namespace(&self, namespace: Namespace)
+                                -> Option<Target> {
         match namespace {
             TypeNS      => return copy self.type_target,
             ValueNS     => return copy self.value_target
@@ -472,8 +473,8 @@ pub fn Module(parent_link: ParentLink,
     }
 }
 
-pub impl Module {
-    fn all_imports_resolved(&self) -> bool {
+impl Module {
+    pub fn all_imports_resolved(&self) -> bool {
         let imports = &mut *self.imports;
         return imports.len() == self.resolved_import_count;
     }
@@ -501,14 +502,14 @@ pub struct NameBindings {
     value_def: Option<ValueNsDef>,  //< Meaning in value namespace.
 }
 
-pub impl NameBindings {
+impl NameBindings {
     /// Creates a new module in this set of name bindings.
-    fn define_module(@mut self,
-                     privacy: Privacy,
-                     parent_link: ParentLink,
-                     def_id: Option<def_id>,
-                     kind: ModuleKind,
-                     sp: span) {
+    pub fn define_module(@mut self,
+                         privacy: Privacy,
+                         parent_link: ParentLink,
+                         def_id: Option<def_id>,
+                         kind: ModuleKind,
+                         sp: span) {
         // Merges the module with the existing type def or creates a new one.
         let module_ = @mut Module(parent_link, def_id, kind);
         match self.type_def {
@@ -532,12 +533,12 @@ fn define_module(@mut self,
     }
 
     /// Sets the kind of the module, creating a new one if necessary.
-    fn set_module_kind(@mut self,
-                       privacy: Privacy,
-                       parent_link: ParentLink,
-                       def_id: Option<def_id>,
-                       kind: ModuleKind,
-                       _sp: span) {
+    pub fn set_module_kind(@mut self,
+                           privacy: Privacy,
+                           parent_link: ParentLink,
+                           def_id: Option<def_id>,
+                           kind: ModuleKind,
+                           _sp: span) {
         match self.type_def {
             None => {
                 let module = @mut Module(parent_link, def_id, kind);
@@ -566,7 +567,7 @@ fn set_module_kind(@mut self,
     }
 
     /// Records a type definition.
-    fn define_type(@mut self, privacy: Privacy, def: def, sp: span) {
+    pub fn define_type(@mut self, privacy: Privacy, def: def, sp: span) {
         // Merges the type with the existing type def or creates a new one.
         match self.type_def {
             None => {
@@ -589,12 +590,12 @@ fn define_type(@mut self, privacy: Privacy, def: def, sp: span) {
     }
 
     /// Records a value definition.
-    fn define_value(@mut self, privacy: Privacy, def: def, sp: span) {
+    pub fn define_value(@mut self, privacy: Privacy, def: def, sp: span) {
         self.value_def = Some(ValueNsDef { privacy: privacy, def: def, value_span: Some(sp) });
     }
 
     /// Returns the module node if applicable.
-    fn get_module_if_available(&self) -> Option<@mut Module> {
+    pub fn get_module_if_available(&self) -> Option<@mut Module> {
         match self.type_def {
             Some(ref type_def) => (*type_def).module_def,
             None => None
@@ -605,7 +606,7 @@ fn get_module_if_available(&self) -> Option<@mut Module> {
      * Returns the module node. Fails if this node does not have a module
      * definition.
      */
-    fn get_module(@mut self) -> @mut Module {
+    pub fn get_module(@mut self) -> @mut Module {
         match self.get_module_if_available() {
             None => {
                 fail!("get_module called on a node with no module \
@@ -615,14 +616,14 @@ fn get_module(@mut self) -> @mut Module {
         }
     }
 
-    fn defined_in_namespace(&self, namespace: Namespace) -> bool {
+    pub fn defined_in_namespace(&self, namespace: Namespace) -> bool {
         match namespace {
             TypeNS   => return self.type_def.is_some(),
             ValueNS  => return self.value_def.is_some()
         }
     }
 
-    fn defined_in_public_namespace(&self, namespace: Namespace) -> bool {
+    pub fn defined_in_public_namespace(&self, namespace: Namespace) -> bool {
         match namespace {
             TypeNS => match self.type_def {
                 Some(def) => def.privacy != Private,
@@ -635,7 +636,7 @@ fn defined_in_public_namespace(&self, namespace: Namespace) -> bool {
         }
     }
 
-    fn def_for_namespace(&self, namespace: Namespace) -> Option<def> {
+    pub fn def_for_namespace(&self, namespace: Namespace) -> Option<def> {
         match namespace {
             TypeNS => {
                 match self.type_def {
@@ -669,7 +670,8 @@ fn def_for_namespace(&self, namespace: Namespace) -> Option<def> {
         }
     }
 
-    fn privacy_for_namespace(&self, namespace: Namespace) -> Option<Privacy> {
+    pub fn privacy_for_namespace(&self, namespace: Namespace)
+                                 -> Option<Privacy> {
         match namespace {
             TypeNS => {
                 match self.type_def {
@@ -686,7 +688,7 @@ fn privacy_for_namespace(&self, namespace: Namespace) -> Option<Privacy> {
         }
     }
 
-    fn span_for_namespace(&self, namespace: Namespace) -> Option<span> {
+    pub fn span_for_namespace(&self, namespace: Namespace) -> Option<span> {
         if self.defined_in_namespace(namespace) {
             match namespace {
                 TypeNS  => {
@@ -720,9 +722,11 @@ pub struct PrimitiveTypeTable {
     primitive_types: HashMap<ident,prim_ty>,
 }
 
-pub impl PrimitiveTypeTable {
-    fn intern(&mut self, intr: @ident_interner, string: &str,
-              primitive_type: prim_ty) {
+impl PrimitiveTypeTable {
+    pub fn intern(&mut self,
+                  intr: @ident_interner,
+                  string: &str,
+                  primitive_type: prim_ty) {
         let ident = intr.intern(string);
         self.primitive_types.insert(ident, primitive_type);
     }
@@ -871,9 +875,9 @@ pub struct Resolver {
     used_imports: HashSet<node_id>,
 }
 
-pub impl Resolver {
+impl Resolver {
     /// The main name resolution procedure.
-    fn resolve(@mut self) {
+    pub fn resolve(@mut self) {
         self.build_reduced_graph();
         self.session.abort_if_errors();
 
@@ -897,7 +901,7 @@ fn resolve(@mut self) {
     //
 
     /// Constructs the reduced graph for the entire crate.
-    fn build_reduced_graph(@mut self) {
+    pub fn build_reduced_graph(@mut self) {
         let initial_parent =
             ModuleReducedGraphParent(self.graph_root.get_module());
         visit_crate(self.crate, initial_parent, mk_vt(@Visitor {
@@ -924,9 +928,9 @@ fn build_reduced_graph(@mut self) {
     }
 
     /// Returns the current module tracked by the reduced graph parent.
-    fn get_module_from_parent(@mut self,
-                              reduced_graph_parent: ReducedGraphParent)
-                           -> @mut Module {
+    pub fn get_module_from_parent(@mut self,
+                                  reduced_graph_parent: ReducedGraphParent)
+                                  -> @mut Module {
         match reduced_graph_parent {
             ModuleReducedGraphParent(module_) => {
                 return module_;
@@ -944,14 +948,13 @@ fn get_module_from_parent(@mut self,
      * If this node does not have a module definition and we are not inside
      * a block, fails.
      */
-    fn add_child(@mut self,
-                 name: ident,
-                 reduced_graph_parent: ReducedGraphParent,
-                 duplicate_checking_mode: DuplicateCheckingMode,
-                 // For printing errors
-                 sp: span)
-              -> (@mut NameBindings, ReducedGraphParent) {
-
+    pub fn add_child(@mut self,
+                     name: ident,
+                     reduced_graph_parent: ReducedGraphParent,
+                     duplicate_checking_mode: DuplicateCheckingMode,
+                     // For printing errors
+                     sp: span)
+                     -> (@mut NameBindings, ReducedGraphParent) {
         // If this is the immediate descendant of a module, then we add the
         // child name directly. Otherwise, we create or reuse an anonymous
         // module and add the child to that.
@@ -1038,7 +1041,7 @@ fn add_child(@mut self,
         }
     }
 
-    fn block_needs_anonymous_module(@mut self, block: &blk) -> bool {
+    pub fn block_needs_anonymous_module(@mut self, block: &blk) -> bool {
         // If the block has view items, we need an anonymous module.
         if block.node.view_items.len() > 0 {
             return true;
@@ -1069,10 +1072,8 @@ fn block_needs_anonymous_module(@mut self, block: &blk) -> bool {
         return false;
     }
 
-    fn get_parent_link(@mut self,
-                       parent: ReducedGraphParent,
-                       name: ident)
-                    -> ParentLink {
+    pub fn get_parent_link(@mut self, parent: ReducedGraphParent, name: ident)
+                           -> ParentLink {
         match parent {
             ModuleReducedGraphParent(module_) => {
                 return ModuleParentLink(module_, name);
@@ -1081,10 +1082,10 @@ fn get_parent_link(@mut self,
     }
 
     /// Constructs the reduced graph for one item.
-    fn build_reduced_graph_for_item(@mut self,
-                                    item: @item,
-                                    parent: ReducedGraphParent,
-                                    visitor: vt<ReducedGraphParent>) {
+    pub fn build_reduced_graph_for_item(@mut self,
+                                        item: @item,
+                                        parent: ReducedGraphParent,
+                                        visitor: vt<ReducedGraphParent>) {
         let ident = item.ident;
         let sp = item.span;
         let privacy = visibility_to_privacy(item.vis);
@@ -1365,12 +1366,12 @@ fn build_reduced_graph_for_item(@mut self,
 
     // Constructs the reduced graph for one variant. Variants exist in the
     // type and/or value namespaces.
-    fn build_reduced_graph_for_variant(@mut self,
-                                       variant: &variant,
-                                       item_id: def_id,
-                                       parent_privacy: Privacy,
-                                       parent: ReducedGraphParent,
-                                       _visitor: vt<ReducedGraphParent>) {
+    pub fn build_reduced_graph_for_variant(@mut self,
+                                           variant: &variant,
+                                           item_id: def_id,
+                                           parent_privacy: Privacy,
+                                           parent: ReducedGraphParent,
+                                           _visitor: vt<ReducedGraphParent>) {
         let ident = variant.node.name;
         let (child, _) = self.add_child(ident, parent, ForbidDuplicateValues,
                                         variant.span);
@@ -1401,10 +1402,10 @@ fn build_reduced_graph_for_variant(@mut self,
 
     /// Constructs the reduced graph for one 'view item'. View items consist
     /// of imports and use directives.
-    fn build_reduced_graph_for_view_item(@mut self,
-                                         view_item: @view_item,
-                                         parent: ReducedGraphParent,
-                                         _visitor: vt<ReducedGraphParent>) {
+    pub fn build_reduced_graph_for_view_item(@mut self,
+                                             view_item: @view_item,
+                                             parent: ReducedGraphParent,
+                                             _: vt<ReducedGraphParent>) {
         let privacy = visibility_to_privacy(view_item.vis);
         match view_item.node {
             view_item_use(ref view_paths) => {
@@ -1497,10 +1498,10 @@ fn build_reduced_graph_for_view_item(@mut self,
     }
 
     /// Constructs the reduced graph for one foreign item.
-    fn build_reduced_graph_for_foreign_item(@mut self,
-                                            foreign_item: @foreign_item,
-                                            parent: ReducedGraphParent,
-                                            visitor:
+    pub fn build_reduced_graph_for_foreign_item(@mut self,
+                                                foreign_item: @foreign_item,
+                                                parent: ReducedGraphParent,
+                                                visitor:
                                                 vt<ReducedGraphParent>) {
         let name = foreign_item.ident;
         let (name_bindings, new_parent) =
@@ -1528,10 +1529,10 @@ fn build_reduced_graph_for_foreign_item(@mut self,
         }
     }
 
-    fn build_reduced_graph_for_block(@mut self,
-                                     block: &blk,
-                                     parent: ReducedGraphParent,
-                                     visitor: vt<ReducedGraphParent>) {
+    pub fn build_reduced_graph_for_block(@mut self,
+                                         block: &blk,
+                                         parent: ReducedGraphParent,
+                                         visitor: vt<ReducedGraphParent>) {
         let new_parent;
         if self.block_needs_anonymous_module(block) {
             let block_id = block.node.id;
@@ -1554,14 +1555,14 @@ fn build_reduced_graph_for_block(@mut self,
         visit_block(block, new_parent, visitor);
     }
 
-    fn handle_external_def(@mut self,
-                           def: def,
-                           visibility: ast::visibility,
-                           modules: &mut HashMap<def_id, @mut Module>,
-                           child_name_bindings: @mut NameBindings,
-                           final_ident: &str,
-                           ident: ident,
-                           new_parent: ReducedGraphParent) {
+    pub fn handle_external_def(@mut self,
+                               def: def,
+                               visibility: ast::visibility,
+                               modules: &mut HashMap<def_id, @mut Module>,
+                               child_name_bindings: @mut NameBindings,
+                               final_ident: &str,
+                               ident: ident,
+                               new_parent: ReducedGraphParent) {
         let privacy = visibility_to_privacy(visibility);
         match def {
           def_mod(def_id) | def_foreign_mod(def_id) => {
@@ -1702,7 +1703,8 @@ trait method '%s'",
      * Builds the reduced graph rooted at the 'use' directive for an external
      * crate.
      */
-    fn build_reduced_graph_for_external_crate(@mut self, root: @mut Module) {
+    pub fn build_reduced_graph_for_external_crate(@mut self,
+                                                  root: @mut Module) {
         let mut modules = HashMap::new();
 
         // Create all the items reachable by paths.
@@ -1879,13 +1881,13 @@ fn build_reduced_graph_for_external_crate(@mut self, root: @mut Module) {
     }
 
     /// Creates and adds an import directive to the given module.
-    fn build_import_directive(@mut self,
-                              privacy: Privacy,
-                              module_: @mut Module,
-                              module_path: ~[ident],
-                              subclass: @ImportDirectiveSubclass,
-                              span: span,
-                              id: node_id) {
+    pub fn build_import_directive(@mut self,
+                                  privacy: Privacy,
+                                  module_: @mut Module,
+                                  module_path: ~[ident],
+                                  subclass: @ImportDirectiveSubclass,
+                                  span: span,
+                                  id: node_id) {
         let directive = @ImportDirective(privacy, module_path,
                                          subclass, span, id);
         module_.imports.push(directive);
@@ -1940,7 +1942,7 @@ fn build_import_directive(@mut self,
 
     /// Resolves all imports for the crate. This method performs the fixed-
     /// point iteration.
-    fn resolve_imports(@mut self) {
+    pub fn resolve_imports(@mut self) {
         let mut i = 0;
         let mut prev_unresolved_imports = 0;
         loop {
@@ -1967,7 +1969,8 @@ fn resolve_imports(@mut self) {
 
     /// Attempts to resolve imports for the given module and all of its
     /// submodules.
-    fn resolve_imports_for_module_subtree(@mut self, module_: @mut Module) {
+    pub fn resolve_imports_for_module_subtree(@mut self,
+                                              module_: @mut Module) {
         debug!("(resolving imports for module subtree) resolving %s",
                self.module_to_str(module_));
         self.resolve_imports_for_module(module_);
@@ -1989,7 +1992,7 @@ fn resolve_imports_for_module_subtree(@mut self, module_: @mut Module) {
     }
 
     /// Attempts to resolve imports for the given module only.
-    fn resolve_imports_for_module(@mut self, module: @mut Module) {
+    pub fn resolve_imports_for_module(@mut self, module: @mut Module) {
         if module.all_imports_resolved() {
             debug!("(resolving imports for module) all imports resolved for \
                    %s",
@@ -2024,7 +2027,7 @@ fn resolve_imports_for_module(@mut self, module: @mut Module) {
         }
     }
 
-    fn idents_to_str(@mut self, idents: &[ident]) -> ~str {
+    pub fn idents_to_str(@mut self, idents: &[ident]) -> ~str {
         let mut first = true;
         let mut result = ~"";
         for idents.each |ident| {
@@ -2034,19 +2037,19 @@ fn idents_to_str(@mut self, idents: &[ident]) -> ~str {
         return result;
     }
 
-    fn import_directive_subclass_to_str(@mut self,
-                                        subclass: ImportDirectiveSubclass)
-                                     -> @~str {
+    pub fn import_directive_subclass_to_str(@mut self,
+                                            subclass: ImportDirectiveSubclass)
+                                            -> @~str {
         match subclass {
             SingleImport(_target, source) => self.session.str_of(source),
             GlobImport => @~"*"
         }
     }
 
-    fn import_path_to_str(@mut self,
-                          idents: &[ident],
-                          subclass: ImportDirectiveSubclass)
-                       -> @~str {
+    pub fn import_path_to_str(@mut self,
+                              idents: &[ident],
+                              subclass: ImportDirectiveSubclass)
+                              -> @~str {
         if idents.is_empty() {
             self.import_directive_subclass_to_str(subclass)
         } else {
@@ -2061,10 +2064,10 @@ fn import_path_to_str(@mut self,
     /// don't know whether the name exists at the moment due to other
     /// currently-unresolved imports, or success if we know the name exists.
     /// If successful, the resolved bindings are written into the module.
-    fn resolve_import_for_module(@mut self,
-                                 module_: @mut Module,
-                                 import_directive: @ImportDirective)
-                                 -> ResolveResult<()> {
+    pub fn resolve_import_for_module(@mut self,
+                                     module_: @mut Module,
+                                     import_directive: @ImportDirective)
+                                     -> ResolveResult<()> {
         let mut resolution_result = Failed;
         let module_path = &import_directive.module_path;
 
@@ -2151,7 +2154,8 @@ fn resolve_import_for_module(@mut self,
         return resolution_result;
     }
 
-    fn create_name_bindings_from_module(module: @mut Module) -> NameBindings {
+    pub fn create_name_bindings_from_module(module: @mut Module)
+                                            -> NameBindings {
         NameBindings {
             type_def: Some(TypeNsDef {
                 privacy: Public,
@@ -2163,13 +2167,13 @@ fn create_name_bindings_from_module(module: @mut Module) -> NameBindings {
         }
     }
 
-    fn resolve_single_import(@mut self,
-                             module_: @mut Module,
-                             containing_module: @mut Module,
-                             target: ident,
-                             source: ident,
-                             span: span)
-                             -> ResolveResult<()> {
+    pub fn resolve_single_import(@mut self,
+                                 module_: @mut Module,
+                                 containing_module: @mut Module,
+                                 target: ident,
+                                 source: ident,
+                                 span: span)
+                                 -> ResolveResult<()> {
         debug!("(resolving single import) resolving `%s` = `%s::%s` from \
                 `%s`",
                *self.session.str_of(target),
@@ -2392,12 +2396,12 @@ fn get_binding(this: @mut Resolver,
     // Resolves a glob import. Note that this function cannot fail; it either
     // succeeds or bails out (as importing * from an empty module or a module
     // that exports nothing is valid).
-    fn resolve_glob_import(@mut self,
-                           privacy: Privacy,
-                           module_: @mut Module,
-                           containing_module: @mut Module,
-                           id: node_id)
-                        -> ResolveResult<()> {
+    pub fn resolve_glob_import(@mut self,
+                               privacy: Privacy,
+                               module_: @mut Module,
+                               containing_module: @mut Module,
+                               id: node_id)
+                               -> ResolveResult<()> {
         // This function works in a highly imperative manner; it eagerly adds
         // everything it can to the list of import resolutions of the module
         // node.
@@ -2516,13 +2520,13 @@ fn resolve_glob_import(@mut self,
     }
 
     /// Resolves the given module path from the given root `module_`.
-    fn resolve_module_path_from_root(@mut self,
-                                     module_: @mut Module,
-                                     module_path: &[ident],
-                                     index: uint,
-                                     span: span,
-                                     mut name_search_type: NameSearchType)
-                                  -> ResolveResult<@mut Module> {
+    pub fn resolve_module_path_from_root(@mut self,
+                                         module_: @mut Module,
+                                         module_path: &[ident],
+                                         index: uint,
+                                         span: span,
+                                         mut name_search_type: NameSearchType)
+                                         -> ResolveResult<@mut Module> {
         let mut search_module = module_;
         let mut index = index;
         let module_path_len = module_path.len();
@@ -2625,13 +2629,13 @@ fn resolve_module_path_from_root(@mut self,
 
     /// Attempts to resolve the module part of an import directive or path
     /// rooted at the given module.
-    fn resolve_module_path(@mut self,
-                           module_: @mut Module,
-                           module_path: &[ident],
-                           use_lexical_scope: UseLexicalScopeFlag,
-                           span: span,
-                           name_search_type: NameSearchType)
-                           -> ResolveResult<@mut Module> {
+    pub fn resolve_module_path(@mut self,
+                               module_: @mut Module,
+                               module_path: &[ident],
+                               use_lexical_scope: UseLexicalScopeFlag,
+                               span: span,
+                               name_search_type: NameSearchType)
+                               -> ResolveResult<@mut Module> {
         let module_path_len = module_path.len();
         assert!(module_path_len > 0);
 
@@ -2719,13 +2723,13 @@ fn resolve_module_path(@mut self,
 
     /// Invariant: This must only be called during main resolution, not during
     /// import resolution.
-    fn resolve_item_in_lexical_scope(@mut self,
-                                     module_: @mut Module,
-                                     name: ident,
-                                     namespace: Namespace,
-                                     search_through_modules:
-                                        SearchThroughModulesFlag)
-                                  -> ResolveResult<Target> {
+    pub fn resolve_item_in_lexical_scope(@mut self,
+                                         module_: @mut Module,
+                                         name: ident,
+                                         namespace: Namespace,
+                                         search_through_modules:
+                                         SearchThroughModulesFlag)
+                                         -> ResolveResult<Target> {
         debug!("(resolving item in lexical scope) resolving `%s` in \
                 namespace %? in `%s`",
                *self.session.str_of(name),
@@ -2846,11 +2850,11 @@ fn resolve_item_in_lexical_scope(@mut self,
         }
     }
 
-    /** Resolves a module name in the current lexical scope. */
-    fn resolve_module_in_lexical_scope(@mut self,
-                                       module_: @mut Module,
-                                       name: ident)
-                                    -> ResolveResult<@mut Module> {
+    /// Resolves a module name in the current lexical scope.
+    pub fn resolve_module_in_lexical_scope(@mut self,
+                                           module_: @mut Module,
+                                           name: ident)
+                                           -> ResolveResult<@mut Module> {
         // If this module is an anonymous module, resolve the item in the
         // lexical scope. Otherwise, resolve the item from the crate root.
         let resolve_result = self.resolve_item_in_lexical_scope(
@@ -2892,11 +2896,9 @@ fn resolve_module_in_lexical_scope(@mut self,
         }
     }
 
-    /**
-     * Returns the nearest normal module parent of the given module.
-     */
-    fn get_nearest_normal_module_parent(@mut self, module_: @mut Module)
-                                     -> Option<@mut Module> {
+    /// Returns the nearest normal module parent of the given module.
+    pub fn get_nearest_normal_module_parent(@mut self, module_: @mut Module)
+                                            -> Option<@mut Module> {
         let mut module_ = module_;
         loop {
             match module_.parent_link {
@@ -2915,13 +2917,11 @@ fn get_nearest_normal_module_parent(@mut self, module_: @mut Module)
         }
     }
 
-    /**
-     * Returns the nearest normal module parent of the given module, or the
-     * module itself if it is a normal module.
-     */
-    fn get_nearest_normal_module_parent_or_self(@mut self,
-                                                module_: @mut Module)
-                                             -> @mut Module {
+    /// Returns the nearest normal module parent of the given module, or the
+    /// module itself if it is a normal module.
+    pub fn get_nearest_normal_module_parent_or_self(@mut self,
+                                                    module_: @mut Module)
+                                                    -> @mut Module {
         match module_.kind {
             NormalModuleKind => return module_,
             ExternModuleKind |
@@ -2936,14 +2936,12 @@ fn get_nearest_normal_module_parent_or_self(@mut self,
         }
     }
 
-    /**
-     * Resolves a "module prefix". A module prefix is one of (a) `self::`;
-     * (b) some chain of `super::`.
-     */
-    fn resolve_module_prefix(@mut self,
-                             module_: @mut Module,
-                             module_path: &[ident])
-                          -> ResolveResult<ModulePrefixResult> {
+    /// Resolves a "module prefix". A module prefix is one of (a) `self::`;
+    /// (b) some chain of `super::`.
+    pub fn resolve_module_prefix(@mut self,
+                                 module_: @mut Module,
+                                 module_path: &[ident])
+                                 -> ResolveResult<ModulePrefixResult> {
         let interner = self.session.parse_sess.interner;
 
         // Start at the current module if we see `self` or `super`, or at the
@@ -2985,12 +2983,12 @@ fn resolve_module_prefix(@mut self,
     /// Attempts to resolve the supplied name in the given module for the
     /// given namespace. If successful, returns the target corresponding to
     /// the name.
-    fn resolve_name_in_module(@mut self,
-                              module_: @mut Module,
-                              name: ident,
-                              namespace: Namespace,
-                              name_search_type: NameSearchType)
-                           -> ResolveResult<Target> {
+    pub fn resolve_name_in_module(@mut self,
+                                  module_: @mut Module,
+                                  name: ident,
+                                  namespace: Namespace,
+                                  name_search_type: NameSearchType)
+                                  -> ResolveResult<Target> {
         debug!("(resolving name in module) resolving `%s` in `%s`",
                *self.session.str_of(name),
                self.module_to_str(module_));
@@ -3069,7 +3067,7 @@ fn resolve_name_in_module(@mut self,
         return Failed;
     }
 
-    fn report_unresolved_imports(@mut self, module_: @mut Module) {
+    pub fn report_unresolved_imports(@mut self, module_: @mut Module) {
         let index = module_.resolved_import_count;
         let imports: &mut ~[@ImportDirective] = &mut *module_.imports;
         let import_count = imports.len();
@@ -3110,12 +3108,13 @@ fn report_unresolved_imports(@mut self, module_: @mut Module) {
     // Then this operation can simply be performed as part of item (or import)
     // processing.
 
-    fn record_exports(@mut self) {
+    pub fn record_exports(@mut self) {
         let root_module = self.graph_root.get_module();
         self.record_exports_for_module_subtree(root_module);
     }
 
-    fn record_exports_for_module_subtree(@mut self, module_: @mut Module) {
+    pub fn record_exports_for_module_subtree(@mut self,
+                                             module_: @mut Module) {
         // If this isn't a local crate, then bail out. We don't need to record
         // exports for nonlocal crates.
 
@@ -3157,7 +3156,7 @@ fn record_exports_for_module_subtree(@mut self, module_: @mut Module) {
         }
     }
 
-    fn record_exports_for_module(@mut self, module_: @mut Module) {
+    pub fn record_exports_for_module(@mut self, module_: @mut Module) {
         let mut exports2 = ~[];
 
         self.add_exports_for_module(&mut exports2, module_);
@@ -3171,12 +3170,12 @@ fn record_exports_for_module(@mut self, module_: @mut Module) {
         }
     }
 
-    fn add_exports_of_namebindings(@mut self,
-                                   exports2: &mut ~[Export2],
-                                   ident: ident,
-                                   namebindings: @mut NameBindings,
-                                   ns: Namespace,
-                                   reexport: bool) {
+    pub fn add_exports_of_namebindings(@mut self,
+                                       exports2: &mut ~[Export2],
+                                       ident: ident,
+                                       namebindings: @mut NameBindings,
+                                       ns: Namespace,
+                                       reexport: bool) {
         match (namebindings.def_for_namespace(ns),
                namebindings.privacy_for_namespace(ns)) {
             (Some(d), Some(Public)) => {
@@ -3199,9 +3198,9 @@ fn add_exports_of_namebindings(@mut self,
         }
     }
 
-    fn add_exports_for_module(@mut self,
-                              exports2: &mut ~[Export2],
-                              module_: @mut Module) {
+    pub fn add_exports_for_module(@mut self,
+                                  exports2: &mut ~[Export2],
+                                  module_: @mut Module) {
         for module_.children.each |ident, namebindings| {
             debug!("(computing exports) maybe export '%s'",
                    *self.session.str_of(*ident));
@@ -3258,7 +3257,7 @@ fn add_exports_for_module(@mut self,
     // generate a fake "implementation scope" containing all the
     // implementations thus found, for compatibility with old resolve pass.
 
-    fn with_scope(@mut self, name: Option<ident>, f: &fn()) {
+    pub fn with_scope(@mut self, name: Option<ident>, f: &fn()) {
         let orig_module = self.current_module;
 
         // Move down in the graph.
@@ -3295,16 +3294,15 @@ fn with_scope(@mut self, name: Option<ident>, f: &fn()) {
         self.current_module = orig_module;
     }
 
-    // Wraps the given definition in the appropriate number of `def_upvar`
-    // wrappers.
-
-    fn upvarify(@mut self,
-                ribs: &mut ~[@Rib],
-                rib_index: uint,
-                def_like: def_like,
-                span: span,
-                allow_capturing_self: AllowCapturingSelfFlag)
-             -> Option<def_like> {
+    /// Wraps the given definition in the appropriate number of `def_upvar`
+    /// wrappers.
+    pub fn upvarify(@mut self,
+                    ribs: &mut ~[@Rib],
+                    rib_index: uint,
+                    def_like: def_like,
+                    span: span,
+                    allow_capturing_self: AllowCapturingSelfFlag)
+                    -> Option<def_like> {
         let mut def;
         let is_ty_param;
 
@@ -3408,12 +3406,12 @@ fn upvarify(@mut self,
         return Some(dl_def(def));
     }
 
-    fn search_ribs(@mut self,
-                   ribs: &mut ~[@Rib],
-                   name: ident,
-                   span: span,
-                   allow_capturing_self: AllowCapturingSelfFlag)
-                -> Option<def_like> {
+    pub fn search_ribs(@mut self,
+                       ribs: &mut ~[@Rib],
+                       name: ident,
+                       span: span,
+                       allow_capturing_self: AllowCapturingSelfFlag)
+                       -> Option<def_like> {
         // FIXME #4950: This should not use a while loop.
         // FIXME #4950: Try caching?
 
@@ -3434,7 +3432,7 @@ fn search_ribs(@mut self,
         return None;
     }
 
-    fn resolve_crate(@mut self) {
+    pub fn resolve_crate(@mut self) {
         debug!("(resolving crate) starting");
 
         visit_crate(self.crate, (), mk_vt(@Visitor {
@@ -3454,7 +3452,7 @@ fn resolve_crate(@mut self) {
         }));
     }
 
-    fn resolve_item(@mut self, item: @item, visitor: ResolveVisitor) {
+    pub fn resolve_item(@mut self, item: @item, visitor: ResolveVisitor) {
         debug!("(resolving item) resolving %s",
                *self.session.str_of(item.ident));
 
@@ -3652,9 +3650,9 @@ fn resolve_item(@mut self, item: @item, visitor: ResolveVisitor) {
         self.xray_context = orig_xray_flag;
     }
 
-    fn with_type_parameter_rib(@mut self,
-                               type_parameters: TypeParameters,
-                               f: &fn()) {
+    pub fn with_type_parameter_rib(@mut self,
+                                   type_parameters: TypeParameters,
+                                   f: &fn()) {
         match type_parameters {
             HasTypeParameters(generics, node_id, initial_index,
                               rib_kind) => {
@@ -3695,25 +3693,25 @@ fn with_type_parameter_rib(@mut self,
         }
     }
 
-    fn with_label_rib(@mut self, f: &fn()) {
+    pub fn with_label_rib(@mut self, f: &fn()) {
         self.label_ribs.push(@Rib(NormalRibKind));
         f();
         self.label_ribs.pop();
     }
 
-    fn with_constant_rib(@mut self, f: &fn()) {
+    pub fn with_constant_rib(@mut self, f: &fn()) {
         self.value_ribs.push(@Rib(ConstantItemRibKind));
         f();
         self.value_ribs.pop();
     }
 
-    fn resolve_function(@mut self,
-                        rib_kind: RibKind,
-                        optional_declaration: Option<&fn_decl>,
-                        type_parameters: TypeParameters,
-                        block: &blk,
-                        self_binding: SelfBinding,
-                        visitor: ResolveVisitor) {
+    pub fn resolve_function(@mut self,
+                            rib_kind: RibKind,
+                            optional_declaration: Option<&fn_decl>,
+                            type_parameters: TypeParameters,
+                            block: &blk,
+                            self_binding: SelfBinding,
+                            visitor: ResolveVisitor) {
         // Create a value rib for the function.
         let function_value_rib = @Rib(rib_kind);
         self.value_ribs.push(function_value_rib);
@@ -3782,9 +3780,9 @@ fn resolve_function(@mut self,
         self.value_ribs.pop();
     }
 
-    fn resolve_type_parameters(@mut self,
-                               type_parameters: &OptVec<TyParam>,
-                               visitor: ResolveVisitor) {
+    pub fn resolve_type_parameters(@mut self,
+                                   type_parameters: &OptVec<TyParam>,
+                                   visitor: ResolveVisitor) {
         for type_parameters.each |type_parameter| {
             for type_parameter.bounds.each |bound| {
                 self.resolve_type_parameter_bound(bound, visitor);
@@ -3792,9 +3790,9 @@ fn resolve_type_parameters(@mut self,
         }
     }
 
-    fn resolve_type_parameter_bound(@mut self,
-                                    type_parameter_bound: &TyParamBound,
-                                    visitor: ResolveVisitor) {
+    pub fn resolve_type_parameter_bound(@mut self,
+                                        type_parameter_bound: &TyParamBound,
+                                        visitor: ResolveVisitor) {
         match *type_parameter_bound {
             TraitTyParamBound(tref) => {
                 self.resolve_trait_reference(tref, visitor)
@@ -3803,9 +3801,9 @@ fn resolve_type_parameter_bound(@mut self,
         }
     }
 
-    fn resolve_trait_reference(@mut self,
-                               trait_reference: &trait_ref,
-                               visitor: ResolveVisitor) {
+    pub fn resolve_trait_reference(@mut self,
+                                   trait_reference: &trait_ref,
+                                   visitor: ResolveVisitor) {
         match self.resolve_path(trait_reference.path, TypeNS, true, visitor) {
             None => {
                 self.session.span_err(trait_reference.path.span,
@@ -3818,11 +3816,11 @@ fn resolve_trait_reference(@mut self,
         }
     }
 
-    fn resolve_struct(@mut self,
-                      id: node_id,
-                      generics: &Generics,
-                      fields: &[@struct_field],
-                      visitor: ResolveVisitor) {
+    pub fn resolve_struct(@mut self,
+                          id: node_id,
+                          generics: &Generics,
+                          fields: &[@struct_field],
+                          visitor: ResolveVisitor) {
         // If applicable, create a rib for the type parameters.
         do self.with_type_parameter_rib(HasTypeParameters
                                         (generics, id, 0,
@@ -3840,11 +3838,11 @@ fn resolve_struct(@mut self,
 
     // Does this really need to take a RibKind or is it always going
     // to be NormalRibKind?
-    fn resolve_method(@mut self,
-                      rib_kind: RibKind,
-                      method: @method,
-                      outer_type_parameter_count: uint,
-                      visitor: ResolveVisitor) {
+    pub fn resolve_method(@mut self,
+                          rib_kind: RibKind,
+                          method: @method,
+                          outer_type_parameter_count: uint,
+                          visitor: ResolveVisitor) {
         let method_generics = &method.generics;
         let type_parameters =
             HasTypeParameters(method_generics,
@@ -3865,13 +3863,13 @@ fn resolve_method(@mut self,
                               visitor);
     }
 
-    fn resolve_implementation(@mut self,
-                              id: node_id,
-                              generics: &Generics,
-                              opt_trait_reference: Option<@trait_ref>,
-                              self_type: @Ty,
-                              methods: &[@method],
-                              visitor: ResolveVisitor) {
+    pub fn resolve_implementation(@mut self,
+                                  id: node_id,
+                                  generics: &Generics,
+                                  opt_trait_reference: Option<@trait_ref>,
+                                  self_type: @Ty,
+                                  methods: &[@method],
+                                  visitor: ResolveVisitor) {
         // If applicable, create a rib for the type parameters.
         let outer_type_parameter_count = generics.ty_params.len();
         do self.with_type_parameter_rib(HasTypeParameters
@@ -3938,18 +3936,18 @@ fn resolve_implementation(@mut self,
         }
     }
 
-    fn resolve_module(@mut self,
-                      module_: &_mod,
-                      span: span,
-                      _name: ident,
-                      id: node_id,
-                      visitor: ResolveVisitor) {
+    pub fn resolve_module(@mut self,
+                          module_: &_mod,
+                          span: span,
+                          _name: ident,
+                          id: node_id,
+                          visitor: ResolveVisitor) {
         // Write the implementations in scope into the module metadata.
         debug!("(resolving module) resolving module ID %d", id);
         visit_mod(module_, span, id, (), visitor);
     }
 
-    fn resolve_local(@mut self, local: @local, visitor: ResolveVisitor) {
+    pub fn resolve_local(@mut self, local: @local, visitor: ResolveVisitor) {
         let mutability = if local.node.is_mutbl {Mutable} else {Immutable};
 
         // Resolve the type.
@@ -3970,7 +3968,7 @@ fn resolve_local(@mut self, local: @local, visitor: ResolveVisitor) {
                              None, visitor);
     }
 
-    fn binding_mode_map(@mut self, pat: @pat) -> BindingMap {
+    pub fn binding_mode_map(@mut self, pat: @pat) -> BindingMap {
         let mut result = HashMap::new();
         do pat_bindings(self.def_map, pat) |binding_mode, _id, sp, path| {
             let ident = path_to_ident(path);
@@ -3981,7 +3979,7 @@ fn binding_mode_map(@mut self, pat: @pat) -> BindingMap {
         return result;
     }
 
-    fn check_consistent_bindings(@mut self, arm: &arm) {
+    pub fn check_consistent_bindings(@mut self, arm: &arm) {
         if arm.pats.len() == 0 { return; }
         let map_0 = self.binding_mode_map(arm.pats[0]);
         for arm.pats.eachi() |i, p| {
@@ -4020,7 +4018,7 @@ fn check_consistent_bindings(@mut self, arm: &arm) {
         }
     }
 
-    fn resolve_arm(@mut self, arm: &arm, visitor: ResolveVisitor) {
+    pub fn resolve_arm(@mut self, arm: &arm, visitor: ResolveVisitor) {
         self.value_ribs.push(@Rib(NormalRibKind));
 
         let bindings_list = @mut HashMap::new();
@@ -4039,7 +4037,7 @@ fn resolve_arm(@mut self, arm: &arm, visitor: ResolveVisitor) {
         self.value_ribs.pop();
     }
 
-    fn resolve_block(@mut self, block: &blk, visitor: ResolveVisitor) {
+    pub fn resolve_block(@mut self, block: &blk, visitor: ResolveVisitor) {
         debug!("(resolving block) entering block");
         self.value_ribs.push(@Rib(NormalRibKind));
 
@@ -4064,7 +4062,7 @@ fn resolve_block(@mut self, block: &blk, visitor: ResolveVisitor) {
         debug!("(resolving block) leaving block");
     }
 
-    fn resolve_type(@mut self, ty: @Ty, visitor: ResolveVisitor) {
+    pub fn resolve_type(@mut self, ty: @Ty, visitor: ResolveVisitor) {
         match ty.node {
             // Like path expressions, the interpretation of path types depends
             // on whether the path has multiple elements in it or not.
@@ -4144,14 +4142,14 @@ fn resolve_type(@mut self, ty: @Ty, visitor: ResolveVisitor) {
         }
     }
 
-    fn resolve_pattern(@mut self,
-                       pattern: @pat,
-                       mode: PatternBindingMode,
-                       mutability: Mutability,
-                       // Maps idents to the node ID for the (outermost)
-                       // pattern that binds them
-                       bindings_list: Option<@mut HashMap<ident,node_id>>,
-                       visitor: ResolveVisitor) {
+    pub fn resolve_pattern(@mut self,
+                           pattern: @pat,
+                           mode: PatternBindingMode,
+                           mutability: Mutability,
+                           // Maps idents to the node ID for the (outermost)
+                           // pattern that binds them
+                           bindings_list: Option<@mut HashMap<ident,node_id>>,
+                           visitor: ResolveVisitor) {
         let pat_id = pattern.id;
         for walk_pat(pattern) |pattern| {
             match pattern.node {
@@ -4386,8 +4384,9 @@ struct in scope",
         }
     }
 
-    fn resolve_bare_identifier_pattern(@mut self, name: ident)
-                                    -> BareIdentifierPatternResolution {
+    pub fn resolve_bare_identifier_pattern(@mut self, name: ident)
+                                           ->
+                                           BareIdentifierPatternResolution {
         match self.resolve_item_in_lexical_scope(self.current_module,
                                                  name,
                                                  ValueNS,
@@ -4426,12 +4425,12 @@ fn resolve_bare_identifier_pattern(@mut self, name: ident)
 
     /// If `check_ribs` is true, checks the local definitions first; i.e.
     /// doesn't skip straight to the containing module.
-    fn resolve_path(@mut self,
-                    path: @Path,
-                    namespace: Namespace,
-                    check_ribs: bool,
-                    visitor: ResolveVisitor)
-                 -> Option<def> {
+    pub fn resolve_path(@mut self,
+                        path: @Path,
+                        namespace: Namespace,
+                        check_ribs: bool,
+                        visitor: ResolveVisitor)
+                        -> Option<def> {
         // First, resolve the types.
         for path.types.each |ty| {
             self.resolve_type(*ty, visitor);
@@ -4455,12 +4454,12 @@ fn resolve_path(@mut self,
                                        path.span);
     }
 
-    fn resolve_identifier(@mut self,
-                          identifier: ident,
-                          namespace: Namespace,
-                          check_ribs: bool,
-                          span: span)
-                       -> Option<def> {
+    pub fn resolve_identifier(@mut self,
+                              identifier: ident,
+                              namespace: Namespace,
+                              check_ribs: bool,
+                              span: span)
+                              -> Option<def> {
         if check_ribs {
             match self.resolve_identifier_in_local_ribs(identifier,
                                                       namespace,
@@ -4479,12 +4478,12 @@ fn resolve_identifier(@mut self,
     }
 
     // FIXME #4952: Merge me with resolve_name_in_module?
-    fn resolve_definition_of_name_in_module(@mut self,
-                                            containing_module: @mut Module,
-                                            name: ident,
-                                            namespace: Namespace,
-                                            xray: XrayFlag)
-                                         -> NameDefinition {
+    pub fn resolve_definition_of_name_in_module(@mut self,
+                                                containing_module: @mut Module,
+                                                name: ident,
+                                                namespace: Namespace,
+                                                xray: XrayFlag)
+                                                -> NameDefinition {
         // First, search children.
         match containing_module.children.find(&name) {
             Some(child_name_bindings) => {
@@ -4552,7 +4551,7 @@ fn resolve_definition_of_name_in_module(@mut self,
         return NoNameDefinition;
     }
 
-    fn intern_module_part_of_path(@mut self, path: @Path) -> ~[ident] {
+    pub fn intern_module_part_of_path(@mut self, path: @Path) -> ~[ident] {
         let mut module_path_idents = ~[];
         for path.idents.eachi |index, ident| {
             if index == path.idents.len() - 1 {
@@ -4565,11 +4564,11 @@ fn intern_module_part_of_path(@mut self, path: @Path) -> ~[ident] {
         return module_path_idents;
     }
 
-    fn resolve_module_relative_path(@mut self,
-                                    path: @Path,
-                                    xray: XrayFlag,
-                                    namespace: Namespace)
-                                 -> Option<def> {
+    pub fn resolve_module_relative_path(@mut self,
+                                        path: @Path,
+                                        xray: XrayFlag,
+                                        namespace: Namespace)
+                                        -> Option<def> {
         let module_path_idents = self.intern_module_part_of_path(path);
 
         let containing_module;
@@ -4612,11 +4611,11 @@ fn resolve_module_relative_path(@mut self,
 
     /// Invariant: This must be called only during main resolution, not during
     /// import resolution.
-    fn resolve_crate_relative_path(@mut self,
-                                   path: @Path,
-                                   xray: XrayFlag,
-                                   namespace: Namespace)
-                                -> Option<def> {
+    pub fn resolve_crate_relative_path(@mut self,
+                                       path: @Path,
+                                       xray: XrayFlag,
+                                       namespace: Namespace)
+                                       -> Option<def> {
         let module_path_idents = self.intern_module_part_of_path(path);
 
         let root_module = self.graph_root.get_module();
@@ -4659,11 +4658,11 @@ fn resolve_crate_relative_path(@mut self,
         }
     }
 
-    fn resolve_identifier_in_local_ribs(@mut self,
-                                        ident: ident,
-                                        namespace: Namespace,
-                                        span: span)
-                                        -> Option<def> {
+    pub fn resolve_identifier_in_local_ribs(@mut self,
+                                            ident: ident,
+                                            namespace: Namespace,
+                                            span: span)
+                                            -> Option<def> {
         // Check the local set of ribs.
         let search_result;
         match namespace {
@@ -4692,8 +4691,8 @@ fn resolve_identifier_in_local_ribs(@mut self,
         }
     }
 
-    fn resolve_self_value_in_local_ribs(@mut self, span: span)
-                                        -> Option<def> {
+    pub fn resolve_self_value_in_local_ribs(@mut self, span: span)
+                                            -> Option<def> {
         // FIXME #4950: This should not use a while loop.
         let ribs = &mut self.value_ribs;
         let mut i = ribs.len();
@@ -4721,10 +4720,10 @@ fn resolve_self_value_in_local_ribs(@mut self, span: span)
         None
     }
 
-    fn resolve_item_by_identifier_in_lexical_scope(@mut self,
-                                                   ident: ident,
-                                                   namespace: Namespace)
-                                                -> Option<def> {
+    pub fn resolve_item_by_identifier_in_lexical_scope(@mut self,
+                                                       ident: ident,
+                                                       namespace: Namespace)
+                                                       -> Option<def> {
         // Check the items.
         match self.resolve_item_in_lexical_scope(self.current_module,
                                                  ident,
@@ -4754,7 +4753,10 @@ fn resolve_item_by_identifier_in_lexical_scope(@mut self,
         }
     }
 
-    fn find_best_match_for_name(@mut self, name: &str, max_distance: uint) -> Option<~str> {
+    pub fn find_best_match_for_name(@mut self,
+                                    name: &str,
+                                    max_distance: uint)
+                                    -> Option<~str> {
         let this = &mut *self;
 
         let mut maybes: ~[~str] = ~[];
@@ -4792,7 +4794,7 @@ fn find_best_match_for_name(@mut self, name: &str, max_distance: uint) -> Option
         }
     }
 
-    fn name_exists_in_scope_struct(@mut self, name: &str) -> bool {
+    pub fn name_exists_in_scope_struct(@mut self, name: &str) -> bool {
         let this = &mut *self;
 
         let mut i = this.type_ribs.len();
@@ -4826,7 +4828,7 @@ fn name_exists_in_scope_struct(@mut self, name: &str) -> bool {
       return false;
     }
 
-    fn resolve_expr(@mut self, expr: @expr, visitor: ResolveVisitor) {
+    pub fn resolve_expr(@mut self, expr: @expr, visitor: ResolveVisitor) {
         // First, record candidate traits for this expression if it could
         // result in the invocation of a method call.
 
@@ -4963,7 +4965,8 @@ fn resolve_expr(@mut self, expr: @expr, visitor: ResolveVisitor) {
         }
     }
 
-    fn record_candidate_traits_for_expr_if_necessary(@mut self, expr: @expr) {
+    pub fn record_candidate_traits_for_expr_if_necessary(@mut self,
+                                                         expr: @expr) {
         match expr.node {
             expr_field(_, ident, _) => {
                 let traits = self.search_for_traits_containing_method(ident);
@@ -5040,9 +5043,8 @@ fn record_candidate_traits_for_expr_if_necessary(@mut self, expr: @expr) {
         }
     }
 
-    fn search_for_traits_containing_method(@mut self,
-                                           name: ident)
-                                        -> ~[def_id] {
+    pub fn search_for_traits_containing_method(@mut self, name: ident)
+                                               -> ~[def_id] {
         debug!("(searching for traits containing method) looking for '%s'",
                *self.session.str_of(name));
 
@@ -5142,10 +5144,10 @@ fn search_for_traits_containing_method(@mut self,
         return found_traits;
     }
 
-    fn add_trait_info(&self,
-                      found_traits: &mut ~[def_id],
-                      trait_def_id: def_id,
-                      name: ident) {
+    pub fn add_trait_info(&self,
+                          found_traits: &mut ~[def_id],
+                          trait_def_id: def_id,
+                          name: ident) {
         debug!("(adding trait info) found trait %d:%d for method '%s'",
                trait_def_id.crate,
                trait_def_id.node,
@@ -5153,21 +5155,21 @@ fn add_trait_info(&self,
         found_traits.push(trait_def_id);
     }
 
-    fn add_fixed_trait_for_expr(@mut self,
-                                expr_id: node_id,
-                                trait_id: def_id) {
+    pub fn add_fixed_trait_for_expr(@mut self,
+                                    expr_id: node_id,
+                                    trait_id: def_id) {
         self.trait_map.insert(expr_id, @mut ~[trait_id]);
     }
 
-    fn record_def(@mut self, node_id: node_id, def: def) {
+    pub fn record_def(@mut self, node_id: node_id, def: def) {
         debug!("(recording def) recording %? for %?", def, node_id);
         self.def_map.insert(node_id, def);
     }
 
-    fn enforce_default_binding_mode(@mut self,
-                                    pat: @pat,
-                                    pat_binding_mode: binding_mode,
-                                    descr: &str) {
+    pub fn enforce_default_binding_mode(@mut self,
+                                        pat: @pat,
+                                        pat_binding_mode: binding_mode,
+                                        descr: &str) {
         match pat_binding_mode {
             bind_infer => {}
             bind_by_ref(*) => {
@@ -5186,7 +5188,7 @@ fn enforce_default_binding_mode(@mut self,
     // resolve data structures.
     //
 
-    fn check_for_unused_imports(@mut self) {
+    pub fn check_for_unused_imports(@mut self) {
         let vt = mk_simple_visitor(@SimpleVisitor {
             visit_view_item: |vi| self.check_for_item_unused_imports(vi),
             .. *default_simple_visitor()
@@ -5194,7 +5196,7 @@ fn check_for_unused_imports(@mut self) {
         visit_crate(self.crate, (), vt);
     }
 
-    fn check_for_item_unused_imports(&mut self, vi: @view_item) {
+    pub fn check_for_item_unused_imports(&mut self, vi: @view_item) {
         // Ignore public import statements because there's no way to be sure
         // whether they're used or not. Also ignore imports with a dummy span
         // because this means that they were generated in some fashion by the
@@ -5238,7 +5240,7 @@ fn check_for_item_unused_imports(&mut self, vi: @view_item) {
     //
 
     /// A somewhat inefficient routine to obtain the name of a module.
-    fn module_to_str(@mut self, module_: @mut Module) -> ~str {
+    pub fn module_to_str(@mut self, module_: @mut Module) -> ~str {
         let mut idents = ~[];
         let mut current_module = module_;
         loop {
@@ -5263,7 +5265,7 @@ fn module_to_str(@mut self, module_: @mut Module) -> ~str {
         return self.idents_to_str(vec::reversed(idents));
     }
 
-    fn dump_module(@mut self, module_: @mut Module) {
+    pub fn dump_module(@mut self, module_: @mut Module) {
         debug!("Dump of module `%s`:", self.module_to_str(module_));
 
         debug!("Children:");
index 629d9ca629bf5c10d1f0101746dbec2ef4e285a2..acc3293f2678302022936479e11c32b365d818e5 100644 (file)
@@ -36,8 +36,8 @@ pub struct FnType {
     sret: bool
 }
 
-pub impl FnType {
-    fn decl_fn(&self, decl: &fn(fnty: TypeRef) -> ValueRef) -> ValueRef {
+impl FnType {
+    pub fn decl_fn(&self, decl: &fn(fnty: TypeRef) -> ValueRef) -> ValueRef {
         let atys = vec::map(self.arg_tys, |t| t.ty);
         let rty = self.ret_ty.ty;
         let fnty = T_fn(atys, rty);
@@ -57,9 +57,11 @@ fn decl_fn(&self, decl: &fn(fnty: TypeRef) -> ValueRef) -> ValueRef {
         return llfn;
     }
 
-    fn build_shim_args(&self, bcx: block,
-                       arg_tys: &[TypeRef],
-                       llargbundle: ValueRef) -> ~[ValueRef] {
+    pub fn build_shim_args(&self,
+                           bcx: block,
+                           arg_tys: &[TypeRef],
+                           llargbundle: ValueRef)
+                           -> ~[ValueRef] {
         let mut atys: &[LLVMType] = self.arg_tys;
         let mut attrs: &[option::Option<Attribute>] = self.attrs;
 
@@ -92,12 +94,12 @@ fn build_shim_args(&self, bcx: block,
         return llargvals;
     }
 
-    fn build_shim_ret(&self,
-                      bcx: block,
-                      arg_tys: &[TypeRef],
-                      ret_def: bool,
-                      llargbundle: ValueRef,
-                      llretval: ValueRef) {
+    pub fn build_shim_ret(&self,
+                          bcx: block,
+                          arg_tys: &[TypeRef],
+                          ret_def: bool,
+                          llargbundle: ValueRef,
+                          llretval: ValueRef) {
         for vec::eachi(self.attrs) |i, a| {
             match *a {
                 option::Some(attr) => {
@@ -128,11 +130,11 @@ fn build_shim_ret(&self,
         };
     }
 
-    fn build_wrap_args(&self,
-                       bcx: block,
-                       ret_ty: TypeRef,
-                       llwrapfn: ValueRef,
-                       llargbundle: ValueRef) {
+    pub fn build_wrap_args(&self,
+                           bcx: block,
+                           ret_ty: TypeRef,
+                           llwrapfn: ValueRef,
+                           llargbundle: ValueRef) {
         let mut atys: &[LLVMType] = self.arg_tys;
         let mut attrs: &[option::Option<Attribute>] = self.attrs;
         let mut j = 0u;
@@ -167,10 +169,10 @@ fn build_wrap_args(&self,
         store_inbounds(bcx, llretptr, llargbundle, [0u, n]);
     }
 
-    fn build_wrap_ret(&self,
-                      bcx: block,
-                      arg_tys: &[TypeRef],
-                      llargbundle: ValueRef) {
+    pub fn build_wrap_ret(&self,
+                          bcx: block,
+                          arg_tys: &[TypeRef],
+                          llargbundle: ValueRef) {
         unsafe {
             if llvm::LLVMGetTypeKind(self.ret_ty.ty) == Void {
                 return;
index 1a78019f289f0f9cfd688b154eea5cda8daab556..a5b44d1a43fc1068fb1b58aa18d9d5b175c62d49 100644 (file)
@@ -118,8 +118,8 @@ pub struct EnvValue {
     datum: Datum
 }
 
-pub impl EnvAction {
-    fn to_str(&self) -> ~str {
+impl EnvAction {
+    pub fn to_str(&self) -> ~str {
         match *self {
             EnvCopy => ~"EnvCopy",
             EnvMove => ~"EnvMove",
@@ -128,8 +128,8 @@ fn to_str(&self) -> ~str {
     }
 }
 
-pub impl EnvValue {
-    fn to_str(&self, ccx: @CrateContext) -> ~str {
+impl EnvValue {
+    pub fn to_str(&self, ccx: @CrateContext) -> ~str {
         fmt!("%s(%s)", self.action.to_str(), self.datum.to_str(ccx))
     }
 }
index a2fa840ad79b92180b18098d6d9e7c1a2bb1d86b..7080487e7f886799f080a7e58b8f2cac9c649a00 100644 (file)
@@ -249,8 +249,8 @@ pub struct param_substs {
     self_ty: Option<ty::t>
 }
 
-pub impl param_substs {
-    fn validate(&self) {
+impl param_substs {
+    pub fn validate(&self) {
         for self.tys.each |t| { assert!(!ty::type_needs_infer(*t)); }
         for self.self_ty.each |t| { assert!(!ty::type_needs_infer(*t)); }
     }
@@ -353,7 +353,7 @@ pub struct fn_ctxt_ {
     ccx: @@CrateContext
 }
 
-pub impl fn_ctxt_ {
+impl fn_ctxt_ {
     pub fn arg_pos(&self, arg: uint) -> uint {
         if self.has_immediate_return_value {
             arg + 1u
@@ -598,8 +598,8 @@ pub struct scope_info {
     landing_pad: Option<BasicBlockRef>,
 }
 
-pub impl scope_info {
-    fn empty_cleanups(&mut self) -> bool {
+impl scope_info {
+    pub fn empty_cleanups(&mut self) -> bool {
         self.cleanups.is_empty()
     }
 }
@@ -695,8 +695,8 @@ pub fn rslt(bcx: block, val: ValueRef) -> Result {
     Result {bcx: bcx, val: val}
 }
 
-pub impl Result {
-    fn unpack(&self, bcx: &mut block) -> ValueRef {
+impl Result {
+    pub fn unpack(&self, bcx: &mut block) -> ValueRef {
         *bcx = self.bcx;
         return self.val;
     }
@@ -742,28 +742,28 @@ pub fn block_parent(cx: block) -> block {
 
 // Accessors
 
-pub impl block_ {
-    fn ccx(@mut self) -> @CrateContext { *self.fcx.ccx }
-    fn tcx(@mut self) -> ty::ctxt { self.fcx.ccx.tcx }
-    fn sess(@mut self) -> Session { self.fcx.ccx.sess }
+impl block_ {
+    pub fn ccx(@mut self) -> @CrateContext { *self.fcx.ccx }
+    pub fn tcx(@mut self) -> ty::ctxt { self.fcx.ccx.tcx }
+    pub fn sess(@mut self) -> Session { self.fcx.ccx.sess }
 
-    fn node_id_to_str(@mut self, id: ast::node_id) -> ~str {
+    pub fn node_id_to_str(@mut self, id: ast::node_id) -> ~str {
         ast_map::node_id_to_str(self.tcx().items, id, self.sess().intr())
     }
 
-    fn expr_to_str(@mut self, e: @ast::expr) -> ~str {
+    pub fn expr_to_str(@mut self, e: @ast::expr) -> ~str {
         e.repr(self.tcx())
     }
 
-    fn expr_is_lval(@mut self, e: @ast::expr) -> bool {
+    pub fn expr_is_lval(@mut self, e: @ast::expr) -> bool {
         ty::expr_is_lval(self.tcx(), self.ccx().maps.method_map, e)
     }
 
-    fn expr_kind(@mut self, e: @ast::expr) -> ty::ExprKind {
+    pub fn expr_kind(@mut self, e: @ast::expr) -> ty::ExprKind {
         ty::expr_kind(self.tcx(), self.ccx().maps.method_map, e)
     }
 
-    fn def(@mut self, nid: ast::node_id) -> ast::def {
+    pub fn def(@mut self, nid: ast::node_id) -> ast::def {
         match self.tcx().def_map.find(&nid) {
             Some(&v) => v,
             None => {
@@ -773,18 +773,19 @@ fn def(@mut self, nid: ast::node_id) -> ast::def {
         }
     }
 
-    fn val_str(@mut self, val: ValueRef) -> @str {
+    pub fn val_str(@mut self, val: ValueRef) -> @str {
         val_str(self.ccx().tn, val)
     }
 
-    fn llty_str(@mut self, llty: TypeRef) -> @str {
+    pub fn llty_str(@mut self, llty: TypeRef) -> @str {
         ty_str(self.ccx().tn, llty)
     }
 
-    fn ty_to_str(@mut self, t: ty::t) -> ~str {
+    pub fn ty_to_str(@mut self, t: ty::t) -> ~str {
         t.repr(self.tcx())
     }
-    fn to_str(@mut self) -> ~str {
+
+    pub fn to_str(@mut self) -> ~str {
         unsafe {
             match self.node_info {
                 Some(node_info) => fmt!("[block %d]", node_info.id),
index c0403083ce1c964d40d8c5f74b0039f73d0d0351..1c94d16b1583479936bd8992bf71180e1aed1a4f 100644 (file)
@@ -145,12 +145,12 @@ pub enum DatumMode {
     ByValue,
 }
 
-pub impl DatumMode {
-    fn is_by_ref(&self) -> bool {
+impl DatumMode {
+    pub fn is_by_ref(&self) -> bool {
         match *self { ByRef(_) => true, ByValue => false }
     }
 
-    fn is_by_value(&self) -> bool {
+    pub fn is_by_value(&self) -> bool {
         match *self { ByRef(_) => false, ByValue => true }
     }
 }
@@ -205,9 +205,13 @@ pub fn appropriate_mode(ty: ty::t) -> DatumMode {
     }
 }
 
-pub impl Datum {
-    fn store_to(&self, bcx: block, id: ast::node_id,
-                action: CopyAction, dst: ValueRef) -> block {
+impl Datum {
+    pub fn store_to(&self,
+                    bcx: block,
+                    id: ast::node_id,
+                    action: CopyAction,
+                    dst: ValueRef)
+                    -> block {
         /*!
          *
          * Stores this value into its final home.  This moves if
@@ -221,8 +225,11 @@ fn store_to(&self, bcx: block, id: ast::node_id,
         }
     }
 
-    fn store_to_dest(&self, bcx: block, id: ast::node_id,
-                     dest: expr::Dest) -> block {
+    pub fn store_to_dest(&self,
+                         bcx: block,
+                         id: ast::node_id,
+                         dest: expr::Dest)
+                         -> block {
         match dest {
             expr::Ignore => {
                 return bcx;
@@ -233,28 +240,32 @@ fn store_to_dest(&self, bcx: block, id: ast::node_id,
         }
     }
 
-    fn store_to_datum(&self, bcx: block, id: ast::node_id,
-                      action: CopyAction, datum: Datum) -> block {
+    pub fn store_to_datum(&self,
+                          bcx: block,
+                          id: ast::node_id,
+                          action: CopyAction,
+                          datum: Datum)
+                          -> block {
         debug!("store_to_datum(self=%s, action=%?, datum=%s)",
                self.to_str(bcx.ccx()), action, datum.to_str(bcx.ccx()));
         assert!(datum.mode.is_by_ref());
         self.store_to(bcx, id, action, datum.val)
     }
 
-    fn move_to_datum(&self, bcx: block, action: CopyAction, datum: Datum)
-                    -> block {
+    pub fn move_to_datum(&self, bcx: block, action: CopyAction, datum: Datum)
+                         -> block {
         assert!(datum.mode.is_by_ref());
         self.move_to(bcx, action, datum.val)
     }
 
-    fn copy_to_datum(&self, bcx: block, action: CopyAction, datum: Datum)
-                    -> block {
+    pub fn copy_to_datum(&self, bcx: block, action: CopyAction, datum: Datum)
+                         -> block {
         assert!(datum.mode.is_by_ref());
         self.copy_to(bcx, action, datum.val)
     }
 
-    fn copy_to(&self, bcx: block, action: CopyAction, dst: ValueRef)
-              -> block {
+    pub fn copy_to(&self, bcx: block, action: CopyAction, dst: ValueRef)
+                   -> block {
         /*!
          *
          * Copies the value into `dst`, which should be a pointer to a
@@ -296,9 +307,11 @@ fn copy_to(&self, bcx: block, action: CopyAction, dst: ValueRef)
         }
     }
 
-    fn copy_to_no_check(&self, bcx: block, action: CopyAction,
-                        dst: ValueRef) -> block
-    {
+    pub fn copy_to_no_check(&self,
+                            bcx: block,
+                            action: CopyAction,
+                            dst: ValueRef)
+                            -> block {
         /*!
          *
          * A helper for `copy_to()` which does not check to see if we
@@ -326,8 +339,8 @@ fn copy_to_no_check(&self, bcx: block, action: CopyAction,
     // This works like copy_val, except that it deinitializes the source.
     // Since it needs to zero out the source, src also needs to be an lval.
     //
-    fn move_to(&self, bcx: block, action: CopyAction, dst: ValueRef)
-              -> block {
+    pub fn move_to(&self, bcx: block, action: CopyAction, dst: ValueRef)
+                   -> block {
         let _icx = bcx.insn_ctxt("move_to");
         let mut bcx = bcx;
 
@@ -356,7 +369,7 @@ fn move_to(&self, bcx: block, action: CopyAction, dst: ValueRef)
         return bcx;
     }
 
-    fn add_clean(&self, bcx: block) {
+    pub fn add_clean(&self, bcx: block) {
         /*!
          * Schedules this datum for cleanup in `bcx`.  The datum
          * must be an rvalue.
@@ -376,7 +389,7 @@ fn add_clean(&self, bcx: block) {
         }
     }
 
-    fn cancel_clean(&self, bcx: block) {
+    pub fn cancel_clean(&self, bcx: block) {
         if ty::type_needs_drop(bcx.tcx(), self.ty) {
             match self.mode {
                 ByValue |
@@ -394,14 +407,14 @@ fn cancel_clean(&self, bcx: block) {
         }
     }
 
-    fn to_str(&self, ccx: &CrateContext) -> ~str {
+    pub fn to_str(&self, ccx: &CrateContext) -> ~str {
         fmt!("Datum { val=%s, ty=%s, mode=%? }",
              val_str(ccx.tn, self.val),
              ty_to_str(ccx.tcx, self.ty),
              self.mode)
     }
 
-    fn to_value_datum(&self, bcx: block) -> Datum {
+    pub fn to_value_datum(&self, bcx: block) -> Datum {
         /*!
          *
          * Yields a by-ref form of this datum.  This may involve
@@ -418,7 +431,7 @@ fn to_value_datum(&self, bcx: block) -> Datum {
         }
     }
 
-    fn to_value_llval(&self, bcx: block) -> ValueRef {
+    pub fn to_value_llval(&self, bcx: block) -> ValueRef {
         /*!
          *
          * Yields the value itself. */
@@ -439,7 +452,7 @@ fn to_value_llval(&self, bcx: block) -> ValueRef {
         }
     }
 
-    fn to_ref_datum(&self, bcx: block) -> Datum {
+    pub fn to_ref_datum(&self, bcx: block) -> Datum {
         /*!
          * Yields a by-ref form of this datum.  This may involve
          * creation of a temporary stack slot.  The value returned by
@@ -456,7 +469,7 @@ fn to_ref_datum(&self, bcx: block) -> Datum {
         }
     }
 
-    fn to_ref_llval(&self, bcx: block) -> ValueRef {
+    pub fn to_ref_llval(&self, bcx: block) -> ValueRef {
         match self.mode {
             ByRef(_) => self.val,
             ByValue => {
@@ -471,7 +484,7 @@ fn to_ref_llval(&self, bcx: block) -> ValueRef {
         }
     }
 
-    fn to_zeroable_ref_llval(&self, bcx: block) -> ValueRef {
+    pub fn to_zeroable_ref_llval(&self, bcx: block) -> ValueRef {
         /*!
          * Returns a by-ref llvalue that can be zeroed in order to
          * cancel cleanup. This is a kind of hokey bridge used
@@ -496,13 +509,13 @@ fn to_zeroable_ref_llval(&self, bcx: block) -> ValueRef {
         }
     }
 
-    fn appropriate_mode(&self) -> DatumMode {
+    pub fn appropriate_mode(&self) -> DatumMode {
         /*! See the `appropriate_mode()` function */
 
         appropriate_mode(self.ty)
     }
 
-    fn to_appropriate_llval(&self, bcx: block) -> ValueRef {
+    pub fn to_appropriate_llval(&self, bcx: block) -> ValueRef {
         /*!
          *
          * Yields an llvalue with the `appropriate_mode()`. */
@@ -513,7 +526,7 @@ fn to_appropriate_llval(&self, bcx: block) -> ValueRef {
         }
     }
 
-    fn to_appropriate_datum(&self, bcx: block) -> Datum {
+    pub fn to_appropriate_datum(&self, bcx: block) -> Datum {
         /*!
          *
          * Yields a datum with the `appropriate_mode()`. */
@@ -524,10 +537,12 @@ fn to_appropriate_datum(&self, bcx: block) -> Datum {
         }
     }
 
-    fn get_element(&self, bcx: block,
-                   ty: ty::t,
-                   source: DatumCleanup,
-                   gep: &fn(ValueRef) -> ValueRef) -> Datum {
+    pub fn get_element(&self,
+                       bcx: block,
+                       ty: ty::t,
+                       source: DatumCleanup,
+                       gep: &fn(ValueRef) -> ValueRef)
+                       -> Datum {
         let base_val = self.to_ref_llval(bcx);
         Datum {
             val: gep(base_val),
@@ -536,7 +551,7 @@ fn get_element(&self, bcx: block,
         }
     }
 
-    fn drop_val(&self, bcx: block) -> block {
+    pub fn drop_val(&self, bcx: block) -> block {
         if !ty::type_needs_drop(bcx.tcx(), self.ty) {
             return bcx;
         }
@@ -547,7 +562,7 @@ fn drop_val(&self, bcx: block) -> block {
         };
     }
 
-    fn box_body(&self, bcx: block) -> Datum {
+    pub fn box_body(&self, bcx: block) -> Datum {
         /*!
          *
          * This datum must represent an @T or ~T box.  Returns a new
@@ -567,7 +582,7 @@ fn box_body(&self, bcx: block) -> Datum {
         Datum {val: body, ty: content_ty, mode: ByRef(ZeroMem)}
     }
 
-    fn to_rptr(&self, bcx: block) -> Datum {
+    pub fn to_rptr(&self, bcx: block) -> Datum {
         //! Returns a new datum of region-pointer type containing the
         //! the same ptr as this datum (after converting to by-ref
         //! using `to_ref_llval()`).
@@ -582,14 +597,18 @@ fn to_rptr(&self, bcx: block) -> Datum {
         Datum {val: llval, ty: rptr_ty, mode: ByValue}
     }
 
-    fn try_deref(&self,
-        bcx: block,            // block wherein to generate insn's
-        span: span,            // location where deref occurs
-        expr_id: ast::node_id, // id of deref expr
-        derefs: uint,          // number of times deref'd already
-        is_auto: bool)         // if true, only deref if auto-derefable
-        -> (Option<Datum>, block)
-    {
+    /// bcx: Block wherein to generate insns.
+    /// span: Location where deref occurs.
+    /// expr_id: ID of deref expr.
+    /// derefs: Number of times deref'd already.
+    /// is_auto: If true, only deref if auto-derefable.
+    pub fn try_deref(&self,
+                     bcx: block,
+                     span: span,
+                     expr_id: ast::node_id,
+                     derefs: uint,
+                     is_auto: bool)
+                     -> (Option<Datum>, block) {
         let ccx = bcx.ccx();
 
         debug!("try_deref(expr_id=%?, derefs=%?, is_auto=%b, self=%?)",
@@ -703,10 +722,9 @@ fn deref_ptr(bcx: block, lv: &Datum, ty: ty::t) -> Datum {
         }
     }
 
-    fn deref(&self, bcx: block,
-             expr: @ast::expr,  // the deref expression
-             derefs: uint)
-          -> DatumBlock {
+    /// expr: The deref expression.
+    pub fn deref(&self, bcx: block, expr: @ast::expr, derefs: uint)
+                 -> DatumBlock {
         match self.try_deref(bcx, expr.span, expr.id, derefs, false) {
             (Some(lvres), bcx) => DatumBlock { bcx: bcx, datum: lvres },
             (None, _) => {
@@ -716,11 +734,12 @@ fn deref(&self, bcx: block,
         }
     }
 
-    fn autoderef(&self, bcx: block,
-                 span: span,
-                 expr_id: ast::node_id,
-                 max: uint)
-              -> DatumBlock {
+    pub fn autoderef(&self,
+                     bcx: block,
+                     span: span,
+                     expr_id: ast::node_id,
+                     max: uint)
+                     -> DatumBlock {
         let _icx = bcx.insn_ctxt("autoderef");
 
         debug!("autoderef(expr_id=%d, max=%?, self=%?)",
@@ -748,12 +767,12 @@ fn autoderef(&self, bcx: block,
         DatumBlock { bcx: bcx, datum: datum }
     }
 
-    fn get_vec_base_and_len(&self,
-                            mut bcx: block,
-                            span: span,
-                            expr_id: ast::node_id,
-                            derefs: uint)
-                            -> (block, ValueRef, ValueRef) {
+    pub fn get_vec_base_and_len(&self,
+                                mut bcx: block,
+                                span: span,
+                                expr_id: ast::node_id,
+                                derefs: uint)
+                                -> (block, ValueRef, ValueRef) {
         //! Converts a vector into the slice pair. Performs rooting
         //! and write guards checks.
 
@@ -763,7 +782,8 @@ fn get_vec_base_and_len(&self,
         (bcx, base, len)
     }
 
-    fn get_vec_base_and_len_no_root(&self, bcx: block) -> (ValueRef, ValueRef) {
+    pub fn get_vec_base_and_len_no_root(&self, bcx: block)
+                                        -> (ValueRef, ValueRef) {
         //! Converts a vector into the slice pair. Des not root
         //! nor perform write guard checks.
 
@@ -771,64 +791,68 @@ fn get_vec_base_and_len_no_root(&self, bcx: block) -> (ValueRef, ValueRef) {
         tvec::get_base_and_len(bcx, llval, self.ty)
     }
 
-    fn root_and_write_guard(&self,
-                            bcx: block,
-                            span: span,
-                            expr_id: ast::node_id,
-                            derefs: uint) -> block {
+    pub fn root_and_write_guard(&self,
+                                bcx: block,
+                                span: span,
+                                expr_id: ast::node_id,
+                                derefs: uint)
+                                -> block {
         write_guard::root_and_write_guard(self, bcx, span, expr_id, derefs)
     }
 
-    fn to_result(&self, bcx: block) -> common::Result {
+    pub fn to_result(&self, bcx: block) -> common::Result {
         rslt(bcx, self.to_appropriate_llval(bcx))
     }
 }
 
-pub impl DatumBlock {
-    fn unpack(&self, bcx: &mut block) -> Datum {
+impl DatumBlock {
+    pub fn unpack(&self, bcx: &mut block) -> Datum {
         *bcx = self.bcx;
         return self.datum;
     }
 
-    fn assert_by_ref(&self) -> DatumBlock {
+    pub fn assert_by_ref(&self) -> DatumBlock {
         assert!(self.datum.mode.is_by_ref());
         *self
     }
 
-    fn drop_val(&self) -> block {
+    pub fn drop_val(&self) -> block {
         self.datum.drop_val(self.bcx)
     }
 
-    fn store_to(&self, id: ast::node_id, action: CopyAction,
-                dst: ValueRef) -> block {
+    pub fn store_to(&self,
+                    id: ast::node_id,
+                    action: CopyAction,
+                    dst: ValueRef)
+                    -> block {
         self.datum.store_to(self.bcx, id, action, dst)
     }
 
-    fn copy_to(&self, action: CopyAction, dst: ValueRef) -> block {
+    pub fn copy_to(&self, action: CopyAction, dst: ValueRef) -> block {
         self.datum.copy_to(self.bcx, action, dst)
     }
 
-    fn move_to(&self, action: CopyAction, dst: ValueRef) -> block {
+    pub fn move_to(&self, action: CopyAction, dst: ValueRef) -> block {
         self.datum.move_to(self.bcx, action, dst)
     }
 
-    fn to_value_llval(&self) -> ValueRef {
+    pub fn to_value_llval(&self) -> ValueRef {
         self.datum.to_value_llval(self.bcx)
     }
 
-    fn to_result(&self) -> common::Result {
+    pub fn to_result(&self) -> common::Result {
         rslt(self.bcx, self.datum.to_appropriate_llval(self.bcx))
     }
 
-    fn ccx(&self) -> @CrateContext {
+    pub fn ccx(&self) -> @CrateContext {
         self.bcx.ccx()
     }
 
-    fn tcx(&self) -> ty::ctxt {
+    pub fn tcx(&self) -> ty::ctxt {
         self.bcx.tcx()
     }
 
-    fn to_str(&self) -> ~str {
+    pub fn to_str(&self) -> ~str {
         self.datum.to_str(self.ccx())
     }
 }
index 42ba06aad764eb9e67fb0f9e2f50f60ddf5c46b2..fa8c3cd8879a2fdef0458ead2b80184ccd3d7a84 100644 (file)
@@ -170,8 +170,8 @@ pub enum Dest {
     Ignore,
 }
 
-pub impl Dest {
-    fn to_str(&self, ccx: @CrateContext) -> ~str {
+impl Dest {
+    pub fn to_str(&self, ccx: @CrateContext) -> ~str {
         match *self {
             SaveIn(v) => fmt!("SaveIn(%s)", val_str(ccx.tn, v)),
             Ignore => ~"Ignore"
index 839c9a96b78e87081687255bee71e2ee24dca571..38cc9ba69de92d969d861dbce0ed502c05d6b6ff 100644 (file)
@@ -41,16 +41,16 @@ pub struct Reflector {
     bcx: block
 }
 
-pub impl Reflector {
-    fn c_uint(&mut self, u: uint) -> ValueRef {
+impl Reflector {
+    pub fn c_uint(&mut self, u: uint) -> ValueRef {
         C_uint(self.bcx.ccx(), u)
     }
 
-    fn c_int(&mut self, i: int) -> ValueRef {
+    pub fn c_int(&mut self, i: int) -> ValueRef {
         C_int(self.bcx.ccx(), i)
     }
 
-    fn c_slice(&mut self, s: @~str) -> ValueRef {
+    pub fn c_slice(&mut self, s: @~str) -> ValueRef {
         // We're careful to not use first class aggregates here because that
         // will kick us off fast isel. (Issue #4352.)
         let bcx = self.bcx;
@@ -64,7 +64,7 @@ fn c_slice(&mut self, s: @~str) -> ValueRef {
         scratch.val
     }
 
-    fn c_size_and_align(&mut self, t: ty::t) -> ~[ValueRef] {
+    pub fn c_size_and_align(&mut self, t: ty::t) -> ~[ValueRef] {
         let tr = type_of(self.bcx.ccx(), t);
         let s = machine::llsize_of_real(self.bcx.ccx(), tr);
         let a = machine::llalign_of_min(self.bcx.ccx(), tr);
@@ -72,19 +72,19 @@ fn c_size_and_align(&mut self, t: ty::t) -> ~[ValueRef] {
              self.c_uint(a)];
     }
 
-    fn c_tydesc(&mut self, t: ty::t) -> ValueRef {
+    pub fn c_tydesc(&mut self, t: ty::t) -> ValueRef {
         let bcx = self.bcx;
         let static_ti = get_tydesc(bcx.ccx(), t);
         glue::lazily_emit_all_tydesc_glue(bcx.ccx(), static_ti);
         PointerCast(bcx, static_ti.tydesc, T_ptr(self.tydesc_ty))
     }
 
-    fn c_mt(&mut self, mt: &ty::mt) -> ~[ValueRef] {
+    pub fn c_mt(&mut self, mt: &ty::mt) -> ~[ValueRef] {
         ~[self.c_uint(mt.mutbl as uint),
           self.c_tydesc(mt.ty)]
     }
 
-    fn visit(&mut self, ty_name: ~str, args: &[ValueRef]) {
+    pub fn visit(&mut self, ty_name: ~str, args: &[ValueRef]) {
         let tcx = self.bcx.tcx();
         let mth_idx = ty::method_idx(
             tcx.sess.ident_of(~"visit_" + ty_name),
@@ -119,19 +119,19 @@ fn visit(&mut self, ty_name: ~str, args: &[ValueRef]) {
         self.bcx = next_bcx
     }
 
-    fn bracketed(&mut self,
-                 bracket_name: ~str,
-                 extra: &[ValueRef],
-                 inner: &fn(&mut Reflector)) {
+    pub fn bracketed(&mut self,
+                     bracket_name: ~str,
+                     extra: &[ValueRef],
+                     inner: &fn(&mut Reflector)) {
         self.visit(~"enter_" + bracket_name, extra);
         inner(self);
         self.visit(~"leave_" + bracket_name, extra);
     }
 
-    fn vstore_name_and_extra(&mut self,
-                             t: ty::t,
-                             vstore: ty::vstore) -> (~str, ~[ValueRef])
-    {
+    pub fn vstore_name_and_extra(&mut self,
+                                 t: ty::t,
+                                 vstore: ty::vstore)
+                                 -> (~str, ~[ValueRef]) {
         match vstore {
             ty::vstore_fixed(n) => {
                 let extra = vec::append(~[self.c_uint(n)],
@@ -144,12 +144,12 @@ fn vstore_name_and_extra(&mut self,
         }
     }
 
-    fn leaf(&mut self, name: ~str) {
+    pub fn leaf(&mut self, name: ~str) {
         self.visit(name, []);
     }
 
     // Entrypoint
-    fn visit_ty(&mut self, t: ty::t) {
+    pub fn visit_ty(&mut self, t: ty::t) {
         let bcx = self.bcx;
         debug!("reflect::visit_ty %s",
                ty_to_str(bcx.ccx().tcx, t));
@@ -351,7 +351,7 @@ fn visit_ty(&mut self, t: ty::t) {
         }
     }
 
-    fn visit_sig(&mut self, retval: uint, sig: &ty::FnSig) {
+    pub fn visit_sig(&mut self, retval: uint, sig: &ty::FnSig) {
         for sig.inputs.eachi |i, arg| {
             let modeval = 5u;   // "by copy"
             let extra = ~[self.c_uint(i),
index 278a73558926c2adf2ef97174b8fdb81ef65ae04..e3c0c3a04d896a54b0066a3c6fe57045f5e256c0 100644 (file)
@@ -149,8 +149,8 @@ pub struct VecTypes {
     llunit_size: ValueRef
 }
 
-pub impl VecTypes {
-    fn to_str(&self, ccx: @CrateContext) -> ~str {
+impl VecTypes {
+    pub fn to_str(&self, ccx: @CrateContext) -> ~str {
         fmt!("VecTypes {vec_ty=%s, unit_ty=%s, llunit_ty=%s, llunit_size=%s}",
              ty_to_str(ccx.tcx, self.vec_ty),
              ty_to_str(ccx.tcx, self.unit_ty),
index 0d180223fefc877bc70a17533b87b0f18616a82e..f02f117bd364b9a1ec5d72de6633b8fe769acdad 100644 (file)
@@ -68,14 +68,15 @@ pub struct Method {
     def_id: ast::def_id
 }
 
-pub impl Method {
-    fn new(ident: ast::ident,
-           generics: ty::Generics,
-           transformed_self_ty: Option<ty::t>,
-           fty: BareFnTy,
-           explicit_self: ast::explicit_self_,
-           vis: ast::visibility,
-           def_id: ast::def_id) -> Method {
+impl Method {
+    pub fn new(ident: ast::ident,
+               generics: ty::Generics,
+               transformed_self_ty: Option<ty::t>,
+               fty: BareFnTy,
+               explicit_self: ast::explicit_self_,
+               vis: ast::visibility,
+               def_id: ast::def_id)
+               -> Method {
         // Check the invariants.
         if explicit_self == ast::sty_static {
             assert!(transformed_self_ty.is_none());
@@ -460,8 +461,8 @@ pub enum Region {
     re_empty,
 }
 
-pub impl Region {
-    fn is_bound(&self) -> bool {
+impl Region {
+    pub fn is_bound(&self) -> bool {
         match self {
             &re_bound(*) => true,
             _ => false
@@ -879,8 +880,8 @@ pub struct Generics {
     region_param: Option<region_variance>,
 }
 
-pub impl Generics {
-    fn has_type_params(&self) -> bool {
+impl Generics {
+    pub fn has_type_params(&self) -> bool {
         !self.type_param_defs.is_empty()
     }
 }
@@ -1817,12 +1818,12 @@ pub struct TypeContents {
     bits: u32
 }
 
-pub impl TypeContents {
-    fn meets_bounds(&self, cx: ctxt, bbs: BuiltinBounds) -> bool {
+impl TypeContents {
+    pub fn meets_bounds(&self, cx: ctxt, bbs: BuiltinBounds) -> bool {
         iter::all(|bb| self.meets_bound(cx, bb), |f| bbs.each(f))
     }
 
-    fn meets_bound(&self, cx: ctxt, bb: BuiltinBound) -> bool {
+    pub fn meets_bound(&self, cx: ctxt, bb: BuiltinBound) -> bool {
         match bb {
             BoundCopy => self.is_copy(cx),
             BoundStatic => self.is_static(cx),
@@ -1832,69 +1833,69 @@ fn meets_bound(&self, cx: ctxt, bb: BuiltinBound) -> bool {
         }
     }
 
-    fn intersects(&self, tc: TypeContents) -> bool {
+    pub fn intersects(&self, tc: TypeContents) -> bool {
         (self.bits & tc.bits) != 0
     }
 
-    fn is_copy(&self, cx: ctxt) -> bool {
+    pub fn is_copy(&self, cx: ctxt) -> bool {
         !self.intersects(TypeContents::noncopyable(cx))
     }
 
-    fn noncopyable(_cx: ctxt) -> TypeContents {
+    pub fn noncopyable(_cx: ctxt) -> TypeContents {
         TC_DTOR + TC_BORROWED_MUT + TC_ONCE_CLOSURE + TC_OWNED_CLOSURE +
             TC_EMPTY_ENUM
     }
 
-    fn is_static(&self, cx: ctxt) -> bool {
+    pub fn is_static(&self, cx: ctxt) -> bool {
         !self.intersects(TypeContents::nonstatic(cx))
     }
 
-    fn nonstatic(_cx: ctxt) -> TypeContents {
+    pub fn nonstatic(_cx: ctxt) -> TypeContents {
         TC_BORROWED_POINTER
     }
 
-    fn is_owned(&self, cx: ctxt) -> bool {
+    pub fn is_owned(&self, cx: ctxt) -> bool {
         !self.intersects(TypeContents::nonowned(cx))
     }
 
-    fn nonowned(_cx: ctxt) -> TypeContents {
+    pub fn nonowned(_cx: ctxt) -> TypeContents {
         TC_MANAGED + TC_BORROWED_POINTER + TC_NON_OWNED
     }
 
-    fn contains_managed(&self) -> bool {
+    pub fn contains_managed(&self) -> bool {
         self.intersects(TC_MANAGED)
     }
 
-    fn is_const(&self, cx: ctxt) -> bool {
+    pub fn is_const(&self, cx: ctxt) -> bool {
         !self.intersects(TypeContents::nonconst(cx))
     }
 
-    fn nonconst(_cx: ctxt) -> TypeContents {
+    pub fn nonconst(_cx: ctxt) -> TypeContents {
         TC_MUTABLE
     }
 
-    fn is_sized(&self, cx: ctxt) -> bool {
+    pub fn is_sized(&self, cx: ctxt) -> bool {
         !self.intersects(TypeContents::dynamically_sized(cx))
     }
 
-    fn dynamically_sized(_cx: ctxt) -> TypeContents {
+    pub fn dynamically_sized(_cx: ctxt) -> TypeContents {
         TC_DYNAMIC_SIZE
     }
 
-    fn moves_by_default(&self, cx: ctxt) -> bool {
+    pub fn moves_by_default(&self, cx: ctxt) -> bool {
         self.intersects(TypeContents::nonimplicitly_copyable(cx))
     }
 
-    fn nonimplicitly_copyable(cx: ctxt) -> TypeContents {
+    pub fn nonimplicitly_copyable(cx: ctxt) -> TypeContents {
         TypeContents::noncopyable(cx) + TC_OWNED_POINTER + TC_OWNED_VEC
     }
 
-    fn needs_drop(&self, cx: ctxt) -> bool {
+    pub fn needs_drop(&self, cx: ctxt) -> bool {
         let tc = TC_MANAGED + TC_DTOR + TypeContents::owned(cx);
         self.intersects(tc)
     }
 
-    fn owned(_cx: ctxt) -> TypeContents {
+    pub fn owned(_cx: ctxt) -> TypeContents {
         //! Any kind of owned contents.
         TC_OWNED_CLOSURE + TC_OWNED_POINTER + TC_OWNED_VEC
     }
@@ -3120,8 +3121,8 @@ fn borrow_fn(cx: ctxt, span: span, r: Region, ty: ty::t) -> ty::t {
     }
 }
 
-pub impl AutoRef {
-    fn map_region(&self, f: &fn(Region) -> Region) -> AutoRef {
+impl AutoRef {
+    pub fn map_region(&self, f: &fn(Region) -> Region) -> AutoRef {
         match *self {
             ty::AutoPtr(r, m) => ty::AutoPtr(f(r), m),
             ty::AutoBorrowVec(r, m) => ty::AutoBorrowVec(f(r), m),
@@ -3809,14 +3810,15 @@ pub enum DtorKind {
     TraitDtor(def_id)
 }
 
-pub impl DtorKind {
-    fn is_not_present(&const self) -> bool {
+impl DtorKind {
+    pub fn is_not_present(&const self) -> bool {
         match *self {
             NoDtor => true,
             _ => false
         }
     }
-    fn is_present(&const self) -> bool {
+
+    pub fn is_present(&const self) -> bool {
         !self.is_not_present()
     }
 }
index 1b7368b3dbfbe8c8327979d85a0e89210a29eacf..9b8393a7464bf17c72b93a043589bac1935e38b0 100644 (file)
@@ -179,8 +179,8 @@ pub struct Candidate {
     origin: method_origin,
 }
 
-pub impl<'self> LookupContext<'self> {
-    fn do_lookup(&self, self_ty: ty::t) -> Option<method_map_entry> {
+impl<'self> LookupContext<'self> {
+    pub fn do_lookup(&self, self_ty: ty::t) -> Option<method_map_entry> {
         let self_ty = structurally_resolved_type(self.fcx,
                                                      self.self_expr.span,
                                                      self_ty);
@@ -248,8 +248,8 @@ fn do_lookup(&self, self_ty: ty::t) -> Option<method_map_entry> {
         self.search_for_autosliced_method(self_ty, autoderefs)
     }
 
-    fn deref(&self, ty: ty::t, enum_dids: &mut ~[ast::def_id])
-            -> Option<ty::t> {
+    pub fn deref(&self, ty: ty::t, enum_dids: &mut ~[ast::def_id])
+                 -> Option<ty::t> {
         match ty::get(ty).sty {
             ty_enum(did, _) => {
                 // Watch out for newtype'd enums like "enum t = @T".
@@ -275,7 +275,7 @@ fn deref(&self, ty: ty::t, enum_dids: &mut ~[ast::def_id])
     // ______________________________________________________________________
     // Candidate collection (see comment at start of file)
 
-    fn push_inherent_candidates(&self, self_ty: ty::t) {
+    pub fn push_inherent_candidates(&self, self_ty: ty::t) {
         /*!
          * Collect all inherent candidates into
          * `self.inherent_candidates`.  See comment at the start of
@@ -326,7 +326,7 @@ fn push_inherent_candidates(&self, self_ty: ty::t) {
         }
     }
 
-    fn push_extension_candidates(&self, self_ty: ty::t) {
+    pub fn push_extension_candidates(&self, self_ty: ty::t) {
         // If the method being called is associated with a trait, then
         // find all the impls of that trait.  Each of those are
         // candidates.
@@ -359,9 +359,9 @@ fn push_extension_candidates(&self, self_ty: ty::t) {
         }
     }
 
-    fn push_inherent_candidates_from_param(&self,
-                                           rcvr_ty: ty::t,
-                                           param_ty: param_ty) {
+    pub fn push_inherent_candidates_from_param(&self,
+                                               rcvr_ty: ty::t,
+                                               param_ty: param_ty) {
         debug!("push_inherent_candidates_from_param(param_ty=%?)",
                param_ty);
         let _indenter = indenter();
@@ -417,11 +417,11 @@ fn push_inherent_candidates_from_param(&self,
         }
     }
 
-    fn push_inherent_candidates_from_trait(&self,
-                                           self_ty: ty::t,
-                                           did: def_id,
-                                           substs: &ty::substs,
-                                           store: ty::TraitStore) {
+    pub fn push_inherent_candidates_from_trait(&self,
+                                               self_ty: ty::t,
+                                               did: def_id,
+                                               substs: &ty::substs,
+                                               store: ty::TraitStore) {
         debug!("push_inherent_candidates_from_trait(did=%s, substs=%s)",
                self.did_to_str(did),
                substs_to_str(self.tcx(), substs));
@@ -469,10 +469,10 @@ fn push_inherent_candidates_from_trait(&self,
         });
     }
 
-    fn push_inherent_candidates_from_self(&self,
-                                          self_ty: ty::t,
-                                          did: def_id,
-                                          substs: &ty::substs) {
+    pub fn push_inherent_candidates_from_self(&self,
+                                              self_ty: ty::t,
+                                              did: def_id,
+                                              substs: &ty::substs) {
         struct MethodInfo {
             method_ty: @ty::Method,
             trait_def_id: ast::def_id,
@@ -533,7 +533,7 @@ struct MethodInfo {
         }
     }
 
-    fn push_inherent_impl_candidates_for_type(&self, did: def_id) {
+    pub fn push_inherent_impl_candidates_for_type(&self, did: def_id) {
         let opt_impl_infos =
             self.fcx.ccx.coherence_info.inherent_methods.find(&did);
         for opt_impl_infos.each |impl_infos| {
@@ -544,8 +544,9 @@ fn push_inherent_impl_candidates_for_type(&self, did: def_id) {
         }
     }
 
-    fn push_candidates_from_impl(&self, candidates: &mut ~[Candidate],
-                                 impl_info: &resolve::Impl) {
+    pub fn push_candidates_from_impl(&self,
+                                     candidates: &mut ~[Candidate],
+                                     impl_info: &resolve::Impl) {
         if !self.impl_dups.insert(impl_info.did) {
             return; // already visited
         }
@@ -579,12 +580,14 @@ fn push_candidates_from_impl(&self, candidates: &mut ~[Candidate],
         });
     }
 
-    fn push_candidates_from_provided_methods(
-            &self,
-            candidates: &mut ~[Candidate],
-            self_ty: ty::t,
-            trait_def_id: def_id,
-            methods: &mut ~[@ProvidedMethodInfo]) {
+    pub fn push_candidates_from_provided_methods(&self,
+                                                 candidates:
+                                                 &mut ~[Candidate],
+                                                 self_ty: ty::t,
+                                                 trait_def_id: def_id,
+                                                 methods:
+                                                 &mut ~[@ProvidedMethodInfo])
+                                                 {
         debug!("(pushing candidates from provided methods) considering trait \
                 id %d:%d",
                trait_def_id.crate,
@@ -618,12 +621,10 @@ fn push_candidates_from_provided_methods(
     // ______________________________________________________________________
     // Candidate selection (see comment at start of file)
 
-    fn search_for_autoderefd_method(
-        &self,
-        self_ty: ty::t,
-        autoderefs: uint)
-        -> Option<method_map_entry>
-    {
+    pub fn search_for_autoderefd_method(&self,
+                                        self_ty: ty::t,
+                                        autoderefs: uint)
+                                        -> Option<method_map_entry> {
         let (self_ty, autoadjust) =
             self.consider_reborrow(self_ty, autoderefs);
         match self.search_for_method(self_ty) {
@@ -639,10 +640,10 @@ fn search_for_autoderefd_method(
         }
     }
 
-    fn consider_reborrow(&self,
-                         self_ty: ty::t,
-                         autoderefs: uint) -> (ty::t, ty::AutoAdjustment)
-    {
+    pub fn consider_reborrow(&self,
+                             self_ty: ty::t,
+                             autoderefs: uint)
+                             -> (ty::t, ty::AutoAdjustment) {
         /*!
          *
          * In the event that we are invoking a method with a receiver
@@ -702,12 +703,10 @@ fn default_method_hack(self_mt: ty::mt) -> bool {
         }
     }
 
-    fn search_for_autosliced_method(
-        &self,
-        self_ty: ty::t,
-        autoderefs: uint)
-        -> Option<method_map_entry>
-    {
+    pub fn search_for_autosliced_method(&self,
+                                        self_ty: ty::t,
+                                        autoderefs: uint)
+                                        -> Option<method_map_entry> {
         /*!
          *
          * Searches for a candidate by converting things like
@@ -770,12 +769,8 @@ fn search_for_autosliced_method(
         }
     }
 
-    fn search_for_autoptrd_method(
-        &self,
-        self_ty: ty::t,
-        autoderefs: uint)
-        -> Option<method_map_entry>
-    {
+    pub fn search_for_autoptrd_method(&self, self_ty: ty::t, autoderefs: uint)
+                                      -> Option<method_map_entry> {
         /*!
          *
          * Converts any type `T` to `&M T` where `M` is an
@@ -806,14 +801,13 @@ fn search_for_autoptrd_method(
         }
     }
 
-    fn search_for_some_kind_of_autorefd_method(
+    pub fn search_for_some_kind_of_autorefd_method(
         &self,
         kind: &fn(Region, ast::mutability) -> ty::AutoRef,
         autoderefs: uint,
         mutbls: &[ast::mutability],
         mk_autoref_ty: &fn(ast::mutability, ty::Region) -> ty::t)
-        -> Option<method_map_entry>
-    {
+        -> Option<method_map_entry> {
         // This is hokey. We should have mutability inference as a
         // variable.  But for now, try &const, then &, then &mut:
         let region = self.infcx().next_region_var_nb(self.expr.span);
@@ -834,10 +828,8 @@ fn search_for_some_kind_of_autorefd_method(
         return None;
     }
 
-    fn search_for_method(&self,
-                         rcvr_ty: ty::t)
-        -> Option<method_map_entry>
-    {
+    pub fn search_for_method(&self, rcvr_ty: ty::t)
+                             -> Option<method_map_entry> {
         debug!("search_for_method(rcvr_ty=%s)", self.ty_to_str(rcvr_ty));
         let _indenter = indenter();
 
@@ -864,11 +856,10 @@ fn search_for_method(&self,
         }
     }
 
-    fn consider_candidates(&self,
-                           rcvr_ty: ty::t,
-                           candidates: &mut ~[Candidate])
-        -> Option<method_map_entry>
-    {
+    pub fn consider_candidates(&self,
+                               rcvr_ty: ty::t,
+                               candidates: &mut ~[Candidate])
+                               -> Option<method_map_entry> {
         let relevant_candidates =
             candidates.filter_to_vec(|c| self.is_relevant(rcvr_ty, c));
 
@@ -890,7 +881,7 @@ fn consider_candidates(&self,
         Some(self.confirm_candidate(rcvr_ty, &relevant_candidates[0]))
     }
 
-    fn merge_candidates(&self, candidates: &[Candidate]) -> ~[Candidate] {
+    pub fn merge_candidates(&self, candidates: &[Candidate]) -> ~[Candidate] {
         let mut merged = ~[];
         let mut i = 0;
         while i < candidates.len() {
@@ -936,11 +927,8 @@ fn merge_candidates(&self, candidates: &[Candidate]) -> ~[Candidate] {
         return merged;
     }
 
-    fn confirm_candidate(&self,
-                         rcvr_ty: ty::t,
-                         candidate: &Candidate)
-        -> method_map_entry
-    {
+    pub fn confirm_candidate(&self, rcvr_ty: ty::t, candidate: &Candidate)
+                             -> method_map_entry {
         let tcx = self.tcx();
         let fty = self.fn_ty_from_origin(&candidate.origin);
 
@@ -1065,10 +1053,9 @@ fn confirm_candidate(&self,
         }
     }
 
-    fn enforce_trait_instance_limitations(&self,
-                                          method_fty: ty::t,
-                                          candidate: &Candidate)
-    {
+    pub fn enforce_trait_instance_limitations(&self,
+                                              method_fty: ty::t,
+                                              candidate: &Candidate) {
         /*!
          *
          * There are some limitations to calling functions through a
@@ -1099,7 +1086,7 @@ fn enforce_trait_instance_limitations(&self,
         }
     }
 
-    fn enforce_drop_trait_limitations(&self, candidate: &Candidate) {
+    pub fn enforce_drop_trait_limitations(&self, candidate: &Candidate) {
         // No code can call the finalize method explicitly.
         let bad;
         match candidate.origin {
@@ -1121,7 +1108,7 @@ fn enforce_drop_trait_limitations(&self, candidate: &Candidate) {
 
     // `rcvr_ty` is the type of the expression. It may be a subtype of a
     // candidate method's `self_ty`.
-    fn is_relevant(&self, rcvr_ty: ty::t, candidate: &Candidate) -> bool {
+    pub fn is_relevant(&self, rcvr_ty: ty::t, candidate: &Candidate) -> bool {
         debug!("is_relevant(rcvr_ty=%s, candidate=%s)",
                self.ty_to_str(rcvr_ty), self.cand_to_str(candidate));
 
@@ -1208,7 +1195,7 @@ fn mutability_matches(self_mutbl: ast::mutability,
         }
     }
 
-    fn fn_ty_from_origin(&self, origin: &method_origin) -> ty::t {
+    pub fn fn_ty_from_origin(&self, origin: &method_origin) -> ty::t {
         return match *origin {
             method_static(did) => {
                 ty::lookup_item_type(self.tcx(), did).ty
@@ -1230,7 +1217,7 @@ fn type_of_trait_method(tcx: ty::ctxt,
         }
     }
 
-    fn report_candidate(&self, idx: uint, origin: &method_origin) {
+    pub fn report_candidate(&self, idx: uint, origin: &method_origin) {
         match *origin {
             method_static(impl_did) => {
                 self.report_static_candidate(idx, impl_did)
@@ -1245,7 +1232,7 @@ fn report_candidate(&self, idx: uint, origin: &method_origin) {
         }
     }
 
-    fn report_static_candidate(&self, idx: uint, did: def_id) {
+    pub fn report_static_candidate(&self, idx: uint, did: def_id) {
         let span = if did.crate == ast::local_crate {
             match self.tcx().items.find(&did.node) {
               Some(&ast_map::node_method(m, _, _)) => m.span,
@@ -1261,7 +1248,7 @@ fn report_static_candidate(&self, idx: uint, did: def_id) {
                  ty::item_path_str(self.tcx(), did)));
     }
 
-    fn report_param_candidate(&self, idx: uint, did: def_id) {
+    pub fn report_param_candidate(&self, idx: uint, did: def_id) {
         self.tcx().sess.span_note(
             self.expr.span,
             fmt!("candidate #%u derives from the bound `%s`",
@@ -1269,7 +1256,7 @@ fn report_param_candidate(&self, idx: uint, did: def_id) {
                  ty::item_path_str(self.tcx(), did)));
     }
 
-    fn report_trait_candidate(&self, idx: uint, did: def_id) {
+    pub fn report_trait_candidate(&self, idx: uint, did: def_id) {
         self.tcx().sess.span_note(
             self.expr.span,
             fmt!("candidate #%u derives from the type of the receiver, \
@@ -1278,30 +1265,30 @@ fn report_trait_candidate(&self, idx: uint, did: def_id) {
                  ty::item_path_str(self.tcx(), did)));
     }
 
-    fn infcx(&self) -> @mut infer::InferCtxt {
+    pub fn infcx(&self) -> @mut infer::InferCtxt {
         self.fcx.inh.infcx
     }
 
-    fn tcx(&self) -> ty::ctxt {
+    pub fn tcx(&self) -> ty::ctxt {
         self.fcx.tcx()
     }
 
-    fn ty_to_str(&self, t: ty::t) -> ~str {
+    pub fn ty_to_str(&self, t: ty::t) -> ~str {
         self.fcx.infcx().ty_to_str(t)
     }
 
-    fn cand_to_str(&self, cand: &Candidate) -> ~str {
+    pub fn cand_to_str(&self, cand: &Candidate) -> ~str {
         fmt!("Candidate(rcvr_ty=%s, rcvr_substs=%s, origin=%?)",
              self.ty_to_str(cand.rcvr_ty),
              ty::substs_to_str(self.tcx(), &cand.rcvr_substs),
              cand.origin)
     }
 
-    fn did_to_str(&self, did: def_id) -> ~str {
+    pub fn did_to_str(&self, did: def_id) -> ~str {
         ty::item_path_str(self.tcx(), did)
     }
 
-    fn bug(&self, s: ~str) -> ! {
+    pub fn bug(&self, s: ~str) -> ! {
         self.tcx().sess.bug(s)
     }
 }
index f8481d4cf904d0e8b195052c93f93183dbbafc5d..ac39e6141653ba9231b9232a3a3d04c679106691 100644 (file)
@@ -186,7 +186,7 @@ pub struct PurityState {
     priv from_fn: bool
 }
 
-pub impl PurityState {
+impl PurityState {
     pub fn function(purity: ast::purity, def: ast::node_id) -> PurityState {
         PurityState { def: def, purity: purity, from_fn: true }
     }
@@ -658,18 +658,17 @@ fn ty_infer(&self, _span: span) -> ty::t {
     }
 }
 
-pub impl FnCtxt {
-    fn infcx(&self) -> @mut infer::InferCtxt {
+impl FnCtxt {
+    pub fn infcx(&self) -> @mut infer::InferCtxt {
         self.inh.infcx
     }
-    fn err_count_since_creation(&self) -> uint {
+    pub fn err_count_since_creation(&self) -> uint {
         self.ccx.tcx.sess.err_count() - self.err_count_on_creation
     }
-    fn search_in_scope_regions(
-        &self,
-        span: span,
-        br: ty::bound_region) -> Result<ty::Region, RegionError>
-    {
+    pub fn search_in_scope_regions(&self,
+                                   span: span,
+                                   br: ty::bound_region)
+                                   -> Result<ty::Region, RegionError> {
         let in_scope_regions = self.in_scope_regions;
         match in_scope_regions.find(br) {
             Some(r) => result::Ok(r),
@@ -703,14 +702,14 @@ fn named_region(&self,
     }
 }
 
-pub impl FnCtxt {
-    fn tag(&self) -> ~str {
+impl FnCtxt {
+    pub fn tag(&self) -> ~str {
         unsafe {
             fmt!("%x", transmute(self))
         }
     }
 
-    fn local_ty(&self, span: span, nid: ast::node_id) -> ty::t {
+    pub fn local_ty(&self, span: span, nid: ast::node_id) -> ty::t {
         match self.inh.locals.find(&nid) {
             Some(&t) => t,
             None => {
@@ -721,23 +720,23 @@ fn local_ty(&self, span: span, nid: ast::node_id) -> ty::t {
         }
     }
 
-    fn expr_to_str(&self, expr: @ast::expr) -> ~str {
+    pub fn expr_to_str(&self, expr: @ast::expr) -> ~str {
         fmt!("expr(%?:%s)", expr.id,
              pprust::expr_to_str(expr, self.tcx().sess.intr()))
     }
 
-    fn block_region(&self) -> ty::Region {
+    pub fn block_region(&self) -> ty::Region {
         ty::re_scope(self.region_lb)
     }
 
     #[inline(always)]
-    fn write_ty(&self, node_id: ast::node_id, ty: ty::t) {
+    pub fn write_ty(&self, node_id: ast::node_id, ty: ty::t) {
         debug!("write_ty(%d, %s) in fcx %s",
                node_id, ppaux::ty_to_str(self.tcx(), ty), self.tag());
         self.inh.node_types.insert(node_id, ty);
     }
 
-    fn write_substs(&self, node_id: ast::node_id, substs: ty::substs) {
+    pub fn write_substs(&self, node_id: ast::node_id, substs: ty::substs) {
         if !ty::substs_is_noop(&substs) {
             debug!("write_substs(%d, %s) in fcx %s",
                    node_id,
@@ -747,18 +746,18 @@ fn write_substs(&self, node_id: ast::node_id, substs: ty::substs) {
         }
     }
 
-    fn write_ty_substs(&self,
-                       node_id: ast::node_id,
-                       ty: ty::t,
-                       substs: ty::substs) {
+    pub fn write_ty_substs(&self,
+                           node_id: ast::node_id,
+                           ty: ty::t,
+                           substs: ty::substs) {
         let ty = ty::subst(self.tcx(), &substs, ty);
         self.write_ty(node_id, ty);
         self.write_substs(node_id, substs);
     }
 
-    fn write_autoderef_adjustment(&self,
-                                  node_id: ast::node_id,
-                                  derefs: uint) {
+    pub fn write_autoderef_adjustment(&self,
+                                      node_id: ast::node_id,
+                                      derefs: uint) {
         if derefs == 0 { return; }
         self.write_adjustment(
             node_id,
@@ -768,36 +767,36 @@ fn write_autoderef_adjustment(&self,
         );
     }
 
-    fn write_adjustment(&self,
-                        node_id: ast::node_id,
-                        adj: @ty::AutoAdjustment) {
+    pub fn write_adjustment(&self,
+                            node_id: ast::node_id,
+                            adj: @ty::AutoAdjustment) {
         debug!("write_adjustment(node_id=%?, adj=%?)", node_id, adj);
         self.inh.adjustments.insert(node_id, adj);
     }
 
-    fn write_nil(&self, node_id: ast::node_id) {
+    pub fn write_nil(&self, node_id: ast::node_id) {
         self.write_ty(node_id, ty::mk_nil());
     }
-    fn write_bot(&self, node_id: ast::node_id) {
+    pub fn write_bot(&self, node_id: ast::node_id) {
         self.write_ty(node_id, ty::mk_bot());
     }
-    fn write_error(@mut self, node_id: ast::node_id) {
+    pub fn write_error(@mut self, node_id: ast::node_id) {
         self.write_ty(node_id, ty::mk_err());
     }
 
-    fn to_ty(&self, ast_t: @ast::Ty) -> ty::t {
+    pub fn to_ty(&self, ast_t: @ast::Ty) -> ty::t {
         ast_ty_to_ty(self, self, ast_t)
     }
 
-    fn expr_to_str(&self, expr: @ast::expr) -> ~str {
+    pub fn expr_to_str(&self, expr: @ast::expr) -> ~str {
         expr.repr(self.tcx())
     }
 
-    fn pat_to_str(&self, pat: @ast::pat) -> ~str {
+    pub fn pat_to_str(&self, pat: @ast::pat) -> ~str {
         pat.repr(self.tcx())
     }
 
-    fn expr_ty(&self, ex: @ast::expr) -> ty::t {
+    pub fn expr_ty(&self, ex: @ast::expr) -> ty::t {
         match self.inh.node_types.find(&ex.id) {
             Some(&t) => t,
             None => {
@@ -807,7 +806,8 @@ fn expr_ty(&self, ex: @ast::expr) -> ty::t {
             }
         }
     }
-    fn node_ty(&self, id: ast::node_id) -> ty::t {
+
+    pub fn node_ty(&self, id: ast::node_id) -> ty::t {
         match self.inh.node_types.find(&id) {
             Some(&t) => t,
             None => {
@@ -820,7 +820,8 @@ fn node_ty(&self, id: ast::node_id) -> ty::t {
             }
         }
     }
-    fn node_ty_substs(&self, id: ast::node_id) -> ty::substs {
+
+    pub fn node_ty_substs(&self, id: ast::node_id) -> ty::substs {
         match self.inh.node_type_substs.find(&id) {
             Some(ts) => (/*bad*/copy *ts),
             None => {
@@ -834,32 +835,32 @@ fn node_ty_substs(&self, id: ast::node_id) -> ty::substs {
         }
     }
 
-    fn opt_node_ty_substs(&self, id: ast::node_id,
-                          f: &fn(&ty::substs) -> bool) -> bool {
+    pub fn opt_node_ty_substs(&self,
+                              id: ast::node_id,
+                              f: &fn(&ty::substs) -> bool)
+                              -> bool {
         match self.inh.node_type_substs.find(&id) {
             Some(s) => f(s),
             None => true
         }
     }
 
-    fn mk_subty(&self,
-                a_is_expected: bool,
-                span: span,
-                sub: ty::t,
-                sup: ty::t)
-             -> Result<(), ty::type_err> {
+    pub fn mk_subty(&self,
+                    a_is_expected: bool,
+                    span: span,
+                    sub: ty::t,
+                    sup: ty::t)
+                    -> Result<(), ty::type_err> {
         infer::mk_subty(self.infcx(), a_is_expected, span, sub, sup)
     }
 
-    fn can_mk_subty(&self,
-                    sub: ty::t,
-                    sup: ty::t)
-                 -> Result<(), ty::type_err> {
+    pub fn can_mk_subty(&self, sub: ty::t, sup: ty::t)
+                        -> Result<(), ty::type_err> {
         infer::can_mk_subty(self.infcx(), sub, sup)
     }
 
-    fn mk_assignty(&self, expr: @ast::expr, sub: ty::t, sup: ty::t)
-                -> Result<(), ty::type_err> {
+    pub fn mk_assignty(&self, expr: @ast::expr, sub: ty::t, sup: ty::t)
+                       -> Result<(), ty::type_err> {
         match infer::mk_coercety(self.infcx(), false, expr.span, sub, sup) {
             Ok(None) => result::Ok(()),
             Err(ref e) => result::Err((*e)),
@@ -870,32 +871,31 @@ fn mk_assignty(&self, expr: @ast::expr, sub: ty::t, sup: ty::t)
         }
     }
 
-    fn can_mk_assignty(&self,
-                       sub: ty::t,
-                       sup: ty::t)
-                    -> Result<(), ty::type_err> {
+    pub fn can_mk_assignty(&self, sub: ty::t, sup: ty::t)
+                           -> Result<(), ty::type_err> {
         infer::can_mk_coercety(self.infcx(), sub, sup)
     }
 
-    fn mk_eqty(&self,
-               a_is_expected: bool,
-               span: span,
-               sub: ty::t,
-               sup: ty::t)
-            -> Result<(), ty::type_err> {
+    pub fn mk_eqty(&self,
+                   a_is_expected: bool,
+                   span: span,
+                   sub: ty::t,
+                   sup: ty::t)
+                   -> Result<(), ty::type_err> {
         infer::mk_eqty(self.infcx(), a_is_expected, span, sub, sup)
     }
 
-    fn mk_subr(&self,
-               a_is_expected: bool,
-               span: span,
-               sub: ty::Region,
-               sup: ty::Region)
-            -> Result<(), ty::type_err> {
+    pub fn mk_subr(&self,
+                   a_is_expected: bool,
+                   span: span,
+                   sub: ty::Region,
+                   sup: ty::Region)
+                   -> Result<(), ty::type_err> {
         infer::mk_subr(self.infcx(), a_is_expected, span, sub, sup)
     }
 
-    fn with_region_lb<R>(@mut self, lb: ast::node_id, f: &fn() -> R) -> R {
+    pub fn with_region_lb<R>(@mut self, lb: ast::node_id, f: &fn() -> R)
+                             -> R {
         let old_region_lb = self.region_lb;
         self.region_lb = lb;
         let v = f();
@@ -903,26 +903,26 @@ fn with_region_lb<R>(@mut self, lb: ast::node_id, f: &fn() -> R) -> R {
         v
     }
 
-    fn region_var_if_parameterized(&self,
-                                   rp: Option<ty::region_variance>,
-                                   span: span)
-                                -> Option<ty::Region> {
+    pub fn region_var_if_parameterized(&self,
+                                       rp: Option<ty::region_variance>,
+                                       span: span)
+                                       -> Option<ty::Region> {
         rp.map(|_rp| self.infcx().next_region_var_nb(span))
     }
 
-    fn type_error_message(&self,
-                          sp: span,
-                          mk_msg: &fn(~str) -> ~str,
-                          actual_ty: ty::t,
-                          err: Option<&ty::type_err>) {
+    pub fn type_error_message(&self,
+                              sp: span,
+                              mk_msg: &fn(~str) -> ~str,
+                              actual_ty: ty::t,
+                              err: Option<&ty::type_err>) {
         self.infcx().type_error_message(sp, mk_msg, actual_ty, err);
     }
 
-    fn report_mismatched_return_types(&self,
-                                      sp: span,
-                                      e: ty::t,
-                                      a: ty::t,
-                                      err: &ty::type_err) {
+    pub fn report_mismatched_return_types(&self,
+                                          sp: span,
+                                          e: ty::t,
+                                          a: ty::t,
+                                          err: &ty::type_err) {
         // Derived error
         if ty::type_is_error(e) || ty::type_is_error(a) {
             return;
@@ -943,11 +943,11 @@ fn report_mismatched_return_types(&self,
         }
     }
 
-    fn report_mismatched_types(&self,
-                               sp: span,
-                               e: ty::t,
-                               a: ty::t,
-                               err: &ty::type_err) {
+    pub fn report_mismatched_types(&self,
+                                   sp: span,
+                                   e: ty::t,
+                                   a: ty::t,
+                                   err: &ty::type_err) {
         self.infcx().report_mismatched_types(sp, e, a, err)
     }
 }
index 13b9c59e2d9cc597014f9743983a9571b459f70d..4c088cd9cbdc4d485b7842e670d2c5f45e6ceb08 100644 (file)
@@ -74,12 +74,12 @@ fn encl_region_of_def(fcx: @mut FnCtxt, def: ast::def) -> ty::Region {
     }
 }
 
-pub impl Rcx {
-    fn tcx(&self) -> ty::ctxt {
+impl Rcx {
+    pub fn tcx(&self) -> ty::ctxt {
         self.fcx.ccx.tcx
     }
 
-    fn resolve_type(&mut self, unresolved_ty: ty::t) -> ty::t {
+    pub fn resolve_type(&mut self, unresolved_ty: ty::t) -> ty::t {
         /*!
          * Try to resolve the type for the given node, returning
          * t_err if an error results.  Note that we never care
@@ -116,12 +116,12 @@ fn resolve_type(&mut self, unresolved_ty: ty::t) -> ty::t {
     }
 
     /// Try to resolve the type for the given node.
-    fn resolve_node_type(@mut self, id: ast::node_id) -> ty::t {
+    pub fn resolve_node_type(@mut self, id: ast::node_id) -> ty::t {
         self.resolve_type(self.fcx.node_ty(id))
     }
 
     /// Try to resolve the type for the given node.
-    fn resolve_expr_type_adjusted(@mut self, expr: @ast::expr) -> ty::t {
+    pub fn resolve_expr_type_adjusted(@mut self, expr: @ast::expr) -> ty::t {
         let ty_unadjusted = self.resolve_node_type(expr.id);
         if ty::type_is_error(ty_unadjusted) || ty::type_is_bot(ty_unadjusted) {
             ty_unadjusted
index 37497e9a2bb2d1b33282509737246dd8542ce3f0..9333d2e7b9d8d13636810e6d69a0a0744708d6d1 100644 (file)
@@ -65,8 +65,8 @@ pub struct VtableContext {
     infcx: @mut infer::InferCtxt
 }
 
-pub impl VtableContext {
-    fn tcx(&const self) -> ty::ctxt { self.ccx.tcx }
+impl VtableContext {
+    pub fn tcx(&const self) -> ty::ctxt { self.ccx.tcx }
 }
 
 fn has_trait_bounds(type_param_defs: &[ty::TypeParameterDef]) -> bool {
index 3cb028b811e22d9262adfa5c0362da6cb6c95bb3..00454d658489bec5301e3a95920090b8c011b565 100644 (file)
@@ -199,8 +199,8 @@ pub struct CoherenceChecker {
     base_type_def_ids: @mut HashMap<def_id,def_id>,
 }
 
-pub impl CoherenceChecker {
-    fn check_coherence(self, crate: @crate) {
+impl CoherenceChecker {
+    pub fn check_coherence(self, crate: @crate) {
         // Check implementations and traits. This populates the tables
         // containing the inherent methods and extension methods. It also
         // builds up the trait inheritance table.
@@ -239,8 +239,9 @@ fn check_coherence(self, crate: @crate) {
         self.populate_destructor_table();
     }
 
-    fn check_implementation(&self,
-                            item: @item, associated_traits: ~[@trait_ref]) {
+    pub fn check_implementation(&self,
+                                item: @item,
+                                associated_traits: ~[@trait_ref]) {
         let tcx = self.crate_context.tcx;
         let self_type = ty::lookup_item_type(tcx, local_def(item.id));
 
@@ -325,9 +326,9 @@ fn check_implementation(&self,
     // Creates default method IDs and performs type substitutions for an impl
     // and trait pair. Then, for each provided method in the trait, inserts a
     // `ProvidedMethodInfo` instance into the `provided_method_sources` map.
-    fn instantiate_default_methods(&self,
-                                   impl_id: ast::node_id,
-                                   trait_ref: &ty::TraitRef) {
+    pub fn instantiate_default_methods(&self,
+                                       impl_id: ast::node_id,
+                                       trait_ref: &ty::TraitRef) {
         let tcx = self.crate_context.tcx;
         debug!("instantiate_default_methods(impl_id=%?, trait_ref=%s)",
                impl_id, trait_ref.repr(tcx));
@@ -416,8 +417,9 @@ fn instantiate_default_methods(&self,
         }
     }
 
-    fn add_inherent_method(&self,
-                           base_def_id: def_id, implementation: @Impl) {
+    pub fn add_inherent_method(&self,
+                               base_def_id: def_id,
+                               implementation: @Impl) {
         let implementation_list;
         match self.crate_context.coherence_info.inherent_methods
                   .find(&base_def_id) {
@@ -434,7 +436,7 @@ fn add_inherent_method(&self,
         implementation_list.push(implementation);
     }
 
-    fn add_trait_method(&self, trait_id: def_id, implementation: @Impl) {
+    pub fn add_trait_method(&self, trait_id: def_id, implementation: @Impl) {
         let implementation_list;
         match self.crate_context.coherence_info.extension_methods
                   .find(&trait_id) {
@@ -451,15 +453,14 @@ fn add_trait_method(&self, trait_id: def_id, implementation: @Impl) {
         implementation_list.push(implementation);
     }
 
-    fn check_implementation_coherence(&self) {
+    pub fn check_implementation_coherence(&self) {
         let coherence_info = self.crate_context.coherence_info;
         for coherence_info.extension_methods.each_key |&trait_id| {
             self.check_implementation_coherence_of(trait_id);
         }
     }
 
-    fn check_implementation_coherence_of(&self, trait_def_id: def_id) {
-
+    pub fn check_implementation_coherence_of(&self, trait_def_id: def_id) {
         // Unify pairs of polytypes.
         do self.iter_impls_of_trait(trait_def_id) |a| {
             let implementation_a = a;
@@ -492,8 +493,10 @@ fn check_implementation_coherence_of(&self, trait_def_id: def_id) {
 
     // Adds an impl of trait trait_t for self type self_t; that impl
     // is the_impl
-    fn add_impl_for_trait(&self,
-                          trait_t: def_id, self_t: t, the_impl: @Impl) {
+    pub fn add_impl_for_trait(&self,
+                              trait_t: def_id,
+                              self_t: t,
+                              the_impl: @Impl) {
         debug!("Adding impl %? of %? for %s",
                the_impl.did, trait_t,
                ty_to_str(self.crate_context.tcx, self_t));
@@ -509,7 +512,7 @@ fn add_impl_for_trait(&self,
         }
     }
 
-    fn iter_impls_of_trait(&self, trait_def_id: def_id, f: &fn(@Impl)) {
+    pub fn iter_impls_of_trait(&self, trait_def_id: def_id, f: &fn(@Impl)) {
         let coherence_info = self.crate_context.coherence_info;
         let extension_methods = &*coherence_info.extension_methods;
 
@@ -527,9 +530,10 @@ fn iter_impls_of_trait(&self, trait_def_id: def_id, f: &fn(@Impl)) {
         }
     }
 
-    fn each_provided_trait_method(&self,
-            trait_did: ast::def_id,
-            f: &fn(x: @ty::Method) -> bool) -> bool {
+    pub fn each_provided_trait_method(&self,
+                                      trait_did: ast::def_id,
+                                      f: &fn(x: @ty::Method) -> bool)
+                                      -> bool {
         // Make a list of all the names of the provided methods.
         // XXX: This is horrible.
         let mut provided_method_idents = HashSet::new();
@@ -548,9 +552,10 @@ fn each_provided_trait_method(&self,
         return true;
     }
 
-    fn polytypes_unify(&self, polytype_a: ty_param_bounds_and_ty,
-                       polytype_b: ty_param_bounds_and_ty)
-                    -> bool {
+    pub fn polytypes_unify(&self,
+                           polytype_a: ty_param_bounds_and_ty,
+                           polytype_b: ty_param_bounds_and_ty)
+                           -> bool {
         let universally_quantified_a =
             self.universally_quantify_polytype(polytype_a);
         let universally_quantified_b =
@@ -564,8 +569,9 @@ fn polytypes_unify(&self, polytype_a: ty_param_bounds_and_ty,
 
     // Converts a polytype to a monotype by replacing all parameters with
     // type variables. Returns the monotype and the type variables created.
-    fn universally_quantify_polytype(&self, polytype: ty_param_bounds_and_ty)
-                                  -> UniversalQuantificationResult {
+    pub fn universally_quantify_polytype(&self,
+                                         polytype: ty_param_bounds_and_ty)
+                                         -> UniversalQuantificationResult {
         // NDM--this span is bogus.
         let self_region =
             polytype.generics.region_param.map(
@@ -594,11 +600,12 @@ fn universally_quantify_polytype(&self, polytype: ty_param_bounds_and_ty)
         }
     }
 
-    fn can_unify_universally_quantified<'a>
-            (&self,
-             a: &'a UniversalQuantificationResult,
-             b: &'a UniversalQuantificationResult)
-          -> bool {
+    pub fn can_unify_universally_quantified<'a>(&self,
+                                                a: &'a
+                                                UniversalQuantificationResult,
+                                                b: &'a
+                                                UniversalQuantificationResult)
+                                                -> bool {
         let mut might_unify = true;
         let _ = do self.inference_context.probe {
             let result = self.inference_context.sub(true, dummy_sp())
@@ -642,13 +649,13 @@ fn can_unify_universally_quantified<'a>
         might_unify
     }
 
-    fn get_self_type_for_implementation(&self, implementation: @Impl)
-                                     -> ty_param_bounds_and_ty {
+    pub fn get_self_type_for_implementation(&self, implementation: @Impl)
+                                            -> ty_param_bounds_and_ty {
         return self.crate_context.tcx.tcache.get_copy(&implementation.did);
     }
 
     // Privileged scope checking
-    fn check_privileged_scopes(self, crate: @crate) {
+    pub fn check_privileged_scopes(self, crate: @crate) {
         visit_crate(crate, (), mk_vt(@Visitor {
             visit_item: |item, _context, visitor| {
                 match item.node {
@@ -698,7 +705,7 @@ fn check_privileged_scopes(self, crate: @crate) {
         }));
     }
 
-    fn trait_ref_to_trait_def_id(&self, trait_ref: @trait_ref) -> def_id {
+    pub fn trait_ref_to_trait_def_id(&self, trait_ref: @trait_ref) -> def_id {
         let def_map = self.crate_context.tcx.def_map;
         let trait_def = def_map.get_copy(&trait_ref.ref_id);
         let trait_id = def_id_of_def(trait_def);
@@ -707,10 +714,13 @@ fn trait_ref_to_trait_def_id(&self, trait_ref: @trait_ref) -> def_id {
 
     // This check doesn't really have anything to do with coherence. It's
     // here for historical reasons
-    fn please_check_that_trait_methods_are_implemented(&self,
-        all_methods: &mut ~[@MethodInfo],
-        trait_did: def_id,
-        trait_ref_span: span) {
+    pub fn please_check_that_trait_methods_are_implemented(&self,
+                                                           all_methods:
+                                                           &mut
+                                                           ~[@MethodInfo],
+                                                           trait_did: def_id,
+                                                           trait_ref_span:
+                                                           span) {
 
         let tcx = self.crate_context.tcx;
 
@@ -774,7 +784,7 @@ pub fn ast_type_is_defined_in_local_crate(&self, original_type: @ast::Ty)
     }
 
     // Converts an implementation in the AST to an Impl structure.
-    fn create_impl_from_item(&self, item: @item) -> @Impl {
+    pub fn create_impl_from_item(&self, item: @item) -> @Impl {
         fn add_provided_methods(all_methods: &mut ~[@MethodInfo],
                             all_provided_methods: &mut ~[@ProvidedMethodInfo],
                             sess: driver::session::Session) {
@@ -844,7 +854,7 @@ fn add_provided_methods(all_methods: &mut ~[@MethodInfo],
         }
     }
 
-    fn span_of_impl(&self, implementation: @Impl) -> span {
+    pub fn span_of_impl(&self, implementation: @Impl) -> span {
         assert_eq!(implementation.did.crate, local_crate);
         match self.crate_context.tcx.items.find(&implementation.did.node) {
             Some(&node_item(item, _)) => {
@@ -859,9 +869,10 @@ fn span_of_impl(&self, implementation: @Impl) -> span {
 
     // External crate handling
 
-    fn add_impls_for_module(&self, impls_seen: &mut HashSet<def_id>,
-                            crate_store: @mut CStore,
-                            module_def_id: def_id) {
+    pub fn add_impls_for_module(&self,
+                                impls_seen: &mut HashSet<def_id>,
+                                crate_store: @mut CStore,
+                                module_def_id: def_id) {
         let implementations = get_impls_for_mod(crate_store,
                                                 module_def_id,
                                                 None);
@@ -934,8 +945,8 @@ fn add_impls_for_module(&self, impls_seen: &mut HashSet<def_id>,
         }
     }
 
-    fn add_default_methods_for_external_trait(&self,
-                                              trait_def_id: ast::def_id) {
+    pub fn add_default_methods_for_external_trait(&self,
+                                                  trait_def_id: ast::def_id) {
         let tcx = self.crate_context.tcx;
         let pmm = tcx.provided_methods;
 
@@ -968,7 +979,7 @@ fn add_default_methods_for_external_trait(&self,
 
     // Adds implementations and traits from external crates to the coherence
     // info.
-    fn add_external_crates(&self) {
+    pub fn add_external_crates(&self) {
         let mut impls_seen = HashSet::new();
 
         let crate_store = self.crate_context.tcx.sess.cstore;
@@ -1001,7 +1012,7 @@ fn add_external_crates(&self) {
     // Destructors
     //
 
-    fn populate_destructor_table(&self) {
+    pub fn populate_destructor_table(&self) {
         let coherence_info = self.crate_context.coherence_info;
         let tcx = self.crate_context.tcx;
         let drop_trait = tcx.lang_items.drop_trait();
@@ -1050,13 +1061,12 @@ fn populate_destructor_table(&self) {
     }
 }
 
-fn subst_receiver_types_in_method_ty(
-    tcx: ty::ctxt,
-    impl_id: ast::node_id,
-    trait_ref: &ty::TraitRef,
-    new_def_id: ast::def_id,
-    method: &ty::Method) -> ty::Method
-{
+fn subst_receiver_types_in_method_ty(tcx: ty::ctxt,
+                                     impl_id: ast::node_id,
+                                     trait_ref: &ty::TraitRef,
+                                     new_def_id: ast::def_id,
+                                     method: &ty::Method)
+                                     -> ty::Method {
     /*!
      * Substitutes the values for the receiver's type parameters
      * that are found in method, leaving the method's type parameters
index 64f0d439223b7ae0be06506bc18a87b0d7072aa9..47f49ade336d1227b1a0597ee978b13860b9cff2 100644 (file)
@@ -86,8 +86,8 @@ fn foo<A>(a: A, b: A) { ... }
 // function.
 pub struct Coerce(CombineFields);
 
-pub impl Coerce {
-    fn tys(&self, a: ty::t, b: ty::t) -> CoerceResult {
+impl Coerce {
+    pub fn tys(&self, a: ty::t, b: ty::t) -> CoerceResult {
         debug!("Coerce.tys(%s => %s)",
                a.inf_str(self.infcx),
                b.inf_str(self.infcx));
@@ -149,17 +149,17 @@ fn tys(&self, a: ty::t, b: ty::t) -> CoerceResult {
         }
     }
 
-    fn subtype(&self, a: ty::t, b: ty::t) -> CoerceResult {
+    pub fn subtype(&self, a: ty::t, b: ty::t) -> CoerceResult {
         match Sub(**self).tys(a, b) {
             Ok(_) => Ok(None),         // No coercion required.
             Err(ref e) => Err(*e)
         }
     }
 
-    fn unpack_actual_value(&self,
-                           a: ty::t,
-                           f: &fn(&ty::sty) -> CoerceResult) -> CoerceResult
-    {
+    pub fn unpack_actual_value(&self,
+                               a: ty::t,
+                               f: &fn(&ty::sty) -> CoerceResult)
+                               -> CoerceResult {
         match resolve_type(self.infcx, a, try_resolve_tvar_shallow) {
             Ok(t) => {
                 f(&ty::get(t).sty)
@@ -173,12 +173,12 @@ fn unpack_actual_value(&self,
         }
     }
 
-    fn coerce_borrowed_pointer(&self,
-                               a: ty::t,
-                               sty_a: &ty::sty,
-                               b: ty::t,
-                               mt_b: ty::mt) -> CoerceResult
-    {
+    pub fn coerce_borrowed_pointer(&self,
+                                   a: ty::t,
+                                   sty_a: &ty::sty,
+                                   b: ty::t,
+                                   mt_b: ty::mt)
+                                   -> CoerceResult {
         debug!("coerce_borrowed_pointer(a=%s, sty_a=%?, b=%s, mt_b=%?)",
                a.inf_str(self.infcx), sty_a,
                b.inf_str(self.infcx), mt_b);
@@ -211,11 +211,11 @@ fn coerce_borrowed_pointer(&self,
         })))
     }
 
-    fn coerce_borrowed_string(&self,
-                              a: ty::t,
-                              sty_a: &ty::sty,
-                              b: ty::t) -> CoerceResult
-    {
+    pub fn coerce_borrowed_string(&self,
+                                  a: ty::t,
+                                  sty_a: &ty::sty,
+                                  b: ty::t)
+                                  -> CoerceResult {
         debug!("coerce_borrowed_string(a=%s, sty_a=%?, b=%s)",
                a.inf_str(self.infcx), sty_a,
                b.inf_str(self.infcx));
@@ -237,12 +237,12 @@ fn coerce_borrowed_string(&self,
         })))
     }
 
-    fn coerce_borrowed_vector(&self,
-                              a: ty::t,
-                              sty_a: &ty::sty,
-                              b: ty::t,
-                              mt_b: ty::mt) -> CoerceResult
-    {
+    pub fn coerce_borrowed_vector(&self,
+                                  a: ty::t,
+                                  sty_a: &ty::sty,
+                                  b: ty::t,
+                                  mt_b: ty::mt)
+                                  -> CoerceResult {
         debug!("coerce_borrowed_vector(a=%s, sty_a=%?, b=%s)",
                a.inf_str(self.infcx), sty_a,
                b.inf_str(self.infcx));
@@ -266,11 +266,11 @@ fn coerce_borrowed_vector(&self,
         })))
     }
 
-    fn coerce_borrowed_fn(&self,
-                          a: ty::t,
-                          sty_a: &ty::sty,
-                          b: ty::t) -> CoerceResult
-    {
+    pub fn coerce_borrowed_fn(&self,
+                              a: ty::t,
+                              sty_a: &ty::sty,
+                              b: ty::t)
+                              -> CoerceResult {
         debug!("coerce_borrowed_fn(a=%s, sty_a=%?, b=%s)",
                a.inf_str(self.infcx), sty_a,
                b.inf_str(self.infcx));
@@ -302,22 +302,22 @@ fn coerce_borrowed_fn(&self,
         })))
     }
 
-    fn coerce_from_bare_fn(&self,
-                           a: ty::t,
-                           fn_ty_a: &ty::BareFnTy,
-                           b: ty::t) -> CoerceResult
-    {
+    pub fn coerce_from_bare_fn(&self,
+                               a: ty::t,
+                               fn_ty_a: &ty::BareFnTy,
+                               b: ty::t)
+                               -> CoerceResult {
         do self.unpack_actual_value(b) |sty_b| {
             self.coerce_from_bare_fn_post_unpack(a, fn_ty_a, b, sty_b)
         }
     }
 
-    fn coerce_from_bare_fn_post_unpack(&self,
-                                       a: ty::t,
-                                       fn_ty_a: &ty::BareFnTy,
-                                       b: ty::t,
-                                       sty_b: &ty::sty) -> CoerceResult
-    {
+    pub fn coerce_from_bare_fn_post_unpack(&self,
+                                           a: ty::t,
+                                           fn_ty_a: &ty::BareFnTy,
+                                           b: ty::t,
+                                           sty_b: &ty::sty)
+                                           -> CoerceResult {
         /*!
          *
          * Attempts to coerce from a bare Rust function (`extern
@@ -346,12 +346,12 @@ fn coerce_from_bare_fn_post_unpack(&self,
         Ok(Some(adj))
     }
 
-    fn coerce_unsafe_ptr(&self,
-                         a: ty::t,
-                         sty_a: &ty::sty,
-                         b: ty::t,
-                         mt_b: ty::mt) -> CoerceResult
-    {
+    pub fn coerce_unsafe_ptr(&self,
+                             a: ty::t,
+                             sty_a: &ty::sty,
+                             b: ty::t,
+                             mt_b: ty::mt)
+                             -> CoerceResult {
         debug!("coerce_unsafe_ptr(a=%s, sty_a=%?, b=%s)",
                a.inf_str(self.infcx), sty_a,
                b.inf_str(self.infcx));
index 3640748b20b54822c83baaa53066a66b844f60fd..cf3c64e5cd633aa2e564c68f0cd75194616de4d4 100644 (file)
@@ -71,13 +71,15 @@ fn glb(cf: &CombineFields, a: &ty::t, b: &ty::t) -> cres<ty::t> {
     }
 }
 
-pub impl CombineFields {
-    fn var_sub_var<T:Copy + InferStr + LatticeValue,
-                   V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
-        &self,
-        a_id: V,
-        b_id: V) -> ures
-    {
+impl CombineFields {
+    pub fn var_sub_var<T:Copy + InferStr + LatticeValue,
+                       V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(&self,
+                                                                        a_id:
+                                                                        V,
+                                                                        b_id:
+                                                                        V)
+                                                                        ->
+                                                                        ures {
         /*!
          *
          * Make one variable a subtype of another variable.  This is a
@@ -125,12 +127,12 @@ fn var_sub_var<T:Copy + InferStr + LatticeValue,
     }
 
     /// make variable a subtype of T
-    fn var_sub_t<T:Copy + InferStr + LatticeValue,
-                 V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
-        &self,
-        a_id: V,
-        b: T) -> ures
-    {
+    pub fn var_sub_t<T:Copy + InferStr + LatticeValue,
+                     V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(&self,
+                                                                      a_id: V,
+                                                                      b: T)
+                                                                      -> ures
+                                                                      {
         /*!
          *
          * Make a variable (`a_id`) a subtype of the concrete type `b` */
@@ -149,12 +151,12 @@ fn var_sub_t<T:Copy + InferStr + LatticeValue,
             a_id, a_bounds, b_bounds, node_a.rank)
     }
 
-    fn t_sub_var<T:Copy + InferStr + LatticeValue,
-                 V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
-        &self,
-        a: T,
-        b_id: V) -> ures
-    {
+    pub fn t_sub_var<T:Copy + InferStr + LatticeValue,
+                     V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(&self,
+                                                                      a: T,
+                                                                      b_id: V)
+                                                                      -> ures
+                                                                      {
         /*!
          *
          * Make a concrete type (`a`) a subtype of the variable `b_id` */
@@ -173,13 +175,12 @@ fn t_sub_var<T:Copy + InferStr + LatticeValue,
             b_id, a_bounds, b_bounds, node_b.rank)
     }
 
-    fn merge_bnd<T:Copy + InferStr + LatticeValue>(
-        &self,
-        a: &Bound<T>,
-        b: &Bound<T>,
-        lattice_op: LatticeOp<T>)
-        -> cres<Bound<T>>
-    {
+    pub fn merge_bnd<T:Copy + InferStr + LatticeValue>(&self,
+                                                       a: &Bound<T>,
+                                                       b: &Bound<T>,
+                                                       lattice_op:
+                                                       LatticeOp<T>)
+                                                       -> cres<Bound<T>> {
         /*!
          *
          * Combines two bounds into a more general bound. */
@@ -201,14 +202,14 @@ fn merge_bnd<T:Copy + InferStr + LatticeValue>(
         }
     }
 
-    fn set_var_to_merged_bounds<T:Copy + InferStr + LatticeValue,
-                                V:Copy+Eq+ToStr+Vid+UnifyVid<Bounds<T>>>(
-        &self,
-        v_id: V,
-        a: &Bounds<T>,
-        b: &Bounds<T>,
-        rank: uint) -> ures
-    {
+    pub fn set_var_to_merged_bounds<T:Copy + InferStr + LatticeValue,
+                                    V:Copy+Eq+ToStr+Vid+UnifyVid<Bounds<T>>>(
+                                    &self,
+                                    v_id: V,
+                                    a: &Bounds<T>,
+                                    b: &Bounds<T>,
+                                    rank: uint)
+                                    -> ures {
         /*!
          *
          * Updates the bounds for the variable `v_id` to be the intersection
@@ -263,11 +264,10 @@ fn set_var_to_merged_bounds<T:Copy + InferStr + LatticeValue,
         uok()
     }
 
-    fn bnds<T:Copy + InferStr + LatticeValue>(
-        &self,
-        a: &Bound<T>,
-        b: &Bound<T>) -> ures
-    {
+    pub fn bnds<T:Copy + InferStr + LatticeValue>(&self,
+                                                  a: &Bound<T>,
+                                                  b: &Bound<T>)
+                                                  -> ures {
         debug!("bnds(%s <: %s)", a.inf_str(self.infcx),
                b.inf_str(self.infcx));
         let _r = indenter();
index f5eb0bc26351ae5bc6c6800d7393d6c67352e5dd..1a73d5bd36bbb7df5a4a3a80da38017dfa60df90 100644 (file)
 
 pub struct Lub(CombineFields);  // least-upper-bound: common supertype
 
-pub impl Lub {
-    fn bot_ty(&self, b: ty::t) -> cres<ty::t> { Ok(b) }
-    fn ty_bot(&self, b: ty::t)
-             -> cres<ty::t> { self.bot_ty(b) } // commutative
+impl Lub {
+    pub fn bot_ty(&self, b: ty::t) -> cres<ty::t> { Ok(b) }
+    pub fn ty_bot(&self, b: ty::t) -> cres<ty::t> {
+        self.bot_ty(b) // commutative
+    }
 }
 
 impl Combine for Lub {
index 6a1fd05baf74531fcd319a99eb0da65a09dca9a4..00e5415e0414aa9ba0f696ed5de3868531c90a6d 100644 (file)
@@ -535,24 +535,23 @@ struct Snapshot {
     region_vars_snapshot: uint,
 }
 
-pub impl InferCtxt {
-    fn combine_fields(@mut self,
-                      a_is_expected: bool,
-                      span: span) -> CombineFields {
+impl InferCtxt {
+    pub fn combine_fields(@mut self, a_is_expected: bool, span: span)
+                          -> CombineFields {
         CombineFields {infcx: self,
                        a_is_expected: a_is_expected,
                        span: span}
     }
 
-    fn sub(@mut self, a_is_expected: bool, span: span) -> Sub {
+    pub fn sub(@mut self, a_is_expected: bool, span: span) -> Sub {
         Sub(self.combine_fields(a_is_expected, span))
     }
 
-    fn in_snapshot(&self) -> bool {
+    pub fn in_snapshot(&self) -> bool {
         self.region_vars.in_snapshot()
     }
 
-    fn start_snapshot(&mut self) -> Snapshot {
+    pub fn start_snapshot(&mut self) -> Snapshot {
         Snapshot {
             ty_var_bindings_len:
                 self.ty_var_bindings.bindings.len(),
@@ -565,7 +564,7 @@ fn start_snapshot(&mut self) -> Snapshot {
         }
     }
 
-    fn rollback_to(&mut self, snapshot: &Snapshot) {
+    pub fn rollback_to(&mut self, snapshot: &Snapshot) {
         debug!("rollback!");
         rollback_to(&mut self.ty_var_bindings, snapshot.ty_var_bindings_len);
 
@@ -578,7 +577,7 @@ fn rollback_to(&mut self, snapshot: &Snapshot) {
     }
 
     /// Execute `f` and commit the bindings if successful
-    fn commit<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
+    pub fn commit<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
         assert!(!self.in_snapshot());
 
         debug!("commit()");
@@ -593,7 +592,7 @@ fn commit<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
     }
 
     /// Execute `f`, unroll bindings on failure
-    fn try<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
+    pub fn try<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
         debug!("try()");
         do indent {
             let snapshot = self.start_snapshot();
@@ -607,7 +606,7 @@ fn try<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
     }
 
     /// Execute `f` then unroll any bindings it creates
-    fn probe<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
+    pub fn probe<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
         debug!("probe()");
         do indent {
             let snapshot = self.start_snapshot();
@@ -628,8 +627,8 @@ fn next_simple_var<V:Copy,T:Copy>(
     return id;
 }
 
-pub impl InferCtxt {
-    fn next_ty_var_id(&mut self) -> TyVid {
+impl InferCtxt {
+    pub fn next_ty_var_id(&mut self) -> TyVid {
         let id = self.ty_var_counter;
         self.ty_var_counter += 1;
         {
@@ -639,38 +638,40 @@ fn next_ty_var_id(&mut self) -> TyVid {
         return TyVid(id);
     }
 
-    fn next_ty_var(&mut self) -> ty::t {
+    pub fn next_ty_var(&mut self) -> ty::t {
         ty::mk_var(self.tcx, self.next_ty_var_id())
     }
 
-    fn next_ty_vars(&mut self, n: uint) -> ~[ty::t] {
+    pub fn next_ty_vars(&mut self, n: uint) -> ~[ty::t] {
         vec::from_fn(n, |_i| self.next_ty_var())
     }
 
-    fn next_int_var_id(&mut self) -> IntVid {
+    pub fn next_int_var_id(&mut self) -> IntVid {
         IntVid(next_simple_var(&mut self.int_var_counter,
                                &mut self.int_var_bindings))
     }
 
-    fn next_int_var(&mut self) -> ty::t {
+    pub fn next_int_var(&mut self) -> ty::t {
         ty::mk_int_var(self.tcx, self.next_int_var_id())
     }
 
-    fn next_float_var_id(&mut self) -> FloatVid {
+    pub fn next_float_var_id(&mut self) -> FloatVid {
         FloatVid(next_simple_var(&mut self.float_var_counter,
                                  &mut self.float_var_bindings))
     }
 
-    fn next_float_var(&mut self) -> ty::t {
+    pub fn next_float_var(&mut self) -> ty::t {
         ty::mk_float_var(self.tcx, self.next_float_var_id())
     }
 
-    fn next_region_var_nb(&mut self, span: span) -> ty::Region {
+    pub fn next_region_var_nb(&mut self, span: span) -> ty::Region {
         ty::re_infer(ty::ReVar(self.region_vars.new_region_var(span)))
     }
 
-    fn next_region_var_with_lb(&mut self, span: span,
-                               lb_region: ty::Region) -> ty::Region {
+    pub fn next_region_var_with_lb(&mut self,
+                                   span: span,
+                                   lb_region: ty::Region)
+                                   -> ty::Region {
         let region_var = self.next_region_var_nb(span);
 
         // add lb_region as a lower bound on the newly built variable
@@ -681,35 +682,36 @@ fn next_region_var_with_lb(&mut self, span: span,
         return region_var;
     }
 
-    fn next_region_var(&mut self, span: span, scope_id: ast::node_id)
-                      -> ty::Region {
+    pub fn next_region_var(&mut self, span: span, scope_id: ast::node_id)
+                           -> ty::Region {
         self.next_region_var_with_lb(span, ty::re_scope(scope_id))
     }
 
-    fn resolve_regions(&mut self) {
+    pub fn resolve_regions(&mut self) {
         self.region_vars.resolve_regions();
     }
 
-    fn ty_to_str(@mut self, t: ty::t) -> ~str {
+    pub fn ty_to_str(@mut self, t: ty::t) -> ~str {
         ty_to_str(self.tcx,
                   self.resolve_type_vars_if_possible(t))
     }
 
-    fn trait_ref_to_str(@mut self, t: &ty::TraitRef) -> ~str {
+    pub fn trait_ref_to_str(@mut self, t: &ty::TraitRef) -> ~str {
         let t = self.resolve_type_vars_in_trait_ref_if_possible(t);
         trait_ref_to_str(self.tcx, &t)
     }
 
-    fn resolve_type_vars_if_possible(@mut self, typ: ty::t) -> ty::t {
+    pub fn resolve_type_vars_if_possible(@mut self, typ: ty::t) -> ty::t {
         match resolve_type(self, typ, resolve_nested_tvar | resolve_ivar) {
           result::Ok(new_type) => new_type,
           result::Err(_) => typ
         }
     }
-    fn resolve_type_vars_in_trait_ref_if_possible(@mut self,
-                                                  trait_ref: &ty::TraitRef)
-        -> ty::TraitRef
-    {
+
+    pub fn resolve_type_vars_in_trait_ref_if_possible(@mut self,
+                                                      trait_ref:
+                                                      &ty::TraitRef)
+                                                      -> ty::TraitRef {
         // make up a dummy type just to reuse/abuse the resolve machinery
         let dummy0 = ty::mk_trait(self.tcx,
                                   trait_ref.def_id,
@@ -732,18 +734,22 @@ fn resolve_type_vars_in_trait_ref_if_possible(@mut self,
         }
     }
 
-    fn type_error_message_str(@mut self,
-                              sp: span,
-                              mk_msg: &fn(Option<~str>, ~str) -> ~str,
-                              actual_ty: ~str, err: Option<&ty::type_err>) {
+    pub fn type_error_message_str(@mut self,
+                                  sp: span,
+                                  mk_msg: &fn(Option<~str>, ~str) -> ~str,
+                                  actual_ty: ~str,
+                                  err: Option<&ty::type_err>) {
         self.type_error_message_str_with_expected(sp, mk_msg, None, actual_ty, err)
     }
 
-    fn type_error_message_str_with_expected(@mut self,
-                                            sp: span,
-                                            mk_msg: &fn(Option<~str>, ~str) -> ~str,
-                                            expected_ty: Option<ty::t>, actual_ty: ~str,
-                                            err: Option<&ty::type_err>) {
+    pub fn type_error_message_str_with_expected(@mut self,
+                                                sp: span,
+                                                mk_msg:
+                                                &fn(Option<~str>, ~str) ->
+                                                ~str,
+                                                expected_ty: Option<ty::t>,
+                                                actual_ty: ~str,
+                                                err: Option<&ty::type_err>) {
         debug!("hi! expected_ty = %?, actual_ty = %s", expected_ty, actual_ty);
 
         let error_str = err.map_default(~"", |t_err|
@@ -766,11 +772,11 @@ fn type_error_message_str_with_expected(@mut self,
         }
     }
 
-    fn type_error_message(@mut self,
-                          sp: span,
-                          mk_msg: &fn(~str) -> ~str,
-                          actual_ty: ty::t,
-                          err: Option<&ty::type_err>) {
+    pub fn type_error_message(@mut self,
+                              sp: span,
+                              mk_msg: &fn(~str) -> ~str,
+                              actual_ty: ty::t,
+                              err: Option<&ty::type_err>) {
         let actual_ty = self.resolve_type_vars_if_possible(actual_ty);
 
         // Don't report an error if actual type is ty_err.
@@ -781,8 +787,11 @@ fn type_error_message(@mut self,
         self.type_error_message_str(sp, |_e, a| { mk_msg(a) }, self.ty_to_str(actual_ty), err);
     }
 
-    fn report_mismatched_types(@mut self, sp: span, e: ty::t, a: ty::t,
-                               err: &ty::type_err) {
+    pub fn report_mismatched_types(@mut self,
+                                   sp: span,
+                                   e: ty::t,
+                                   a: ty::t,
+                                   err: &ty::type_err) {
         let resolved_expected =
             self.resolve_type_vars_if_possible(e);
         let mk_msg = match ty::get(resolved_expected).sty {
@@ -799,10 +808,11 @@ fn report_mismatched_types(@mut self, sp: span, e: ty::t, a: ty::t,
         self.type_error_message(sp, mk_msg, a, Some(err));
     }
 
-    fn replace_bound_regions_with_fresh_regions(&mut self,
-            span: span,
-            fsig: &ty::FnSig)
-         -> (ty::FnSig, isr_alist) {
+    pub fn replace_bound_regions_with_fresh_regions(&mut self,
+                                                    span: span,
+                                                    fsig: &ty::FnSig)
+                                                    -> (ty::FnSig,
+                                                        isr_alist) {
         let(isr, _, fn_sig) =
             replace_bound_regions_in_fn_sig(self.tcx, @Nil, None, fsig, |br| {
                 // N.B.: The name of the bound region doesn't have anything to
index 556fcfeac99a5d087ab03cd4e3faadbd6042543c..f99d096f03d752984c319819167d2f8902fcb4ce 100644 (file)
@@ -643,12 +643,12 @@ pub fn RegionVarBindings(tcx: ty::ctxt) -> RegionVarBindings {
     }
 }
 
-pub impl RegionVarBindings {
-    fn in_snapshot(&self) -> bool {
+impl RegionVarBindings {
+    pub fn in_snapshot(&self) -> bool {
         self.undo_log.len() > 0
     }
 
-    fn start_snapshot(&mut self) -> uint {
+    pub fn start_snapshot(&mut self) -> uint {
         debug!("RegionVarBindings: snapshot()=%u", self.undo_log.len());
         if self.in_snapshot() {
             self.undo_log.len()
@@ -658,14 +658,14 @@ fn start_snapshot(&mut self) -> uint {
         }
     }
 
-    fn commit(&mut self) {
+    pub fn commit(&mut self) {
         debug!("RegionVarBindings: commit()");
         while self.undo_log.len() > 0 {
             self.undo_log.pop();
         }
     }
 
-    fn rollback_to(&mut self, snapshot: uint) {
+    pub fn rollback_to(&mut self, snapshot: uint) {
         debug!("RegionVarBindings: rollback_to(%u)", snapshot);
         while self.undo_log.len() > snapshot {
             let undo_item = self.undo_log.pop();
@@ -689,11 +689,11 @@ fn rollback_to(&mut self, snapshot: uint) {
         }
     }
 
-    fn num_vars(&mut self) -> uint {
+    pub fn num_vars(&mut self) -> uint {
         self.var_spans.len()
     }
 
-    fn new_region_var(&mut self, span: span) -> RegionVid {
+    pub fn new_region_var(&mut self, span: span) -> RegionVid {
         let id = self.num_vars();
         self.var_spans.push(span);
         let vid = RegionVid { id: id };
@@ -705,13 +705,13 @@ fn new_region_var(&mut self, span: span) -> RegionVid {
         return vid;
     }
 
-    fn new_skolemized(&mut self, br: ty::bound_region) -> Region {
+    pub fn new_skolemized(&mut self, br: ty::bound_region) -> Region {
         let sc = self.skolemization_count;
         self.skolemization_count += 1;
         re_infer(ReSkolemized(sc, br))
     }
 
-    fn new_bound(&mut self) -> Region {
+    pub fn new_bound(&mut self) -> Region {
         // Creates a fresh bound variable for use in GLB computations.
         // See discussion of GLB computation in the large comment at
         // the top of this file for more details.
@@ -731,7 +731,7 @@ fn new_bound(&mut self) -> Region {
         re_bound(br_fresh(sc))
     }
 
-    fn add_constraint(&mut self, constraint: Constraint, span: span) {
+    pub fn add_constraint(&mut self, constraint: Constraint, span: span) {
         // cannot add constraints once regions are resolved
         assert!(self.values.is_empty());
 
@@ -744,10 +744,8 @@ fn add_constraint(&mut self, constraint: Constraint, span: span) {
         }
     }
 
-    fn make_subregion(&mut self,
-                      span: span,
-                      sub: Region,
-                      sup: Region) -> cres<()> {
+    pub fn make_subregion(&mut self, span: span, sub: Region, sup: Region)
+                          -> cres<()> {
         // cannot add constraints once regions are resolved
         assert!(self.values.is_empty());
 
@@ -785,11 +783,8 @@ fn make_subregion(&mut self,
         }
     }
 
-    fn lub_regions(&mut self,
-                   span: span,
-                   a: Region,
-                   b: Region)
-                -> cres<Region> {
+    pub fn lub_regions(&mut self, span: span, a: Region, b: Region)
+                       -> cres<Region> {
         // cannot add constraints once regions are resolved
         assert!(self.values.is_empty());
 
@@ -811,11 +806,8 @@ fn lub_regions(&mut self,
         }
     }
 
-    fn glb_regions(&mut self,
-                   span: span,
-                   a: Region,
-                   b: Region)
-                -> cres<Region> {
+    pub fn glb_regions(&mut self, span: span, a: Region, b: Region)
+                       -> cres<Region> {
         // cannot add constraints once regions are resolved
         assert!(self.values.is_empty());
 
@@ -838,7 +830,7 @@ fn glb_regions(&mut self,
         }
     }
 
-    fn resolve_var(&mut self, rid: RegionVid) -> ty::Region {
+    pub fn resolve_var(&mut self, rid: RegionVid) -> ty::Region {
         if self.values.is_empty() {
             self.tcx.sess.span_bug(
                 self.var_spans[rid.to_uint()],
@@ -864,15 +856,15 @@ fn resolve_var(&mut self, rid: RegionVid) -> ty::Region {
         }
     }
 
-    fn combine_vars(&mut self,
-                    t: CombineMapType,
-                    a: Region,
-                    b: Region,
-                    span: span,
-                    relate: &fn(this: &mut RegionVarBindings,
-                                old_r: Region,
-                                new_r: Region) -> cres<()>)
-                 -> cres<Region> {
+    pub fn combine_vars(&mut self,
+                        t: CombineMapType,
+                        a: Region,
+                        b: Region,
+                        span: span,
+                        relate: &fn(this: &mut RegionVarBindings,
+                                    old_r: Region,
+                                    new_r: Region) -> cres<()>)
+                        -> cres<Region> {
         let vars = TwoRegions { a: a, b: b };
         let c;
         {
@@ -906,9 +898,8 @@ fn combine_vars(&mut self,
         }
     }
 
-    fn vars_created_since_snapshot(&mut self,
-                                   snapshot: uint)
-                                -> ~[RegionVid] {
+    pub fn vars_created_since_snapshot(&mut self, snapshot: uint)
+                                       -> ~[RegionVid] {
         do vec::build |push| {
             for uint::range(snapshot, self.undo_log.len()) |i| {
                 match self.undo_log[i] {
@@ -919,7 +910,7 @@ fn vars_created_since_snapshot(&mut self,
         }
     }
 
-    fn tainted(&mut self, snapshot: uint, r0: Region) -> ~[Region] {
+    pub fn tainted(&mut self, snapshot: uint, r0: Region) -> ~[Region] {
         /*!
          *
          * Computes all regions that have been related to `r0` in any
@@ -1003,14 +994,14 @@ fn consider_adding_edge(result_set: ~[Region],
     constraints, assuming such values can be found; if they cannot,
     errors are reported.
     */
-    fn resolve_regions(&mut self) {
+    pub fn resolve_regions(&mut self) {
         debug!("RegionVarBindings: resolve_regions()");
         let v = self.infer_variable_values();
         self.values.put_back(v);
     }
 }
 
-priv impl RegionVarBindings {
+impl RegionVarBindings {
     fn is_subregion_of(&self, sub: Region, sup: Region) -> bool {
         let rm = self.tcx.region_maps;
         rm.is_subregion_of(sub, sup)
@@ -1266,15 +1257,15 @@ struct SpannedRegion {
     span: span,
 }
 
-pub impl RegionVarBindings {
-    fn infer_variable_values(&mut self) -> ~[GraphNodeValue] {
+impl RegionVarBindings {
+    pub fn infer_variable_values(&mut self) -> ~[GraphNodeValue] {
         let mut graph = self.construct_graph();
         self.expansion(&mut graph);
         self.contraction(&mut graph);
         self.extract_values_and_report_conflicts(&graph)
     }
 
-    fn construct_graph(&mut self) -> Graph {
+    pub fn construct_graph(&mut self) -> Graph {
         let num_vars = self.num_vars();
         let num_edges = self.constraints.len();
 
@@ -1339,7 +1330,7 @@ fn insert_edge(graph: &mut Graph,
         }
     }
 
-    fn expansion(&mut self, graph: &mut Graph) {
+    pub fn expansion(&mut self, graph: &mut Graph) {
         do iterate_until_fixed_point(~"Expansion", graph) |nodes, edge| {
             match edge.constraint {
               ConstrainRegSubVar(a_region, b_vid) => {
@@ -1363,11 +1354,11 @@ fn expansion(&mut self, graph: &mut Graph) {
         }
     }
 
-    fn expand_node(&mut self,
-                   a_region: Region,
-                   b_vid: RegionVid,
-                   b_node: &mut GraphNode)
-                -> bool {
+    pub fn expand_node(&mut self,
+                       a_region: Region,
+                       b_vid: RegionVid,
+                       b_node: &mut GraphNode)
+                       -> bool {
         debug!("expand_node(%?, %? == %?)",
                a_region, b_vid, b_node.value);
 
@@ -1399,7 +1390,7 @@ fn expand_node(&mut self,
         }
     }
 
-    fn contraction(&mut self, graph: &mut Graph) {
+    pub fn contraction(&mut self, graph: &mut Graph) {
         do iterate_until_fixed_point(~"Contraction", graph) |nodes, edge| {
             match edge.constraint {
               ConstrainRegSubVar(*) => {
@@ -1423,11 +1414,11 @@ fn contraction(&mut self, graph: &mut Graph) {
         }
     }
 
-    fn contract_node(&mut self,
-                     a_vid: RegionVid,
-                     a_node: &mut GraphNode,
-                     b_region: Region)
-                  -> bool {
+    pub fn contract_node(&mut self,
+                         a_vid: RegionVid,
+                         a_node: &mut GraphNode,
+                         b_region: Region)
+                         -> bool {
         debug!("contract_node(%? == %?/%?, %?)",
                a_vid, a_node.value, a_node.classification, b_region);
 
@@ -1495,10 +1486,8 @@ fn adjust_node(this: &mut RegionVarBindings,
         }
     }
 
-    fn extract_values_and_report_conflicts(
-        &mut self,
-        graph: &Graph) -> ~[GraphNodeValue]
-    {
+    pub fn extract_values_and_report_conflicts(&mut self, graph: &Graph)
+                                               -> ~[GraphNodeValue] {
         debug!("extract_values_and_report_conflicts()");
 
         // This is the best way that I have found to suppress
@@ -1567,10 +1556,10 @@ fn extract_values_and_report_conflicts(
         })
     }
 
-    fn report_error_for_expanding_node(&mut self,
-                                       graph: &Graph,
-                                       dup_vec: &mut [uint],
-                                       node_idx: RegionVid) {
+    pub fn report_error_for_expanding_node(&mut self,
+                                           graph: &Graph,
+                                           dup_vec: &mut [uint],
+                                           node_idx: RegionVid) {
         // Errors in expanding nodes result from a lower-bound that is
         // not contained by an upper-bound.
         let (lower_bounds, lower_dup) =
@@ -1626,10 +1615,10 @@ fn report_error_for_expanding_node(&mut self,
                  upper_bounds.map(|x| x.region).repr(self.tcx)));
     }
 
-    fn report_error_for_contracting_node(&mut self,
-                                         graph: &Graph,
-                                         dup_vec: &mut [uint],
-                                         node_idx: RegionVid) {
+    pub fn report_error_for_contracting_node(&mut self,
+                                             graph: &Graph,
+                                             dup_vec: &mut [uint],
+                                             node_idx: RegionVid) {
         // Errors in contracting nodes result from two upper-bounds
         // that have no intersection.
         let (upper_bounds, dup_found) =
@@ -1685,12 +1674,12 @@ fn report_error_for_contracting_node(&mut self,
                  upper_bounds.map(|x| x.region).repr(self.tcx)));
     }
 
-    fn collect_concrete_regions(&mut self,
-                                graph: &Graph,
-                                orig_node_idx: RegionVid,
-                                dir: Direction,
-                                dup_vec: &mut [uint])
-                             -> (~[SpannedRegion], bool) {
+    pub fn collect_concrete_regions(&mut self,
+                                    graph: &Graph,
+                                    orig_node_idx: RegionVid,
+                                    dir: Direction,
+                                    dup_vec: &mut [uint])
+                                    -> (~[SpannedRegion], bool) {
         struct WalkState {
             set: HashSet<RegionVid>,
             stack: ~[RegionVid],
@@ -1766,11 +1755,12 @@ fn process_edges(this: &mut RegionVarBindings,
         }
     }
 
-    fn each_edge(&mut self,
-                 graph: &Graph,
-                 node_idx: RegionVid,
-                 dir: Direction,
-                 op: &fn(edge: &GraphEdge) -> bool) -> bool {
+    pub fn each_edge(&mut self,
+                     graph: &Graph,
+                     node_idx: RegionVid,
+                     dir: Direction,
+                     op: &fn(edge: &GraphEdge) -> bool)
+                     -> bool {
         let mut edge_idx =
             graph.nodes[node_idx.to_uint()].head_edge[dir as uint];
         while edge_idx != uint::max_value {
index ea0bdc68ac2533526a0d38db624547b50b59fcf9..c2ee7fc2647bd5da4ad3b5c863f61b6ff79d429c 100644 (file)
@@ -98,12 +98,12 @@ pub fn resolver(infcx: @mut InferCtxt, modes: uint) -> ResolveState {
     }
 }
 
-pub impl ResolveState {
-    fn should(&mut self, mode: uint) -> bool {
+impl ResolveState {
+    pub fn should(&mut self, mode: uint) -> bool {
         (self.modes & mode) == mode
     }
 
-    fn resolve_type_chk(&mut self, typ: ty::t) -> fres<ty::t> {
+    pub fn resolve_type_chk(&mut self, typ: ty::t) -> fres<ty::t> {
         self.err = None;
 
         debug!("Resolving %s (modes=%x)",
@@ -128,7 +128,8 @@ fn resolve_type_chk(&mut self, typ: ty::t) -> fres<ty::t> {
         }
     }
 
-    fn resolve_region_chk(&mut self, orig: ty::Region) -> fres<ty::Region> {
+    pub fn resolve_region_chk(&mut self, orig: ty::Region)
+                              -> fres<ty::Region> {
         self.err = None;
         let resolved = indent(|| self.resolve_region(orig) );
         match self.err {
@@ -137,7 +138,7 @@ fn resolve_region_chk(&mut self, orig: ty::Region) -> fres<ty::Region> {
         }
     }
 
-    fn resolve_type(&mut self, typ: ty::t) -> ty::t {
+    pub fn resolve_type(&mut self, typ: ty::t) -> ty::t {
         debug!("resolve_type(%s)", typ.inf_str(self.infcx));
         let _i = indenter();
 
@@ -179,7 +180,7 @@ fn resolve_type(&mut self, typ: ty::t) -> ty::t {
         }
     }
 
-    fn resolve_region(&mut self, orig: ty::Region) -> ty::Region {
+    pub fn resolve_region(&mut self, orig: ty::Region) -> ty::Region {
         debug!("Resolve_region(%s)", orig.inf_str(self.infcx));
         match orig {
           ty::re_infer(ty::ReVar(rid)) => self.resolve_region_var(rid),
@@ -187,14 +188,14 @@ fn resolve_region(&mut self, orig: ty::Region) -> ty::Region {
         }
     }
 
-    fn resolve_region_var(&mut self, rid: RegionVid) -> ty::Region {
+    pub fn resolve_region_var(&mut self, rid: RegionVid) -> ty::Region {
         if !self.should(resolve_rvar) {
             return ty::re_infer(ty::ReVar(rid));
         }
         self.infcx.region_vars.resolve_var(rid)
     }
 
-    fn assert_not_rvar(&mut self, rid: RegionVid, r: ty::Region) {
+    pub fn assert_not_rvar(&mut self, rid: RegionVid, r: ty::Region) {
         match r {
           ty::re_infer(ty::ReVar(rid2)) => {
             self.err = Some(region_var_bound_by_region_var(rid, rid2));
@@ -203,7 +204,7 @@ fn assert_not_rvar(&mut self, rid: RegionVid, r: ty::Region) {
         }
     }
 
-    fn resolve_ty_var(&mut self, vid: TyVid) -> ty::t {
+    pub fn resolve_ty_var(&mut self, vid: TyVid) -> ty::t {
         if vec::contains(self.v_seen, &vid) {
             self.err = Some(cyclic_ty(vid));
             return ty::mk_var(self.infcx.tcx, vid);
@@ -237,7 +238,7 @@ fn resolve_ty_var(&mut self, vid: TyVid) -> ty::t {
         }
     }
 
-    fn resolve_int_var(&mut self, vid: IntVid) -> ty::t {
+    pub fn resolve_int_var(&mut self, vid: IntVid) -> ty::t {
         if !self.should(resolve_ivar) {
             return ty::mk_int_var(self.infcx.tcx, vid);
         }
@@ -260,7 +261,7 @@ fn resolve_int_var(&mut self, vid: IntVid) -> ty::t {
         }
     }
 
-    fn resolve_float_var(&mut self, vid: FloatVid) -> ty::t {
+    pub fn resolve_float_var(&mut self, vid: FloatVid) -> ty::t {
         if !self.should(resolve_fvar) {
             return ty::mk_float_var(self.infcx.tcx, vid);
         }
index e39dd986c514b0ef9174075883240913337ae798..e6e6753255e749864075e7691bd4517d21c547d0 100644 (file)
@@ -77,15 +77,15 @@ fn setup_env(test_name: &str, source_string: &str) -> Env {
                 err_messages: messages};
 }
 
-pub impl Env {
-    fn create_region_hierarchy(&self, rh: &RH) {
+impl Env {
+    pub fn create_region_hierarchy(&self, rh: &RH) {
         for rh.sub.each |child_rh| {
             self.create_region_hierarchy(child_rh);
             self.tcx.region_map.insert(child_rh.id, rh.id);
         }
     }
 
-    fn create_simple_region_hierarchy(&self) {
+    pub fn create_simple_region_hierarchy(&self) {
         // creates a region hierarchy where 1 is root, 10 and 11 are
         // children of 1, etc
         self.create_region_hierarchy(
@@ -96,7 +96,7 @@ fn create_simple_region_hierarchy(&self) {
                             sub: &[]}]});
     }
 
-    fn lookup_item(&self, names: &[~str]) -> ast::node_id {
+    pub fn lookup_item(&self, names: &[~str]) -> ast::node_id {
         return match search_mod(self, &self.crate.node.module, 0, names) {
             Some(id) => id,
             None => {
@@ -144,14 +144,14 @@ fn search(self: &Env,
         }
     }
 
-    fn is_subtype(&self, a: ty::t, b: ty::t) -> bool {
+    pub fn is_subtype(&self, a: ty::t, b: ty::t) -> bool {
         match infer::can_mk_subty(self.infcx, a, b) {
             Ok(_) => true,
             Err(_) => false
         }
     }
 
-    fn assert_subtype(&self, a: ty::t, b: ty::t) {
+    pub fn assert_subtype(&self, a: ty::t, b: ty::t) {
         if !self.is_subtype(a, b) {
             fail!("%s is not a subtype of %s, but it should be",
                   self.ty_to_str(a),
@@ -159,7 +159,7 @@ fn assert_subtype(&self, a: ty::t, b: ty::t) {
         }
     }
 
-    fn assert_not_subtype(&self, a: ty::t, b: ty::t) {
+    pub fn assert_not_subtype(&self, a: ty::t, b: ty::t) {
         if self.is_subtype(a, b) {
             fail!("%s is a subtype of %s, but it shouldn't be",
                   self.ty_to_str(a),
@@ -167,21 +167,21 @@ fn assert_not_subtype(&self, a: ty::t, b: ty::t) {
         }
     }
 
-    fn assert_strict_subtype(&self, a: ty::t, b: ty::t) {
+    pub fn assert_strict_subtype(&self, a: ty::t, b: ty::t) {
         self.assert_subtype(a, b);
         self.assert_not_subtype(b, a);
     }
 
-    fn assert_eq(&self, a: ty::t, b: ty::t) {
+    pub fn assert_eq(&self, a: ty::t, b: ty::t) {
         self.assert_subtype(a, b);
         self.assert_subtype(b, a);
     }
 
-    fn ty_to_str(&self, a: ty::t) -> ~str {
+    pub fn ty_to_str(&self, a: ty::t) -> ~str {
         ty_to_str(self.tcx, a)
     }
 
-    fn t_fn(&self, input_tys: &[ty::t], output_ty: ty::t) -> ty::t {
+    pub fn t_fn(&self, input_tys: &[ty::t], output_ty: ty::t) -> ty::t {
         let inputs = input_tys.map(|t| {mode: ast::expl(ast::by_copy),
                                         ty: *t});
         ty::mk_fn(self.tcx, FnTyBase {
@@ -195,34 +195,34 @@ fn t_fn(&self, input_tys: &[ty::t], output_ty: ty::t) -> ty::t {
         })
     }
 
-    fn t_int(&self) -> ty::t {
+    pub fn t_int(&self) -> ty::t {
         ty::mk_int(self.tcx)
     }
 
-    fn t_rptr_bound(&self, id: uint) -> ty::t {
+    pub fn t_rptr_bound(&self, id: uint) -> ty::t {
         ty::mk_imm_rptr(self.tcx, ty::re_bound(ty::br_anon(id)), self.t_int())
     }
 
-    fn t_rptr_scope(&self, id: ast::node_id) -> ty::t {
+    pub fn t_rptr_scope(&self, id: ast::node_id) -> ty::t {
         ty::mk_imm_rptr(self.tcx, ty::re_scope(id), self.t_int())
     }
 
-    fn t_rptr_free(&self, nid: ast::node_id, id: uint) -> ty::t {
+    pub fn t_rptr_free(&self, nid: ast::node_id, id: uint) -> ty::t {
         ty::mk_imm_rptr(self.tcx,
                         ty::re_free(ty::FreeRegion {scope_id: nid,
                                                     bound_region: ty::br_anon(id)}),
                         self.t_int())
     }
 
-    fn t_rptr_static(&self) -> ty::t {
+    pub fn t_rptr_static(&self) -> ty::t {
         ty::mk_imm_rptr(self.tcx, ty::re_static, self.t_int())
     }
 
-    fn lub() -> Lub { Lub(self.infcx.combine_fields(true, dummy_sp())) }
+    pub fn lub() -> Lub { Lub(self.infcx.combine_fields(true, dummy_sp())) }
 
-    fn glb() -> Glb { Glb(self.infcx.combine_fields(true, dummy_sp())) }
+    pub fn glb() -> Glb { Glb(self.infcx.combine_fields(true, dummy_sp())) }
 
-    fn resolve_regions(exp_count: uint) {
+    pub fn resolve_regions(exp_count: uint) {
         debug!("resolve_regions(%u)", exp_count);
 
         self.infcx.resolve_regions();
@@ -237,7 +237,7 @@ fn resolve_regions(exp_count: uint) {
     }
 
     /// Checks that `LUB(t1,t2) == t_lub`
-    fn check_lub(&self, t1: ty::t, t2: ty::t, t_lub: ty::t) {
+    pub fn check_lub(&self, t1: ty::t, t2: ty::t, t_lub: ty::t) {
         match self.lub().tys(t1, t2) {
             Err(e) => {
                 fail!("Unexpected error computing LUB: %?", e)
@@ -255,7 +255,7 @@ fn check_lub(&self, t1: ty::t, t2: ty::t, t_lub: ty::t) {
     }
 
     /// Checks that `GLB(t1,t2) == t_glb`
-    fn check_glb(&self, t1: ty::t, t2: ty::t, t_glb: ty::t) {
+    pub fn check_glb(&self, t1: ty::t, t2: ty::t, t_glb: ty::t) {
         debug!("check_glb(t1=%s, t2=%s, t_glb=%s)",
                self.ty_to_str(t1),
                self.ty_to_str(t2),
@@ -277,7 +277,7 @@ fn check_glb(&self, t1: ty::t, t2: ty::t, t_glb: ty::t) {
     }
 
     /// Checks that `LUB(t1,t2)` is undefined
-    fn check_no_lub(&self, t1: ty::t, t2: ty::t) {
+    pub fn check_no_lub(&self, t1: ty::t, t2: ty::t) {
         match self.lub().tys(t1, t2) {
             Err(_) => {}
             Ok(t) => {
@@ -287,7 +287,7 @@ fn check_no_lub(&self, t1: ty::t, t2: ty::t) {
     }
 
     /// Checks that `GLB(t1,t2)` is undefined
-    fn check_no_glb(&self, t1: ty::t, t2: ty::t) {
+    pub fn check_no_glb(&self, t1: ty::t, t2: ty::t) {
         match self.glb().tys(t1, t2) {
             Err(_) => {}
             Ok(t) => {
index 78739bd7b04f9dd141773f2cb7a9e855fe746b74..c6e4b485d29b530cc93e1ec291b6adfaa7624018 100644 (file)
@@ -40,11 +40,9 @@ fn appropriate_vals_and_bindings<'v>(infcx: &'v mut InferCtxt)
                                       -> &'v mut ValsAndBindings<Self, T>;
 }
 
-pub impl InferCtxt {
-    fn get<T:Copy, V:Copy+Eq+Vid+UnifyVid<T>>(
-        &mut self,
-        vid: V) -> Node<V, T>
-    {
+impl InferCtxt {
+    pub fn get<T:Copy, V:Copy+Eq+Vid+UnifyVid<T>>(&mut self, vid: V)
+                                                  -> Node<V, T> {
         /*!
          *
          * Find the root node for `vid`. This uses the standard
@@ -86,10 +84,10 @@ fn helper<T:Copy, V:Copy+Eq+Vid>(
         }
     }
 
-    fn set<T:Copy + InferStr,V:Copy + Vid + ToStr + UnifyVid<T>>(
-            &mut self,
-            vid: V,
-            new_v: VarValue<V, T>) {
+    pub fn set<T:Copy + InferStr,
+               V:Copy + Vid + ToStr + UnifyVid<T>>(&mut self,
+                                                   vid: V,
+                                                   new_v: VarValue<V, T>) {
         /*!
          *
          * Sets the value for `vid` to `new_v`.  `vid` MUST be a root node!
@@ -106,11 +104,11 @@ fn set<T:Copy + InferStr,V:Copy + Vid + ToStr + UnifyVid<T>>(
         }
     }
 
-    fn unify<T:Copy + InferStr,V:Copy + Vid + ToStr + UnifyVid<T>>(
-        &mut self,
-        node_a: &Node<V, T>,
-        node_b: &Node<V, T>) -> (V, uint)
-    {
+    pub fn unify<T:Copy + InferStr,
+                 V:Copy + Vid + ToStr + UnifyVid<T>>(&mut self,
+                                                     node_a: &Node<V, T>,
+                                                     node_b: &Node<V, T>)
+                                                     -> (V, uint) {
         // Rank optimization: if you don't know what it is, check
         // out <http://en.wikipedia.org/wiki/Disjoint-set_data_structure>
 
@@ -159,14 +157,14 @@ pub fn mk_err<T:SimplyUnifiable>(a_is_expected: bool,
     }
 }
 
-pub impl InferCtxt {
-    fn simple_vars<T:Copy + Eq + InferStr + SimplyUnifiable,
-                   V:Copy + Eq + Vid + ToStr + UnifyVid<Option<T>>>(
-            &mut self,
-            a_is_expected: bool,
-            a_id: V,
-            b_id: V)
-         -> ures {
+impl InferCtxt {
+    pub fn simple_vars<T:Copy+Eq+InferStr+SimplyUnifiable,
+                       V:Copy+Eq+Vid+ToStr+UnifyVid<Option<T>>>(&mut self,
+                                                                a_is_expected:
+                                                                bool,
+                                                                a_id: V,
+                                                                b_id: V)
+                                                                -> ures {
         /*!
          *
          * Unifies two simple variables.  Because simple variables do
@@ -198,13 +196,13 @@ fn simple_vars<T:Copy + Eq + InferStr + SimplyUnifiable,
         return uok();
     }
 
-    fn simple_var_t<T:Copy + Eq + InferStr + SimplyUnifiable,
-                    V:Copy + Eq + Vid + ToStr + UnifyVid<Option<T>>>(
-            &mut self,
-            a_is_expected: bool,
-            a_id: V,
-            b: T)
-         -> ures {
+    pub fn simple_var_t<T:Copy+Eq+InferStr+SimplyUnifiable,
+                        V:Copy+Eq+Vid+ToStr+UnifyVid<Option<T>>>(&mut self,
+                                                                 a_is_expected
+                                                                 : bool,
+                                                                 a_id: V,
+                                                                 b: T)
+                                                                 -> ures {
         /*!
          *
          * Sets the value of the variable `a_id` to `b`.  Because
index 4e9b7cf00a0bd843e620789e06020047d9effe9b..85fceabf0ac8fbea555671de4d28a0adc0b305e7 100644 (file)
@@ -26,40 +26,40 @@ fn bit<E:CLike>(e: E) -> uint {
     1 << e.to_uint()
 }
 
-pub impl<E:CLike> EnumSet<E> {
-    fn empty() -> EnumSet<E> {
+impl<E:CLike> EnumSet<E> {
+    pub fn empty() -> EnumSet<E> {
         EnumSet {bits: 0}
     }
 
-    fn is_empty(&self) -> bool {
+    pub fn is_empty(&self) -> bool {
         self.bits == 0
     }
 
-    fn intersects(&self, e: EnumSet<E>) -> bool {
+    pub fn intersects(&self, e: EnumSet<E>) -> bool {
         (self.bits & e.bits) != 0
     }
 
-    fn intersection(&self, e: EnumSet<E>) -> EnumSet<E> {
+    pub fn intersection(&self, e: EnumSet<E>) -> EnumSet<E> {
         EnumSet {bits: self.bits & e.bits}
     }
 
-    fn contains(&self, e: EnumSet<E>) -> bool {
+    pub fn contains(&self, e: EnumSet<E>) -> bool {
         (self.bits & e.bits) == e.bits
     }
 
-    fn union(&self, e: EnumSet<E>) -> EnumSet<E> {
+    pub fn union(&self, e: EnumSet<E>) -> EnumSet<E> {
         EnumSet {bits: self.bits | e.bits}
     }
 
-    fn add(&mut self, e: E) {
+    pub fn add(&mut self, e: E) {
         self.bits |= bit(e);
     }
 
-    fn contains_elem(&self, e: E) -> bool {
+    pub fn contains_elem(&self, e: E) -> bool {
         (self.bits & bit(e)) != 0
     }
 
-    fn each(&self, f: &fn(E) -> bool) -> bool {
+    pub fn each(&self, f: &fn(E) -> bool) -> bool {
         let mut bits = self.bits;
         let mut index = 0;
         while bits != 0 {
index 2d5f60e714b5082511c9697d7d534ca9498c063f..283763c156471e0d4cec349d76ea5ff36e52f52f 100644 (file)
@@ -172,8 +172,8 @@ pub struct IndexEntry {
     link: ~str
 }
 
-pub impl Doc {
-    fn CrateDoc(&self) -> CrateDoc {
+impl Doc {
+    pub fn CrateDoc(&self) -> CrateDoc {
         vec::foldl(None, self.pages, |_m, page| {
             match copy *page {
               doc::CratePage(doc) => Some(doc),
@@ -182,14 +182,14 @@ fn CrateDoc(&self) -> CrateDoc {
         }).get()
     }
 
-    fn cratemod(&self) -> ModDoc {
+    pub fn cratemod(&self) -> ModDoc {
         copy self.CrateDoc().topmod
     }
 }
 
 /// Some helper methods on ModDoc, mostly for testing
-pub impl ModDoc {
-    fn mods(&self) -> ~[ModDoc] {
+impl ModDoc {
+    pub fn mods(&self) -> ~[ModDoc] {
         do vec::filter_mapped(self.items) |itemtag| {
             match copy *itemtag {
               ModTag(ModDoc) => Some(ModDoc),
@@ -198,7 +198,7 @@ fn mods(&self) -> ~[ModDoc] {
         }
     }
 
-    fn nmods(&self) -> ~[NmodDoc] {
+    pub fn nmods(&self) -> ~[NmodDoc] {
         do vec::filter_mapped(self.items) |itemtag| {
             match copy *itemtag {
               NmodTag(nModDoc) => Some(nModDoc),
@@ -207,7 +207,7 @@ fn nmods(&self) -> ~[NmodDoc] {
         }
     }
 
-    fn fns(&self) -> ~[FnDoc] {
+    pub fn fns(&self) -> ~[FnDoc] {
         do vec::filter_mapped(self.items) |itemtag| {
             match copy *itemtag {
               FnTag(FnDoc) => Some(FnDoc),
@@ -216,7 +216,7 @@ fn fns(&self) -> ~[FnDoc] {
         }
     }
 
-    fn consts(&self) -> ~[ConstDoc] {
+    pub fn consts(&self) -> ~[ConstDoc] {
         do vec::filter_mapped(self.items) |itemtag| {
             match copy *itemtag {
               ConstTag(ConstDoc) => Some(ConstDoc),
@@ -225,7 +225,7 @@ fn consts(&self) -> ~[ConstDoc] {
         }
     }
 
-    fn enums(&self) -> ~[EnumDoc] {
+    pub fn enums(&self) -> ~[EnumDoc] {
         do vec::filter_mapped(self.items) |itemtag| {
             match copy *itemtag {
               EnumTag(EnumDoc) => Some(EnumDoc),
@@ -234,7 +234,7 @@ fn enums(&self) -> ~[EnumDoc] {
         }
     }
 
-    fn traits(&self) -> ~[TraitDoc] {
+    pub fn traits(&self) -> ~[TraitDoc] {
         do vec::filter_mapped(self.items) |itemtag| {
             match copy *itemtag {
               TraitTag(TraitDoc) => Some(TraitDoc),
@@ -243,7 +243,7 @@ fn traits(&self) -> ~[TraitDoc] {
         }
     }
 
-    fn impls(&self) -> ~[ImplDoc] {
+    pub fn impls(&self) -> ~[ImplDoc] {
         do vec::filter_mapped(self.items) |itemtag| {
             match copy *itemtag {
               ImplTag(ImplDoc) => Some(ImplDoc),
@@ -252,7 +252,7 @@ fn impls(&self) -> ~[ImplDoc] {
         }
     }
 
-    fn types(&self) -> ~[TyDoc] {
+    pub fn types(&self) -> ~[TyDoc] {
         do vec::filter_mapped(self.items) |itemtag| {
             match copy *itemtag {
               TyTag(TyDoc) => Some(TyDoc),
@@ -261,7 +261,7 @@ fn types(&self) -> ~[TyDoc] {
         }
     }
 
-    fn structs(&self) -> ~[StructDoc] {
+    pub fn structs(&self) -> ~[StructDoc] {
         do vec::filter_mapped(self.items) |itemtag| {
             match copy *itemtag {
                 StructTag(StructDoc) => Some(StructDoc),
index 26344ebbc61391b2ed0d8f8fb9d65e4997d648f1..a2fa80daa3ba2bc0f251aed42e864139ba0991c9 100644 (file)
@@ -212,8 +212,8 @@ pub fn bar() { }\
     #[test]
     fn should_prune_priv_associated_methods_on_pub_impls() {
         let doc = mk_doc(
-            ~"pub impl Foo {\
-              fn bar() { }\
+            ~"impl Foo {\
+              pub fn bar() { }\
               priv fn baz() { }\
               }");
         assert_eq!(doc.cratemod().impls()[0].methods.len(), 1);
@@ -222,7 +222,7 @@ fn bar() { }\
     #[test]
     fn should_prune_associated_methods_without_vis_modifier_on_priv_impls() {
         let doc = mk_doc(
-            ~"priv impl Foo {\
+            ~"impl Foo {\
               pub fn bar() { }\
               fn baz() { }\
               }");
@@ -232,7 +232,7 @@ fn baz() { }\
     #[test]
     fn should_prune_priv_associated_methods_on_priv_impls() {
         let doc = mk_doc(
-            ~"priv impl Foo {\
+            ~"impl Foo {\
               pub fn bar() { }\
               priv fn baz() { }\
               }");
@@ -242,7 +242,7 @@ pub fn bar() { }\
     #[test]
     fn should_prune_associated_impls_with_no_pub_methods() {
         let doc = mk_doc(
-            ~"priv impl Foo {\
+            ~"impl Foo {\
               fn baz() { }\
               }");
         assert!(doc.cratemod().impls().is_empty());
index cdb1a49c36dd7153e1ae1a28fd7a61ef4e12323a..bf4c7027ce21b557f611bac8e072e744ba38d881 100644 (file)
@@ -47,7 +47,7 @@ fn test() {
          fn ifn() { } \
          enum ienum { ivar } \
          trait itrait { fn a(); } \
-         pub impl int { fn a() { } } \
+         impl int { fn a() { } } \
          type itype = int; \
          struct istruct { f: () }";
     do astsrv::from_str(source) |srv| {
index 6b560541e52bc62527648d3a2d1d0abbeb1c3ca7..ada03e777ca63fa641b4b148588e9427b84713f1 100644 (file)
@@ -430,9 +430,8 @@ pub struct Crate {
     cfgs: ~[~str]
 }
 
-pub impl Crate {
-
-    fn new(p: &Path) -> Crate {
+impl Crate {
+    pub fn new(p: &Path) -> Crate {
         Crate {
             file: copy *p,
             flags: ~[],
@@ -440,28 +439,28 @@ pub impl Crate {
         }
     }
 
-    fn flag(&self, flag: ~str) -> Crate {
+    pub fn flag(&self, flag: ~str) -> Crate {
         Crate {
             flags: vec::append(copy self.flags, [flag]),
             .. copy *self
         }
     }
 
-    fn flags(&self, flags: ~[~str]) -> Crate {
+    pub fn flags(&self, flags: ~[~str]) -> Crate {
         Crate {
             flags: vec::append(copy self.flags, flags),
             .. copy *self
         }
     }
 
-    fn cfg(&self, cfg: ~str) -> Crate {
+    pub fn cfg(&self, cfg: ~str) -> Crate {
         Crate {
             cfgs: vec::append(copy self.cfgs, [cfg]),
             .. copy *self
         }
     }
 
-    fn cfgs(&self, cfgs: ~[~str]) -> Crate {
+    pub fn cfgs(&self, cfgs: ~[~str]) -> Crate {
         Crate {
             cfgs: vec::append(copy self.cfgs, cfgs),
             .. copy *self
index 8019b3b8afb00494b012cd9c8ed09015353d29cc..34fd719fc4c6b1bc179c143731ddcf74abc760b5 100644 (file)
@@ -107,8 +107,8 @@ pub struct PkgId {
     version: Version
 }
 
-pub impl PkgId {
-    fn new(s: &str) -> PkgId {
+impl PkgId {
+    pub fn new(s: &str) -> PkgId {
         use conditions::bad_pkg_id::cond;
 
         let p = Path(s);
@@ -129,13 +129,13 @@ fn new(s: &str) -> PkgId {
         }
     }
 
-    fn hash(&self) -> ~str {
+    pub fn hash(&self) -> ~str {
         fmt!("%s-%s-%s", self.remote_path.to_str(),
              hash(self.remote_path.to_str() + self.version.to_str()),
              self.version.to_str())
     }
 
-    fn short_name_with_version(&self) -> ~str {
+    pub fn short_name_with_version(&self) -> ~str {
         fmt!("%s-%s", self.short_name, self.version.to_str())
     }
 }
index 87145acbb625695aa21599072fddc5e78298f2a5..ab4752ff847703c57642c170d74a24b84343e861 100644 (file)
@@ -10,6 +10,8 @@
 
 //! A mutable, nullable memory location
 
+#[missing_doc];
+
 use cast::transmute_mut;
 use prelude::*;
 use util::replace;
@@ -37,9 +39,9 @@ pub fn empty_cell<T>() -> Cell<T> {
     Cell { value: None }
 }
 
-pub impl<T> Cell<T> {
+impl<T> Cell<T> {
     /// Yields the value, failing if the cell is empty.
-    fn take(&self) -> T {
+    pub fn take(&self) -> T {
         let this = unsafe { transmute_mut(self) };
         if this.is_empty() {
             fail!("attempt to take an empty cell");
@@ -49,7 +51,7 @@ fn take(&self) -> T {
     }
 
     /// Returns the value, failing if the cell is full.
-    fn put_back(&self, value: T) {
+    pub fn put_back(&self, value: T) {
         let this = unsafe { transmute_mut(self) };
         if !this.is_empty() {
             fail!("attempt to put a value back into a full cell");
@@ -58,20 +60,20 @@ fn put_back(&self, value: T) {
     }
 
     /// Returns true if the cell is empty and false if the cell is full.
-    fn is_empty(&self) -> bool {
+    pub fn is_empty(&self) -> bool {
         self.value.is_none()
     }
 
-    // Calls a closure with a reference to the value.
-    fn with_ref<R>(&self, op: &fn(v: &T) -> R) -> R {
+    /// Calls a closure with a reference to the value.
+    pub fn with_ref<R>(&self, op: &fn(v: &T) -> R) -> R {
         let v = self.take();
         let r = op(&v);
         self.put_back(v);
         r
     }
 
-    // Calls a closure with a mutable reference to the value.
-    fn with_mut_ref<R>(&self, op: &fn(v: &mut T) -> R) -> R {
+    /// Calls a closure with a mutable reference to the value.
+    pub fn with_mut_ref<R>(&self, op: &fn(v: &mut T) -> R) -> R {
         let mut v = self.take();
         let r = op(&mut v);
         self.put_back(v);
index e044a73b338fe7a1ee054ebd90cd4341667ff79e..a376a71597694ac16139854b34d2c7e361f250de 100644 (file)
@@ -150,14 +150,14 @@ pub struct PortSet<T> {
     ports: ~[pipesy::Port<T>],
 }
 
-pub impl<T: Owned> PortSet<T> {
-    fn new() -> PortSet<T> {
+impl<T: Owned> PortSet<T> {
+    pub fn new() -> PortSet<T> {
         PortSet {
             ports: ~[]
         }
     }
 
-    fn add(&self, port: Port<T>) {
+    pub fn add(&self, port: Port<T>) {
         let Port { inner } = port;
         let port = match inner {
             Left(p) => p,
@@ -169,7 +169,7 @@ fn add(&self, port: Port<T>) {
         }
     }
 
-    fn chan(&self) -> Chan<T> {
+    pub fn chan(&self) -> Chan<T> {
         let (po, ch) = stream();
         self.add(po);
         ch
@@ -470,20 +470,20 @@ pub fn oneshot<T: Owned>() -> (PortOne<T>, ChanOne<T>) {
         (PortOne::new(port), ChanOne::new(chan))
     }
 
-    pub impl<T: Owned> PortOne<T> {
-        fn recv(self) -> T { recv_one(self) }
-        fn try_recv(self) -> Option<T> { try_recv_one(self) }
-        fn unwrap(self) -> oneshot::server::Oneshot<T> {
+    impl<T: Owned> PortOne<T> {
+        pub fn recv(self) -> T { recv_one(self) }
+        pub fn try_recv(self) -> Option<T> { try_recv_one(self) }
+        pub fn unwrap(self) -> oneshot::server::Oneshot<T> {
             match self {
                 PortOne { contents: s } => s
             }
         }
     }
 
-    pub impl<T: Owned> ChanOne<T> {
-        fn send(self, data: T) { send_one(self, data) }
-        fn try_send(self, data: T) -> bool { try_send_one(self, data) }
-        fn unwrap(self) -> oneshot::client::Oneshot<T> {
+    impl<T: Owned> ChanOne<T> {
+        pub fn send(self, data: T) { send_one(self, data) }
+        pub fn try_send(self, data: T) -> bool { try_send_one(self, data) }
+        pub fn unwrap(self) -> oneshot::client::Oneshot<T> {
             match self {
                 ChanOne { contents: s } => s
             }
index eed61aab5c0bceeb51fcf3ca67893e9260c1c4dc..2f150a0d1b2835d054b3ec614c5e1e46283fe9d7 100644 (file)
@@ -29,8 +29,8 @@ pub struct Condition<'self, T, U> {
     key: local_data::LocalDataKey<'self, Handler<T, U>>
 }
 
-pub impl<'self, T, U> Condition<'self, T, U> {
-    fn trap(&'self self, h: &'self fn(T) -> U) -> Trap<'self, T, U> {
+impl<'self, T, U> Condition<'self, T, U> {
+    pub fn trap(&'self self, h: &'self fn(T) -> U) -> Trap<'self, T, U> {
         unsafe {
             let p : *RustClosure = ::cast::transmute(&h);
             let prev = local_data::local_data_get(self.key);
@@ -39,12 +39,12 @@ fn trap(&'self self, h: &'self fn(T) -> U) -> Trap<'self, T, U> {
         }
     }
 
-    fn raise(&self, t: T) -> U {
+    pub fn raise(&self, t: T) -> U {
         let msg = fmt!("Unhandled condition: %s: %?", self.name, t);
         self.raise_default(t, || fail!(copy msg))
     }
 
-    fn raise_default(&self, t: T, default: &fn() -> U) -> U {
+    pub fn raise_default(&self, t: T, default: &fn() -> U) -> U {
         unsafe {
             match local_data_pop(self.key) {
                 None => {
@@ -73,8 +73,8 @@ struct Trap<'self, T, U> {
     handler: @Handler<T, U>
 }
 
-pub impl<'self, T, U> Trap<'self, T, U> {
-    fn in<V>(&self, inner: &'self fn() -> V) -> V {
+impl<'self, T, U> Trap<'self, T, U> {
+    pub fn in<V>(&self, inner: &'self fn() -> V) -> V {
         unsafe {
             let _g = Guard { cond: self.cond };
             debug!("Trap: pushing handler to TLS");
index f89bb3b2f90646c993d6e40ce9fb690d7c873a4a..fac0866f17e762b808e856826971224a3d122c0e 100644 (file)
@@ -10,6 +10,8 @@
 
 //! A type that represents one of two alternatives
 
+#[allow(missing_doc)];
+
 use container::Container;
 use cmp::Eq;
 use kinds::Copy;
@@ -137,29 +139,29 @@ pub fn unwrap_right<T,U>(eith: Either<T,U>) -> U {
     }
 }
 
-pub impl<T, U> Either<T, U> {
+impl<T, U> Either<T, U> {
     #[inline(always)]
-    fn either<V>(&self, f_left: &fn(&T) -> V, f_right: &fn(&U) -> V) -> V {
+    pub fn either<V>(&self, f_left: &fn(&T) -> V, f_right: &fn(&U) -> V) -> V {
         either(f_left, f_right, self)
     }
 
     #[inline(always)]
-    fn flip(self) -> Either<U, T> { flip(self) }
+    pub fn flip(self) -> Either<U, T> { flip(self) }
 
     #[inline(always)]
-    fn to_result(self) -> Result<U, T> { to_result(self) }
+    pub fn to_result(self) -> Result<U, T> { to_result(self) }
 
     #[inline(always)]
-    fn is_left(&self) -> bool { is_left(self) }
+    pub fn is_left(&self) -> bool { is_left(self) }
 
     #[inline(always)]
-    fn is_right(&self) -> bool { is_right(self) }
+    pub fn is_right(&self) -> bool { is_right(self) }
 
     #[inline(always)]
-    fn unwrap_left(self) -> T { unwrap_left(self) }
+    pub fn unwrap_left(self) -> T { unwrap_left(self) }
 
     #[inline(always)]
-    fn unwrap_right(self) -> U { unwrap_right(self) }
+    pub fn unwrap_right(self) -> U { unwrap_right(self) }
 }
 
 #[test]
index 4826af20c69a1f6c9fccc59ccc7c7b936041f7f6..2d56707e2f67a5d38546b6a0500da504343aae32 100644 (file)
@@ -13,6 +13,8 @@
 //! The tables use a keyed hash with new random keys generated for each container, so the ordering
 //! of a set of keys in a hash table is randomized.
 
+#[mutable_doc];
+
 use container::{Container, Mutable, Map, Set};
 use cmp::{Eq, Equiv};
 use hash::Hash;
@@ -81,7 +83,7 @@ fn linear_map_with_capacity_and_keys<K:Eq + Hash,V>(
     }
 }
 
-priv impl<K:Hash + Eq,V> HashMap<K, V> {
+impl<K:Hash + Eq,V> HashMap<K, V> {
     #[inline(always)]
     fn to_bucket(&self, h: uint) -> uint {
         // A good hash function with entropy spread over all of the
@@ -403,20 +405,20 @@ fn pop(&mut self, k: &K) -> Option<V> {
     }
 }
 
-pub impl<K: Hash + Eq, V> HashMap<K, V> {
+impl<K: Hash + Eq, V> HashMap<K, V> {
     /// Create an empty HashMap
-    fn new() -> HashMap<K, V> {
+    pub fn new() -> HashMap<K, V> {
         HashMap::with_capacity(INITIAL_CAPACITY)
     }
 
     /// Create an empty HashMap with space for at least `n` elements in
     /// the hash table.
-    fn with_capacity(capacity: uint) -> HashMap<K, V> {
+    pub fn with_capacity(capacity: uint) -> HashMap<K, V> {
         linear_map_with_capacity(capacity)
     }
 
     /// Reserve space for at least `n` elements in the hash table.
-    fn reserve_at_least(&mut self, n: uint) {
+    pub fn reserve_at_least(&mut self, n: uint) {
         if n > self.buckets.len() {
             let buckets = n * 4 / 3 + 1;
             self.resize(uint::next_power_of_two(buckets));
@@ -425,7 +427,7 @@ fn reserve_at_least(&mut self, n: uint) {
 
     /// Return the value corresponding to the key in the map, or insert
     /// and return the value if it doesn't exist.
-    fn find_or_insert<'a>(&'a mut self, k: K, v: V) -> &'a V {
+    pub fn find_or_insert<'a>(&'a mut self, k: K, v: V) -> &'a V {
         if self.size >= self.resize_at {
             // n.b.: We could also do this after searching, so
             // that we do not resize if this call to insert is
@@ -453,7 +455,8 @@ fn find_or_insert<'a>(&'a mut self, k: K, v: V) -> &'a V {
 
     /// Return the value corresponding to the key in the map, or create,
     /// insert, and return a new value if it doesn't exist.
-    fn find_or_insert_with<'a>(&'a mut self, k: K, f: &fn(&K) -> V) -> &'a V {
+    pub fn find_or_insert_with<'a>(&'a mut self, k: K, f: &fn(&K) -> V)
+                                   -> &'a V {
         if self.size >= self.resize_at {
             // n.b.: We could also do this after searching, so
             // that we do not resize if this call to insert is
@@ -480,7 +483,9 @@ fn find_or_insert_with<'a>(&'a mut self, k: K, f: &fn(&K) -> V) -> &'a V {
         self.value_for_bucket(idx)
     }
 
-    fn consume(&mut self, f: &fn(K, V)) {
+    /// Calls a function on each element of a hash map, destroying the hash
+    /// map in the process.
+    pub fn consume(&mut self, f: &fn(K, V)) {
         let buckets = replace(&mut self.buckets,
                               vec::from_fn(INITIAL_CAPACITY, |_| None));
         self.size = 0;
@@ -495,7 +500,9 @@ fn consume(&mut self, f: &fn(K, V)) {
         }
     }
 
-    fn get<'a>(&'a self, k: &K) -> &'a V {
+    /// Retrieves a value for the given key, failing if the key is not
+    /// present.
+    pub fn get<'a>(&'a self, k: &K) -> &'a V {
         match self.find(k) {
             Some(v) => v,
             None => fail!("No entry found for key: %?", k),
@@ -504,7 +511,7 @@ fn get<'a>(&'a self, k: &K) -> &'a V {
 
     /// Return true if the map contains a value for the specified key,
     /// using equivalence
-    fn contains_key_equiv<Q:Hash + Equiv<K>>(&self, key: &Q) -> bool {
+    pub fn contains_key_equiv<Q:Hash + Equiv<K>>(&self, key: &Q) -> bool {
         match self.bucket_for_key_equiv(key) {
             FoundEntry(_) => {true}
             TableFull | FoundHole(_) => {false}
@@ -513,7 +520,8 @@ fn contains_key_equiv<Q:Hash + Equiv<K>>(&self, key: &Q) -> bool {
 
     /// Return the value corresponding to the key in the map, using
     /// equivalence
-    fn find_equiv<'a, Q:Hash + Equiv<K>>(&'a self, k: &Q) -> Option<&'a V> {
+    pub fn find_equiv<'a, Q:Hash + Equiv<K>>(&'a self, k: &Q)
+                                             -> Option<&'a V> {
         match self.bucket_for_key_equiv(k) {
             FoundEntry(idx) => Some(self.value_for_bucket(idx)),
             TableFull | FoundHole(_) => None,
@@ -521,14 +529,14 @@ fn find_equiv<'a, Q:Hash + Equiv<K>>(&'a self, k: &Q) -> Option<&'a V> {
     }
 }
 
-pub impl<K: Hash + Eq, V: Copy> HashMap<K, V> {
+impl<K: Hash + Eq, V: Copy> HashMap<K, V> {
     /// Like `find`, but returns a copy of the value.
-    fn find_copy(&self, k: &K) -> Option<V> {
+    pub fn find_copy(&self, k: &K) -> Option<V> {
         self.find(k).map_consume(|v| copy *v)
     }
 
     /// Like `get`, but returns a copy of the value.
-    fn get_copy(&self, k: &K) -> V {
+    pub fn get_copy(&self, k: &K) -> V {
         copy *self.get(k)
     }
 }
@@ -632,29 +640,31 @@ fn union(&self, other: &HashSet<T>, f: &fn(&T) -> bool) -> bool {
     }
 }
 
-pub impl <T:Hash + Eq> HashSet<T> {
+impl<T:Hash + Eq> HashSet<T> {
     /// Create an empty HashSet
-    fn new() -> HashSet<T> {
+    pub fn new() -> HashSet<T> {
         HashSet::with_capacity(INITIAL_CAPACITY)
     }
 
     /// Create an empty HashSet with space for at least `n` elements in
     /// the hash table.
-    fn with_capacity(capacity: uint) -> HashSet<T> {
+    pub fn with_capacity(capacity: uint) -> HashSet<T> {
         HashSet { map: HashMap::with_capacity(capacity) }
     }
 
     /// Reserve space for at least `n` elements in the hash table.
-    fn reserve_at_least(&mut self, n: uint) {
+    pub fn reserve_at_least(&mut self, n: uint) {
         self.map.reserve_at_least(n)
     }
 
     /// Consumes all of the elements in the set, emptying it out
-    fn consume(&mut self, f: &fn(T)) {
+    pub fn consume(&mut self, f: &fn(T)) {
         self.map.consume(|k, _| f(k))
     }
 
-    fn contains_equiv<Q:Hash + Equiv<T>>(&self, value: &Q) -> bool {
+    /// Returns true if the hash set contains a value equivalent to the
+    /// given query value.
+    pub fn contains_equiv<Q:Hash + Equiv<T>>(&self, value: &Q) -> bool {
       self.map.contains_key_equiv(value)
     }
 }
index ee6e37aeb783ee13f94972b7e747796bd8f51f86..b9d04edd8a3b00e27d1b65517289e42a1c1bc8aa 100644 (file)
@@ -145,21 +145,20 @@ fn flat_map_to_vec<B,IB:BaseIter<B>>(&self, op: &fn(&A) -> IB)
     }
 }
 
-pub impl<T> Option<T> {
+impl<T> Option<T> {
     /// Returns true if the option equals `none`
-    fn is_none(&const self) -> bool {
+    pub fn is_none(&const self) -> bool {
         match *self { None => true, Some(_) => false }
     }
 
     /// Returns true if the option contains some value
     #[inline(always)]
-    fn is_some(&const self) -> bool { !self.is_none() }
+    pub fn is_some(&const self) -> bool { !self.is_none() }
 
     /// Update an optional value by optionally running its content through a
     /// function that returns an option.
     #[inline(always)]
-    fn chain<U>(self, f: &fn(t: T) -> Option<U>) -> Option<U> {
-
+    pub fn chain<U>(self, f: &fn(t: T) -> Option<U>) -> Option<U> {
         match self {
             Some(t) => f(t),
             None => None
@@ -168,7 +167,7 @@ fn chain<U>(self, f: &fn(t: T) -> Option<U>) -> Option<U> {
 
     /// Returns the leftmost Some() value, or None if both are None.
     #[inline(always)]
-    fn or(self, optb: Option<T>) -> Option<T> {
+    pub fn or(self, optb: Option<T>) -> Option<T> {
         match self {
             Some(opta) => Some(opta),
             _ => optb
@@ -178,45 +177,49 @@ fn or(self, optb: Option<T>) -> Option<T> {
     /// Update an optional value by optionally running its content by reference
     /// through a function that returns an option.
     #[inline(always)]
-    fn chain_ref<'a, U>(&'a self, f: &fn(x: &'a T) -> Option<U>) -> Option<U> {
-        match *self { Some(ref x) => f(x), None => None }
+    pub fn chain_ref<'a, U>(&'a self, f: &fn(x: &'a T) -> Option<U>)
+                            -> Option<U> {
+        match *self {
+            Some(ref x) => f(x),
+            None => None
+        }
     }
 
     /// Maps a `some` value from one type to another by reference
     #[inline(always)]
-    fn map<'a, U>(&self, f: &fn(&'a T) -> U) -> Option<U> {
+    pub fn map<'a, U>(&self, f: &fn(&'a T) -> U) -> Option<U> {
         match *self { Some(ref x) => Some(f(x)), None => None }
     }
 
     /// As `map`, but consumes the option and gives `f` ownership to avoid
     /// copying.
     #[inline(always)]
-    fn map_consume<U>(self, f: &fn(v: T) -> U) -> Option<U> {
+    pub fn map_consume<U>(self, f: &fn(v: T) -> U) -> Option<U> {
         match self { None => None, Some(v) => Some(f(v)) }
     }
 
     /// Applies a function to the contained value or returns a default
     #[inline(always)]
-    fn map_default<'a, U>(&'a self, def: U, f: &fn(&'a T) -> U) -> U {
+    pub fn map_default<'a, U>(&'a self, def: U, f: &fn(&'a T) -> U) -> U {
         match *self { None => def, Some(ref t) => f(t) }
     }
 
     /// As `map_default`, but consumes the option and gives `f`
     /// ownership to avoid copying.
     #[inline(always)]
-    fn map_consume_default<U>(self, def: U, f: &fn(v: T) -> U) -> U {
+    pub fn map_consume_default<U>(self, def: U, f: &fn(v: T) -> U) -> U {
         match self { None => def, Some(v) => f(v) }
     }
 
     /// Apply a function to the contained value or do nothing
-    fn mutate(&mut self, f: &fn(T) -> T) {
+    pub fn mutate(&mut self, f: &fn(T) -> T) {
         if self.is_some() {
             *self = Some(f(self.swap_unwrap()));
         }
     }
 
     /// Apply a function to the contained value or set it to a default
-    fn mutate_default(&mut self, def: T, f: &fn(T) -> T) {
+    pub fn mutate_default(&mut self, def: T, f: &fn(T) -> T) {
         if self.is_some() {
             *self = Some(f(self.swap_unwrap()));
         } else {
@@ -239,7 +242,7 @@ fn mutate_default(&mut self, def: T, f: &fn(T) -> T) {
     case explicitly.
      */
     #[inline(always)]
-    fn get_ref<'a>(&'a self) -> &'a T {
+    pub fn get_ref<'a>(&'a self) -> &'a T {
         match *self {
           Some(ref x) => x,
           None => fail!("option::get_ref none")
@@ -261,7 +264,7 @@ fn get_ref<'a>(&'a self) -> &'a T {
     case explicitly.
      */
     #[inline(always)]
-    fn get_mut_ref<'a>(&'a mut self) -> &'a mut T {
+    pub fn get_mut_ref<'a>(&'a mut self) -> &'a mut T {
         match *self {
           Some(ref mut x) => x,
           None => fail!("option::get_mut_ref none")
@@ -269,7 +272,7 @@ fn get_mut_ref<'a>(&'a mut self) -> &'a mut T {
     }
 
     #[inline(always)]
-    fn unwrap(self) -> T {
+    pub fn unwrap(self) -> T {
         /*!
         Moves a value out of an option type and returns it.
 
@@ -301,7 +304,7 @@ fn unwrap(self) -> T {
      * Fails if the value equals `None`.
      */
     #[inline(always)]
-    fn swap_unwrap(&mut self) -> T {
+    pub fn swap_unwrap(&mut self) -> T {
         if self.is_none() { fail!("option::swap_unwrap none") }
         util::replace(self, None).unwrap()
     }
@@ -315,7 +318,7 @@ fn swap_unwrap(&mut self) -> T {
      * Fails if the value equals `none`
      */
     #[inline(always)]
-    fn expect(self, reason: &str) -> T {
+    pub fn expect(self, reason: &str) -> T {
         match self {
           Some(val) => val,
           None => fail!(reason.to_owned()),
@@ -323,7 +326,7 @@ fn expect(self, reason: &str) -> T {
     }
 }
 
-pub impl<T:Copy> Option<T> {
+impl<T:Copy> Option<T> {
     /**
     Gets the value out of an option
 
@@ -339,7 +342,7 @@ pub impl<T:Copy> Option<T> {
     case explicitly.
     */
     #[inline(always)]
-    fn get(self) -> T {
+    pub fn get(self) -> T {
         match self {
           Some(x) => return x,
           None => fail!("option::get none")
@@ -348,13 +351,13 @@ fn get(self) -> T {
 
     /// Returns the contained value or a default
     #[inline(always)]
-    fn get_or_default(self, def: T) -> T {
+    pub fn get_or_default(self, def: T) -> T {
         match self { Some(x) => x, None => def }
     }
 
     /// Applies a function zero or more times until the result is none.
     #[inline(always)]
-    fn while_some(self, blk: &fn(v: T) -> Option<T>) {
+    pub fn while_some(self, blk: &fn(v: T) -> Option<T>) {
         let mut opt = self;
         while opt.is_some() {
             opt = blk(opt.unwrap());
@@ -362,11 +365,14 @@ fn while_some(self, blk: &fn(v: T) -> Option<T>) {
     }
 }
 
-pub impl<T:Copy + Zero> Option<T> {
+impl<T:Copy + Zero> Option<T> {
     /// Returns the contained value or zero (for this type)
     #[inline(always)]
-    fn get_or_zero(self) -> T {
-        match self { Some(x) => x, None => Zero::zero() }
+    pub fn get_or_zero(self) -> T {
+        match self {
+            Some(x) => x,
+            None => Zero::zero()
+        }
     }
 }
 
index 9eb7b54f009a7d18e7f16d42f26bb55928feae42..a551b9bf3c0b3e3b5e07215790fd26a81ce5479e 100644 (file)
@@ -308,8 +308,8 @@ pub fn default_stat() -> libc::stat {
 }
 
 
-pub impl Path {
-    fn stat(&self) -> Option<libc::stat> {
+impl Path {
+    pub fn stat(&self) -> Option<libc::stat> {
         unsafe {
              do str::as_c_str(self.to_str()) |buf| {
                 let mut st = stat::arch::default_stat();
@@ -322,7 +322,7 @@ fn stat(&self) -> Option<libc::stat> {
     }
 
     #[cfg(unix)]
-    fn lstat(&self) -> Option<libc::stat> {
+    pub fn lstat(&self) -> Option<libc::stat> {
         unsafe {
             do str::as_c_str(self.to_str()) |buf| {
                 let mut st = stat::arch::default_stat();
@@ -334,21 +334,21 @@ fn lstat(&self) -> Option<libc::stat> {
         }
     }
 
-    fn exists(&self) -> bool {
+    pub fn exists(&self) -> bool {
         match self.stat() {
             None => false,
             Some(_) => true,
         }
     }
 
-    fn get_size(&self) -> Option<i64> {
+    pub fn get_size(&self) -> Option<i64> {
         match self.stat() {
             None => None,
             Some(ref st) => Some(st.st_size as i64),
         }
     }
 
-    fn get_mode(&self) -> Option<uint> {
+    pub fn get_mode(&self) -> Option<uint> {
         match self.stat() {
             None => None,
             Some(ref st) => Some(st.st_mode as uint),
@@ -359,8 +359,8 @@ fn get_mode(&self) -> Option<uint> {
 #[cfg(target_os = "freebsd")]
 #[cfg(target_os = "linux")]
 #[cfg(target_os = "macos")]
-pub impl Path {
-    fn get_atime(&self) -> Option<(i64, int)> {
+impl Path {
+    pub fn get_atime(&self) -> Option<(i64, int)> {
         match self.stat() {
             None => None,
             Some(ref st) => {
@@ -370,7 +370,7 @@ fn get_atime(&self) -> Option<(i64, int)> {
         }
     }
 
-    fn get_mtime(&self) -> Option<(i64, int)> {
+    pub fn get_mtime(&self) -> Option<(i64, int)> {
         match self.stat() {
             None => None,
             Some(ref st) => {
@@ -380,7 +380,7 @@ fn get_mtime(&self) -> Option<(i64, int)> {
         }
     }
 
-    fn get_ctime(&self) -> Option<(i64, int)> {
+    pub fn get_ctime(&self) -> Option<(i64, int)> {
         match self.stat() {
             None => None,
             Some(ref st) => {
@@ -393,8 +393,8 @@ fn get_ctime(&self) -> Option<(i64, int)> {
 
 #[cfg(target_os = "freebsd")]
 #[cfg(target_os = "macos")]
-pub impl Path {
-    fn get_birthtime(&self) -> Option<(i64, int)> {
+impl Path {
+    pub fn get_birthtime(&self) -> Option<(i64, int)> {
         match self.stat() {
             None => None,
             Some(ref st) => {
@@ -406,8 +406,8 @@ fn get_birthtime(&self) -> Option<(i64, int)> {
 }
 
 #[cfg(target_os = "win32")]
-pub impl Path {
-    fn get_atime(&self) -> Option<(i64, int)> {
+impl Path {
+    pub fn get_atime(&self) -> Option<(i64, int)> {
         match self.stat() {
             None => None,
             Some(ref st) => {
@@ -416,7 +416,7 @@ fn get_atime(&self) -> Option<(i64, int)> {
         }
     }
 
-    fn get_mtime(&self) -> Option<(i64, int)> {
+    pub fn get_mtime(&self) -> Option<(i64, int)> {
         match self.stat() {
             None => None,
             Some(ref st) => {
@@ -425,7 +425,7 @@ fn get_mtime(&self) -> Option<(i64, int)> {
         }
     }
 
-    fn get_ctime(&self) -> Option<(i64, int)> {
+    pub fn get_ctime(&self) -> Option<(i64, int)> {
         match self.stat() {
             None => None,
             Some(ref st) => {
index 5fbf97dccc8771891ac4d4ada5a0237b1cb97349..9607d395151dafebc6fb9ea83bed9df1b8551c10 100644 (file)
@@ -152,16 +152,16 @@ pub fn PacketHeader() -> PacketHeader {
     }
 }
 
-pub impl PacketHeader {
+impl PacketHeader {
     // Returns the old state.
-    unsafe fn mark_blocked(&mut self, this: *rust_task) -> State {
+    pub unsafe fn mark_blocked(&mut self, this: *rust_task) -> State {
         rustrt::rust_task_ref(this);
         let old_task = swap_task(&mut self.blocked_task, this);
         assert!(old_task.is_null());
         swap_state_acq(&mut self.state, Blocked)
     }
 
-    unsafe fn unblock(&mut self) {
+    pub unsafe fn unblock(&mut self) {
         let old_task = swap_task(&mut self.blocked_task, ptr::null());
         if !old_task.is_null() {
             rustrt::rust_task_deref(old_task)
@@ -176,12 +176,12 @@ unsafe fn unblock(&mut self) {
     // unsafe because this can do weird things to the space/time
     // continuum. It ends making multiple unique pointers to the same
     // thing. You'll probably want to forget them when you're done.
-    unsafe fn buf_header(&mut self) -> ~BufferHeader {
+    pub unsafe fn buf_header(&mut self) -> ~BufferHeader {
         assert!(self.buffer.is_not_null());
         transmute_copy(&self.buffer)
     }
 
-    fn set_buffer<T:Owned>(&mut self, b: ~Buffer<T>) {
+    pub fn set_buffer<T:Owned>(&mut self, b: ~Buffer<T>) {
         unsafe {
             self.buffer = transmute_copy(&b);
         }
@@ -694,12 +694,12 @@ pub fn SendPacketBuffered<T,Tbuffer>(p: *mut Packet<T>)
     }
 }
 
-pub impl<T,Tbuffer> SendPacketBuffered<T,Tbuffer> {
-    fn unwrap(&mut self) -> *mut Packet<T> {
+impl<T,Tbuffer> SendPacketBuffered<T,Tbuffer> {
+    pub fn unwrap(&mut self) -> *mut Packet<T> {
         replace(&mut self.p, None).unwrap()
     }
 
-    fn header(&mut self) -> *mut PacketHeader {
+    pub fn header(&mut self) -> *mut PacketHeader {
         match self.p {
             Some(packet) => unsafe {
                 let packet = &mut *packet;
@@ -710,7 +710,7 @@ fn header(&mut self) -> *mut PacketHeader {
         }
     }
 
-    fn reuse_buffer(&mut self) -> BufferResource<Tbuffer> {
+    pub fn reuse_buffer(&mut self) -> BufferResource<Tbuffer> {
         //error!("send reuse_buffer");
         replace(&mut self.buffer, None).unwrap()
     }
@@ -742,12 +742,12 @@ fn finalize(&self) {
     }
 }
 
-pub impl<T:Owned,Tbuffer:Owned> RecvPacketBuffered<T, Tbuffer> {
-    fn unwrap(&mut self) -> *mut Packet<T> {
+impl<T:Owned,Tbuffer:Owned> RecvPacketBuffered<T, Tbuffer> {
+    pub fn unwrap(&mut self) -> *mut Packet<T> {
         replace(&mut self.p, None).unwrap()
     }
 
-    fn reuse_buffer(&mut self) -> BufferResource<Tbuffer> {
+    pub fn reuse_buffer(&mut self) -> BufferResource<Tbuffer> {
         replace(&mut self.buffer, None).unwrap()
     }
 }
index 07a5acbdde5579440a80d823a3cae1dc792b3d50..40d1744f0fb1e255db6d63fec7e5e3631e0048d3 100644 (file)
@@ -612,9 +612,9 @@ pub struct IsaacRng {
     priv c: u32
 }
 
-pub impl IsaacRng {
+impl IsaacRng {
     /// Create an ISAAC random number generator with a random seed.
-    fn new() -> IsaacRng {
+    pub fn new() -> IsaacRng {
         IsaacRng::new_seeded(seed())
     }
 
@@ -623,7 +623,7 @@ fn new() -> IsaacRng {
     /// will be silently ignored. A generator constructed with a given seed
     /// will generate the same sequence of values as all other generators
     /// constructed with the same seed.
-    fn new_seeded(seed: &[u8]) -> IsaacRng {
+    pub fn new_seeded(seed: &[u8]) -> IsaacRng {
         let mut rng = IsaacRng {
             cnt: 0,
             rsl: [0, .. RAND_SIZE],
@@ -643,7 +643,7 @@ fn new_seeded(seed: &[u8]) -> IsaacRng {
 
     /// Create an ISAAC random number generator using the default
     /// fixed seed.
-    fn new_unseeded() -> IsaacRng {
+    pub fn new_unseeded() -> IsaacRng {
         let mut rng = IsaacRng {
             cnt: 0,
             rsl: [0, .. RAND_SIZE],
@@ -657,7 +657,7 @@ fn new_unseeded() -> IsaacRng {
     /// Initialises `self`. If `use_rsl` is true, then use the current value
     /// of `rsl` as a seed, otherwise construct one algorithmically (not
     /// randomly).
-    priv fn init(&mut self, use_rsl: bool) {
+    fn init(&mut self, use_rsl: bool) {
         macro_rules! init_mut_many (
             ($( $var:ident ),* = $val:expr ) => {
                 let mut $( $var = $val ),*;
@@ -715,7 +715,7 @@ macro_rules! memloop (
 
     /// Refills the output buffer (`self.rsl`)
     #[inline]
-    priv fn isaac(&mut self) {
+    fn isaac(&mut self) {
         self.c += 1;
         // abbreviations
         let mut a = self.a, b = self.b + self.c;
@@ -795,9 +795,9 @@ pub fn next(&mut self) -> u32 {
     }
 }
 
-pub impl XorShiftRng {
+impl XorShiftRng {
     /// Create an xor shift random number generator with a default seed.
-    fn new() -> XorShiftRng {
+    pub fn new() -> XorShiftRng {
         // constants taken from http://en.wikipedia.org/wiki/Xorshift
         XorShiftRng::new_seeded(123456789u32,
                                 362436069u32,
@@ -807,10 +807,10 @@ fn new() -> XorShiftRng {
 
     /**
      * Create a random number generator using the specified seed. A generator
-     * constructed with a given seed will generate the same sequence of values as
-     * all other generators constructed with the same seed.
+     * constructed with a given seed will generate the same sequence of values
+     * as all other generators constructed with the same seed.
      */
-    fn new_seeded(x: u32, y: u32, z: u32, w: u32) -> XorShiftRng {
+    pub fn new_seeded(x: u32, y: u32, z: u32, w: u32) -> XorShiftRng {
         XorShiftRng {
             x: x,
             y: y,
index cadfa71e7fa9ccb1a8c5dc52af4712dca910d33f..1eb3d3a0daaae8319c7efb6773c67879ad36d171 100644 (file)
@@ -48,28 +48,28 @@ pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
     MovePtrAdaptor { inner: v }
 }
 
-pub impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
+impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
     #[inline(always)]
-    fn bump(&self, sz: uint) {
-      do self.inner.move_ptr() |p| {
+    pub fn bump(&self, sz: uint) {
+        do self.inner.move_ptr() |p| {
             ((p as uint) + sz) as *c_void
-      };
+        };
     }
 
     #[inline(always)]
-    fn align(&self, a: uint) {
-      do self.inner.move_ptr() |p| {
+    pub fn align(&self, a: uint) {
+        do self.inner.move_ptr() |p| {
             align(p as uint, a) as *c_void
-      };
+        };
     }
 
     #[inline(always)]
-    fn align_to<T>(&self) {
+    pub fn align_to<T>(&self) {
         self.align(sys::min_align_of::<T>());
     }
 
     #[inline(always)]
-    fn bump_past<T>(&self) {
+    pub fn bump_past<T>(&self) {
         self.bump(sys::size_of::<T>());
     }
 }
index c50823f471ec12d7a2f1f35b9d403ee74ae965c5..14bec48782ff3abcb946c1f32676c22b79730466 100644 (file)
@@ -174,12 +174,11 @@ fn pop_ptr(&self) {
     }
 }
 
-pub impl ReprVisitor {
-
+impl ReprVisitor {
     // Various helpers for the TyVisitor impl
 
     #[inline(always)]
-    fn get<T>(&self, f: &fn(&T)) -> bool {
+    pub fn get<T>(&self, f: &fn(&T)) -> bool {
         unsafe {
             f(transmute::<*c_void,&T>(*self.ptr));
         }
@@ -187,12 +186,12 @@ fn get<T>(&self, f: &fn(&T)) -> bool {
     }
 
     #[inline(always)]
-    fn visit_inner(&self, inner: *TyDesc) -> bool {
+    pub fn visit_inner(&self, inner: *TyDesc) -> bool {
         self.visit_ptr_inner(*self.ptr, inner)
     }
 
     #[inline(always)]
-    fn visit_ptr_inner(&self, ptr: *c_void, inner: *TyDesc) -> bool {
+    pub fn visit_ptr_inner(&self, ptr: *c_void, inner: *TyDesc) -> bool {
         unsafe {
             let u = ReprVisitor(ptr, self.writer);
             let v = reflect::MovePtrAdaptor(u);
@@ -202,13 +201,13 @@ fn visit_ptr_inner(&self, ptr: *c_void, inner: *TyDesc) -> bool {
     }
 
     #[inline(always)]
-    fn write<T:Repr>(&self) -> bool {
+    pub fn write<T:Repr>(&self) -> bool {
         do self.get |v:&T| {
             v.write_repr(self.writer);
         }
     }
 
-    fn write_escaped_slice(&self, slice: &str) {
+    pub fn write_escaped_slice(&self, slice: &str) {
         self.writer.write_char('"');
         for slice.each_char |ch| {
             self.writer.write_escaped_char(ch);
@@ -216,7 +215,7 @@ fn write_escaped_slice(&self, slice: &str) {
         self.writer.write_char('"');
     }
 
-    fn write_mut_qualifier(&self, mtbl: uint) {
+    pub fn write_mut_qualifier(&self, mtbl: uint) {
         if mtbl == 0 {
             self.writer.write_str("mut ");
         } else if mtbl == 1 {
@@ -227,8 +226,12 @@ fn write_mut_qualifier(&self, mtbl: uint) {
         }
     }
 
-    fn write_vec_range(&self, mtbl: uint, ptr: *u8, len: uint,
-                       inner: *TyDesc) -> bool {
+    pub fn write_vec_range(&self,
+                           mtbl: uint,
+                           ptr: *u8,
+                           len: uint,
+                           inner: *TyDesc)
+                           -> bool {
         let mut p = ptr;
         let end = ptr::offset(p, len);
         let (sz, al) = unsafe { ((*inner).size, (*inner).align) };
@@ -248,13 +251,14 @@ fn write_vec_range(&self, mtbl: uint, ptr: *u8, len: uint,
         true
     }
 
-    fn write_unboxed_vec_repr(&self, mtbl: uint, v: &UnboxedVecRepr,
-                              inner: *TyDesc) -> bool {
+    pub fn write_unboxed_vec_repr(&self,
+                                  mtbl: uint,
+                                  v: &UnboxedVecRepr,
+                                  inner: *TyDesc)
+                                  -> bool {
         self.write_vec_range(mtbl, ptr::to_unsafe_ptr(&v.data),
                              v.fill, inner)
     }
-
-
 }
 
 impl TyVisitor for ReprVisitor {
index 5b40b09e98e84f8c41de73676d4903617c09fd87..8f7a0015bcf155786d3ebe59b60615b203e0e05d 100644 (file)
@@ -10,7 +10,7 @@
 
 //! A type representing either success or failure
 
-// NB: transitionary, de-mode-ing.
+#[allow(missing_doc)];
 
 use cmp::Eq;
 use either;
@@ -227,55 +227,55 @@ pub fn map_err<T:Copy,E,F:Copy>(res: &Result<T, E>, op: &fn(&E) -> F)
     }
 }
 
-pub impl<T, E> Result<T, E> {
+impl<T, E> Result<T, E> {
     #[inline(always)]
-    fn get_ref<'a>(&'a self) -> &'a T { get_ref(self) }
+    pub fn get_ref<'a>(&'a self) -> &'a T { get_ref(self) }
 
     #[inline(always)]
-    fn is_ok(&self) -> bool { is_ok(self) }
+    pub fn is_ok(&self) -> bool { is_ok(self) }
 
     #[inline(always)]
-    fn is_err(&self) -> bool { is_err(self) }
+    pub fn is_err(&self) -> bool { is_err(self) }
 
     #[inline(always)]
-    fn iter(&self, f: &fn(&T)) { iter(self, f) }
+    pub fn iter(&self, f: &fn(&T)) { iter(self, f) }
 
     #[inline(always)]
-    fn iter_err(&self, f: &fn(&E)) { iter_err(self, f) }
+    pub fn iter_err(&self, f: &fn(&E)) { iter_err(self, f) }
 
     #[inline(always)]
-    fn unwrap(self) -> T { unwrap(self) }
+    pub fn unwrap(self) -> T { unwrap(self) }
 
     #[inline(always)]
-    fn unwrap_err(self) -> E { unwrap_err(self) }
+    pub fn unwrap_err(self) -> E { unwrap_err(self) }
 
     #[inline(always)]
-    fn chain<U>(self, op: &fn(T) -> Result<U,E>) -> Result<U,E> {
+    pub fn chain<U>(self, op: &fn(T) -> Result<U,E>) -> Result<U,E> {
         chain(self, op)
     }
 
     #[inline(always)]
-    fn chain_err<F>(self, op: &fn(E) -> Result<T,F>) -> Result<T,F> {
+    pub fn chain_err<F>(self, op: &fn(E) -> Result<T,F>) -> Result<T,F> {
         chain_err(self, op)
     }
 }
 
-pub impl<T:Copy,E> Result<T, E> {
+impl<T:Copy,E> Result<T, E> {
     #[inline(always)]
-    fn get(&self) -> T { get(self) }
+    pub fn get(&self) -> T { get(self) }
 
     #[inline(always)]
-    fn map_err<F:Copy>(&self, op: &fn(&E) -> F) -> Result<T,F> {
+    pub fn map_err<F:Copy>(&self, op: &fn(&E) -> F) -> Result<T,F> {
         map_err(self, op)
     }
 }
 
-pub impl<T, E: Copy> Result<T, E> {
+impl<T, E: Copy> Result<T, E> {
     #[inline(always)]
-    fn get_err(&self) -> E { get_err(self) }
+    pub fn get_err(&self) -> E { get_err(self) }
 
     #[inline(always)]
-    fn map<U:Copy>(&self, op: &fn(&T) -> U) -> Result<U,E> {
+    pub fn map<U:Copy>(&self, op: &fn(&T) -> U) -> Result<U,E> {
         map(self, op)
     }
 }
index 0d011ce42bab9e1a8bde2bcbd7f80bb943440e84..d5ca8473ceeac6913342f25ebda97b03949f8b52 100644 (file)
@@ -27,8 +27,8 @@ pub struct Context {
     regs: ~Registers
 }
 
-pub impl Context {
-    fn empty() -> Context {
+impl Context {
+    pub fn empty() -> Context {
         Context {
             start: None,
             regs: new_regs()
@@ -36,7 +36,7 @@ fn empty() -> Context {
     }
 
     /// Create a new context that will resume execution by running ~fn()
-    fn new(start: ~fn(), stack: &mut StackSegment) -> Context {
+    pub fn new(start: ~fn(), stack: &mut StackSegment) -> Context {
         // XXX: Putting main into a ~ so it's a thin pointer and can
         // be passed to the spawn function.  Another unfortunate
         // allocation
@@ -71,7 +71,7 @@ fn new(start: ~fn(), stack: &mut StackSegment) -> Context {
     saving the registers values of the executing thread to a Context
     then loading the registers from a previously saved Context.
     */
-    fn swap(out_context: &mut Context, in_context: &Context) {
+    pub fn swap(out_context: &mut Context, in_context: &Context) {
         let out_regs: &mut Registers = match out_context {
             &Context { regs: ~ref mut r, _ } => r
         };
index 2d9cdaddc8433db2a48e94b8c27c17630e8497fc..064eb63afc627d3752d0c22e457aab735dc13e92 100644 (file)
@@ -57,11 +57,10 @@ enum CleanupJob {
     GiveTask(~Coroutine, UnsafeTaskReceiver)
 }
 
-pub impl Scheduler {
+impl Scheduler {
+    pub fn in_task_context(&self) -> bool { self.current_task.is_some() }
 
-    fn in_task_context(&self) -> bool { self.current_task.is_some() }
-
-    fn new(event_loop: ~EventLoopObject) -> Scheduler {
+    pub fn new(event_loop: ~EventLoopObject) -> Scheduler {
 
         // Lazily initialize the runtime TLS key
         local_ptr::init_tls_key();
@@ -80,7 +79,7 @@ fn new(event_loop: ~EventLoopObject) -> Scheduler {
     // the scheduler itself doesn't have to call event_loop.run.
     // That will be important for embedding the runtime into external
     // event loops.
-    fn run(~self) -> ~Scheduler {
+    pub fn run(~self) -> ~Scheduler {
         assert!(!self.in_task_context());
 
         let mut self_sched = self;
@@ -107,7 +106,7 @@ fn run(~self) -> ~Scheduler {
     /// Pushes the task onto the work stealing queue and tells the event loop
     /// to run it later. Always use this instead of pushing to the work queue
     /// directly.
-    fn enqueue_task(&mut self, task: ~Coroutine) {
+    pub fn enqueue_task(&mut self, task: ~Coroutine) {
         self.work_queue.push(task);
         self.event_loop.callback(resume_task_from_queue);
 
@@ -119,7 +118,7 @@ fn resume_task_from_queue() {
 
     // * Scheduler-context operations
 
-    fn resume_task_from_queue(~self) {
+    pub fn resume_task_from_queue(~self) {
         assert!(!self.in_task_context());
 
         rtdebug!("looking in work queue for task to schedule");
@@ -141,7 +140,7 @@ fn resume_task_from_queue(~self) {
 
     /// Called by a running task to end execution, after which it will
     /// be recycled by the scheduler for reuse in a new task.
-    fn terminate_current_task(~self) {
+    pub fn terminate_current_task(~self) {
         assert!(self.in_task_context());
 
         rtdebug!("ending running task");
@@ -156,7 +155,7 @@ fn terminate_current_task(~self) {
         abort!("control reached end of task");
     }
 
-    fn schedule_new_task(~self, task: ~Coroutine) {
+    pub fn schedule_new_task(~self, task: ~Coroutine) {
         assert!(self.in_task_context());
 
         do self.switch_running_tasks_and_then(task) |last_task| {
@@ -167,7 +166,7 @@ fn schedule_new_task(~self, task: ~Coroutine) {
         }
     }
 
-    fn schedule_task(~self, task: ~Coroutine) {
+    pub fn schedule_task(~self, task: ~Coroutine) {
         assert!(self.in_task_context());
 
         do self.switch_running_tasks_and_then(task) |last_task| {
@@ -180,7 +179,7 @@ fn schedule_task(~self, task: ~Coroutine) {
 
     // Core scheduling ops
 
-    fn resume_task_immediately(~self, task: ~Coroutine) {
+    pub fn resume_task_immediately(~self, task: ~Coroutine) {
         let mut this = self;
         assert!(!this.in_task_context());
 
@@ -218,7 +217,7 @@ fn resume_task_immediately(~self, task: ~Coroutine) {
     /// The closure here is a *stack* closure that lives in the
     /// 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(~Coroutine)) {
+    pub fn deschedule_running_task_and_then(~self, f: &fn(~Coroutine)) {
         let mut this = self;
         assert!(this.in_task_context());
 
@@ -248,7 +247,9 @@ fn deschedule_running_task_and_then(~self, f: &fn(~Coroutine)) {
     /// Switch directly to another task, without going through the 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: ~Coroutine, f: &fn(~Coroutine)) {
+    pub fn switch_running_tasks_and_then(~self,
+                                         next_task: ~Coroutine,
+                                         f: &fn(~Coroutine)) {
         let mut this = self;
         assert!(this.in_task_context());
 
@@ -279,12 +280,12 @@ fn switch_running_tasks_and_then(~self, next_task: ~Coroutine, f: &fn(~Coroutine
 
     // * Other stuff
 
-    fn enqueue_cleanup_job(&mut self, job: CleanupJob) {
+    pub fn enqueue_cleanup_job(&mut self, job: CleanupJob) {
         assert!(self.cleanup_job.is_none());
         self.cleanup_job = Some(job);
     }
 
-    fn run_cleanup_job(&mut self) {
+    pub fn run_cleanup_job(&mut self) {
         rtdebug!("running cleanup job");
 
         assert!(self.cleanup_job.is_some());
@@ -305,9 +306,9 @@ fn run_cleanup_job(&mut self) {
     /// callers should first arrange for that task to be located in the
     /// Scheduler's current_task slot and set up the
     /// post-context-switch cleanup job.
-    fn get_contexts<'a>(&'a mut self) -> (&'a mut Context,
-                                          Option<&'a mut Context>,
-                                          Option<&'a mut Context>) {
+    pub fn get_contexts<'a>(&'a mut self) -> (&'a mut Context,
+                                              Option<&'a mut Context>,
+                                              Option<&'a mut Context>) {
         let last_task = match self.cleanup_job {
             Some(GiveTask(~ref task, _)) => {
                 Some(task)
@@ -349,14 +350,14 @@ pub struct Coroutine {
     task: ~Task
 }
 
-pub impl Coroutine {
-    fn new(stack_pool: &mut StackPool, start: ~fn()) -> Coroutine {
+impl Coroutine {
+    pub fn new(stack_pool: &mut StackPool, start: ~fn()) -> Coroutine {
         Coroutine::with_task(stack_pool, ~Task::new(), start)
     }
 
-    fn with_task(stack_pool: &mut StackPool,
-                  task: ~Task,
-                  start: ~fn()) -> Coroutine {
+    pub fn with_task(stack_pool: &mut StackPool,
+                     task: ~Task,
+                     start: ~fn()) -> Coroutine {
         let start = Coroutine::build_start_wrapper(start);
         let mut stack = stack_pool.take_segment(MIN_STACK_SIZE);
         // NB: Context holds a pointer to that ~fn
@@ -368,7 +369,7 @@ fn with_task(stack_pool: &mut StackPool,
         };
     }
 
-    priv fn build_start_wrapper(start: ~fn()) -> ~fn() {
+    fn build_start_wrapper(start: ~fn()) -> ~fn() {
         // XXX: The old code didn't have this extra allocation
         let wrapper: ~fn() = || {
             // This is the first code to execute after the initial
@@ -391,7 +392,7 @@ fn with_task(stack_pool: &mut StackPool,
     }
 
     /// Destroy the task and try to reuse its components
-    fn recycle(~self, stack_pool: &mut StackPool) {
+    pub fn recycle(~self, stack_pool: &mut StackPool) {
         match self {
             ~Coroutine {current_stack_segment, _} => {
                 stack_pool.give_segment(current_stack_segment);
index ec56e65931c8182192d81fd6abe79f3cffd69eb0..fa4b8f30f4e7677cd6571c64b424c2323106da25 100644 (file)
@@ -19,8 +19,8 @@ pub struct StackSegment {
     valgrind_id: c_uint
 }
 
-pub impl StackSegment {
-    fn new(size: uint) -> StackSegment {
+impl StackSegment {
+    pub fn new(size: uint) -> StackSegment {
         unsafe {
             // Crate a block of uninitialized values
             let mut stack = vec::with_capacity(size);
@@ -38,12 +38,12 @@ fn new(size: uint) -> StackSegment {
     }
 
     /// Point to the low end of the allocated stack
-    fn start(&self) -> *uint {
-      vec::raw::to_ptr(self.buf) as *uint
+    pub fn start(&self) -> *uint {
+        vec::raw::to_ptr(self.buf) as *uint
     }
 
     /// Point one word beyond the high end of the allocated stack
-    fn end(&self) -> *uint {
+    pub fn end(&self) -> *uint {
         vec::raw::to_ptr(self.buf).offset(self.buf.len()) as *uint
     }
 }
index 0f1ae09bd944ba104e7e17dcae2c0a957202bcee..bc29019131078535259778ee244406967e236f7f 100644 (file)
@@ -19,8 +19,8 @@ pub struct Thread {
     raw_thread: *raw_thread
 }
 
-pub impl Thread {
-    fn start(main: ~fn()) -> Thread {
+impl Thread {
+    pub fn start(main: ~fn()) -> Thread {
         fn substart(main: &~fn()) -> *raw_thread {
             unsafe { rust_raw_thread_start(main) }
         }
index 2cf0b5c4872889d94e61e82dd1579b6eaeec1d68..e1def9ffd508bccf865fbf36ecd757d3c179ef65 100644 (file)
@@ -17,8 +17,8 @@
 pub struct IdleWatcher(*uvll::uv_idle_t);
 impl Watcher for IdleWatcher { }
 
-pub impl IdleWatcher {
-    fn new(loop_: &mut Loop) -> IdleWatcher {
+impl IdleWatcher {
+    pub fn new(loop_: &mut Loop) -> IdleWatcher {
         unsafe {
             let handle = uvll::idle_new();
             assert!(handle.is_not_null());
@@ -29,7 +29,7 @@ fn new(loop_: &mut Loop) -> IdleWatcher {
         }
     }
 
-    fn start(&mut self, cb: IdleCallback) {
+    pub fn start(&mut self, cb: IdleCallback) {
         {
             let data = self.get_watcher_data();
             data.idle_cb = Some(cb);
@@ -48,16 +48,17 @@ fn start(&mut self, cb: IdleCallback) {
         }
     }
 
-    fn stop(&mut self) {
-        // NB: Not resetting the Rust idle_cb to None here because `stop` is likely
-        // called from *within* the idle callback, causing a use after free
+    pub fn stop(&mut self) {
+        // NB: Not resetting the Rust idle_cb to None here because `stop` is
+        // likely called from *within* the idle callback, causing a use after
+        // free
 
         unsafe {
             assert!(0 == uvll::idle_stop(self.native_handle()));
         }
     }
 
-    fn close(self, cb: NullCallback) {
+    pub fn close(self, cb: NullCallback) {
         {
             let mut this = self;
             let data = this.get_watcher_data();
index 2bd657fd8641f466bc01998d52a2824ad026083c..bc968fc3d60641f842c36e1f7a157366d5e98d3d 100644 (file)
@@ -92,18 +92,18 @@ pub trait NativeHandle<T> {
     pub fn native_handle(&self) -> T;
 }
 
-pub impl Loop {
-    fn new() -> Loop {
+impl Loop {
+    pub fn new() -> Loop {
         let handle = unsafe { uvll::loop_new() };
         assert!(handle.is_not_null());
         NativeHandle::from_native_handle(handle)
     }
 
-    fn run(&mut self) {
+    pub fn run(&mut self) {
         unsafe { uvll::run(self.native_handle()) };
     }
 
-    fn close(&mut self) {
+    pub fn close(&mut self) {
         unsafe { uvll::loop_delete(self.native_handle()) };
     }
 }
@@ -193,9 +193,8 @@ pub fn drop_watcher_data(&mut self) {
 
 pub struct UvError(uvll::uv_err_t);
 
-pub impl UvError {
-
-    fn name(&self) -> ~str {
+impl UvError {
+    pub fn name(&self) -> ~str {
         unsafe {
             let inner = match self { &UvError(ref a) => a };
             let name_str = uvll::err_name(inner);
@@ -204,7 +203,7 @@ fn name(&self) -> ~str {
         }
     }
 
-    fn desc(&self) -> ~str {
+    pub fn desc(&self) -> ~str {
         unsafe {
             let inner = match self { &UvError(ref a) => a };
             let desc_str = uvll::strerror(inner);
@@ -213,7 +212,7 @@ fn desc(&self) -> ~str {
         }
     }
 
-    fn is_eof(&self) -> bool {
+    pub fn is_eof(&self) -> bool {
         self.code == uvll::EOF
     }
 }
index 68b871e6b31184b4f234beb151e31248a848c515..563d7fd1e81a16a0389124d498f055eb08fa0606 100644 (file)
@@ -43,9 +43,8 @@ fn ip4_as_uv_ip4<T>(addr: IpAddr, f: &fn(*sockaddr_in) -> T) -> T {
 pub struct StreamWatcher(*uvll::uv_stream_t);
 impl Watcher for StreamWatcher { }
 
-pub impl StreamWatcher {
-
-    fn read_start(&mut self, alloc: AllocCallback, cb: ReadCallback) {
+impl StreamWatcher {
+    pub fn read_start(&mut self, alloc: AllocCallback, cb: ReadCallback) {
         {
             let data = self.get_watcher_data();
             data.alloc_cb = Some(alloc);
@@ -73,7 +72,7 @@ fn read_start(&mut self, alloc: AllocCallback, cb: ReadCallback) {
         }
     }
 
-    fn read_stop(&mut self) {
+    pub fn read_stop(&mut self) {
         // It would be nice to drop the alloc and read callbacks here,
         // but read_stop may be called from inside one of them and we
         // would end up freeing the in-use environment
@@ -81,7 +80,7 @@ fn read_stop(&mut self) {
         unsafe { uvll::read_stop(handle); }
     }
 
-    fn write(&mut self, buf: Buf, cb: ConnectionCallback) {
+    pub fn write(&mut self, buf: Buf, cb: ConnectionCallback) {
         {
             let data = self.get_watcher_data();
             assert!(data.write_cb.is_none());
@@ -110,7 +109,7 @@ fn write(&mut self, buf: Buf, cb: ConnectionCallback) {
         }
     }
 
-    fn accept(&mut self, stream: StreamWatcher) {
+    pub fn accept(&mut self, stream: StreamWatcher) {
         let self_handle = self.native_handle() as *c_void;
         let stream_handle = stream.native_handle() as *c_void;
         unsafe {
@@ -118,7 +117,7 @@ fn accept(&mut self, stream: StreamWatcher) {
         }
     }
 
-    fn close(self, cb: NullCallback) {
+    pub fn close(self, cb: NullCallback) {
         {
             let mut this = self;
             let data = this.get_watcher_data();
@@ -153,8 +152,8 @@ fn native_handle(&self) -> *uvll::uv_stream_t {
 pub struct TcpWatcher(*uvll::uv_tcp_t);
 impl Watcher for TcpWatcher { }
 
-pub impl TcpWatcher {
-    fn new(loop_: &mut Loop) -> TcpWatcher {
+impl TcpWatcher {
+    pub fn new(loop_: &mut Loop) -> TcpWatcher {
         unsafe {
             let handle = malloc_handle(UV_TCP);
             assert!(handle.is_not_null());
@@ -165,7 +164,7 @@ fn new(loop_: &mut Loop) -> TcpWatcher {
         }
     }
 
-    fn bind(&mut self, address: IpAddr) -> Result<(), UvError> {
+    pub fn bind(&mut self, address: IpAddr) -> Result<(), UvError> {
         match address {
             Ipv4(*) => {
                 do ip4_as_uv_ip4(address) |addr| {
@@ -183,7 +182,7 @@ fn bind(&mut self, address: IpAddr) -> Result<(), UvError> {
         }
     }
 
-    fn connect(&mut self, address: IpAddr, cb: ConnectionCallback) {
+    pub fn connect(&mut self, address: IpAddr, cb: ConnectionCallback) {
         unsafe {
             assert!(self.get_watcher_data().connect_cb.is_none());
             self.get_watcher_data().connect_cb = Some(cb);
@@ -216,7 +215,7 @@ fn connect(&mut self, address: IpAddr, cb: ConnectionCallback) {
         }
     }
 
-    fn listen(&mut self, cb: ConnectionCallback) {
+    pub fn listen(&mut self, cb: ConnectionCallback) {
         {
             let data = self.get_watcher_data();
             assert!(data.connect_cb.is_none());
@@ -240,7 +239,7 @@ fn listen(&mut self, cb: ConnectionCallback) {
         }
     }
 
-    fn as_stream(&self) -> StreamWatcher {
+    pub fn as_stream(&self) -> StreamWatcher {
         NativeHandle::from_native_handle(self.native_handle() as *uvll::uv_stream_t)
     }
 }
@@ -295,9 +294,8 @@ fn native_handle(&self) -> *uvll::uv_connect_t {
 
 impl Request for WriteRequest { }
 
-pub impl WriteRequest {
-
-    fn new() -> WriteRequest {
+impl WriteRequest {
+    pub fn new() -> WriteRequest {
         let write_handle = unsafe {
             malloc_req(UV_WRITE)
         };
@@ -306,14 +304,14 @@ fn new() -> WriteRequest {
         WriteRequest(write_handle)
     }
 
-    fn stream(&self) -> StreamWatcher {
+    pub fn stream(&self) -> StreamWatcher {
         unsafe {
             let stream_handle = uvll::get_stream_handle_from_write_req(self.native_handle());
             NativeHandle::from_native_handle(stream_handle)
         }
     }
 
-    fn delete(self) {
+    pub fn delete(self) {
         unsafe { free_req(self.native_handle() as *c_void) }
     }
 }
index cacd67314ebac9a0dde6ac6ca540120cc79b6cd5..1d4f65f1517f64ef81e25f308d21794b452766c0 100644 (file)
@@ -33,15 +33,15 @@ pub struct UvEventLoop {
     uvio: UvIoFactory
 }
 
-pub impl UvEventLoop {
-    fn new() -> UvEventLoop {
+impl UvEventLoop {
+    pub fn new() -> UvEventLoop {
         UvEventLoop {
             uvio: UvIoFactory(Loop::new())
         }
     }
 
     /// A convenience constructor
-    fn new_scheduler() -> Scheduler {
+    pub fn new_scheduler() -> Scheduler {
         Scheduler::new(~UvEventLoop::new())
     }
 }
@@ -57,7 +57,6 @@ fn finalize(&self) {
 }
 
 impl EventLoop for UvEventLoop {
-
     fn run(&mut self) {
         self.uvio.uv_loop().run();
     }
@@ -103,8 +102,8 @@ fn test_callback_run_once() {
 
 pub struct UvIoFactory(Loop);
 
-pub impl UvIoFactory {
-    fn uv_loop<'a>(&'a mut self) -> &'a mut Loop {
+impl UvIoFactory {
+    pub fn uv_loop<'a>(&'a mut self) -> &'a mut Loop {
         match self { &UvIoFactory(ref mut ptr) => ptr }
     }
 }
index 24bffd8d1cd2449afbbc3cd5e5dc63883a48721c..c7467364b4d9de930d385e635335fd5c8fed93a2 100644 (file)
@@ -29,15 +29,15 @@ pub struct UvEventLoop {
     uvio: UvIoFactory
 }
 
-pub impl UvEventLoop {
-    fn new() -> UvEventLoop {
+impl UvEventLoop {
+    pub fn new() -> UvEventLoop {
         UvEventLoop {
             uvio: UvIoFactory(Loop::new())
         }
     }
 
     /// A convenience constructor
-    fn new_scheduler() -> Scheduler {
+    pub fn new_scheduler() -> Scheduler {
         Scheduler::new(~UvEventLoop::new())
     }
 }
@@ -90,8 +90,8 @@ fn test_callback_run_once() {
 
 pub struct UvIoFactory(Loop);
 
-pub impl UvIoFactory {
-    fn uv_loop<'a>(&'a mut self) -> &'a mut Loop {
+impl UvIoFactory {
+    pub fn uv_loop<'a>(&'a mut self) -> &'a mut Loop {
         match self { &UvIoFactory(ref mut ptr) => ptr }
     }
 }
index 4671a45aaea3af8c3e78264f380917a4b40da15d..58d36113f0e35692abbc53ed0a150e8f05606063 100644 (file)
@@ -21,21 +21,21 @@ pub struct WorkQueue<T> {
     priv queue: ~Exclusive<~[T]>
 }
 
-pub impl<T: Owned> WorkQueue<T> {
-    fn new() -> WorkQueue<T> {
+impl<T: Owned> WorkQueue<T> {
+    pub fn new() -> WorkQueue<T> {
         WorkQueue {
             queue: ~exclusive(~[])
         }
     }
 
-    fn push(&mut self, value: T) {
+    pub fn push(&mut self, value: T) {
         unsafe {
             let value = Cell(value);
             self.queue.with(|q| q.unshift(value.take()) );
         }
     }
 
-    fn pop(&mut self) -> Option<T> {
+    pub fn pop(&mut self) -> Option<T> {
         unsafe {
             do self.queue.with |q| {
                 if !q.is_empty() {
@@ -47,7 +47,7 @@ fn pop(&mut self) -> Option<T> {
         }
     }
 
-    fn steal(&mut self) -> Option<T> {
+    pub fn steal(&mut self) -> Option<T> {
         unsafe {
             do self.queue.with |q| {
                 if !q.is_empty() {
@@ -59,7 +59,7 @@ fn steal(&mut self) -> Option<T> {
         }
     }
 
-    fn is_empty(&self) -> bool {
+    pub fn is_empty(&self) -> bool {
         unsafe {
             self.queue.with_imm(|q| q.is_empty() )
         }
index de1148e431b8475b37d59ba3aed8c22b1849e702..07b521d019766322358b646ed1818cafdf492179 100644 (file)
@@ -136,8 +136,7 @@ pub struct ProcessOutput {
     error: ~[u8],
 }
 
-pub impl Process {
-
+impl Process {
     /**
      * Spawns a new Process.
      *
@@ -148,8 +147,8 @@ pub impl Process {
      * * options - Options to configure the environment of the process,
      *             the working directory and the standard IO streams.
      */
-    pub fn new(prog: &str, args: &[~str], options: ProcessOptions) -> Process {
-
+    pub fn new(prog: &str, args: &[~str], options: ProcessOptions)
+               -> Process {
         let (in_pipe, in_fd) = match options.in_fd {
             None => {
                 let pipe = os::pipe();
@@ -192,9 +191,9 @@ pub fn new(prog: &str, args: &[~str], options: ProcessOptions) -> Process {
     }
 
     /// Returns the unique id of the process
-    fn get_id(&self) -> pid_t { self.pid }
+    pub fn get_id(&self) -> pid_t { self.pid }
 
-    priv fn input_fd(&mut self) -> c_int {
+    fn input_fd(&mut self) -> c_int {
         match self.input {
             Some(fd) => fd,
             None => fail!("This Process's stdin was redirected to an \
@@ -202,7 +201,7 @@ fn get_id(&self) -> pid_t { self.pid }
         }
     }
 
-    priv fn output_file(&mut self) -> *libc::FILE {
+    fn output_file(&mut self) -> *libc::FILE {
         match self.output {
             Some(file) => file,
             None => fail!("This Process's stdout was redirected to an \
@@ -210,7 +209,7 @@ fn get_id(&self) -> pid_t { self.pid }
         }
     }
 
-    priv fn error_file(&mut self) -> *libc::FILE {
+    fn error_file(&mut self) -> *libc::FILE {
         match self.error {
             Some(file) => file,
             None => fail!("This Process's stderr was redirected to an \
@@ -225,7 +224,7 @@ fn get_id(&self) -> pid_t { self.pid }
      *
      * If this method returns true then self.input() will fail.
      */
-    fn input_redirected(&self) -> bool {
+    pub fn input_redirected(&self) -> bool {
         self.input.is_none()
     }
 
@@ -236,7 +235,7 @@ fn input_redirected(&self) -> bool {
      *
      * If this method returns true then self.output() will fail.
      */
-    fn output_redirected(&self) -> bool {
+    pub fn output_redirected(&self) -> bool {
         self.output.is_none()
     }
 
@@ -247,7 +246,7 @@ fn output_redirected(&self) -> bool {
      *
      * If this method returns true then self.error() will fail.
      */
-    fn error_redirected(&self) -> bool {
+    pub fn error_redirected(&self) -> bool {
         self.error.is_none()
     }
 
@@ -256,7 +255,7 @@ fn error_redirected(&self) -> bool {
      *
      * Fails if this Process's stdin was redirected to an existing file descriptor.
      */
-    fn input(&mut self) -> @io::Writer {
+    pub fn input(&mut self) -> @io::Writer {
         // FIXME: the Writer can still be used after self is destroyed: #2625
        io::fd_writer(self.input_fd(), false)
     }
@@ -266,7 +265,7 @@ fn input(&mut self) -> @io::Writer {
      *
      * Fails if this Process's stdout was redirected to an existing file descriptor.
      */
-    fn output(&mut self) -> @io::Reader {
+    pub fn output(&mut self) -> @io::Reader {
         // FIXME: the Reader can still be used after self is destroyed: #2625
         io::FILE_reader(self.output_file(), false)
     }
@@ -276,7 +275,7 @@ fn output(&mut self) -> @io::Reader {
      *
      * Fails if this Process's stderr was redirected to an existing file descriptor.
      */
-    fn error(&mut self) -> @io::Reader {
+    pub fn error(&mut self) -> @io::Reader {
         // FIXME: the Reader can still be used after self is destroyed: #2625
         io::FILE_reader(self.error_file(), false)
     }
@@ -287,7 +286,7 @@ fn error(&mut self) -> @io::Reader {
      * If this process is reading its stdin from an existing file descriptor, then this
      * method does nothing.
      */
-    fn close_input(&mut self) {
+    pub fn close_input(&mut self) {
         match self.input {
             Some(-1) | None => (),
             Some(fd) => {
@@ -299,7 +298,7 @@ fn close_input(&mut self) {
         }
     }
 
-    priv fn close_outputs(&mut self) {
+    fn close_outputs(&mut self) {
         fclose_and_null(&mut self.output);
         fclose_and_null(&mut self.error);
 
@@ -322,7 +321,7 @@ fn fclose_and_null(f_opt: &mut Option<*libc::FILE>) {
      *
      * If the child has already been finished then the exit code is returned.
      */
-    fn finish(&mut self) -> int {
+    pub fn finish(&mut self) -> int {
         for self.exit_code.each |&code| {
             return code;
         }
@@ -342,8 +341,7 @@ fn finish(&mut self) -> int {
      * This method will fail if the child process's stdout or stderr streams were
      * redirected to existing file descriptors.
      */
-    fn finish_with_output(&mut self) -> ProcessOutput {
-
+    pub fn finish_with_output(&mut self) -> ProcessOutput {
         let output_file = self.output_file();
         let error_file = self.error_file();
 
@@ -378,8 +376,7 @@ fn finish_with_output(&mut self) -> ProcessOutput {
                               error: errs};
     }
 
-    priv fn destroy_internal(&mut self, force: bool) {
-
+    fn destroy_internal(&mut self, force: bool) {
         // if the process has finished, and therefore had waitpid called,
         // and we kill it, then on unix we might ending up killing a
         // newer process that happens to have the same (re-used) id
@@ -417,7 +414,7 @@ fn killpid(pid: pid_t, force: bool) {
      * On Posix OSs SIGTERM will be sent to the process. On Win32
      * TerminateProcess(..) will be called.
      */
-    fn destroy(&mut self) { self.destroy_internal(false); }
+    pub fn destroy(&mut self) { self.destroy_internal(false); }
 
     /**
      * Terminates the process as soon as possible without giving it a
@@ -426,7 +423,7 @@ fn killpid(pid: pid_t, force: bool) {
      * On Posix OSs SIGKILL will be sent to the process. On Win32
      * TerminateProcess(..) will be called.
      */
-    fn force_destroy(&mut self) { self.destroy_internal(true); }
+    pub fn force_destroy(&mut self) { self.destroy_internal(true); }
 }
 
 impl Drop for Process {
index e48fef01df941bd75e491f36d326f7646cbc748a..3b31d70f7a1bdd4af832482deb5dd05c9a7675d7 100644 (file)
 #[deriving(Clone, Eq)]
 pub struct Ascii { priv chr: u8 }
 
-pub impl Ascii {
+impl Ascii {
     /// Converts a ascii character into a `u8`.
     #[inline(always)]
-    fn to_byte(self) -> u8 {
+    pub fn to_byte(self) -> u8 {
         self.chr
     }
 
     /// Converts a ascii character into a `char`.
     #[inline(always)]
-    fn to_char(self) -> char {
+    pub fn to_char(self) -> char {
         self.chr as char
     }
 
     /// Convert to lowercase.
     #[inline(always)]
-    fn to_lower(self) -> Ascii {
+    pub fn to_lower(self) -> Ascii {
         if self.chr >= 65 && self.chr <= 90 {
             Ascii{chr: self.chr | 0x20 }
         } else {
@@ -46,7 +46,7 @@ fn to_lower(self) -> Ascii {
 
     /// Convert to uppercase.
     #[inline(always)]
-    fn to_upper(self) -> Ascii {
+    pub fn to_upper(self) -> Ascii {
         if self.chr >= 97 && self.chr <= 122 {
             Ascii{chr: self.chr & !0x20 }
         } else {
@@ -54,9 +54,9 @@ fn to_upper(self) -> Ascii {
         }
     }
 
-    // Compares two ascii characters of equality, ignoring case.
+    /// Compares two ascii characters of equality, ignoring case.
     #[inline(always)]
-    fn eq_ignore_case(self, other: Ascii) -> bool {
+    pub fn eq_ignore_case(self, other: Ascii) -> bool {
         self.to_lower().chr == other.to_lower().chr
     }
 }
index b68abca8605209d4031843875503972913351ccd..7c9639bb8f3cb9ce011687d14f64232506f84829 100644 (file)
@@ -202,7 +202,7 @@ pub fn task() -> TaskBuilder {
     }
 }
 
-priv impl TaskBuilder {
+impl TaskBuilder {
     fn consume(&mut self) -> TaskBuilder {
         if self.consumed {
             fail!("Cannot copy a task_builder"); // Fake move mode on self
@@ -224,24 +224,24 @@ fn consume(&mut self) -> TaskBuilder {
     }
 }
 
-pub impl TaskBuilder {
+impl TaskBuilder {
     /// Decouple the child task's failure from the parent's. If either fails,
     /// the other will not be killed.
-    fn unlinked(&mut self) {
+    pub fn unlinked(&mut self) {
         self.opts.linked = false;
     }
 
     /// Unidirectionally link the child task's failure with the parent's. The
     /// child's failure will not kill the parent, but the parent's will kill
     /// the child.
-    fn supervised(&mut self) {
+    pub fn supervised(&mut self) {
         self.opts.supervised = true;
         self.opts.linked = false;
     }
 
     /// Link the child task's and parent task's failures. If either fails, the
     /// other will be killed.
-    fn linked(&mut self) {
+    pub fn linked(&mut self) {
         self.opts.linked = true;
         self.opts.supervised = false;
     }
@@ -263,7 +263,7 @@ fn linked(&mut self) {
      * # Failure
      * Fails if a future_result was already set for this task.
      */
-    fn future_result(&mut self, blk: &fn(v: Port<TaskResult>)) {
+    pub fn future_result(&mut self, blk: &fn(v: Port<TaskResult>)) {
         // FIXME (#3725): Once linked failure and notification are
         // handled in the library, I can imagine implementing this by just
         // registering an arbitrary number of task::on_exit handlers and
@@ -283,7 +283,7 @@ fn future_result(&mut self, blk: &fn(v: Port<TaskResult>)) {
     }
 
     /// Configure a custom scheduler mode for the task.
-    fn sched_mode(&mut self, mode: SchedMode) {
+    pub fn sched_mode(&mut self, mode: SchedMode) {
         self.opts.sched.mode = mode;
     }
 
@@ -299,7 +299,7 @@ fn sched_mode(&mut self, mode: SchedMode) {
      * generator by applying the task body which results from the
      * existing body generator to the new body generator.
      */
-    fn add_wrapper(&mut self, wrapper: ~fn(v: ~fn()) -> ~fn()) {
+    pub fn add_wrapper(&mut self, wrapper: ~fn(v: ~fn()) -> ~fn()) {
         let prev_gen_body = replace(&mut self.gen_body, None);
         let prev_gen_body = match prev_gen_body {
             Some(gen) => gen,
@@ -331,7 +331,7 @@ fn add_wrapper(&mut self, wrapper: ~fn(v: ~fn()) -> ~fn()) {
      * When spawning into a new scheduler, the number of threads requested
      * must be greater than zero.
      */
-    fn spawn(&mut self, f: ~fn()) {
+    pub fn spawn(&mut self, f: ~fn()) {
         let gen_body = replace(&mut self.gen_body, None);
         let notify_chan = replace(&mut self.opts.notify_chan, None);
         let x = self.consume();
@@ -353,7 +353,7 @@ fn spawn(&mut self, f: ~fn()) {
     }
 
     /// Runs a task, while transfering ownership of one argument to the child.
-    fn spawn_with<A:Owned>(&mut self, arg: A, f: ~fn(v: A)) {
+    pub fn spawn_with<A:Owned>(&mut self, arg: A, f: ~fn(v: A)) {
         let arg = Cell(arg);
         do self.spawn {
             f(arg.take());
@@ -373,7 +373,7 @@ fn spawn_with<A:Owned>(&mut self, arg: A, f: ~fn(v: A)) {
      * # Failure
      * Fails if a future_result was already set for this task.
      */
-    fn try<T:Owned>(&mut self, f: ~fn() -> T) -> Result<T,()> {
+    pub fn try<T:Owned>(&mut self, f: ~fn() -> T) -> Result<T,()> {
         let (po, ch) = stream::<T>();
         let mut result = None;
 
index e5b1385974e237bc87854dc07e42908c16b3272d..aea03b437ca1392912a9090ccfcba453f76f2f9d 100644 (file)
@@ -145,28 +145,28 @@ fn pop(&mut self, key: &uint) -> Option<T> {
     }
 }
 
-pub impl<T> TrieMap<T> {
+impl<T> TrieMap<T> {
     /// Create an empty TrieMap
     #[inline(always)]
-    fn new() -> TrieMap<T> {
+    pub fn new() -> TrieMap<T> {
         TrieMap{root: TrieNode::new(), length: 0}
     }
 
     /// Visit all key-value pairs in reverse order
     #[inline(always)]
-    fn each_reverse<'a>(&'a self, f: &fn(&uint, &'a T) -> bool) -> bool {
+    pub fn each_reverse<'a>(&'a self, f: &fn(&uint, &'a T) -> bool) -> bool {
         self.root.each_reverse(f)
     }
 
     /// Visit all keys in reverse order
     #[inline(always)]
-    fn each_key_reverse(&self, f: &fn(&uint) -> bool) -> bool {
+    pub fn each_key_reverse(&self, f: &fn(&uint) -> bool) -> bool {
         self.each_reverse(|k, _| f(k))
     }
 
     /// Visit all values in reverse order
     #[inline(always)]
-    fn each_value_reverse(&self, f: &fn(&T) -> bool) -> bool {
+    pub fn each_value_reverse(&self, f: &fn(&T) -> bool) -> bool {
         self.each_reverse(|_, v| f(v))
     }
 }
@@ -208,28 +208,32 @@ impl Mutable for TrieSet {
     fn clear(&mut self) { self.map.clear() }
 }
 
-pub impl TrieSet {
+impl TrieSet {
     /// Create an empty TrieSet
     #[inline(always)]
-    fn new() -> TrieSet {
+    pub fn new() -> TrieSet {
         TrieSet{map: TrieMap::new()}
     }
 
     /// Return true if the set contains a value
     #[inline(always)]
-    fn contains(&self, value: &uint) -> bool {
+    pub fn contains(&self, value: &uint) -> bool {
         self.map.contains_key(value)
     }
 
     /// Add a value to the set. Return true if the value was not already
     /// present in the set.
     #[inline(always)]
-    fn insert(&mut self, value: uint) -> bool { self.map.insert(value, ()) }
+    pub fn insert(&mut self, value: uint) -> bool {
+        self.map.insert(value, ())
+    }
 
     /// Remove a value from the set. Return true if the value was
     /// present in the set.
     #[inline(always)]
-    fn remove(&mut self, value: &uint) -> bool { self.map.remove(value) }
+    pub fn remove(&mut self, value: &uint) -> bool {
+        self.map.remove(value)
+    }
 }
 
 struct TrieNode<T> {
index 8da378fdc97ce95ce0016848d9deb0fe9a808cf4..07bcf6d953c3a91d0b826c3759d748c6e8e1446d 100644 (file)
@@ -139,8 +139,8 @@ struct Parsed<T> {
         next: uint
     }
 
-    pub impl<T> Parsed<T> {
-        fn new(val: T, next: uint) -> Parsed<T> {
+    impl<T> Parsed<T> {
+        pub fn new(val: T, next: uint) -> Parsed<T> {
             Parsed {val: val, next: next}
         }
     }
index bee317a0b930e805665e308a2c28d0c0d9dce2df..f0b178c667013f7328b0ca50a2cdb06f68bf42d3 100644 (file)
@@ -117,9 +117,9 @@ fn LittleLock() -> LittleLock {
     }
 }
 
-pub impl LittleLock {
+impl LittleLock {
     #[inline(always)]
-    unsafe fn lock<T>(&self, f: &fn() -> T) -> T {
+    pub unsafe fn lock<T>(&self, f: &fn() -> T) -> T {
         do atomically {
             rust_lock_little_lock(self.l);
             do (|| {
@@ -162,7 +162,7 @@ fn clone(&self) -> Exclusive<T> {
     }
 }
 
-pub impl<T:Owned> Exclusive<T> {
+impl<T:Owned> Exclusive<T> {
     // Exactly like std::arc::mutex_arc,access(), but with the little_lock
     // instead of a proper mutex. Same reason for being unsafe.
     //
@@ -170,7 +170,7 @@ pub impl<T:Owned> Exclusive<T> {
     // accessing the provided condition variable) are prohibited while inside
     // the exclusive. Supporting that is a work in progress.
     #[inline(always)]
-    unsafe fn with<U>(&self, f: &fn(x: &mut T) -> U) -> U {
+    pub unsafe fn with<U>(&self, f: &fn(x: &mut T) -> U) -> U {
         let rec = self.x.get();
         do (*rec).lock.lock {
             if (*rec).failed {
@@ -184,7 +184,7 @@ unsafe fn with<U>(&self, f: &fn(x: &mut T) -> U) -> U {
     }
 
     #[inline(always)]
-    unsafe fn with_imm<U>(&self, f: &fn(x: &T) -> U) -> U {
+    pub unsafe fn with_imm<U>(&self, f: &fn(x: &T) -> U) -> U {
         do self.with |x| {
             f(cast::transmute_immut(x))
         }
index 21fbe2836cd68264e41de741abe91362a4b85a2c..e8e68ddd632e63c2c03c0e6619cf934dd7f60727 100644 (file)
@@ -90,9 +90,9 @@ pub fn NonCopyable() -> NonCopyable { NonCopyable { i: () } }
 /// A type with no inhabitants
 pub enum Void { }
 
-pub impl Void {
+impl Void {
     /// A utility function for ignoring this uninhabited type
-    fn uninhabited(self) -> ! {
+    pub fn uninhabited(self) -> ! {
         match self {
             // Nothing to match on
         }
index 2b8d8cb3d31dbcf25b7b48ec2a61b3fec19a45ab..75439dfaa786ca628c54ee9388f8c44c797416d4 100644 (file)
@@ -109,18 +109,18 @@ pub fn all_names() -> ~[&'static str] {
     AbiDatas.map(|d| d.name)
 }
 
-pub impl Abi {
+impl Abi {
     #[inline]
-    fn index(&self) -> uint {
+    pub fn index(&self) -> uint {
         *self as uint
     }
 
     #[inline]
-    fn data(&self) -> &'static AbiData {
+    pub fn data(&self) -> &'static AbiData {
         &AbiDatas[self.index()]
     }
 
-    fn name(&self) -> &'static str {
+    pub fn name(&self) -> &'static str {
         self.data().name
     }
 }
@@ -131,70 +131,70 @@ fn bit(&self) -> u32 {
     }
 }
 
-pub impl AbiSet {
-    fn from(abi: Abi) -> AbiSet {
+impl AbiSet {
+    pub fn from(abi: Abi) -> AbiSet {
         AbiSet { bits: (1 << abi.index()) }
     }
 
     #[inline]
-    fn Rust() -> AbiSet {
+    pub fn Rust() -> AbiSet {
         AbiSet::from(Rust)
     }
 
     #[inline]
-    fn C() -> AbiSet {
+    pub fn C() -> AbiSet {
         AbiSet::from(C)
     }
 
     #[inline]
-    fn Intrinsic() -> AbiSet {
+    pub fn Intrinsic() -> AbiSet {
         AbiSet::from(RustIntrinsic)
     }
 
-    fn default() -> AbiSet {
+    pub fn default() -> AbiSet {
         AbiSet::C()
     }
 
-    fn empty() -> AbiSet {
+    pub fn empty() -> AbiSet {
         AbiSet { bits: 0 }
     }
 
     #[inline]
-    fn is_rust(&self) -> bool {
+    pub fn is_rust(&self) -> bool {
         self.bits == 1 << Rust.index()
     }
 
     #[inline]
-    fn is_c(&self) -> bool {
+    pub fn is_c(&self) -> bool {
         self.bits == 1 << C.index()
     }
 
     #[inline]
-    fn is_intrinsic(&self) -> bool {
+    pub fn is_intrinsic(&self) -> bool {
         self.bits == 1 << RustIntrinsic.index()
     }
 
-    fn contains(&self, abi: Abi) -> bool {
+    pub fn contains(&self, abi: Abi) -> bool {
         (self.bits & (1 << abi.index())) != 0
     }
 
-    fn subset_of(&self, other_abi_set: AbiSet) -> bool {
+    pub fn subset_of(&self, other_abi_set: AbiSet) -> bool {
         (self.bits & other_abi_set.bits) == self.bits
     }
 
-    fn add(&mut self, abi: Abi) {
+    pub fn add(&mut self, abi: Abi) {
         self.bits |= (1 << abi.index());
     }
 
-    fn each(&self, op: &fn(abi: Abi) -> bool) -> bool {
+    pub fn each(&self, op: &fn(abi: Abi) -> bool) -> bool {
         each_abi(|abi| !self.contains(abi) || op(abi))
     }
 
-    fn is_empty(&self) -> bool {
+    pub fn is_empty(&self) -> bool {
         self.bits == 0
     }
 
-    fn for_arch(&self, arch: Architecture) -> Option<Abi> {
+    pub fn for_arch(&self, arch: Architecture) -> Option<Abi> {
         // NB---Single platform ABIs come first
         for self.each |abi| {
             let data = abi.data();
@@ -208,7 +208,7 @@ fn for_arch(&self, arch: Architecture) -> Option<Abi> {
         None
     }
 
-    fn check_valid(&self) -> Option<(Abi, Abi)> {
+    pub fn check_valid(&self) -> Option<(Abi, Abi)> {
         let mut abis = ~[];
         for self.each |abi| { abis.push(abi); }
 
index 676a57e38daa39080a9f8bc485aca4e3fff1d1f1..ac9734ebaa3bf9c7657077074877508cfc9e9ee1 100644 (file)
@@ -166,14 +166,14 @@ pub struct Generics {
     ty_params: OptVec<TyParam>
 }
 
-pub impl Generics {
-    fn is_parameterized(&self) -> bool {
+impl Generics {
+    pub fn is_parameterized(&self) -> bool {
         self.lifetimes.len() + self.ty_params.len() > 0
     }
-    fn is_lt_parameterized(&self) -> bool {
+    pub fn is_lt_parameterized(&self) -> bool {
         self.lifetimes.len() > 0
     }
-    fn is_type_parameterized(&self) -> bool {
+    pub fn is_type_parameterized(&self) -> bool {
         self.ty_params.len() > 0
     }
 }
index deff6dc5ba9667315549151bbf43346849913124..4da2d500dd84759efb38e104c8286c84b78c1442 100644 (file)
@@ -373,17 +373,19 @@ pub struct id_range {
     max: node_id,
 }
 
-pub impl id_range {
-    fn max() -> id_range {
-        id_range {min: int::max_value,
-                  max: int::min_value}
+impl id_range {
+    pub fn max() -> id_range {
+        id_range {
+            min: int::max_value,
+            max: int::min_value,
+        }
     }
 
-    fn empty(&self) -> bool {
+    pub fn empty(&self) -> bool {
         self.min >= self.max
     }
 
-    fn add(&mut self, id: node_id) {
+    pub fn add(&mut self, id: node_id) {
         self.min = int::min(self.min, id);
         self.max = int::max(self.max, id + 1);
     }
index aedf30127ad49f8220415aae652dc7eb67b43d7c..5f8d6e73cefab6846ce8da4c2535a37299236f19 100644 (file)
@@ -271,13 +271,13 @@ pub struct FileMap {
     multibyte_chars: @mut ~[MultiByteChar],
 }
 
-pub impl FileMap {
+impl FileMap {
     // EFFECT: register a start-of-line offset in the
     // table of line-beginnings.
     // UNCHECKED INVARIANT: these offsets must be added in the right
     // order and must be in the right places; there is shared knowledge
     // about what ends a line between this file and parse.rs
-    fn next_line(&self, pos: BytePos) {
+    pub fn next_line(&self, pos: BytePos) {
         // the new charpos must be > the last one (or it's the first one).
         let lines = &mut *self.lines;
         assert!((lines.len() == 0) || (lines[lines.len() - 1] < pos))
@@ -309,7 +309,7 @@ pub struct CodeMap {
     files: @mut ~[@FileMap]
 }
 
-pub impl CodeMap {
+impl CodeMap {
     pub fn new() -> CodeMap {
         CodeMap {
             files: @mut ~[],
@@ -317,16 +317,15 @@ pub fn new() -> CodeMap {
     }
 
     /// Add a new FileMap to the CodeMap and return it
-    fn new_filemap(&self, filename: FileName, src: @~str) -> @FileMap {
+    pub fn new_filemap(&self, filename: FileName, src: @~str) -> @FileMap {
         return self.new_filemap_w_substr(filename, FssNone, src);
     }
 
-    fn new_filemap_w_substr(
-        &self,
-        filename: FileName,
-        substr: FileSubstr,
-        src: @~str
-    ) -> @FileMap {
+    pub fn new_filemap_w_substr(&self,
+                                filename: FileName,
+                                substr: FileSubstr,
+                                src: @~str)
+                                -> @FileMap {
         let files = &mut *self.files;
         let start_pos = if files.len() == 0 {
             0
@@ -359,8 +358,7 @@ pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
         return self.lookup_pos(pos);
     }
 
-    pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt
-    {
+    pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt {
         let loc = self.lookup_char_pos(pos);
         match (loc.file.substr) {
             FssNone =>
@@ -430,11 +428,9 @@ pub fn get_filemap(&self, filename: ~str) -> @FileMap {
         //      (or expected function, found _|_)
         fail!(); // ("asking for " + filename + " which we don't know about");
     }
-
 }
 
-priv impl CodeMap {
-
+impl CodeMap {
     fn lookup_filemap_idx(&self, pos: BytePos) -> uint {
         let files = &*self.files;
         let len = files.len();
index a9b12c16b31181259539d4ac4b8776a17e1b1bc5..5fae6ff3c18b01cc1bf28cb9989b71501fbcb81a 100644 (file)
@@ -219,8 +219,9 @@ pub struct ExtCtxt {
     trace_mac: @mut bool
 }
 
-pub impl ExtCtxt {
-    fn new(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg) -> @ExtCtxt {
+impl ExtCtxt {
+    pub fn new(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg)
+               -> @ExtCtxt {
         @ExtCtxt {
             parse_sess: parse_sess,
             cfg: cfg,
@@ -230,21 +231,21 @@ fn new(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg) -> @ExtCtxt {
         }
     }
 
-    fn codemap(&self) -> @CodeMap { self.parse_sess.cm }
-    fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess }
-    fn cfg(&self) -> ast::crate_cfg { copy self.cfg }
-    fn call_site(&self) -> span {
+    pub fn codemap(&self) -> @CodeMap { self.parse_sess.cm }
+    pub fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess }
+    pub fn cfg(&self) -> ast::crate_cfg { copy self.cfg }
+    pub fn call_site(&self) -> span {
         match *self.backtrace {
             Some(@ExpandedFrom(CallInfo {call_site: cs, _})) => cs,
             None => self.bug("missing top span")
         }
     }
-    fn print_backtrace(&self) { }
-    fn backtrace(&self) -> Option<@ExpnInfo> { *self.backtrace }
-    fn mod_push(&self, i: ast::ident) { self.mod_path.push(i); }
-    fn mod_pop(&self) { self.mod_path.pop(); }
-    fn mod_path(&self) -> ~[ast::ident] { copy *self.mod_path }
-    fn bt_push(&self, ei: codemap::ExpnInfo) {
+    pub fn print_backtrace(&self) { }
+    pub fn backtrace(&self) -> Option<@ExpnInfo> { *self.backtrace }
+    pub fn mod_push(&self, i: ast::ident) { self.mod_path.push(i); }
+    pub fn mod_pop(&self) { self.mod_path.pop(); }
+    pub fn mod_path(&self) -> ~[ast::ident] { copy *self.mod_path }
+    pub fn bt_push(&self, ei: codemap::ExpnInfo) {
         match ei {
             ExpandedFrom(CallInfo {call_site: cs, callee: ref callee}) => {
                 *self.backtrace =
@@ -255,7 +256,7 @@ fn bt_push(&self, ei: codemap::ExpnInfo) {
             }
         }
     }
-    fn bt_pop(&self) {
+    pub fn bt_pop(&self) {
         match *self.backtrace {
             Some(@ExpandedFrom(
                 CallInfo {
@@ -266,43 +267,43 @@ fn bt_pop(&self) {
             _ => self.bug("tried to pop without a push")
         }
     }
-    fn span_fatal(&self, sp: span, msg: &str) -> ! {
+    pub fn span_fatal(&self, sp: span, msg: &str) -> ! {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_fatal(sp, msg);
     }
-    fn span_err(&self, sp: span, msg: &str) {
+    pub fn span_err(&self, sp: span, msg: &str) {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_err(sp, msg);
     }
-    fn span_warn(&self, sp: span, msg: &str) {
+    pub fn span_warn(&self, sp: span, msg: &str) {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_warn(sp, msg);
     }
-    fn span_unimpl(&self, sp: span, msg: &str) -> ! {
+    pub fn span_unimpl(&self, sp: span, msg: &str) -> ! {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_unimpl(sp, msg);
     }
-    fn span_bug(&self, sp: span, msg: &str) -> ! {
+    pub fn span_bug(&self, sp: span, msg: &str) -> ! {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_bug(sp, msg);
     }
-    fn bug(&self, msg: &str) -> ! {
+    pub fn bug(&self, msg: &str) -> ! {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.handler().bug(msg);
     }
-    fn next_id(&self) -> ast::node_id {
+    pub fn next_id(&self) -> ast::node_id {
         parse::next_node_id(self.parse_sess)
     }
-    fn trace_macros(&self) -> bool {
+    pub fn trace_macros(&self) -> bool {
         *self.trace_mac
     }
-    fn set_trace_macros(&self, x: bool) {
+    pub fn set_trace_macros(&self, x: bool) {
         *self.trace_mac = x
     }
-    fn str_of(&self, id: ast::ident) -> ~str {
+    pub fn str_of(&self, id: ast::ident) -> ~str {
         copy *self.parse_sess.interner.get(id)
     }
-    fn ident_of(&self, st: &str) -> ast::ident {
+    pub fn ident_of(&self, st: &str) -> ast::ident {
         self.parse_sess.interner.intern(st)
     }
 }
@@ -436,7 +437,7 @@ fn get_map<'a>(&'a self) -> &'a HashMap<K,@V> {
     }
 
 // traits just don't work anywhere...?
-//pub impl Map<Name,SyntaxExtension> for MapChain {
+//impl Map<Name,SyntaxExtension> for MapChain {
 
     fn contains_key (&self, key: &K) -> bool {
         match *self {
index f8f7dc8db5fd6a03b5eeb9d5012406f5f938392b..3b39cb691a629927a792a551e49f10ba5f6c4998 100644 (file)
@@ -38,15 +38,18 @@ pub struct Path<'self> {
     global: bool
 }
 
-pub impl<'self> Path<'self> {
-    fn new<'r>(path: ~[&'r str]) -> Path<'r> {
+impl<'self> Path<'self> {
+    pub fn new<'r>(path: ~[&'r str]) -> Path<'r> {
         Path::new_(path, None, ~[], true)
     }
-    fn new_local<'r>(path: &'r str) -> Path<'r> {
+    pub fn new_local<'r>(path: &'r str) -> Path<'r> {
         Path::new_(~[ path ], None, ~[], false)
     }
-    fn new_<'r>(path: ~[&'r str], lifetime: Option<&'r str>, params: ~[~Ty<'r>], global: bool)
-        -> Path<'r> {
+    pub fn new_<'r>(path: ~[&'r str],
+                    lifetime: Option<&'r str>,
+                    params: ~[~Ty<'r>],
+                    global: bool)
+                    -> Path<'r> {
         Path {
             path: path,
             lifetime: lifetime,
@@ -55,13 +58,21 @@ fn new_<'r>(path: ~[&'r str], lifetime: Option<&'r str>, params: ~[~Ty<'r>], glo
         }
     }
 
-    fn to_ty(&self, cx: @ExtCtxt, span: span,
-             self_ty: ident, self_generics: &Generics) -> @ast::Ty {
+    pub fn to_ty(&self,
+                 cx: @ExtCtxt,
+                 span: span,
+                 self_ty: ident,
+                 self_generics: &Generics)
+                 -> @ast::Ty {
         cx.ty_path(self.to_path(cx, span,
                                 self_ty, self_generics))
     }
-    fn to_path(&self, cx: @ExtCtxt, span: span,
-               self_ty: ident, self_generics: &Generics) -> @ast::Path {
+    pub fn to_path(&self,
+                   cx: @ExtCtxt,
+                   span: span,
+                   self_ty: ident,
+                   self_generics: &Generics)
+                   -> @ast::Path {
         let idents = self.path.map(|s| cx.ident_of(*s) );
         let lt = mk_lifetime(cx, span, &self.lifetime);
         let tys = self.params.map(|t| t.to_ty(cx, span, self_ty, self_generics));
@@ -108,9 +119,13 @@ fn mk_lifetime(cx: @ExtCtxt, span: span, lt: &Option<&str>) -> Option<@ast::Life
     }
 }
 
-pub impl<'self> Ty<'self> {
-    fn to_ty(&self, cx: @ExtCtxt, span: span,
-             self_ty: ident, self_generics: &Generics) -> @ast::Ty {
+impl<'self> Ty<'self> {
+    pub fn to_ty(&self,
+                 cx: @ExtCtxt,
+                 span: span,
+                 self_ty: ident,
+                 self_generics: &Generics)
+                 -> @ast::Ty {
         match *self {
             Ptr(ref ty, ref ptr) => {
                 let raw_ty = ty.to_ty(cx, span, self_ty, self_generics);
@@ -143,8 +158,12 @@ fn to_ty(&self, cx: @ExtCtxt, span: span,
         }
     }
 
-    fn to_path(&self, cx: @ExtCtxt, span: span,
-               self_ty: ident, self_generics: &Generics) -> @ast::Path {
+    pub fn to_path(&self,
+                   cx: @ExtCtxt,
+                   span: span,
+                   self_ty: ident,
+                   self_generics: &Generics)
+                   -> @ast::Path {
         match *self {
             Self => {
                 let self_params = do self_generics.ty_params.map |ty_param| {
@@ -192,14 +211,18 @@ pub struct LifetimeBounds<'self> {
     bounds: ~[(&'self str, ~[Path<'self>])]
 }
 
-pub impl<'self> LifetimeBounds<'self> {
-    fn empty() -> LifetimeBounds<'static> {
+impl<'self> LifetimeBounds<'self> {
+    pub fn empty() -> LifetimeBounds<'static> {
         LifetimeBounds {
             lifetimes: ~[], bounds: ~[]
         }
     }
-    fn to_generics(&self, cx: @ExtCtxt, span: span,
-                   self_ty: ident, self_generics: &Generics) -> Generics {
+    pub fn to_generics(&self,
+                       cx: @ExtCtxt,
+                       span: span,
+                       self_ty: ident,
+                       self_generics: &Generics)
+                       -> Generics {
         let lifetimes = do self.lifetimes.map |lt| {
             cx.lifetime(span, cx.ident_of(*lt))
         };
index 80e4520b09419e34404d1f92101f077c3da37369..0eb0f5c615927068425b60de06641f4773ccf7d6 100644 (file)
@@ -28,8 +28,8 @@ fn to_str(&self) -> ~str {
     }
 }
 
-pub impl direction {
-    fn reverse(&self) -> direction {
+impl direction {
+    pub fn reverse(&self) -> direction {
         match *self {
           send => recv,
           recv => send
@@ -45,21 +45,21 @@ pub struct next_state {
 // name, span, data, current state, next state
 pub struct message(~str, span, ~[@ast::Ty], state, Option<next_state>);
 
-pub impl message {
-    fn name(&mut self) -> ~str {
+impl message {
+    pub fn name(&mut self) -> ~str {
         match *self {
           message(ref id, _, _, _, _) => copy *id
         }
     }
 
-    fn span(&mut self) -> span {
+    pub fn span(&mut self) -> span {
         match *self {
           message(_, span, _, _, _) => span
         }
     }
 
     /// Return the type parameters actually used by this message
-    fn get_generics(&self) -> ast::Generics {
+    pub fn get_generics(&self) -> ast::Generics {
         match *self {
           message(_, _, _, this, _) => copy this.generics
         }
@@ -79,23 +79,26 @@ pub struct state_ {
     proto: protocol
 }
 
-pub impl state_ {
-    fn add_message(@self, name: ~str, span: span,
-                   data: ~[@ast::Ty], next: Option<next_state>) {
+impl state_ {
+    pub fn add_message(@self,
+                       name: ~str,
+                       span: span,
+                       data: ~[@ast::Ty],
+                       next: Option<next_state>) {
         self.messages.push(message(name, span, data, self,
                                    next));
     }
 
-    fn filename(&self) -> ~str {
+    pub fn filename(&self) -> ~str {
         self.proto.filename()
     }
 
-    fn data_name(&self) -> ast::ident {
+    pub fn data_name(&self) -> ast::ident {
         self.ident
     }
 
     /// Returns the type that is used for the messages.
-    fn to_ty(&self, cx: @ExtCtxt) -> @ast::Ty {
+    pub fn to_ty(&self, cx: @ExtCtxt) -> @ast::Ty {
         cx.ty_path
             (path(~[cx.ident_of(self.name)],self.span).add_tys(
                 cx.ty_vars(&self.generics.ty_params)))
@@ -103,7 +106,7 @@ fn to_ty(&self, cx: @ExtCtxt) -> @ast::Ty {
 
     /// Iterate over the states that can be reached in one message
     /// from this state.
-    fn reachable(&self, f: &fn(state) -> bool) -> bool {
+    pub fn reachable(&self, f: &fn(state) -> bool) -> bool {
         for self.messages.each |m| {
             match *m {
               message(_, _, _, _, Some(next_state { state: ref id, _ })) => {
@@ -140,28 +143,28 @@ pub struct protocol_ {
     bounded: Option<bool>,
 }
 
-pub impl protocol_ {
+impl protocol_ {
     /// Get a state.
-    fn get_state(&self, name: &str) -> state {
+    pub fn get_state(&self, name: &str) -> state {
         self.states.find(|i| name == i.name).get()
     }
 
-    fn get_state_by_id(&self, id: uint) -> state { self.states[id] }
+    pub fn get_state_by_id(&self, id: uint) -> state { self.states[id] }
 
-    fn has_state(&self, name: &str) -> bool {
+    pub fn has_state(&self, name: &str) -> bool {
         self.states.find(|i| name == i.name).is_some()
     }
 
-    fn filename(&self) -> ~str {
+    pub fn filename(&self) -> ~str {
         ~"proto://" + self.name
     }
 
-    fn num_states(&self) -> uint {
+    pub fn num_states(&self) -> uint {
         let states = &mut *self.states;
         states.len()
     }
 
-    fn has_ty_params(&self) -> bool {
+    pub fn has_ty_params(&self) -> bool {
         for self.states.each |s| {
             if s.generics.ty_params.len() > 0 {
                 return true;
@@ -169,19 +172,20 @@ fn has_ty_params(&self) -> bool {
         }
         false
     }
-    fn is_bounded(&self) -> bool {
+
+    pub fn is_bounded(&self) -> bool {
         let bounded = self.bounded.get();
         bounded
     }
 }
 
-pub impl protocol_ {
-    fn add_state_poly(@mut self,
-                      name: ~str,
-                      ident: ast::ident,
-                      dir: direction,
-                      generics: ast::Generics)
-                   -> state {
+impl protocol_ {
+    pub fn add_state_poly(@mut self,
+                          name: ~str,
+                          ident: ast::ident,
+                          dir: direction,
+                          generics: ast::Generics)
+                          -> state {
         let messages = @mut ~[];
         let states = &mut *self.states;
 
index bdbe91e4112b72c786704db9373f3e1282ba5366..8a930cf9afd54d95dacc1e51c6f9a6abff4247b8 100644 (file)
@@ -52,18 +52,18 @@ pub fn token_to_str(reader: @reader, token: &token::Token) -> ~str {
     token::to_str(reader.interner(), token)
 }
 
-pub impl Parser {
+impl Parser {
     // convert a token to a string using self's reader
-    fn token_to_str(&self, token: &token::Token) -> ~str {
+    pub fn token_to_str(&self, token: &token::Token) -> ~str {
         token::to_str(self.reader.interner(), token)
     }
 
     // convert the current token to a string using self's reader
-    fn this_token_to_str(&self) -> ~str {
+    pub fn this_token_to_str(&self) -> ~str {
         self.token_to_str(self.token)
     }
 
-    fn unexpected_last(&self, t: &token::Token) -> ! {
+    pub fn unexpected_last(&self, t: &token::Token) -> ! {
         self.span_fatal(
             *self.last_span,
             fmt!(
@@ -73,7 +73,7 @@ fn unexpected_last(&self, t: &token::Token) -> ! {
         );
     }
 
-    fn unexpected(&self) -> ! {
+    pub fn unexpected(&self) -> ! {
         self.fatal(
             fmt!(
                 "unexpected token: `%s`",
@@ -84,7 +84,7 @@ fn unexpected(&self) -> ! {
 
     // expect and consume the token t. Signal an error if
     // the next token is not t.
-    fn expect(&self, t: &token::Token) {
+    pub fn expect(&self, t: &token::Token) {
         if *self.token == *t {
             self.bump();
         } else {
@@ -98,7 +98,7 @@ fn expect(&self, t: &token::Token) {
         }
     }
 
-    fn parse_ident(&self) -> ast::ident {
+    pub fn parse_ident(&self) -> ast::ident {
         self.check_strict_keywords();
         self.check_reserved_keywords();
         match *self.token {
@@ -120,7 +120,7 @@ fn parse_ident(&self) -> ast::ident {
         }
     }
 
-    fn parse_path_list_ident(&self) -> ast::path_list_ident {
+    pub fn parse_path_list_ident(&self) -> ast::path_list_ident {
         let lo = self.span.lo;
         let ident = self.parse_ident();
         let hi = self.last_span.hi;
@@ -130,17 +130,17 @@ fn parse_path_list_ident(&self) -> ast::path_list_ident {
 
     // consume token 'tok' if it exists. Returns true if the given
     // token was present, false otherwise.
-    fn eat(&self, tok: &token::Token) -> bool {
+    pub fn eat(&self, tok: &token::Token) -> bool {
         return if *self.token == *tok { self.bump(); true } else { false };
     }
 
-    fn is_keyword(&self, kw: keywords::Keyword) -> bool {
+    pub fn is_keyword(&self, kw: keywords::Keyword) -> bool {
         token::is_keyword(kw, self.token)
     }
 
     // if the next token is the given keyword, eat it and return
     // true. Otherwise, return false.
-    fn eat_keyword(&self, kw: keywords::Keyword) -> bool {
+    pub fn eat_keyword(&self, kw: keywords::Keyword) -> bool {
         let is_kw = match *self.token {
             token::IDENT(sid, false) => kw.to_ident().repr == sid.repr,
             _ => false
@@ -152,7 +152,7 @@ fn eat_keyword(&self, kw: keywords::Keyword) -> bool {
     // if the given word is not a keyword, signal an error.
     // if the next token is not the given word, signal an error.
     // otherwise, eat it.
-    fn expect_keyword(&self, kw: keywords::Keyword) {
+    pub fn expect_keyword(&self, kw: keywords::Keyword) {
         if !self.eat_keyword(kw) {
             self.fatal(
                 fmt!(
@@ -165,7 +165,7 @@ fn expect_keyword(&self, kw: keywords::Keyword) {
     }
 
     // signal an error if the given string is a strict keyword
-    fn check_strict_keywords(&self) {
+    pub fn check_strict_keywords(&self) {
         if token::is_strict_keyword(self.token) {
             self.span_err(*self.last_span,
                           fmt!("found `%s` in ident position", self.this_token_to_str()));
@@ -173,7 +173,7 @@ fn check_strict_keywords(&self) {
     }
 
     // signal an error if the current token is a reserved keyword
-    fn check_reserved_keywords(&self) {
+    pub fn check_reserved_keywords(&self) {
         if token::is_reserved_keyword(self.token) {
             self.fatal(fmt!("`%s` is a reserved keyword", self.this_token_to_str()));
         }
@@ -182,7 +182,7 @@ fn check_reserved_keywords(&self) {
     // expect and consume a GT. if a >> is seen, replace it
     // with a single > and continue. If a GT is not seen,
     // signal an error.
-    fn expect_gt(&self) {
+    pub fn expect_gt(&self) {
         if *self.token == token::GT {
             self.bump();
         } else if *self.token == token::BINOP(token::SHR) {
@@ -203,11 +203,10 @@ fn expect_gt(&self) {
 
     // parse a sequence bracketed by '<' and '>', stopping
     // before the '>'.
-    fn parse_seq_to_before_gt<T: Copy>(
-        &self,
-        sep: Option<token::Token>,
-        f: &fn(&Parser) -> T
-    ) -> OptVec<T> {
+    pub fn parse_seq_to_before_gt<T: Copy>(&self,
+                                           sep: Option<token::Token>,
+                                           f: &fn(&Parser) -> T)
+                                           -> OptVec<T> {
         let mut first = true;
         let mut v = opt_vec::Empty;
         while *self.token != token::GT
@@ -224,11 +223,10 @@ fn parse_seq_to_before_gt<T: Copy>(
         return v;
     }
 
-    fn parse_seq_to_gt<T: Copy>(
-        &self,
-        sep: Option<token::Token>,
-        f: &fn(&Parser) -> T
-    ) -> OptVec<T> {
+    pub fn parse_seq_to_gt<T: Copy>(&self,
+                                    sep: Option<token::Token>,
+                                    f: &fn(&Parser) -> T)
+                                    -> OptVec<T> {
         let v = self.parse_seq_to_before_gt(sep, f);
         self.expect_gt();
         return v;
@@ -237,12 +235,11 @@ fn parse_seq_to_gt<T: Copy>(
     // parse a sequence, including the closing delimiter. The function
     // f must consume tokens until reaching the next separator or
     // closing bracket.
-    fn parse_seq_to_end<T: Copy>(
-        &self,
-        ket: &token::Token,
-        sep: SeqSep,
-        f: &fn(&Parser) -> T
-    ) -> ~[T] {
+    pub fn parse_seq_to_end<T: Copy>(&self,
+                                     ket: &token::Token,
+                                     sep: SeqSep,
+                                     f: &fn(&Parser) -> T)
+                                     -> ~[T] {
         let val = self.parse_seq_to_before_end(ket, sep, f);
         self.bump();
         val
@@ -251,12 +248,11 @@ fn parse_seq_to_end<T: Copy>(
     // parse a sequence, not including the closing delimiter. The function
     // f must consume tokens until reaching the next separator or
     // closing bracket.
-    fn parse_seq_to_before_end<T: Copy>(
-        &self,
-        ket: &token::Token,
-        sep: SeqSep,
-        f: &fn(&Parser) -> T
-    ) -> ~[T] {
+    pub fn parse_seq_to_before_end<T: Copy>(&self,
+                                            ket: &token::Token,
+                                            sep: SeqSep,
+                                            f: &fn(&Parser) -> T)
+                                            -> ~[T] {
         let mut first: bool = true;
         let mut v: ~[T] = ~[];
         while *self.token != *ket {
@@ -276,13 +272,12 @@ fn parse_seq_to_before_end<T: Copy>(
     // parse a sequence, including the closing delimiter. The function
     // f must consume tokens until reaching the next separator or
     // closing bracket.
-    fn parse_unspanned_seq<T: Copy>(
-        &self,
-        bra: &token::Token,
-        ket: &token::Token,
-        sep: SeqSep,
-        f: &fn(&Parser) -> T
-    ) -> ~[T] {
+    pub fn parse_unspanned_seq<T: Copy>(&self,
+                                        bra: &token::Token,
+                                        ket: &token::Token,
+                                        sep: SeqSep,
+                                        f: &fn(&Parser) -> T)
+                                        -> ~[T] {
         self.expect(bra);
         let result = self.parse_seq_to_before_end(ket, sep, f);
         self.bump();
@@ -291,13 +286,12 @@ fn parse_unspanned_seq<T: Copy>(
 
     // NB: Do not use this function unless you actually plan to place the
     // spanned list in the AST.
-    fn parse_seq<T: Copy>(
-        &self,
-        bra: &token::Token,
-        ket: &token::Token,
-        sep: SeqSep,
-        f: &fn(&Parser) -> T
-    ) -> spanned<~[T]> {
+    pub fn parse_seq<T: Copy>(&self,
+                              bra: &token::Token,
+                              ket: &token::Token,
+                              sep: SeqSep,
+                              f: &fn(&Parser) -> T)
+                              -> spanned<~[T]> {
         let lo = self.span.lo;
         self.expect(bra);
         let result = self.parse_seq_to_before_end(ket, sep, f);
index 085d24d7e68b156aa46de5df8d2dda6ea573e2aa..f11219f6c9e1efd70844b9da4ad16af8e8855e19 100644 (file)
@@ -73,9 +73,9 @@ fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
     }
 }
 
-pub impl Parser {
+impl Parser {
     /// Reports an obsolete syntax non-fatal error.
-    fn obsolete(&self, sp: span, kind: ObsoleteSyntax) {
+    pub fn obsolete(&self, sp: span, kind: ObsoleteSyntax) {
         let (kind_str, desc) = match kind {
             ObsoleteLowerCaseKindBounds => (
                 "lower-case kind bounds",
@@ -232,13 +232,16 @@ fn obsolete(&self, sp: span, kind: ObsoleteSyntax) {
 
     // Reports an obsolete syntax non-fatal error, and returns
     // a placeholder expression
-    fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr {
+    pub fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr {
         self.obsolete(sp, kind);
         self.mk_expr(sp.lo, sp.hi, expr_lit(@respan(sp, lit_nil)))
     }
 
-    priv fn report(&self, sp: span, kind: ObsoleteSyntax, kind_str: &str,
-                   desc: &str) {
+    fn report(&self,
+              sp: span,
+              kind: ObsoleteSyntax,
+              kind_str: &str,
+              desc: &str) {
         self.span_err(sp, fmt!("obsolete syntax: %s", kind_str));
 
         if !self.obsolete_set.contains(&kind) {
@@ -247,7 +250,8 @@ fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr {
         }
     }
 
-    fn token_is_obsolete_ident(&self, ident: &str, token: &Token) -> bool {
+    pub fn token_is_obsolete_ident(&self, ident: &str, token: &Token)
+                                   -> bool {
         match *token {
             token::IDENT(sid, _) => {
                 str::eq_slice(*self.id_to_str(sid), ident)
@@ -256,11 +260,11 @@ fn token_is_obsolete_ident(&self, ident: &str, token: &Token) -> bool {
         }
     }
 
-    fn is_obsolete_ident(&self, ident: &str) -> bool {
+    pub fn is_obsolete_ident(&self, ident: &str) -> bool {
         self.token_is_obsolete_ident(ident, self.token)
     }
 
-    fn eat_obsolete_ident(&self, ident: &str) -> bool {
+    pub fn eat_obsolete_ident(&self, ident: &str) -> bool {
         if self.is_obsolete_ident(ident) {
             self.bump();
             true
@@ -269,7 +273,7 @@ fn eat_obsolete_ident(&self, ident: &str) -> bool {
         }
     }
 
-    fn try_parse_obsolete_struct_ctor(&self) -> bool {
+    pub fn try_parse_obsolete_struct_ctor(&self) -> bool {
         if self.eat_obsolete_ident("new") {
             self.obsolete(*self.last_span, ObsoleteStructCtor);
             self.parse_fn_decl();
@@ -280,7 +284,7 @@ fn try_parse_obsolete_struct_ctor(&self) -> bool {
         }
     }
 
-    fn try_parse_obsolete_with(&self) -> bool {
+    pub fn try_parse_obsolete_with(&self) -> bool {
         if *self.token == token::COMMA
             && self.token_is_obsolete_ident("with",
                                             &self.look_ahead(1u)) {
@@ -295,7 +299,8 @@ fn try_parse_obsolete_with(&self) -> bool {
         }
     }
 
-    fn try_parse_obsolete_priv_section(&self, attrs: &[attribute]) -> bool {
+    pub fn try_parse_obsolete_priv_section(&self, attrs: &[attribute])
+                                           -> bool {
         if self.is_keyword(keywords::Priv) && self.look_ahead(1) == token::LBRACE {
             self.obsolete(copy *self.span, ObsoletePrivSection);
             self.eat_keyword(keywords::Priv);
index c47092ef61cb788f81d7d0e2c3912282842c33ac..00ad12ce40241fc21e38511e5068b3481be44a9e 100644 (file)
@@ -272,9 +272,9 @@ impl Drop for Parser {
     fn finalize(&self) {}
 }
 
-pub impl Parser {
+impl Parser {
     // advance the parser by one token
-    fn bump(&self) {
+    pub fn bump(&self) {
         *self.last_span = copy *self.span;
         let next = if *self.buffer_start == *self.buffer_end {
             self.reader.next_token()
@@ -288,17 +288,20 @@ fn bump(&self) {
         *self.tokens_consumed += 1u;
     }
     // EFFECT: replace the current token and span with the given one
-    fn replace_token(&self, next: token::Token, lo: BytePos, hi: BytePos) {
+    pub fn replace_token(&self,
+                         next: token::Token,
+                         lo: BytePos,
+                         hi: BytePos) {
         *self.token = next;
         *self.span = mk_sp(lo, hi);
     }
-    fn buffer_length(&self) -> int {
+    pub fn buffer_length(&self) -> int {
         if *self.buffer_start <= *self.buffer_end {
             return *self.buffer_end - *self.buffer_start;
         }
         return (4 - *self.buffer_start) + *self.buffer_end;
     }
-    fn look_ahead(&self, distance: uint) -> token::Token {
+    pub fn look_ahead(&self, distance: uint) -> token::Token {
         let dist = distance as int;
         while self.buffer_length() < dist {
             self.buffer[*self.buffer_end] = self.reader.next_token();
@@ -306,49 +309,49 @@ fn look_ahead(&self, distance: uint) -> token::Token {
         }
         return copy self.buffer[(*self.buffer_start + dist - 1) & 3].tok;
     }
-    fn fatal(&self, m: &str) -> ! {
+    pub fn fatal(&self, m: &str) -> ! {
         self.sess.span_diagnostic.span_fatal(*copy self.span, m)
     }
-    fn span_fatal(&self, sp: span, m: &str) -> ! {
+    pub fn span_fatal(&self, sp: span, m: &str) -> ! {
         self.sess.span_diagnostic.span_fatal(sp, m)
     }
-    fn span_note(&self, sp: span, m: &str) {
+    pub fn span_note(&self, sp: span, m: &str) {
         self.sess.span_diagnostic.span_note(sp, m)
     }
-    fn bug(&self, m: &str) -> ! {
+    pub fn bug(&self, m: &str) -> ! {
         self.sess.span_diagnostic.span_bug(*copy self.span, m)
     }
-    fn warn(&self, m: &str) {
+    pub fn warn(&self, m: &str) {
         self.sess.span_diagnostic.span_warn(*copy self.span, m)
     }
-    fn span_err(&self, sp: span, m: &str) {
+    pub fn span_err(&self, sp: span, m: &str) {
         self.sess.span_diagnostic.span_err(sp, m)
     }
-    fn abort_if_errors(&self) {
+    pub fn abort_if_errors(&self) {
         self.sess.span_diagnostic.handler().abort_if_errors();
     }
-    fn get_id(&self) -> node_id { next_node_id(self.sess) }
+    pub fn get_id(&self) -> node_id { next_node_id(self.sess) }
 
-    fn id_to_str(&self, id: ident) -> @~str {
+    pub fn id_to_str(&self, id: ident) -> @~str {
         self.sess.interner.get(id)
     }
 
     // is this one of the keywords that signals a closure type?
-    fn token_is_closure_keyword(&self, tok: &token::Token) -> bool {
+    pub fn token_is_closure_keyword(&self, tok: &token::Token) -> bool {
         token::is_keyword(keywords::Pure, tok) ||
             token::is_keyword(keywords::Unsafe, tok) ||
             token::is_keyword(keywords::Once, tok) ||
             token::is_keyword(keywords::Fn, tok)
     }
 
-    fn token_is_lifetime(&self, tok: &token::Token) -> bool {
+    pub fn token_is_lifetime(&self, tok: &token::Token) -> bool {
         match *tok {
             token::LIFETIME(*) => true,
             _ => false,
         }
     }
 
-    fn get_lifetime(&self, tok: &token::Token) -> ast::ident {
+    pub fn get_lifetime(&self, tok: &token::Token) -> ast::ident {
         match *tok {
             token::LIFETIME(ref ident) => copy *ident,
             _ => self.bug("not a lifetime"),
@@ -356,8 +359,7 @@ fn get_lifetime(&self, tok: &token::Token) -> ast::ident {
     }
 
     // parse a ty_bare_fun type:
-    fn parse_ty_bare_fn(&self) -> ty_
-    {
+    pub fn parse_ty_bare_fn(&self) -> ty_ {
         /*
 
         extern "ABI" [pure|unsafe] fn <'lt> (S) -> T
@@ -386,10 +388,10 @@ fn parse_ty_bare_fn(&self) -> ty_
     }
 
     // parse a ty_closure type
-    fn parse_ty_closure(&self,
-                        sigil: ast::Sigil,
-                        region: Option<@ast::Lifetime>)
-                        -> ty_ {
+    pub fn parse_ty_closure(&self,
+                            sigil: ast::Sigil,
+                            region: Option<@ast::Lifetime>)
+                            -> ty_ {
         /*
 
         (&|~|@) ['r] [pure|unsafe] [once] fn [:Bounds] <'lt> (S) -> T
@@ -440,7 +442,7 @@ fn parse_onceness(this: &Parser) -> Onceness {
     }
 
     // looks like this should be called parse_unsafety
-    fn parse_unsafety(&self) -> purity {
+    pub fn parse_unsafety(&self) -> purity {
         if self.eat_keyword(keywords::Pure) {
             self.obsolete(*self.last_span, ObsoletePurity);
             return impure_fn;
@@ -452,7 +454,7 @@ fn parse_unsafety(&self) -> purity {
     }
 
     // parse a function type (following the 'fn')
-    fn parse_ty_fn_decl(&self) -> (fn_decl, OptVec<ast::Lifetime>) {
+    pub fn parse_ty_fn_decl(&self) -> (fn_decl, OptVec<ast::Lifetime>) {
         /*
 
         (fn) <'lt> (S) -> T
@@ -487,7 +489,7 @@ fn parse_ty_fn_decl(&self) -> (fn_decl, OptVec<ast::Lifetime>) {
     }
 
     // parse the methods in a trait declaration
-    fn parse_trait_methods(&self) -> ~[trait_method] {
+    pub fn parse_trait_methods(&self) -> ~[trait_method] {
         do self.parse_unspanned_seq(
             &token::LBRACE,
             &token::RBRACE,
@@ -563,9 +565,8 @@ fn parse_trait_methods(&self) -> ~[trait_method] {
         }
     }
 
-
     // parse a possibly mutable type
-    fn parse_mt(&self) -> mt {
+    pub fn parse_mt(&self) -> mt {
         let mutbl = self.parse_mutability();
         let t = self.parse_ty(false);
         mt { ty: t, mutbl: mutbl }
@@ -573,7 +574,7 @@ fn parse_mt(&self) -> mt {
 
     // parse [mut/const/imm] ID : TY
     // now used only by obsolete record syntax parser...
-    fn parse_ty_field(&self) -> ty_field {
+    pub fn parse_ty_field(&self) -> ty_field {
         let lo = self.span.lo;
         let mutbl = self.parse_mutability();
         let id = self.parse_ident();
@@ -590,7 +591,7 @@ fn parse_ty_field(&self) -> ty_field {
     }
 
     // parse optional return type [ -> TY ] in function decl
-    fn parse_ret_ty(&self) -> (ret_style, @Ty) {
+    pub fn parse_ret_ty(&self) -> (ret_style, @Ty) {
         return if self.eat(&token::RARROW) {
             let lo = self.span.lo;
             if self.eat(&token::NOT) {
@@ -621,7 +622,7 @@ fn parse_ret_ty(&self) -> (ret_style, @Ty) {
     // parse a type.
     // Useless second parameter for compatibility with quasiquote macros.
     // Bleh!
-    fn parse_ty(&self, _: bool) -> @Ty {
+    pub fn parse_ty(&self, _: bool) -> @Ty {
         maybe_whole!(self, nt_ty);
 
         let lo = self.span.lo;
@@ -722,11 +723,9 @@ fn parse_ty(&self, _: bool) -> @Ty {
     }
 
     // parse the type following a @ or a ~
-    fn parse_box_or_uniq_pointee(
-        &self,
-        sigil: ast::Sigil,
-        ctor: &fn(v: mt) -> ty_) -> ty_
-    {
+    pub fn parse_box_or_uniq_pointee(&self,
+                                     sigil: ast::Sigil,
+                                     ctor: &fn(v: mt) -> ty_) -> ty_ {
         // @'foo fn() or @foo/fn() or @fn() are parsed directly as fn types:
         match *self.token {
             token::LIFETIME(*) => {
@@ -765,7 +764,7 @@ fn parse_box_or_uniq_pointee(
         ctor(mt)
     }
 
-    fn parse_borrowed_pointee(&self) -> ty_ {
+    pub fn parse_borrowed_pointee(&self) -> ty_ {
         // look for `&'lt` or `&'foo ` and interpret `foo` as the region name:
         let opt_lifetime = self.parse_opt_lifetime();
 
@@ -778,7 +777,7 @@ fn parse_borrowed_pointee(&self) -> ty_ {
     }
 
     // parse an optional, obsolete argument mode.
-    fn parse_arg_mode(&self) {
+    pub fn parse_arg_mode(&self) {
         if self.eat(&token::BINOP(token::MINUS)) {
             self.obsolete(*self.span, ObsoleteMode);
         } else if self.eat(&token::ANDAND) {
@@ -794,7 +793,7 @@ fn parse_arg_mode(&self) {
         }
     }
 
-    fn is_named_argument(&self) -> bool {
+    pub fn is_named_argument(&self) -> bool {
         let offset = if *self.token == token::BINOP(token::AND) {
             1
         } else if *self.token == token::BINOP(token::MINUS) {
@@ -819,7 +818,7 @@ fn is_named_argument(&self) -> bool {
 
     // This version of parse arg doesn't necessarily require
     // identifier names.
-    fn parse_arg_general(&self, require_name: bool) -> arg {
+    pub fn parse_arg_general(&self, require_name: bool) -> arg {
         let mut is_mutbl = false;
         let pat = if require_name || self.is_named_argument() {
             self.parse_arg_mode();
@@ -844,12 +843,12 @@ fn parse_arg_general(&self, require_name: bool) -> arg {
     }
 
     // parse a single function argument
-    fn parse_arg(&self) -> arg_or_capture_item {
+    pub fn parse_arg(&self) -> arg_or_capture_item {
         either::Left(self.parse_arg_general(true))
     }
 
     // parse an argument in a lambda header e.g. |arg, arg|
-    fn parse_fn_block_arg(&self) -> arg_or_capture_item {
+    pub fn parse_fn_block_arg(&self) -> arg_or_capture_item {
         self.parse_arg_mode();
         let is_mutbl = self.eat_keyword(keywords::Mut);
         let pat = self.parse_pat();
@@ -870,7 +869,7 @@ fn parse_fn_block_arg(&self) -> arg_or_capture_item {
         })
     }
 
-    fn maybe_parse_fixed_vstore(&self) -> Option<@ast::expr> {
+    pub fn maybe_parse_fixed_vstore(&self) -> Option<@ast::expr> {
         if self.eat(&token::BINOP(token::STAR)) {
             self.obsolete(*self.last_span, ObsoleteFixedLengthVectorType);
             Some(self.parse_expr())
@@ -885,7 +884,7 @@ fn maybe_parse_fixed_vstore(&self) -> Option<@ast::expr> {
     }
 
     // matches token_lit = LIT_INT | ...
-    fn lit_from_token(&self, tok: &token::Token) -> lit_ {
+    pub fn lit_from_token(&self, tok: &token::Token) -> lit_ {
         match *tok {
             token::LIT_INT(i, it) => lit_int(i, it),
             token::LIT_UINT(u, ut) => lit_uint(u, ut),
@@ -900,7 +899,7 @@ fn lit_from_token(&self, tok: &token::Token) -> lit_ {
     }
 
     // matches lit = true | false | token_lit
-    fn parse_lit(&self) -> lit {
+    pub fn parse_lit(&self) -> lit {
         let lo = self.span.lo;
         let lit = if self.eat_keyword(keywords::True) {
             lit_bool(true)
@@ -916,7 +915,7 @@ fn parse_lit(&self) -> lit {
     }
 
     // matches '-' lit | lit
-    fn parse_literal_maybe_minus(&self) -> @expr {
+    pub fn parse_literal_maybe_minus(&self) -> @expr {
         let minus_lo = self.span.lo;
         let minus_present = self.eat(&token::BINOP(token::MINUS));
 
@@ -935,7 +934,7 @@ fn parse_literal_maybe_minus(&self) -> @expr {
 
     // parse a path into a vector of idents, whether the path starts
     // with ::, and a span.
-    fn parse_path(&self) -> (~[ast::ident],bool,span) {
+    pub fn parse_path(&self) -> (~[ast::ident],bool,span) {
         let lo = self.span.lo;
         let is_global = self.eat(&token::MOD_SEP);
         let (ids,span{lo:_,hi,expn_info}) = self.parse_path_non_global();
@@ -943,7 +942,7 @@ fn parse_path(&self) -> (~[ast::ident],bool,span) {
     }
 
     // parse a path beginning with an identifier into a vector of idents and a span
-    fn parse_path_non_global(&self) -> (~[ast::ident],span) {
+    pub fn parse_path_non_global(&self) -> (~[ast::ident],span) {
         let lo = self.span.lo;
         let mut ids = ~[];
         // must be at least one to begin:
@@ -966,8 +965,7 @@ fn parse_path_non_global(&self) -> (~[ast::ident],span) {
     }
 
     // parse a path that doesn't have type parameters attached
-    fn parse_path_without_tps(&self)
-        -> @ast::Path {
+    pub fn parse_path_without_tps(&self) -> @ast::Path {
         maybe_whole!(self, nt_path);
         let (ids,is_global,sp) = self.parse_path();
         @ast::Path { span: sp,
@@ -980,7 +978,7 @@ fn parse_path_without_tps(&self)
     // parse a path optionally with type parameters. If 'colons'
     // is true, then type parameters must be preceded by colons,
     // as in a::t::<t1,t2>
-    fn parse_path_with_tps(&self, colons: bool) -> @ast::Path {
+    pub fn parse_path_with_tps(&self, colons: bool) -> @ast::Path {
         debug!("parse_path_with_tps(colons=%b)", colons);
 
         maybe_whole!(self, nt_path);
@@ -1042,7 +1040,7 @@ fn parse_path_with_tps(&self, colons: bool) -> @ast::Path {
     }
 
     /// parses 0 or 1 lifetime
-    fn parse_opt_lifetime(&self) -> Option<@ast::Lifetime> {
+    pub fn parse_opt_lifetime(&self) -> Option<@ast::Lifetime> {
         match *self.token {
             token::LIFETIME(*) => {
                 Some(@self.parse_lifetime())
@@ -1064,7 +1062,7 @@ fn parse_opt_lifetime(&self) -> Option<@ast::Lifetime> {
         }
     }
 
-    fn token_is_lifetime(&self, tok: &token::Token) -> bool {
+    pub fn token_is_lifetime(&self, tok: &token::Token) -> bool {
         match *tok {
             token::LIFETIME(_) => true,
             _ => false
@@ -1073,7 +1071,7 @@ fn token_is_lifetime(&self, tok: &token::Token) -> bool {
 
     /// Parses a single lifetime
     // matches lifetime = ( LIFETIME ) | ( IDENT / )
-    fn parse_lifetime(&self) -> ast::Lifetime {
+    pub fn parse_lifetime(&self) -> ast::Lifetime {
         match *self.token {
             token::LIFETIME(i) => {
                 let span = copy self.span;
@@ -1107,7 +1105,7 @@ fn parse_lifetime(&self) -> ast::Lifetime {
     // matches lifetimes = ( lifetime ) | ( lifetime , lifetimes )
     // actually, it matches the empty one too, but putting that in there
     // messes up the grammar....
-    fn parse_lifetimes(&self) -> OptVec<ast::Lifetime> {
+    pub fn parse_lifetimes(&self) -> OptVec<ast::Lifetime> {
         /*!
          *
          * Parses zero or more comma separated lifetimes.
@@ -1139,13 +1137,13 @@ fn parse_lifetimes(&self) -> OptVec<ast::Lifetime> {
         }
     }
 
-    fn token_is_mutability(&self, tok: &token::Token) -> bool {
+    pub fn token_is_mutability(&self, tok: &token::Token) -> bool {
         token::is_keyword(keywords::Mut, tok) ||
         token::is_keyword(keywords::Const, tok)
     }
 
     // parse mutability declaration (mut/const/imm)
-    fn parse_mutability(&self) -> mutability {
+    pub fn parse_mutability(&self) -> mutability {
         if self.eat_keyword(keywords::Mut) {
             m_mutbl
         } else if self.eat_keyword(keywords::Const) {
@@ -1156,7 +1154,7 @@ fn parse_mutability(&self) -> mutability {
     }
 
     // parse ident COLON expr
-    fn parse_field(&self) -> field {
+    pub fn parse_field(&self) -> field {
         let lo = self.span.lo;
         let i = self.parse_ident();
         self.expect(&token::COLON);
@@ -1167,7 +1165,7 @@ fn parse_field(&self) -> field {
         })
     }
 
-    fn mk_expr(&self, lo: BytePos, hi: BytePos, node: expr_) -> @expr {
+    pub fn mk_expr(&self, lo: BytePos, hi: BytePos, node: expr_) -> @expr {
         @expr {
             id: self.get_id(),
             callee_id: self.get_id(),
@@ -1176,7 +1174,7 @@ fn mk_expr(&self, lo: BytePos, hi: BytePos, node: expr_) -> @expr {
         }
     }
 
-    fn mk_mac_expr(&self, lo: BytePos, hi: BytePos, m: mac_) -> @expr {
+    pub fn mk_mac_expr(&self, lo: BytePos, hi: BytePos, m: mac_) -> @expr {
         @expr {
             id: self.get_id(),
             callee_id: self.get_id(),
@@ -1185,7 +1183,7 @@ fn mk_mac_expr(&self, lo: BytePos, hi: BytePos, m: mac_) -> @expr {
         }
     }
 
-    fn mk_lit_u32(&self, i: u32) -> @expr {
+    pub fn mk_lit_u32(&self, i: u32) -> @expr {
         let span = self.span;
         let lv_lit = @codemap::spanned {
             node: lit_uint(i as u64, ty_u32),
@@ -1203,7 +1201,7 @@ fn mk_lit_u32(&self, i: u32) -> @expr {
     // at the bottom (top?) of the precedence hierarchy,
     // parse things like parenthesized exprs,
     // macros, return, etc.
-    fn parse_bottom_expr(&self) -> @expr {
+    pub fn parse_bottom_expr(&self) -> @expr {
         maybe_whole_expr!(self);
 
         let lo = self.span.lo;
@@ -1414,23 +1412,20 @@ fn parse_bottom_expr(&self) -> @expr {
     }
 
     // parse a block or unsafe block
-    fn parse_block_expr(
-        &self,
-        lo: BytePos,
-        blk_mode: blk_check_mode
-    ) -> @expr {
+    pub fn parse_block_expr(&self, lo: BytePos, blk_mode: blk_check_mode)
+                            -> @expr {
         self.expect(&token::LBRACE);
         let blk = self.parse_block_tail(lo, blk_mode);
         return self.mk_expr(blk.span.lo, blk.span.hi, expr_block(blk));
     }
 
     // parse a.b or a(13) or a[4] or just a
-    fn parse_dot_or_call_expr(&self) -> @expr {
+    pub fn parse_dot_or_call_expr(&self) -> @expr {
         let b = self.parse_bottom_expr();
         self.parse_dot_or_call_expr_with(b)
     }
 
-    fn parse_dot_or_call_expr_with(&self, e0: @expr) -> @expr {
+    pub fn parse_dot_or_call_expr_with(&self, e0: @expr) -> @expr {
         let mut e = e0;
         let lo = e.span.lo;
         let mut hi;
@@ -1504,7 +1499,7 @@ fn parse_dot_or_call_expr_with(&self, e0: @expr) -> @expr {
 
     // parse an optional separator followed by a kleene-style
     // repetition token (+ or *).
-    fn parse_sep_and_zerok(&self) -> (Option<token::Token>, bool) {
+    pub fn parse_sep_and_zerok(&self) -> (Option<token::Token>, bool) {
         if *self.token == token::BINOP(token::STAR)
             || *self.token == token::BINOP(token::PLUS) {
             let zerok = *self.token == token::BINOP(token::STAR);
@@ -1525,7 +1520,7 @@ fn parse_sep_and_zerok(&self) -> (Option<token::Token>, bool) {
     }
 
     // parse a single token tree from the input.
-    fn parse_token_tree(&self) -> token_tree {
+    pub fn parse_token_tree(&self) -> token_tree {
         maybe_whole!(deref self, nt_tt);
 
         // this is the fall-through for the 'match' below.
@@ -1612,7 +1607,7 @@ fn parse_any_tt_tok(p: &Parser) -> token_tree{
 
     // parse a stream of tokens into a list of token_trees,
     // up to EOF.
-    fn parse_all_token_trees(&self) -> ~[token_tree] {
+    pub fn parse_all_token_trees(&self) -> ~[token_tree] {
         let mut tts = ~[];
         while *self.token != token::EOF {
             tts.push(self.parse_token_tree());
@@ -1620,7 +1615,7 @@ fn parse_all_token_trees(&self) -> ~[token_tree] {
         tts
     }
 
-    fn parse_matchers(&self) -> ~[matcher] {
+    pub fn parse_matchers(&self) -> ~[matcher] {
         // unification of matchers and token_trees would vastly improve
         // the interpolation of matchers
         maybe_whole!(self, nt_matchers);
@@ -1642,12 +1637,11 @@ fn parse_matchers(&self) -> ~[matcher] {
     // This goofy function is necessary to correctly match parens in matchers.
     // Otherwise, `$( ( )` would be a valid matcher, and `$( () )` would be
     // invalid. It's similar to common::parse_seq.
-    fn parse_matcher_subseq(
-        &self,
-        name_idx: @mut uint,
-        bra: token::Token,
-        ket: token::Token
-    ) -> ~[matcher] {
+    pub fn parse_matcher_subseq(&self,
+                                name_idx: @mut uint,
+                                bra: token::Token,
+                                ket: token::Token)
+                                -> ~[matcher] {
         let mut ret_val = ~[];
         let mut lparens = 0u;
 
@@ -1664,7 +1658,7 @@ fn parse_matcher_subseq(
         return ret_val;
     }
 
-    fn parse_matcher(&self, name_idx: @mut uint) -> matcher {
+    pub fn parse_matcher(&self, name_idx: @mut uint) -> matcher {
         let lo = self.span.lo;
 
         let m = if *self.token == token::DOLLAR {
@@ -1699,7 +1693,7 @@ fn parse_matcher(&self, name_idx: @mut uint) -> matcher {
     }
 
     // parse a prefix-operator expr
-    fn parse_prefix_expr(&self) -> @expr {
+    pub fn parse_prefix_expr(&self) -> @expr {
         let lo = self.span.lo;
         let hi;
 
@@ -1791,13 +1785,12 @@ fn parse_prefix_expr(&self) -> @expr {
     }
 
     // parse an expression of binops
-    fn parse_binops(&self) -> @expr {
+    pub fn parse_binops(&self) -> @expr {
         self.parse_more_binops(self.parse_prefix_expr(), 0)
     }
 
     // parse an expression of binops of at least min_prec precedence
-    fn parse_more_binops(&self, lhs: @expr, min_prec: uint) ->
-        @expr {
+    pub fn parse_more_binops(&self, lhs: @expr, min_prec: uint) -> @expr {
         if self.expr_is_complete(lhs) { return lhs; }
         let peeked = copy *self.token;
         if peeked == token::BINOP(token::OR) &&
@@ -1841,7 +1834,7 @@ fn parse_more_binops(&self, lhs: @expr, min_prec: uint) ->
     // parse an assignment expression....
     // actually, this seems to be the main entry point for
     // parsing an arbitrary expression.
-    fn parse_assign_expr(&self) -> @expr {
+    pub fn parse_assign_expr(&self) -> @expr {
         let lo = self.span.lo;
         let lhs = self.parse_binops();
         match *self.token {
@@ -1892,7 +1885,7 @@ fn parse_assign_expr(&self) -> @expr {
     }
 
     // parse an 'if' expression ('if' token already eaten)
-    fn parse_if_expr(&self) -> @expr {
+    pub fn parse_if_expr(&self) -> @expr {
         let lo = self.last_span.lo;
         let cond = self.parse_expr();
         let thn = self.parse_block();
@@ -1907,7 +1900,7 @@ fn parse_if_expr(&self) -> @expr {
     }
 
     // `|args| { ... }` or `{ ...}` like in `do` expressions
-    fn parse_lambda_block_expr(&self) -> @expr {
+    pub fn parse_lambda_block_expr(&self) -> @expr {
         self.parse_lambda_expr_(
             || {
                 match *self.token {
@@ -1935,7 +1928,7 @@ fn parse_lambda_block_expr(&self) -> @expr {
     }
 
     // `|args| expr`
-    fn parse_lambda_expr(&self) -> @expr {
+    pub fn parse_lambda_expr(&self) -> @expr {
         self.parse_lambda_expr_(|| self.parse_fn_block_decl(),
                                 || self.parse_expr())
     }
@@ -1943,11 +1936,10 @@ fn parse_lambda_expr(&self) -> @expr {
     // parse something of the form |args| expr
     // this is used both in parsing a lambda expr
     // and in parsing a block expr as e.g. in for...
-    fn parse_lambda_expr_(
-        &self,
-        parse_decl: &fn() -> fn_decl,
-        parse_body: &fn() -> @expr
-    ) -> @expr {
+    pub fn parse_lambda_expr_(&self,
+                              parse_decl: &fn() -> fn_decl,
+                              parse_body: &fn() -> @expr)
+                              -> @expr {
         let lo = self.last_span.lo;
         let decl = parse_decl();
         let body = parse_body();
@@ -1964,7 +1956,7 @@ fn parse_lambda_expr_(
                             expr_fn_block(decl, fakeblock));
     }
 
-    fn parse_else_expr(&self) -> @expr {
+    pub fn parse_else_expr(&self) -> @expr {
         if self.eat_keyword(keywords::If) {
             return self.parse_if_expr();
         } else {
@@ -1976,9 +1968,11 @@ fn parse_else_expr(&self) -> @expr {
     // parse a 'for' or 'do'.
     // the 'for' and 'do' expressions parse as calls, but look like
     // function calls followed by a closure expression.
-    fn parse_sugary_call_expr(&self, keyword: ~str,
-                              sugar: CallSugar,
-                              ctor: &fn(v: @expr) -> expr_) -> @expr {
+    pub fn parse_sugary_call_expr(&self,
+                                  keyword: ~str,
+                                  sugar: CallSugar,
+                                  ctor: &fn(v: @expr) -> expr_)
+                                  -> @expr {
         let lo = self.last_span;
         // Parse the callee `foo` in
         //    for foo || {
@@ -2035,7 +2029,7 @@ fn parse_sugary_call_expr(&self, keyword: ~str,
         }
     }
 
-    fn parse_while_expr(&self) -> @expr {
+    pub fn parse_while_expr(&self) -> @expr {
         let lo = self.last_span.lo;
         let cond = self.parse_expr();
         let body = self.parse_block();
@@ -2043,7 +2037,7 @@ fn parse_while_expr(&self) -> @expr {
         return self.mk_expr(lo, hi, expr_while(cond, body));
     }
 
-    fn parse_loop_expr(&self, opt_ident: Option<ast::ident>) -> @expr {
+    pub fn parse_loop_expr(&self, opt_ident: Option<ast::ident>) -> @expr {
         // loop headers look like 'loop {' or 'loop unsafe {'
         let is_loop_header =
             *self.token == token::LBRACE
@@ -2126,7 +2120,7 @@ fn parse_match_expr(&self) -> @expr {
     }
 
     // parse an expression
-    fn parse_expr(&self) -> @expr {
+    pub fn parse_expr(&self) -> @expr {
         return self.parse_expr_res(UNRESTRICTED);
     }
 
@@ -2257,7 +2251,7 @@ fn parse_pat_fields(&self) -> (~[ast::field_pat], bool) {
     }
 
     // parse a pattern.
-    fn parse_pat(&self) -> @pat {
+    pub fn parse_pat(&self) -> @pat {
         maybe_whole!(self, nt_pat);
 
         let lo = self.span.lo;
@@ -2580,7 +2574,7 @@ fn parse_name_and_ty(&self,
 
     // parse a statement. may include decl.
     // precondition: any attributes are parsed already
-    fn parse_stmt(&self, item_attrs: ~[attribute]) -> @stmt {
+    pub fn parse_stmt(&self, item_attrs: ~[attribute]) -> @stmt {
         maybe_whole!(self, nt_stmt);
 
         fn check_expected_item(p: &Parser, current_attrs: &[attribute]) {
@@ -2674,7 +2668,7 @@ fn expr_is_complete(&self, e: @expr) -> bool {
     }
 
     // parse a block. No inner attrs are allowed.
-    fn parse_block(&self) -> blk {
+    pub fn parse_block(&self) -> blk {
         maybe_whole!(self, nt_block);
 
         let lo = self.span.lo;
@@ -2924,7 +2918,7 @@ fn parse_ty_param(&self) -> TyParam {
     // matches generics = ( ) | ( < > ) | ( < typaramseq ( , )? > ) | ( < lifetimes ( , )? > )
     //                  | ( < lifetimes , typaramseq ( , )? > )
     // where   typaramseq = ( typaram ) | ( typaram , typaramseq )
-    fn parse_generics(&self) -> ast::Generics {
+    pub fn parse_generics(&self) -> ast::Generics {
         if self.eat(&token::LT) {
             let lifetimes = self.parse_lifetimes();
             let ty_params = self.parse_seq_to_gt(
@@ -2958,9 +2952,7 @@ fn parse_generic_values_after_lt(
     }
 
     // parse the argument list and result type of a function declaration
-    fn parse_fn_decl(&self)
-        -> fn_decl
-    {
+    pub fn parse_fn_decl(&self) -> fn_decl {
         let args_or_capture_items: ~[arg_or_capture_item] =
             self.parse_unspanned_seq(
                 &token::LPAREN,
@@ -3398,9 +3390,10 @@ fn token_is_pound_or_doc_comment(&self, tok: token::Token) -> bool {
     }
 
     // parse a structure field declaration
-    fn parse_single_struct_field(&self,
-                                 vis: visibility,
-                                 attrs: ~[attribute]) -> @struct_field {
+    pub fn parse_single_struct_field(&self,
+                                     vis: visibility,
+                                     attrs: ~[attribute])
+                                     -> @struct_field {
         if self.eat_obsolete_ident("let") {
             self.obsolete(*self.last_span, ObsoleteLet);
         }
@@ -4214,7 +4207,7 @@ fn parse_macro_use_or_failure(
         return iovi_none;
     }
 
-    fn parse_item(&self, attrs: ~[attribute]) -> Option<@ast::item> {
+    pub fn parse_item(&self, attrs: ~[attribute]) -> Option<@ast::item> {
         match self.parse_item_or_view_item(attrs, true) {
             iovi_none =>
                 None,
@@ -4493,7 +4486,7 @@ fn parse_foreign_items(&self, first_item_attrs: ~[attribute],
 
     // Parses a source module as a crate. This is the main
     // entry point for the parser.
-    fn parse_crate_mod(&self) -> @crate {
+    pub fn parse_crate_mod(&self) -> @crate {
         let lo = self.span.lo;
         // parse the crate's inner attrs, maybe (oops) one
         // of the attrs of an item:
@@ -4507,7 +4500,7 @@ fn parse_crate_mod(&self) -> @crate {
                                config: copy self.cfg })
     }
 
-    fn parse_str(&self) -> @~str {
+    pub fn parse_str(&self) -> @~str {
         match *self.token {
             token::LIT_STR(s) => {
                 self.bump();
index f50b9f8936a3a730f086564d6c0c703630669e39..b716384c6ccc5b5dfafc03ad31176fbb22dc12df 100644 (file)
@@ -393,21 +393,22 @@ pub struct ident_interner {
     priv interner: StrInterner,
 }
 
-pub impl ident_interner {
-    fn intern(&self, val: &str) -> ast::ident {
+impl ident_interner {
+    pub fn intern(&self, val: &str) -> ast::ident {
         ast::ident { repr: self.interner.intern(val), ctxt: 0 }
     }
-    fn gensym(&self, val: &str) -> ast::ident {
+    pub fn gensym(&self, val: &str) -> ast::ident {
         ast::ident { repr: self.interner.gensym(val), ctxt: 0 }
     }
-    fn get(&self, idx: ast::ident) -> @~str {
+    pub fn get(&self, idx: ast::ident) -> @~str {
         self.interner.get(idx.repr)
     }
-    fn len(&self) -> uint {
+    pub fn len(&self) -> uint {
         self.interner.len()
     }
-    fn find_equiv<Q:Hash + IterBytes + Equiv<@~str>>(&self, val: &Q)
-                                                     -> Option<ast::ident> {
+    pub fn find_equiv<Q:Hash +
+                        IterBytes +
+                        Equiv<@~str>>(&self, val: &Q) -> Option<ast::ident> {
         match self.interner.find_equiv(val) {
             Some(v) => Some(ast::ident { repr: v, ctxt: 0 }),
             None => None,
@@ -586,8 +587,8 @@ pub enum Keyword {
         Be,
     }
 
-    pub impl Keyword {
-        fn to_ident(&self) -> ident {
+    impl Keyword {
+        pub fn to_ident(&self) -> ident {
             match *self {
                 As => ident { repr: 35, ctxt: 0 },
                    Break => ident { repr: 36, ctxt: 0 },
index 11830dc3c2908d9960f8b4196e2edf2ad33f473b..f6059980697faa94718c6fa5e6c1540d282c9361 100644 (file)
@@ -87,11 +87,12 @@ pub enum token {
     EOF,
 }
 
-pub impl token {
-    fn is_eof(&self) -> bool {
+impl token {
+    pub fn is_eof(&self) -> bool {
         match *self { EOF => true, _ => false }
     }
-    fn is_hardbreak_tok(&self) -> bool {
+
+    pub fn is_hardbreak_tok(&self) -> bool {
         match *self {
             BREAK(break_t {
                 offset: 0,
@@ -274,11 +275,13 @@ pub struct Printer {
     pending_indentation: int,
 }
 
-pub impl Printer {
-    fn last_token(&mut self) -> token { self.token[self.right] }
+impl Printer {
+    pub fn last_token(&mut self) -> token { self.token[self.right] }
     // be very careful with this!
-    fn replace_last_token(&mut self, t: token) { self.token[self.right] = t; }
-    fn pretty_print(&mut self, t: token) {
+    pub fn replace_last_token(&mut self, t: token) {
+        self.token[self.right] = t;
+    }
+    pub fn pretty_print(&mut self, t: token) {
         debug!("pp ~[%u,%u]", self.left, self.right);
         match t {
           EOF => {
@@ -346,7 +349,7 @@ fn pretty_print(&mut self, t: token) {
           }
         }
     }
-    fn check_stream(&mut self) {
+    pub fn check_stream(&mut self) {
         debug!("check_stream ~[%u, %u] with left_total=%d, right_total=%d",
                self.left, self.right, self.left_total, self.right_total);
         if self.right_total - self.left_total > self.space {
@@ -362,7 +365,7 @@ fn check_stream(&mut self) {
             if self.left != self.right { self.check_stream(); }
         }
     }
-    fn scan_push(&mut self, x: uint) {
+    pub fn scan_push(&mut self, x: uint) {
         debug!("scan_push %u", x);
         if self.scan_stack_empty {
             self.scan_stack_empty = false;
@@ -373,7 +376,7 @@ fn scan_push(&mut self, x: uint) {
         }
         self.scan_stack[self.top] = x;
     }
-    fn scan_pop(&mut self) -> uint {
+    pub fn scan_pop(&mut self) -> uint {
         assert!((!self.scan_stack_empty));
         let x = self.scan_stack[self.top];
         if self.top == self.bottom {
@@ -381,11 +384,11 @@ fn scan_pop(&mut self) -> uint {
         } else { self.top += self.buf_len - 1u; self.top %= self.buf_len; }
         return x;
     }
-    fn scan_top(&mut self) -> uint {
+    pub fn scan_top(&mut self) -> uint {
         assert!((!self.scan_stack_empty));
         return self.scan_stack[self.top];
     }
-    fn scan_pop_bottom(&mut self) -> uint {
+    pub fn scan_pop_bottom(&mut self) -> uint {
         assert!((!self.scan_stack_empty));
         let x = self.scan_stack[self.bottom];
         if self.top == self.bottom {
@@ -393,12 +396,12 @@ fn scan_pop_bottom(&mut self) -> uint {
         } else { self.bottom += 1u; self.bottom %= self.buf_len; }
         return x;
     }
-    fn advance_right(&mut self) {
+    pub fn advance_right(&mut self) {
         self.right += 1u;
         self.right %= self.buf_len;
         assert!((self.right != self.left));
     }
-    fn advance_left(&mut self, x: token, L: int) {
+    pub fn advance_left(&mut self, x: token, L: int) {
         debug!("advnce_left ~[%u,%u], sizeof(%u)=%d", self.left, self.right,
                self.left, L);
         if L >= 0 {
@@ -418,7 +421,7 @@ fn advance_left(&mut self, x: token, L: int) {
             }
         }
     }
-    fn check_stack(&mut self, k: int) {
+    pub fn check_stack(&mut self, k: int) {
         if !self.scan_stack_empty {
             let x = self.scan_top();
             match copy self.token[x] {
@@ -441,17 +444,17 @@ fn check_stack(&mut self, k: int) {
             }
         }
     }
-    fn print_newline(&mut self, amount: int) {
+    pub fn print_newline(&mut self, amount: int) {
         debug!("NEWLINE %d", amount);
         (*self.out).write_str("\n");
         self.pending_indentation = 0;
         self.indent(amount);
     }
-    fn indent(&mut self, amount: int) {
+    pub fn indent(&mut self, amount: int) {
         debug!("INDENT %d", amount);
         self.pending_indentation += amount;
     }
-    fn get_top(&mut self) -> print_stack_elt {
+    pub fn get_top(&mut self) -> print_stack_elt {
         let print_stack = &mut *self.print_stack;
         let n = print_stack.len();
         if n != 0u {
@@ -463,14 +466,14 @@ fn get_top(&mut self) -> print_stack_elt {
             }
         }
     }
-    fn print_str(&mut self, s: &str) {
+    pub fn print_str(&mut self, s: &str) {
         while self.pending_indentation > 0 {
             (*self.out).write_str(" ");
             self.pending_indentation -= 1;
         }
         (*self.out).write_str(s);
     }
-    fn print(&mut self, x: token, L: int) {
+    pub fn print(&mut self, x: token, L: int) {
         debug!("print %s %d (remaining line space=%d)", tok_str(x), L,
                self.space);
         debug!("%s", buf_str(copy self.token,
index e2736a00564bd4d994f7a2040f910f70772cb61e..c3deb65163dddb70c03bcf01709b052159283e38 100644 (file)
@@ -27,21 +27,21 @@ pub struct Interner<T> {
 }
 
 // when traits can extend traits, we should extend index<uint,T> to get []
-pub impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> {
-    fn new() -> Interner<T> {
+impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> {
+    pub fn new() -> Interner<T> {
         Interner {
             map: @mut HashMap::new(),
             vect: @mut ~[],
         }
     }
 
-    fn prefill(init: &[T]) -> Interner<T> {
+    pub fn prefill(init: &[T]) -> Interner<T> {
         let rv = Interner::new();
         for init.each() |v| { rv.intern(*v); }
         rv
     }
 
-    fn intern(&self, val: T) -> uint {
+    pub fn intern(&self, val: T) -> uint {
         match self.map.find(&val) {
             Some(&idx) => return idx,
             None => (),
@@ -54,7 +54,7 @@ fn intern(&self, val: T) -> uint {
         new_idx
     }
 
-    fn gensym(&self, val: T) -> uint {
+    pub fn gensym(&self, val: T) -> uint {
         let new_idx = {
             let vect = &*self.vect;
             vect.len()
@@ -67,11 +67,11 @@ fn gensym(&self, val: T) -> uint {
     // this isn't "pure" in the traditional sense, because it can go from
     // failing to returning a value as items are interned. But for typestate,
     // where we first check a pred and then rely on it, ceasing to fail is ok.
-    fn get(&self, idx: uint) -> T { self.vect[idx] }
+    pub fn get(&self, idx: uint) -> T { self.vect[idx] }
 
-    fn len(&self) -> uint { let vect = &*self.vect; vect.len() }
+    pub fn len(&self) -> uint { let vect = &*self.vect; vect.len() }
 
-    fn find_equiv<Q:Hash + IterBytes + Equiv<T>>(&self, val: &Q)
+    pub fn find_equiv<Q:Hash + IterBytes + Equiv<T>>(&self, val: &Q)
                                               -> Option<uint> {
         match self.map.find_equiv(val) {
             Some(v) => Some(*v),
@@ -88,21 +88,21 @@ pub struct StrInterner {
 }
 
 // when traits can extend traits, we should extend index<uint,T> to get []
-pub impl StrInterner {
-    fn new() -> StrInterner {
+impl StrInterner {
+    pub fn new() -> StrInterner {
         StrInterner {
             map: @mut HashMap::new(),
             vect: @mut ~[],
         }
     }
 
-    fn prefill(init: &[&str]) -> StrInterner {
+    pub fn prefill(init: &[&str]) -> StrInterner {
         let rv = StrInterner::new();
         for init.each() |v| { rv.intern(*v); }
         rv
     }
 
-    fn intern(&self, val: &str) -> uint {
+    pub fn intern(&self, val: &str) -> uint {
         match self.map.find_equiv(&StringRef(val)) {
             Some(&idx) => return idx,
             None => (),
@@ -114,7 +114,7 @@ fn intern(&self, val: &str) -> uint {
         new_idx
     }
 
-    fn gensym(&self, val: &str) -> uint {
+    pub fn gensym(&self, val: &str) -> uint {
         let new_idx = self.len();
         // leave out of .map to avoid colliding
         self.vect.push(@val.to_owned());
@@ -124,12 +124,12 @@ fn gensym(&self, val: &str) -> uint {
     // this isn't "pure" in the traditional sense, because it can go from
     // failing to returning a value as items are interned. But for typestate,
     // where we first check a pred and then rely on it, ceasing to fail is ok.
-    fn get(&self, idx: uint) -> @~str { self.vect[idx] }
+    pub fn get(&self, idx: uint) -> @~str { self.vect[idx] }
 
-    fn len(&self) -> uint { let vect = &*self.vect; vect.len() }
+    pub fn len(&self) -> uint { let vect = &*self.vect; vect.len() }
 
-    fn find_equiv<Q:Hash + IterBytes + Equiv<@~str>>(&self, val: &Q)
-                                              -> Option<uint> {
+    pub fn find_equiv<Q:Hash + IterBytes + Equiv<@~str>>(&self, val: &Q)
+                                                         -> Option<uint> {
         match self.map.find_equiv(val) {
             Some(v) => Some(*v),
             None => None,
index 6e111381cba3423ddbf4754c5f813a90dac51f7b..a15373a703377bf6c0da022b7e56ad6252c039f4 100644 (file)
@@ -12,8 +12,8 @@ pub struct Foo {
     x: int
 }
 
-pub impl Foo {
-    fn new() -> Foo {
+impl Foo {
+    pub fn new() -> Foo {
         Foo { x: 3 }
     }
 }
index b120a4d759f9037db721ed31c4dc613f674728e8..c0275249ca6d47cd93a921a33910e8427e7766fc 100644 (file)
@@ -16,8 +16,8 @@ pub struct cat {
 
     }
 
-    pub impl cat {
-        fn speak(&self) {}
+    impl cat {
+        pub fn speak(&self) {}
     }
 
     pub fn cat(in_x : uint, in_y : int) -> cat {
index a516f5398df624008b9972cae9f1d6ea0ad96ac0..7ebf5a1e75a7fceb7052fa03fc7ab2d508de5a0a 100644 (file)
@@ -15,9 +15,9 @@ pub struct cat {
         how_hungry : int,
     }
 
-    pub impl cat {
-        fn speak(&mut self) { self.meows += 1u; }
-        fn meow_count(&mut self) -> uint { self.meows }
+    impl cat {
+        pub fn speak(&mut self) { self.meows += 1u; }
+        pub fn meow_count(&mut self) -> uint { self.meows }
     }
 
     pub fn cat(in_x : uint, in_y : int) -> cat {
index 68143b32741c8661c8486d348e3d599e1e282e94..98e5c8c2b5bbd59316a209d5c1e41673bbe95388 100644 (file)
@@ -16,10 +16,10 @@ pub struct cat {
         name : ~str,
     }
 
-    pub impl cat {
-        fn speak(&mut self) { self.meow(); }
+    impl cat {
+        pub fn speak(&mut self) { self.meow(); }
 
-        fn eat(&mut self) -> bool {
+        pub fn eat(&mut self) -> bool {
             if self.how_hungry > 0 {
                 error!("OM NOM NOM");
                 self.how_hungry -= 2;
@@ -31,8 +31,8 @@ fn eat(&mut self) -> bool {
         }
     }
 
-    pub impl cat {
-        fn meow(&mut self) {
+    impl cat {
+        pub fn meow(&mut self) {
             error!("Meow");
             self.meows += 1u;
             if self.meows % 5u == 0u {
index 10dedc12399d11f2580774250881ea564ef8003a..d64930b3dab22b34f7cecdb694969037159123b8 100644 (file)
@@ -16,8 +16,8 @@ pub struct cat {
         how_hungry : int,
     }
 
-    pub impl cat {
-      priv fn nap(&self) { for uint::range(1, 10000u) |_i|{}}
+    impl cat {
+        priv fn nap(&self) { for uint::range(1, 10000u) |_i|{}}
     }
 
     pub fn cat(in_x : uint, in_y : int) -> cat {
index 7ad617cebdbb31e6465f542406e434c1d1c745c4..90344a544bff4e2a579657ca1ef16243bb6c8215 100644 (file)
@@ -16,11 +16,12 @@ pub struct cat<U> {
         how_hungry : int,
     }
 
-    pub impl<U> cat<U> {
-        fn speak<T>(&mut self, stuff: ~[T]) {
+    impl<U> cat<U> {
+        pub fn speak<T>(&mut self, stuff: ~[T]) {
             self.meows += stuff.len();
         }
-        fn meow_count(&mut self) -> uint { self.meows }
+
+        pub fn meow_count(&mut self) -> uint { self.meows }
     }
 
     pub fn cat<U>(in_x : uint, in_y : int, in_info: ~[U]) -> cat<U> {
index 56808b0d58f8d112526f1cba4bb09fbf98f8776d..1e82b85f728c068abd589f0454cd4193c6003dcd 100644 (file)
@@ -21,7 +21,7 @@ impl ToStr for cat {
        fn to_str(&self) -> ~str { copy self.name }
     }
 
-    priv impl cat {
+    impl cat {
         fn meow(&mut self) {
             error!("Meow");
             self.meows += 1u;
@@ -32,10 +32,10 @@ fn meow(&mut self) {
 
     }
 
-    pub impl cat {
-        fn speak(&mut self) { self.meow(); }
+    impl cat {
+        pub fn speak(&mut self) { self.meow(); }
 
-        fn eat(&mut self) -> bool {
+        pub fn eat(&mut self) -> bool {
             if self.how_hungry > 0 {
                 error!("OM NOM NOM");
                 self.how_hungry -= 2;
index 4d98c4d9d2b54ed9b2342eb7af9f4d3d9c23f289..4752c5a3bac56c67a5207bbbf90ed6cffc9c30fb 100644 (file)
@@ -4,6 +4,6 @@ pub struct Fish {
     x: int
 }
 
-pub impl Fish {
-    fn swim(&self) {}
+impl Fish {
+    pub fn swim(&self) {}
 }
index 7969128ce5285cf2059b564ccd40495853717c36..1475b1a75a6652b3874c570fad115316a4ce7a33 100644 (file)
@@ -11,8 +11,8 @@
 
 pub struct S(());
 
-pub impl S {
-    fn foo(&self) { }
+impl S {
+    pub fn foo(&self) { }
 }
 
 pub trait T {
index 5281c1b863c6ae80a7ddf357fb5b59c89d523d64..a0b742515494c11a13b738d8c95caf9d757aa4f4 100644 (file)
@@ -35,8 +35,8 @@ fn timed(result: &mut float, op: &fn()) {
     *result = (end - start);
 }
 
-pub impl Results {
-    fn bench_int<T:Set<uint>,
+impl Results {
+    pub fn bench_int<T:Set<uint>,
                  R: rand::Rng>(
                  &mut self,
                  rng: &mut R,
@@ -79,7 +79,7 @@ fn bench_int<T:Set<uint>,
         }
     }
 
-    fn bench_str<T:Set<~str>,
+    pub fn bench_str<T:Set<~str>,
                  R:rand::Rng>(
                  &mut self,
                  rng: &mut R,
index 8f39ae62f9e39a56c888747052e4bd369dc783f4..25bdf7dc3feffd935bbca3ba335eb67afb98bb25 100644 (file)
@@ -35,8 +35,8 @@ struct Noise2DContext {
     permutations: [int, ..256],
 }
 
-pub impl Noise2DContext {
-    fn new() -> Noise2DContext {
+impl Noise2DContext {
+    pub fn new() -> Noise2DContext {
         let mut r = rand::rng();
         let mut rgradients = [ Vec2 { x: 0.0, y: 0.0 }, ..256 ];
         for int::range(0, 256) |i| {
@@ -55,17 +55,17 @@ fn new() -> Noise2DContext {
     }
 
     #[inline(always)]
-    fn get_gradient(&self, x: int, y: int) -> Vec2 {
+    pub fn get_gradient(&self, x: int, y: int) -> Vec2 {
         let idx = self.permutations[x & 255] + self.permutations[y & 255];
         self.rgradients[idx & 255]
     }
 
     #[inline]
-    fn get_gradients(&self,
-                     gradients: &mut [Vec2, ..4],
-                     origins: &mut [Vec2, ..4],
-                     x: f32,
-                     y: f32) {
+    pub fn get_gradients(&self,
+                         gradients: &mut [Vec2, ..4],
+                         origins: &mut [Vec2, ..4],
+                         x: f32,
+                         y: f32) {
         let x0f = f32::floor(x);
         let y0f = f32::floor(y);
         let x0 = x0f as int;
@@ -85,7 +85,7 @@ fn get_gradients(&self,
     }
 
     #[inline]
-    fn get(&self, x: f32, y: f32) -> f32 {
+    pub fn get(&self, x: f32, y: f32) -> f32 {
         let p = Vec2 {x: x, y: y};
         let mut gradients = [ Vec2 { x: 0.0, y: 0.0 }, ..4 ];
         let mut origins = [ Vec2 { x: 0.0, y: 0.0 }, ..4 ];
index 8f12f2bd58e735268d7cb3a452d62fcc24297034..3bf08cfb934f8c26cdee5a8ec33762b7ee452059 100644 (file)
@@ -44,7 +44,7 @@ struct Sudoku {
     grid: grid
 }
 
-pub impl Sudoku {
+impl Sudoku {
     pub fn new(g: grid) -> Sudoku {
         return Sudoku { grid: g }
     }
index 55a358a32e200ba9f3055b4da2f7adb32f27f7e4..85bb60e05853ee27e318dc48a3cc047dbf45846e 100644 (file)
@@ -14,9 +14,8 @@ struct cat {
   how_hungry : int,
 }
 
-pub impl cat {
-
-  fn speak(&self) { self.meows += 1u; }
+impl cat {
+    pub fn speak(&self) { self.meows += 1u; }
 }
 
 fn cat(in_x : uint, in_y : int) -> cat {
index b9758e669e07ee1ed63d902228cd105fdf954f98..e2fbce6e195f579783b00938340fbbaebad8fc8a 100644 (file)
@@ -16,8 +16,8 @@ struct Foo {
     x: int
 }
 
-pub impl Foo {
-    fn printme(&mut self) {
+impl Foo {
+    pub fn printme(&mut self) {
         io::println(fmt!("%d", self.x));
     }
 }
index 192fe669f57aedd165ba8af791c12b87bba72d6b..4bbd1b0decf57c8b3f222bf80669e30564b0f0b4 100644 (file)
 
 struct X(Either<(uint,uint),extern fn()>);
 
-pub impl X {
-    fn with(&self, blk: &fn(x: &Either<(uint,uint),extern fn()>)) {
+impl X {
+    pub fn with(&self, blk: &fn(x: &Either<(uint,uint),extern fn()>)) {
         blk(&**self)
     }
 }
+
 fn main() {
     let mut x = X(Right(main));
     do (&mut x).with |opt| {
index 3abd19e5a11364d942dad58988a8be938087c8ee..0aa7cbf50b7a327e8a2ec1df94d33123811cadda 100644 (file)
@@ -12,10 +12,10 @@ struct Foo {
     x: int,
 }
 
-pub impl Foo {
-    fn f(&self) {}
-    fn g(&const self) {}
-    fn h(&mut self) {}
+impl Foo {
+    pub fn f(&self) {}
+    pub fn g(&const self) {}
+    pub fn h(&mut self) {}
 }
 
 fn a(x: &mut Foo) {
index c9bd75039693f564bed044d22d1e8ea76a526699..1a0bec7d723b3fba41d86910bd8737ea823a26a8 100644 (file)
@@ -14,12 +14,12 @@ struct Foo {
   n: HashSet<int>,
 }
 
-pub impl Foo {
-  fn foo(&mut self, fun: &fn(&int)) {
-    for self.n.each |f| {
-      fun(f);
+impl Foo {
+    pub fn foo(&mut self, fun: &fn(&int)) {
+        for self.n.each |f| {
+            fun(f);
+        }
     }
-  }
 }
 
 fn bar(f: &mut Foo) {
index 443bcc921837c53325e4dac951ab615b6d72c13a..b205c5be2179c16050aec75e2946a02bfb24ee3e 100644 (file)
@@ -19,8 +19,8 @@ fn add(&self, z: &int) -> int {
     }
 }
 
-pub impl Point {
-    fn times(&self, z: int) -> int {
+impl Point {
+    pub fn times(&self, z: int) -> int {
         self.x * self.y * z
     }
 }
index 8df9650d9507700f943485b9cceef9be7487748d..7f7c58a60df0500eb8da81ba8155767cc5521ddd 100644 (file)
@@ -19,9 +19,8 @@ struct cat {
   name : ~str,
 }
 
-pub impl cat {
-
-  fn eat(&self) -> bool {
+impl cat {
+  pub fn eat(&self) -> bool {
     if self.how_hungry > 0 {
         error!("OM NOM NOM");
         self.how_hungry -= 2;
@@ -39,7 +38,7 @@ impl noisy for cat {
 
 }
 
-priv impl cat {
+impl cat {
     fn meow(&self) {
       error!("Meow");
       self.meows += 1;
index 4d1c22dfabe81f1122fb110b596e98d1eaf6f6a8..c27c27b5942e1b3276e86c410a94a21883c57b8b 100644 (file)
@@ -12,7 +12,7 @@ struct cat {
   priv meows : uint,
 }
 
-priv impl cat {
+impl cat {
     fn sleep(&self) { loop{} }
     fn meow(&self) {
       error!("Meow");
index 9a574b984ca4758a9e2e63d56afc4972cbd57c15..cb559b91889bb848221d34be55e480b359a2367e 100644 (file)
@@ -14,6 +14,6 @@ struct cat {
   tail: int,
 }
 
-pub impl cat {
-  fn meow() { tail += 1; } //~ ERROR: Did you mean: `self.tail`
+impl cat {
+  pub fn meow() { tail += 1; } //~ ERROR: Did you mean: `self.tail`
 }
index 41527027c744b0898ff08e2548031fd23db0efac..91ae0e1c07a555e9d6f47556e174ad66e145b339 100644 (file)
@@ -14,7 +14,7 @@ pub mod server {
         use std::option;
         use std::pipes;
 
-        pub impl<T:Owned> Stream<T> {
+        impl<T:Owned> Stream<T> {
             pub fn recv() -> extern fn(v: Stream<T>) -> ::stream::Stream<T> {
               // resolve really should report just one error here.
               // Change the test case when it changes.
index f9f1a27e11b2c3e26a57e40755eed4e08d55f9b2..d3aec178c238ad6d28d8766b5ab67ff69a20dc26 100644 (file)
@@ -16,8 +16,8 @@ struct siphash {
         v0: u64,
     }
 
-    pub impl siphash {
-        fn reset(&mut self) {
+    impl siphash {
+        pub fn reset(&mut self) {
            self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR attempted dynamic environment-capture
            //~^ ERROR unresolved name `k0`.
         }
index 02df25d87d7fb9a7a9ffa485e2a800bfd8f75c87..02ccf14138a355d6620d39edb540296babad7052 100644 (file)
@@ -10,8 +10,8 @@
 
 // xfail-test
 struct x(());
-pub impl x {
-    unsafe fn with() { } // This should fail
+impl x {
+    pub unsafe fn with() { } // This should fail
 }
 
 fn main() {
index 5e8230686d5063413f28dfdec915e99071ad3097..4e128b63e925722862c07458e355358b1ae778d2 100644 (file)
@@ -12,11 +12,11 @@ struct Obj {
     member: uint
 }
 
-pub impl Obj {
-    fn boom() -> bool {
+impl Obj {
+    pub fn boom() -> bool {
         return 1+1 == 2
     }
-    fn chirp(&self) {
+    pub fn chirp(&self) {
         self.boom(); //~ ERROR `&Obj` does not implement any method in scope named `boom`
     }
 }
index f6226032eeef384d5c46e496cac8176ddc569091..9647d412d2cdb8e70857cac782090e729c10959f 100644 (file)
@@ -15,7 +15,7 @@ pub struct MyStruct {
     pub fn MyStruct () -> MyStruct {
         MyStruct {priv_field: 4}
     }
-    pub impl MyStruct {
+    impl MyStruct {
         priv fn happyfun(&self) {}
     }
 }
index 7d41481354fa6ff3dfcd80108ac1531cd568d0ac..30c2b9eef8ca00e24dc2fb8a6086db05225d66a9 100644 (file)
@@ -14,8 +14,8 @@ struct cat {
   how_hungry : int,
 }
 
-pub impl cat {
-  fn eat(&self) {
+impl cat {
+  pub fn eat(&self) {
     self.how_hungry -= 5; //~ ERROR cannot assign
   }
 
index a6728f82ec3b300ca92e749354f295c2503801a3..26b7d73ab2af2db19099f5665e157359a257a4dc 100644 (file)
@@ -13,7 +13,7 @@ pub struct Foo {
         x: int
     }
 
-    pub impl Foo {
+    impl Foo {
         priv fn foo(&self) {}
     }
 }
index 800bb1c5703948fd2fe1d09d048c860c8ede51ef..0c67980a5515c3de893e6cf4be0cd89853756e13 100644 (file)
@@ -19,7 +19,7 @@ pub struct cat {
         how_hungry : int,
     }
 
-    pub impl cat {
+    impl cat {
         priv fn nap(&self) { uint::range(1u, 10000u, |_i| false); }
     }
 
index f96ef639e756c0ecd12458fb07a4be87eaa08cf5..0516264d45797dc2cbaf957ec12dd6ed5148c5c7 100644 (file)
@@ -12,13 +12,13 @@ struct dog {
     cats_chased: uint,
 }
 
-pub impl dog {
-    fn chase_cat(&mut self) {
+impl dog {
+    pub fn chase_cat(&mut self) {
         let p: &'static mut uint = &mut self.cats_chased; //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
         *p += 1u;
     }
 
-    fn chase_cat_2(&mut self) {
+    pub fn chase_cat_2(&mut self) {
         let p: &'blk mut uint = &mut self.cats_chased;
         *p += 1u;
     }
index 1c7235743eaa8de75b79c37eafe920c1572e6dcd..f1172690f4dfa85331a6371702f7a0738836eafe 100644 (file)
@@ -14,8 +14,8 @@ struct dog {
     food: uint,
 }
 
-pub impl dog {
-    fn chase_cat(&mut self) {
+impl dog {
+    pub fn chase_cat(&mut self) {
         for uint::range(0u, 10u) |_i| {
             let p: &'static mut uint = &mut self.food; //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
             *p = 3u;
index dc3d414e91b4d49f5b2bc9e470ef322741f30ac1..d438b55f4af790ce9fbad129ce87e52b7374807a 100644 (file)
@@ -22,8 +22,8 @@ pub fn flag<'r>(name: &'r str, desc: &'r str) -> Flag<'r> {
         Flag { name: name, desc: desc, max_count: 1, value: 0 }
     }
 
-    pub impl<'self> Flag<'self> {
-        fn set_desc(self, s: &str) -> Flag<'self> {
+    impl<'self> Flag<'self> {
+        pub fn set_desc(self, s: &str) -> Flag<'self> {
             Flag { //~ ERROR cannot infer an appropriate lifetime
                 name: self.name,
                 desc: s,
index a5e37eb949d28bea5c885fc2271a69c2183c2f70..f687a6f97024a8840870e99487163a97ac933409 100644 (file)
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 // error-pattern: implement a trait or new type instead
-pub impl <T> Option<T> {
-    fn foo(&self) { }
+impl<T> Option<T> {
+    pub fn foo(&self) { }
 }
 
 fn main() { }
index e4e5802fafb6f8a80e7ec08085a7c7c5ef3625fb..5b4d67fb0cef27e5c904144a36723ed25dad22d8 100644 (file)
@@ -6,13 +6,13 @@ impl Drop for S {
     fn finalize(&self) {}
 }
 
-pub impl S {
-    fn foo(self) -> int {
+impl S {
+    pub fn foo(self) -> int {
         self.bar();
         return self.x;  //~ ERROR use of moved value: `self`
     }
 
-    fn bar(self) {}
+    pub fn bar(self) {}
 }
 
 fn main() {
index 4750a5fbd2ddcd471abf57f612d4d27eeffc4ff7..c38f4821b881e4b04c745decee451f2bba38c0f0 100644 (file)
@@ -2,13 +2,13 @@ struct S {
     x: ~int
 }
 
-pub impl S {
-    fn foo(self) -> int {
+impl S {
+    pub fn foo(self) -> int {
         self.bar();
         return *self.x;  //~ ERROR use of moved value: `self`
     }
 
-    fn bar(self) {}
+    pub fn bar(self) {}
 }
 
 fn main() {
index 10462fa4abb22efb0987c8d2d396a7873014ace9..843e9436229ec67473ec8c4ece823c117da41325 100644 (file)
@@ -12,8 +12,8 @@ struct Foo {
     x: int
 }
 
-pub impl Foo {
-    fn new() -> Foo {
+impl Foo {
+    pub fn new() -> Foo {
         Foo { x: 3 }
     }
 }
index 26ef339daf5627c3881b63151aa71c08f02a64d6..8adc2cfd571906595a3322ca25cce7d602566eaf 100644 (file)
@@ -13,8 +13,8 @@
 
 struct Foo(uint);
 
-pub impl Foo {
-    fn len(&self) -> uint { **self }
+impl Foo {
+    pub fn len(&self) -> uint { **self }
 }
 
 pub fn main() {
index 2bc6df4703042216f8c57b51a0efe14a5dd7ed1e..b00d8980c69fefbb56eb2be088a7793dbcda5671 100644 (file)
@@ -12,8 +12,8 @@ struct Foo {
     x: int,
 }
 
-pub impl Foo {
-    fn f(&const self) {}
+impl Foo {
+    pub fn f(&const self) {}
 }
 
 fn g(x: &mut Foo) {
index 4494f5f2fa337be078fd797ab9afeae7ff5648d2..50e9b6d81b5175626c4f5b68c26459ca9b0671fd 100644 (file)
 
 struct Foo {a: uint, b: uint}
 
-pub impl Foo {
-    fn inc_a(&mut self, v: uint) { self.a += v; }
+impl Foo {
+    pub fn inc_a(&mut self, v: uint) { self.a += v; }
 
-    fn next_b(&mut self) -> uint {
+    pub fn next_b(&mut self) -> uint {
         let b = self.b;
         self.b += 1;
         b
index 212bc62a98afcc390c5854296210215a497fb8f5..284db7af66be3b65bf5e42b7dcb0a8de8b6f7c00 100644 (file)
@@ -2,8 +2,8 @@ struct Wizard {
     spells: ~[&'static str]
 }
 
-pub impl Wizard {
-    fn cast(&mut self) {
+impl Wizard {
+    pub fn cast(&mut self) {
         for self.spells.each |&spell| {
             println(spell);
         }
index c41a8c2b284bd1b7ea09a34864f8d05a92377e0c..361cafc40a962426e6eb69b372b9653a89a18b59 100644 (file)
@@ -20,7 +20,7 @@ struct dog {
   volume : @mut int,
 }
 
-pub impl dog {
+impl dog {
     priv fn bark(&self) -> int {
       debug!("Woof %u %d", *self.barks, *self.volume);
       *self.barks += 1u;
@@ -57,11 +57,11 @@ impl noisy for cat {
   fn speak(&self) -> int { self.meow() as int }
 }
 
-pub impl cat {
-  fn meow_count(&self) -> uint { *self.meows }
+impl cat {
+  pub fn meow_count(&self) -> uint { *self.meows }
 }
 
-priv impl cat {
+impl cat {
     fn meow(&self) -> uint {
       debug!("Meow");
       *self.meows += 1u;
index a15afa60c7522367434a9d7b09d45c372e6848a2..a8ff9061216871f5e85e82e9c4a265c00ab96ce3 100644 (file)
@@ -22,8 +22,8 @@ impl noisy for cat {
   fn speak(&mut self) { self.meow(); }
 }
 
-pub impl cat {
-  fn eat(&mut self) -> bool {
+impl cat {
+  pub fn eat(&mut self) -> bool {
     if self.how_hungry > 0 {
         error!("OM NOM NOM");
         self.how_hungry -= 2;
@@ -36,7 +36,7 @@ fn eat(&mut self) -> bool {
   }
 }
 
-priv impl cat {
+impl cat {
     fn meow(&mut self) {
       error!("Meow");
       self.meows += 1u;
index eb2c26478b6934988a6978a49b4b1c7874749e81..11ef86035c56f444947d708e21414cb54ca085a2 100644 (file)
@@ -21,8 +21,8 @@ pub struct cat {
         name: ~str,
     }
 
-    pub impl cat {
-        fn get_name(&self) -> ~str { self.name.clone() }
+    impl cat {
+        pub fn get_name(&self) -> ~str { self.name.clone() }
     }
 
     pub fn cat(in_name: ~str) -> cat {
index b8ea3bec21a65dc6a6c879a61643a170ca897703..88686bcdbfa359b8a33ec0f811f27121e641b8b5 100644 (file)
@@ -37,10 +37,10 @@ struct cat<T> {
     name : T,
 }
 
-pub impl<T> cat<T> {
-    fn speak(&mut self) { self.meow(); }
+impl<T> cat<T> {
+    pub fn speak(&mut self) { self.meow(); }
 
-    fn eat(&mut self) -> bool {
+    pub fn eat(&mut self) -> bool {
         if self.how_hungry > 0 {
             error!("OM NOM NOM");
             self.how_hungry -= 2;
@@ -113,20 +113,20 @@ fn pop(&mut self, _k: &int) -> Option<T> { fail!() }
     fn swap(&mut self, _k: int, _v: T) -> Option<T> { fail!() }
 }
 
-pub impl<T> cat<T> {
-    fn get<'a>(&'a self, k: &int) -> &'a T {
+impl<T> cat<T> {
+    pub fn get<'a>(&'a self, k: &int) -> &'a T {
         match self.find(k) {
           Some(v) => { v }
           None    => { fail!("epic fail"); }
         }
     }
 
-    fn new(in_x: int, in_y: int, in_name: T) -> cat<T> {
+    pub fn new(in_x: int, in_y: int, in_name: T) -> cat<T> {
         cat{meows: in_x, how_hungry: in_y, name: in_name }
     }
 }
 
-priv impl<T> cat<T> {
+impl<T> cat<T> {
     fn meow(&mut self) {
         self.meows += 1;
         error!("Meow %d", self.meows);
index 724f9a0f7b11e4b59f6d658c6b0f3b2fd10b149d..70020b395103da1ecdfa87f7c56d158262417d83 100644 (file)
@@ -22,8 +22,8 @@ struct cat {
   name : ~str,
 }
 
-pub impl cat {
-    fn eat(&mut self) -> bool {
+impl cat {
+    pub fn eat(&mut self) -> bool {
         if self.how_hungry > 0 {
             error!("OM NOM NOM");
             self.how_hungry -= 2;
@@ -40,7 +40,7 @@ impl noisy for cat {
     fn speak(&mut self) { self.meow(); }
 }
 
-priv impl cat {
+impl cat {
     fn meow(&mut self) {
         error!("Meow");
         self.meows += 1u;
index d8ba7320b95bd491108c545e3b42d500d03a9440..8c7c62ce27e3ffbb5451353fbee944bb652b9990 100644 (file)
@@ -23,7 +23,7 @@ struct cat {
     name : ~str,
 }
 
-priv impl cat {
+impl cat {
     fn meow(&mut self) {
         error!("Meow");
         self.meows += 1u;
@@ -33,8 +33,8 @@ fn meow(&mut self) {
     }
 }
 
-pub impl cat {
-    fn eat(&mut self) -> bool {
+impl cat {
+    pub fn eat(&mut self) -> bool {
         if self.how_hungry > 0 {
             error!("OM NOM NOM");
             self.how_hungry -= 2;
index fa358f4b132aaf52a69df77ca6da434bb39e6fe6..fca128b9a97350e86cd18c0f92596fdd98055a6b 100644 (file)
@@ -14,9 +14,9 @@ struct cat {
   how_hungry : int,
 }
 
-pub impl cat {
-    fn speak(&mut self) { self.meows += 1u; }
-    fn meow_count(&mut self) -> uint { self.meows }
+impl cat {
+    pub fn speak(&mut self) { self.meows += 1u; }
+    pub fn meow_count(&mut self) -> uint { self.meows }
 }
 
 fn cat(in_x: uint, in_y: int) -> cat {
index f538eb054a67fa16ae0c55e39807d31842551554..0201501bc7c64848ec7418a8cb214d88034d6c66 100644 (file)
@@ -15,11 +15,11 @@ struct cat<U> {
     how_hungry : int,
 }
 
-pub impl<U> cat<U> {
-    fn speak<T>(&mut self, stuff: ~[T]) {
+impl<U> cat<U> {
+    pub fn speak<T>(&mut self, stuff: ~[T]) {
         self.meows += stuff.len();
     }
-    fn meow_count(&mut self) -> uint { self.meows }
+    pub fn meow_count(&mut self) -> uint { self.meows }
 }
 
 fn cat<U>(in_x : uint, in_y : int, in_info: ~[U]) -> cat<U> {
index 1952520d018bc52292d517b2c32ea16b7b5971de..f31b702519349f306779b9c2fd3809928dfe744f 100644 (file)
@@ -16,10 +16,10 @@ struct cat {
     name : ~str,
 }
 
-pub impl cat {
-    fn speak(&mut self) { self.meow(); }
+impl cat {
+    pub fn speak(&mut self) { self.meow(); }
 
-    fn eat(&mut self) -> bool {
+    pub fn eat(&mut self) -> bool {
         if self.how_hungry > 0 {
             error!("OM NOM NOM");
             self.how_hungry -= 2;
@@ -32,7 +32,7 @@ fn eat(&mut self) -> bool {
     }
 }
 
-priv impl cat {
+impl cat {
     fn meow(&mut self) {
         error!("Meow");
         self.meows += 1u;
index 29354c54d8ba096521bb80e01d0ae78738504b3f..8533add411949adc5cc9d6ce9674cf52023a7419 100644 (file)
@@ -14,9 +14,9 @@ struct cat<U> {
     how_hungry : int,
 }
 
-pub impl<U> cat<U> {
-    fn speak(&mut self) { self.meows += 1u; }
-    fn meow_count(&mut self) -> uint { self.meows }
+impl<U> cat<U> {
+    pub fn speak(&mut self) { self.meows += 1u; }
+    pub fn meow_count(&mut self) -> uint { self.meows }
 }
 
 fn cat<U>(in_x : uint, in_y : int) -> cat<U> {
index 9de1066ec5701008c7fd6d24435d5cf7357d69f9..f27738cf4216ee17eba5cd0a9a4ced7fd97230a2 100644 (file)
@@ -14,8 +14,8 @@ struct cat {
     how_hungry : int,
 }
 
-pub impl cat {
-  fn speak(&mut self) {}
+impl cat {
+    pub fn speak(&mut self) {}
 }
 
 fn cat(in_x : uint, in_y : int) -> cat {
index e3f9b651083494e67d01516e64b839edd4f1b514..89d89d116a38d992c05e19f7c7288a60f05a9ad8 100644 (file)
@@ -17,10 +17,10 @@ struct cat {
     name : ~str,
 }
 
-pub impl cat {
-    fn speak(&mut self) { self.meow(); }
+impl cat {
+    pub fn speak(&mut self) { self.meow(); }
 
-    fn eat(&mut self) -> bool {
+    pub fn eat(&mut self) -> bool {
         if self.how_hungry > 0 {
             error!("OM NOM NOM");
             self.how_hungry -= 2;
@@ -32,7 +32,7 @@ fn eat(&mut self) -> bool {
     }
 }
 
-priv impl cat {
+impl cat {
     fn meow(&mut self) {
         error!("Meow");
         self.meows += 1u;
index 6c78cd250ddd8168c89c94df8d6f0beffdc9f5d9..438c70c6583f4956486cbef66133147e33d86e72 100644 (file)
@@ -2,8 +2,8 @@ struct SpeechMaker {
     speeches: uint
 }
 
-pub impl SpeechMaker {
-    fn how_many(&const self) -> uint { self.speeches }
+impl SpeechMaker {
+    pub fn how_many(&const self) -> uint { self.speeches }
 }
 
 fn foo(speaker: &const SpeechMaker) -> uint {
index fd47c262d6a7d225bfb9cae5ce65b64eb00ab18b..3adb805581dd0d119f879d04a6f355e5938a7262 100644 (file)
@@ -2,8 +2,8 @@ struct SpeechMaker {
     speeches: uint
 }
 
-pub impl SpeechMaker {
-    fn talk(&mut self) {
+impl SpeechMaker {
+    pub fn talk(&mut self) {
         self.speeches += 1;
     }
 }
index c4e1ea727e47ed9e66ed76fd938ca1c948857b73..098a001cfcde977eee7cb9f748c95f1f1c0789ac 100644 (file)
@@ -11,8 +11,8 @@
 enum E { V, VV(int) }
 static C: E = V;
 
-pub impl E {
-    fn method(&self) {
+impl E {
+    pub fn method(&self) {
         match *self {
             V => {}
             VV(*) => fail!()
index e019140d1a015103ae0612a6c5c16c45720a4844..eb62c8a91d2423a125f1a995114cb682fcc9b618 100644 (file)
@@ -14,11 +14,11 @@ struct Box {
     x: uint
 }
 
-pub impl Box {
-    fn set_many(&mut self, xs: &[uint]) {
+impl Box {
+    pub fn set_many(&mut self, xs: &[uint]) {
         for xs.each |x| { self.x = *x; }
     }
-    fn set_many2(@mut self, xs: &[uint]) {
+    pub fn set_many2(@mut self, xs: &[uint]) {
         for xs.each |x| { self.x = *x; }
     }
 }
index c500201d65de3e1fa391bde51b4b14129d2fb65d..80e16af922847da1ce8cbf4a563d72ecffaec341 100644 (file)
@@ -30,8 +30,8 @@ fn linear_map<K,V>() -> HashMap<K,V> {
         size: 0})
 }
 
-pub impl<K,V> HashMap<K,V> {
-    fn len(&mut self) -> uint {
+impl<K,V> HashMap<K,V> {
+    pub fn len(&mut self) -> uint {
         self.size
     }
 }
index 6ae99f64cf069573b55f45bf91879b4aca18654d..25e404021619e796fd0404ae9c5a68fcdbaa0d14 100644 (file)
@@ -26,10 +26,10 @@ fn compute_area(shape: &shape) -> float {
     }
 }
 
-pub impl shape {
+impl shape {
     // self is in the implicit self region
-    fn select<'r, T>(&self, threshold: float,
-                     a: &'r T, b: &'r T) -> &'r T {
+    pub fn select<'r, T>(&self, threshold: float, a: &'r T, b: &'r T)
+                         -> &'r T {
         if compute_area(self) > threshold {a} else {b}
     }
 }
@@ -54,12 +54,12 @@ fn thing(x: A) -> thing {
     }
 }
 
-pub impl thing {
-    fn foo(@self) -> int { *self.x.a }
-    fn bar(~self) -> int { *self.x.a }
-    fn quux(&self) -> int { *self.x.a }
-    fn baz<'a>(&'a self) -> &'a A { &self.x }
-    fn spam(self) -> int { *self.x.a }
+impl thing {
+    pub fn foo(@self) -> int { *self.x.a }
+    pub fn bar(~self) -> int { *self.x.a }
+    pub fn quux(&self) -> int { *self.x.a }
+    pub fn baz<'a>(&'a self) -> &'a A { &self.x }
+    pub fn spam(self) -> int { *self.x.a }
 }
 
 trait Nus { fn f(&self); }
index 10a5661a32468842e03c107390d604cec5e2e0be..a33fc4f2e7402204de52172e1d39ea64071676ef 100644 (file)
@@ -13,8 +13,8 @@ enum option_<T> {
     some_(T),
 }
 
-pub impl<T> option_<T> {
-    fn foo(&self) -> bool { true }
+impl<T> option_<T> {
+    pub fn foo(&self) -> bool { true }
 }
 
 enum option__ {
@@ -22,8 +22,8 @@ enum option__ {
     some__(int)
 }
 
-pub impl option__ {
-    fn foo(&self) -> bool { true }
+impl option__ {
+    pub fn foo(&self) -> bool { true }
 }
 
 pub fn main() {
index 5f47e7ccb9f7975e74dd2187dc33d6d28bfd53d6..155f9cff29629fa4cbe19a005d3e150fc5d2c05e 100644 (file)
@@ -13,8 +13,8 @@ struct foo<A> {
     x: A,
 }
 
-pub impl<A:Copy> foo<A> {
-   fn bar<B,C:clam<A>>(&self, c: C) -> B {
+impl<A:Copy> foo<A> {
+   pub fn bar<B,C:clam<A>>(&self, c: C) -> B {
      fail!();
    }
 }
index f3aa96298f0c5e737b7a0ba68fecf2ef3e7389d1..59ca02f50fc3a57c454898504035b9781665de7c 100644 (file)
@@ -14,8 +14,8 @@ trait clam<A> { }
 
 struct foo(int);
 
-pub impl foo {
-    fn bar<B,C:clam<B>>(&self, c: C) -> B { fail!(); }
+impl foo {
+    pub fn bar<B,C:clam<B>>(&self, c: C) -> B { fail!(); }
 }
 
 pub fn main() { }
index 55c72a41a6a328c7b6a4415432d2887921c1f987..c26038afd764f4af14a60e50b22162317b3eb4c1 100644 (file)
@@ -12,8 +12,8 @@ struct c1<T> {
     x: T,
 }
 
-pub impl<T:Copy> c1<T> {
-    fn f1(&self, x: int) {
+impl<T:Copy> c1<T> {
+    pub fn f1(&self, x: int) {
     }
 }
 
@@ -23,8 +23,8 @@ fn c1<T:Copy>(x: T) -> c1<T> {
     }
 }
 
-pub impl<T:Copy> c1<T> {
-    fn f2(&self, x: int) {
+impl<T:Copy> c1<T> {
+    pub fn f2(&self, x: int) {
     }
 }
 
index 5a82b5340157198234e7eeef50fba5d8000ea33e..64d60725978763848ef5b253230e6113dba4856d 100644 (file)
@@ -12,8 +12,8 @@ struct c1<T> {
     x: T,
 }
 
-pub impl<T:Copy> c1<T> {
-    fn f1(&self, x: T) {}
+impl<T:Copy> c1<T> {
+    pub fn f1(&self, x: T) {}
 }
 
 fn c1<T:Copy>(x: T) -> c1<T> {
@@ -22,8 +22,8 @@ fn c1<T:Copy>(x: T) -> c1<T> {
     }
 }
 
-pub impl<T:Copy> c1<T> {
-    fn f2(&self, x: T) {}
+impl<T:Copy> c1<T> {
+    pub fn f2(&self, x: T) {}
 }
 
 
index 388160e538acd55733fa4e2d0a2d6ac077ac21a3..5e5fb70bcd4a5b200c6c6cf2571a700cff888a8d 100644 (file)
@@ -17,8 +17,8 @@ impl Drop for socket {
     fn finalize(&self) {}
 }
 
-pub impl socket {
-    fn set_identity(&self)  {
+impl socket {
+    pub fn set_identity(&self)  {
         do closure {
             setsockopt_bytes(self.sock.clone())
         }
index 34eb591b73aa4252f5868ef4adb0ab4bb9653c36..c26fef49be73574b9725c143ab0a021d2957a702 100644 (file)
@@ -12,8 +12,8 @@ struct font<'self> {
     fontbuf: &'self ~[u8],
 }
 
-pub impl<'self> font<'self> {
-    fn buf(&self) -> &'self ~[u8] {
+impl<'self> font<'self> {
+    pub fn buf(&self) -> &'self ~[u8] {
         self.fontbuf
     }
 }
index 4dad60225dd904ab0efe5673f64be49d9e763813..d51470cf9bd916ed65c067fceafa83bb675e4b28 100644 (file)
@@ -172,8 +172,8 @@ fn finalize(&self) {
         }
     }
 
-    pub impl<T:Owned> send_packet<T> {
-        fn unwrap(&mut self) -> *packet<T> {
+    impl<T:Owned> send_packet<T> {
+        pub fn unwrap(&mut self) -> *packet<T> {
             util::replace(&mut self.p, None).unwrap()
         }
     }
@@ -202,8 +202,8 @@ fn finalize(&self) {
         }
     }
 
-    pub impl<T:Owned> recv_packet<T> {
-        fn unwrap(&mut self) -> *packet<T> {
+    impl<T:Owned> recv_packet<T> {
+        pub fn unwrap(&mut self) -> *packet<T> {
             util::replace(&mut self.p, None).unwrap()
         }
     }
index 9ecc46c17ac346d00b7e0d3acb3f20d63d812a26..9cc5e5910435fd9f89f5fedbc673f93aec8d69d9 100644 (file)
@@ -19,7 +19,10 @@ fn thing() -> thing {
         x: 0
     }
 }
-pub impl thing { fn f(self) {} }
+
+impl thing {
+    pub fn f(self) {}
+}
 
 pub fn main() {
     let z = thing();
index 20355238e3ebbd371ce2b3f35e9ba71523c71a93..711dfd3778b5b8b6cf46ecf7700e15d3caf35a6e 100644 (file)
@@ -13,8 +13,8 @@ struct list<'self, T> {
     next: Option<@mut list<'self, T>>
 }
 
-pub impl<'self, T> list<'self, T>{
-    fn addEnd(&mut self, element: &'self T) {
+impl<'self, T> list<'self, T>{
+    pub fn addEnd(&mut self, element: &'self T) {
         let newList = list {
             element: element,
             next: None
index 825a49e91b08efc1c2038f68bfd42183a3c1b94b..a94abe04fded2b7e829788686b62b0f9bacbcd1a 100644 (file)
@@ -24,7 +24,7 @@ pub enum Shape {
     Rectangle(Point, Point)
 }
 
-pub impl Shape {
+impl Shape {
     pub fn area(&self, sh: Shape) -> float {
         match sh {
             Circle(_, size) => float::consts::pi * size * size,
index 778b2b72b13d920687fdaf70e7c76f356e3acb6b..0a22e8bcfd07eac07ebd7edf8290a208936ba367 100644 (file)
@@ -10,8 +10,8 @@
 
 struct Foo { x: int }
 
-pub impl Foo {
-    fn stuff<'a>(&'a mut self) -> &'a mut Foo {
+impl Foo {
+    pub fn stuff<'a>(&'a mut self) -> &'a mut Foo {
         return self;
     }
 }
index 1a09a8b860f8454f627d7f9b4c89de2a9663134a..6b0796a1260d5a5528a5d2b1d9c2d7b265de0a62 100644 (file)
@@ -23,8 +23,8 @@ struct X {
     err: ErrPrinter
 }
 
-pub impl X {
-    fn boom() {
+impl X {
+    pub fn boom() {
         exit(self.err, "prog", "arg");
     }
 }
index 87e80568c32232912fbca7303d4941434d6693c4..c34067c329d27a537c2e17bbcda1533c1a4d7f48 100644 (file)
@@ -17,8 +17,8 @@ struct Foo {
     y: int,
 }
 
-pub impl Foo {
-    fn sum(&self) -> int {
+impl Foo {
+    pub fn sum(&self) -> int {
         self.x + self.y
     }
 }
index 61ece52453e3a1ca27ef72a0c9ee60ef34e85a08..55a7edbb679c6df17dc0b044e340ad72888747a4 100644 (file)
@@ -2,12 +2,12 @@ struct S {
     x: ~str
 }
 
-pub impl S {
-    fn foo(self) {
+impl S {
+    pub fn foo(self) {
         self.bar();
     }
 
-    fn bar(self) {
+    pub fn bar(self) {
         println(self.x);
     }
 }
index 3bf4b53c18407b365e6e9c574c0538be75e2c900..6ab9856c0700aefd9abcfafaaa1e461d1f478531 100644 (file)
@@ -13,8 +13,8 @@ struct b {
         i: int,
     }
 
-    pub impl b {
-        fn do_stuff(&self) -> int { return 37; }
+    impl b {
+        pub fn do_stuff(&self) -> int { return 37; }
     }
 
     fn b(i:int) -> b {
index 44a56333a780beb1dbf6164f23082495fe9a75c5..868cbbfa8021284dd061e6a9f30ad5468312d05c 100644 (file)
@@ -14,8 +14,8 @@ struct cat {
     how_hungry : int,
 }
 
-pub impl cat {
-  fn meow_count(&mut self) -> uint { self.meows }
+impl cat {
+  pub fn meow_count(&mut self) -> uint { self.meows }
 }
 
 fn cat(in_x : uint, in_y : int) -> cat {
index 2b811a69db0bf79c176b862d7a7b1acd51968b8d..de07cc7c4d0183de728fdc7e5cf2de6b427a8f1f 100644 (file)
@@ -16,14 +16,14 @@ struct cat {
     how_hungry : int,
 }
 
-pub impl cat {
-    fn play(&mut self) {
+impl cat {
+    pub fn play(&mut self) {
         self.meows += 1u;
         self.nap();
     }
 }
 
-priv impl cat {
+impl cat {
     fn nap(&mut self) { for uint::range(1u, 10u) |_i| { }}
 }
 
index e218d3326eeefa75e3bbc5716f442a66f8d80eb6..f4ccd038afee85678f98b20d67640740b70eb275 100644 (file)
@@ -33,29 +33,29 @@ fn align(size: uint, align: uint) -> uint {
 
 struct ptr_visit_adaptor<V>(Inner<V>);
 
-pub impl<V:TyVisitor + movable_ptr> ptr_visit_adaptor<V> {
+impl<V:TyVisitor + movable_ptr> ptr_visit_adaptor<V> {
 
     #[inline(always)]
-    fn bump(&self, sz: uint) {
+    pub fn bump(&self, sz: uint) {
       do self.inner.move_ptr() |p| {
             ((p as uint) + sz) as *c_void
       };
     }
 
     #[inline(always)]
-    fn align(&self, a: uint) {
+    pub fn align(&self, a: uint) {
       do self.inner.move_ptr() |p| {
             align(p as uint, a) as *c_void
       };
     }
 
     #[inline(always)]
-    fn align_to<T>(&self) {
+    pub fn align_to<T>(&self) {
         self.align(sys::min_align_of::<T>());
     }
 
     #[inline(always)]
-    fn bump_past<T>(&self) {
+    pub fn bump_past<T>(&self) {
         self.bump(sys::size_of::<T>());
     }
 
@@ -485,14 +485,14 @@ struct Stuff {
     vals: ~[~str]
 }
 
-pub impl my_visitor {
-    fn get<T>(&self, f: &fn(T)) {
+impl my_visitor {
+    pub fn get<T>(&self, f: &fn(T)) {
         unsafe {
             f(*(self.ptr1 as *T));
         }
     }
 
-    fn visit_inner(&self, inner: *TyDesc) -> bool {
+    pub fn visit_inner(&self, inner: *TyDesc) -> bool {
         unsafe {
             let u = my_visitor(**self);
             let v = ptr_visit_adaptor::<my_visitor>(Inner {inner: u});
index 174b9a206ccdf2488382c42e3917166661972f2f..58c13885e036cea44a8998eadb16de9ed69c21c2 100644 (file)
@@ -14,8 +14,8 @@ struct Foo {
     f: uint
 }
 
-pub impl Foo {
-    fn foo<'a>(&'a self) {}
+impl Foo {
+    pub fn foo<'a>(&'a self) {}
 }
 
-pub fn main() {}
\ No newline at end of file
+pub fn main() {}
index b69248e327710fe46fe8a4421070011db73f2f2e..c240c6708a4ac2dd89a8e87fbfc6ea19f4bdb716 100644 (file)
@@ -21,8 +21,8 @@ fn finalize(&self) {
     }
 }
 
-pub impl shrinky_pointer {
-  fn look_at(&self) -> int { return **(self.i); }
+impl shrinky_pointer {
+    pub fn look_at(&self) -> int { return **(self.i); }
 }
 
 fn shrinky_pointer(i: @@mut int) -> shrinky_pointer {