]> git.lizzy.rs Git - rust.git/commitdiff
De-implicit-self libstd
authorBen Striegel <ben.striegel@gmail.com>
Fri, 8 Mar 2013 02:11:09 +0000 (21:11 -0500)
committerBen Striegel <ben.striegel@gmail.com>
Fri, 8 Mar 2013 02:11:09 +0000 (21:11 -0500)
14 files changed:
src/libstd/arc.rs
src/libstd/base64.rs
src/libstd/comm.rs
src/libstd/ebml.rs
src/libstd/future.rs
src/libstd/io_util.rs
src/libstd/json.rs
src/libstd/net_ip.rs
src/libstd/net_tcp.rs
src/libstd/oldmap.rs
src/libstd/std.rc
src/libstd/sync.rs
src/libstd/time.rs
src/libstd/workcache.rs

index b9b39063667ef02027ba681df8a0e6c9304cb761..b07e6cdaa80261937a1b94937d7e9e0231fb1f72 100644 (file)
@@ -335,7 +335,7 @@ fn write_cond<U>(&self, blk: fn(x: &x/mut T, c: &c/Condvar) -> U) -> U {
      * Failing will unlock the ARC while unwinding. However, unlike all other
      * access modes, this will not poison the ARC.
      */
-    fn read<U>(blk: fn(x: &T) -> U) -> U {
+    fn read<U>(&self, blk: fn(x: &T) -> U) -> U {
         let state = unsafe { get_shared_immutable_state(&self.x) };
         do (&state.lock).read {
             check_poison(false, state.failed);
@@ -360,7 +360,7 @@ fn read<U>(blk: fn(x: &T) -> U) -> U {
      * }
      * ~~~
      */
-    fn write_downgrade<U>(blk: fn(v: RWWriteMode<T>) -> U) -> U {
+    fn write_downgrade<U>(&self, blk: fn(v: RWWriteMode<T>) -> U) -> U {
         unsafe {
             let state = get_shared_mutable_state(&self.x);
             do (*borrow_rwlock(state)).write_downgrade |write_mode| {
@@ -373,7 +373,7 @@ fn write_downgrade<U>(blk: fn(v: RWWriteMode<T>) -> U) -> U {
     }
 
     /// To be called inside of the write_downgrade block.
-    fn downgrade(token: RWWriteMode/&a<T>) -> RWReadMode/&a<T> {
+    fn downgrade(&self, token: RWWriteMode/&a<T>) -> RWReadMode/&a<T> {
         // The rwlock should assert that the token belongs to us for us.
         let state = unsafe { get_shared_immutable_state(&self.x) };
         let RWWriteMode((data, t, _poison)) = token;
index dceb39312daf3bb8a97fe77157a23b10aa57a338..d8fc6a5b9eedb5349c4e48b8b3e1c735298f36c1 100644 (file)
 use core::vec;
 
 pub trait ToBase64 {
-    pure fn to_base64() -> ~str;
+    pure fn to_base64(&self) -> ~str;
 }
 
 impl ToBase64 for &self/[u8] {
-    pure fn to_base64() -> ~str {
+    pure fn to_base64(&self) -> ~str {
         let chars = str::chars(
           ~"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
         );
@@ -70,17 +70,17 @@ impl ToBase64 for &self/[u8] {
 }
 
 impl ToBase64 for &self/str {
-    pure fn to_base64() -> ~str {
-        str::to_bytes(self).to_base64()
+    pure fn to_base64(&self) -> ~str {
+        str::to_bytes(*self).to_base64()
     }
 }
 
 pub trait FromBase64 {
-    pure fn from_base64() -> ~[u8];
+    pure fn from_base64(&self) -> ~[u8];
 }
 
 impl FromBase64 for ~[u8] {
-    pure fn from_base64() -> ~[u8] {
+    pure fn from_base64(&self) -> ~[u8] {
         if self.len() % 4u != 0u { fail!(~"invalid base64 length"); }
 
         let len = self.len();
@@ -142,8 +142,8 @@ impl FromBase64 for ~[u8] {
 }
 
 impl FromBase64 for ~str {
-    pure fn from_base64() -> ~[u8] {
-        str::to_bytes(self).from_base64()
+    pure fn from_base64(&self) -> ~[u8] {
+        str::to_bytes(*self).from_base64()
     }
 }
 
index e3437fc57aaed8515de5d24ec65dbfcc7586acba..4189b37c2a44074aceb9cdeb450a56e5f937ba17 100644 (file)
@@ -29,19 +29,19 @@ pub struct DuplexStream<T, U> {
 #[cfg(stage1)]
 #[cfg(stage2)]
 pub impl<T:Owned,U:Owned> DuplexStream<T, U> {
-    fn send(x: T) {
+    fn send(&self, x: T) {
         self.chan.send(x)
     }
-    fn try_send(x: T) -> bool {
+    fn try_send(&self, x: T) -> bool {
         self.chan.try_send(x)
     }
-    fn recv() -> U {
+    fn recv(&self, ) -> U {
         self.port.recv()
     }
-    fn try_recv() -> Option<U> {
+    fn try_recv(&self) -> Option<U> {
         self.port.try_recv()
     }
-    pure fn peek() -> bool {
+    pure fn peek(&self) -> bool {
         self.port.peek()
     }
 }
index 7ac58ae539f7ee5e3aa1f9c440b053f7871fe53c..bbf3fc8c0725535ff2bb13d770b1d75954661f63 100644 (file)
@@ -217,7 +217,7 @@ pub fn Decoder(d: Doc) -> Decoder {
     }
 
     priv impl Decoder {
-        fn _check_label(lbl: &str) {
+        fn _check_label(&self, lbl: &str) {
             if self.pos < self.parent.end {
                 let TaggedDoc { tag: r_tag, doc: r_doc } =
                     doc_at(self.parent.data, self.pos);
@@ -233,7 +233,7 @@ fn _check_label(lbl: &str) {
             }
         }
 
-        fn next_doc(exp_tag: EbmlEncoderTag) -> Doc {
+        fn next_doc(&self, exp_tag: EbmlEncoderTag) -> Doc {
             debug!(". next_doc(exp_tag=%?)", exp_tag);
             if self.pos >= self.parent.end {
                 fail!(~"no more documents in current node!");
@@ -255,7 +255,7 @@ fn next_doc(exp_tag: EbmlEncoderTag) -> Doc {
             r_doc
         }
 
-        fn push_doc<T>(d: Doc, f: fn() -> T) -> T {
+        fn push_doc<T>(&self, d: Doc, f: fn() -> T) -> T {
             let old_parent = self.parent;
             let old_pos = self.pos;
             self.parent = d;
@@ -266,7 +266,7 @@ fn push_doc<T>(d: Doc, f: fn() -> T) -> T {
             r
         }
 
-        fn _next_uint(exp_tag: EbmlEncoderTag) -> uint {
+        fn _next_uint(&self, exp_tag: EbmlEncoderTag) -> uint {
             let r = doc_as_u32(self.next_doc(exp_tag));
             debug!("_next_uint exp_tag=%? result=%?", exp_tag, r);
             r as uint
@@ -446,7 +446,7 @@ pub fn Encoder(w: io::Writer) -> Encoder {
 
     // FIXME (#2741): Provide a function to write the standard ebml header.
     pub impl Encoder {
-        fn start_tag(tag_id: uint) {
+        fn start_tag(&self, tag_id: uint) {
             debug!("Start tag %u", tag_id);
 
             // Write the enum ID:
@@ -458,7 +458,7 @@ fn start_tag(tag_id: uint) {
             self.writer.write(zeroes);
         }
 
-        fn end_tag() {
+        fn end_tag(&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);
@@ -469,72 +469,72 @@ fn end_tag() {
             debug!("End tag (size = %u)", size);
         }
 
-        fn wr_tag(tag_id: uint, blk: fn()) {
+        fn wr_tag(&self, tag_id: uint, blk: fn()) {
             self.start_tag(tag_id);
             blk();
             self.end_tag();
         }
 
-        fn wr_tagged_bytes(tag_id: uint, b: &[u8]) {
+        fn wr_tagged_bytes(&self, tag_id: uint, b: &[u8]) {
             write_vuint(self.writer, tag_id);
             write_vuint(self.writer, vec::len(b));
             self.writer.write(b);
         }
 
-        fn wr_tagged_u64(tag_id: uint, v: u64) {
+        fn wr_tagged_u64(&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(tag_id: uint, v: u32) {
+        fn wr_tagged_u32(&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(tag_id: uint, v: u16) {
+        fn wr_tagged_u16(&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(tag_id: uint, v: u8) {
+        fn wr_tagged_u8(&self, tag_id: uint, v: u8) {
             self.wr_tagged_bytes(tag_id, &[v]);
         }
 
-        fn wr_tagged_i64(tag_id: uint, v: i64) {
+        fn wr_tagged_i64(&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(tag_id: uint, v: i32) {
+        fn wr_tagged_i32(&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(tag_id: uint, v: i16) {
+        fn wr_tagged_i16(&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(tag_id: uint, v: i8) {
+        fn wr_tagged_i8(&self, tag_id: uint, v: i8) {
             self.wr_tagged_bytes(tag_id, &[v as u8]);
         }
 
-        fn wr_tagged_str(tag_id: uint, v: &str) {
+        fn wr_tagged_str(&self, tag_id: uint, v: &str) {
             str::byte_slice(v, |b| self.wr_tagged_bytes(tag_id, b));
         }
 
-        fn wr_bytes(b: &[u8]) {
+        fn wr_bytes(&self, b: &[u8]) {
             debug!("Write %u bytes", vec::len(b));
             self.writer.write(b);
         }
 
-        fn wr_str(s: &str) {
+        fn wr_str(&self, s: &str) {
             debug!("Write str: %?", s);
             self.writer.write(str::to_bytes(s));
         }
@@ -549,12 +549,12 @@ fn wr_str(s: &str) {
 
     priv impl Encoder {
         // used internally to emit things like the vector length and so on
-        fn _emit_tagged_uint(t: EbmlEncoderTag, v: uint) {
+        fn _emit_tagged_uint(&self, t: EbmlEncoderTag, v: uint) {
             assert v <= 0xFFFF_FFFF_u;
             self.wr_tagged_u32(t as uint, v as u32);
         }
 
-        fn _emit_label(label: &str) {
+        fn _emit_label(&self, label: &str) {
             // There are various strings that we have access to, such as
             // the name of a record field, which do not actually appear in
             // the encoded EBML (normally).  This is just for
index f105aacbc4f42bd1661a88bd2305b6b253af4fc6..68a9ce75593e253bf0e85136bbfbd10e5f7008dd 100644 (file)
@@ -47,7 +47,7 @@ fn finalize(&self) {}
 
 /// Methods on the `future` type
 pub impl<A:Copy> Future<A> {
-    fn get() -> A {
+    fn get(&self) -> A {
         //! Get the value of the future
         *(self.get_ref())
     }
index 6839981d2017919234953f5408cb5b314798c9ec..7d673feaf254cbcc85caf813505de17ddbd328d5 100644 (file)
@@ -24,7 +24,7 @@ pub impl BufReader {
         }
     }
 
-    priv fn as_bytes_reader<A>(f: &fn(&BytesReader) -> A) -> A {
+    priv fn as_bytes_reader<A>(&self, f: &fn(&BytesReader) -> A) -> A {
         // Recreating the BytesReader state every call since
         // I can't get the borrowing to work correctly
         let bytes_reader = BytesReader {
index cfa66ae000aa5207b2ebda3d00f9cecc57603c18..4ebd151eb2e03cce107fcd891fa98615c939abeb 100644 (file)
@@ -387,7 +387,7 @@ pub fn Parser(rdr: io::Reader) -> Parser {
 }
 
 pub impl Parser {
-    fn parse() -> Result<Json, Error> {
+    fn parse(&self) -> Result<Json, Error> {
         match self.parse_value() {
           Ok(value) => {
             // Skip trailing whitespaces.
@@ -405,9 +405,9 @@ fn parse() -> Result<Json, Error> {
 }
 
 priv impl Parser {
-    fn eof() -> bool { self.ch == -1 as char }
+    fn eof(&self) -> bool { self.ch == -1 as char }
 
-    fn bump() {
+    fn bump(&self) {
         self.ch = self.rdr.read_char();
 
         if self.ch == '\n' {
@@ -418,16 +418,16 @@ fn bump() {
         }
     }
 
-    fn next_char() -> char {
+    fn next_char(&self) -> char {
         self.bump();
         self.ch
     }
 
-    fn error<T>(msg: ~str) -> Result<T, Error> {
+    fn error<T>(&self, msg: ~str) -> Result<T, Error> {
         Err(Error { line: self.line, col: self.col, msg: @msg })
     }
 
-    fn parse_value() -> Result<Json, Error> {
+    fn parse_value(&self) -> Result<Json, Error> {
         self.parse_whitespace();
 
         if self.eof() { return self.error(~"EOF while parsing value"); }
@@ -448,11 +448,11 @@ fn parse_value() -> Result<Json, Error> {
         }
     }
 
-    fn parse_whitespace() {
+    fn parse_whitespace(&self) {
         while char::is_whitespace(self.ch) { self.bump(); }
     }
 
-    fn parse_ident(ident: &str, value: Json) -> Result<Json, Error> {
+    fn parse_ident(&self, ident: &str, value: Json) -> Result<Json, Error> {
         if str::all(ident, |c| c == self.next_char()) {
             self.bump();
             Ok(value)
@@ -461,7 +461,7 @@ fn parse_ident(ident: &str, value: Json) -> Result<Json, Error> {
         }
     }
 
-    fn parse_number() -> Result<Json, Error> {
+    fn parse_number(&self) -> Result<Json, Error> {
         let mut neg = 1f;
 
         if self.ch == '-' {
@@ -491,7 +491,7 @@ fn parse_number() -> Result<Json, Error> {
         Ok(Number(neg * res))
     }
 
-    fn parse_integer() -> Result<float, Error> {
+    fn parse_integer(&self) -> Result<float, Error> {
         let mut res = 0f;
 
         match self.ch {
@@ -523,7 +523,7 @@ fn parse_integer() -> Result<float, Error> {
         Ok(res)
     }
 
-    fn parse_decimal(res: float) -> Result<float, Error> {
+    fn parse_decimal(&self, res: float) -> Result<float, Error> {
         self.bump();
 
         // Make sure a digit follows the decimal place.
@@ -549,7 +549,7 @@ fn parse_decimal(res: float) -> Result<float, Error> {
         Ok(res)
     }
 
-    fn parse_exponent(res: float) -> Result<float, Error> {
+    fn parse_exponent(&self, res: float) -> Result<float, Error> {
         self.bump();
 
         let mut res = res;
@@ -590,7 +590,7 @@ fn parse_exponent(res: float) -> Result<float, Error> {
         Ok(res)
     }
 
-    fn parse_str() -> Result<~str, Error> {
+    fn parse_str(&self) -> Result<~str, Error> {
         let mut escape = false;
         let mut res = ~"";
 
@@ -654,7 +654,7 @@ fn parse_str() -> Result<~str, Error> {
         self.error(~"EOF while parsing string")
     }
 
-    fn parse_list() -> Result<Json, Error> {
+    fn parse_list(&self) -> Result<Json, Error> {
         self.bump();
         self.parse_whitespace();
 
@@ -684,7 +684,7 @@ fn parse_list() -> Result<Json, Error> {
         };
     }
 
-    fn parse_object() -> Result<Json, Error> {
+    fn parse_object(&self) -> Result<Json, Error> {
         self.bump();
         self.parse_whitespace();
 
@@ -1072,87 +1072,87 @@ impl Eq for Error {
     pure fn ne(&self, other: &Error) -> bool { !(*self).eq(other) }
 }
 
-trait ToJson { fn to_json() -> Json; }
+trait ToJson { fn to_json(&self) -> Json; }
 
 impl ToJson for Json {
-    fn to_json() -> Json { copy self }
+    fn to_json(&self) -> Json { copy *self }
 }
 
 impl ToJson for @Json {
-    fn to_json() -> Json { (*self).to_json() }
+    fn to_json(&self) -> Json { (**self).to_json() }
 }
 
 impl ToJson for int {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for i8 {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for i16 {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for i32 {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for i64 {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for uint {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for u8 {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for u16 {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for u32 {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for u64 {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for float {
-    fn to_json() -> Json { Number(self) }
+    fn to_json(&self) -> Json { Number(*self) }
 }
 
 impl ToJson for f32 {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for f64 {
-    fn to_json() -> Json { Number(self as float) }
+    fn to_json(&self) -> Json { Number(*self as float) }
 }
 
 impl ToJson for () {
-    fn to_json() -> Json { Null }
+    fn to_json(&self) -> Json { Null }
 }
 
 impl ToJson for bool {
-    fn to_json() -> Json { Boolean(self) }
+    fn to_json(&self) -> Json { Boolean(*self) }
 }
 
 impl ToJson for ~str {
-    fn to_json() -> Json { String(copy self) }
+    fn to_json(&self) -> Json { String(copy *self) }
 }
 
 impl ToJson for @~str {
-    fn to_json() -> Json { String(copy *self) }
+    fn to_json(&self) -> Json { String(copy **self) }
 }
 
 impl<A:ToJson,B:ToJson> ToJson for (A, B) {
-    fn to_json() -> Json {
-        match self {
+    fn to_json(&self) -> Json {
+        match *self {
           (ref a, ref b) => {
             List(~[a.to_json(), b.to_json()])
           }
@@ -1161,8 +1161,8 @@ fn to_json() -> Json {
 }
 
 impl<A:ToJson,B:ToJson,C:ToJson> ToJson for (A, B, C) {
-    fn to_json() -> Json {
-        match self {
+    fn to_json(&self) -> Json {
+        match *self {
           (ref a, ref b, ref c) => {
             List(~[a.to_json(), b.to_json(), c.to_json()])
           }
@@ -1171,11 +1171,11 @@ fn to_json() -> Json {
 }
 
 impl<A:ToJson> ToJson for ~[A] {
-    fn to_json() -> Json { List(self.map(|elt| elt.to_json())) }
+    fn to_json(&self) -> Json { List(self.map(|elt| elt.to_json())) }
 }
 
 impl<A:ToJson + Copy> ToJson for LinearMap<~str, A> {
-    fn to_json() -> Json {
+    fn to_json(&self) -> Json {
         let mut d = LinearMap::new();
         for self.each |&(key, value)| {
             d.insert(copy *key, value.to_json());
@@ -1185,8 +1185,8 @@ fn to_json() -> Json {
 }
 
 impl<A:ToJson> ToJson for Option<A> {
-    fn to_json() -> Json {
-        match self {
+    fn to_json(&self) -> Json {
+        match *self {
           None => Null,
           Some(ref value) => value.to_json()
         }
index 95e10cf5b12a6e321dbd181cfab465fcb25adb29..7a5c40f403f7b99cfebb23af3f83683c0f110a45 100644 (file)
@@ -187,13 +187,13 @@ pub fn parse_addr(ip: &str) -> IpAddr {
     pub struct Ipv4Rep { a: u8, b: u8, c: u8, d: u8 }
 
     pub trait AsUnsafeU32 {
-        unsafe fn as_u32() -> u32;
+        unsafe fn as_u32(&self) -> u32;
     }
 
     impl AsUnsafeU32 for Ipv4Rep {
         // this is pretty dastardly, i know
-        unsafe fn as_u32() -> u32 {
-            *((ptr::addr_of(&self)) as *u32)
+        unsafe fn as_u32(&self) -> u32 {
+            *((ptr::addr_of(self)) as *u32)
         }
     }
     pub fn parse_to_ipv4_rep(ip: &str) -> result::Result<Ipv4Rep, ~str> {
index eea9f427326a1b310803b3bd88dd1dd85fef77e8..f270739b2f2e63425429b8e7909440de66cac3ad 100644 (file)
@@ -823,31 +823,31 @@ pub fn socket_buf(sock: TcpSocket) -> TcpSocketBuf {
 
 /// Convenience methods extending `net::tcp::TcpSocket`
 pub impl TcpSocket {
-    pub fn read_start() -> result::Result<@Port<
+    pub fn read_start(&self) -> result::Result<@Port<
         result::Result<~[u8], TcpErrData>>, TcpErrData> {
-        read_start(&self)
+        read_start(self)
     }
-    pub fn read_stop() ->
+    pub fn read_stop(&self) ->
         result::Result<(), TcpErrData> {
-        read_stop(&self)
+        read_stop(self)
     }
-    fn read(timeout_msecs: uint) ->
+    fn read(&self, timeout_msecs: uint) ->
         result::Result<~[u8], TcpErrData> {
-        read(&self, timeout_msecs)
+        read(self, timeout_msecs)
     }
-    fn read_future(timeout_msecs: uint) ->
+    fn read_future(&self, timeout_msecs: uint) ->
         future::Future<result::Result<~[u8], TcpErrData>> {
-        read_future(&self, timeout_msecs)
+        read_future(self, timeout_msecs)
     }
-    pub fn write(raw_write_data: ~[u8])
+    pub fn write(&self, raw_write_data: ~[u8])
         -> result::Result<(), TcpErrData> {
-        write(&self, raw_write_data)
+        write(self, raw_write_data)
     }
-    pub fn write_future(raw_write_data: ~[u8])
+    pub fn write_future(&self, raw_write_data: ~[u8])
         -> future::Future<result::Result<(), TcpErrData>> {
-        write_future(&self, raw_write_data)
+        write_future(self, raw_write_data)
     }
-    pub fn get_peer_addr() -> ip::IpAddr {
+    pub fn get_peer_addr(&self) -> ip::IpAddr {
         unsafe {
             if self.socket_data.ipv6 {
                 let addr = uv::ll::ip6_addr("", 0);
@@ -1264,11 +1264,11 @@ enum TcpReadResult {
 }
 
 trait ToTcpErr {
-    fn to_tcp_err() -> TcpErrData;
+    fn to_tcp_err(&self) -> TcpErrData;
 }
 
 impl ToTcpErr for uv::ll::uv_err_data {
-    fn to_tcp_err() -> TcpErrData {
+    fn to_tcp_err(&self) -> TcpErrData {
         TcpErrData { err_name: self.err_name, err_msg: self.err_msg }
     }
 }
index faa26e24812226e49bbc43f069e6e6e3c53b609f..eb5ad2b6d73badff031ecb6c95c6c0dd3ce4bfe0 100644 (file)
@@ -74,7 +74,7 @@ enum SearchResult<K, V> {
     }
 
     priv impl<K:Eq + IterBytes + Hash,V> T<K, V> {
-        pure fn search_rem(k: &K, h: uint, idx: uint,
+        pure fn search_rem(&self, k: &K, h: uint, idx: uint,
                            e_root: @Entry<K,V>) -> SearchResult<K,V> {
             let mut e0 = e_root;
             let mut comp = 1u;   // for logging
@@ -100,7 +100,7 @@ enum SearchResult<K, V> {
             };
         }
 
-        pure fn search_tbl(k: &K, h: uint) -> SearchResult<K,V> {
+        pure fn search_tbl(&self, k: &K, h: uint) -> SearchResult<K,V> {
             let idx = h % vec::len(self.chains);
             match copy self.chains[idx] {
               None => {
@@ -120,7 +120,7 @@ enum SearchResult<K, V> {
             }
         }
 
-        fn rehash() {
+        fn rehash(&self) {
             let n_old_chains = self.chains.len();
             let n_new_chains: uint = uint::next_power_of_two(n_old_chains+1u);
             let mut new_chains = chains(n_new_chains);
@@ -134,7 +134,7 @@ fn rehash() {
     }
 
     pub impl<K:Eq + IterBytes + Hash,V> T<K, V> {
-        pure fn each_entry(blk: fn(@Entry<K,V>) -> bool) {
+        pure fn each_entry(&self, blk: fn(@Entry<K,V>) -> bool) {
             // n.b. we can't use vec::iter() here because self.chains
             // is stored in a mutable location.
             let mut i = 0u, n = self.chains.len();
@@ -176,7 +176,7 @@ pub impl<K:Eq + IterBytes + Hash,V> T<K, V> {
             }
         }
 
-        fn insert(k: K, v: V) -> bool {
+        fn insert(&self, k: K, v: V) -> bool {
             let hash = k.hash_keyed(0,0) as uint;
             match self.search_tbl(&k, hash) {
               NotFound => {
@@ -220,7 +220,7 @@ fn insert(k: K, v: V) -> bool {
             }
         }
 
-        fn remove(k: &K) -> bool {
+        fn remove(&self, k: &K) -> bool {
             match self.search_tbl(k, k.hash_keyed(0,0) as uint) {
               NotFound => false,
               FoundFirst(idx, entry) => {
@@ -260,7 +260,8 @@ pub impl<K:Eq + IterBytes + Hash + Copy,V:Copy> T<K, V> {
             }
         }
 
-        fn update_with_key(key: K, newval: V, ff: fn(K, V, V) -> V) -> bool {
+        fn update_with_key(&self, key: K, newval: V, ff: fn(K, V, V) -> V)
+                          -> bool {
 /*
             match self.find(key) {
                 None            => return self.insert(key, val),
@@ -311,7 +312,7 @@ fn update_with_key(key: K, newval: V, ff: fn(K, V, V) -> V) -> bool {
             }
         }
 
-        fn update(key: K, newval: V, ff: fn(V, V) -> V) -> bool {
+        fn update(&self, key: K, newval: V, ff: fn(V, V) -> V) -> bool {
             return self.update_with_key(key, newval, |_k, v, v1| ff(v,v1));
         }
 
@@ -325,7 +326,7 @@ fn update(key: K, newval: V, ff: fn(V, V) -> V) -> bool {
     }
 
     pub impl<K:Eq + IterBytes + Hash + Copy + ToStr,V:ToStr + Copy> T<K, V> {
-        fn to_writer(wr: io::Writer) {
+        fn to_writer(&self, wr: io::Writer) {
             if self.count == 0u {
                 wr.write_str(~"{}");
                 return;
index f29872bf3871243a6ff4e5897a6af79463232ca0..a3b18e50df26aeaf9976cf6569aeb511b2ff0f74 100644 (file)
@@ -28,7 +28,7 @@ not required in or otherwise suitable for the core library.
 
 #[allow(vecs_implicitly_copyable)];
 #[deny(non_camel_case_types)];
-#[allow(deprecated_self)];
+#[deny(deprecated_self)];
 #[allow(deprecated_mutable_fields)];
 
 #[no_core];
index e02d09954d32a327165218064ff45bc5eca7b4b5..6c8d719e5f517b8baa73757619c7f71456a5560c 100644 (file)
@@ -99,7 +99,7 @@ fn new_sem_and_signal(count: int, num_condvars: uint)
 
 #[doc(hidden)]
 pub impl<Q:Owned> &self/Sem<Q> {
-    fn acquire() {
+    fn acquire(&self) {
         let mut waiter_nobe = None;
         unsafe {
             do (**self).with |state| {
@@ -121,7 +121,7 @@ fn acquire() {
             let _ = comm::recv_one(option::unwrap(waiter_nobe));
         }
     }
-    fn release() {
+    fn release(&self) {
         unsafe {
             do (**self).with |state| {
                 state.count += 1;
@@ -135,12 +135,12 @@ fn release() {
 // FIXME(#3154) move both copies of this into Sem<Q>, and unify the 2 structs
 #[doc(hidden)]
 pub impl &self/Sem<()> {
-    fn access<U>(blk: fn() -> U) -> U {
+    fn access<U>(&self, blk: fn() -> U) -> U {
         let mut release = None;
         unsafe {
             do task::unkillable {
                 self.acquire();
-                release = Some(SemRelease(self));
+                release = Some(SemRelease(*self));
             }
         }
         blk()
@@ -148,12 +148,12 @@ fn access<U>(blk: fn() -> U) -> U {
 }
 #[doc(hidden)]
 pub impl &self/Sem<~[Waitqueue]> {
-    fn access<U>(blk: fn() -> U) -> U {
+    fn access<U>(&self, blk: fn() -> U) -> U {
         let mut release = None;
         unsafe {
             do task::unkillable {
                 self.acquire();
-                release = Some(SemAndSignalRelease(self));
+                release = Some(SemAndSignalRelease(*self));
             }
         }
         blk()
@@ -385,7 +385,7 @@ fn acquire(&self) { (&self.sem).acquire() }
     fn release(&self) { (&self.sem).release() }
 
     /// Run a function with ownership of one of the semaphore's resources.
-    fn access<U>(blk: fn() -> U) -> U { (&self.sem).access(blk) }
+    fn access<U>(&self, blk: fn() -> U) -> U { (&self.sem).access(blk) }
 }
 
 /****************************************************************************
index 7a4da436d12f8c89b0a628720dbbdb60055bc582..3801fdf88347de741467531413365aedff45ce64 100644 (file)
@@ -209,25 +209,25 @@ pub fn now() -> Tm {
 
 pub impl Tm {
     /// Convert time to the seconds from January 1, 1970
-    fn to_timespec() -> Timespec {
+    fn to_timespec(&self) -> Timespec {
         unsafe {
             let mut sec = 0i64;
             if self.tm_gmtoff == 0_i32 {
-                rustrt::rust_timegm(self, &mut sec);
+                rustrt::rust_timegm(*self, &mut sec);
             } else {
-                rustrt::rust_mktime(self, &mut sec);
+                rustrt::rust_mktime(*self, &mut sec);
             }
             Timespec::new(sec, self.tm_nsec)
         }
     }
 
     /// Convert time to the local timezone
-    fn to_local() -> Tm {
+    fn to_local(&self) -> Tm {
         at(self.to_timespec())
     }
 
     /// Convert time to the UTC
-    fn to_utc() -> Tm {
+    fn to_utc(&self) -> Tm {
         at_utc(self.to_timespec())
     }
 
@@ -235,7 +235,7 @@ fn to_utc() -> Tm {
      * Return a string of the current time in the form
      * "Thu Jan  1 00:00:00 1970".
      */
-    pure fn ctime() -> ~str { self.strftime(~"%c") }
+    pure fn ctime(&self) -> ~str { self.strftime(~"%c") }
 
     /// Formats the time according to the format string.
     pure fn strftime(&self, format: &str) -> ~str {
@@ -248,7 +248,7 @@ fn to_utc() -> Tm {
      * local: "Thu, 22 Mar 2012 07:53:18 PST"
      * utc:   "Thu, 22 Mar 2012 14:53:18 UTC"
      */
-    pure fn rfc822() -> ~str {
+    pure fn rfc822(&self) -> ~str {
         if self.tm_gmtoff == 0_i32 {
             self.strftime(~"%a, %d %b %Y %T GMT")
         } else {
@@ -262,7 +262,7 @@ fn to_utc() -> Tm {
      * local: "Thu, 22 Mar 2012 07:53:18 -0700"
      * utc:   "Thu, 22 Mar 2012 14:53:18 -0000"
      */
-    pure fn rfc822z() -> ~str {
+    pure fn rfc822z(&self) -> ~str {
         self.strftime(~"%a, %d %b %Y %T %z")
     }
 
@@ -272,7 +272,7 @@ fn to_utc() -> Tm {
      * local: "2012-02-22T07:53:18-07:00"
      * utc:   "2012-02-22T14:53:18Z"
      */
-    pure fn rfc3339() -> ~str {
+    pure fn rfc3339(&self) -> ~str {
         if self.tm_gmtoff == 0_i32 {
             self.strftime(~"%Y-%m-%dT%H:%M:%SZ")
         } else {
index e5435ca18b7a1e4bc683af5ac33f60da06257873..eac6e090f1f10dd104af9d66ccd01fff60e3320c 100644 (file)
@@ -200,7 +200,7 @@ struct Logger {
 }
 
 pub impl Logger {
-    fn info(i: &str) {
+    fn info(&self, i: &str) {
         io::println(~"workcache: " + i.to_owned());
     }
 }