From 5731ca3078318a66a13208133d8839a9f9f92629 Mon Sep 17 00:00:00 2001 From: Erik Price Date: Mon, 9 Dec 2013 23:16:18 -0800 Subject: [PATCH] Make 'self lifetime illegal. Also remove all instances of 'self within the codebase. This fixes #10889. --- doc/rust.md | 10 +- src/libextra/arc.rs | 24 +- src/libextra/base64.rs | 4 +- src/libextra/bitv.rs | 18 +- src/libextra/dlist.rs | 32 +- src/libextra/hex.rs | 4 +- src/libextra/json.rs | 88 +++--- src/libextra/priority_queue.rs | 8 +- src/libextra/ringbuf.rs | 34 +- src/libextra/serialize.rs | 6 +- src/libextra/smallintmap.rs | 24 +- src/libextra/sort.rs | 4 +- src/libextra/stats.rs | 2 +- src/libextra/sync.rs | 20 +- src/libextra/treemap.rs | 78 ++--- src/libextra/workcache.rs | 42 +-- src/librustc/front/config.rs | 6 +- src/librustc/metadata/decoder.rs | 4 +- src/librustc/metadata/encoder.rs | 36 +-- src/librustc/metadata/filesearch.rs | 2 +- src/librustc/metadata/tydecode.rs | 8 +- src/librustc/middle/astencode.rs | 2 +- src/librustc/middle/borrowck/check_loans.rs | 12 +- .../middle/borrowck/gather_loans/lifetime.rs | 6 +- .../middle/borrowck/gather_loans/mod.rs | 8 +- .../borrowck/gather_loans/restrictions.rs | 6 +- src/librustc/middle/dataflow.rs | 8 +- src/librustc/middle/lang_items.rs | 6 +- src/librustc/middle/lint.rs | 10 +- src/librustc/middle/privacy.rs | 16 +- src/librustc/middle/resolve.rs | 14 +- src/librustc/middle/resolve_lifetime.rs | 22 +- src/librustc/middle/subst.rs | 6 +- src/librustc/middle/trans/_match.rs | 12 +- src/librustc/middle/trans/base.rs | 12 +- src/librustc/middle/trans/basic_block.rs | 2 +- src/librustc/middle/trans/cabi_x86_64.rs | 2 +- src/librustc/middle/trans/callee.rs | 6 +- src/librustc/middle/trans/debuginfo.rs | 4 +- src/librustc/middle/trans/glue.rs | 2 +- src/librustc/middle/trans/llrepr.rs | 2 +- src/librustc/middle/trans/tvec.rs | 2 +- src/librustc/middle/ty.rs | 6 +- src/librustc/middle/ty_fold.rs | 26 +- src/librustc/middle/typeck/astconv.rs | 2 +- src/librustc/middle/typeck/check/method.rs | 6 +- src/librustc/middle/typeck/check/mod.rs | 2 +- .../middle/typeck/check/regionmanip.rs | 8 +- src/librustc/middle/typeck/check/vtable.rs | 6 +- src/librustc/middle/typeck/infer/lattice.rs | 6 +- .../typeck/infer/region_inference/doc.rs | 8 +- src/librustc/middle/typeck/variance.rs | 88 +++--- src/librustc/util/common.rs | 12 +- src/librustc/util/ppaux.rs | 2 +- src/librustdoc/clean.rs | 2 +- src/librustdoc/html/escape.rs | 6 +- src/librustdoc/html/format.rs | 6 +- src/librustdoc/html/layout.rs | 8 +- src/librustdoc/html/markdown.rs | 6 +- src/librustdoc/html/render.rs | 36 +-- src/librustdoc/passes.rs | 12 +- src/librustpkg/lib.rs | 6 +- src/librustpkg/util.rs | 18 +- src/libstd/any.rs | 18 +- src/libstd/ascii.rs | 16 +- src/libstd/at_vec.rs | 2 +- src/libstd/borrow.rs | 24 +- src/libstd/c_str.rs | 10 +- src/libstd/cleanup.rs | 2 +- src/libstd/clone.rs | 12 +- src/libstd/condition.rs | 16 +- src/libstd/fmt/mod.rs | 28 +- src/libstd/fmt/parse.rs | 76 ++--- src/libstd/fmt/rt.rs | 26 +- src/libstd/hash.rs | 4 +- src/libstd/hashmap.rs | 30 +- src/libstd/io/mem.rs | 22 +- src/libstd/io/mod.rs | 10 +- src/libstd/io/net/ip.rs | 8 +- src/libstd/io/process.rs | 12 +- src/libstd/iter.rs | 100 +++--- src/libstd/path/mod.rs | 16 +- src/libstd/path/posix.rs | 14 +- src/libstd/path/windows.rs | 20 +- src/libstd/rand/isaac.rs | 12 +- src/libstd/rand/mod.rs | 6 +- src/libstd/repr.rs | 10 +- src/libstd/rt/comm.rs | 8 +- src/libstd/rt/crate_map.rs | 10 +- src/libstd/run.rs | 6 +- src/libstd/select.rs | 2 +- src/libstd/send_str.rs | 2 +- src/libstd/str.rs | 260 ++++++++-------- src/libstd/to_bytes.rs | 8 +- src/libstd/to_str.rs | 2 +- src/libstd/trie.rs | 14 +- src/libstd/unstable/dynamic_lib.rs | 2 +- src/libstd/unstable/finally.rs | 8 +- src/libstd/unstable/raw.rs | 4 +- src/libstd/vec.rs | 290 +++++++++--------- src/libsyntax/ast_util.rs | 14 +- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/ext/deriving/generic.rs | 54 ++-- src/libsyntax/ext/deriving/mod.rs | 4 +- src/libsyntax/ext/deriving/ty.rs | 32 +- src/libsyntax/ext/quote.rs | 14 +- src/libsyntax/opt_vec.rs | 8 +- src/libsyntax/parse/lexer.rs | 13 +- src/libsyntax/parse/parser.rs | 6 +- src/libsyntax/print/pprust.rs | 10 +- src/libsyntax/visit.rs | 6 +- src/test/auxiliary/iss.rs | 4 +- src/test/bench/shootout-binarytrees.rs | 4 +- src/test/bench/shootout-meteor.rs | 22 +- .../compile-fail/auto-ref-slice-plus-ref.rs | 2 +- ...rowck-assign-to-andmut-in-aliasable-loc.rs | 4 +- ...rrowck-assign-to-andmut-in-borrowed-loc.rs | 4 +- .../borrowck-borrowed-uniq-rvalue-2.rs | 6 +- .../compile-fail/builtin-superkinds-simple.rs | 4 +- src/test/compile-fail/issue-3154.rs | 4 +- src/test/compile-fail/issue-5500-1.rs | 4 +- .../compile-fail/kindck-owned-trait-scoped.rs | 6 +- src/test/compile-fail/lifetime-no-keyword.rs | 7 +- .../compile-fail/lifetime-obsoleted-self.rs | 13 + ...ased-on-type-no-recursive-stack-closure.rs | 4 +- src/test/compile-fail/regions-bounds.rs | 4 +- .../compile-fail/regions-creating-enums.rs | 4 +- .../compile-fail/regions-creating-enums3.rs | 4 +- .../compile-fail/regions-creating-enums4.rs | 4 +- .../regions-escape-via-trait-or-not.rs | 2 +- .../regions-free-region-ordering-caller.rs | 2 +- .../regions-free-region-ordering-incorrect.rs | 14 +- .../compile-fail/regions-glb-free-free.rs | 10 +- src/test/compile-fail/regions-in-enums.rs | 6 +- src/test/compile-fail/regions-in-structs.rs | 6 +- .../regions-infer-at-fn-not-param.rs | 4 +- ...ns-infer-invariance-due-to-mutability-3.rs | 4 +- ...ns-infer-invariance-due-to-mutability-4.rs | 4 +- .../compile-fail/regions-infer-not-param.rs | 10 +- .../regions-infer-paramd-indirect.rs | 18 +- .../regions-infer-paramd-method.rs | 10 +- .../compile-fail/regions-steal-closure.rs | 4 +- src/test/compile-fail/regions-trait-1.rs | 6 +- src/test/compile-fail/regions-trait-2.rs | 8 +- src/test/compile-fail/regions-trait-3.rs | 10 +- src/test/compile-fail/regions-undeclared.rs | 4 +- src/test/compile-fail/unconstrained-ref.rs | 4 +- src/test/debug-info/option-like-enum.rs | 16 +- ...orrowck-wg-one-mut-one-imm-slice-method.rs | 8 +- src/test/run-pass/assignability-trait.rs | 2 +- src/test/run-pass/auto-ref-slice-plus-ref.rs | 4 +- .../run-pass/borrow-by-val-method-receiver.rs | 2 +- src/test/run-pass/const-fn-val.rs | 2 +- .../run-pass/const-region-ptrs-noncopy.rs | 2 +- src/test/run-pass/const-region-ptrs.rs | 2 +- src/test/run-pass/const-vec-of-fns.rs | 2 +- ...deriving-self-lifetime-totalord-totaleq.rs | 4 +- src/test/run-pass/deriving-self-lifetime.rs | 4 +- src/test/run-pass/expr-block-generic-box2.rs | 2 +- .../run-pass/expr-block-generic-unique1.rs | 2 +- .../run-pass/expr-block-generic-unique2.rs | 2 +- src/test/run-pass/expr-block-generic.rs | 2 +- .../run-pass/expr-match-generic-unique2.rs | 2 +- src/test/run-pass/fn-coerce-field.rs | 4 +- src/test/run-pass/hashmap-memory.rs | 2 +- src/test/run-pass/issue-2502.rs | 8 +- src/test/run-pass/issue-2748-a.rs | 4 +- src/test/run-pass/issue-5243.rs | 4 +- src/test/run-pass/issue-5708.rs | 14 +- src/test/run-pass/issue-5884.rs | 4 +- src/test/run-pass/issue-7012.rs | 2 +- src/test/run-pass/issue-7563.rs | 6 +- src/test/run-pass/issue-8249.rs | 4 +- src/test/run-pass/issue-9382.rs | 8 +- src/test/run-pass/rcvr-borrowed-to-region.rs | 2 +- src/test/run-pass/rcvr-borrowed-to-slice.rs | 2 +- src/test/run-pass/regions-copy-closure.rs | 4 +- src/test/run-pass/regions-creating-enums2.rs | 4 +- src/test/run-pass/regions-creating-enums5.rs | 4 +- ...regions-infer-contravariance-due-to-ret.rs | 4 +- src/test/run-pass/regions-mock-trans.rs | 10 +- src/test/run-pass/regions-nullary-variant.rs | 4 +- src/test/run-pass/regions-self-impls.rs | 12 +- src/test/run-pass/regions-self-in-enums.rs | 4 +- src/test/run-pass/regions-static-closure.rs | 4 +- .../run-pass/struct-field-assignability.rs | 4 +- src/test/run-pass/unfold-cross-crate.rs | 2 +- 187 files changed, 1290 insertions(+), 1277 deletions(-) create mode 100644 src/test/compile-fail/lifetime-obsoleted-self.rs diff --git a/doc/rust.md b/doc/rust.md index 7368ba2b7e7..63fb30ef2f3 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -1239,9 +1239,9 @@ static BIT2: uint = 1 << 1; static BITS: [uint, ..2] = [BIT1, BIT2]; static STRING: &'static str = "bitstring"; -struct BitsNStrings<'self> { +struct BitsNStrings<'a> { mybits: [uint, ..2], - mystring: &'self str + mystring: &'a str } static bits_n_strings: BitsNStrings<'static> = BitsNStrings { @@ -2281,7 +2281,7 @@ The following are examples of structure expressions: ~~~~ # struct Point { x: f64, y: f64 } # struct TuplePoint(f64, f64); -# mod game { pub struct User<'self> { name: &'self str, age: uint, score: uint } } +# mod game { pub struct User<'a> { name: &'a str, age: uint, score: uint } } # struct Cookie; fn some_fn(t: T) {} Point {x: 10.0, y: 20.0}; TuplePoint(10.0, 20.0); @@ -3055,7 +3055,7 @@ order specified by the tuple type. An example of a tuple type and its use: ~~~~ -type Pair<'self> = (int,&'self str); +type Pair<'a> = (int,&'a str); let p: Pair<'static> = (10,"hello"); let (a, b) = p; assert!(b != "world"); @@ -3220,7 +3220,7 @@ fn add(x: int, y: int) -> int { let mut x = add(5,7); -type Binop<'self> = 'self |int,int| -> int; +type Binop<'a> = 'a |int,int| -> int; let bo: Binop = add; x = bo(5,7); ~~~~ diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs index 005328c6934..6389e3fdab0 100644 --- a/src/libextra/arc.rs +++ b/src/libextra/arc.rs @@ -49,13 +49,13 @@ use std::task; use std::borrow; /// As sync::condvar, a mechanism for unlock-and-descheduling and signaling. -pub struct Condvar<'self> { +pub struct Condvar<'a> { priv is_mutex: bool, - priv failed: &'self mut bool, - priv cond: &'self sync::Condvar<'self> + priv failed: &'a mut bool, + priv cond: &'a sync::Condvar<'a> } -impl<'self> Condvar<'self> { +impl<'a> Condvar<'a> { /// Atomically exit the associated Arc and block until a signal is sent. #[inline] pub fn wait(&self) { self.wait_on(0) } @@ -523,19 +523,19 @@ fn borrow_rwlock(state: *mut RWArcInner) -> *RWLock { } /// The "write permission" token used for RWArc.write_downgrade(). -pub struct RWWriteMode<'self, T> { - priv data: &'self mut T, - priv token: sync::RWLockWriteMode<'self>, +pub struct RWWriteMode<'a, T> { + priv data: &'a mut T, + priv token: sync::RWLockWriteMode<'a>, priv poison: PoisonOnFail, } /// The "read permission" token used for RWArc.write_downgrade(). -pub struct RWReadMode<'self, T> { - priv data: &'self T, - priv token: sync::RWLockReadMode<'self>, +pub struct RWReadMode<'a, T> { + priv data: &'a T, + priv token: sync::RWLockReadMode<'a>, } -impl<'self, T:Freeze + Send> RWWriteMode<'self, T> { +impl<'a, T:Freeze + Send> RWWriteMode<'a, T> { /// Access the pre-downgrade RWArc in write mode. pub fn write(&mut self, blk: |x: &mut T| -> U) -> U { match *self { @@ -574,7 +574,7 @@ impl<'self, T:Freeze + Send> RWWriteMode<'self, T> { } } -impl<'self, T:Freeze + Send> RWReadMode<'self, T> { +impl<'a, T:Freeze + Send> RWReadMode<'a, T> { /// Access the post-downgrade rwlock in read mode. pub fn read(&self, blk: |x: &T| -> U) -> U { match *self { diff --git a/src/libextra/base64.rs b/src/libextra/base64.rs index c4247799cad..0b06ed9d5de 100644 --- a/src/libextra/base64.rs +++ b/src/libextra/base64.rs @@ -56,7 +56,7 @@ pub trait ToBase64 { fn to_base64(&self, config: Config) -> ~str; } -impl<'self> ToBase64 for &'self [u8] { +impl<'a> ToBase64 for &'a [u8] { /** * Turn a vector of `u8` bytes into a base64 string. * @@ -157,7 +157,7 @@ pub trait FromBase64 { fn from_base64(&self) -> Result<~[u8], ~str>; } -impl<'self> FromBase64 for &'self str { +impl<'a> FromBase64 for &'a str { /** * Convert any base64 encoded string (literal, `@`, `&`, or `~`) * to the byte values it encodes. diff --git a/src/libextra/bitv.rs b/src/libextra/bitv.rs index c6102079b20..733a8932218 100644 --- a/src/libextra/bitv.rs +++ b/src/libextra/bitv.rs @@ -578,13 +578,13 @@ fn iterate_bits(base: uint, bits: uint, f: |uint| -> bool) -> bool { } /// An iterator for `Bitv`. -pub struct BitvIterator<'self> { - priv bitv: &'self Bitv, +pub struct BitvIterator<'a> { + priv bitv: &'a Bitv, priv next_idx: uint, priv end_idx: uint, } -impl<'self> Iterator for BitvIterator<'self> { +impl<'a> Iterator for BitvIterator<'a> { #[inline] fn next(&mut self) -> Option { if self.next_idx != self.end_idx { @@ -602,7 +602,7 @@ impl<'self> Iterator for BitvIterator<'self> { } } -impl<'self> DoubleEndedIterator for BitvIterator<'self> { +impl<'a> DoubleEndedIterator for BitvIterator<'a> { #[inline] fn next_back(&mut self) -> Option { if self.next_idx != self.end_idx { @@ -614,9 +614,9 @@ impl<'self> DoubleEndedIterator for BitvIterator<'self> { } } -impl<'self> ExactSize for BitvIterator<'self> {} +impl<'a> ExactSize for BitvIterator<'a> {} -impl<'self> RandomAccessIterator for BitvIterator<'self> { +impl<'a> RandomAccessIterator for BitvIterator<'a> { #[inline] fn indexable(&self) -> uint { self.end_idx - self.next_idx @@ -903,12 +903,12 @@ impl BitvSet { } } -pub struct BitvSetIterator<'self> { - priv set: &'self BitvSet, +pub struct BitvSetIterator<'a> { + priv set: &'a BitvSet, priv next_idx: uint } -impl<'self> Iterator for BitvSetIterator<'self> { +impl<'a> Iterator for BitvSetIterator<'a> { #[inline] fn next(&mut self) -> Option { while self.next_idx < self.set.capacity() { diff --git a/src/libextra/dlist.rs b/src/libextra/dlist.rs index ccbaca295ec..7da92704ceb 100644 --- a/src/libextra/dlist.rs +++ b/src/libextra/dlist.rs @@ -48,15 +48,15 @@ struct Node { /// Double-ended DList iterator #[deriving(Clone)] -pub struct DListIterator<'self, T> { - priv head: &'self Link, +pub struct DListIterator<'a, T> { + priv head: &'a Link, priv tail: Rawlink>, priv nelem: uint, } /// Double-ended mutable DList iterator -pub struct MutDListIterator<'self, T> { - priv list: &'self mut DList, +pub struct MutDListIterator<'a, T> { + priv list: &'a mut DList, priv head: Rawlink>, priv tail: Rawlink>, priv nelem: uint, @@ -439,9 +439,9 @@ impl Drop for DList { } -impl<'self, A> Iterator<&'self A> for DListIterator<'self, A> { +impl<'a, A> Iterator<&'a A> for DListIterator<'a, A> { #[inline] - fn next(&mut self) -> Option<&'self A> { + fn next(&mut self) -> Option<&'a A> { if self.nelem == 0 { return None; } @@ -458,9 +458,9 @@ impl<'self, A> Iterator<&'self A> for DListIterator<'self, A> { } } -impl<'self, A> DoubleEndedIterator<&'self A> for DListIterator<'self, A> { +impl<'a, A> DoubleEndedIterator<&'a A> for DListIterator<'a, A> { #[inline] - fn next_back(&mut self) -> Option<&'self A> { + fn next_back(&mut self) -> Option<&'a A> { if self.nelem == 0 { return None; } @@ -473,11 +473,11 @@ impl<'self, A> DoubleEndedIterator<&'self A> for DListIterator<'self, A> { } } -impl<'self, A> ExactSize<&'self A> for DListIterator<'self, A> {} +impl<'a, A> ExactSize<&'a A> for DListIterator<'a, A> {} -impl<'self, A> Iterator<&'self mut A> for MutDListIterator<'self, A> { +impl<'a, A> Iterator<&'a mut A> for MutDListIterator<'a, A> { #[inline] - fn next(&mut self) -> Option<&'self mut A> { + fn next(&mut self) -> Option<&'a mut A> { if self.nelem == 0 { return None; } @@ -497,9 +497,9 @@ impl<'self, A> Iterator<&'self mut A> for MutDListIterator<'self, A> { } } -impl<'self, A> DoubleEndedIterator<&'self mut A> for MutDListIterator<'self, A> { +impl<'a, A> DoubleEndedIterator<&'a mut A> for MutDListIterator<'a, A> { #[inline] - fn next_back(&mut self) -> Option<&'self mut A> { + fn next_back(&mut self) -> Option<&'a mut A> { if self.nelem == 0 { return None; } @@ -511,7 +511,7 @@ impl<'self, A> DoubleEndedIterator<&'self mut A> for MutDListIterator<'self, A> } } -impl<'self, A> ExactSize<&'self mut A> for MutDListIterator<'self, A> {} +impl<'a, A> ExactSize<&'a mut A> for MutDListIterator<'a, A> {} /// Allow mutating the DList while iterating pub trait ListInsertion { @@ -525,7 +525,7 @@ pub trait ListInsertion { } // private methods for MutDListIterator -impl<'self, A> MutDListIterator<'self, A> { +impl<'a, A> MutDListIterator<'a, A> { fn insert_next_node(&mut self, mut ins_node: ~Node) { // Insert before `self.head` so that it is between the // previously yielded element and self.head. @@ -547,7 +547,7 @@ impl<'self, A> MutDListIterator<'self, A> { } } -impl<'self, A> ListInsertion for MutDListIterator<'self, A> { +impl<'a, A> ListInsertion for MutDListIterator<'a, A> { #[inline] fn insert_next(&mut self, elt: A) { self.insert_next_node(~Node::new(elt)) diff --git a/src/libextra/hex.rs b/src/libextra/hex.rs index 7daba4c08f2..83dcc412f57 100644 --- a/src/libextra/hex.rs +++ b/src/libextra/hex.rs @@ -21,7 +21,7 @@ pub trait ToHex { static CHARS: &'static[u8] = bytes!("0123456789abcdef"); -impl<'self> ToHex for &'self [u8] { +impl<'a> ToHex for &'a [u8] { /** * Turn a vector of `u8` bytes into a hexadecimal string. * @@ -57,7 +57,7 @@ pub trait FromHex { fn from_hex(&self) -> Result<~[u8], ~str>; } -impl<'self> FromHex for &'self str { +impl<'a> FromHex for &'a str { /** * Convert any hexadecimal encoded string (literal, `@`, `&`, or `~`) * to the byte values it encodes. diff --git a/src/libextra/json.rs b/src/libextra/json.rs index 46a04abebe5..aa2cc9c855e 100644 --- a/src/libextra/json.rs +++ b/src/libextra/json.rs @@ -84,11 +84,11 @@ fn spaces(n: uint) -> ~str { } /// A structure for implementing serialization to JSON. -pub struct Encoder<'self> { - priv wr: &'self mut io::Writer, +pub struct Encoder<'a> { + priv wr: &'a mut io::Writer, } -impl<'self> Encoder<'self> { +impl<'a> Encoder<'a> { /// Creates a new JSON encoder whose output will be written to the writer /// specified. pub fn new<'a>(wr: &'a mut io::Writer) -> Encoder<'a> { @@ -96,7 +96,7 @@ impl<'self> Encoder<'self> { } } -impl<'self> serialize::Encoder for Encoder<'self> { +impl<'a> serialize::Encoder for Encoder<'a> { fn emit_nil(&mut self) { write!(self.wr, "null") } fn emit_uint(&mut self, v: uint) { self.emit_f64(v as f64); } @@ -129,13 +129,13 @@ impl<'self> serialize::Encoder for Encoder<'self> { write!(self.wr, "{}", escape_str(v)) } - fn emit_enum(&mut self, _name: &str, f: |&mut Encoder<'self>|) { f(self) } + fn emit_enum(&mut self, _name: &str, f: |&mut Encoder<'a>|) { f(self) } fn emit_enum_variant(&mut self, name: &str, _id: uint, cnt: uint, - f: |&mut Encoder<'self>|) { + f: |&mut Encoder<'a>|) { // enums are encoded as strings or objects // Bunny => "Bunny" // Kangaroo(34,"William") => {"variant": "Kangaroo", "fields": [34,"William"]} @@ -150,7 +150,7 @@ impl<'self> serialize::Encoder for Encoder<'self> { } } - fn emit_enum_variant_arg(&mut self, idx: uint, f: |&mut Encoder<'self>|) { + fn emit_enum_variant_arg(&mut self, idx: uint, f: |&mut Encoder<'a>|) { if idx != 0 { write!(self.wr, ","); } @@ -161,18 +161,18 @@ impl<'self> serialize::Encoder for Encoder<'self> { name: &str, id: uint, cnt: uint, - f: |&mut Encoder<'self>|) { + f: |&mut Encoder<'a>|) { self.emit_enum_variant(name, id, cnt, f) } fn emit_enum_struct_variant_field(&mut self, _: &str, idx: uint, - f: |&mut Encoder<'self>|) { + f: |&mut Encoder<'a>|) { self.emit_enum_variant_arg(idx, f) } - fn emit_struct(&mut self, _: &str, _: uint, f: |&mut Encoder<'self>|) { + fn emit_struct(&mut self, _: &str, _: uint, f: |&mut Encoder<'a>|) { write!(self.wr, r"\{"); f(self); write!(self.wr, r"\}"); @@ -181,58 +181,58 @@ impl<'self> serialize::Encoder for Encoder<'self> { fn emit_struct_field(&mut self, name: &str, idx: uint, - f: |&mut Encoder<'self>|) { + f: |&mut Encoder<'a>|) { if idx != 0 { write!(self.wr, ",") } write!(self.wr, "{}:", escape_str(name)); f(self); } - fn emit_tuple(&mut self, len: uint, f: |&mut Encoder<'self>|) { + fn emit_tuple(&mut self, len: uint, f: |&mut Encoder<'a>|) { self.emit_seq(len, f) } - fn emit_tuple_arg(&mut self, idx: uint, f: |&mut Encoder<'self>|) { + fn emit_tuple_arg(&mut self, idx: uint, f: |&mut Encoder<'a>|) { self.emit_seq_elt(idx, f) } fn emit_tuple_struct(&mut self, _name: &str, len: uint, - f: |&mut Encoder<'self>|) { + f: |&mut Encoder<'a>|) { self.emit_seq(len, f) } - fn emit_tuple_struct_arg(&mut self, idx: uint, f: |&mut Encoder<'self>|) { + fn emit_tuple_struct_arg(&mut self, idx: uint, f: |&mut Encoder<'a>|) { self.emit_seq_elt(idx, f) } - fn emit_option(&mut self, f: |&mut Encoder<'self>|) { f(self); } + fn emit_option(&mut self, f: |&mut Encoder<'a>|) { f(self); } fn emit_option_none(&mut self) { self.emit_nil(); } - fn emit_option_some(&mut self, f: |&mut Encoder<'self>|) { f(self); } + fn emit_option_some(&mut self, f: |&mut Encoder<'a>|) { f(self); } - fn emit_seq(&mut self, _len: uint, f: |&mut Encoder<'self>|) { + fn emit_seq(&mut self, _len: uint, f: |&mut Encoder<'a>|) { write!(self.wr, "["); f(self); write!(self.wr, "]"); } - fn emit_seq_elt(&mut self, idx: uint, f: |&mut Encoder<'self>|) { + fn emit_seq_elt(&mut self, idx: uint, f: |&mut Encoder<'a>|) { if idx != 0 { write!(self.wr, ","); } f(self) } - fn emit_map(&mut self, _len: uint, f: |&mut Encoder<'self>|) { + fn emit_map(&mut self, _len: uint, f: |&mut Encoder<'a>|) { write!(self.wr, r"\{"); f(self); write!(self.wr, r"\}"); } - fn emit_map_elt_key(&mut self, idx: uint, f: |&mut Encoder<'self>|) { + fn emit_map_elt_key(&mut self, idx: uint, f: |&mut Encoder<'a>|) { if idx != 0 { write!(self.wr, ",") } f(self) } - fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut Encoder<'self>|) { + fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut Encoder<'a>|) { write!(self.wr, ":"); f(self) } @@ -240,12 +240,12 @@ impl<'self> serialize::Encoder for Encoder<'self> { /// Another encoder for JSON, but prints out human-readable JSON instead of /// compact data -pub struct PrettyEncoder<'self> { - priv wr: &'self mut io::Writer, +pub struct PrettyEncoder<'a> { + priv wr: &'a mut io::Writer, priv indent: uint, } -impl<'self> PrettyEncoder<'self> { +impl<'a> PrettyEncoder<'a> { /// Creates a new encoder whose output will be written to the specified writer pub fn new<'a>(wr: &'a mut io::Writer) -> PrettyEncoder<'a> { PrettyEncoder { @@ -255,7 +255,7 @@ impl<'self> PrettyEncoder<'self> { } } -impl<'self> serialize::Encoder for PrettyEncoder<'self> { +impl<'a> serialize::Encoder for PrettyEncoder<'a> { fn emit_nil(&mut self) { write!(self.wr, "null") } fn emit_uint(&mut self, v: uint) { self.emit_f64(v as f64); } @@ -286,7 +286,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { fn emit_char(&mut self, v: char) { self.emit_str(str::from_char(v)) } fn emit_str(&mut self, v: &str) { write!(self.wr, "{}", escape_str(v)); } - fn emit_enum(&mut self, _name: &str, f: |&mut PrettyEncoder<'self>|) { + fn emit_enum(&mut self, _name: &str, f: |&mut PrettyEncoder<'a>|) { f(self) } @@ -294,7 +294,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { name: &str, _: uint, cnt: uint, - f: |&mut PrettyEncoder<'self>|) { + f: |&mut PrettyEncoder<'a>|) { if cnt == 0 { write!(self.wr, "{}", escape_str(name)); } else { @@ -308,7 +308,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { fn emit_enum_variant_arg(&mut self, idx: uint, - f: |&mut PrettyEncoder<'self>|) { + f: |&mut PrettyEncoder<'a>|) { if idx != 0 { write!(self.wr, ",\n"); } @@ -320,14 +320,14 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { name: &str, id: uint, cnt: uint, - f: |&mut PrettyEncoder<'self>|) { + f: |&mut PrettyEncoder<'a>|) { self.emit_enum_variant(name, id, cnt, f) } fn emit_enum_struct_variant_field(&mut self, _: &str, idx: uint, - f: |&mut PrettyEncoder<'self>|) { + f: |&mut PrettyEncoder<'a>|) { self.emit_enum_variant_arg(idx, f) } @@ -335,7 +335,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { fn emit_struct(&mut self, _: &str, len: uint, - f: |&mut PrettyEncoder<'self>|) { + f: |&mut PrettyEncoder<'a>|) { if len == 0 { write!(self.wr, "\\{\\}"); } else { @@ -350,7 +350,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { fn emit_struct_field(&mut self, name: &str, idx: uint, - f: |&mut PrettyEncoder<'self>|) { + f: |&mut PrettyEncoder<'a>|) { if idx == 0 { write!(self.wr, "\n"); } else { @@ -360,30 +360,30 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { f(self); } - fn emit_tuple(&mut self, len: uint, f: |&mut PrettyEncoder<'self>|) { + fn emit_tuple(&mut self, len: uint, f: |&mut PrettyEncoder<'a>|) { self.emit_seq(len, f) } - fn emit_tuple_arg(&mut self, idx: uint, f: |&mut PrettyEncoder<'self>|) { + fn emit_tuple_arg(&mut self, idx: uint, f: |&mut PrettyEncoder<'a>|) { self.emit_seq_elt(idx, f) } fn emit_tuple_struct(&mut self, _: &str, len: uint, - f: |&mut PrettyEncoder<'self>|) { + f: |&mut PrettyEncoder<'a>|) { self.emit_seq(len, f) } fn emit_tuple_struct_arg(&mut self, idx: uint, - f: |&mut PrettyEncoder<'self>|) { + f: |&mut PrettyEncoder<'a>|) { self.emit_seq_elt(idx, f) } - fn emit_option(&mut self, f: |&mut PrettyEncoder<'self>|) { f(self); } + fn emit_option(&mut self, f: |&mut PrettyEncoder<'a>|) { f(self); } fn emit_option_none(&mut self) { self.emit_nil(); } - fn emit_option_some(&mut self, f: |&mut PrettyEncoder<'self>|) { f(self); } + fn emit_option_some(&mut self, f: |&mut PrettyEncoder<'a>|) { f(self); } - fn emit_seq(&mut self, len: uint, f: |&mut PrettyEncoder<'self>|) { + fn emit_seq(&mut self, len: uint, f: |&mut PrettyEncoder<'a>|) { if len == 0 { write!(self.wr, "[]"); } else { @@ -395,7 +395,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { } } - fn emit_seq_elt(&mut self, idx: uint, f: |&mut PrettyEncoder<'self>|) { + fn emit_seq_elt(&mut self, idx: uint, f: |&mut PrettyEncoder<'a>|) { if idx == 0 { write!(self.wr, "\n"); } else { @@ -405,7 +405,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { f(self) } - fn emit_map(&mut self, len: uint, f: |&mut PrettyEncoder<'self>|) { + fn emit_map(&mut self, len: uint, f: |&mut PrettyEncoder<'a>|) { if len == 0 { write!(self.wr, "\\{\\}"); } else { @@ -417,7 +417,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { } } - fn emit_map_elt_key(&mut self, idx: uint, f: |&mut PrettyEncoder<'self>|) { + fn emit_map_elt_key(&mut self, idx: uint, f: |&mut PrettyEncoder<'a>|) { if idx == 0 { write!(self.wr, "\n"); } else { @@ -427,7 +427,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> { f(self); } - fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut PrettyEncoder<'self>|) { + fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut PrettyEncoder<'a>|) { write!(self.wr, ": "); f(self); } diff --git a/src/libextra/priority_queue.rs b/src/libextra/priority_queue.rs index 587f8372087..77d1c5cdcf4 100644 --- a/src/libextra/priority_queue.rs +++ b/src/libextra/priority_queue.rs @@ -177,13 +177,13 @@ impl PriorityQueue { } /// PriorityQueue iterator -pub struct PriorityQueueIterator <'self, T> { - priv iter: vec::VecIterator<'self, T>, +pub struct PriorityQueueIterator <'a, T> { + priv iter: vec::VecIterator<'a, T>, } -impl<'self, T> Iterator<&'self T> for PriorityQueueIterator<'self, T> { +impl<'a, T> Iterator<&'a T> for PriorityQueueIterator<'a, T> { #[inline] - fn next(&mut self) -> Option<(&'self T)> { self.iter.next() } + fn next(&mut self) -> Option<(&'a T)> { self.iter.next() } #[inline] fn size_hint(&self) -> (uint, Option) { self.iter.size_hint() } diff --git a/src/libextra/ringbuf.rs b/src/libextra/ringbuf.rs index 2274db6c63d..19e293c94a2 100644 --- a/src/libextra/ringbuf.rs +++ b/src/libextra/ringbuf.rs @@ -229,16 +229,16 @@ impl RingBuf { } /// RingBuf iterator -pub struct RingBufIterator<'self, T> { +pub struct RingBufIterator<'a, T> { priv lo: uint, priv index: uint, priv rindex: uint, - priv elts: &'self [Option], + priv elts: &'a [Option], } -impl<'self, T> Iterator<&'self T> for RingBufIterator<'self, T> { +impl<'a, T> Iterator<&'a T> for RingBufIterator<'a, T> { #[inline] - fn next(&mut self) -> Option<&'self T> { + fn next(&mut self) -> Option<&'a T> { if self.index == self.rindex { return None; } @@ -254,9 +254,9 @@ impl<'self, T> Iterator<&'self T> for RingBufIterator<'self, T> { } } -impl<'self, T> DoubleEndedIterator<&'self T> for RingBufIterator<'self, T> { +impl<'a, T> DoubleEndedIterator<&'a T> for RingBufIterator<'a, T> { #[inline] - fn next_back(&mut self) -> Option<&'self T> { + fn next_back(&mut self) -> Option<&'a T> { if self.index == self.rindex { return None; } @@ -266,14 +266,14 @@ impl<'self, T> DoubleEndedIterator<&'self T> for RingBufIterator<'self, T> { } } -impl<'self, T> ExactSize<&'self T> for RingBufIterator<'self, T> {} +impl<'a, T> ExactSize<&'a T> for RingBufIterator<'a, T> {} -impl<'self, T> RandomAccessIterator<&'self T> for RingBufIterator<'self, T> { +impl<'a, T> RandomAccessIterator<&'a T> for RingBufIterator<'a, T> { #[inline] fn indexable(&self) -> uint { self.rindex - self.index } #[inline] - fn idx(&self, j: uint) -> Option<&'self T> { + fn idx(&self, j: uint) -> Option<&'a T> { if j >= self.indexable() { None } else { @@ -284,15 +284,15 @@ impl<'self, T> RandomAccessIterator<&'self T> for RingBufIterator<'self, T> { } /// RingBuf mutable iterator -pub struct RingBufMutIterator<'self, T> { - priv remaining1: &'self mut [Option], - priv remaining2: &'self mut [Option], +pub struct RingBufMutIterator<'a, T> { + priv remaining1: &'a mut [Option], + priv remaining2: &'a mut [Option], priv nelts: uint, } -impl<'self, T> Iterator<&'self mut T> for RingBufMutIterator<'self, T> { +impl<'a, T> Iterator<&'a mut T> for RingBufMutIterator<'a, T> { #[inline] - fn next(&mut self) -> Option<&'self mut T> { + fn next(&mut self) -> Option<&'a mut T> { if self.nelts == 0 { return None; } @@ -312,9 +312,9 @@ impl<'self, T> Iterator<&'self mut T> for RingBufMutIterator<'self, T> { } } -impl<'self, T> DoubleEndedIterator<&'self mut T> for RingBufMutIterator<'self, T> { +impl<'a, T> DoubleEndedIterator<&'a mut T> for RingBufMutIterator<'a, T> { #[inline] - fn next_back(&mut self) -> Option<&'self mut T> { + fn next_back(&mut self) -> Option<&'a mut T> { if self.nelts == 0 { return None; } @@ -329,7 +329,7 @@ impl<'self, T> DoubleEndedIterator<&'self mut T> for RingBufMutIterator<'self, T } } -impl<'self, T> ExactSize<&'self mut T> for RingBufMutIterator<'self, T> {} +impl<'a, T> ExactSize<&'a mut T> for RingBufMutIterator<'a, T> {} /// Grow is only called on full elts, so nelts is also len(elts), unlike /// elsewhere. diff --git a/src/libextra/serialize.rs b/src/libextra/serialize.rs index aa63ac102e4..6b298d877da 100644 --- a/src/libextra/serialize.rs +++ b/src/libextra/serialize.rs @@ -292,7 +292,7 @@ impl Decodable for i64 { } } -impl<'self, S:Encoder> Encodable for &'self str { +impl<'a, S:Encoder> Encodable for &'a str { fn encode(&self, s: &mut S) { s.emit_str(*self) } @@ -382,7 +382,7 @@ impl Decodable for () { } } -impl<'self, S:Encoder,T:Encodable> Encodable for &'self T { +impl<'a, S:Encoder,T:Encodable> Encodable for &'a T { fn encode(&self, s: &mut S) { (**self).encode(s) } @@ -438,7 +438,7 @@ impl + 'static> Decodable for @mut T { } } -impl<'self, S:Encoder,T:Encodable> Encodable for &'self [T] { +impl<'a, S:Encoder,T:Encodable> Encodable for &'a [T] { fn encode(&self, s: &mut S) { s.emit_seq(self.len(), |s| { for (i, e) in self.iter().enumerate() { diff --git a/src/libextra/smallintmap.rs b/src/libextra/smallintmap.rs index 119988735a7..649ed281f87 100644 --- a/src/libextra/smallintmap.rs +++ b/src/libextra/smallintmap.rs @@ -184,7 +184,7 @@ impl SmallIntMap { macro_rules! iterator { (impl $name:ident -> $elem:ty, $getter:ident) => { - impl<'self, T> Iterator<$elem> for $name<'self, T> { + impl<'a, T> Iterator<$elem> for $name<'a, T> { #[inline] fn next(&mut self) -> Option<$elem> { while self.front < self.back { @@ -213,7 +213,7 @@ macro_rules! iterator { macro_rules! double_ended_iterator { (impl $name:ident -> $elem:ty, $getter:ident) => { - impl<'self, T> DoubleEndedIterator<$elem> for $name<'self, T> { + impl<'a, T> DoubleEndedIterator<$elem> for $name<'a, T> { #[inline] fn next_back(&mut self) -> Option<$elem> { while self.front < self.back { @@ -234,25 +234,25 @@ macro_rules! double_ended_iterator { } } -pub struct SmallIntMapIterator<'self, T> { +pub struct SmallIntMapIterator<'a, T> { priv front: uint, priv back: uint, - priv iter: VecIterator<'self, Option> + priv iter: VecIterator<'a, Option> } -iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref) -double_ended_iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref) -pub type SmallIntMapRevIterator<'self, T> = Invert>; +iterator!(impl SmallIntMapIterator -> (uint, &'a T), get_ref) +double_ended_iterator!(impl SmallIntMapIterator -> (uint, &'a T), get_ref) +pub type SmallIntMapRevIterator<'a, T> = Invert>; -pub struct SmallIntMapMutIterator<'self, T> { +pub struct SmallIntMapMutIterator<'a, T> { priv front: uint, priv back: uint, - priv iter: VecMutIterator<'self, Option> + priv iter: VecMutIterator<'a, Option> } -iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref) -double_ended_iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref) -pub type SmallIntMapMutRevIterator<'self, T> = Invert>; +iterator!(impl SmallIntMapMutIterator -> (uint, &'a mut T), get_mut_ref) +double_ended_iterator!(impl SmallIntMapMutIterator -> (uint, &'a mut T), get_mut_ref) +pub type SmallIntMapMutRevIterator<'a, T> = Invert>; #[cfg(test)] mod test_map { diff --git a/src/libextra/sort.rs b/src/libextra/sort.rs index a8b8c094135..bba26a16d4d 100644 --- a/src/libextra/sort.rs +++ b/src/libextra/sort.rs @@ -15,7 +15,7 @@ use std::cmp::{Eq, Ord}; use std::util::swap; use std::vec; -type Le<'self, T> = 'self |v1: &T, v2: &T| -> bool; +type Le<'a, T> = 'a |v1: &T, v2: &T| -> bool; /** * Merge sort. Returns a new vector containing the sorted list. @@ -173,7 +173,7 @@ pub trait Sort { fn qsort(self); } -impl<'self, T:Clone + Ord + Eq> Sort for &'self mut [T] { +impl<'a, T:Clone + Ord + Eq> Sort for &'a mut [T] { fn qsort(self) { quick_sort3(self); } } diff --git a/src/libextra/stats.rs b/src/libextra/stats.rs index 44c399c89da..b96b9dda6eb 100644 --- a/src/libextra/stats.rs +++ b/src/libextra/stats.rs @@ -145,7 +145,7 @@ impl Summary { } } -impl<'self> Stats for &'self [f64] { +impl<'a> Stats for &'a [f64] { fn sum(self) -> f64 { self.iter().fold(0.0, |p,q| p + *q) diff --git a/src/libextra/sync.rs b/src/libextra/sync.rs index 88207bfbae4..f00c3d8db9a 100644 --- a/src/libextra/sync.rs +++ b/src/libextra/sync.rs @@ -155,28 +155,28 @@ impl Sem<~[WaitQueue]> { // FIXME(#3598): Want to use an Option down below, but we need a custom enum // that's not polymorphic to get around the fact that lifetimes are invariant // inside of type parameters. -enum ReacquireOrderLock<'self> { +enum ReacquireOrderLock<'a> { Nothing, // c.c - Just(&'self Semaphore), + Just(&'a Semaphore), } /// A mechanism for atomic-unlock-and-deschedule blocking and signalling. -pub struct Condvar<'self> { +pub struct Condvar<'a> { // The 'Sem' object associated with this condvar. This is the one that's // atomically-unlocked-and-descheduled upon and reacquired during wakeup. - priv sem: &'self Sem<~[WaitQueue]>, + priv sem: &'a Sem<~[WaitQueue]>, // This is (can be) an extra semaphore which is held around the reacquire // operation on the first one. This is only used in cvars associated with // rwlocks, and is needed to ensure that, when a downgrader is trying to // hand off the access lock (which would be the first field, here), a 2nd // writer waking up from a cvar wait can't race with a reader to steal it, // See the comment in write_cond for more detail. - priv order: ReacquireOrderLock<'self>, + priv order: ReacquireOrderLock<'a>, // Make sure condvars are non-copyable. priv token: util::NonCopyable, } -impl<'self> Condvar<'self> { +impl<'a> Condvar<'a> { /** * Atomically drop the associated lock, and block until a signal is sent. * @@ -644,12 +644,12 @@ impl RWLock { /// The "write permission" token used for rwlock.write_downgrade(). -pub struct RWLockWriteMode<'self> { priv lock: &'self RWLock, priv token: NonCopyable } +pub struct RWLockWriteMode<'a> { priv lock: &'a RWLock, priv token: NonCopyable } /// The "read permission" token used for rwlock.write_downgrade(). -pub struct RWLockReadMode<'self> { priv lock: &'self RWLock, +pub struct RWLockReadMode<'a> { priv lock: &'a RWLock, priv token: NonCopyable } -impl<'self> RWLockWriteMode<'self> { +impl<'a> RWLockWriteMode<'a> { /// Access the pre-downgrade rwlock in write mode. pub fn write(&self, blk: || -> U) -> U { blk() } /// Access the pre-downgrade rwlock in write mode with a condvar. @@ -662,7 +662,7 @@ impl<'self> RWLockWriteMode<'self> { } } -impl<'self> RWLockReadMode<'self> { +impl<'a> RWLockReadMode<'a> { /// Access the post-downgrade rwlock in read mode. pub fn read(&self, blk: || -> U) -> U { blk() } } diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs index a936ceacc2e..7c411048149 100644 --- a/src/libextra/treemap.rs +++ b/src/libextra/treemap.rs @@ -228,9 +228,9 @@ impl TreeMap { } /// Lazy forward iterator over a map -pub struct TreeMapIterator<'self, K, V> { - priv stack: ~[&'self TreeNode], - priv node: Option<&'self TreeNode>, +pub struct TreeMapIterator<'a, K, V> { + priv stack: ~[&'a TreeNode], + priv node: Option<&'a TreeNode>, priv remaining_min: uint, priv remaining_max: uint } @@ -245,9 +245,9 @@ fn deref<'a, K, V>(node: &'a Option<~TreeNode>) -> Option<&'a TreeNode TreeMapIterator<'self, K, V> { +impl<'a, K, V> TreeMapIterator<'a, K, V> { #[inline(always)] - fn next_(&mut self, forward: bool) -> Option<(&'self K, &'self V)> { + fn next_(&mut self, forward: bool) -> Option<(&'a K, &'a V)> { while !self.stack.is_empty() || self.node.is_some() { match self.node { Some(x) => { @@ -269,11 +269,11 @@ impl<'self, K, V> TreeMapIterator<'self, K, V> { } } -impl<'self, K, V> Iterator<(&'self K, &'self V)> for TreeMapIterator<'self, K, V> { +impl<'a, K, V> Iterator<(&'a K, &'a V)> for TreeMapIterator<'a, K, V> { /// Advance the iterator to the next node (in order) and return a /// tuple with a reference to the key and value. If there are no /// more nodes, return `None`. - fn next(&mut self) -> Option<(&'self K, &'self V)> { + fn next(&mut self) -> Option<(&'a K, &'a V)> { self.next_(true) } @@ -284,15 +284,15 @@ impl<'self, K, V> Iterator<(&'self K, &'self V)> for TreeMapIterator<'self, K, V } /// Lazy backward iterator over a map -pub struct TreeMapRevIterator<'self, K, V> { - priv iter: TreeMapIterator<'self, K, V>, +pub struct TreeMapRevIterator<'a, K, V> { + priv iter: TreeMapIterator<'a, K, V>, } -impl<'self, K, V> Iterator<(&'self K, &'self V)> for TreeMapRevIterator<'self, K, V> { +impl<'a, K, V> Iterator<(&'a K, &'a V)> for TreeMapRevIterator<'a, K, V> { /// Advance the iterator to the next node (in order) and return a /// tuple with a reference to the key and value. If there are no /// more nodes, return `None`. - fn next(&mut self) -> Option<(&'self K, &'self V)> { + fn next(&mut self) -> Option<(&'a K, &'a V)> { self.iter.next_(false) } @@ -390,18 +390,18 @@ impl Iterator<(K, V)> for TreeMapMoveIterator { } -impl<'self, T> Iterator<&'self T> for TreeSetIterator<'self, T> { +impl<'a, T> Iterator<&'a T> for TreeSetIterator<'a, T> { /// Advance the iterator to the next node (in order). If there are no more nodes, return `None`. #[inline] - fn next(&mut self) -> Option<&'self T> { + fn next(&mut self) -> Option<&'a T> { self.iter.next().map(|(value, _)| value) } } -impl<'self, T> Iterator<&'self T> for TreeSetRevIterator<'self, T> { +impl<'a, T> Iterator<&'a T> for TreeSetRevIterator<'a, T> { /// Advance the iterator to the next node (in order). If there are no more nodes, return `None`. #[inline] - fn next(&mut self) -> Option<&'self T> { + fn next(&mut self) -> Option<&'a T> { self.iter.next().map(|(value, _)| value) } } @@ -561,37 +561,37 @@ impl TreeSet { } /// Lazy forward iterator over a set -pub struct TreeSetIterator<'self, T> { - priv iter: TreeMapIterator<'self, T, ()> +pub struct TreeSetIterator<'a, T> { + priv iter: TreeMapIterator<'a, T, ()> } /// Lazy backward iterator over a set -pub struct TreeSetRevIterator<'self, T> { - priv iter: TreeMapRevIterator<'self, T, ()> +pub struct TreeSetRevIterator<'a, T> { + priv iter: TreeMapRevIterator<'a, T, ()> } /// Lazy iterator producing elements in the set difference (in-order) -pub struct Difference<'self, T> { - priv a: Peekable<&'self T, TreeSetIterator<'self, T>>, - priv b: Peekable<&'self T, TreeSetIterator<'self, T>>, +pub struct Difference<'a, T> { + priv a: Peekable<&'a T, TreeSetIterator<'a, T>>, + priv b: Peekable<&'a T, TreeSetIterator<'a, T>>, } /// Lazy iterator producing elements in the set symmetric difference (in-order) -pub struct SymDifference<'self, T> { - priv a: Peekable<&'self T, TreeSetIterator<'self, T>>, - priv b: Peekable<&'self T, TreeSetIterator<'self, T>>, +pub struct SymDifference<'a, T> { + priv a: Peekable<&'a T, TreeSetIterator<'a, T>>, + priv b: Peekable<&'a T, TreeSetIterator<'a, T>>, } /// Lazy iterator producing elements in the set intersection (in-order) -pub struct Intersection<'self, T> { - priv a: Peekable<&'self T, TreeSetIterator<'self, T>>, - priv b: Peekable<&'self T, TreeSetIterator<'self, T>>, +pub struct Intersection<'a, T> { + priv a: Peekable<&'a T, TreeSetIterator<'a, T>>, + priv b: Peekable<&'a T, TreeSetIterator<'a, T>>, } /// Lazy iterator producing elements in the set intersection (in-order) -pub struct Union<'self, T> { - priv a: Peekable<&'self T, TreeSetIterator<'self, T>>, - priv b: Peekable<&'self T, TreeSetIterator<'self, T>>, +pub struct Union<'a, T> { + priv a: Peekable<&'a T, TreeSetIterator<'a, T>>, + priv b: Peekable<&'a T, TreeSetIterator<'a, T>>, } /// Compare `x` and `y`, but return `short` if x is None and `long` if y is None @@ -604,8 +604,8 @@ fn cmp_opt(x: Option<&T>, y: Option<&T>, } } -impl<'self, T: TotalOrd> Iterator<&'self T> for Difference<'self, T> { - fn next(&mut self) -> Option<&'self T> { +impl<'a, T: TotalOrd> Iterator<&'a T> for Difference<'a, T> { + fn next(&mut self) -> Option<&'a T> { loop { match cmp_opt(self.a.peek(), self.b.peek(), Less, Less) { Less => return self.a.next(), @@ -616,8 +616,8 @@ impl<'self, T: TotalOrd> Iterator<&'self T> for Difference<'self, T> { } } -impl<'self, T: TotalOrd> Iterator<&'self T> for SymDifference<'self, T> { - fn next(&mut self) -> Option<&'self T> { +impl<'a, T: TotalOrd> Iterator<&'a T> for SymDifference<'a, T> { + fn next(&mut self) -> Option<&'a T> { loop { match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) { Less => return self.a.next(), @@ -628,8 +628,8 @@ impl<'self, T: TotalOrd> Iterator<&'self T> for SymDifference<'self, T> { } } -impl<'self, T: TotalOrd> Iterator<&'self T> for Intersection<'self, T> { - fn next(&mut self) -> Option<&'self T> { +impl<'a, T: TotalOrd> Iterator<&'a T> for Intersection<'a, T> { + fn next(&mut self) -> Option<&'a T> { loop { let o_cmp = match (self.a.peek(), self.b.peek()) { (None , _ ) => None, @@ -646,8 +646,8 @@ impl<'self, T: TotalOrd> Iterator<&'self T> for Intersection<'self, T> { } } -impl<'self, T: TotalOrd> Iterator<&'self T> for Union<'self, T> { - fn next(&mut self) -> Option<&'self T> { +impl<'a, T: TotalOrd> Iterator<&'a T> for Union<'a, T> { + fn next(&mut self) -> Option<&'a T> { loop { match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) { Less => return self.a.next(), diff --git a/src/libextra/workcache.rs b/src/libextra/workcache.rs index 1487cee75cc..91f1f1a0d0b 100644 --- a/src/libextra/workcache.rs +++ b/src/libextra/workcache.rs @@ -239,9 +239,9 @@ pub struct Context { priv freshness: Arc } -pub struct Prep<'self> { - priv ctxt: &'self Context, - priv fn_name: &'self str, +pub struct Prep<'a> { + priv ctxt: &'a Context, + priv fn_name: &'a str, priv declared_inputs: WorkMap, } @@ -250,12 +250,12 @@ pub struct Exec { priv discovered_outputs: WorkMap } -enum Work<'self, T> { +enum Work<'a, T> { WorkValue(T), - WorkFromTask(&'self Prep<'self>, PortOne<(Exec, T)>), + WorkFromTask(&'a Prep<'a>, PortOne<(Exec, T)>), } -fn json_encode<'self, T:Encodable>>(t: &T) -> ~str { +fn json_encode<'a, T:Encodable>>(t: &T) -> ~str { let mut writer = MemWriter::new(); let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer); t.encode(&mut encoder); @@ -336,8 +336,8 @@ impl Exec { } } -impl<'self> Prep<'self> { - fn new(ctxt: &'self Context, fn_name: &'self str) -> Prep<'self> { +impl<'a> Prep<'a> { + fn new(ctxt: &'a Context, fn_name: &'a str) -> Prep<'a> { Prep { ctxt: ctxt, fn_name: fn_name, @@ -356,7 +356,7 @@ impl<'self> Prep<'self> { } } -impl<'self> Prep<'self> { +impl<'a> Prep<'a> { pub fn declare_input(&mut self, kind: &str, name: &str, val: &str) { debug!("Declaring input {} {} {}", kind, name, val); self.declared_inputs.insert_work_key(WorkKey::new(kind, name), @@ -395,17 +395,17 @@ impl<'self> Prep<'self> { return true; } - pub fn exec<'self, T:Send + - Encodable> + + pub fn exec<'a, T:Send + + Encodable> + Decodable>( - &'self self, blk: proc(&mut Exec) -> T) -> T { + &'a self, blk: proc(&mut Exec) -> T) -> T { self.exec_work(blk).unwrap() } - fn exec_work<'self, T:Send + - Encodable> + + fn exec_work<'a, T:Send + + Encodable> + Decodable>( // FIXME(#5121) - &'self self, blk: proc(&mut Exec) -> T) -> Work<'self, T> { + &'a self, blk: proc(&mut Exec) -> T) -> Work<'a, T> { let mut bo = Some(blk); debug!("exec_work: looking up {} and {:?}", self.fn_name, @@ -445,16 +445,16 @@ impl<'self> Prep<'self> { } } -impl<'self, T:Send + - Encodable> + +impl<'a, T:Send + + Encodable> + Decodable> - Work<'self, T> { // FIXME(#5121) + Work<'a, T> { // FIXME(#5121) - pub fn from_value(elt: T) -> Work<'self, T> { + pub fn from_value(elt: T) -> Work<'a, T> { WorkValue(elt) } - pub fn from_task(prep: &'self Prep<'self>, port: PortOne<(Exec, T)>) - -> Work<'self, T> { + pub fn from_task(prep: &'a Prep<'a>, port: PortOne<(Exec, T)>) + -> Work<'a, T> { WorkFromTask(prep, port) } diff --git a/src/librustc/front/config.rs b/src/librustc/front/config.rs index e9dfed46f73..6694bee582f 100644 --- a/src/librustc/front/config.rs +++ b/src/librustc/front/config.rs @@ -12,8 +12,8 @@ use syntax::fold::ast_fold; use syntax::{ast, fold, attr}; -struct Context<'self> { - in_cfg: 'self |attrs: &[ast::Attribute]| -> bool, +struct Context<'a> { + in_cfg: 'a |attrs: &[ast::Attribute]| -> bool, } // Support conditional compilation by transforming the AST, stripping out @@ -23,7 +23,7 @@ pub fn strip_unconfigured_items(crate: ast::Crate) -> ast::Crate { strip_items(crate, |attrs| in_cfg(config, attrs)) } -impl<'self> fold::ast_fold for Context<'self> { +impl<'a> fold::ast_fold for Context<'a> { fn fold_mod(&self, module: &ast::_mod) -> ast::_mod { fold_mod(self, module) } diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index dd4df7481d4..70d65bc5470 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -73,7 +73,7 @@ fn lookup_hash(d: ebml::Doc, eq_fn: |&[u8]| -> bool, hash: u64) -> ret } -pub type GetCrateDataCb<'self> = 'self |ast::CrateNum| -> Cmd; +pub type GetCrateDataCb<'a> = 'a |ast::CrateNum| -> Cmd; pub fn maybe_find_item(item_id: ast::NodeId, items: ebml::Doc) -> Option { fn eq_item(bytes: &[u8], item_id: ast::NodeId) -> bool { @@ -694,7 +694,7 @@ pub fn get_item_path(cdata: Cmd, id: ast::NodeId) -> ast_map::path { item_path(lookup_item(id, cdata.data)) } -pub type decode_inlined_item<'self> = 'self |cdata: @cstore::crate_metadata, +pub type decode_inlined_item<'a> = 'a |cdata: @cstore::crate_metadata, tcx: ty::ctxt, path: ast_map::path, par_doc: ebml::Doc| diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 209ed5e2d18..1ffadfb6ede 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -51,21 +51,21 @@ use writer = extra::ebml::writer; // used by astencode: type abbrev_map = @mut HashMap; -pub type encode_inlined_item<'self> = 'self |ecx: &EncodeContext, +pub type encode_inlined_item<'a> = 'a |ecx: &EncodeContext, ebml_w: &mut writer::Encoder, path: &[ast_map::path_elt], ii: ast::inlined_item|; -pub struct EncodeParams<'self> { +pub struct EncodeParams<'a> { diag: @mut span_handler, tcx: ty::ctxt, reexports2: middle::resolve::ExportMap2, - item_symbols: &'self HashMap, - discrim_symbols: &'self HashMap, - non_inlineable_statics: &'self HashSet, - link_meta: &'self LinkMeta, + item_symbols: &'a HashMap, + discrim_symbols: &'a HashMap, + non_inlineable_statics: &'a HashSet, + link_meta: &'a LinkMeta, cstore: @mut cstore::CStore, - encode_inlined_item: encode_inlined_item<'self>, + encode_inlined_item: encode_inlined_item<'a>, reachable: @mut HashSet, } @@ -85,17 +85,17 @@ struct Stats { n_inlines: uint } -pub struct EncodeContext<'self> { +pub struct EncodeContext<'a> { diag: @mut span_handler, tcx: ty::ctxt, stats: @mut Stats, reexports2: middle::resolve::ExportMap2, - item_symbols: &'self HashMap, - discrim_symbols: &'self HashMap, - non_inlineable_statics: &'self HashSet, - link_meta: &'self LinkMeta, - cstore: &'self cstore::CStore, - encode_inlined_item: encode_inlined_item<'self>, + item_symbols: &'a HashMap, + discrim_symbols: &'a HashMap, + non_inlineable_statics: &'a HashSet, + link_meta: &'a LinkMeta, + cstore: &'a cstore::CStore, + encode_inlined_item: encode_inlined_item<'a>, type_abbrevs: abbrev_map, reachable: @mut HashSet, } @@ -1605,12 +1605,12 @@ fn encode_native_libraries(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) { ebml_w.end_tag(); } -struct ImplVisitor<'self> { - ecx: &'self EncodeContext<'self>, - ebml_w: &'self mut writer::Encoder, +struct ImplVisitor<'a> { + ecx: &'a EncodeContext<'a>, + ebml_w: &'a mut writer::Encoder, } -impl<'self> Visitor<()> for ImplVisitor<'self> { +impl<'a> Visitor<()> for ImplVisitor<'a> { fn visit_item(&mut self, item: @item, _: ()) { match item.node { item_impl(_, Some(ref trait_ref), _, _) => { diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 456a08f6d08..9b6da280be0 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -23,7 +23,7 @@ pub enum FileMatch { FileMatches, FileDoesntMatch } /// Functions with type `pick` take a parent directory as well as /// a file found in that directory. -pub type pick<'self> = 'self |path: &Path| -> FileMatch; +pub type pick<'a> = 'a |path: &Path| -> FileMatch; pub fn pick_file(file: Path, path: &Path) -> Option { if path.filename() == Some(file.as_vec()) { diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 5f9be5f5c42..27f43a0ef53 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -52,11 +52,11 @@ pub enum DefIdSource { // Identifies a region parameter (`fn foo<'X>() { ... }`). RegionParameter, } -type conv_did<'self> = - 'self |source: DefIdSource, ast::DefId| -> ast::DefId; +type conv_did<'a> = + 'a |source: DefIdSource, ast::DefId| -> ast::DefId; -pub struct PState<'self> { - data: &'self [u8], +pub struct PState<'a> { + data: &'a [u8], crate: ast::CrateNum, pos: uint, tcx: ty::ctxt diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 227c7d72d6b..b5dec466a08 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -765,7 +765,7 @@ trait get_ty_str_ctxt { fn ty_str_ctxt(&self) -> @tyencode::ctxt; } -impl<'self> get_ty_str_ctxt for e::EncodeContext<'self> { +impl<'a> get_ty_str_ctxt for e::EncodeContext<'a> { fn ty_str_ctxt(&self) -> @tyencode::ctxt { @tyencode::ctxt { diag: self.tcx.sess.diagnostic(), diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index f335c789db3..0a93a57a963 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -32,15 +32,15 @@ use syntax::visit; use util::ppaux::Repr; #[deriving(Clone)] -struct CheckLoanCtxt<'self> { - bccx: &'self BorrowckCtxt, - dfcx_loans: &'self LoanDataFlow, +struct CheckLoanCtxt<'a> { + bccx: &'a BorrowckCtxt, + dfcx_loans: &'a LoanDataFlow, move_data: @move_data::FlowedMoveData, - all_loans: &'self [Loan], + all_loans: &'a [Loan], reported: @mut HashSet, } -impl<'self> Visitor<()> for CheckLoanCtxt<'self> { +impl<'a> Visitor<()> for CheckLoanCtxt<'a> { fn visit_expr(&mut self, ex:@ast::Expr, _:()) { check_loans_in_expr(self, ex); @@ -86,7 +86,7 @@ enum MoveError { MoveWhileBorrowed(/*loan*/@LoanPath, /*loan*/Span) } -impl<'self> CheckLoanCtxt<'self> { +impl<'a> CheckLoanCtxt<'a> { pub fn tcx(&self) -> ty::ctxt { self.bccx.tcx } pub fn each_issued_loan(&self, scope_id: ast::NodeId, op: |&Loan| -> bool) diff --git a/src/librustc/middle/borrowck/gather_loans/lifetime.rs b/src/librustc/middle/borrowck/gather_loans/lifetime.rs index 0ce36e52262..8c6384c0296 100644 --- a/src/librustc/middle/borrowck/gather_loans/lifetime.rs +++ b/src/librustc/middle/borrowck/gather_loans/lifetime.rs @@ -45,8 +45,8 @@ pub fn guarantee_lifetime(bccx: &BorrowckCtxt, /////////////////////////////////////////////////////////////////////////// // Private -struct GuaranteeLifetimeContext<'self> { - bccx: &'self BorrowckCtxt, +struct GuaranteeLifetimeContext<'a> { + bccx: &'a BorrowckCtxt, // the node id of the function body for the enclosing item item_scope_id: ast::NodeId, @@ -61,7 +61,7 @@ struct GuaranteeLifetimeContext<'self> { cmt_original: mc::cmt } -impl<'self> GuaranteeLifetimeContext<'self> { +impl<'a> GuaranteeLifetimeContext<'a> { fn tcx(&self) -> ty::ctxt { self.bccx.tcx } diff --git a/src/librustc/middle/borrowck/gather_loans/mod.rs b/src/librustc/middle/borrowck/gather_loans/mod.rs index 440664b36d8..36dbfe8a2c1 100644 --- a/src/librustc/middle/borrowck/gather_loans/mod.rs +++ b/src/librustc/middle/borrowck/gather_loans/mod.rs @@ -64,8 +64,8 @@ mod gather_moves; /// No good. Instead what will happen is that `root_ub` will be set to the /// body of the while loop and we will refuse to root the pointer `&*x` /// because it would have to be rooted for a region greater than `root_ub`. -struct GatherLoanCtxt<'self> { - bccx: &'self BorrowckCtxt, +struct GatherLoanCtxt<'a> { + bccx: &'a BorrowckCtxt, id_range: id_range, move_data: @mut move_data::MoveData, all_loans: @mut ~[Loan], @@ -73,7 +73,7 @@ struct GatherLoanCtxt<'self> { repeating_ids: ~[ast::NodeId] } -impl<'self> visit::Visitor<()> for GatherLoanCtxt<'self> { +impl<'a> visit::Visitor<()> for GatherLoanCtxt<'a> { fn visit_expr(&mut self, ex:@Expr, _:()) { gather_loans_in_expr(self, ex); } @@ -333,7 +333,7 @@ fn gather_loans_in_expr(this: &mut GatherLoanCtxt, } } -impl<'self> GatherLoanCtxt<'self> { +impl<'a> GatherLoanCtxt<'a> { pub fn tcx(&self) -> ty::ctxt { self.bccx.tcx } pub fn push_repeating_id(&mut self, id: ast::NodeId) { diff --git a/src/librustc/middle/borrowck/gather_loans/restrictions.rs b/src/librustc/middle/borrowck/gather_loans/restrictions.rs index 0490fd19aa4..ae6b828ecaa 100644 --- a/src/librustc/middle/borrowck/gather_loans/restrictions.rs +++ b/src/librustc/middle/borrowck/gather_loans/restrictions.rs @@ -42,14 +42,14 @@ pub fn compute_restrictions(bccx: &BorrowckCtxt, /////////////////////////////////////////////////////////////////////////// // Private -struct RestrictionsContext<'self> { - bccx: &'self BorrowckCtxt, +struct RestrictionsContext<'a> { + bccx: &'a BorrowckCtxt, span: Span, cmt_original: mc::cmt, loan_region: ty::Region, } -impl<'self> RestrictionsContext<'self> { +impl<'a> RestrictionsContext<'a> { fn restrict(&self, cmt: mc::cmt, restrictions: RestrictionSet) -> RestrictionResult { diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index 6ef3b70dba8..6a6e8f958ff 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -77,12 +77,12 @@ pub trait DataFlowOperator { fn walk_closures(&self) -> bool; } -struct PropagationContext<'self, O> { - dfcx: &'self mut DataFlowContext, +struct PropagationContext<'a, O> { + dfcx: &'a mut DataFlowContext, changed: bool } -struct LoopScope<'self> { +struct LoopScope<'a> { loop_id: ast::NodeId, break_bits: ~[uint] } @@ -363,7 +363,7 @@ impl DataFlowContext { } } -impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { +impl<'a, O:DataFlowOperator> PropagationContext<'a, O> { fn tcx(&self) -> ty::ctxt { self.dfcx.tcx } diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 72471123a3e..d77f0cb054a 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -103,11 +103,11 @@ struct LanguageItemCollector { item_refs: HashMap<&'static str, uint>, } -struct LanguageItemVisitor<'self> { - this: &'self mut LanguageItemCollector, +struct LanguageItemVisitor<'a> { + this: &'a mut LanguageItemCollector, } -impl<'self> Visitor<()> for LanguageItemVisitor<'self> { +impl<'a> Visitor<()> for LanguageItemVisitor<'a> { fn visit_item(&mut self, item: @ast::item, _: ()) { match extract(item.attrs) { Some(value) => { diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 4c32f7159ca..feee3583f71 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -352,7 +352,7 @@ pub fn get_lint_dict() -> LintDict { return map; } -struct Context<'self> { +struct Context<'a> { // All known lint modes (string versions) dict: @LintDict, // Current levels of each lint warning @@ -360,7 +360,7 @@ struct Context<'self> { // context we're checking in (used to access fields like sess) tcx: ty::ctxt, // Items exported by the crate; used by the missing_doc lint. - exported_items: &'self privacy::ExportedItems, + exported_items: &'a privacy::ExportedItems, // The id of the current `ast::struct_def` being walked. cur_struct_def_id: ast::NodeId, // Whether some ancestor of the current node was marked @@ -376,7 +376,7 @@ struct Context<'self> { negated_expr_id: ast::NodeId } -impl<'self> Context<'self> { +impl<'a> Context<'a> { fn get_level(&self, lint: lint) -> level { match self.cur.find(&(lint as uint)) { Some(&(lvl, _)) => lvl, @@ -1234,7 +1234,7 @@ fn check_stability(cx: &Context, e: &ast::Expr) { cx.span_lint(lint, e.span, msg); } -impl<'self> Visitor<()> for Context<'self> { +impl<'a> Visitor<()> for Context<'a> { fn visit_item(&mut self, it: @ast::item, _: ()) { self.with_lint_attrs(it.attrs, |cx| { check_item_ctypes(cx, it); @@ -1369,7 +1369,7 @@ impl<'self> Visitor<()> for Context<'self> { fn visit_ty(&mut self, _t: &ast::Ty, _: ()) {} } -impl<'self> IdVisitingOperation for Context<'self> { +impl<'a> IdVisitingOperation for Context<'a> { fn visit_id(&self, id: ast::NodeId) { match self.tcx.sess.lints.pop(&id) { None => {} diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 8b60bbce401..ded8d11786a 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -30,7 +30,7 @@ use syntax::opt_vec; use syntax::visit; use syntax::visit::Visitor; -type Context<'self> = (&'self method_map, &'self resolve::ExportMap2); +type Context<'a> = (&'a method_map, &'a resolve::ExportMap2); /// A set of AST nodes exported by the crate. pub type ExportedItems = HashSet; @@ -143,9 +143,9 @@ impl Visitor<()> for ParentVisitor { /// The embargo visitor, used to determine the exports of the ast //////////////////////////////////////////////////////////////////////////////// -struct EmbargoVisitor<'self> { +struct EmbargoVisitor<'a> { tcx: ty::ctxt, - exp_map2: &'self resolve::ExportMap2, + exp_map2: &'a resolve::ExportMap2, // This flag is an indicator of whether the previous item in the // hierarchical chain was exported or not. This is the indicator of whether @@ -167,7 +167,7 @@ struct EmbargoVisitor<'self> { reexports: HashSet, } -impl<'self> Visitor<()> for EmbargoVisitor<'self> { +impl<'a> Visitor<()> for EmbargoVisitor<'a> { fn visit_item(&mut self, item: @ast::item, _: ()) { let orig_all_pub = self.prev_exported; match item.node { @@ -308,12 +308,12 @@ impl<'self> Visitor<()> for EmbargoVisitor<'self> { /// The privacy visitor, where privacy checks take place (violations reported) //////////////////////////////////////////////////////////////////////////////// -struct PrivacyVisitor<'self> { +struct PrivacyVisitor<'a> { tcx: ty::ctxt, curitem: ast::NodeId, in_fn: bool, in_foreign: bool, - method_map: &'self method_map, + method_map: &'a method_map, parents: HashMap, external_exports: resolve::ExternalExports, last_private_map: resolve::LastPrivateMap, @@ -325,7 +325,7 @@ enum PrivacyResult { DisallowedBy(ast::NodeId), } -impl<'self> PrivacyVisitor<'self> { +impl<'a> PrivacyVisitor<'a> { // used when debugging fn nodestr(&self, id: ast::NodeId) -> ~str { ast_map::node_id_to_str(self.tcx.items, id, token::get_ident_interner()) @@ -601,7 +601,7 @@ impl<'self> PrivacyVisitor<'self> { } } -impl<'self> Visitor<()> for PrivacyVisitor<'self> { +impl<'a> Visitor<()> for PrivacyVisitor<'a> { fn visit_item(&mut self, item: @ast::item, _: ()) { // Do not check privacy inside items with the resolve_unexported // attribute. This is used for the test runner. diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index d2454be4fa0..970b373f424 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -185,9 +185,9 @@ impl ResolveResult { } } -enum TypeParameters<'self> { +enum TypeParameters<'a> { NoTypeParameters, //< No type parameters. - HasTypeParameters(&'self Generics, //< Type parameters. + HasTypeParameters(&'a Generics, //< Type parameters. NodeId, //< ID of the enclosing item // The index to start numbering the type parameters at. @@ -881,11 +881,11 @@ struct Resolver { used_imports: HashSet, } -struct BuildReducedGraphVisitor<'self> { - resolver: &'self mut Resolver, +struct BuildReducedGraphVisitor<'a> { + resolver: &'a mut Resolver, } -impl<'self> Visitor for BuildReducedGraphVisitor<'self> { +impl<'a> Visitor for BuildReducedGraphVisitor<'a> { fn visit_item(&mut self, item:@item, context:ReducedGraphParent) { let p = self.resolver.build_reduced_graph_for_item(item, context); @@ -913,9 +913,9 @@ impl<'self> Visitor for BuildReducedGraphVisitor<'self> { } -struct UnusedImportCheckVisitor<'self> { resolver: &'self Resolver } +struct UnusedImportCheckVisitor<'a> { resolver: &'a Resolver } -impl<'self> Visitor<()> for UnusedImportCheckVisitor<'self> { +impl<'a> Visitor<()> for UnusedImportCheckVisitor<'a> { fn visit_view_item(&mut self, vi:&view_item, _:()) { self.resolver.check_for_item_unused_imports(vi); visit::walk_view_item(self, vi, ()); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 1ff4d395356..6130887c084 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -36,10 +36,10 @@ struct LifetimeContext { named_region_map: @mut NamedRegionMap, } -enum ScopeChain<'self> { - ItemScope(&'self OptVec), - FnScope(ast::NodeId, &'self OptVec, &'self ScopeChain<'self>), - BlockScope(ast::NodeId, &'self ScopeChain<'self>), +enum ScopeChain<'a> { + ItemScope(&'a OptVec), + FnScope(ast::NodeId, &'a OptVec, &'a ScopeChain<'a>), + BlockScope(ast::NodeId, &'a ScopeChain<'a>), RootScope } @@ -55,10 +55,10 @@ pub fn crate(sess: session::Session, ctxt.named_region_map } -impl<'self> Visitor<&'self ScopeChain<'self>> for LifetimeContext { +impl<'a> Visitor<&'a ScopeChain<'a>> for LifetimeContext { fn visit_item(&mut self, item: @ast::item, - _: &'self ScopeChain<'self>) { + _: &'a ScopeChain<'a>) { let scope = match item.node { ast::item_fn(..) | // fn lifetimes get added in visit_fn below ast::item_mod(..) | @@ -87,7 +87,7 @@ impl<'self> Visitor<&'self ScopeChain<'self>> for LifetimeContext { b: ast::P, s: Span, n: ast::NodeId, - scope: &'self ScopeChain<'self>) { + scope: &'a ScopeChain<'a>) { match *fk { visit::fk_item_fn(_, generics, _, _) | visit::fk_method(_, generics, _) => { @@ -105,7 +105,7 @@ impl<'self> Visitor<&'self ScopeChain<'self>> for LifetimeContext { fn visit_ty(&mut self, ty: &ast::Ty, - scope: &'self ScopeChain<'self>) { + scope: &'a ScopeChain<'a>) { match ty.node { ast::ty_closure(@ast::TyClosure { lifetimes: ref lifetimes, .. }) | ast::ty_bare_fn(@ast::TyBareFn { lifetimes: ref lifetimes, .. }) => { @@ -123,7 +123,7 @@ impl<'self> Visitor<&'self ScopeChain<'self>> for LifetimeContext { fn visit_ty_method(&mut self, m: &ast::TypeMethod, - scope: &'self ScopeChain<'self>) { + scope: &'a ScopeChain<'a>) { let scope1 = FnScope(m.id, &m.generics.lifetimes, scope); self.check_lifetime_names(&m.generics.lifetimes); debug!("pushing fn scope id={} due to ty_method", m.id); @@ -133,7 +133,7 @@ impl<'self> Visitor<&'self ScopeChain<'self>> for LifetimeContext { fn visit_block(&mut self, b: ast::P, - scope: &'self ScopeChain<'self>) { + scope: &'a ScopeChain<'a>) { let scope1 = BlockScope(b.id, scope); debug!("pushing block scope {}", b.id); visit::walk_block(self, b, &scope1); @@ -142,7 +142,7 @@ impl<'self> Visitor<&'self ScopeChain<'self>> for LifetimeContext { fn visit_lifetime_ref(&mut self, lifetime_ref: &ast::Lifetime, - scope: &'self ScopeChain<'self>) { + scope: &'a ScopeChain<'a>) { if lifetime_ref.ident == special_idents::statik { self.insert_lifetime(lifetime_ref, ast::DefStaticRegion); return; diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs index c9abf71e2b6..6062b30cfae 100644 --- a/src/librustc/middle/subst.rs +++ b/src/librustc/middle/subst.rs @@ -45,12 +45,12 @@ impl Subst for ty::t { } } -struct SubstFolder<'self> { +struct SubstFolder<'a> { tcx: ty::ctxt, - substs: &'self ty::substs + substs: &'a ty::substs } -impl<'self> TypeFolder for SubstFolder<'self> { +impl<'a> TypeFolder for SubstFolder<'a> { fn tcx(&self) -> ty::ctxt { self.tcx } fn fold_region(&mut self, r: ty::Region) -> ty::Region { diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index f4479b98e61..091614b6bc7 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -394,9 +394,9 @@ struct BindingInfo { type BindingsMap = HashMap; #[deriving(Clone)] -struct ArmData<'self> { +struct ArmData<'a> { bodycx: @mut Block, - arm: &'self ast::Arm, + arm: &'a ast::Arm, bindings_map: @BindingsMap } @@ -407,13 +407,13 @@ struct ArmData<'self> { * these pointers are stored in llmatch variables just before executing `data` arm. */ #[deriving(Clone)] -struct Match<'self> { +struct Match<'a> { pats: ~[@ast::Pat], - data: ArmData<'self>, + data: ArmData<'a>, bound_ptrs: ~[(Ident, ValueRef)] } -impl<'self> Repr for Match<'self> { +impl<'a> Repr for Match<'a> { fn repr(&self, tcx: ty::ctxt) -> ~str { if tcx.sess.verbose() { // for many programs, this just take too long to serialize @@ -477,7 +477,7 @@ fn assert_is_binding_or_wild(bcx: @mut Block, p: @ast::Pat) { } } -type enter_pat<'self> = 'self |@ast::Pat| -> Option<~[@ast::Pat]>; +type enter_pat<'a> = 'a |@ast::Pat| -> Option<~[@ast::Pat]>; fn enter_match<'r>(bcx: @mut Block, dm: DefMap, diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index b95f4affc84..d6fc48b52ea 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -130,16 +130,16 @@ pub fn push_ctxt(s: &'static str) -> _InsnCtxt { _InsnCtxt { _x: () } } -struct StatRecorder<'self> { +struct StatRecorder<'a> { ccx: @mut CrateContext, - name: &'self str, + name: &'a str, start: u64, istart: uint, } -impl<'self> StatRecorder<'self> { +impl<'a> StatRecorder<'a> { pub fn new(ccx: @mut CrateContext, - name: &'self str) -> StatRecorder<'self> { + name: &'a str) -> StatRecorder<'a> { let start = if ccx.sess.trans_stats() { time::precise_time_ns() } else { @@ -156,7 +156,7 @@ impl<'self> StatRecorder<'self> { } #[unsafe_destructor] -impl<'self> Drop for StatRecorder<'self> { +impl<'a> Drop for StatRecorder<'a> { fn drop(&mut self) { if self.ccx.sess.trans_stats() { let end = time::precise_time_ns(); @@ -668,7 +668,7 @@ pub fn compare_scalar_values(cx: @mut Block, } } -pub type val_and_ty_fn<'self> = 'self |@mut Block, ValueRef, ty::t| +pub type val_and_ty_fn<'a> = 'a |@mut Block, ValueRef, ty::t| -> @mut Block; pub fn load_inbounds(cx: @mut Block, p: ValueRef, idxs: &[uint]) -> ValueRef { diff --git a/src/librustc/middle/trans/basic_block.rs b/src/librustc/middle/trans/basic_block.rs index 14ba9244260..15cbe53d266 100644 --- a/src/librustc/middle/trans/basic_block.rs +++ b/src/librustc/middle/trans/basic_block.rs @@ -14,7 +14,7 @@ use std::iter::{Filter, Map}; pub struct BasicBlock(BasicBlockRef); -pub type PredIterator<'self> = Map<'self, Value, BasicBlock, Filter<'self, Value, UserIterator>>; +pub type PredIterator<'a> = Map<'a, Value, BasicBlock, Filter<'a, Value, UserIterator>>; /** * Wrapper for LLVM BasicBlockRef diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs index ebd7bb6937e..329651cb194 100644 --- a/src/librustc/middle/trans/cabi_x86_64.rs +++ b/src/librustc/middle/trans/cabi_x86_64.rs @@ -67,7 +67,7 @@ trait ClassList { fn is_ret_bysret(&self) -> bool; } -impl<'self> ClassList for &'self [RegClass] { +impl<'a> ClassList for &'a [RegClass] { fn is_pass_byval(&self) -> bool { if self.len() == 0 { return false; } diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index ac67045c241..5230a5c81b2 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -750,9 +750,9 @@ pub fn trans_call_inner(in_cx: @mut Block, }) } -pub enum CallArgs<'self> { - ArgExprs(&'self [@ast::Expr]), - ArgVals(&'self [ValueRef]) +pub enum CallArgs<'a> { + ArgExprs(&'a [@ast::Expr]), + ArgVals(&'a [ValueRef]) } pub fn trans_args(cx: @mut Block, diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 8346228e881..ab0013e73bf 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -214,12 +214,12 @@ struct FunctionDebugContextData { source_locations_enabled: bool, } -enum VariableAccess<'self> { +enum VariableAccess<'a> { // The llptr given is an alloca containing the variable's value DirectVariable { alloca: ValueRef }, // The llptr given is an alloca containing the start of some pointer chain leading to the // variable's content. - IndirectVariable { alloca: ValueRef, address_operations: &'self [ValueRef] } + IndirectVariable { alloca: ValueRef, address_operations: &'a [ValueRef] } } enum VariableKind { diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs index b7c51810996..3e3ba06538b 100644 --- a/src/librustc/middle/trans/glue.rs +++ b/src/librustc/middle/trans/glue.rs @@ -641,7 +641,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info { return inf; } -pub type glue_helper<'self> = 'self |@mut Block, ValueRef, ty::t| +pub type glue_helper<'a> = 'a |@mut Block, ValueRef, ty::t| -> @mut Block; pub fn declare_generic_glue(ccx: &mut CrateContext, t: ty::t, llfnty: Type, diff --git a/src/librustc/middle/trans/llrepr.rs b/src/librustc/middle/trans/llrepr.rs index ffb70abcec5..75908a0d805 100644 --- a/src/librustc/middle/trans/llrepr.rs +++ b/src/librustc/middle/trans/llrepr.rs @@ -16,7 +16,7 @@ pub trait LlvmRepr { fn llrepr(&self, ccx: &CrateContext) -> ~str; } -impl<'self, T:LlvmRepr> LlvmRepr for &'self [T] { +impl<'a, T:LlvmRepr> LlvmRepr for &'a [T] { fn llrepr(&self, ccx: &CrateContext) -> ~str { let reprs = self.map(|t| t.llrepr(ccx)); format!("[{}]", reprs.connect(",")) diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index d641ed42c30..52b89e0e0b6 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -539,7 +539,7 @@ pub fn get_base_and_len(bcx: @mut Block, llval: ValueRef, vec_ty: ty::t) -> (Val } } -pub type iter_vec_block<'self> = 'self |@mut Block, ValueRef, ty::t| +pub type iter_vec_block<'a> = 'a |@mut Block, ValueRef, ty::t| -> @mut Block; pub fn iter_vec_loop(bcx: @mut Block, diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index c2003e0849f..cb0e8d3241e 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -1408,13 +1408,13 @@ pub fn subst_tps(tcx: ctxt, tps: &[t], self_ty_opt: Option, typ: t) -> t { let mut subst = TpsSubst { tcx: tcx, self_ty_opt: self_ty_opt, tps: tps }; return subst.fold_ty(typ); - struct TpsSubst<'self> { + struct TpsSubst<'a> { tcx: ctxt, self_ty_opt: Option, - tps: &'self [t], + tps: &'a [t], } - impl<'self> TypeFolder for TpsSubst<'self> { + impl<'a> TypeFolder for TpsSubst<'a> { fn tcx(&self) -> ty::ctxt { self.tcx } fn fold_ty(&mut self, t: ty::t) -> ty::t { diff --git a/src/librustc/middle/ty_fold.rs b/src/librustc/middle/ty_fold.rs index d196956163b..2d39352ebc4 100644 --- a/src/librustc/middle/ty_fold.rs +++ b/src/librustc/middle/ty_fold.rs @@ -222,12 +222,12 @@ pub fn super_fold_trait_store(this: &mut T, /////////////////////////////////////////////////////////////////////////// // Some sample folders -pub struct BottomUpFolder<'self> { +pub struct BottomUpFolder<'a> { tcx: ty::ctxt, - fldop: 'self |ty::t| -> ty::t, + fldop: 'a |ty::t| -> ty::t, } -impl<'self> TypeFolder for BottomUpFolder<'self> { +impl<'a> TypeFolder for BottomUpFolder<'a> { fn tcx(&self) -> ty::ctxt { self.tcx } fn fold_ty(&mut self, ty: ty::t) -> ty::t { @@ -239,17 +239,17 @@ impl<'self> TypeFolder for BottomUpFolder<'self> { /////////////////////////////////////////////////////////////////////////// // Region folder -pub struct RegionFolder<'self> { +pub struct RegionFolder<'a> { tcx: ty::ctxt, - fld_t: 'self |ty::t| -> ty::t, - fld_r: 'self |ty::Region| -> ty::Region, + fld_t: 'a |ty::t| -> ty::t, + fld_r: 'a |ty::Region| -> ty::Region, } -impl<'self> RegionFolder<'self> { +impl<'a> RegionFolder<'a> { pub fn general(tcx: ty::ctxt, - fld_r: 'self |ty::Region| -> ty::Region, - fld_t: 'self |ty::t| -> ty::t) - -> RegionFolder<'self> { + fld_r: 'a |ty::Region| -> ty::Region, + fld_t: 'a |ty::t| -> ty::t) + -> RegionFolder<'a> { RegionFolder { tcx: tcx, fld_t: fld_t, @@ -257,8 +257,8 @@ impl<'self> RegionFolder<'self> { } } - pub fn regions(tcx: ty::ctxt, fld_r: 'self |ty::Region| -> ty::Region) - -> RegionFolder<'self> { + pub fn regions(tcx: ty::ctxt, fld_r: 'a |ty::Region| -> ty::Region) + -> RegionFolder<'a> { fn noop(t: ty::t) -> ty::t { t } RegionFolder { @@ -269,7 +269,7 @@ impl<'self> RegionFolder<'self> { } } -impl<'self> TypeFolder for RegionFolder<'self> { +impl<'a> TypeFolder for RegionFolder<'a> { fn tcx(&self) -> ty::ctxt { self.tcx } fn fold_ty(&mut self, ty: ty::t) -> ty::t { diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 26b9a1b25d5..5a437fce0a5 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -40,7 +40,7 @@ * as it does not already appear in scope. * * Case (b) says that if you have a type: - * type foo<'self> = ...; + * type foo<'a> = ...; * type bar = fn(&foo, &a.foo) * The fully expanded version of type bar is: * type bar = fn(&'foo &, &a.foo<'a>) diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 6467be93a8e..22e0a60514f 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -167,13 +167,13 @@ pub fn lookup( return lcx.search(self_ty); } -pub struct LookupContext<'self> { +pub struct LookupContext<'a> { fcx: @mut FnCtxt, expr: @ast::Expr, self_expr: @ast::Expr, callee_id: NodeId, m_name: ast::Name, - supplied_tps: &'self [ty::t], + supplied_tps: &'a [ty::t], impl_dups: @mut HashSet, inherent_candidates: @mut ~[Candidate], extension_candidates: @mut ~[Candidate], @@ -208,7 +208,7 @@ enum RcvrMatchCondition { RcvrMatchesIfSubtype(ty::t) } -impl<'self> LookupContext<'self> { +impl<'a> LookupContext<'a> { fn search(&self, self_ty: ty::t) -> Option { let mut self_ty = self_ty; let mut autoderefs = 0; diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 0b6806f7598..799f1a879da 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -918,7 +918,7 @@ pub fn compare_impl_method(tcx: ty::ctxt, // Create a substitution that maps the type parameters on the impl // to themselves and which replace any references to bound regions // in the self type with free regions. So, for example, if the - // impl type is "&'self str", then this would replace the self + // impl type is "&'a str", then this would replace the self // type with a free region `self`. let dummy_impl_tps: ~[ty::t] = impl_generics.type_param_defs.iter().enumerate(). diff --git a/src/librustc/middle/typeck/check/regionmanip.rs b/src/librustc/middle/typeck/check/regionmanip.rs index 7bf5eacb3d5..23c1961b0c0 100644 --- a/src/librustc/middle/typeck/check/regionmanip.rs +++ b/src/librustc/middle/typeck/check/regionmanip.rs @@ -85,17 +85,17 @@ pub fn relate_nested_regions(tcx: ty::ctxt, } rr.fold_ty(ty); - struct RegionRelator<'self> { + struct RegionRelator<'a> { tcx: ty::ctxt, stack: ~[ty::Region], - relate_op: 'self |ty::Region, ty::Region|, + relate_op: 'a |ty::Region, ty::Region|, } // FIXME(#10151) -- Define more precisely when a region is // considered "nested". Consider taking variance into account as // well. - impl<'self> TypeFolder for RegionRelator<'self> { + impl<'a> TypeFolder for RegionRelator<'a> { fn tcx(&self) -> ty::ctxt { self.tcx } @@ -124,7 +124,7 @@ pub fn relate_nested_regions(tcx: ty::ctxt, } } - impl<'self> RegionRelator<'self> { + impl<'a> RegionRelator<'a> { fn relate(&mut self, r_sub: ty::Region) { for &r in self.stack.iter() { if !r.is_bound() && !r_sub.is_bound() { diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 4a2ddf5f0f2..401a0ea898b 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -69,12 +69,12 @@ pub struct LocationInfo { /// A vtable context includes an inference context, a crate context, and a /// callback function to call in case of type error. -pub struct VtableContext<'self> { +pub struct VtableContext<'a> { infcx: @mut infer::InferCtxt, - param_env: &'self ty::ParameterEnvironment, + param_env: &'a ty::ParameterEnvironment, } -impl<'self> VtableContext<'self> { +impl<'a> VtableContext<'a> { pub fn tcx(&self) -> ty::ctxt { self.infcx.tcx } } diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index 8f344095aea..8f702e59d0a 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -51,8 +51,8 @@ pub trait LatticeValue { fn glb(cf: &CombineFields, a: &Self, b: &Self) -> cres; } -pub type LatticeOp<'self, T> = - 'self |cf: &CombineFields, a: &T, b: &T| -> cres; +pub type LatticeOp<'a, T> = + 'a |cf: &CombineFields, a: &T, b: &T| -> cres; impl LatticeValue for ty::t { fn sub(cf: &CombineFields, a: &ty::t, b: &ty::t) -> ures { @@ -405,7 +405,7 @@ pub fn super_lattice_tys(this: &L, } } -pub type LatticeDirOp<'self, T> = 'self |a: &T, b: &T| -> cres; +pub type LatticeDirOp<'a, T> = 'a |a: &T, b: &T| -> cres; #[deriving(Clone)] pub enum LatticeVarResult { diff --git a/src/librustc/middle/typeck/infer/region_inference/doc.rs b/src/librustc/middle/typeck/infer/region_inference/doc.rs index f63779cd8b8..09069ce46b2 100644 --- a/src/librustc/middle/typeck/infer/region_inference/doc.rs +++ b/src/librustc/middle/typeck/infer/region_inference/doc.rs @@ -406,7 +406,7 @@ Now let's consider two more function types. Here, we assume that the `self` lifetime is defined somewhere outside and hence is not a lifetime parameter bound by the function type (it "appears free"): - fn(&'a int) <: |&'self int|? (Yes, a => self) + fn(&'a int) <: |&'a int|? (Yes, a => self) This subtyping relation does in fact hold. To see why, you have to consider what subtyping means. One way to look at `T1 <: T2` is to @@ -423,7 +423,7 @@ to the same thing: a function that accepts pointers with any lifetime So, what if we reverse the order of the two function types, like this: - fn(&'self int) <: |&'a int|? (No) + fn(&'a int) <: |&'a int|? (No) Does the subtyping relationship still hold? The answer of course is no. In this case, the function accepts *only the lifetime `&self`*, @@ -491,12 +491,12 @@ So far we have encountered no error, so the subtype check succeeds. Now let's look first at the third example, which was: - 3. fn(&'self T) <: |&'b T|? No! + 3. fn(&'a T) <: |&'b T|? No! After steps 1 and 2 of the algorithm we will have replaced the types like so: - 3. fn(&'self T) <: |&'x T|? + 3. fn(&'a T) <: |&'x T|? This looks pretty much the same as before, except that on the LHS `&self` was not bound, and hence was left as-is and not replaced with diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs index 84dff19e452..81489c1577f 100644 --- a/src/librustc/middle/typeck/variance.rs +++ b/src/librustc/middle/typeck/variance.rs @@ -218,7 +218,7 @@ pub fn infer_variance(tcx: ty::ctxt, * * Terms are structured as a straightforward tree. Rather than rely on * GC, we allocate terms out of a bounded arena (the lifetime of this - * arena is the lifetime 'self that is threaded around). + * arena is the lifetime 'a that is threaded around). * * We assign a unique index to each type/region parameter whose variance * is to be inferred. We refer to such variables as "inferreds". An @@ -226,17 +226,17 @@ pub fn infer_variance(tcx: ty::ctxt, * a variable. */ -type VarianceTermPtr<'self> = &'self VarianceTerm<'self>; +type VarianceTermPtr<'a> = &'a VarianceTerm<'a>; struct InferredIndex(uint); -enum VarianceTerm<'self> { +enum VarianceTerm<'a> { ConstantTerm(ty::Variance), - TransformTerm(VarianceTermPtr<'self>, VarianceTermPtr<'self>), + TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>), InferredTerm(InferredIndex), } -impl<'self> ToStr for VarianceTerm<'self> { +impl<'a> ToStr for VarianceTerm<'a> { fn to_str(&self) -> ~str { match *self { ConstantTerm(c1) => format!("{}", c1.to_str()), @@ -251,9 +251,9 @@ impl<'self> ToStr for VarianceTerm<'self> { * The first pass over the crate simply builds up the set of inferreds. */ -struct TermsContext<'self> { +struct TermsContext<'a> { tcx: ty::ctxt, - arena: &'self Arena, + arena: &'a Arena, empty_variances: @ty::ItemVariances, @@ -262,17 +262,17 @@ struct TermsContext<'self> { inferred_map: HashMap, // Maps from an InferredIndex to the info for that variable. - inferred_infos: ~[InferredInfo<'self>], + inferred_infos: ~[InferredInfo<'a>], } enum ParamKind { TypeParam, RegionParam, SelfParam } -struct InferredInfo<'self> { +struct InferredInfo<'a> { item_id: ast::NodeId, kind: ParamKind, index: uint, param_id: ast::NodeId, - term: VarianceTermPtr<'self>, + term: VarianceTermPtr<'a>, } fn determine_parameters_to_be_inferred<'a>(tcx: ty::ctxt, @@ -297,7 +297,7 @@ fn determine_parameters_to_be_inferred<'a>(tcx: ty::ctxt, terms_cx } -impl<'self> TermsContext<'self> { +impl<'a> TermsContext<'a> { fn add_inferred(&mut self, item_id: ast::NodeId, kind: ParamKind, @@ -326,7 +326,7 @@ impl<'self> TermsContext<'self> { } } -impl<'self> Visitor<()> for TermsContext<'self> { +impl<'a> Visitor<()> for TermsContext<'a> { fn visit_item(&mut self, item: @ast::item, (): ()) { @@ -392,23 +392,23 @@ impl<'self> Visitor<()> for TermsContext<'self> { * We walk the set of items and, for each member, generate new constraints. */ -struct ConstraintContext<'self> { - terms_cx: TermsContext<'self>, +struct ConstraintContext<'a> { + terms_cx: TermsContext<'a>, // These are pointers to common `ConstantTerm` instances - covariant: VarianceTermPtr<'self>, - contravariant: VarianceTermPtr<'self>, - invariant: VarianceTermPtr<'self>, - bivariant: VarianceTermPtr<'self>, + covariant: VarianceTermPtr<'a>, + contravariant: VarianceTermPtr<'a>, + invariant: VarianceTermPtr<'a>, + bivariant: VarianceTermPtr<'a>, - constraints: ~[Constraint<'self>], + constraints: ~[Constraint<'a>], } /// Declares that the variable `decl_id` appears in a location with /// variance `variance`. -struct Constraint<'self> { +struct Constraint<'a> { inferred: InferredIndex, - variance: &'self VarianceTerm<'self>, + variance: &'a VarianceTerm<'a>, } fn add_constraints_from_crate<'a>(terms_cx: TermsContext<'a>, @@ -430,7 +430,7 @@ fn add_constraints_from_crate<'a>(terms_cx: TermsContext<'a>, constraint_cx } -impl<'self> Visitor<()> for ConstraintContext<'self> { +impl<'a> Visitor<()> for ConstraintContext<'a> { fn visit_item(&mut self, item: @ast::item, (): ()) { @@ -506,7 +506,7 @@ impl<'self> Visitor<()> for ConstraintContext<'self> { } } -impl<'self> ConstraintContext<'self> { +impl<'a> ConstraintContext<'a> { fn tcx(&self) -> ty::ctxt { self.terms_cx.tcx } @@ -529,7 +529,7 @@ impl<'self> ConstraintContext<'self> { item_def_id: ast::DefId, kind: ParamKind, index: uint) - -> VarianceTermPtr<'self> { + -> VarianceTermPtr<'a> { /*! * Returns a variance term representing the declared variance of * the type/region parameter with the given id. @@ -557,7 +557,7 @@ impl<'self> ConstraintContext<'self> { fn add_constraint(&mut self, index: InferredIndex, - variance: VarianceTermPtr<'self>) { + variance: VarianceTermPtr<'a>) { debug!("add_constraint(index={}, variance={})", *index, variance.to_str()); self.constraints.push(Constraint { inferred: index, @@ -565,18 +565,18 @@ impl<'self> ConstraintContext<'self> { } fn contravariant(&mut self, - variance: VarianceTermPtr<'self>) - -> VarianceTermPtr<'self> { + variance: VarianceTermPtr<'a>) + -> VarianceTermPtr<'a> { self.xform(variance, self.contravariant) } fn invariant(&mut self, - variance: VarianceTermPtr<'self>) - -> VarianceTermPtr<'self> { + variance: VarianceTermPtr<'a>) + -> VarianceTermPtr<'a> { self.xform(variance, self.invariant) } - fn constant_term(&self, v: ty::Variance) -> VarianceTermPtr<'self> { + fn constant_term(&self, v: ty::Variance) -> VarianceTermPtr<'a> { match v { ty::Covariant => self.covariant, ty::Invariant => self.invariant, @@ -586,9 +586,9 @@ impl<'self> ConstraintContext<'self> { } fn xform(&mut self, - v1: VarianceTermPtr<'self>, - v2: VarianceTermPtr<'self>) - -> VarianceTermPtr<'self> { + v1: VarianceTermPtr<'a>, + v2: VarianceTermPtr<'a>) + -> VarianceTermPtr<'a> { match (*v1, *v2) { (_, ConstantTerm(ty::Covariant)) => { // Applying a "covariant" transform is always a no-op @@ -609,7 +609,7 @@ impl<'self> ConstraintContext<'self> { /// in a context with ambient variance `variance` fn add_constraints_from_ty(&mut self, ty: ty::t, - variance: VarianceTermPtr<'self>) { + variance: VarianceTermPtr<'a>) { debug!("add_constraints_from_ty(ty={})", ty.repr(self.tcx())); match ty::get(ty).sty { @@ -704,7 +704,7 @@ impl<'self> ConstraintContext<'self> { /// appearing in a context with ambient variance `variance` fn add_constraints_from_vstore(&mut self, vstore: ty::vstore, - variance: VarianceTermPtr<'self>) { + variance: VarianceTermPtr<'a>) { match vstore { ty::vstore_slice(r) => { let contra = self.contravariant(variance); @@ -722,7 +722,7 @@ impl<'self> ConstraintContext<'self> { def_id: ast::DefId, generics: &ty::Generics, substs: &ty::substs, - variance: VarianceTermPtr<'self>) { + variance: VarianceTermPtr<'a>) { debug!("add_constraints_from_substs(def_id={:?})", def_id); for (i, p) in generics.type_param_defs.iter().enumerate() { @@ -749,7 +749,7 @@ impl<'self> ConstraintContext<'self> { /// `sig` appearing in a context with ambient variance `variance` fn add_constraints_from_sig(&mut self, sig: &ty::FnSig, - variance: VarianceTermPtr<'self>) { + variance: VarianceTermPtr<'a>) { let contra = self.contravariant(variance); for &input in sig.inputs.iter() { self.add_constraints_from_ty(input, contra); @@ -761,7 +761,7 @@ impl<'self> ConstraintContext<'self> { /// context with ambient variance `variance` fn add_constraints_from_region(&mut self, region: ty::Region, - variance: VarianceTermPtr<'self>) { + variance: VarianceTermPtr<'a>) { match region { ty::ReEarlyBound(param_id, _, _) => { let index = self.inferred_index(param_id); @@ -790,7 +790,7 @@ impl<'self> ConstraintContext<'self> { /// appearing in a context with ambient variance `variance` fn add_constraints_from_mt(&mut self, mt: &ty::mt, - variance: VarianceTermPtr<'self>) { + variance: VarianceTermPtr<'a>) { match mt.mutbl { ast::MutMutable => { let invar = self.invariant(variance); @@ -813,9 +813,9 @@ impl<'self> ConstraintContext<'self> { * inferred is then written into the `variance_map` in the tcx. */ -struct SolveContext<'self> { - terms_cx: TermsContext<'self>, - constraints: ~[Constraint<'self>], +struct SolveContext<'a> { + terms_cx: TermsContext<'a>, + constraints: ~[Constraint<'a>], // Maps from an InferredIndex to the inferred value for that variable. solutions: ~[ty::Variance] @@ -833,7 +833,7 @@ fn solve_constraints(constraints_cx: ConstraintContext) { solutions_cx.write(); } -impl<'self> SolveContext<'self> { +impl<'a> SolveContext<'a> { fn solve(&mut self) { // Propagate constraints until a fixed point is reached. Note // that the maximum number of iterations is 2C where C is the @@ -925,7 +925,7 @@ impl<'self> SolveContext<'self> { } } - fn evaluate(&self, term: VarianceTermPtr<'self>) -> ty::Variance { + fn evaluate(&self, term: VarianceTermPtr<'a>) -> ty::Variance { match *term { ConstantTerm(v) => { v diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index ee068d7e6a1..ad55c8dcab9 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -69,12 +69,12 @@ pub fn field_exprs(fields: ~[ast::Field]) -> ~[@ast::Expr] { fields.map(|f| f.expr) } -struct LoopQueryVisitor<'self> { - p: 'self |&ast::Expr_| -> bool, +struct LoopQueryVisitor<'a> { + p: 'a |&ast::Expr_| -> bool, flag: bool, } -impl<'self> Visitor<()> for LoopQueryVisitor<'self> { +impl<'a> Visitor<()> for LoopQueryVisitor<'a> { fn visit_expr(&mut self, e: @ast::Expr, _: ()) { self.flag |= (self.p)(&e.node); match e.node { @@ -97,12 +97,12 @@ pub fn loop_query(b: ast::P, p: |&ast::Expr_| -> bool) -> bool { return v.flag; } -struct BlockQueryVisitor<'self> { - p: 'self |@ast::Expr| -> bool, +struct BlockQueryVisitor<'a> { + p: 'a |@ast::Expr| -> bool, flag: bool, } -impl<'self> Visitor<()> for BlockQueryVisitor<'self> { +impl<'a> Visitor<()> for BlockQueryVisitor<'a> { fn visit_expr(&mut self, e: @ast::Expr, _:()) { self.flag |= (self.p)(e); visit::walk_expr(self, e, ()) diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 2b3db1e0a89..9cc2d7dbb63 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -567,7 +567,7 @@ fn repr_vec(tcx: ctxt, v: &[T]) -> ~str { vec_map_to_str(v, |t| t.repr(tcx)) } -impl<'self, T:Repr> Repr for &'self [T] { +impl<'a, T:Repr> Repr for &'a [T] { fn repr(&self, tcx: ctxt) -> ~str { repr_vec(tcx, *self) } diff --git a/src/librustdoc/clean.rs b/src/librustdoc/clean.rs index ab9fabb0841..54323ddeb32 100644 --- a/src/librustdoc/clean.rs +++ b/src/librustdoc/clean.rs @@ -239,7 +239,7 @@ impl Clean for ast::Attribute { } // This is a rough approximation that gets us what we want. -impl<'self> attr::AttrMetaMethods for &'self Attribute { +impl<'a> attr::AttrMetaMethods for &'a Attribute { fn name(&self) -> @str { match **self { Word(ref n) | List(ref n, _) | NameValue(ref n, _) => diff --git a/src/librustdoc/html/escape.rs b/src/librustdoc/html/escape.rs index d618275ff05..0022dcf279c 100644 --- a/src/librustdoc/html/escape.rs +++ b/src/librustdoc/html/escape.rs @@ -17,10 +17,10 @@ use std::fmt; /// Wrapper struct which will emit the HTML-escaped version of the contained /// string when passed to a format string. -pub struct Escape<'self>(&'self str); +pub struct Escape<'a>(&'a str); -impl<'self> fmt::Default for Escape<'self> { - fn fmt(s: &Escape<'self>, fmt: &mut fmt::Formatter) { +impl<'a> fmt::Default for Escape<'a> { + fn fmt(s: &Escape<'a>, fmt: &mut fmt::Formatter) { // Because the internet is always right, turns out there's not that many // characters to escape: http://stackoverflow.com/questions/7381974 let pile_o_bits = s.as_slice(); diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index b80f92016a8..661f96e7c1a 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -33,7 +33,7 @@ pub struct VisSpace(Option); /// space after it. pub struct PuritySpace(ast::purity); /// Wrapper struct for properly emitting a method declaration. -pub struct Method<'self>(&'self clean::SelfTy, &'self clean::FnDecl); +pub struct Method<'a>(&'a clean::SelfTy, &'a clean::FnDecl); impl fmt::Default for clean::Generics { fn fmt(g: &clean::Generics, f: &mut fmt::Formatter) { @@ -393,8 +393,8 @@ impl fmt::Default for ~[clean::Argument] { } } -impl<'self> fmt::Default for Method<'self> { - fn fmt(m: &Method<'self>, f: &mut fmt::Formatter) { +impl<'a> fmt::Default for Method<'a> { + fn fmt(m: &Method<'a>, f: &mut fmt::Formatter) { let Method(selfty, d) = *m; let mut args = ~""; match *selfty { diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 09b4ade3814..fd8c957801d 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -18,10 +18,10 @@ pub struct Layout { crate: ~str, } -pub struct Page<'self> { - title: &'self str, - ty: &'self str, - root_path: &'self str, +pub struct Page<'a> { + title: &'a str, + ty: &'a str, + root_path: &'a str, } pub fn render( diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index e91be32227e..97cd7c20f51 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -30,7 +30,7 @@ use std::vec; /// A unit struct which has the `fmt::Default` trait implemented. When /// formatted, this struct will emit the HTML corresponding to the rendered /// version of the contained markdown string. -pub struct Markdown<'self>(&'self str); +pub struct Markdown<'a>(&'a str); static OUTPUT_UNIT: libc::size_t = 64; static MKDEXT_NO_INTRA_EMPHASIS: libc::c_uint = 1 << 0; @@ -119,8 +119,8 @@ fn render(w: &mut io::Writer, s: &str) { } } -impl<'self> fmt::Default for Markdown<'self> { - fn fmt(md: &Markdown<'self>, fmt: &mut fmt::Formatter) { +impl<'a> fmt::Default for Markdown<'a> { + fn fmt(md: &Markdown<'a>, fmt: &mut fmt::Formatter) { // This is actually common enough to special-case if md.len() == 0 { return; } render(fmt.buf, md.as_slice()); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 39f68ae59e8..0c703e780f1 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -166,8 +166,8 @@ pub struct Cache { } /// Helper struct to render all source code to HTML pages -struct SourceCollector<'self> { - cx: &'self mut Context, +struct SourceCollector<'a> { + cx: &'a mut Context, /// Processed source-file paths seen: HashSet<~str>, @@ -177,13 +177,13 @@ struct SourceCollector<'self> { /// Wrapper struct to render the source code of a file. This will do things like /// adding line numbers to the left-hand side. -struct Source<'self>(&'self str); +struct Source<'a>(&'a str); // Helper structs for rendering items/sidebars and carrying along contextual // information -struct Item<'self> { cx: &'self Context, item: &'self clean::Item, } -struct Sidebar<'self> { cx: &'self Context, item: &'self clean::Item, } +struct Item<'a> { cx: &'a Context, item: &'a clean::Item, } +struct Sidebar<'a> { cx: &'a Context, item: &'a clean::Item, } /// Struct representing one entry in the JS search index. These are all emitted /// by hand to a large JS file at the end of cache-creation. @@ -380,7 +380,7 @@ fn extern_location(e: &clean::ExternalCrate, dst: &Path) -> ExternalLocation { return Unknown; } -impl<'self> DocFolder for SourceCollector<'self> { +impl<'a> DocFolder for SourceCollector<'a> { fn fold_item(&mut self, item: clean::Item) -> Option { // If we're including source files, and we haven't seen this file yet, // then we need to render it out to the filesystem @@ -406,7 +406,7 @@ impl<'self> DocFolder for SourceCollector<'self> { } } -impl<'self> SourceCollector<'self> { +impl<'a> SourceCollector<'a> { /// Renders the given filename into its corresponding HTML source file. fn emit_source(&mut self, filename: &str) -> bool { let p = Path::new(filename); @@ -632,7 +632,7 @@ impl DocFolder for Cache { } } -impl<'self> Cache { +impl<'a> Cache { fn generics(&mut self, generics: &clean::Generics) { for typ in generics.type_params.iter() { self.typarams.insert(typ.id, typ.name.clone()); @@ -862,7 +862,7 @@ fn shortty(item: &clean::Item) -> &'static str { } } -impl<'self> Item<'self> { +impl<'a> Item<'a> { fn ismodule(&self) -> bool { match self.item.inner { clean::ModuleItem(..) => true, _ => false @@ -870,8 +870,8 @@ impl<'self> Item<'self> { } } -impl<'self> fmt::Default for Item<'self> { - fn fmt(it: &Item<'self>, fmt: &mut fmt::Formatter) { +impl<'a> fmt::Default for Item<'a> { + fn fmt(it: &Item<'a>, fmt: &mut fmt::Formatter) { match attr::find_stability(it.item.attrs.iter()) { Some(stability) => { write!(fmt.buf, @@ -1057,9 +1057,9 @@ fn item_module(w: &mut Writer, cx: &Context, match myitem.inner { clean::StaticItem(ref s) | clean::ForeignStaticItem(ref s) => { - struct Initializer<'self>(&'self str); - impl<'self> fmt::Default for Initializer<'self> { - fn fmt(s: &Initializer<'self>, f: &mut fmt::Formatter) { + struct Initializer<'a>(&'a str); + impl<'a> fmt::Default for Initializer<'a> { + fn fmt(s: &Initializer<'a>, f: &mut fmt::Formatter) { if s.len() == 0 { return; } write!(f.buf, " = "); let tag = if s.contains("\n") { "pre" } else { "code" }; @@ -1563,8 +1563,8 @@ fn item_typedef(w: &mut Writer, it: &clean::Item, t: &clean::Typedef) { document(w, it); } -impl<'self> fmt::Default for Sidebar<'self> { - fn fmt(s: &Sidebar<'self>, fmt: &mut fmt::Formatter) { +impl<'a> fmt::Default for Sidebar<'a> { + fn fmt(s: &Sidebar<'a>, fmt: &mut fmt::Formatter) { let cx = s.cx; let it = s.item; write!(fmt.buf, "

, f: &mut fmt::Formatter) { d.with_str(|s| f.pad(s)) } } -impl<'self, P: GenericPath> ToStr for Display<'self, P> { +impl<'a, P: GenericPath> ToStr for Display<'a, P> { /// Returns the path as a string /// /// If the path is not UTF-8, invalid sequences with be replaced with the @@ -551,7 +551,7 @@ impl<'self, P: GenericPath> ToStr for Display<'self, P> { } } -impl<'self, P: GenericPath> Display<'self, P> { +impl<'a, P: GenericPath> Display<'a, P> { /// Provides the path as a string to a closure /// /// If the path is not UTF-8, invalid sequences will be replaced with the @@ -570,7 +570,7 @@ impl<'self, P: GenericPath> Display<'self, P> { } } -impl<'self> BytesContainer for &'self str { +impl<'a> BytesContainer for &'a str { #[inline] fn container_as_bytes<'a>(&'a self) -> &'a [u8] { self.as_bytes() @@ -584,7 +584,7 @@ impl<'self> BytesContainer for &'self str { Some(*self) } #[inline] - fn is_str(_: Option<&'self str>) -> bool { true } + fn is_str(_: Option<&'a str>) -> bool { true } } impl BytesContainer for ~str { @@ -625,7 +625,7 @@ impl BytesContainer for @str { fn is_str(_: Option<@str>) -> bool { true } } -impl<'self> BytesContainer for &'self [u8] { +impl<'a> BytesContainer for &'a [u8] { #[inline] fn container_as_bytes<'a>(&'a self) -> &'a [u8] { *self diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 10ce06f7e03..3f2535765dd 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -25,16 +25,16 @@ use vec::{CopyableVector, RSplitIterator, SplitIterator, Vector, VectorVector}; use super::{BytesContainer, GenericPath, GenericPathUnsafe}; /// Iterator that yields successive components of a Path as &[u8] -pub type ComponentIter<'self> = SplitIterator<'self, u8>; +pub type ComponentIter<'a> = SplitIterator<'a, u8>; /// Iterator that yields components of a Path in reverse as &[u8] -pub type RevComponentIter<'self> = RSplitIterator<'self, u8>; +pub type RevComponentIter<'a> = RSplitIterator<'a, u8>; /// Iterator that yields successive components of a Path as Option<&str> -pub type StrComponentIter<'self> = Map<'self, &'self [u8], Option<&'self str>, - ComponentIter<'self>>; +pub type StrComponentIter<'a> = Map<'a, &'a [u8], Option<&'a str>, + ComponentIter<'a>>; /// Iterator that yields components of a Path in reverse as Option<&str> -pub type RevStrComponentIter<'self> = Map<'self, &'self [u8], Option<&'self str>, - RevComponentIter<'self>>; +pub type RevStrComponentIter<'a> = Map<'a, &'a [u8], Option<&'a str>, + RevComponentIter<'a>>; /// Represents a POSIX file path #[deriving(Clone, DeepClone)] @@ -103,7 +103,7 @@ impl BytesContainer for Path { } } -impl<'self> BytesContainer for &'self Path { +impl<'a> BytesContainer for &'a Path { #[inline] fn container_as_bytes<'a>(&'a self) -> &'a [u8] { self.as_vec() diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index b7a0d685f12..114f675cdba 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -27,21 +27,21 @@ use super::{contains_nul, BytesContainer, GenericPath, GenericPathUnsafe}; /// /// Each component is yielded as Option<&str> for compatibility with PosixPath, but /// every component in WindowsPath is guaranteed to be Some. -pub type StrComponentIter<'self> = Map<'self, &'self str, Option<&'self str>, - CharSplitIterator<'self, char>>; +pub type StrComponentIter<'a> = Map<'a, &'a str, Option<&'a str>, + CharSplitIterator<'a, char>>; /// Iterator that yields components of a Path in reverse as &str /// /// Each component is yielded as Option<&str> for compatibility with PosixPath, but /// every component in WindowsPath is guaranteed to be Some. -pub type RevStrComponentIter<'self> = Invert, - CharSplitIterator<'self, char>>>; +pub type RevStrComponentIter<'a> = Invert, + CharSplitIterator<'a, char>>>; /// Iterator that yields successive components of a Path as &[u8] -pub type ComponentIter<'self> = Map<'self, Option<&'self str>, &'self [u8], - StrComponentIter<'self>>; +pub type ComponentIter<'a> = Map<'a, Option<&'a str>, &'a [u8], + StrComponentIter<'a>>; /// Iterator that yields components of a Path in reverse as &[u8] -pub type RevComponentIter<'self> = Map<'self, Option<&'self str>, &'self [u8], - RevStrComponentIter<'self>>; +pub type RevComponentIter<'a> = Map<'a, Option<&'a str>, &'a [u8], + RevStrComponentIter<'a>>; /// Represents a Windows path // Notes for Windows path impl: @@ -138,7 +138,7 @@ impl BytesContainer for Path { fn is_str(_: Option) -> bool { true } } -impl<'self> BytesContainer for &'self Path { +impl<'a> BytesContainer for &'a Path { #[inline] fn container_as_bytes<'a>(&'a self) -> &'a [u8] { self.as_vec() @@ -152,7 +152,7 @@ impl<'self> BytesContainer for &'self Path { self.as_str() } #[inline] - fn is_str(_: Option<&'self Path>) -> bool { true } + fn is_str(_: Option<&'a Path>) -> bool { true } } impl GenericPathUnsafe for Path { diff --git a/src/libstd/rand/isaac.rs b/src/libstd/rand/isaac.rs index 877df1fb644..3dcf97212f5 100644 --- a/src/libstd/rand/isaac.rs +++ b/src/libstd/rand/isaac.rs @@ -188,8 +188,8 @@ impl Rng for IsaacRng { } } -impl<'self> SeedableRng<&'self [u32]> for IsaacRng { - fn reseed(&mut self, seed: &'self [u32]) { +impl<'a> SeedableRng<&'a [u32]> for IsaacRng { + fn reseed(&mut self, seed: &'a [u32]) { // make the seed into [seed[0], seed[1], ..., seed[seed.len() // - 1], 0, 0, ...], to fill rng.rsl. let seed_iter = seed.iter().map(|&x| x).chain(Repeat::new(0u32)); @@ -210,7 +210,7 @@ impl<'self> SeedableRng<&'self [u32]> for IsaacRng { /// 256 and any more will be silently ignored. A generator /// constructed with a given seed will generate the same sequence /// of values as all other generators constructed with that seed. - fn from_seed(seed: &'self [u32]) -> IsaacRng { + fn from_seed(seed: &'a [u32]) -> IsaacRng { let mut rng = EMPTY; rng.reseed(seed); rng @@ -399,8 +399,8 @@ impl Rng for Isaac64Rng { } } -impl<'self> SeedableRng<&'self [u64]> for Isaac64Rng { - fn reseed(&mut self, seed: &'self [u64]) { +impl<'a> SeedableRng<&'a [u64]> for Isaac64Rng { + fn reseed(&mut self, seed: &'a [u64]) { // make the seed into [seed[0], seed[1], ..., seed[seed.len() // - 1], 0, 0, ...], to fill rng.rsl. let seed_iter = seed.iter().map(|&x| x).chain(Repeat::new(0u64)); @@ -421,7 +421,7 @@ impl<'self> SeedableRng<&'self [u64]> for Isaac64Rng { /// 256 and any more will be silently ignored. A generator /// constructed with a given seed will generate the same sequence /// of values as all other generators constructed with that seed. - fn from_seed(seed: &'self [u64]) -> Isaac64Rng { + fn from_seed(seed: &'a [u64]) -> Isaac64Rng { let mut rng = EMPTY_64; rng.reseed(seed); rng diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 3a33fb182aa..32c2402f39b 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -469,14 +469,14 @@ impl Rng for StdRng { } } -impl<'self> SeedableRng<&'self [uint]> for StdRng { - fn reseed(&mut self, seed: &'self [uint]) { +impl<'a> SeedableRng<&'a [uint]> for StdRng { + fn reseed(&mut self, seed: &'a [uint]) { // the internal RNG can just be seeded from the above // randomness. self.rng.reseed(unsafe {cast::transmute(seed)}) } - fn from_seed(seed: &'self [uint]) -> StdRng { + fn from_seed(seed: &'a [uint]) -> StdRng { StdRng { rng: SeedableRng::from_seed(unsafe {cast::transmute(seed)}) } } } diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index 081673e86cb..2f9478716a3 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -97,11 +97,11 @@ enum VariantState { AlreadyFound } -pub struct ReprVisitor<'self> { +pub struct ReprVisitor<'a> { priv ptr: *c_void, priv ptr_stk: ~[*c_void], priv var_stk: ~[VariantState], - priv writer: &'self mut io::Writer + priv writer: &'a mut io::Writer } pub fn ReprVisitor<'a>(ptr: *c_void, @@ -114,7 +114,7 @@ pub fn ReprVisitor<'a>(ptr: *c_void, } } -impl<'self> MovePtr for ReprVisitor<'self> { +impl<'a> MovePtr for ReprVisitor<'a> { #[inline] fn move_ptr(&mut self, adjustment: |*c_void| -> *c_void) { self.ptr = adjustment(self.ptr); @@ -127,7 +127,7 @@ impl<'self> MovePtr for ReprVisitor<'self> { } } -impl<'self> ReprVisitor<'self> { +impl<'a> ReprVisitor<'a> { // Various helpers for the TyVisitor impl #[inline] @@ -242,7 +242,7 @@ impl<'self> ReprVisitor<'self> { } } -impl<'self> TyVisitor for ReprVisitor<'self> { +impl<'a> TyVisitor for ReprVisitor<'a> { fn visit_bot(&mut self) -> bool { self.writer.write("!".as_bytes()); true diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs index 2b1e7865a73..2fa34994292 100644 --- a/src/libstd/rt/comm.rs +++ b/src/libstd/rt/comm.rs @@ -510,7 +510,7 @@ impl Peekable for Port { // of them, but a &Port should also be selectable so you can select2 on it // alongside a PortOne without passing the port by value in recv_ready. -impl<'self, T: Send> SelectInner for &'self Port { +impl<'a, T: Send> SelectInner for &'a Port { #[inline] fn optimistic_check(&mut self) -> bool { self.next.with_mut(|pone| { pone.get_mut_ref().optimistic_check() }) @@ -528,7 +528,7 @@ impl<'self, T: Send> SelectInner for &'self Port { } } -impl<'self, T: Send> Select for &'self Port { } +impl<'a, T: Send> Select for &'a Port { } impl SelectInner for Port { #[inline] @@ -549,7 +549,7 @@ impl SelectInner for Port { impl Select for Port { } -impl<'self, T: Send> SelectPortInner for &'self Port { +impl<'a, T: Send> SelectPortInner for &'a Port { fn recv_ready(self) -> Option { let mut b = self.next.borrow_mut(); match b.get().take_unwrap().recv_ready() { @@ -562,7 +562,7 @@ impl<'self, T: Send> SelectPortInner for &'self Port { } } -impl<'self, T: Send> SelectPort for &'self Port { } +impl<'a, T: Send> SelectPort for &'a Port { } pub struct SharedChan { // Just like Chan, but a shared AtomicOption diff --git a/src/libstd/rt/crate_map.rs b/src/libstd/rt/crate_map.rs index 6dcbd4a129e..22fc3f0ab56 100644 --- a/src/libstd/rt/crate_map.rs +++ b/src/libstd/rt/crate_map.rs @@ -21,15 +21,15 @@ use rt::rtio::EventLoop; #[link_args = "-Wl,-U,__rust_crate_map_toplevel"] extern {} -pub struct ModEntry<'self> { - name: &'self str, +pub struct ModEntry<'a> { + name: &'a str, log_level: *mut u32 } -pub struct CrateMap<'self> { +pub struct CrateMap<'a> { version: i32, - entries: &'self [ModEntry<'self>], - children: &'self [&'self CrateMap<'self>], + entries: &'a [ModEntry<'a>], + children: &'a [&'a CrateMap<'a>], event_loop_factory: Option ~EventLoop>, } diff --git a/src/libstd/run.rs b/src/libstd/run.rs index f4c6cdbd934..754c02e308f 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -33,7 +33,7 @@ pub struct Process { } /// Options that can be given when starting a Process. -pub struct ProcessOptions<'self> { +pub struct ProcessOptions<'a> { /** * If this is None then the new process will have the same initial * environment as the parent process. @@ -50,7 +50,7 @@ pub struct ProcessOptions<'self> { * If this is Some(path) then the new process will use the given path * for its initial working directory. */ - dir: Option<&'self Path>, + dir: Option<&'a Path>, /** * If this is None then a new pipe will be created for the new process's @@ -83,7 +83,7 @@ pub struct ProcessOptions<'self> { err_fd: Option, } -impl <'self> ProcessOptions<'self> { +impl <'a> ProcessOptions<'a> { /// Return a ProcessOptions that has None in every field. pub fn new<'a>() -> ProcessOptions<'a> { ProcessOptions { diff --git a/src/libstd/select.rs b/src/libstd/select.rs index 01b953051db..cca64244db5 100644 --- a/src/libstd/select.rs +++ b/src/libstd/select.rs @@ -108,7 +108,7 @@ pub fn select(ports: &mut [A]) -> uint { /* FIXME(#5121, #7914) This all should be legal, but rust is not clever enough yet. -impl <'self> Select for &'self mut Select { +impl <'a> Select for &'a mut Select { fn optimistic_check(&mut self) -> bool { self.optimistic_check() } fn block_on(&mut self, sched: &mut Scheduler, task: BlockedTask) -> bool { self.block_on(sched, task) diff --git a/src/libstd/send_str.rs b/src/libstd/send_str.rs index 3ef99d48a03..b0bc4c3f467 100644 --- a/src/libstd/send_str.rs +++ b/src/libstd/send_str.rs @@ -107,7 +107,7 @@ impl TotalOrd for SendStr { } } -impl<'self, S: Str> Equiv for SendStr { +impl<'a, S: Str> Equiv for SendStr { #[inline] fn equiv(&self, other: &S) -> bool { self.as_slice().equals(&other.as_slice()) diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 0fbf9d92595..af381ef3cf0 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -182,7 +182,7 @@ impl FromStr for ~str { fn from_str(s: &str) -> Option<~str> { Some(s.to_owned()) } } -impl<'self> ToStr for &'self str { +impl<'a> ToStr for &'a str { #[inline] fn to_str(&self) -> ~str { self.to_owned() } } @@ -192,7 +192,7 @@ impl ToStr for @str { fn to_str(&self) -> ~str { self.to_owned() } } -impl<'self> FromStr for @str { +impl<'a> FromStr for @str { #[inline] fn from_str(s: &str) -> Option<@str> { Some(s.to_managed()) } } @@ -238,7 +238,7 @@ pub trait StrVector { fn connect(&self, sep: &str) -> ~str; } -impl<'self, S: Str> StrVector for &'self [S] { +impl<'a, S: Str> StrVector for &'a [S] { fn concat(&self) -> ~str { if self.is_empty() { return ~""; } @@ -294,7 +294,7 @@ impl CharEq for char { fn only_ascii(&self) -> bool { (*self as uint) < 128 } } -impl<'self> CharEq for 'self |char| -> bool { +impl<'a> CharEq for 'a |char| -> bool { #[inline] fn matches(&self, c: char) -> bool { (*self)(c) } @@ -308,7 +308,7 @@ impl CharEq for extern "Rust" fn(char) -> bool { fn only_ascii(&self) -> bool { false } } -impl<'self, C: CharEq> CharEq for &'self [C] { +impl<'a, C: CharEq> CharEq for &'a [C] { #[inline] fn matches(&self, c: char) -> bool { self.iter().any(|m| m.matches(c)) @@ -326,12 +326,12 @@ Section: Iterators /// External iterator for a string's characters. /// Use with the `std::iter` module. #[deriving(Clone)] -pub struct CharIterator<'self> { +pub struct CharIterator<'a> { /// The slice remaining to be iterated - priv string: &'self str, + priv string: &'a str, } -impl<'self> Iterator for CharIterator<'self> { +impl<'a> Iterator for CharIterator<'a> { #[inline] fn next(&mut self) -> Option { // Decode the next codepoint, then update @@ -353,7 +353,7 @@ impl<'self> Iterator for CharIterator<'self> { } } -impl<'self> DoubleEndedIterator for CharIterator<'self> { +impl<'a> DoubleEndedIterator for CharIterator<'a> { #[inline] fn next_back(&mut self) -> Option { if self.string.len() != 0 { @@ -371,13 +371,13 @@ impl<'self> DoubleEndedIterator for CharIterator<'self> { /// External iterator for a string's characters and their byte offsets. /// Use with the `std::iter` module. #[deriving(Clone)] -pub struct CharOffsetIterator<'self> { +pub struct CharOffsetIterator<'a> { /// The original string to be iterated - priv string: &'self str, - priv iter: CharIterator<'self>, + priv string: &'a str, + priv iter: CharIterator<'a>, } -impl<'self> Iterator<(uint, char)> for CharOffsetIterator<'self> { +impl<'a> Iterator<(uint, char)> for CharOffsetIterator<'a> { #[inline] fn next(&mut self) -> Option<(uint, char)> { // Compute the byte offset by using the pointer offset between @@ -396,7 +396,7 @@ impl<'self> Iterator<(uint, char)> for CharOffsetIterator<'self> { } } -impl<'self> DoubleEndedIterator<(uint, char)> for CharOffsetIterator<'self> { +impl<'a> DoubleEndedIterator<(uint, char)> for CharOffsetIterator<'a> { #[inline] fn next_back(&mut self) -> Option<(uint, char)> { self.iter.next_back().map(|ch| { @@ -412,26 +412,26 @@ impl<'self> DoubleEndedIterator<(uint, char)> for CharOffsetIterator<'self> { /// External iterator for a string's characters in reverse order. /// Use with the `std::iter` module. -pub type CharRevIterator<'self> = Invert>; +pub type CharRevIterator<'a> = Invert>; /// External iterator for a string's characters and their byte offsets in reverse order. /// Use with the `std::iter` module. -pub type CharOffsetRevIterator<'self> = Invert>; +pub type CharOffsetRevIterator<'a> = Invert>; /// External iterator for a string's bytes. /// Use with the `std::iter` module. -pub type ByteIterator<'self> = - Map<'self, &'self u8, u8, vec::VecIterator<'self, u8>>; +pub type ByteIterator<'a> = + Map<'a, &'a u8, u8, vec::VecIterator<'a, u8>>; /// External iterator for a string's bytes in reverse order. /// Use with the `std::iter` module. -pub type ByteRevIterator<'self> = Invert>; +pub type ByteRevIterator<'a> = Invert>; /// An iterator over the substrings of a string, separated by `sep`. #[deriving(Clone)] -pub struct CharSplitIterator<'self, Sep> { +pub struct CharSplitIterator<'a, Sep> { /// The slice remaining to be iterated - priv string: &'self str, + priv string: &'a str, priv sep: Sep, /// Whether an empty string at the end is allowed priv allow_trailing_empty: bool, @@ -441,29 +441,29 @@ pub struct CharSplitIterator<'self, Sep> { /// An iterator over the substrings of a string, separated by `sep`, /// starting from the back of the string. -pub type CharRSplitIterator<'self, Sep> = Invert>; +pub type CharRSplitIterator<'a, Sep> = Invert>; /// An iterator over the substrings of a string, separated by `sep`, /// splitting at most `count` times. #[deriving(Clone)] -pub struct CharSplitNIterator<'self, Sep> { - priv iter: CharSplitIterator<'self, Sep>, +pub struct CharSplitNIterator<'a, Sep> { + priv iter: CharSplitIterator<'a, Sep>, /// The number of splits remaining priv count: uint, priv invert: bool, } /// An iterator over the words of a string, separated by an sequence of whitespace -pub type WordIterator<'self> = - Filter<'self, &'self str, CharSplitIterator<'self, extern "Rust" fn(char) -> bool>>; +pub type WordIterator<'a> = + Filter<'a, &'a str, CharSplitIterator<'a, extern "Rust" fn(char) -> bool>>; /// An iterator over the lines of a string, separated by either `\n` or (`\r\n`). -pub type AnyLineIterator<'self> = - Map<'self, &'self str, &'self str, CharSplitIterator<'self, char>>; +pub type AnyLineIterator<'a> = + Map<'a, &'a str, &'a str, CharSplitIterator<'a, char>>; -impl<'self, Sep> CharSplitIterator<'self, Sep> { +impl<'a, Sep> CharSplitIterator<'a, Sep> { #[inline] - fn get_end(&mut self) -> Option<&'self str> { + fn get_end(&mut self) -> Option<&'a str> { if !self.finished && (self.allow_trailing_empty || self.string.len() > 0) { self.finished = true; Some(self.string) @@ -473,9 +473,9 @@ impl<'self, Sep> CharSplitIterator<'self, Sep> { } } -impl<'self, Sep: CharEq> Iterator<&'self str> for CharSplitIterator<'self, Sep> { +impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitIterator<'a, Sep> { #[inline] - fn next(&mut self) -> Option<&'self str> { + fn next(&mut self) -> Option<&'a str> { if self.finished { return None } let mut next_split = None; @@ -505,10 +505,10 @@ impl<'self, Sep: CharEq> Iterator<&'self str> for CharSplitIterator<'self, Sep> } } -impl<'self, Sep: CharEq> DoubleEndedIterator<&'self str> -for CharSplitIterator<'self, Sep> { +impl<'a, Sep: CharEq> DoubleEndedIterator<&'a str> +for CharSplitIterator<'a, Sep> { #[inline] - fn next_back(&mut self) -> Option<&'self str> { + fn next_back(&mut self) -> Option<&'a str> { if self.finished { return None } if !self.allow_trailing_empty { @@ -547,9 +547,9 @@ for CharSplitIterator<'self, Sep> { } } -impl<'self, Sep: CharEq> Iterator<&'self str> for CharSplitNIterator<'self, Sep> { +impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitNIterator<'a, Sep> { #[inline] - fn next(&mut self) -> Option<&'self str> { + fn next(&mut self) -> Option<&'a str> { if self.count != 0 { self.count -= 1; if self.invert { self.iter.next_back() } else { self.iter.next() } @@ -562,22 +562,22 @@ impl<'self, Sep: CharEq> Iterator<&'self str> for CharSplitNIterator<'self, Sep> /// An iterator over the start and end indices of the matches of a /// substring within a larger string #[deriving(Clone)] -pub struct MatchesIndexIterator<'self> { - priv haystack: &'self str, - priv needle: &'self str, +pub struct MatchesIndexIterator<'a> { + priv haystack: &'a str, + priv needle: &'a str, priv position: uint, } /// An iterator over the substrings of a string separated by a given /// search string #[deriving(Clone)] -pub struct StrSplitIterator<'self> { - priv it: MatchesIndexIterator<'self>, +pub struct StrSplitIterator<'a> { + priv it: MatchesIndexIterator<'a>, priv last_end: uint, priv finished: bool } -impl<'self> Iterator<(uint, uint)> for MatchesIndexIterator<'self> { +impl<'a> Iterator<(uint, uint)> for MatchesIndexIterator<'a> { #[inline] fn next(&mut self) -> Option<(uint, uint)> { // See Issue #1932 for why this is a naive search @@ -608,9 +608,9 @@ impl<'self> Iterator<(uint, uint)> for MatchesIndexIterator<'self> { } } -impl<'self> Iterator<&'self str> for StrSplitIterator<'self> { +impl<'a> Iterator<&'a str> for StrSplitIterator<'a> { #[inline] - fn next(&mut self) -> Option<&'self str> { + fn next(&mut self) -> Option<&'a str> { if self.finished { return None; } match self.it.next() { @@ -656,14 +656,14 @@ enum NormalizationForm { /// External iterator for a string's normalization's characters. /// Use with the `std::iter` module. #[deriving(Clone)] -struct NormalizationIterator<'self> { +struct NormalizationIterator<'a> { priv kind: NormalizationForm, - priv iter: CharIterator<'self>, + priv iter: CharIterator<'a>, priv buffer: ~[(char, u8)], priv sorted: bool } -impl<'self> Iterator for NormalizationIterator<'self> { +impl<'a> Iterator for NormalizationIterator<'a> { #[inline] fn next(&mut self) -> Option { use unicode::decompose::canonical_combining_class; @@ -1168,18 +1168,18 @@ pub mod traits { use super::{Str, eq_slice}; use option::{Some, None}; - impl<'self> Add<&'self str,~str> for &'self str { + impl<'a> Add<&'a str,~str> for &'a str { #[inline] - fn add(&self, rhs: & &'self str) -> ~str { + fn add(&self, rhs: & &'a str) -> ~str { let mut ret = self.to_owned(); ret.push_str(*rhs); ret } } - impl<'self> TotalOrd for &'self str { + impl<'a> TotalOrd for &'a str { #[inline] - fn cmp(&self, other: & &'self str) -> Ordering { + fn cmp(&self, other: & &'a str) -> Ordering { for (s_b, o_b) in self.bytes().zip(other.bytes()) { match s_b.cmp(&o_b) { Greater => return Greater, @@ -1202,13 +1202,13 @@ pub mod traits { fn cmp(&self, other: &@str) -> Ordering { self.as_slice().cmp(&other.as_slice()) } } - impl<'self> Eq for &'self str { + impl<'a> Eq for &'a str { #[inline] - fn eq(&self, other: & &'self str) -> bool { + fn eq(&self, other: & &'a str) -> bool { eq_slice((*self), (*other)) } #[inline] - fn ne(&self, other: & &'self str) -> bool { !(*self).eq(other) } + fn ne(&self, other: & &'a str) -> bool { !(*self).eq(other) } } impl Eq for ~str { @@ -1225,9 +1225,9 @@ pub mod traits { } } - impl<'self> TotalEq for &'self str { + impl<'a> TotalEq for &'a str { #[inline] - fn equals(&self, other: & &'self str) -> bool { + fn equals(&self, other: & &'a str) -> bool { eq_slice((*self), (*other)) } } @@ -1246,9 +1246,9 @@ pub mod traits { } } - impl<'self> Ord for &'self str { + impl<'a> Ord for &'a str { #[inline] - fn lt(&self, other: & &'self str) -> bool { self.cmp(other) == Less } + fn lt(&self, other: & &'a str) -> bool { self.cmp(other) == Less } } impl Ord for ~str { @@ -1261,17 +1261,17 @@ pub mod traits { fn lt(&self, other: &@str) -> bool { self.cmp(other) == Less } } - impl<'self, S: Str> Equiv for &'self str { + impl<'a, S: Str> Equiv for &'a str { #[inline] fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) } } - impl<'self, S: Str> Equiv for @str { + impl<'a, S: Str> Equiv for @str { #[inline] fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) } } - impl<'self, S: Str> Equiv for ~str { + impl<'a, S: Str> Equiv for ~str { #[inline] fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) } } @@ -1289,7 +1289,7 @@ pub trait Str { fn into_owned(self) -> ~str; } -impl<'self> Str for &'self str { +impl<'a> Str for &'a str { #[inline] fn as_slice<'a>(&'a self) -> &'a str { *self } @@ -1297,7 +1297,7 @@ impl<'self> Str for &'self str { fn into_owned(self) -> ~str { self.to_owned() } } -impl<'self> Str for ~str { +impl<'a> Str for ~str { #[inline] fn as_slice<'a>(&'a self) -> &'a str { let s: &'a str = *self; s @@ -1307,7 +1307,7 @@ impl<'self> Str for ~str { fn into_owned(self) -> ~str { self } } -impl<'self> Str for @str { +impl<'a> Str for @str { #[inline] fn as_slice<'a>(&'a self) -> &'a str { let s: &'a str = *self; s @@ -1317,7 +1317,7 @@ impl<'self> Str for @str { fn into_owned(self) -> ~str { self.to_owned() } } -impl<'self> Container for &'self str { +impl<'a> Container for &'a str { #[inline] fn len(&self) -> uint { self.as_imm_buf(|_p, n| n) @@ -1345,7 +1345,7 @@ impl Mutable for ~str { } /// Methods for string slices -pub trait StrSlice<'self> { +pub trait StrSlice<'a> { /// Returns true if one string contains another /// /// # Arguments @@ -1369,23 +1369,23 @@ pub trait StrSlice<'self> { /// let v: ~[char] = "abc åäö".chars().collect(); /// assert_eq!(v, ~['a', 'b', 'c', ' ', 'å', 'ä', 'ö']); /// ``` - fn chars(&self) -> CharIterator<'self>; + fn chars(&self) -> CharIterator<'a>; /// An iterator over the characters of `self`, in reverse order. - fn chars_rev(&self) -> CharRevIterator<'self>; + fn chars_rev(&self) -> CharRevIterator<'a>; /// An iterator over the bytes of `self` - fn bytes(&self) -> ByteIterator<'self>; + fn bytes(&self) -> ByteIterator<'a>; /// An iterator over the bytes of `self`, in reverse order - fn bytes_rev(&self) -> ByteRevIterator<'self>; + fn bytes_rev(&self) -> ByteRevIterator<'a>; /// An iterator over the characters of `self` and their byte offsets. - fn char_indices(&self) -> CharOffsetIterator<'self>; + fn char_indices(&self) -> CharOffsetIterator<'a>; /// An iterator over the characters of `self` and their byte offsets, /// in reverse order. - fn char_indices_rev(&self) -> CharOffsetRevIterator<'self>; + fn char_indices_rev(&self) -> CharOffsetRevIterator<'a>; /// An iterator over substrings of `self`, separated by characters /// matched by `sep`. @@ -1402,7 +1402,7 @@ pub trait StrSlice<'self> { /// let v: ~[&str] = "lionXXtigerXleopard".split('X').collect(); /// assert_eq!(v, ~["lion", "", "tiger", "leopard"]); /// ``` - fn split(&self, sep: Sep) -> CharSplitIterator<'self, Sep>; + fn split(&self, sep: Sep) -> CharSplitIterator<'a, Sep>; /// An iterator over substrings of `self`, separated by characters /// matched by `sep`, restricted to splitting at most `count` @@ -1420,7 +1420,7 @@ pub trait StrSlice<'self> { /// let v: ~[&str] = "lionXXtigerXleopard".splitn('X', 2).collect(); /// assert_eq!(v, ~["lion", "", "tigerXleopard"]); /// ``` - fn splitn(&self, sep: Sep, count: uint) -> CharSplitNIterator<'self, Sep>; + fn splitn(&self, sep: Sep, count: uint) -> CharSplitNIterator<'a, Sep>; /// An iterator over substrings of `self`, separated by characters /// matched by `sep`. @@ -1437,7 +1437,7 @@ pub trait StrSlice<'self> { /// let v: ~[&str] = "A..B..".split_terminator('.').collect(); /// assert_eq!(v, ~["A", "", "B", ""]); /// ``` - fn split_terminator(&self, sep: Sep) -> CharSplitIterator<'self, Sep>; + fn split_terminator(&self, sep: Sep) -> CharSplitIterator<'a, Sep>; /// An iterator over substrings of `self`, separated by characters /// matched by `sep`, in reverse order. @@ -1454,7 +1454,7 @@ pub trait StrSlice<'self> { /// let v: ~[&str] = "lionXXtigerXleopard".rsplit('X').collect(); /// assert_eq!(v, ~["leopard", "tiger", "", "lion"]); /// ``` - fn rsplit(&self, sep: Sep) -> CharRSplitIterator<'self, Sep>; + fn rsplit(&self, sep: Sep) -> CharRSplitIterator<'a, Sep>; /// An iterator over substrings of `self`, separated by characters /// matched by `sep`, starting from the end of the string. @@ -1472,7 +1472,7 @@ pub trait StrSlice<'self> { /// let v: ~[&str] = "lionXXtigerXleopard".rsplitn('X', 2).collect(); /// assert_eq!(v, ~["leopard", "tiger", "lionX"]); /// ``` - fn rsplitn(&self, sep: Sep, count: uint) -> CharSplitNIterator<'self, Sep>; + fn rsplitn(&self, sep: Sep, count: uint) -> CharSplitNIterator<'a, Sep>; /// An iterator over the start and end indices of the disjoint /// matches of `sep` within `self`. @@ -1494,7 +1494,7 @@ pub trait StrSlice<'self> { /// let v: ~[(uint, uint)] = "ababa".split_str("aba").collect(); /// assert_eq!(v, ~[(0, 3)]); // only the first `aba` /// ``` - fn match_indices(&self, sep: &'self str) -> MatchesIndexIterator<'self>; + fn match_indices(&self, sep: &'a str) -> MatchesIndexIterator<'a>; /// An iterator over the substrings of `self` separated by `sep`. /// @@ -1507,7 +1507,7 @@ pub trait StrSlice<'self> { /// let v: ~[&str] = "1abcabc2".split_str("abc").collect(); /// assert_eq!(v, ~["1", "", "2"]); /// ``` - fn split_str(&self, &'self str) -> StrSplitIterator<'self>; + fn split_str(&self, &'a str) -> StrSplitIterator<'a>; /// An iterator over the lines of a string (subsequences separated /// by `\n`). This does not include the empty string after a @@ -1520,7 +1520,7 @@ pub trait StrSlice<'self> { /// let v: ~[&str] = four_lines.lines().collect(); /// assert_eq!(v, ~["foo", "bar", "", "baz"]); /// ``` - fn lines(&self) -> CharSplitIterator<'self, char>; + fn lines(&self) -> CharSplitIterator<'a, char>; /// An iterator over the lines of a string, separated by either /// `\n` or `\r\n`. As with `.lines()`, this does not include an @@ -1533,7 +1533,7 @@ pub trait StrSlice<'self> { /// let v: ~[&str] = four_lines.lines_any().collect(); /// assert_eq!(v, ~["foo", "bar", "", "baz"]); /// ``` - fn lines_any(&self) -> AnyLineIterator<'self>; + fn lines_any(&self) -> AnyLineIterator<'a>; /// An iterator over the words of a string (subsequences separated /// by any sequence of whitespace). Sequences of whitespace are @@ -1546,15 +1546,15 @@ pub trait StrSlice<'self> { /// let v: ~[&str] = some_words.words().collect(); /// assert_eq!(v, ~["Mary", "had", "a", "little", "lamb"]); /// ``` - fn words(&self) -> WordIterator<'self>; + fn words(&self) -> WordIterator<'a>; /// An Iterator over the string in Unicode Normalization Form D /// (canonical decomposition). - fn nfd_chars(&self) -> NormalizationIterator<'self>; + fn nfd_chars(&self) -> NormalizationIterator<'a>; /// An Iterator over the string in Unicode Normalization Form KD /// (compatibility decomposition). - fn nfkd_chars(&self) -> NormalizationIterator<'self>; + fn nfkd_chars(&self) -> NormalizationIterator<'a>; /// Returns true if the string contains only whitespace. /// @@ -1647,7 +1647,7 @@ pub trait StrSlice<'self> { /// // byte 100 is outside the string /// // s.slice(3, 100); /// ``` - fn slice(&self, begin: uint, end: uint) -> &'self str; + fn slice(&self, begin: uint, end: uint) -> &'a str; /// Returns a slice of the string from `begin` to its end. /// @@ -1657,7 +1657,7 @@ pub trait StrSlice<'self> { /// out of bounds. /// /// See also `slice`, `slice_to` and `slice_chars`. - fn slice_from(&self, begin: uint) -> &'self str; + fn slice_from(&self, begin: uint) -> &'a str; /// Returns a slice of the string from the beginning to byte /// `end`. @@ -1668,7 +1668,7 @@ pub trait StrSlice<'self> { /// out of bounds. /// /// See also `slice`, `slice_from` and `slice_chars`. - fn slice_to(&self, end: uint) -> &'self str; + fn slice_to(&self, end: uint) -> &'a str; /// Returns a slice of the string from the character range /// [`begin`..`end`). @@ -1693,7 +1693,7 @@ pub trait StrSlice<'self> { /// assert_eq!(s.slice_chars(0, 4), "Löwe"); /// assert_eq!(s.slice_chars(6, 8), "老虎"); /// ``` - fn slice_chars(&self, begin: uint, end: uint) -> &'self str; + fn slice_chars(&self, begin: uint, end: uint) -> &'a str; /// Returns true if `needle` is a prefix of the string. fn starts_with(&self, needle: &str) -> bool; @@ -1708,13 +1708,13 @@ pub trait StrSlice<'self> { fn escape_unicode(&self) -> ~str; /// Returns a string with leading and trailing whitespace removed. - fn trim(&self) -> &'self str; + fn trim(&self) -> &'a str; /// Returns a string with leading whitespace removed. - fn trim_left(&self) -> &'self str; + fn trim_left(&self) -> &'a str; /// Returns a string with trailing whitespace removed. - fn trim_right(&self) -> &'self str; + fn trim_right(&self) -> &'a str; /// Returns a string with characters that match `to_trim` removed. /// @@ -1729,7 +1729,7 @@ pub trait StrSlice<'self> { /// assert_eq!("12foo1bar12".trim_chars(& &['1', '2']), "foo1bar") /// assert_eq!("123foo1bar123".trim_chars(&|c: char| c.is_digit()), "foo1bar") /// ``` - fn trim_chars(&self, to_trim: &C) -> &'self str; + fn trim_chars(&self, to_trim: &C) -> &'a str; /// Returns a string with leading `chars_to_trim` removed. /// @@ -1744,7 +1744,7 @@ pub trait StrSlice<'self> { /// assert_eq!("12foo1bar12".trim_left_chars(& &['1', '2']), "foo1bar12") /// assert_eq!("123foo1bar123".trim_left_chars(&|c: char| c.is_digit()), "foo1bar123") /// ``` - fn trim_left_chars(&self, to_trim: &C) -> &'self str; + fn trim_left_chars(&self, to_trim: &C) -> &'a str; /// Returns a string with trailing `chars_to_trim` removed. /// @@ -1759,7 +1759,7 @@ pub trait StrSlice<'self> { /// assert_eq!("12foo1bar12".trim_right_chars(& &['1', '2']), "12foo1bar") /// assert_eq!("123foo1bar123".trim_right_chars(&|c: char| c.is_digit()), "123foo1bar") /// ``` - fn trim_right_chars(&self, to_trim: &C) -> &'self str; + fn trim_right_chars(&self, to_trim: &C) -> &'a str; /// Replace all occurrences of one string with another. /// @@ -1891,7 +1891,7 @@ pub trait StrSlice<'self> { fn char_at_reverse(&self, i: uint) -> char; /// Work with the byte buffer of a string as a byte slice. - fn as_bytes(&self) -> &'self [u8]; + fn as_bytes(&self) -> &'a [u8]; /// Returns the byte index of the first character of `self` that /// matches `search`. @@ -1986,7 +1986,7 @@ pub trait StrSlice<'self> { /// assert_eq!(c, 'ö'); /// assert_eq!(s2, "we 老虎 Léopard"); /// ``` - fn slice_shift_char(&self) -> (char, &'self str); + fn slice_shift_char(&self) -> (char, &'a str); /// Levenshtein Distance between two strings. fn lev_distance(&self, t: &str) -> uint; @@ -2013,7 +2013,7 @@ pub trait StrSlice<'self> { fn as_imm_buf(&self, f: |*u8, uint| -> T) -> T; } -impl<'self> StrSlice<'self> for &'self str { +impl<'a> StrSlice<'a> for &'a str { #[inline] fn contains<'a>(&self, needle: &'a str) -> bool { self.find_str(needle).is_some() @@ -2025,37 +2025,37 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn chars(&self) -> CharIterator<'self> { + fn chars(&self) -> CharIterator<'a> { CharIterator{string: *self} } #[inline] - fn chars_rev(&self) -> CharRevIterator<'self> { + fn chars_rev(&self) -> CharRevIterator<'a> { self.chars().invert() } #[inline] - fn bytes(&self) -> ByteIterator<'self> { + fn bytes(&self) -> ByteIterator<'a> { self.as_bytes().iter().map(|&b| b) } #[inline] - fn bytes_rev(&self) -> ByteRevIterator<'self> { + fn bytes_rev(&self) -> ByteRevIterator<'a> { self.bytes().invert() } #[inline] - fn char_indices(&self) -> CharOffsetIterator<'self> { + fn char_indices(&self) -> CharOffsetIterator<'a> { CharOffsetIterator{string: *self, iter: self.chars()} } #[inline] - fn char_indices_rev(&self) -> CharOffsetRevIterator<'self> { + fn char_indices_rev(&self) -> CharOffsetRevIterator<'a> { self.char_indices().invert() } #[inline] - fn split(&self, sep: Sep) -> CharSplitIterator<'self, Sep> { + fn split(&self, sep: Sep) -> CharSplitIterator<'a, Sep> { CharSplitIterator { string: *self, only_ascii: sep.only_ascii(), @@ -2067,7 +2067,7 @@ impl<'self> StrSlice<'self> for &'self str { #[inline] fn splitn(&self, sep: Sep, count: uint) - -> CharSplitNIterator<'self, Sep> { + -> CharSplitNIterator<'a, Sep> { CharSplitNIterator { iter: self.split(sep), count: count, @@ -2077,7 +2077,7 @@ impl<'self> StrSlice<'self> for &'self str { #[inline] fn split_terminator(&self, sep: Sep) - -> CharSplitIterator<'self, Sep> { + -> CharSplitIterator<'a, Sep> { CharSplitIterator { allow_trailing_empty: false, ..self.split(sep) @@ -2085,13 +2085,13 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn rsplit(&self, sep: Sep) -> CharRSplitIterator<'self, Sep> { + fn rsplit(&self, sep: Sep) -> CharRSplitIterator<'a, Sep> { self.split(sep).invert() } #[inline] fn rsplitn(&self, sep: Sep, count: uint) - -> CharSplitNIterator<'self, Sep> { + -> CharSplitNIterator<'a, Sep> { CharSplitNIterator { iter: self.split(sep), count: count, @@ -2100,7 +2100,7 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn match_indices(&self, sep: &'self str) -> MatchesIndexIterator<'self> { + fn match_indices(&self, sep: &'a str) -> MatchesIndexIterator<'a> { assert!(!sep.is_empty()) MatchesIndexIterator { haystack: *self, @@ -2110,7 +2110,7 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn split_str(&self, sep: &'self str) -> StrSplitIterator<'self> { + fn split_str(&self, sep: &'a str) -> StrSplitIterator<'a> { StrSplitIterator { it: self.match_indices(sep), last_end: 0, @@ -2119,11 +2119,11 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn lines(&self) -> CharSplitIterator<'self, char> { + fn lines(&self) -> CharSplitIterator<'a, char> { self.split_terminator('\n') } - fn lines_any(&self) -> AnyLineIterator<'self> { + fn lines_any(&self) -> AnyLineIterator<'a> { self.lines().map(|line| { let l = line.len(); if l > 0 && line[l - 1] == '\r' as u8 { line.slice(0, l - 1) } @@ -2132,12 +2132,12 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn words(&self) -> WordIterator<'self> { + fn words(&self) -> WordIterator<'a> { self.split(char::is_whitespace).filter(|s| !s.is_empty()) } #[inline] - fn nfd_chars(&self) -> NormalizationIterator<'self> { + fn nfd_chars(&self) -> NormalizationIterator<'a> { NormalizationIterator { iter: self.chars(), buffer: ~[], @@ -2147,7 +2147,7 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn nfkd_chars(&self) -> NormalizationIterator<'self> { + fn nfkd_chars(&self) -> NormalizationIterator<'a> { NormalizationIterator { iter: self.chars(), buffer: ~[], @@ -2166,23 +2166,23 @@ impl<'self> StrSlice<'self> for &'self str { fn char_len(&self) -> uint { self.chars().len() } #[inline] - fn slice(&self, begin: uint, end: uint) -> &'self str { + fn slice(&self, begin: uint, end: uint) -> &'a str { assert!(self.is_char_boundary(begin) && self.is_char_boundary(end)); unsafe { raw::slice_bytes(*self, begin, end) } } #[inline] - fn slice_from(&self, begin: uint) -> &'self str { + fn slice_from(&self, begin: uint) -> &'a str { self.slice(begin, self.len()) } #[inline] - fn slice_to(&self, end: uint) -> &'self str { + fn slice_to(&self, end: uint) -> &'a str { assert!(self.is_char_boundary(end)); unsafe { raw::slice_bytes(*self, 0, end) } } - fn slice_chars(&self, begin: uint, end: uint) -> &'self str { + fn slice_chars(&self, begin: uint, end: uint) -> &'a str { assert!(begin <= end); let mut count = 0; let mut begin_byte = None; @@ -2236,27 +2236,27 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn trim(&self) -> &'self str { + fn trim(&self) -> &'a str { self.trim_left().trim_right() } #[inline] - fn trim_left(&self) -> &'self str { + fn trim_left(&self) -> &'a str { self.trim_left_chars(&char::is_whitespace) } #[inline] - fn trim_right(&self) -> &'self str { + fn trim_right(&self) -> &'a str { self.trim_right_chars(&char::is_whitespace) } #[inline] - fn trim_chars(&self, to_trim: &C) -> &'self str { + fn trim_chars(&self, to_trim: &C) -> &'a str { self.trim_left_chars(to_trim).trim_right_chars(to_trim) } #[inline] - fn trim_left_chars(&self, to_trim: &C) -> &'self str { + fn trim_left_chars(&self, to_trim: &C) -> &'a str { match self.find(|c: char| !to_trim.matches(c)) { None => "", Some(first) => unsafe { raw::slice_bytes(*self, first, self.len()) } @@ -2264,7 +2264,7 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn trim_right_chars(&self, to_trim: &C) -> &'self str { + fn trim_right_chars(&self, to_trim: &C) -> &'a str { match self.rfind(|c: char| !to_trim.matches(c)) { None => "", Some(last) => { @@ -2408,7 +2408,7 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn as_bytes(&self) -> &'self [u8] { + fn as_bytes(&self) -> &'a [u8] { unsafe { cast::transmute(*self) } } @@ -2453,7 +2453,7 @@ impl<'self> StrSlice<'self> for &'self str { } #[inline] - fn slice_shift_char(&self) -> (char, &'self str) { + fn slice_shift_char(&self) -> (char, &'a str) { let CharRange {ch, next} = self.char_range_at(0u); let next_s = unsafe { raw::slice_bytes(*self, next, self.len()) }; return (ch, next_s); @@ -2756,8 +2756,8 @@ impl Extendable for ~str { } // This works because every lifetime is a sub-lifetime of 'static -impl<'self> Default for &'self str { - fn default() -> &'self str { "" } +impl<'a> Default for &'a str { + fn default() -> &'a str { "" } } impl Default for ~str { diff --git a/src/libstd/to_bytes.rs b/src/libstd/to_bytes.rs index d81fe0c2fbd..815320be94e 100644 --- a/src/libstd/to_bytes.rs +++ b/src/libstd/to_bytes.rs @@ -22,7 +22,7 @@ use rc::Rc; use str::{Str, StrSlice}; use vec::{Vector, ImmutableVector}; -pub type Cb<'self> = 'self |buf: &[u8]| -> bool; +pub type Cb<'a> = 'a |buf: &[u8]| -> bool; /// /// A trait to implement in order to make a type hashable; @@ -219,7 +219,7 @@ impl IterBytes for f64 { } } -impl<'self,A:IterBytes> IterBytes for &'self [A] { +impl<'a,A:IterBytes> IterBytes for &'a [A] { #[inline] fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool { self.len().iter_bytes(lsb0, |b| f(b)) && @@ -273,7 +273,7 @@ impl IterBytes for @[A] { } } -impl<'self> IterBytes for &'self str { +impl<'a> IterBytes for &'a str { #[inline] fn iter_bytes(&self, _lsb0: bool, f: Cb) -> bool { // Terminate the string with a byte that does not appear in UTF-8 @@ -305,7 +305,7 @@ impl IterBytes for Option { } } -impl<'self,A:IterBytes> IterBytes for &'self A { +impl<'a,A:IterBytes> IterBytes for &'a A { #[inline] fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool { (**self).iter_bytes(lsb0, f) diff --git a/src/libstd/to_str.rs b/src/libstd/to_str.rs index 554b9a85100..41c8aef18f4 100644 --- a/src/libstd/to_str.rs +++ b/src/libstd/to_str.rs @@ -121,7 +121,7 @@ impl ToStr for (A, B, C) { } } -impl<'self,A:ToStr> ToStr for &'self [A] { +impl<'a,A:ToStr> ToStr for &'a [A] { #[inline] fn to_str(&self) -> ~str { let mut acc = ~"["; diff --git a/src/libstd/trie.rs b/src/libstd/trie.rs index 97209e99bd6..09dd091d0e7 100644 --- a/src/libstd/trie.rs +++ b/src/libstd/trie.rs @@ -443,14 +443,14 @@ fn remove(count: &mut uint, child: &mut Child, key: uint, } /// Forward iterator over a map -pub struct TrieMapIterator<'self, T> { - priv stack: ~[vec::VecIterator<'self, Child>], +pub struct TrieMapIterator<'a, T> { + priv stack: ~[vec::VecIterator<'a, Child>], priv remaining_min: uint, priv remaining_max: uint } -impl<'self, T> Iterator<(uint, &'self T)> for TrieMapIterator<'self, T> { - fn next(&mut self) -> Option<(uint, &'self T)> { +impl<'a, T> Iterator<(uint, &'a T)> for TrieMapIterator<'a, T> { + fn next(&mut self) -> Option<(uint, &'a T)> { while !self.stack.is_empty() { match self.stack[self.stack.len() - 1].next() { None => { @@ -483,11 +483,11 @@ impl<'self, T> Iterator<(uint, &'self T)> for TrieMapIterator<'self, T> { } /// Forward iterator over a set -pub struct TrieSetIterator<'self> { - priv iter: TrieMapIterator<'self, ()> +pub struct TrieSetIterator<'a> { + priv iter: TrieMapIterator<'a, ()> } -impl<'self> Iterator for TrieSetIterator<'self> { +impl<'a> Iterator for TrieSetIterator<'a> { fn next(&mut self) -> Option { self.iter.next().map(|(key, _)| key) } diff --git a/src/libstd/unstable/dynamic_lib.rs b/src/libstd/unstable/dynamic_lib.rs index 42a696eaf7e..03b25fbd044 100644 --- a/src/libstd/unstable/dynamic_lib.rs +++ b/src/libstd/unstable/dynamic_lib.rs @@ -62,7 +62,7 @@ impl DynamicLibrary { /// Access the value at the symbol of the dynamic library pub unsafe fn symbol(&self, symbol: &str) -> Result { - // This function should have a lifetime constraint of 'self on + // This function should have a lifetime constraint of 'a on // T but that feature is still unimplemented let maybe_symbol_value = dl::check_for_errors_in(|| { diff --git a/src/libstd/unstable/finally.rs b/src/libstd/unstable/finally.rs index 57aff6031ba..6f92da5e93e 100644 --- a/src/libstd/unstable/finally.rs +++ b/src/libstd/unstable/finally.rs @@ -44,7 +44,7 @@ macro_rules! finally_fn { } } -impl<'self,T> Finally for 'self || -> T { +impl<'a,T> Finally for 'a || -> T { fn finally(&self, dtor: ||) -> T { let _d = Finallyalizer { dtor: dtor @@ -56,12 +56,12 @@ impl<'self,T> Finally for 'self || -> T { finally_fn!(extern "Rust" fn() -> T) -struct Finallyalizer<'self> { - dtor: 'self || +struct Finallyalizer<'a> { + dtor: 'a || } #[unsafe_destructor] -impl<'self> Drop for Finallyalizer<'self> { +impl<'a> Drop for Finallyalizer<'a> { fn drop(&mut self) { (self.dtor)(); } diff --git a/src/libstd/unstable/raw.rs b/src/libstd/unstable/raw.rs index 4ad4656af7b..64a9a7c672a 100644 --- a/src/libstd/unstable/raw.rs +++ b/src/libstd/unstable/raw.rs @@ -53,8 +53,8 @@ pub trait Repr { fn repr(&self) -> T { unsafe { cast::transmute_copy(self) } } } -impl<'self, T> Repr> for &'self [T] {} -impl<'self> Repr> for &'self str {} +impl<'a, T> Repr> for &'a [T] {} +impl<'a> Repr> for &'a str {} impl Repr<*Box> for @T {} impl Repr<*Box>> for @[T] {} impl Repr<*String> for ~str {} diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 621a0be60b3..78ed58ba356 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -219,16 +219,16 @@ pub fn build(size: Option, builder: |push: |v: A||) -> ~[A] { /// An iterator over the slices of a vector separated by elements that /// match a predicate function. -pub struct SplitIterator<'self, T> { - priv v: &'self [T], +pub struct SplitIterator<'a, T> { + priv v: &'a [T], priv n: uint, - priv pred: 'self |t: &T| -> bool, + priv pred: 'a |t: &T| -> bool, priv finished: bool } -impl<'self, T> Iterator<&'self [T]> for SplitIterator<'self, T> { +impl<'a, T> Iterator<&'a [T]> for SplitIterator<'a, T> { #[inline] - fn next(&mut self) -> Option<&'self [T]> { + fn next(&mut self) -> Option<&'a [T]> { if self.finished { return None; } if self.n == 0 { @@ -268,16 +268,16 @@ impl<'self, T> Iterator<&'self [T]> for SplitIterator<'self, T> { /// An iterator over the slices of a vector separated by elements that /// match a predicate function, from back to front. -pub struct RSplitIterator<'self, T> { - priv v: &'self [T], +pub struct RSplitIterator<'a, T> { + priv v: &'a [T], priv n: uint, - priv pred: 'self |t: &T| -> bool, + priv pred: 'a |t: &T| -> bool, priv finished: bool } -impl<'self, T> Iterator<&'self [T]> for RSplitIterator<'self, T> { +impl<'a, T> Iterator<&'a [T]> for RSplitIterator<'a, T> { #[inline] - fn next(&mut self) -> Option<&'self [T]> { + fn next(&mut self) -> Option<&'a [T]> { if self.finished { return None; } if self.n == 0 { @@ -355,7 +355,7 @@ pub trait VectorVector { fn connect_vec(&self, sep: &T) -> ~[T]; } -impl<'self, T: Clone, V: Vector> VectorVector for &'self [V] { +impl<'a, T: Clone, V: Vector> VectorVector for &'a [V] { fn concat_vec(&self) -> ~[T] { let size = self.iter().fold(0u, |acc, v| acc + v.as_slice().len()); let mut result = with_capacity(size); @@ -503,14 +503,14 @@ impl Iterator<~[T]> for Permutations { /// An iterator over the (overlapping) slices of length `size` within /// a vector. #[deriving(Clone)] -pub struct WindowIter<'self, T> { - priv v: &'self [T], +pub struct WindowIter<'a, T> { + priv v: &'a [T], priv size: uint } -impl<'self, T> Iterator<&'self [T]> for WindowIter<'self, T> { +impl<'a, T> Iterator<&'a [T]> for WindowIter<'a, T> { #[inline] - fn next(&mut self) -> Option<&'self [T]> { + fn next(&mut self) -> Option<&'a [T]> { if self.size > self.v.len() { None } else { @@ -537,14 +537,14 @@ impl<'self, T> Iterator<&'self [T]> for WindowIter<'self, T> { /// When the vector len is not evenly divided by the chunk size, /// the last slice of the iteration will be the remainder. #[deriving(Clone)] -pub struct ChunkIter<'self, T> { - priv v: &'self [T], +pub struct ChunkIter<'a, T> { + priv v: &'a [T], priv size: uint } -impl<'self, T> Iterator<&'self [T]> for ChunkIter<'self, T> { +impl<'a, T> Iterator<&'a [T]> for ChunkIter<'a, T> { #[inline] - fn next(&mut self) -> Option<&'self [T]> { + fn next(&mut self) -> Option<&'a [T]> { if self.v.len() == 0 { None } else { @@ -568,9 +568,9 @@ impl<'self, T> Iterator<&'self [T]> for ChunkIter<'self, T> { } } -impl<'self, T> DoubleEndedIterator<&'self [T]> for ChunkIter<'self, T> { +impl<'a, T> DoubleEndedIterator<&'a [T]> for ChunkIter<'a, T> { #[inline] - fn next_back(&mut self) -> Option<&'self [T]> { + fn next_back(&mut self) -> Option<&'a [T]> { if self.v.len() == 0 { None } else { @@ -584,14 +584,14 @@ impl<'self, T> DoubleEndedIterator<&'self [T]> for ChunkIter<'self, T> { } } -impl<'self, T> RandomAccessIterator<&'self [T]> for ChunkIter<'self, T> { +impl<'a, T> RandomAccessIterator<&'a [T]> for ChunkIter<'a, T> { #[inline] fn indexable(&self) -> uint { self.v.len()/self.size + if self.v.len() % self.size != 0 { 1 } else { 0 } } #[inline] - fn idx(&self, index: uint) -> Option<&'self [T]> { + fn idx(&self, index: uint) -> Option<&'a [T]> { if index < self.indexable() { let lo = index * self.size; let mut hi = lo + self.size; @@ -616,12 +616,12 @@ pub mod traits { use iter::order; use ops::Add; - impl<'self,T:Eq> Eq for &'self [T] { - fn eq(&self, other: & &'self [T]) -> bool { + impl<'a,T:Eq> Eq for &'a [T] { + fn eq(&self, other: & &'a [T]) -> bool { self.len() == other.len() && order::eq(self.iter(), other.iter()) } - fn ne(&self, other: & &'self [T]) -> bool { + fn ne(&self, other: & &'a [T]) -> bool { self.len() != other.len() || order::ne(self.iter(), other.iter()) } @@ -641,8 +641,8 @@ pub mod traits { fn ne(&self, other: &@[T]) -> bool { !self.eq(other) } } - impl<'self,T:TotalEq> TotalEq for &'self [T] { - fn equals(&self, other: & &'self [T]) -> bool { + impl<'a,T:TotalEq> TotalEq for &'a [T] { + fn equals(&self, other: & &'a [T]) -> bool { self.len() == other.len() && order::equals(self.iter(), other.iter()) } @@ -658,23 +658,23 @@ pub mod traits { fn equals(&self, other: &@[T]) -> bool { self.as_slice().equals(&other.as_slice()) } } - impl<'self,T:Eq, V: Vector> Equiv for &'self [T] { + impl<'a,T:Eq, V: Vector> Equiv for &'a [T] { #[inline] fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } } - impl<'self,T:Eq, V: Vector> Equiv for ~[T] { + impl<'a,T:Eq, V: Vector> Equiv for ~[T] { #[inline] fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } } - impl<'self,T:Eq, V: Vector> Equiv for @[T] { + impl<'a,T:Eq, V: Vector> Equiv for @[T] { #[inline] fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } } - impl<'self,T:TotalOrd> TotalOrd for &'self [T] { - fn cmp(&self, other: & &'self [T]) -> Ordering { + impl<'a,T:TotalOrd> TotalOrd for &'a [T] { + fn cmp(&self, other: & &'a [T]) -> Ordering { order::cmp(self.iter(), other.iter()) } } @@ -689,20 +689,20 @@ pub mod traits { fn cmp(&self, other: &@[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) } } - impl<'self, T: Eq + Ord> Ord for &'self [T] { - fn lt(&self, other: & &'self [T]) -> bool { + impl<'a, T: Eq + Ord> Ord for &'a [T] { + fn lt(&self, other: & &'a [T]) -> bool { order::lt(self.iter(), other.iter()) } #[inline] - fn le(&self, other: & &'self [T]) -> bool { + fn le(&self, other: & &'a [T]) -> bool { order::le(self.iter(), other.iter()) } #[inline] - fn ge(&self, other: & &'self [T]) -> bool { + fn ge(&self, other: & &'a [T]) -> bool { order::ge(self.iter(), other.iter()) } #[inline] - fn gt(&self, other: & &'self [T]) -> bool { + fn gt(&self, other: & &'a [T]) -> bool { order::gt(self.iter(), other.iter()) } } @@ -729,7 +729,7 @@ pub mod traits { fn gt(&self, other: &@[T]) -> bool { self.as_slice() > other.as_slice() } } - impl<'self,T:Clone, V: Vector> Add for &'self [T] { + impl<'a,T:Clone, V: Vector> Add for &'a [T] { #[inline] fn add(&self, rhs: &V) -> ~[T] { let mut res = with_capacity(self.len() + rhs.as_slice().len()); @@ -756,7 +756,7 @@ pub trait Vector { fn as_slice<'a>(&'a self) -> &'a [T]; } -impl<'self,T> Vector for &'self [T] { +impl<'a,T> Vector for &'a [T] { #[inline(always)] fn as_slice<'a>(&'a self) -> &'a [T] { *self } } @@ -771,7 +771,7 @@ impl Vector for @[T] { fn as_slice<'a>(&'a self) -> &'a [T] { let v: &'a [T] = *self; v } } -impl<'self, T> Container for &'self [T] { +impl<'a, T> Container for &'a [T] { /// Returns the length of a vector #[inline] fn len(&self) -> uint { @@ -797,7 +797,7 @@ pub trait CopyableVector { } /// Extension methods for vector slices -impl<'self, T: Clone> CopyableVector for &'self [T] { +impl<'a, T: Clone> CopyableVector for &'a [T] { /// Returns a copy of `v`. #[inline] fn to_owned(&self) -> ~[T] { @@ -831,52 +831,52 @@ impl CopyableVector for @[T] { } /// Extension methods for vectors -pub trait ImmutableVector<'self, T> { +pub trait ImmutableVector<'a, T> { /** * Returns a slice of self between `start` and `end`. * * Fails when `start` or `end` point outside the bounds of self, * or when `start` > `end`. */ - fn slice(&self, start: uint, end: uint) -> &'self [T]; + fn slice(&self, start: uint, end: uint) -> &'a [T]; /** * Returns a slice of self from `start` to the end of the vec. * * Fails when `start` points outside the bounds of self. */ - fn slice_from(&self, start: uint) -> &'self [T]; + fn slice_from(&self, start: uint) -> &'a [T]; /** * Returns a slice of self from the start of the vec to `end`. * * Fails when `end` points outside the bounds of self. */ - fn slice_to(&self, end: uint) -> &'self [T]; + fn slice_to(&self, end: uint) -> &'a [T]; /// Returns an iterator over the vector - fn iter(self) -> VecIterator<'self, T>; + fn iter(self) -> VecIterator<'a, T>; /// Returns a reversed iterator over a vector - fn rev_iter(self) -> RevIterator<'self, T>; + fn rev_iter(self) -> RevIterator<'a, T>; /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred`. The matched element /// is not contained in the subslices. - fn split(self, pred: 'self |&T| -> bool) -> SplitIterator<'self, T>; + fn split(self, pred: 'a |&T| -> bool) -> SplitIterator<'a, T>; /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred`, limited to splitting /// at most `n` times. The matched element is not contained in /// the subslices. - fn splitn(self, n: uint, pred: 'self |&T| -> bool) -> SplitIterator<'self, T>; + fn splitn(self, n: uint, pred: 'a |&T| -> bool) -> SplitIterator<'a, T>; /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred`. This starts at the /// end of the vector and works backwards. The matched element is /// not contained in the subslices. - fn rsplit(self, pred: 'self |&T| -> bool) -> RSplitIterator<'self, T>; + fn rsplit(self, pred: 'a |&T| -> bool) -> RSplitIterator<'a, T>; /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred` limited to splitting /// at most `n` times. This starts at the end of the vector and /// works backwards. The matched element is not contained in the /// subslices. - fn rsplitn(self, n: uint, pred: 'self |&T| -> bool) -> RSplitIterator<'self, T>; + fn rsplitn(self, n: uint, pred: 'a |&T| -> bool) -> RSplitIterator<'a, T>; /** * Returns an iterator over all contiguous windows of length @@ -900,7 +900,7 @@ pub trait ImmutableVector<'self, T> { * ``` * */ - fn windows(self, size: uint) -> WindowIter<'self, T>; + fn windows(self, size: uint) -> WindowIter<'a, T>; /** * * Returns an iterator over `size` elements of the vector at a @@ -925,27 +925,27 @@ pub trait ImmutableVector<'self, T> { * ``` * */ - fn chunks(self, size: uint) -> ChunkIter<'self, T>; + fn chunks(self, size: uint) -> ChunkIter<'a, T>; /// Returns the element of a vector at the given index, or `None` if the /// index is out of bounds - fn get_opt(&self, index: uint) -> Option<&'self T>; + fn get_opt(&self, index: uint) -> Option<&'a T>; /// Returns the first element of a vector, failing if the vector is empty. - fn head(&self) -> &'self T; + fn head(&self) -> &'a T; /// Returns the first element of a vector, or `None` if it is empty - fn head_opt(&self) -> Option<&'self T>; + fn head_opt(&self) -> Option<&'a T>; /// Returns all but the first element of a vector - fn tail(&self) -> &'self [T]; + fn tail(&self) -> &'a [T]; /// Returns all but the first `n' elements of a vector - fn tailn(&self, n: uint) -> &'self [T]; + fn tailn(&self, n: uint) -> &'a [T]; /// Returns all but the last element of a vector - fn init(&self) -> &'self [T]; + fn init(&self) -> &'a [T]; /// Returns all but the last `n' elemnts of a vector - fn initn(&self, n: uint) -> &'self [T]; + fn initn(&self, n: uint) -> &'a [T]; /// Returns the last element of a vector, failing if the vector is empty. - fn last(&self) -> &'self T; + fn last(&self) -> &'a T; /// Returns the last element of a vector, or `None` if it is empty. - fn last_opt(&self) -> Option<&'self T>; + fn last_opt(&self) -> Option<&'a T>; /** * Apply a function to each element of a vector and return a concatenation * of each result vector @@ -995,7 +995,7 @@ pub trait ImmutableVector<'self, T> { * * Fails if slice is empty. */ - fn shift_ref(&mut self) -> &'self T; + fn shift_ref(&mut self) -> &'a T; /** * Returns a mutable reference to the last element in this slice @@ -1012,12 +1012,12 @@ pub trait ImmutableVector<'self, T> { * * Fails if slice is empty. */ - fn pop_ref(&mut self) -> &'self T; + fn pop_ref(&mut self) -> &'a T; } -impl<'self,T> ImmutableVector<'self, T> for &'self [T] { +impl<'a,T> ImmutableVector<'a, T> for &'a [T] { #[inline] - fn slice(&self, start: uint, end: uint) -> &'self [T] { + fn slice(&self, start: uint, end: uint) -> &'a [T] { assert!(start <= end); assert!(end <= self.len()); self.as_imm_buf(|p, _len| { @@ -1031,17 +1031,17 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { } #[inline] - fn slice_from(&self, start: uint) -> &'self [T] { + fn slice_from(&self, start: uint) -> &'a [T] { self.slice(start, self.len()) } #[inline] - fn slice_to(&self, end: uint) -> &'self [T] { + fn slice_to(&self, end: uint) -> &'a [T] { self.slice(0, end) } #[inline] - fn iter(self) -> VecIterator<'self, T> { + fn iter(self) -> VecIterator<'a, T> { unsafe { let p = vec::raw::to_ptr(self); if mem::size_of::() == 0 { @@ -1057,17 +1057,17 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { } #[inline] - fn rev_iter(self) -> RevIterator<'self, T> { + fn rev_iter(self) -> RevIterator<'a, T> { self.iter().invert() } #[inline] - fn split(self, pred: 'self |&T| -> bool) -> SplitIterator<'self, T> { + fn split(self, pred: 'a |&T| -> bool) -> SplitIterator<'a, T> { self.splitn(uint::max_value, pred) } #[inline] - fn splitn(self, n: uint, pred: 'self |&T| -> bool) -> SplitIterator<'self, T> { + fn splitn(self, n: uint, pred: 'a |&T| -> bool) -> SplitIterator<'a, T> { SplitIterator { v: self, n: n, @@ -1077,12 +1077,12 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { } #[inline] - fn rsplit(self, pred: 'self |&T| -> bool) -> RSplitIterator<'self, T> { + fn rsplit(self, pred: 'a |&T| -> bool) -> RSplitIterator<'a, T> { self.rsplitn(uint::max_value, pred) } #[inline] - fn rsplitn(self, n: uint, pred: 'self |&T| -> bool) -> RSplitIterator<'self, T> { + fn rsplitn(self, n: uint, pred: 'a |&T| -> bool) -> RSplitIterator<'a, T> { RSplitIterator { v: self, n: n, @@ -1092,57 +1092,57 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { } #[inline] - fn windows(self, size: uint) -> WindowIter<'self, T> { + fn windows(self, size: uint) -> WindowIter<'a, T> { assert!(size != 0); WindowIter { v: self, size: size } } #[inline] - fn chunks(self, size: uint) -> ChunkIter<'self, T> { + fn chunks(self, size: uint) -> ChunkIter<'a, T> { assert!(size != 0); ChunkIter { v: self, size: size } } #[inline] - fn get_opt(&self, index: uint) -> Option<&'self T> { + fn get_opt(&self, index: uint) -> Option<&'a T> { if index < self.len() { Some(&self[index]) } else { None } } #[inline] - fn head(&self) -> &'self T { + fn head(&self) -> &'a T { if self.len() == 0 { fail!("head: empty vector") } &self[0] } #[inline] - fn head_opt(&self) -> Option<&'self T> { + fn head_opt(&self) -> Option<&'a T> { if self.len() == 0 { None } else { Some(&self[0]) } } #[inline] - fn tail(&self) -> &'self [T] { self.slice(1, self.len()) } + fn tail(&self) -> &'a [T] { self.slice(1, self.len()) } #[inline] - fn tailn(&self, n: uint) -> &'self [T] { self.slice(n, self.len()) } + fn tailn(&self, n: uint) -> &'a [T] { self.slice(n, self.len()) } #[inline] - fn init(&self) -> &'self [T] { + fn init(&self) -> &'a [T] { self.slice(0, self.len() - 1) } #[inline] - fn initn(&self, n: uint) -> &'self [T] { + fn initn(&self, n: uint) -> &'a [T] { self.slice(0, self.len() - n) } #[inline] - fn last(&self) -> &'self T { + fn last(&self) -> &'a T { if self.len() == 0 { fail!("last: empty vector") } &self[self.len() - 1] } #[inline] - fn last_opt(&self) -> Option<&'self T> { + fn last_opt(&self) -> Option<&'a T> { if self.len() == 0 { None } else { Some(&self[self.len() - 1]) } } @@ -1185,14 +1185,14 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { f(s.data, s.len) } - fn shift_ref(&mut self) -> &'self T { + fn shift_ref(&mut self) -> &'a T { unsafe { let s: &mut Slice = cast::transmute(self); &*raw::shift_ptr(s) } } - fn pop_ref(&mut self) -> &'self T { + fn pop_ref(&mut self) -> &'a T { unsafe { let s: &mut Slice = cast::transmute(self); &*raw::pop_ptr(s) @@ -1218,7 +1218,7 @@ pub trait ImmutableEqVector { fn ends_with(&self, needle: &[T]) -> bool; } -impl<'self,T:Eq> ImmutableEqVector for &'self [T] { +impl<'a,T:Eq> ImmutableEqVector for &'a [T] { #[inline] fn position_elem(&self, x: &T) -> Option { self.iter().position(|y| *x == *y) @@ -1257,7 +1257,7 @@ pub trait ImmutableTotalOrdVector { fn bsearch_elem(&self, x: &T) -> Option; } -impl<'self, T: TotalOrd> ImmutableTotalOrdVector for &'self [T] { +impl<'a, T: TotalOrd> ImmutableTotalOrdVector for &'a [T] { fn bsearch_elem(&self, x: &T) -> Option { self.bsearch(|p| p.cmp(x)) } @@ -1278,7 +1278,7 @@ pub trait ImmutableCopyableVector { fn permutations(self) -> Permutations; } -impl<'self,T:Clone> ImmutableCopyableVector for &'self [T] { +impl<'a,T:Clone> ImmutableCopyableVector for &'a [T] { #[inline] fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]) { let mut lefts = ~[]; @@ -1913,34 +1913,34 @@ impl OwnedEqVector for ~[T] { /// Extension methods for vectors such that their elements are /// mutable. -pub trait MutableVector<'self, T> { +pub trait MutableVector<'a, T> { /// Return a slice that points into another slice. - fn mut_slice(self, start: uint, end: uint) -> &'self mut [T]; + fn mut_slice(self, start: uint, end: uint) -> &'a mut [T]; /** * Returns a slice of self from `start` to the end of the vec. * * Fails when `start` points outside the bounds of self. */ - fn mut_slice_from(self, start: uint) -> &'self mut [T]; + fn mut_slice_from(self, start: uint) -> &'a mut [T]; /** * Returns a slice of self from the start of the vec to `end`. * * Fails when `end` points outside the bounds of self. */ - fn mut_slice_to(self, end: uint) -> &'self mut [T]; + fn mut_slice_to(self, end: uint) -> &'a mut [T]; /// Returns an iterator that allows modifying each value - fn mut_iter(self) -> VecMutIterator<'self, T>; + fn mut_iter(self) -> VecMutIterator<'a, T>; /// Returns a reversed iterator that allows modifying each value - fn mut_rev_iter(self) -> MutRevIterator<'self, T>; + fn mut_rev_iter(self) -> MutRevIterator<'a, T>; /// Returns an iterator over the mutable subslices of the vector /// which are separated by elements that match `pred`. The /// matched element is not contained in the subslices. - fn mut_split(self, pred: 'self |&T| -> bool) -> MutSplitIterator<'self, T>; + fn mut_split(self, pred: 'a |&T| -> bool) -> MutSplitIterator<'a, T>; /** * Returns an iterator over `size` elements of the vector at a time. @@ -1952,7 +1952,7 @@ pub trait MutableVector<'self, T> { * * Fails if `size` is 0. */ - fn mut_chunks(self, chunk_size: uint) -> MutChunkIter<'self, T>; + fn mut_chunks(self, chunk_size: uint) -> MutChunkIter<'a, T>; /** * Returns a mutable reference to the first element in this slice @@ -1969,7 +1969,7 @@ pub trait MutableVector<'self, T> { * * Fails if slice is empty. */ - fn mut_shift_ref(&mut self) -> &'self mut T; + fn mut_shift_ref(&mut self) -> &'a mut T; /** * Returns a mutable reference to the last element in this slice @@ -1986,7 +1986,7 @@ pub trait MutableVector<'self, T> { * * Fails if slice is empty. */ - fn mut_pop_ref(&mut self) -> &'self mut T; + fn mut_pop_ref(&mut self) -> &'a mut T; /** * Swaps two elements in a vector @@ -2004,8 +2004,8 @@ pub trait MutableVector<'self, T> { * itself) and the second will contain all indices from * `mid..len` (excluding the index `len` itself). */ - fn mut_split_at(self, mid: uint) -> (&'self mut [T], - &'self mut [T]); + fn mut_split_at(self, mid: uint) -> (&'a mut [T], + &'a mut [T]); /// Reverse the order of elements in a vector, in place fn reverse(self); @@ -2034,9 +2034,9 @@ pub trait MutableVector<'self, T> { fn as_mut_buf(self, f: |*mut T, uint| -> U) -> U; } -impl<'self,T> MutableVector<'self, T> for &'self mut [T] { +impl<'a,T> MutableVector<'a, T> for &'a mut [T] { #[inline] - fn mut_slice(self, start: uint, end: uint) -> &'self mut [T] { + fn mut_slice(self, start: uint, end: uint) -> &'a mut [T] { assert!(start <= end); assert!(end <= self.len()); self.as_mut_buf(|p, _len| { @@ -2050,27 +2050,27 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] { } #[inline] - fn mut_slice_from(self, start: uint) -> &'self mut [T] { + fn mut_slice_from(self, start: uint) -> &'a mut [T] { let len = self.len(); self.mut_slice(start, len) } #[inline] - fn mut_slice_to(self, end: uint) -> &'self mut [T] { + fn mut_slice_to(self, end: uint) -> &'a mut [T] { self.mut_slice(0, end) } #[inline] - fn mut_split_at(self, mid: uint) -> (&'self mut [T], &'self mut [T]) { + fn mut_split_at(self, mid: uint) -> (&'a mut [T], &'a mut [T]) { unsafe { let len = self.len(); - let self2: &'self mut [T] = cast::transmute_copy(&self); + let self2: &'a mut [T] = cast::transmute_copy(&self); (self.mut_slice(0, mid), self2.mut_slice(mid, len)) } } #[inline] - fn mut_iter(self) -> VecMutIterator<'self, T> { + fn mut_iter(self) -> VecMutIterator<'a, T> { unsafe { let p = vec::raw::to_mut_ptr(self); if mem::size_of::() == 0 { @@ -2086,30 +2086,30 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] { } #[inline] - fn mut_rev_iter(self) -> MutRevIterator<'self, T> { + fn mut_rev_iter(self) -> MutRevIterator<'a, T> { self.mut_iter().invert() } #[inline] - fn mut_split(self, pred: 'self |&T| -> bool) -> MutSplitIterator<'self, T> { + fn mut_split(self, pred: 'a |&T| -> bool) -> MutSplitIterator<'a, T> { MutSplitIterator { v: self, pred: pred, finished: false } } #[inline] - fn mut_chunks(self, chunk_size: uint) -> MutChunkIter<'self, T> { + fn mut_chunks(self, chunk_size: uint) -> MutChunkIter<'a, T> { assert!(chunk_size > 0); let len = self.len(); MutChunkIter { v: self, chunk_size: chunk_size, remaining: len } } - fn mut_shift_ref(&mut self) -> &'self mut T { + fn mut_shift_ref(&mut self) -> &'a mut T { unsafe { let s: &mut Slice = cast::transmute(self); cast::transmute_mut(&*raw::shift_ptr(s)) } } - fn mut_pop_ref(&mut self) -> &'self mut T { + fn mut_pop_ref(&mut self) -> &'a mut T { unsafe { let s: &mut Slice = cast::transmute(self); cast::transmute_mut(&*raw::pop_ptr(s)) @@ -2167,7 +2167,7 @@ pub trait MutableCloneableVector { fn copy_from(self, &[T]) -> uint; } -impl<'self, T:Clone> MutableCloneableVector for &'self mut [T] { +impl<'a, T:Clone> MutableCloneableVector for &'a mut [T] { #[inline] fn copy_from(self, src: &[T]) -> uint { for (a, b) in self.mut_iter().zip(src.iter()) { @@ -2368,7 +2368,7 @@ pub mod bytes { fn set_memory(self, value: u8); } - impl<'self> MutableByteVector for &'self mut [u8] { + impl<'a> MutableByteVector for &'a mut [u8] { #[inline] fn set_memory(self, value: u8) { self.as_mut_buf(|p, len| { @@ -2483,8 +2483,8 @@ impl DeepClone for ~[A] { } // This works because every lifetime is a sub-lifetime of 'static -impl<'self, A> Default for &'self [A] { - fn default() -> &'self [A] { &'self [] } +impl<'a, A> Default for &'a [A] { + fn default() -> &'a [A] { &'a [] } } impl Default for ~[A] { @@ -2498,13 +2498,13 @@ impl Default for @[A] { macro_rules! iterator { (struct $name:ident -> $ptr:ty, $elem:ty) => { /// An iterator for iterating over a vector. - pub struct $name<'self, T> { + pub struct $name<'a, T> { priv ptr: $ptr, priv end: $ptr, priv lifetime: Option<$elem> // FIXME: #5922 } - impl<'self, T> Iterator<$elem> for $name<'self, T> { + impl<'a, T> Iterator<$elem> for $name<'a, T> { #[inline] fn next(&mut self) -> Option<$elem> { // could be implemented with slices, but this avoids bounds checks @@ -2535,7 +2535,7 @@ macro_rules! iterator { } } - impl<'self, T> DoubleEndedIterator<$elem> for $name<'self, T> { + impl<'a, T> DoubleEndedIterator<$elem> for $name<'a, T> { #[inline] fn next_back(&mut self) -> Option<$elem> { // could be implemented with slices, but this avoids bounds checks @@ -2557,7 +2557,7 @@ macro_rules! iterator { } } -impl<'self, T> RandomAccessIterator<&'self T> for VecIterator<'self, T> { +impl<'a, T> RandomAccessIterator<&'a T> for VecIterator<'a, T> { #[inline] fn indexable(&self) -> uint { let (exact, _) = self.size_hint(); @@ -2565,7 +2565,7 @@ impl<'self, T> RandomAccessIterator<&'self T> for VecIterator<'self, T> { } #[inline] - fn idx(&self, index: uint) -> Option<&'self T> { + fn idx(&self, index: uint) -> Option<&'a T> { unsafe { if index < self.indexable() { cast::transmute(self.ptr.offset(index as int)) @@ -2576,30 +2576,30 @@ impl<'self, T> RandomAccessIterator<&'self T> for VecIterator<'self, T> { } } -iterator!{struct VecIterator -> *T, &'self T} -pub type RevIterator<'self, T> = Invert>; +iterator!{struct VecIterator -> *T, &'a T} +pub type RevIterator<'a, T> = Invert>; -impl<'self, T> ExactSize<&'self T> for VecIterator<'self, T> {} -impl<'self, T> ExactSize<&'self mut T> for VecMutIterator<'self, T> {} +impl<'a, T> ExactSize<&'a T> for VecIterator<'a, T> {} +impl<'a, T> ExactSize<&'a mut T> for VecMutIterator<'a, T> {} -impl<'self, T> Clone for VecIterator<'self, T> { - fn clone(&self) -> VecIterator<'self, T> { *self } +impl<'a, T> Clone for VecIterator<'a, T> { + fn clone(&self) -> VecIterator<'a, T> { *self } } -iterator!{struct VecMutIterator -> *mut T, &'self mut T} -pub type MutRevIterator<'self, T> = Invert>; +iterator!{struct VecMutIterator -> *mut T, &'a mut T} +pub type MutRevIterator<'a, T> = Invert>; /// An iterator over the subslices of the vector which are separated /// by elements that match `pred`. -pub struct MutSplitIterator<'self, T> { - priv v: &'self mut [T], - priv pred: 'self |t: &T| -> bool, +pub struct MutSplitIterator<'a, T> { + priv v: &'a mut [T], + priv pred: 'a |t: &T| -> bool, priv finished: bool } -impl<'self, T> Iterator<&'self mut [T]> for MutSplitIterator<'self, T> { +impl<'a, T> Iterator<&'a mut [T]> for MutSplitIterator<'a, T> { #[inline] - fn next(&mut self) -> Option<&'self mut [T]> { + fn next(&mut self) -> Option<&'a mut [T]> { if self.finished { return None; } match self.v.iter().position(|x| (self.pred)(x)) { @@ -2632,9 +2632,9 @@ impl<'self, T> Iterator<&'self mut [T]> for MutSplitIterator<'self, T> { } } -impl<'self, T> DoubleEndedIterator<&'self mut [T]> for MutSplitIterator<'self, T> { +impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutSplitIterator<'a, T> { #[inline] - fn next_back(&mut self) -> Option<&'self mut [T]> { + fn next_back(&mut self) -> Option<&'a mut [T]> { if self.finished { return None; } match self.v.iter().rposition(|x| (self.pred)(x)) { @@ -2659,15 +2659,15 @@ impl<'self, T> DoubleEndedIterator<&'self mut [T]> for MutSplitIterator<'self, T /// An iterator over a vector in (non-overlapping) mutable chunks (`size` elements at a time). When /// the vector len is not evenly divided by the chunk size, the last slice of the iteration will be /// the remainder. -pub struct MutChunkIter<'self, T> { - priv v: &'self mut [T], +pub struct MutChunkIter<'a, T> { + priv v: &'a mut [T], priv chunk_size: uint, priv remaining: uint } -impl<'self, T> Iterator<&'self mut [T]> for MutChunkIter<'self, T> { +impl<'a, T> Iterator<&'a mut [T]> for MutChunkIter<'a, T> { #[inline] - fn next(&mut self) -> Option<&'self mut [T]> { + fn next(&mut self) -> Option<&'a mut [T]> { if self.remaining == 0 { None } else { @@ -2692,9 +2692,9 @@ impl<'self, T> Iterator<&'self mut [T]> for MutChunkIter<'self, T> { } } -impl<'self, T> DoubleEndedIterator<&'self mut [T]> for MutChunkIter<'self, T> { +impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunkIter<'a, T> { #[inline] - fn next_back(&mut self) -> Option<&'self mut [T]> { + fn next_back(&mut self) -> Option<&'a mut [T]> { if self.remaining == 0 { None } else { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 11a55a4adbc..afbbb069354 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -390,13 +390,13 @@ pub trait IdVisitingOperation { fn visit_id(&self, node_id: NodeId); } -pub struct IdVisitor<'self, O> { - operation: &'self O, +pub struct IdVisitor<'a, O> { + operation: &'a O, pass_through_items: bool, visited_outermost: bool, } -impl<'self, O: IdVisitingOperation> IdVisitor<'self, O> { +impl<'a, O: IdVisitingOperation> IdVisitor<'a, O> { fn visit_generics_helper(&self, generics: &Generics) { for type_parameter in generics.ty_params.iter() { self.operation.visit_id(type_parameter.id) @@ -407,7 +407,7 @@ impl<'self, O: IdVisitingOperation> IdVisitor<'self, O> { } } -impl<'self, O: IdVisitingOperation> Visitor<()> for IdVisitor<'self, O> { +impl<'a, O: IdVisitingOperation> Visitor<()> for IdVisitor<'a, O> { fn visit_mod(&mut self, module: &_mod, _: Span, @@ -657,11 +657,11 @@ pub trait EachViewItem { fn each_view_item(&self, f: |&ast::view_item| -> bool) -> bool; } -struct EachViewItemData<'self> { - callback: 'self |&ast::view_item| -> bool, +struct EachViewItemData<'a> { + callback: 'a |&ast::view_item| -> bool, } -impl<'self> Visitor<()> for EachViewItemData<'self> { +impl<'a> Visitor<()> for EachViewItemData<'a> { fn visit_view_item(&mut self, view_item: &ast::view_item, _: ()) { let _ = (self.callback)(view_item); } diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index af86091084a..d5a64a5edba 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -493,7 +493,7 @@ pub fn get_exprs_from_tts(cx: @ExtCtxt, // use a top-level managed pointer by some difficulties // with pushing and popping functionally, and the ownership // issues. As a result, the values returned by the table -// also need to be managed; the &'self ... type that Maps +// also need to be managed; the &'a ... type that Maps // return won't work for things that need to get outside // of that managed pointer. The easiest way to do this // is just to insist that the values in the tables are diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index fefc4a9bafb..b3e2503f8c4 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -188,41 +188,41 @@ use std::vec; pub use self::ty::*; mod ty; -pub struct TraitDef<'self> { +pub struct TraitDef<'a> { /// The extension context cx: @ExtCtxt, /// The span for the current #[deriving(Foo)] header. span: Span, /// Path of the trait, including any type parameters - path: Path<'self>, + path: Path<'a>, /// Additional bounds required of any type parameters of the type, /// other than the current trait - additional_bounds: ~[Ty<'self>], + additional_bounds: ~[Ty<'a>], /// Any extra lifetimes and/or bounds, e.g. `D: extra::serialize::Decoder` - generics: LifetimeBounds<'self>, + generics: LifetimeBounds<'a>, - methods: ~[MethodDef<'self>] + methods: ~[MethodDef<'a>] } -pub struct MethodDef<'self> { +pub struct MethodDef<'a> { /// name of the method - name: &'self str, + name: &'a str, /// List of generics, e.g. `R: std::rand::Rng` - generics: LifetimeBounds<'self>, + generics: LifetimeBounds<'a>, /// Whether there is a self argument (outer Option) i.e. whether /// this is a static function, and whether it is a pointer (inner /// Option) - explicit_self: Option>>, + explicit_self: Option>>, /// Arguments other than the self argument - args: ~[Ty<'self>], + args: ~[Ty<'a>], /// Return type - ret_ty: Ty<'self>, + ret_ty: Ty<'a>, /// Whether to mark this as #[inline] inline: bool, @@ -231,20 +231,20 @@ pub struct MethodDef<'self> { /// actual enum variants, i.e. can use _ => .. match. const_nonmatching: bool, - combine_substructure: CombineSubstructureFunc<'self> + combine_substructure: CombineSubstructureFunc<'a> } /// All the data about the data structure/method being derived upon. -pub struct Substructure<'self> { +pub struct Substructure<'a> { /// ident of self type_ident: Ident, /// ident of the method method_ident: Ident, /// dereferenced access to any Self or Ptr(Self, _) arguments - self_args: &'self [@Expr], + self_args: &'a [@Expr], /// verbatim access to any other arguments - nonself_args: &'self [@Expr], - fields: &'self SubstructureFields<'self> + nonself_args: &'a [@Expr], + fields: &'a SubstructureFields<'a> } /// Summary of the relevant parts of a struct/enum field. @@ -271,26 +271,26 @@ pub enum StaticFields { /// A summary of the possible sets of fields. See above for details /// and examples -pub enum SubstructureFields<'self> { +pub enum SubstructureFields<'a> { Struct(~[FieldInfo]), /** Matching variants of the enum: variant index, ast::variant, fields: the field name is only non-`None` in the case of a struct variant. */ - EnumMatching(uint, &'self ast::variant, ~[FieldInfo]), + EnumMatching(uint, &'a ast::variant, ~[FieldInfo]), /** non-matching variants of the enum, [(variant index, ast::variant, [field span, field ident, fields])] (i.e. all fields for self are in the first tuple, for other1 are in the second tuple, etc.) */ - EnumNonMatching(&'self [(uint, P, ~[(Span, Option, @Expr)])]), + EnumNonMatching(&'a [(uint, P, ~[(Span, Option, @Expr)])]), /// A static method where Self is a struct. - StaticStruct(&'self ast::struct_def, StaticFields), + StaticStruct(&'a ast::struct_def, StaticFields), /// A static method where Self is an enum. - StaticEnum(&'self ast::enum_def, ~[(Ident, StaticFields)]) + StaticEnum(&'a ast::enum_def, ~[(Ident, StaticFields)]) } @@ -299,23 +299,23 @@ pub enum SubstructureFields<'self> { Combine the values of all the fields together. The last argument is all the fields of all the structures, see above for details. */ -pub type CombineSubstructureFunc<'self> = - 'self |@ExtCtxt, Span, &Substructure| -> @Expr; +pub type CombineSubstructureFunc<'a> = + 'a |@ExtCtxt, Span, &Substructure| -> @Expr; /** Deal with non-matching enum variants, the arguments are a list representing each variant: (variant index, ast::variant instance, [variant fields]), and a list of the nonself args of the type */ -pub type EnumNonMatchFunc<'self> = - 'self |@ExtCtxt, +pub type EnumNonMatchFunc<'a> = + 'a |@ExtCtxt, Span, &[(uint, P, ~[(Span, Option, @Expr)])], &[@Expr]| -> @Expr; -impl<'self> TraitDef<'self> { +impl<'a> TraitDef<'a> { pub fn expand(&self, _mitem: @ast::MetaItem, in_items: ~[@ast::item]) -> ~[@ast::item] { @@ -467,7 +467,7 @@ impl<'self> TraitDef<'self> { } } -impl<'self> MethodDef<'self> { +impl<'a> MethodDef<'a> { fn call_substructure_method(&self, trait_: &TraitDef, type_ident: Ident, diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index 9c611d7e7b2..d38f9b4d1b7 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -46,13 +46,13 @@ pub mod totalord; pub mod generic; -pub type ExpandDerivingStructDefFn<'self> = 'self |@ExtCtxt, +pub type ExpandDerivingStructDefFn<'a> = 'a |@ExtCtxt, Span, x: &struct_def, Ident, y: &Generics| -> @item; -pub type ExpandDerivingEnumDefFn<'self> = 'self |@ExtCtxt, +pub type ExpandDerivingEnumDefFn<'a> = 'a |@ExtCtxt, Span, x: &enum_def, Ident, diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index 87381d25dc7..e606cebc415 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -22,22 +22,22 @@ use opt_vec; use opt_vec::OptVec; /// The types of pointers -pub enum PtrTy<'self> { +pub enum PtrTy<'a> { Send, // ~ Managed(ast::Mutability), // @[mut] - Borrowed(Option<&'self str>, ast::Mutability), // &['lifetime] [mut] + Borrowed(Option<&'a str>, ast::Mutability), // &['lifetime] [mut] } /// A path, e.g. `::std::option::Option::` (global). Has support /// for type parameters and a lifetime. -pub struct Path<'self> { - path: ~[&'self str], - lifetime: Option<&'self str>, - params: ~[~Ty<'self>], +pub struct Path<'a> { + path: ~[&'a str], + lifetime: Option<&'a str>, + params: ~[~Ty<'a>], global: bool } -impl<'self> Path<'self> { +impl<'a> Path<'a> { pub fn new<'r>(path: ~[&'r str]) -> Path<'r> { Path::new_(path, None, ~[], true) } @@ -80,15 +80,15 @@ impl<'self> Path<'self> { } /// A type. Supports pointers (except for *), Self, and literals -pub enum Ty<'self> { +pub enum Ty<'a> { Self, // &/~/@ Ty - Ptr(~Ty<'self>, PtrTy<'self>), + Ptr(~Ty<'a>, PtrTy<'a>), // mod::mod::Type<[lifetime], [Params...]>, including a plain type // parameter, and things like `int` - Literal(Path<'self>), + Literal(Path<'a>), // includes nil - Tuple(~[Ty<'self>]) + Tuple(~[Ty<'a>]) } pub fn borrowed_ptrty<'r>() -> PtrTy<'r> { @@ -124,7 +124,7 @@ fn mk_lifetimes(cx: @ExtCtxt, span: Span, lt: &Option<&str>) -> OptVec Ty<'self> { +impl<'a> Ty<'a> { pub fn to_ty(&self, cx: @ExtCtxt, span: Span, @@ -207,12 +207,12 @@ fn mk_generics(lifetimes: ~[ast::Lifetime], ty_params: ~[ast::TyParam]) -> Gene } /// Lifetimes and bounds on type parameters -pub struct LifetimeBounds<'self> { - lifetimes: ~[&'self str], - bounds: ~[(&'self str, ~[Path<'self>])] +pub struct LifetimeBounds<'a> { + lifetimes: ~[&'a str], + bounds: ~[(&'a str, ~[Path<'a>])] } -impl<'self> LifetimeBounds<'self> { +impl<'a> LifetimeBounds<'a> { pub fn empty() -> LifetimeBounds<'static> { LifetimeBounds { lifetimes: ~[], bounds: ~[] diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 451e6683f0c..77cb02522a7 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -80,7 +80,7 @@ pub mod rt { } } - impl<'self> ToSource for &'self [@ast::item] { + impl<'a> ToSource for &'a [@ast::item] { fn to_source(&self) -> @str { self.map(|i| i.to_source()).connect("\n\n").to_managed() } @@ -92,7 +92,7 @@ pub mod rt { } } - impl<'self> ToSource for &'self [ast::Ty] { + impl<'a> ToSource for &'a [ast::Ty] { fn to_source(&self) -> @str { self.map(|i| i.to_source()).connect(", ").to_managed() } @@ -116,7 +116,7 @@ pub mod rt { } } - impl<'self> ToSource for &'self str { + impl<'a> ToSource for &'a str { fn to_source(&self) -> @str { let lit = dummy_spanned(ast::lit_str(self.to_managed(), ast::CookedStr)); pprust::lit_to_str(&lit).to_managed() @@ -208,7 +208,7 @@ pub mod rt { macro_rules! impl_to_tokens_self( ($t:ty) => ( - impl<'self> ToTokens for $t { + impl<'a> ToTokens for $t { fn to_tokens(&self, cx: @ExtCtxt) -> ~[token_tree] { cx.parse_tts(self.to_source()) } @@ -218,13 +218,13 @@ pub mod rt { impl_to_tokens!(ast::Ident) impl_to_tokens!(@ast::item) - impl_to_tokens_self!(&'self [@ast::item]) + impl_to_tokens_self!(&'a [@ast::item]) impl_to_tokens!(ast::Ty) - impl_to_tokens_self!(&'self [ast::Ty]) + impl_to_tokens_self!(&'a [ast::Ty]) impl_to_tokens!(Generics) impl_to_tokens!(@ast::Expr) impl_to_tokens!(ast::Block) - impl_to_tokens_self!(&'self str) + impl_to_tokens_self!(&'a str) impl_to_tokens!(int) impl_to_tokens!(i8) impl_to_tokens!(i16) diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index 3a0b7c6adc4..247962e0b94 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -144,13 +144,13 @@ impl Default for OptVec { fn default() -> OptVec { Empty } } -pub struct OptVecIterator<'self, T> { - priv iter: Option> +pub struct OptVecIterator<'a, T> { + priv iter: Option> } -impl<'self, T> Iterator<&'self T> for OptVecIterator<'self, T> { +impl<'a, T> Iterator<&'a T> for OptVecIterator<'a, T> { #[inline] - fn next(&mut self) -> Option<&'self T> { + fn next(&mut self) -> Option<&'a T> { match self.iter { Some(ref mut x) => x.next(), None => None diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 22a999ab744..d48c1d9d8d7 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -764,14 +764,15 @@ fn next_token_inner(rdr: @mut StringReader) -> token::Token { let ident = str_to_ident(lifetime_name); let tok = &token::IDENT(ident, false); - if token::is_any_keyword(tok) - && !token::is_keyword(token::keywords::Static, tok) - && !token::is_keyword(token::keywords::Self, tok) { + if token::is_keyword(token::keywords::Self, tok) { fatal_span(rdr, start, rdr.last_pos, - ~"invalid lifetime name"); + ~"invalid lifetime name: 'self is no longer a special lifetime"); + } else if token::is_any_keyword(tok) && + !token::is_keyword(token::keywords::Static, tok) { + fatal_span(rdr, start, rdr.last_pos, ~"invalid lifetime name"); + } else { + token::LIFETIME(ident) } - - token::LIFETIME(ident) }) } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4270a4d0dc5..aa37d859d79 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -102,13 +102,13 @@ pub enum PathParsingMode { /// A path with no type parameters; e.g. `foo::bar::Baz` NoTypesAllowed, /// A path with a lifetime and type parameters, with no double colons - /// before the type parameters; e.g. `foo::bar<'self>::Baz` + /// before the type parameters; e.g. `foo::bar<'a>::Baz` LifetimeAndTypesWithoutColons, /// A path with a lifetime and type parameters with double colons before - /// the type parameters; e.g. `foo::bar::<'self>::Baz::` + /// the type parameters; e.g. `foo::bar::<'a>::Baz::` LifetimeAndTypesWithColons, /// A path with a lifetime and type parameters with bounds before the last - /// set of type parameters only; e.g. `foo::bar<'self>::Baz:X+Y` This + /// set of type parameters only; e.g. `foo::bar<'a>::Baz:X+Y` This /// form does not use extra double colons. LifetimeAndTypesAndBounds, } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 19133fad9ee..503d884c24d 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -34,11 +34,11 @@ use std::io::Decorator; use std::io::mem::MemWriter; // The @ps is stored here to prevent recursive type. -pub enum ann_node<'self> { - node_block(@ps, &'self ast::Block), - node_item(@ps, &'self ast::item), - node_expr(@ps, &'self ast::Expr), - node_pat(@ps, &'self ast::Pat), +pub enum ann_node<'a> { + node_block(@ps, &'a ast::Block), + node_item(@ps, &'a ast::item), + node_expr(@ps, &'a ast::Expr), + node_pat(@ps, &'a ast::Pat), } pub trait pp_ann { diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index a5a8513fa71..3bfc88e1e81 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -28,12 +28,12 @@ use opt_vec::OptVec; // execute before AST node B, then A is visited first. The borrow checker in // particular relies on this property. -pub enum fn_kind<'self> { +pub enum fn_kind<'a> { // fn foo() or extern "Abi" fn foo() - fk_item_fn(Ident, &'self Generics, purity, AbiSet), + fk_item_fn(Ident, &'a Generics, purity, AbiSet), // fn foo(&self) - fk_method(Ident, &'self Generics, &'self method), + fk_method(Ident, &'a Generics, &'a method), // @fn(x, y) { ... } fk_anon(ast::Sigil), diff --git a/src/test/auxiliary/iss.rs b/src/test/auxiliary/iss.rs index 83574fb218a..6be7d7ab214 100644 --- a/src/test/auxiliary/iss.rs +++ b/src/test/auxiliary/iss.rs @@ -14,8 +14,8 @@ // part of issue-6919.rs -struct C<'self> { - k: 'self ||, +struct C<'a> { + k: 'a ||, } fn no_op() { } diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index d2241a0ddee..f132bc491e8 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -14,9 +14,9 @@ use std::iter::range_step; use extra::arena::Arena; use extra::future::Future; -enum Tree<'self> { +enum Tree<'a> { Nil, - Node(&'self Tree<'self>, &'self Tree<'self>, int) + Node(&'a Tree<'a>, &'a Tree<'a>, int) } fn item_check(t: &Tree) -> int { diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index 5685b489072..b40996b1471 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -17,11 +17,11 @@ fn iterate<'a, T>(x: T, f: 'a |&T| -> T) -> Iterate<'a, T> { Iterate {f: f, next: x} } -struct Iterate<'self, T> { - priv f: 'self |&T| -> T, +struct Iterate<'a, T> { + priv f: 'a |&T| -> T, priv next: T } -impl<'self, T> Iterator for Iterate<'self, T> { +impl<'a, T> Iterator for Iterate<'a, T> { fn next(&mut self) -> Option { let mut res = (self.f)(&self.next); std::util::swap(&mut res, &mut self.next); @@ -30,20 +30,20 @@ impl<'self, T> Iterator for Iterate<'self, T> { } // a linked list using borrowed next. -enum List<'self, T> { +enum List<'a, T> { Nil, - Cons(T, &'self List<'self, T>) + Cons(T, &'a List<'a, T>) } -struct ListIterator<'self, T> { - priv cur: &'self List<'self, T> +struct ListIterator<'a, T> { + priv cur: &'a List<'a, T> } -impl<'self, T> List<'self, T> { - fn iter(&'self self) -> ListIterator<'self, T> { +impl<'a, T> List<'a, T> { + fn iter(&'a self) -> ListIterator<'a, T> { ListIterator{cur: self} } } -impl<'self, T> Iterator<&'self T> for ListIterator<'self, T> { - fn next(&mut self) -> Option<&'self T> { +impl<'a, T> Iterator<&'a T> for ListIterator<'a, T> { + fn next(&mut self) -> Option<&'a T> { match *self.cur { Nil => None, Cons(ref elt, next) => { diff --git a/src/test/compile-fail/auto-ref-slice-plus-ref.rs b/src/test/compile-fail/auto-ref-slice-plus-ref.rs index d8164be6ea6..9f73955f29e 100644 --- a/src/test/compile-fail/auto-ref-slice-plus-ref.rs +++ b/src/test/compile-fail/auto-ref-slice-plus-ref.rs @@ -23,6 +23,6 @@ trait MyIter { fn test_mut(&mut self); } -impl<'self> MyIter for &'self [int] { +impl<'a> MyIter for &'a [int] { fn test_mut(&mut self) { } } diff --git a/src/test/compile-fail/borrowck-assign-to-andmut-in-aliasable-loc.rs b/src/test/compile-fail/borrowck-assign-to-andmut-in-aliasable-loc.rs index e4a23e74a12..3fa840f6a4e 100644 --- a/src/test/compile-fail/borrowck-assign-to-andmut-in-aliasable-loc.rs +++ b/src/test/compile-fail/borrowck-assign-to-andmut-in-aliasable-loc.rs @@ -11,8 +11,8 @@ // Test that assignments to an `&mut` pointer which is found in a // borrowed (but otherwise non-aliasable) location is illegal. -struct S<'self> { - pointer: &'self mut int +struct S<'a> { + pointer: &'a mut int } fn a(s: &S) { diff --git a/src/test/compile-fail/borrowck-assign-to-andmut-in-borrowed-loc.rs b/src/test/compile-fail/borrowck-assign-to-andmut-in-borrowed-loc.rs index dcef74b6c2b..ccbbc2ea6c3 100644 --- a/src/test/compile-fail/borrowck-assign-to-andmut-in-borrowed-loc.rs +++ b/src/test/compile-fail/borrowck-assign-to-andmut-in-borrowed-loc.rs @@ -11,8 +11,8 @@ // Test that assignments to an `&mut` pointer which is found in a // borrowed (but otherwise non-aliasable) location is illegal. -struct S<'self> { - pointer: &'self mut int +struct S<'a> { + pointer: &'a mut int } fn copy_borrowed_ptr<'a>(p: &'a mut S<'a>) -> S<'a> { diff --git a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs index cc196a6f7cf..646ec692863 100644 --- a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs +++ b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs @@ -8,12 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct defer<'self> { - x: &'self [&'self str], +struct defer<'a> { + x: &'a [&'a str], } #[unsafe_destructor] -impl<'self> Drop for defer<'self> { +impl<'a> Drop for defer<'a> { fn drop(&mut self) { unsafe { error!("{:?}", self.x); diff --git a/src/test/compile-fail/builtin-superkinds-simple.rs b/src/test/compile-fail/builtin-superkinds-simple.rs index c1011f1368a..962bf67f009 100644 --- a/src/test/compile-fail/builtin-superkinds-simple.rs +++ b/src/test/compile-fail/builtin-superkinds-simple.rs @@ -13,10 +13,10 @@ trait Foo : Send { } -impl <'self> Foo for &'self mut () { } //~ ERROR cannot implement this trait +impl <'a> Foo for &'a mut () { } //~ ERROR cannot implement this trait trait Bar : Freeze { } -impl <'self> Bar for &'self mut () { } //~ ERROR cannot implement this trait +impl <'a> Bar for &'a mut () { } //~ ERROR cannot implement this trait fn main() { } diff --git a/src/test/compile-fail/issue-3154.rs b/src/test/compile-fail/issue-3154.rs index bcbf90b660e..1cfed882d6c 100644 --- a/src/test/compile-fail/issue-3154.rs +++ b/src/test/compile-fail/issue-3154.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct thing<'self, Q> { - x: &'self Q +struct thing<'a, Q> { + x: &'a Q } fn thing(x: &Q) -> thing { diff --git a/src/test/compile-fail/issue-5500-1.rs b/src/test/compile-fail/issue-5500-1.rs index f709aadf4ac..6b1b84a940a 100644 --- a/src/test/compile-fail/issue-5500-1.rs +++ b/src/test/compile-fail/issue-5500-1.rs @@ -10,8 +10,8 @@ // xfail-test -struct TrieMapIterator<'self> { - priv node: &'self uint +struct TrieMapIterator<'a> { + priv node: &'a uint } fn main() { diff --git a/src/test/compile-fail/kindck-owned-trait-scoped.rs b/src/test/compile-fail/kindck-owned-trait-scoped.rs index 4dc1c6f2f3e..670c4927a6f 100644 --- a/src/test/compile-fail/kindck-owned-trait-scoped.rs +++ b/src/test/compile-fail/kindck-owned-trait-scoped.rs @@ -12,14 +12,14 @@ // except according to those terms. // A dummy trait/impl that work close over any type. The trait will -// be parameterized by a region due to the &'self int constraint. +// be parameterized by a region due to the &'a int constraint. trait foo { - fn foo(&self, i: &'self int) -> int; + fn foo(&self, i: &'a int) -> int; } impl foo for T { - fn foo(&self, i: &'self int) -> int {*i} + fn foo(&self, i: &'a int) -> int {*i} } fn to_foo(t: T) { diff --git a/src/test/compile-fail/lifetime-no-keyword.rs b/src/test/compile-fail/lifetime-no-keyword.rs index 593e1dc5e08..0ef13d73fab 100644 --- a/src/test/compile-fail/lifetime-no-keyword.rs +++ b/src/test/compile-fail/lifetime-no-keyword.rs @@ -1,4 +1,3 @@ - // Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -9,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(a: &'let int) { } //~ ERROR invalid lifetime name -fn bar(a: &'static int) { } -fn baz<'self>(a: &'self int) { } +fn foo<'a>(a: &'a int) { } +fn bar(a: &'static int) { } +fn baz(a: &'let int) { } //~ ERROR invalid lifetime name fn main() { } diff --git a/src/test/compile-fail/lifetime-obsoleted-self.rs b/src/test/compile-fail/lifetime-obsoleted-self.rs new file mode 100644 index 00000000000..a99daaab249 --- /dev/null +++ b/src/test/compile-fail/lifetime-obsoleted-self.rs @@ -0,0 +1,13 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn baz(a: &'self int) { } //~ ERROR invalid lifetime name: 'self is no longer a special lifetime + +fn main() { } diff --git a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs index 260d5a5dd44..03b9b7ba78f 100644 --- a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs +++ b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs @@ -12,11 +12,11 @@ // bound must be noncopyable. For details see // http://smallcultfollowing.com/babysteps/blog/2013/04/30/the-case-of-the-recurring-closure/ -struct R<'self> { +struct R<'a> { // This struct is needed to create the // otherwise infinite type of a fn that // accepts itself as argument: - c: 'self |&R, bool| + c: 'a |&R, bool| } fn innocent_looking_victim() { diff --git a/src/test/compile-fail/regions-bounds.rs b/src/test/compile-fail/regions-bounds.rs index ab365c1bf6f..f74244c4984 100644 --- a/src/test/compile-fail/regions-bounds.rs +++ b/src/test/compile-fail/regions-bounds.rs @@ -12,8 +12,8 @@ // nominal types (but not on other types) and that they are type // checked. -struct an_enum<'self>(&'self int); -struct a_class<'self> { x:&'self int } +struct an_enum<'a>(&'a int); +struct a_class<'a> { x:&'a int } fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { return e; //~ ERROR mismatched types: expected `an_enum<'b>` but found `an_enum<'a>` diff --git a/src/test/compile-fail/regions-creating-enums.rs b/src/test/compile-fail/regions-creating-enums.rs index 0a370425c41..4fd3cd27044 100644 --- a/src/test/compile-fail/regions-creating-enums.rs +++ b/src/test/compile-fail/regions-creating-enums.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum ast<'self> { +enum ast<'a> { num(uint), - add(&'self ast<'self>, &'self ast<'self>) + add(&'a ast<'a>, &'a ast<'a>) } fn build() { diff --git a/src/test/compile-fail/regions-creating-enums3.rs b/src/test/compile-fail/regions-creating-enums3.rs index 08243bace90..9e36ecc2b75 100644 --- a/src/test/compile-fail/regions-creating-enums3.rs +++ b/src/test/compile-fail/regions-creating-enums3.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum ast<'self> { +enum ast<'a> { num(uint), - add(&'self ast<'self>, &'self ast<'self>) + add(&'a ast<'a>, &'a ast<'a>) } fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> { diff --git a/src/test/compile-fail/regions-creating-enums4.rs b/src/test/compile-fail/regions-creating-enums4.rs index 8f764745697..7683b678b2b 100644 --- a/src/test/compile-fail/regions-creating-enums4.rs +++ b/src/test/compile-fail/regions-creating-enums4.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum ast<'self> { +enum ast<'a> { num(uint), - add(&'self ast<'self>, &'self ast<'self>) + add(&'a ast<'a>, &'a ast<'a>) } fn mk_add_bad2<'a>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast { diff --git a/src/test/compile-fail/regions-escape-via-trait-or-not.rs b/src/test/compile-fail/regions-escape-via-trait-or-not.rs index 32ec59d9741..7f54fe298a1 100644 --- a/src/test/compile-fail/regions-escape-via-trait-or-not.rs +++ b/src/test/compile-fail/regions-escape-via-trait-or-not.rs @@ -12,7 +12,7 @@ trait deref { fn get(self) -> int; } -impl<'self> deref for &'self int { +impl<'a> deref for &'a int { fn get(self) -> int { *self } diff --git a/src/test/compile-fail/regions-free-region-ordering-caller.rs b/src/test/compile-fail/regions-free-region-ordering-caller.rs index 808e850907f..2f8caabb7f8 100644 --- a/src/test/compile-fail/regions-free-region-ordering-caller.rs +++ b/src/test/compile-fail/regions-free-region-ordering-caller.rs @@ -12,7 +12,7 @@ // than the thing it points at and ensure that they result in // errors. See also regions-free-region-ordering-callee.rs -struct Paramd<'self> { x: &'self uint } +struct Paramd<'a> { x: &'a uint } fn call2<'a, 'b>(a: &'a uint, b: &'b uint) { let z: Option<&'b &'a uint> = None; diff --git a/src/test/compile-fail/regions-free-region-ordering-incorrect.rs b/src/test/compile-fail/regions-free-region-ordering-incorrect.rs index c2bd64fddaf..54352092794 100644 --- a/src/test/compile-fail/regions-free-region-ordering-incorrect.rs +++ b/src/test/compile-fail/regions-free-region-ordering-incorrect.rs @@ -9,19 +9,19 @@ // except according to those terms. // Test that free regions ordering only goes one way. That is, -// we have `&'a Node<'self, T>`, which implies that `'a <= 'self`, -// but not `'self <= 'a`. Hence returning `&self.val` (which has lifetime -// `'a`) where `'self` is expected yields an error. +// we have `&'a Node<'b, T>`, which implies that `'a <= 'b`, +// but not `'b <= 'a`. Hence returning `&self.val` (which has lifetime +// `'a`) where `'b` is expected yields an error. // // This test began its life as a test for issue #4325. -struct Node<'self, T> { +struct Node<'b, T> { val: T, - next: Option<&'self Node<'self, T>> + next: Option<&'b Node<'b, T>> } -impl<'self, T> Node<'self, T> { - fn get<'a>(&'a self) -> &'self T { +impl<'b, T> Node<'b, T> { + fn get<'a>(&'a self) -> &'b T { match self.next { Some(ref next) => next.get(), None => &self.val //~ ERROR cannot infer an appropriate lifetime diff --git a/src/test/compile-fail/regions-glb-free-free.rs b/src/test/compile-fail/regions-glb-free-free.rs index d438b55f4af..8f6754b34bc 100644 --- a/src/test/compile-fail/regions-glb-free-free.rs +++ b/src/test/compile-fail/regions-glb-free-free.rs @@ -11,9 +11,9 @@ mod argparse { extern mod extra; - pub struct Flag<'self> { - name: &'self str, - desc: &'self str, + pub struct Flag<'a> { + name: &'a str, + desc: &'a str, max_count: uint, value: uint } @@ -22,8 +22,8 @@ mod argparse { Flag { name: name, desc: desc, max_count: 1, value: 0 } } - impl<'self> Flag<'self> { - pub fn set_desc(self, s: &str) -> Flag<'self> { + impl<'a> Flag<'a> { + pub fn set_desc(self, s: &str) -> Flag<'a> { Flag { //~ ERROR cannot infer an appropriate lifetime name: self.name, desc: s, diff --git a/src/test/compile-fail/regions-in-enums.rs b/src/test/compile-fail/regions-in-enums.rs index 0a221b9a533..72b32e4a9af 100644 --- a/src/test/compile-fail/regions-in-enums.rs +++ b/src/test/compile-fail/regions-in-enums.rs @@ -15,8 +15,8 @@ enum yes0<'lt> { X3(&'lt uint) } -enum yes1<'self> { - X4(&'self uint) +enum yes1<'a> { + X4(&'a uint) } enum no0 { @@ -24,7 +24,7 @@ enum no0 { } enum no1 { - X6(&'self uint) //~ ERROR use of undeclared lifetime name `'self` + X6(&'a uint) //~ ERROR use of undeclared lifetime name `'a` } fn main() {} diff --git a/src/test/compile-fail/regions-in-structs.rs b/src/test/compile-fail/regions-in-structs.rs index 1e74fa4adb9..0c5cb98e6a4 100644 --- a/src/test/compile-fail/regions-in-structs.rs +++ b/src/test/compile-fail/regions-in-structs.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct yes1<'self> { - x: &'self uint, +struct yes1<'a> { + x: &'a uint, } struct yes2<'a> { @@ -18,7 +18,7 @@ struct yes2<'a> { struct StructDecl { a: &'a int, //~ ERROR use of undeclared lifetime name `'a` - b: &'self int, //~ ERROR use of undeclared lifetime name `'self` + b: &'a int, //~ ERROR use of undeclared lifetime name `'a` } diff --git a/src/test/compile-fail/regions-infer-at-fn-not-param.rs b/src/test/compile-fail/regions-infer-at-fn-not-param.rs index 6347fa97c4d..46de570eaf4 100644 --- a/src/test/compile-fail/regions-infer-at-fn-not-param.rs +++ b/src/test/compile-fail/regions-infer-at-fn-not-param.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct parameterized1<'self> { - g: 'self || +struct parameterized1<'a> { + g: 'a || } struct not_parameterized1 { diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs index c7364a60bdf..6a6b8f95e63 100644 --- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs +++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs @@ -10,8 +10,8 @@ #[feature(managed_boxes)]; -struct invariant<'self> { - f: 'static |x: @mut &'self int| +struct invariant<'a> { + f: 'static |x: @mut &'a int| } fn to_same_lifetime<'r>(bi: invariant<'r>) { diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs index 8070d1f1dce..4210c52e7f6 100644 --- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs +++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs @@ -10,8 +10,8 @@ #[feature(managed_boxes)]; -struct invariant<'self> { - f: 'static || -> @mut &'self int +struct invariant<'a> { + f: 'static || -> @mut &'a int } fn to_same_lifetime<'r>(bi: invariant<'r>) { diff --git a/src/test/compile-fail/regions-infer-not-param.rs b/src/test/compile-fail/regions-infer-not-param.rs index 92159489ae7..b5fce9e21bd 100644 --- a/src/test/compile-fail/regions-infer-not-param.rs +++ b/src/test/compile-fail/regions-infer-not-param.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct direct<'self> { - f: &'self int +struct direct<'a> { + f: &'a int } struct indirect1 { @@ -17,9 +17,9 @@ struct indirect1 { g: 'static |direct| } -struct indirect2<'self> { - // But here it is set to 'self - g: 'static |direct<'self>| +struct indirect2<'a> { + // But here it is set to 'a + g: 'static |direct<'a>| } fn take_direct(p: direct) -> direct { p } //~ ERROR mismatched types diff --git a/src/test/compile-fail/regions-infer-paramd-indirect.rs b/src/test/compile-fail/regions-infer-paramd-indirect.rs index 6a9b153bbe3..63d3338cc89 100644 --- a/src/test/compile-fail/regions-infer-paramd-indirect.rs +++ b/src/test/compile-fail/regions-infer-paramd-indirect.rs @@ -13,25 +13,25 @@ // Check that we correctly infer that b and c must be region // parameterized because they reference a which requires a region. -type a<'self> = &'self int; -type b<'self> = @a<'self>; +type a<'a> = &'a int; +type b<'a> = @a<'a>; -struct c<'self> { - f: @b<'self> +struct c<'a> { + f: @b<'a> } -trait set_f<'self> { - fn set_f_ok(&self, b: @b<'self>); +trait set_f<'a> { + fn set_f_ok(&self, b: @b<'a>); fn set_f_bad(&self, b: @b); } -impl<'self> set_f<'self> for c<'self> { - fn set_f_ok(&self, b: @b<'self>) { +impl<'a> set_f<'a> for c<'a> { + fn set_f_ok(&self, b: @b<'a>) { self.f = b; } fn set_f_bad(&self, b: @b) { - self.f = b; //~ ERROR mismatched types: expected `@@&'self int` but found `@@&int` + self.f = b; //~ ERROR mismatched types: expected `@@&'a int` but found `@@&int` //~^ ERROR cannot infer an appropriate lifetime } } diff --git a/src/test/compile-fail/regions-infer-paramd-method.rs b/src/test/compile-fail/regions-infer-paramd-method.rs index 8c3195f020a..62a65596f06 100644 --- a/src/test/compile-fail/regions-infer-paramd-method.rs +++ b/src/test/compile-fail/regions-infer-paramd-method.rs @@ -14,21 +14,21 @@ // Here: foo is parameterized because it contains a method that // refers to self. -trait foo<'self> { - fn self_int(self) -> &'self int; +trait foo<'a> { + fn self_int(self) -> &'a int; fn any_int(self) -> ∫ } -struct with_foo<'self> { - f: @foo<'self> +struct with_foo<'a> { + f: @foo<'a> } trait set_foo_foo { fn set_foo(&mut self, f: @foo); } -impl<'self> set_foo_foo for with_foo<'self> { +impl<'a> set_foo_foo for with_foo<'a> { fn set_foo(&mut self, f: @foo) { self.f = f; //~ ERROR mismatched types: expected `@foo/&self` but found `@foo/&` } diff --git a/src/test/compile-fail/regions-steal-closure.rs b/src/test/compile-fail/regions-steal-closure.rs index 292e282dd07..32fde3747c1 100644 --- a/src/test/compile-fail/regions-steal-closure.rs +++ b/src/test/compile-fail/regions-steal-closure.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct closure_box<'self> { - cl: 'self || +struct closure_box<'a> { + cl: 'a || } fn box_it<'r>(x: 'r ||) -> closure_box<'r> { diff --git a/src/test/compile-fail/regions-trait-1.rs b/src/test/compile-fail/regions-trait-1.rs index f5dd33a1598..8e6b821294b 100644 --- a/src/test/compile-fail/regions-trait-1.rs +++ b/src/test/compile-fail/regions-trait-1.rs @@ -17,13 +17,13 @@ trait get_ctxt { fn get_ctxt(&self) -> &ctxt; } -struct has_ctxt<'self> { c: &'self ctxt } +struct has_ctxt<'a> { c: &'a ctxt } -impl<'self> get_ctxt for has_ctxt<'self> { +impl<'a> get_ctxt for has_ctxt<'a> { // Here an error occurs because we used `&self` but // the definition used `&`: - fn get_ctxt(&self) -> &'self ctxt { //~ ERROR method `get_ctxt` has an incompatible type + fn get_ctxt(&self) -> &'a ctxt { //~ ERROR method `get_ctxt` has an incompatible type self.c } diff --git a/src/test/compile-fail/regions-trait-2.rs b/src/test/compile-fail/regions-trait-2.rs index 9855a234618..7639bc69c21 100644 --- a/src/test/compile-fail/regions-trait-2.rs +++ b/src/test/compile-fail/regions-trait-2.rs @@ -16,13 +16,13 @@ struct ctxt { v: uint } trait get_ctxt { - fn get_ctxt(&self) -> &'self ctxt; + fn get_ctxt(&self) -> &'a ctxt; } -struct has_ctxt<'self> { c: &'self ctxt } +struct has_ctxt<'a> { c: &'a ctxt } -impl<'self> get_ctxt for has_ctxt<'self> { - fn get_ctxt(&self) -> &'self ctxt { self.c } +impl<'a> get_ctxt for has_ctxt<'a> { + fn get_ctxt(&self) -> &'a ctxt { self.c } } fn make_gc() -> @get_ctxt { diff --git a/src/test/compile-fail/regions-trait-3.rs b/src/test/compile-fail/regions-trait-3.rs index 072b0e83fdf..01195d0ac94 100644 --- a/src/test/compile-fail/regions-trait-3.rs +++ b/src/test/compile-fail/regions-trait-3.rs @@ -11,8 +11,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait get_ctxt<'self> { - fn get_ctxt(self) -> &'self uint; +trait get_ctxt<'a> { + fn get_ctxt(self) -> &'a uint; } fn make_gc1(gc: @get_ctxt<'a>) -> @get_ctxt<'b> { @@ -20,11 +20,11 @@ fn make_gc1(gc: @get_ctxt<'a>) -> @get_ctxt<'b> { } struct Foo { - r: &'self uint + r: &'a uint } -impl get_ctxt for Foo<'self> { - fn get_ctxt(&self) -> &'self uint { self.r } +impl get_ctxt for Foo<'a> { + fn get_ctxt(&self) -> &'a uint { self.r } } fn make_gc2<'a,'b>(foo: Foo<'a>) -> @get_ctxt<'b> { diff --git a/src/test/compile-fail/regions-undeclared.rs b/src/test/compile-fail/regions-undeclared.rs index fcf3a73b19f..2d1de23616b 100644 --- a/src/test/compile-fail/regions-undeclared.rs +++ b/src/test/compile-fail/regions-undeclared.rs @@ -12,11 +12,11 @@ static c_x: &'blk int = &22; //~ ERROR use of undeclared lifetime name `'blk` enum EnumDecl { Foo(&'a int), //~ ERROR use of undeclared lifetime name `'a` - Bar(&'self int), //~ ERROR use of undeclared lifetime name `'self` + Bar(&'a int), //~ ERROR use of undeclared lifetime name `'a` } fn fnDecl(x: &'a int, //~ ERROR use of undeclared lifetime name `'a` - y: &'self int) //~ ERROR use of undeclared lifetime name `'self` + y: &'a int) //~ ERROR use of undeclared lifetime name `'a` {} fn main() { diff --git a/src/test/compile-fail/unconstrained-ref.rs b/src/test/compile-fail/unconstrained-ref.rs index 80bd83caf32..a4125f94cd2 100644 --- a/src/test/compile-fail/unconstrained-ref.rs +++ b/src/test/compile-fail/unconstrained-ref.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct S<'self, T> { - o: &'self Option +struct S<'a, T> { + o: &'a Option } fn main() { diff --git a/src/test/debug-info/option-like-enum.rs b/src/test/debug-info/option-like-enum.rs index be1ab45345c..c263d115509 100644 --- a/src/test/debug-info/option-like-enum.rs +++ b/src/test/debug-info/option-like-enum.rs @@ -45,26 +45,26 @@ // in the null-case is not defined. So we just read the discriminator field in // this case (by casting the value to a memory-equivalent struct). -enum MoreFields<'self> { - Full(u32, &'self int, i16), +enum MoreFields<'a> { + Full(u32, &'a int, i16), Empty } -struct MoreFieldsRepr<'self> { +struct MoreFieldsRepr<'a> { a: u32, - discr: &'self int, + discr: &'a int, b: i16 } -enum NamedFields<'self> { - Droid { id: i32, range: i64, internals: &'self int }, +enum NamedFields<'a> { + Droid { id: i32, range: i64, internals: &'a int }, Void } -struct NamedFieldsRepr<'self> { +struct NamedFieldsRepr<'a> { id: i32, range: i64, - internals: &'self int + internals: &'a int } fn main() { diff --git a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs index 88ff00e86fa..668fa54315e 100644 --- a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs +++ b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs @@ -7,8 +7,8 @@ trait MyMutSlice { fn my_mut_slice(self) -> Self; } -impl<'self, T> MyMutSlice for &'self mut [T] { - fn my_mut_slice(self) -> &'self mut [T] { +impl<'a, T> MyMutSlice for &'a mut [T] { + fn my_mut_slice(self) -> &'a mut [T] { self } } @@ -17,8 +17,8 @@ trait MySlice { fn my_slice(self) -> Self; } -impl<'self, T> MySlice for &'self [T] { - fn my_slice(self) -> &'self [T] { +impl<'a, T> MySlice for &'a [T] { + fn my_slice(self) -> &'a [T] { self } } diff --git a/src/test/run-pass/assignability-trait.rs b/src/test/run-pass/assignability-trait.rs index c5142897b1d..85c5ae444eb 100644 --- a/src/test/run-pass/assignability-trait.rs +++ b/src/test/run-pass/assignability-trait.rs @@ -16,7 +16,7 @@ trait iterable { fn iterate(&self, blk: |x: &A| -> bool) -> bool; } -impl<'self,A> iterable for &'self [A] { +impl<'a,A> iterable for &'a [A] { fn iterate(&self, f: |x: &A| -> bool) -> bool { self.iter().advance(f) } diff --git a/src/test/run-pass/auto-ref-slice-plus-ref.rs b/src/test/run-pass/auto-ref-slice-plus-ref.rs index d35341516f2..2b9870b84a5 100644 --- a/src/test/run-pass/auto-ref-slice-plus-ref.rs +++ b/src/test/run-pass/auto-ref-slice-plus-ref.rs @@ -15,11 +15,11 @@ trait MyIter { fn test_imm(&self); } -impl<'self> MyIter for &'self [int] { +impl<'a> MyIter for &'a [int] { fn test_imm(&self) { assert_eq!(self[0], 1) } } -impl<'self> MyIter for &'self str { +impl<'a> MyIter for &'a str { fn test_imm(&self) { assert_eq!(*self, "test") } } diff --git a/src/test/run-pass/borrow-by-val-method-receiver.rs b/src/test/run-pass/borrow-by-val-method-receiver.rs index fb4316ca1f5..386f5f673d6 100644 --- a/src/test/run-pass/borrow-by-val-method-receiver.rs +++ b/src/test/run-pass/borrow-by-val-method-receiver.rs @@ -12,7 +12,7 @@ trait Foo { fn foo(self); } -impl<'self> Foo for &'self [int] { +impl<'a> Foo for &'a [int] { fn foo(self) {} } diff --git a/src/test/run-pass/const-fn-val.rs b/src/test/run-pass/const-fn-val.rs index 126d53621dd..0ad8dfc277c 100644 --- a/src/test/run-pass/const-fn-val.rs +++ b/src/test/run-pass/const-fn-val.rs @@ -12,7 +12,7 @@ fn foo() -> int { return 0xca7f000d; } -struct Bar<'self> { f: 'self || -> int } +struct Bar<'a> { f: 'a || -> int } static b : Bar<'static> = Bar { f: foo }; diff --git a/src/test/run-pass/const-region-ptrs-noncopy.rs b/src/test/run-pass/const-region-ptrs-noncopy.rs index 3eaf733d784..6dce262dd9a 100644 --- a/src/test/run-pass/const-region-ptrs-noncopy.rs +++ b/src/test/run-pass/const-region-ptrs-noncopy.rs @@ -11,7 +11,7 @@ use std::ptr; type Big = [u64, ..8]; -struct Pair<'self> { a: int, b: &'self Big } +struct Pair<'a> { a: int, b: &'a Big } static x: &'static Big = &([13, 14, 10, 13, 11, 14, 14, 15]); static y: &'static Pair<'static> = &Pair {a: 15, b: x}; diff --git a/src/test/run-pass/const-region-ptrs.rs b/src/test/run-pass/const-region-ptrs.rs index c5884ae6e93..1d7ba0ed6c7 100644 --- a/src/test/run-pass/const-region-ptrs.rs +++ b/src/test/run-pass/const-region-ptrs.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Pair<'self> { a: int, b: &'self int } +struct Pair<'a> { a: int, b: &'a int } static x: &'static int = &10; diff --git a/src/test/run-pass/const-vec-of-fns.rs b/src/test/run-pass/const-vec-of-fns.rs index 593d0e3125d..fa6633121c8 100644 --- a/src/test/run-pass/const-vec-of-fns.rs +++ b/src/test/run-pass/const-vec-of-fns.rs @@ -20,7 +20,7 @@ fn f() { } static bare_fns: &'static [extern fn()] = &[f, f]; -struct S<'self>('self ||); +struct S<'a>('a ||); static closures: &'static [S<'static>] = &[S(f), S(f)]; pub fn main() { diff --git a/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs b/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs index 2d0b4f37b2f..fbeb0a05340 100644 --- a/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs +++ b/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs @@ -11,8 +11,8 @@ use std::cmp::{Less,Equal,Greater}; #[deriving(TotalEq,TotalOrd)] -struct A<'self> { - x: &'self int +struct A<'a> { + x: &'a int } pub fn main() { let (a, b) = (A { x: &1 }, A { x: &2 }); diff --git a/src/test/run-pass/deriving-self-lifetime.rs b/src/test/run-pass/deriving-self-lifetime.rs index 2b0245fa5d2..3d7d58878f2 100644 --- a/src/test/run-pass/deriving-self-lifetime.rs +++ b/src/test/run-pass/deriving-self-lifetime.rs @@ -9,8 +9,8 @@ // except according to those terms. #[deriving(Eq,Ord)] -struct A<'self> { - x: &'self int +struct A<'a> { + x: &'a int } pub fn main() { diff --git a/src/test/run-pass/expr-block-generic-box2.rs b/src/test/run-pass/expr-block-generic-box2.rs index 04721c6bd94..aa205d8cc40 100644 --- a/src/test/run-pass/expr-block-generic-box2.rs +++ b/src/test/run-pass/expr-block-generic-box2.rs @@ -12,7 +12,7 @@ // xfail-fast -type compare<'self, T> = 'self |T, T| -> bool; +type compare<'a, T> = 'a |T, T| -> bool; fn test_generic(expected: T, eq: compare) { let actual: T = { expected.clone() }; diff --git a/src/test/run-pass/expr-block-generic-unique1.rs b/src/test/run-pass/expr-block-generic-unique1.rs index f1df0e167b9..43ddfe6d58f 100644 --- a/src/test/run-pass/expr-block-generic-unique1.rs +++ b/src/test/run-pass/expr-block-generic-unique1.rs @@ -10,7 +10,7 @@ -type compare<'self, T> = 'self |~T, ~T| -> bool; +type compare<'a, T> = 'a |~T, ~T| -> bool; fn test_generic(expected: ~T, eq: compare) { let actual: ~T = { expected.clone() }; diff --git a/src/test/run-pass/expr-block-generic-unique2.rs b/src/test/run-pass/expr-block-generic-unique2.rs index b666a2f6760..aadca91477c 100644 --- a/src/test/run-pass/expr-block-generic-unique2.rs +++ b/src/test/run-pass/expr-block-generic-unique2.rs @@ -10,7 +10,7 @@ // xfail-fast -type compare<'self, T> = 'self |T, T| -> bool; +type compare<'a, T> = 'a |T, T| -> bool; fn test_generic(expected: T, eq: compare) { let actual: T = { expected.clone() }; diff --git a/src/test/run-pass/expr-block-generic.rs b/src/test/run-pass/expr-block-generic.rs index bc8c4c8983d..90f6ae25f9f 100644 --- a/src/test/run-pass/expr-block-generic.rs +++ b/src/test/run-pass/expr-block-generic.rs @@ -12,7 +12,7 @@ // xfail-fast // Tests for standalone blocks as expressions with dynamic type sizes -type compare<'self, T> = 'self |T, T| -> bool; +type compare<'a, T> = 'a |T, T| -> bool; fn test_generic(expected: T, eq: compare) { let actual: T = { expected.clone() }; diff --git a/src/test/run-pass/expr-match-generic-unique2.rs b/src/test/run-pass/expr-match-generic-unique2.rs index 2bd0f18ba0a..bcac6a08260 100644 --- a/src/test/run-pass/expr-match-generic-unique2.rs +++ b/src/test/run-pass/expr-match-generic-unique2.rs @@ -10,7 +10,7 @@ // xfail-fast -type compare<'self, T> = 'self |T, T| -> bool; +type compare<'a, T> = 'a |T, T| -> bool; fn test_generic(expected: T, eq: compare) { let actual: T = match true { diff --git a/src/test/run-pass/fn-coerce-field.rs b/src/test/run-pass/fn-coerce-field.rs index 809005258b5..e49b1e9ed61 100644 --- a/src/test/run-pass/fn-coerce-field.rs +++ b/src/test/run-pass/fn-coerce-field.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct r<'self> { - field: 'self || +struct r<'a> { + field: 'a || } pub fn main() { diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 3d02d2c2c5b..e16cfecb694 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -24,7 +24,7 @@ mod map_reduce { use std::str; use std::task; - pub type putter<'self> = 'self |~str, ~str|; + pub type putter<'a> = 'a |~str, ~str|; pub type mapper = extern fn(~str, putter); diff --git a/src/test/run-pass/issue-2502.rs b/src/test/run-pass/issue-2502.rs index c26fef49be7..2ee5b2e60de 100644 --- a/src/test/run-pass/issue-2502.rs +++ b/src/test/run-pass/issue-2502.rs @@ -8,12 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct font<'self> { - fontbuf: &'self ~[u8], +struct font<'a> { + fontbuf: &'a ~[u8], } -impl<'self> font<'self> { - pub fn buf(&self) -> &'self ~[u8] { +impl<'a> font<'a> { + pub fn buf(&self) -> &'a ~[u8] { self.fontbuf } } diff --git a/src/test/run-pass/issue-2748-a.rs b/src/test/run-pass/issue-2748-a.rs index 63807de22dd..455d22fe7f0 100644 --- a/src/test/run-pass/issue-2748-a.rs +++ b/src/test/run-pass/issue-2748-a.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct CMap<'self> { - buf: &'self [u8], +struct CMap<'a> { + buf: &'a [u8], } fn CMap<'r>(buf: &'r [u8]) -> CMap<'r> { diff --git a/src/test/run-pass/issue-5243.rs b/src/test/run-pass/issue-5243.rs index 1fc51961b16..f5d2c381472 100644 --- a/src/test/run-pass/issue-5243.rs +++ b/src/test/run-pass/issue-5243.rs @@ -12,8 +12,8 @@ // enough for trans to consider this as non-monomorphic, // which led to various assertions and failures in turn. -struct S<'self> { - v: &'self int +struct S<'a> { + v: &'a int } fn f<'lt>(_s: &'lt S<'lt>) {} diff --git a/src/test/run-pass/issue-5708.rs b/src/test/run-pass/issue-5708.rs index 918e43d040c..2743e335732 100644 --- a/src/test/run-pass/issue-5708.rs +++ b/src/test/run-pass/issue-5708.rs @@ -27,11 +27,11 @@ impl Inner for int { fn print(&self) { print(format!("Inner: {}\n", *self)); } } -struct Outer<'self> { - inner: &'self Inner +struct Outer<'a> { + inner: &'a Inner } -impl<'self> Outer<'self> { +impl<'a> Outer<'a> { fn new<'r>(inner: &'r Inner) -> Outer<'r> { Outer { inner: inner @@ -49,12 +49,12 @@ pub fn main() { // minimal trait MyTrait { } -pub struct MyContainer<'self, T> { - foos: ~[&'self MyTrait], +pub struct MyContainer<'a, T> { + foos: ~[&'a MyTrait], } -impl<'self, T> MyContainer<'self, T> { - pub fn add (&mut self, foo: &'self MyTrait) { +impl<'a, T> MyContainer<'a, T> { + pub fn add (&mut self, foo: &'a MyTrait) { self.foos.push(foo); } } diff --git a/src/test/run-pass/issue-5884.rs b/src/test/run-pass/issue-5884.rs index 98b9d5e8a06..593ca9de3af 100644 --- a/src/test/run-pass/issue-5884.rs +++ b/src/test/run-pass/issue-5884.rs @@ -14,9 +14,9 @@ pub struct Foo { a: int, } -struct Bar<'self> { +struct Bar<'a> { a: ~Option, - b: &'self Foo, + b: &'a Foo, } fn check(a: @Foo) { diff --git a/src/test/run-pass/issue-7012.rs b/src/test/run-pass/issue-7012.rs index 696197a21af..2bd233c9aed 100644 --- a/src/test/run-pass/issue-7012.rs +++ b/src/test/run-pass/issue-7012.rs @@ -15,7 +15,7 @@ The expected behaviour would be that test==test1, therefore 'true' would be printed, however the below prints false. */ -struct signature<'self> { pattern : &'self [u32] } +struct signature<'a> { pattern : &'a [u32] } static test1: signature<'static> = signature { pattern: &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32] diff --git a/src/test/run-pass/issue-7563.rs b/src/test/run-pass/issue-7563.rs index ece53f4e3f2..1f172725b5e 100644 --- a/src/test/run-pass/issue-7563.rs +++ b/src/test/run-pass/issue-7563.rs @@ -3,7 +3,7 @@ trait IDummy { } struct A { a: int } -struct B<'self> { b: int, pa: &'self A } +struct B<'a> { b: int, pa: &'a A } impl IDummy for A { fn do_nothing(&self) { @@ -11,8 +11,8 @@ struct B<'self> { b: int, pa: &'self A } } } -impl<'self> B<'self> { - fn get_pa(&self) -> &'self IDummy { self.pa as &'self IDummy } +impl<'a> B<'a> { + fn get_pa(&self) -> &'a IDummy { self.pa as &'a IDummy } } pub fn main() { diff --git a/src/test/run-pass/issue-8249.rs b/src/test/run-pass/issue-8249.rs index bfc1d943690..3ca6c806ef5 100644 --- a/src/test/run-pass/issue-8249.rs +++ b/src/test/run-pass/issue-8249.rs @@ -12,8 +12,8 @@ trait A {} struct B; impl A for B {} -struct C<'self> { - foo: &'self mut A, +struct C<'a> { + foo: &'a mut A, } fn foo(a: &mut A) { diff --git a/src/test/run-pass/issue-9382.rs b/src/test/run-pass/issue-9382.rs index 4b79760956c..d2bf6e29f87 100644 --- a/src/test/run-pass/issue-9382.rs +++ b/src/test/run-pass/issue-9382.rs @@ -15,13 +15,13 @@ // from a vector to a slice. The drop glue was being invoked on // the temporary slice with a wrong type, triggering an LLVM assert. -struct Thing1<'self> { - baz: &'self [~int], +struct Thing1<'a> { + baz: &'a [~int], bar: ~u64, } -struct Thing2<'self> { - baz: &'self [~int], +struct Thing2<'a> { + baz: &'a [~int], bar: u64, } diff --git a/src/test/run-pass/rcvr-borrowed-to-region.rs b/src/test/run-pass/rcvr-borrowed-to-region.rs index 8f256bbf2a4..7d07cab433f 100644 --- a/src/test/run-pass/rcvr-borrowed-to-region.rs +++ b/src/test/run-pass/rcvr-borrowed-to-region.rs @@ -15,7 +15,7 @@ trait get { // Note: impl on a slice; we're checking that the pointers below // correctly get borrowed to `&`. (similar to impling for `int`, with // `&self` instead of `self`.) -impl<'self> get for &'self int { +impl<'a> get for &'a int { fn get(self) -> int { return *self; } diff --git a/src/test/run-pass/rcvr-borrowed-to-slice.rs b/src/test/run-pass/rcvr-borrowed-to-slice.rs index fd37cc12302..050a51c958d 100644 --- a/src/test/run-pass/rcvr-borrowed-to-slice.rs +++ b/src/test/run-pass/rcvr-borrowed-to-slice.rs @@ -13,7 +13,7 @@ trait sum { } // Note: impl on a slice -impl<'self> sum for &'self [int] { +impl<'a> sum for &'a [int] { fn sum_(self) -> int { self.iter().fold(0, |a, &b| a + b) } diff --git a/src/test/run-pass/regions-copy-closure.rs b/src/test/run-pass/regions-copy-closure.rs index 19fd1206419..718394e943f 100644 --- a/src/test/run-pass/regions-copy-closure.rs +++ b/src/test/run-pass/regions-copy-closure.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct closure_box<'self> { - cl: 'self ||, +struct closure_box<'a> { + cl: 'a ||, } fn box_it<'r>(x: 'r ||) -> closure_box<'r> { diff --git a/src/test/run-pass/regions-creating-enums2.rs b/src/test/run-pass/regions-creating-enums2.rs index a9a6aa0c709..fa795c2c87b 100644 --- a/src/test/run-pass/regions-creating-enums2.rs +++ b/src/test/run-pass/regions-creating-enums2.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum ast<'self> { +enum ast<'a> { num(uint), - add(&'self ast<'self>, &'self ast<'self>) + add(&'a ast<'a>, &'a ast<'a>) } fn mk_add_ok<'r>(x: &'r ast<'r>, y: &'r ast<'r>) -> ast<'r> { diff --git a/src/test/run-pass/regions-creating-enums5.rs b/src/test/run-pass/regions-creating-enums5.rs index 380e6800299..a95199901d5 100644 --- a/src/test/run-pass/regions-creating-enums5.rs +++ b/src/test/run-pass/regions-creating-enums5.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum ast<'self> { +enum ast<'a> { num(uint), - add(&'self ast<'self>, &'self ast<'self>) + add(&'a ast<'a>, &'a ast<'a>) } fn mk_add_ok<'a>(x: &'a ast<'a>, y: &'a ast<'a>, _z: &ast) -> ast<'a> { diff --git a/src/test/run-pass/regions-infer-contravariance-due-to-ret.rs b/src/test/run-pass/regions-infer-contravariance-due-to-ret.rs index f07105cebed..7e328f3bb03 100644 --- a/src/test/run-pass/regions-infer-contravariance-due-to-ret.rs +++ b/src/test/run-pass/regions-infer-contravariance-due-to-ret.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct boxed_int<'self> { - f: &'self int, +struct boxed_int<'a> { + f: &'a int, } fn max<'r>(bi: &'r boxed_int, f: &'r int) -> int { diff --git a/src/test/run-pass/regions-mock-trans.rs b/src/test/run-pass/regions-mock-trans.rs index 2446fb2a94a..8cac6e8558f 100644 --- a/src/test/run-pass/regions-mock-trans.rs +++ b/src/test/run-pass/regions-mock-trans.rs @@ -14,13 +14,13 @@ use std::mem; struct arena(()); -struct Bcx<'self> { - fcx: &'self Fcx<'self> +struct Bcx<'a> { + fcx: &'a Fcx<'a> } -struct Fcx<'self> { - arena: &'self arena, - ccx: &'self Ccx +struct Fcx<'a> { + arena: &'a arena, + ccx: &'a Ccx } struct Ccx { diff --git a/src/test/run-pass/regions-nullary-variant.rs b/src/test/run-pass/regions-nullary-variant.rs index e842ed585be..784424ad54c 100644 --- a/src/test/run-pass/regions-nullary-variant.rs +++ b/src/test/run-pass/regions-nullary-variant.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum roption<'self> { - a, b(&'self uint) +enum roption<'a> { + a, b(&'a uint) } fn mk<'r>(cond: bool, ptr: &'r uint) -> roption<'r> { diff --git a/src/test/run-pass/regions-self-impls.rs b/src/test/run-pass/regions-self-impls.rs index ceff247b5dd..cc8174d0d32 100644 --- a/src/test/run-pass/regions-self-impls.rs +++ b/src/test/run-pass/regions-self-impls.rs @@ -8,16 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Clam<'self> { - chowder: &'self int +struct Clam<'a> { + chowder: &'a int } -trait get_chowder<'self> { - fn get_chowder(&self) -> &'self int; +trait get_chowder<'a> { + fn get_chowder(&self) -> &'a int; } -impl<'self> get_chowder<'self> for Clam<'self> { - fn get_chowder(&self) -> &'self int { return self.chowder; } +impl<'a> get_chowder<'a> for Clam<'a> { + fn get_chowder(&self) -> &'a int { return self.chowder; } } pub fn main() { diff --git a/src/test/run-pass/regions-self-in-enums.rs b/src/test/run-pass/regions-self-in-enums.rs index 1b429110e10..6e2d62cce92 100644 --- a/src/test/run-pass/regions-self-in-enums.rs +++ b/src/test/run-pass/regions-self-in-enums.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum int_wrapper<'self> { - int_wrapper_ctor(&'self int) +enum int_wrapper<'a> { + int_wrapper_ctor(&'a int) } pub fn main() { diff --git a/src/test/run-pass/regions-static-closure.rs b/src/test/run-pass/regions-static-closure.rs index 941f2c5edfd..9d994c423c9 100644 --- a/src/test/run-pass/regions-static-closure.rs +++ b/src/test/run-pass/regions-static-closure.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct closure_box<'self> { - cl: 'self ||, +struct closure_box<'a> { + cl: 'a ||, } fn box_it<'r>(x: 'r ||) -> closure_box<'r> { diff --git a/src/test/run-pass/struct-field-assignability.rs b/src/test/run-pass/struct-field-assignability.rs index 335e13caa14..86656b011dd 100644 --- a/src/test/run-pass/struct-field-assignability.rs +++ b/src/test/run-pass/struct-field-assignability.rs @@ -1,5 +1,5 @@ -struct Foo<'self> { - x: &'self int +struct Foo<'a> { + x: &'a int } pub fn main() { diff --git a/src/test/run-pass/unfold-cross-crate.rs b/src/test/run-pass/unfold-cross-crate.rs index 5f63968d59d..1c3eafb2032 100644 --- a/src/test/run-pass/unfold-cross-crate.rs +++ b/src/test/run-pass/unfold-cross-crate.rs @@ -10,7 +10,7 @@ use std::iter::Unfold; -// Unfold had a bug with 'self that mean it didn't work +// Unfold had a bug with 'a that mean it didn't work // cross-crate pub fn main() {

"); @@ -1628,8 +1628,8 @@ fn build_sidebar(m: &clean::Module) -> HashMap<~str, ~[~str]> { return map; } -impl<'self> fmt::Default for Source<'self> { - fn fmt(s: &Source<'self>, fmt: &mut fmt::Formatter) { +impl<'a> fmt::Default for Source<'a> { + fn fmt(s: &Source<'a>, fmt: &mut fmt::Formatter) { let lines = s.lines().len(); let mut cols = 0; let mut tmp = lines; diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs index 1ca9fb1e98c..d9c3cf80316 100644 --- a/src/librustdoc/passes.rs +++ b/src/librustdoc/passes.rs @@ -76,12 +76,12 @@ pub fn strip_private(crate: clean::Crate) -> plugins::PluginResult { (crate, None) } -struct Stripper<'self> { - retained: &'self mut HashSet, - exported_items: &'self HashSet, +struct Stripper<'a> { + retained: &'a mut HashSet, + exported_items: &'a HashSet, } -impl<'self> fold::DocFolder for Stripper<'self> { +impl<'a> fold::DocFolder for Stripper<'a> { fn fold_item(&mut self, i: Item) -> Option { match i.inner { // These items can all get re-exported @@ -150,8 +150,8 @@ impl<'self> fold::DocFolder for Stripper<'self> { } // This stripper discards all private impls of traits -struct ImplStripper<'self>(&'self HashSet); -impl<'self> fold::DocFolder for ImplStripper<'self> { +struct ImplStripper<'a>(&'a HashSet); +impl<'a> fold::DocFolder for ImplStripper<'a> { fn fold_item(&mut self, i: Item) -> Option { match i.inner { clean::ImplItem(ref imp) => { diff --git a/src/librustpkg/lib.rs b/src/librustpkg/lib.rs index 0526e7dd434..cedb21eeb2a 100644 --- a/src/librustpkg/lib.rs +++ b/src/librustpkg/lib.rs @@ -83,9 +83,9 @@ pub mod usage; /// A PkgScript represents user-supplied custom logic for /// special build hooks. This only exists for packages with /// an explicit package script. -struct PkgScript<'self> { +struct PkgScript<'a> { /// Uniquely identifies this package - id: &'self PkgId, + id: &'a PkgId, /// File path for the package script input: Path, /// The session to use *only* for compiling the custom @@ -99,7 +99,7 @@ struct PkgScript<'self> { build_dir: Path } -impl<'self> PkgScript<'self> { +impl<'a> PkgScript<'a> { /// Given the path name for a package script /// and a package ID, parse the package script into /// a PkgScript that we can then execute diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs index 97fba807c0e..ae490dc1f8a 100644 --- a/src/librustpkg/util.rs +++ b/src/librustpkg/util.rs @@ -427,18 +427,18 @@ pub fn compile_crate(ctxt: &BuildContext, compile_input(ctxt, exec, pkg_id, crate, workspace, deps, flags, cfgs, opt, what) } -struct ViewItemVisitor<'self> { - context: &'self BuildContext, - parent: &'self PkgId, - parent_crate: &'self Path, +struct ViewItemVisitor<'a> { + context: &'a BuildContext, + parent: &'a PkgId, + parent_crate: &'a Path, sess: session::Session, - exec: &'self mut workcache::Exec, - c: &'self ast::Crate, - save: 'self |Path|, - deps: &'self mut DepMap + exec: &'a mut workcache::Exec, + c: &'a ast::Crate, + save: 'a |Path|, + deps: &'a mut DepMap } -impl<'self> Visitor<()> for ViewItemVisitor<'self> { +impl<'a> Visitor<()> for ViewItemVisitor<'a> { fn visit_view_item(&mut self, vi: &ast::view_item, env: ()) { use conditions::nonexistent_package::cond; diff --git a/src/libstd/any.rs b/src/libstd/any.rs index 4133bb1835d..8bce687e245 100644 --- a/src/libstd/any.rs +++ b/src/libstd/any.rs @@ -65,16 +65,16 @@ impl Any for T { /////////////////////////////////////////////////////////////////////////////// /// Extension methods for a referenced `Any` trait object -pub trait AnyRefExt<'self> { +pub trait AnyRefExt<'a> { /// Returns true if the boxed type is the same as `T` fn is(self) -> bool; /// Returns some reference to the boxed value if it is of type `T`, or /// `None` if it isn't. - fn as_ref(self) -> Option<&'self T>; + fn as_ref(self) -> Option<&'a T>; } -impl<'self> AnyRefExt<'self> for &'self Any { +impl<'a> AnyRefExt<'a> for &'a Any { #[inline] fn is(self) -> bool { // Get TypeId of the type this function is instantiated with @@ -88,7 +88,7 @@ impl<'self> AnyRefExt<'self> for &'self Any { } #[inline] - fn as_ref(self) -> Option<&'self T> { + fn as_ref(self) -> Option<&'a T> { if self.is::() { Some(unsafe { transmute(self.as_void_ptr()) }) } else { @@ -98,15 +98,15 @@ impl<'self> AnyRefExt<'self> for &'self Any { } /// Extension methods for a mutable referenced `Any` trait object -pub trait AnyMutRefExt<'self> { +pub trait AnyMutRefExt<'a> { /// Returns some mutable reference to the boxed value if it is of type `T`, or /// `None` if it isn't. - fn as_mut(self) -> Option<&'self mut T>; + fn as_mut(self) -> Option<&'a mut T>; } -impl<'self> AnyMutRefExt<'self> for &'self mut Any { +impl<'a> AnyMutRefExt<'a> for &'a mut Any { #[inline] - fn as_mut(self) -> Option<&'self mut T> { + fn as_mut(self) -> Option<&'a mut T> { if self.is::() { Some(unsafe { transmute(self.as_mut_void_ptr()) }) } else { @@ -149,7 +149,7 @@ impl ToStr for ~Any { fn to_str(&self) -> ~str { ~"~Any" } } -impl<'self> ToStr for &'self Any { +impl<'a> ToStr for &'a Any { fn to_str(&self) -> ~str { ~"&Any" } } diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index c43b4e9b6ea..2242ded94f5 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -145,15 +145,15 @@ pub trait AsciiCast { fn is_ascii(&self) -> bool; } -impl<'self> AsciiCast<&'self[Ascii]> for &'self [u8] { +impl<'a> AsciiCast<&'a[Ascii]> for &'a [u8] { #[inline] - fn to_ascii(&self) -> &'self[Ascii] { + fn to_ascii(&self) -> &'a[Ascii] { assert!(self.is_ascii()); unsafe {self.to_ascii_nocheck()} } #[inline] - unsafe fn to_ascii_nocheck(&self) -> &'self[Ascii] { + unsafe fn to_ascii_nocheck(&self) -> &'a[Ascii] { cast::transmute(*self) } @@ -166,15 +166,15 @@ impl<'self> AsciiCast<&'self[Ascii]> for &'self [u8] { } } -impl<'self> AsciiCast<&'self [Ascii]> for &'self str { +impl<'a> AsciiCast<&'a [Ascii]> for &'a str { #[inline] - fn to_ascii(&self) -> &'self [Ascii] { + fn to_ascii(&self) -> &'a [Ascii] { assert!(self.is_ascii()); unsafe { self.to_ascii_nocheck() } } #[inline] - unsafe fn to_ascii_nocheck(&self) -> &'self [Ascii] { + unsafe fn to_ascii_nocheck(&self) -> &'a [Ascii] { cast::transmute(*self) } @@ -272,7 +272,7 @@ pub trait AsciiStr { fn eq_ignore_case(self, other: &[Ascii]) -> bool; } -impl<'self> AsciiStr for &'self [Ascii] { +impl<'a> AsciiStr for &'a [Ascii] { #[inline] fn as_str_ascii<'a>(&'a self) -> &'a str { unsafe { cast::transmute(*self) } @@ -351,7 +351,7 @@ pub trait StrAsciiExt { fn eq_ignore_ascii_case(&self, other: &str) -> bool; } -impl<'self> StrAsciiExt for &'self str { +impl<'a> StrAsciiExt for &'a str { #[inline] fn to_ascii_upper(&self) -> ~str { unsafe { str_copy_map_bytes(*self, ASCII_UPPER_MAP) } diff --git a/src/libstd/at_vec.rs b/src/libstd/at_vec.rs index 2b64c5c83fb..352d1abfb4b 100644 --- a/src/libstd/at_vec.rs +++ b/src/libstd/at_vec.rs @@ -153,7 +153,7 @@ pub mod traits { use ops::Add; use vec::Vector; - impl<'self,T:Clone, V: Vector> Add for @[T] { + impl<'a,T:Clone, V: Vector> Add for @[T] { #[inline] fn add(&self, rhs: &V) -> @[T] { append(*self, rhs.as_slice()) diff --git a/src/libstd/borrow.rs b/src/libstd/borrow.rs index 0626b3fc618..e8eda39537c 100644 --- a/src/libstd/borrow.rs +++ b/src/libstd/borrow.rs @@ -27,48 +27,48 @@ pub fn ref_eq<'a, 'b, T>(thing: &'a T, other: &'b T) -> bool { // Equality for region pointers #[cfg(not(test))] -impl<'self, T: Eq> Eq for &'self T { +impl<'a, T: Eq> Eq for &'a T { #[inline] - fn eq(&self, other: & &'self T) -> bool { + fn eq(&self, other: & &'a T) -> bool { *(*self) == *(*other) } #[inline] - fn ne(&self, other: & &'self T) -> bool { + fn ne(&self, other: & &'a T) -> bool { *(*self) != *(*other) } } // Comparison for region pointers #[cfg(not(test))] -impl<'self, T: Ord> Ord for &'self T { +impl<'a, T: Ord> Ord for &'a T { #[inline] - fn lt(&self, other: & &'self T) -> bool { + fn lt(&self, other: & &'a T) -> bool { *(*self) < *(*other) } #[inline] - fn le(&self, other: & &'self T) -> bool { + fn le(&self, other: & &'a T) -> bool { *(*self) <= *(*other) } #[inline] - fn ge(&self, other: & &'self T) -> bool { + fn ge(&self, other: & &'a T) -> bool { *(*self) >= *(*other) } #[inline] - fn gt(&self, other: & &'self T) -> bool { + fn gt(&self, other: & &'a T) -> bool { *(*self) > *(*other) } } #[cfg(not(test))] -impl<'self, T: TotalOrd> TotalOrd for &'self T { +impl<'a, T: TotalOrd> TotalOrd for &'a T { #[inline] - fn cmp(&self, other: & &'self T) -> Ordering { (**self).cmp(*other) } + fn cmp(&self, other: & &'a T) -> Ordering { (**self).cmp(*other) } } #[cfg(not(test))] -impl<'self, T: TotalEq> TotalEq for &'self T { +impl<'a, T: TotalEq> TotalEq for &'a T { #[inline] - fn equals(&self, other: & &'self T) -> bool { (**self).equals(*other) } + fn equals(&self, other: & &'a T) -> bool { (**self).equals(*other) } } #[cfg(test)] diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index 11845c766ed..1563b7f99d1 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -234,7 +234,7 @@ pub trait ToCStr { } } -impl<'self> ToCStr for &'self str { +impl<'a> ToCStr for &'a str { #[inline] fn to_c_str(&self) -> CString { self.as_bytes().to_c_str() @@ -259,7 +259,7 @@ impl<'self> ToCStr for &'self str { // The length of the stack allocated buffer for `vec.with_c_str()` static BUF_LEN: uint = 128; -impl<'self> ToCStr for &'self [u8] { +impl<'a> ToCStr for &'a [u8] { fn to_c_str(&self) -> CString { let mut cs = unsafe { self.to_c_str_unchecked() }; cs.with_mut_ref(|buf| check_for_null(*self, buf)); @@ -328,12 +328,12 @@ fn check_for_null(v: &[u8], buf: *mut libc::c_char) { /// External iterator for a CString's bytes. /// /// Use with the `std::iter` module. -pub struct CStringIterator<'self> { +pub struct CStringIterator<'a> { priv ptr: *libc::c_char, - priv lifetime: &'self libc::c_char, // FIXME: #5922 + priv lifetime: &'a libc::c_char, // FIXME: #5922 } -impl<'self> Iterator for CStringIterator<'self> { +impl<'a> Iterator for CStringIterator<'a> { fn next(&mut self) -> Option { let ch = unsafe { *self.ptr }; if ch == 0 { diff --git a/src/libstd/cleanup.rs b/src/libstd/cleanup.rs index 7c972ed86b4..7b01a5c1b81 100644 --- a/src/libstd/cleanup.rs +++ b/src/libstd/cleanup.rs @@ -15,7 +15,7 @@ use ptr; use unstable::intrinsics::TyDesc; use unstable::raw; -type DropGlue<'self> = 'self |**TyDesc, *c_void|; +type DropGlue<'a> = 'a |**TyDesc, *c_void|; /* * Box annihilation diff --git a/src/libstd/clone.rs b/src/libstd/clone.rs index 584963c36ca..95d75138082 100644 --- a/src/libstd/clone.rs +++ b/src/libstd/clone.rs @@ -64,22 +64,22 @@ impl Clone for @mut T { fn clone(&self) -> @mut T { *self } } -impl<'self, T> Clone for &'self T { +impl<'a, T> Clone for &'a T { /// Return a shallow copy of the borrowed pointer. #[inline] - fn clone(&self) -> &'self T { *self } + fn clone(&self) -> &'a T { *self } } -impl<'self, T> Clone for &'self [T] { +impl<'a, T> Clone for &'a [T] { /// Return a shallow copy of the slice. #[inline] - fn clone(&self) -> &'self [T] { *self } + fn clone(&self) -> &'a [T] { *self } } -impl<'self> Clone for &'self str { +impl<'a> Clone for &'a str { /// Return a shallow copy of the slice. #[inline] - fn clone(&self) -> &'self str { *self } + fn clone(&self) -> &'a str { *self } } macro_rules! clone_impl( diff --git a/src/libstd/condition.rs b/src/libstd/condition.rs index c5d6ce2f3df..df5154123f2 100644 --- a/src/libstd/condition.rs +++ b/src/libstd/condition.rs @@ -162,12 +162,12 @@ impl Condition { /// /// Normally this object is not dealt with directly, but rather it's directly /// used after being returned from `trap` -pub struct Trap<'self, T, U> { - priv cond: &'self Condition, +pub struct Trap<'a, T, U> { + priv cond: &'a Condition, priv handler: @Handler } -impl<'self, T, U> Trap<'self, T, U> { +impl<'a, T, U> Trap<'a, T, U> { /// Execute a block of code with this trap handler's exception handler /// registered. /// @@ -181,7 +181,7 @@ impl<'self, T, U> Trap<'self, T, U> { /// }); /// assert_eq!(result, 7); /// ``` - pub fn inside(&self, inner: 'self || -> V) -> V { + pub fn inside(&self, inner: 'a || -> V) -> V { let _g = Guard { cond: self.cond }; debug!("Trap: pushing handler to TLS"); local_data::set(self.cond.key, self.handler); @@ -191,7 +191,7 @@ impl<'self, T, U> Trap<'self, T, U> { /// Returns a guard that will automatically reset the condition upon /// exit of the scope. This is useful if you want to use conditions with /// an RAII pattern. - pub fn guard(&self) -> Guard<'self,T,U> { + pub fn guard(&self) -> Guard<'a,T,U> { let guard = Guard { cond: self.cond }; @@ -204,12 +204,12 @@ impl<'self, T, U> Trap<'self, T, U> { /// A guard that will automatically reset the condition handler upon exit of /// the scope. This is useful if you want to use conditions with an RAII /// pattern. -pub struct Guard<'self, T, U> { - priv cond: &'self Condition +pub struct Guard<'a, T, U> { + priv cond: &'a Condition } #[unsafe_destructor] -impl<'self, T, U> Drop for Guard<'self, T, U> { +impl<'a, T, U> Drop for Guard<'a, T, U> { fn drop(&mut self) { debug!("Guard: popping handler from TLS"); let curr = local_data::pop(self.cond.key); diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs index 463540b3677..a98a110ac3b 100644 --- a/src/libstd/fmt/mod.rs +++ b/src/libstd/fmt/mod.rs @@ -476,7 +476,7 @@ pub mod rt; /// A struct to represent both where to emit formatting strings to and how they /// should be formatted. A mutable version of this is passed to all formatting /// traits. -pub struct Formatter<'self> { +pub struct Formatter<'a> { /// Flags for formatting (packed version of rt::Flag) flags: uint, /// Character used as 'fill' whenever there is alignment @@ -489,21 +489,21 @@ pub struct Formatter<'self> { precision: Option, /// Output buffer. - buf: &'self mut io::Writer, - priv curarg: vec::VecIterator<'self, Argument<'self>>, - priv args: &'self [Argument<'self>], + buf: &'a mut io::Writer, + priv curarg: vec::VecIterator<'a, Argument<'a>>, + priv args: &'a [Argument<'a>], } /// This struct represents the generic "argument" which is taken by the Xprintf /// family of functions. It contains a function to format the given value. At /// compile time it is ensured that the function and the value have the correct /// types, and then this struct is used to canonicalize arguments to one type. -pub struct Argument<'self> { +pub struct Argument<'a> { priv formatter: extern "Rust" fn(&util::Void, &mut Formatter), - priv value: &'self util::Void, + priv value: &'a util::Void, } -impl<'self> Arguments<'self> { +impl<'a> Arguments<'a> { /// When using the format_args!() macro, this function is used to generate the /// Arguments structure. The compiler inserts an `unsafe` block to call this, /// which is valid because the compiler performs all necessary validation to @@ -524,9 +524,9 @@ impl<'self> Arguments<'self> { /// and pass it to a user-supplied function. The macro validates the format /// string at compile-time so usage of the `write` and `format` functions can /// be safely performed. -pub struct Arguments<'self> { - priv fmt: &'self [rt::Piece<'self>], - priv args: &'self [Argument<'self>], +pub struct Arguments<'a> { + priv fmt: &'a [rt::Piece<'a>], + priv args: &'a [Argument<'a>], } /// When a format is not otherwise specified, types are formatted by ascribing @@ -684,7 +684,7 @@ pub unsafe fn format_unsafe(fmt: &[rt::Piece], args: &[Argument]) -> ~str { return str::from_utf8_owned(output.inner()); } -impl<'self> Formatter<'self> { +impl<'a> Formatter<'a> { // First up is the collection of functions used to execute a format string // at runtime. This consumes all of the compile-time statics generated by @@ -988,7 +988,7 @@ impl Bool for bool { } } -impl<'self, T: str::Str> String for T { +impl<'a, T: str::Str> String for T { fn fmt(s: &T, f: &mut Formatter) { f.pad(s.as_slice()); } @@ -1111,7 +1111,7 @@ impl Pointer for *mut T { // Implementation of Default for various core types macro_rules! delegate(($ty:ty to $other:ident) => { - impl<'self> Default for $ty { + impl<'a> Default for $ty { fn fmt(me: &$ty, f: &mut Formatter) { $other::fmt(me, f) } @@ -1129,7 +1129,7 @@ delegate!( u32 to Unsigned) delegate!( u64 to Unsigned) delegate!(@str to String) delegate!(~str to String) -delegate!(&'self str to String) +delegate!(&'a str to String) delegate!(bool to Bool) delegate!(char to Char) delegate!(f32 to Float) diff --git a/src/libstd/fmt/parse.rs b/src/libstd/fmt/parse.rs index 6489ff79205..e9f7af181a7 100644 --- a/src/libstd/fmt/parse.rs +++ b/src/libstd/fmt/parse.rs @@ -24,31 +24,31 @@ condition! { pub parse_error: ~str -> (); } /// A piece is a portion of the format string which represents the next part to /// emit. These are emitted as a stream by the `Parser` class. #[deriving(Eq)] -pub enum Piece<'self> { +pub enum Piece<'a> { /// A literal string which should directly be emitted - String(&'self str), + String(&'a str), /// A back-reference to whatever the current argument is. This is used /// inside of a method call to refer back to the original argument. CurrentArgument, /// This describes that formatting should process the next argument (as /// specified inside) for emission. - Argument(Argument<'self>), + Argument(Argument<'a>), } /// Representation of an argument specification. #[deriving(Eq)] -pub struct Argument<'self> { +pub struct Argument<'a> { /// Where to find this argument - position: Position<'self>, + position: Position<'a>, /// How to format the argument - format: FormatSpec<'self>, + format: FormatSpec<'a>, /// If not `None`, what method to invoke on the argument - method: Option<~Method<'self>> + method: Option<~Method<'a>> } /// Specification for the formatting of an argument in the format string. #[deriving(Eq)] -pub struct FormatSpec<'self> { +pub struct FormatSpec<'a> { /// Optionally specified character to fill alignment with fill: Option, /// Optionally specified alignment @@ -56,20 +56,20 @@ pub struct FormatSpec<'self> { /// Packed version of various flags provided flags: uint, /// The integer precision to use - precision: Count<'self>, + precision: Count<'a>, /// The string width requested for the resulting format - width: Count<'self>, + width: Count<'a>, /// The descriptor string representing the name of the format desired for /// this argument, this can be empty or any number of characters, although /// it is required to be one word. - ty: &'self str + ty: &'a str } /// Enum describing where an argument for a format can be located. #[deriving(Eq)] #[allow(missing_doc)] -pub enum Position<'self> { - ArgumentNext, ArgumentIs(uint), ArgumentNamed(&'self str) +pub enum Position<'a> { + ArgumentNext, ArgumentIs(uint), ArgumentNamed(&'a str) } /// Enum of alignments which are supported. @@ -92,9 +92,9 @@ pub enum Flag { /// can reference either an argument or a literal integer. #[deriving(Eq)] #[allow(missing_doc)] -pub enum Count<'self> { +pub enum Count<'a> { CountIs(uint), - CountIsName(&'self str), + CountIsName(&'a str), CountIsParam(uint), CountIsNextParam, CountImplied, @@ -103,7 +103,7 @@ pub enum Count<'self> { /// Enum describing all of the possible methods which the formatting language /// currently supports. #[deriving(Eq)] -pub enum Method<'self> { +pub enum Method<'a> { /// A plural method selects on an integer over a list of either integer or /// keyword-defined clauses. The meaning of the keywords is defined by the /// current locale. @@ -113,23 +113,23 @@ pub enum Method<'self> { /// /// The final element of this enum is the default "other" case which is /// always required to be specified. - Plural(Option, ~[PluralArm<'self>], ~[Piece<'self>]), + Plural(Option, ~[PluralArm<'a>], ~[Piece<'a>]), /// A select method selects over a string. Each arm is a different string /// which can be selected for. /// /// As with `Plural`, a default "other" case is required as well. - Select(~[SelectArm<'self>], ~[Piece<'self>]), + Select(~[SelectArm<'a>], ~[Piece<'a>]), } /// Structure representing one "arm" of the `plural` function. #[deriving(Eq)] -pub struct PluralArm<'self> { +pub struct PluralArm<'a> { /// A selector can either be specified by a keyword or with an integer /// literal. selector: Either, /// Array of pieces which are the format of this arm - result: ~[Piece<'self>], + result: ~[Piece<'a>], } /// Enum of the 5 CLDR plural keywords. There is one more, "other", but that is @@ -144,11 +144,11 @@ pub enum PluralKeyword { /// Structure representing one "arm" of the `select` function. #[deriving(Eq)] -pub struct SelectArm<'self> { +pub struct SelectArm<'a> { /// String selector which guards this arm - selector: &'self str, + selector: &'a str, /// Array of pieces which are the format of this arm - result: ~[Piece<'self>], + result: ~[Piece<'a>], } /// The parser structure for interpreting the input format string. This is @@ -157,14 +157,14 @@ pub struct SelectArm<'self> { /// /// This is a recursive-descent parser for the sake of simplicity, and if /// necessary there's probably lots of room for improvement performance-wise. -pub struct Parser<'self> { - priv input: &'self str, - priv cur: str::CharOffsetIterator<'self>, +pub struct Parser<'a> { + priv input: &'a str, + priv cur: str::CharOffsetIterator<'a>, priv depth: uint, } -impl<'self> Iterator> for Parser<'self> { - fn next(&mut self) -> Option> { +impl<'a> Iterator> for Parser<'a> { + fn next(&mut self) -> Option> { match self.cur.clone().next() { Some((_, '#')) => { self.cur.next(); Some(CurrentArgument) } Some((_, '{')) => { @@ -191,7 +191,7 @@ impl<'self> Iterator> for Parser<'self> { } } -impl<'self> Parser<'self> { +impl<'a> Parser<'a> { /// Creates a new parser for the given format string pub fn new<'a>(s: &'a str) -> Parser<'a> { Parser { @@ -276,7 +276,7 @@ impl<'self> Parser<'self> { /// Parses all of a string which is to be considered a "raw literal" in a /// format string. This is everything outside of the braces. - fn string(&mut self, start: uint) -> &'self str { + fn string(&mut self, start: uint) -> &'a str { loop { // we may not consume the character, so clone the iterator match self.cur.clone().next() { @@ -295,7 +295,7 @@ impl<'self> Parser<'self> { /// Parses an Argument structure, or what's contained within braces inside /// the format string - fn argument(&mut self) -> Argument<'self> { + fn argument(&mut self) -> Argument<'a> { Argument { position: self.position(), format: self.format(), @@ -305,7 +305,7 @@ impl<'self> Parser<'self> { /// Parses a positional argument for a format. This could either be an /// integer index of an argument, a named argument, or a blank string. - fn position(&mut self) -> Position<'self> { + fn position(&mut self) -> Position<'a> { match self.integer() { Some(i) => { ArgumentIs(i) } None => { @@ -321,7 +321,7 @@ impl<'self> Parser<'self> { /// Parses a format specifier at the current position, returning all of the /// relevant information in the FormatSpec struct. - fn format(&mut self) -> FormatSpec<'self> { + fn format(&mut self) -> FormatSpec<'a> { let mut spec = FormatSpec { fill: None, align: AlignUnknown, @@ -396,7 +396,7 @@ impl<'self> Parser<'self> { /// Parses a method to be applied to the previously specified argument and /// its format. The two current supported methods are 'plural' and 'select' - fn method(&mut self) -> Option<~Method<'self>> { + fn method(&mut self) -> Option<~Method<'a>> { if !self.wsconsume(',') { return None; } @@ -422,7 +422,7 @@ impl<'self> Parser<'self> { } /// Parses a 'select' statement (after the initial 'select' word) - fn select(&mut self) -> ~Method<'self> { + fn select(&mut self) -> ~Method<'a> { let mut other = None; let mut arms = ~[]; // Consume arms one at a time @@ -464,7 +464,7 @@ impl<'self> Parser<'self> { } /// Parses a 'plural' statement (after the initial 'plural' word) - fn plural(&mut self) -> ~Method<'self> { + fn plural(&mut self) -> ~Method<'a> { let mut offset = None; let mut other = None; let mut arms = ~[]; @@ -564,7 +564,7 @@ impl<'self> Parser<'self> { /// Parses a Count parameter at the current position. This does not check /// for 'CountIsNextParam' because that is only used in precision, not /// width. - fn count(&mut self) -> Count<'self> { + fn count(&mut self) -> Count<'a> { match self.integer() { Some(i) => { if self.consume('$') { @@ -591,7 +591,7 @@ impl<'self> Parser<'self> { /// Parses a word starting at the current position. A word is considered to /// be an alphabetic character followed by any number of alphanumeric /// characters. - fn word(&mut self) -> &'self str { + fn word(&mut self) -> &'a str { let start = match self.cur.clone().next() { Some((pos, c)) if char::is_XID_start(c) => { self.cur.next(); diff --git a/src/libstd/fmt/rt.rs b/src/libstd/fmt/rt.rs index b20af1a35b8..c139a2f5734 100644 --- a/src/libstd/fmt/rt.rs +++ b/src/libstd/fmt/rt.rs @@ -21,17 +21,17 @@ use either::Either; use fmt::parse; use option::Option; -pub enum Piece<'self> { - String(&'self str), +pub enum Piece<'a> { + String(&'a str), // FIXME(#8259): this shouldn't require the unit-value here CurrentArgument(()), - Argument(Argument<'self>), + Argument(Argument<'a>), } -pub struct Argument<'self> { +pub struct Argument<'a> { position: Position, format: FormatSpec, - method: Option<&'self Method<'self>> + method: Option<&'a Method<'a>> } pub struct FormatSpec { @@ -50,17 +50,17 @@ pub enum Position { ArgumentNext, ArgumentIs(uint) } -pub enum Method<'self> { - Plural(Option, &'self [PluralArm<'self>], &'self [Piece<'self>]), - Select(&'self [SelectArm<'self>], &'self [Piece<'self>]), +pub enum Method<'a> { + Plural(Option, &'a [PluralArm<'a>], &'a [Piece<'a>]), + Select(&'a [SelectArm<'a>], &'a [Piece<'a>]), } -pub struct PluralArm<'self> { +pub struct PluralArm<'a> { selector: Either, - result: &'self [Piece<'self>], + result: &'a [Piece<'a>], } -pub struct SelectArm<'self> { - selector: &'self str, - result: &'self [Piece<'self>], +pub struct SelectArm<'a> { + selector: &'a str, + result: &'a [Piece<'a>], } diff --git a/src/libstd/hash.rs b/src/libstd/hash.rs index fd439eb05e2..a135d66141a 100644 --- a/src/libstd/hash.rs +++ b/src/libstd/hash.rs @@ -305,8 +305,8 @@ mod tests { use prelude::*; // Hash just the bytes of the slice, without length prefix - struct Bytes<'self>(&'self [u8]); - impl<'self> IterBytes for Bytes<'self> { + struct Bytes<'a>(&'a [u8]); + impl<'a> IterBytes for Bytes<'a> { fn iter_bytes(&self, _lsb0: bool, f: |&[u8]| -> bool) -> bool { f(**self) } diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs index e7eb8e60704..335e77c6478 100644 --- a/src/libstd/hashmap.rs +++ b/src/libstd/hashmap.rs @@ -521,13 +521,13 @@ impl Clone for HashMap { /// HashMap iterator #[deriving(Clone)] -pub struct HashMapIterator<'self, K, V> { - priv iter: vec::VecIterator<'self, Option>>, +pub struct HashMapIterator<'a, K, V> { + priv iter: vec::VecIterator<'a, Option>>, } /// HashMap mutable values iterator -pub struct HashMapMutIterator<'self, K, V> { - priv iter: vec::VecMutIterator<'self, Option>>, +pub struct HashMapMutIterator<'a, K, V> { + priv iter: vec::VecMutIterator<'a, Option>>, } /// HashMap move iterator @@ -537,8 +537,8 @@ pub struct HashMapMoveIterator { /// HashSet iterator #[deriving(Clone)] -pub struct HashSetIterator<'self, K> { - priv iter: vec::VecIterator<'self, Option>>, +pub struct HashSetIterator<'a, K> { + priv iter: vec::VecIterator<'a, Option>>, } /// HashSet move iterator @@ -546,9 +546,9 @@ pub struct HashSetMoveIterator { priv iter: vec::MoveRevIterator>>, } -impl<'self, K, V> Iterator<(&'self K, &'self V)> for HashMapIterator<'self, K, V> { +impl<'a, K, V> Iterator<(&'a K, &'a V)> for HashMapIterator<'a, K, V> { #[inline] - fn next(&mut self) -> Option<(&'self K, &'self V)> { + fn next(&mut self) -> Option<(&'a K, &'a V)> { for elt in self.iter { match elt { &Some(ref bucket) => return Some((&bucket.key, &bucket.value)), @@ -559,9 +559,9 @@ impl<'self, K, V> Iterator<(&'self K, &'self V)> for HashMapIterator<'self, K, V } } -impl<'self, K, V> Iterator<(&'self K, &'self mut V)> for HashMapMutIterator<'self, K, V> { +impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for HashMapMutIterator<'a, K, V> { #[inline] - fn next(&mut self) -> Option<(&'self K, &'self mut V)> { + fn next(&mut self) -> Option<(&'a K, &'a mut V)> { for elt in self.iter { match elt { &Some(ref mut bucket) => return Some((&bucket.key, &mut bucket.value)), @@ -585,9 +585,9 @@ impl Iterator<(K, V)> for HashMapMoveIterator { } } -impl<'self, K> Iterator<&'self K> for HashSetIterator<'self, K> { +impl<'a, K> Iterator<&'a K> for HashSetIterator<'a, K> { #[inline] - fn next(&mut self) -> Option<&'self K> { + fn next(&mut self) -> Option<&'a K> { for elt in self.iter { match elt { &Some(ref bucket) => return Some(&bucket.key), @@ -798,9 +798,9 @@ impl Default for HashSet { // `Repeat` is used to feed the filter closure an explicit capture // of a reference to the other set /// Set operations iterator -pub type SetAlgebraIter<'self, T> = - FilterMap<'static,(&'self HashSet, &'self T), &'self T, - Zip>,HashSetIterator<'self,T>>>; +pub type SetAlgebraIter<'a, T> = + FilterMap<'static,(&'a HashSet, &'a T), &'a T, + Zip>,HashSetIterator<'a,T>>>; #[cfg(test)] diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs index aa3eb9a8317..b6778d89c33 100644 --- a/src/libstd/io/mem.rs +++ b/src/libstd/io/mem.rs @@ -148,12 +148,12 @@ impl Decorator<~[u8]> for MemReader { /// /// If a write will not fit in the buffer, it raises the `io_error` /// condition and does not write any data. -pub struct BufWriter<'self> { - priv buf: &'self mut [u8], +pub struct BufWriter<'a> { + priv buf: &'a mut [u8], priv pos: uint } -impl<'self> BufWriter<'self> { +impl<'a> BufWriter<'a> { pub fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a> { BufWriter { buf: buf, @@ -162,7 +162,7 @@ impl<'self> BufWriter<'self> { } } -impl<'self> Writer for BufWriter<'self> { +impl<'a> Writer for BufWriter<'a> { fn write(&mut self, buf: &[u8]) { // raises a condition if the entire write does not fit in the buffer let max_size = self.buf.len(); @@ -182,7 +182,7 @@ impl<'self> Writer for BufWriter<'self> { } // FIXME(#10432) -impl<'self> Seek for BufWriter<'self> { +impl<'a> Seek for BufWriter<'a> { fn tell(&self) -> u64 { self.pos as u64 } fn seek(&mut self, pos: i64, style: SeekStyle) { @@ -199,12 +199,12 @@ impl<'self> Seek for BufWriter<'self> { /// Reads from a fixed-size byte slice -pub struct BufReader<'self> { - priv buf: &'self [u8], +pub struct BufReader<'a> { + priv buf: &'a [u8], priv pos: uint } -impl<'self> BufReader<'self> { +impl<'a> BufReader<'a> { pub fn new<'a>(buf: &'a [u8]) -> BufReader<'a> { BufReader { buf: buf, @@ -213,7 +213,7 @@ impl<'self> BufReader<'self> { } } -impl<'self> Reader for BufReader<'self> { +impl<'a> Reader for BufReader<'a> { fn read(&mut self, buf: &mut [u8]) -> Option { { if self.eof() { return None; } } @@ -233,13 +233,13 @@ impl<'self> Reader for BufReader<'self> { fn eof(&mut self) -> bool { self.pos == self.buf.len() } } -impl<'self> Seek for BufReader<'self> { +impl<'a> Seek for BufReader<'a> { fn tell(&self) -> u64 { self.pos as u64 } fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } } -impl<'self> Buffer for BufReader<'self> { +impl<'a> Buffer for BufReader<'a> { fn fill<'a>(&'a mut self) -> &'a [u8] { self.buf.slice_from(self.pos) } fn consume(&mut self, amt: uint) { self.pos += amt; } } diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 77bdf866338..393262aa1dd 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -811,7 +811,7 @@ impl Reader for ~Reader { fn eof(&mut self) -> bool { self.eof() } } -impl<'self> Reader for &'self mut Reader { +impl<'a> Reader for &'a mut Reader { fn read(&mut self, buf: &mut [u8]) -> Option { self.read(buf) } fn eof(&mut self) -> bool { self.eof() } } @@ -972,7 +972,7 @@ impl Writer for ~Writer { fn flush(&mut self) { self.flush() } } -impl<'self> Writer for &'self mut Writer { +impl<'a> Writer for &'a mut Writer { fn write(&mut self, buf: &[u8]) { self.write(buf) } fn flush(&mut self) { self.flush() } } @@ -1184,11 +1184,11 @@ pub trait Acceptor { /// The Some contains another Option representing whether the connection attempt was succesful. /// A successful connection will be wrapped in Some. /// A failed connection is represented as a None and raises a condition. -struct IncomingIterator<'self, A> { - priv inc: &'self mut A, +struct IncomingIterator<'a, A> { + priv inc: &'a mut A, } -impl<'self, T, A: Acceptor> Iterator> for IncomingIterator<'self, A> { +impl<'a, T, A: Acceptor> Iterator> for IncomingIterator<'a, A> { fn next(&mut self) -> Option> { Some(self.inc.accept()) } diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 6a97a21673d..b4d14b57efc 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -62,14 +62,14 @@ impl ToStr for SocketAddr { } } -struct Parser<'self> { +struct Parser<'a> { // parsing as ASCII, so can use byte array - s: &'self [u8], + s: &'a [u8], pos: uint, } -impl<'self> Parser<'self> { - fn new(s: &'self str) -> Parser<'self> { +impl<'a> Parser<'a> { + fn new(s: &'a str) -> Parser<'a> { Parser { s: s.as_bytes(), pos: 0, diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 1c86ac84bbb..001faa1ecaf 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -33,20 +33,20 @@ pub struct Process { /// This configuration describes how a new process should be spawned. This is /// translated to libuv's own configuration -pub struct ProcessConfig<'self> { +pub struct ProcessConfig<'a> { /// Path to the program to run - program: &'self str, + program: &'a str, /// Arguments to pass to the program (doesn't include the program itself) - args: &'self [~str], + args: &'a [~str], /// Optional environment to specify for the program. If this is None, then /// it will inherit the current process's environment. - env: Option<&'self [(~str, ~str)]>, + env: Option<&'a [(~str, ~str)]>, /// Optional working directory for the new process. If this is None, then /// the current directory of the running process is inherited. - cwd: Option<&'self str>, + cwd: Option<&'a str>, /// Any number of streams/file descriptors/pipes may be attached to this /// process. This list enumerates the file descriptors and such for the @@ -58,7 +58,7 @@ pub struct ProcessConfig<'self> { /// 0 - stdin /// 1 - stdout /// 2 - stderr - io: &'self [StdioContainer] + io: &'a [StdioContainer] } /// Describes what to do with a standard io stream for a child process. diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index 8cebc49be7c..3a7f8ab8629 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -691,7 +691,7 @@ pub trait MutableDoubleEndedIterator { fn reverse_(&mut self); } -impl<'self, A, T: DoubleEndedIterator<&'self mut A>> MutableDoubleEndedIterator for T { +impl<'a, A, T: DoubleEndedIterator<&'a mut A>> MutableDoubleEndedIterator for T { // FIXME: #5898: should be called `reverse` /// Use an iterator to reverse a container in-place fn reverse_(&mut self) { @@ -754,9 +754,9 @@ pub trait ExactSize : DoubleEndedIterator { // All adaptors that preserve the size of the wrapped iterator are fine // Adaptors that may overflow in `size_hint` are not, i.e. `Chain`. impl> ExactSize<(uint, A)> for Enumerate {} -impl<'self, A, T: ExactSize> ExactSize for Inspect<'self, A, T> {} +impl<'a, A, T: ExactSize> ExactSize for Inspect<'a, A, T> {} impl> ExactSize for Invert {} -impl<'self, A, B, T: ExactSize> ExactSize for Map<'self, A, B, T> {} +impl<'a, A, B, T: ExactSize> ExactSize for Map<'a, A, B, T> {} impl, U: ExactSize> ExactSize<(A, B)> for Zip {} /// An double-ended iterator with the direction inverted @@ -788,17 +788,17 @@ impl + RandomAccessIterator> RandomAccessIterato } /// A mutable reference to an iterator -pub struct ByRef<'self, T> { - priv iter: &'self mut T +pub struct ByRef<'a, T> { + priv iter: &'a mut T } -impl<'self, A, T: Iterator> Iterator for ByRef<'self, T> { +impl<'a, A, T: Iterator> Iterator for ByRef<'a, T> { #[inline] fn next(&mut self) -> Option { self.iter.next() } // FIXME: #9629 we cannot implement &self methods like size_hint on ByRef } -impl<'self, A, T: DoubleEndedIterator> DoubleEndedIterator for ByRef<'self, T> { +impl<'a, A, T: DoubleEndedIterator> DoubleEndedIterator for ByRef<'a, T> { #[inline] fn next_back(&mut self) -> Option { self.iter.next_back() } } @@ -1121,12 +1121,12 @@ RandomAccessIterator<(A, B)> for Zip { } /// An iterator which maps the values of `iter` with `f` -pub struct Map<'self, A, B, T> { +pub struct Map<'a, A, B, T> { priv iter: T, - priv f: 'self |A| -> B + priv f: 'a |A| -> B } -impl<'self, A, B, T> Map<'self, A, B, T> { +impl<'a, A, B, T> Map<'a, A, B, T> { #[inline] fn do_map(&self, elt: Option) -> Option { match elt { @@ -1136,7 +1136,7 @@ impl<'self, A, B, T> Map<'self, A, B, T> { } } -impl<'self, A, B, T: Iterator> Iterator for Map<'self, A, B, T> { +impl<'a, A, B, T: Iterator> Iterator for Map<'a, A, B, T> { #[inline] fn next(&mut self) -> Option { let next = self.iter.next(); @@ -1149,7 +1149,7 @@ impl<'self, A, B, T: Iterator> Iterator for Map<'self, A, B, T> { } } -impl<'self, A, B, T: DoubleEndedIterator> DoubleEndedIterator for Map<'self, A, B, T> { +impl<'a, A, B, T: DoubleEndedIterator> DoubleEndedIterator for Map<'a, A, B, T> { #[inline] fn next_back(&mut self) -> Option { let next = self.iter.next_back(); @@ -1157,7 +1157,7 @@ impl<'self, A, B, T: DoubleEndedIterator> DoubleEndedIterator for Map<'sel } } -impl<'self, A, B, T: RandomAccessIterator> RandomAccessIterator for Map<'self, A, B, T> { +impl<'a, A, B, T: RandomAccessIterator> RandomAccessIterator for Map<'a, A, B, T> { #[inline] fn indexable(&self) -> uint { self.iter.indexable() @@ -1170,12 +1170,12 @@ impl<'self, A, B, T: RandomAccessIterator> RandomAccessIterator for Map<'s } /// An iterator which filters the elements of `iter` with `predicate` -pub struct Filter<'self, A, T> { +pub struct Filter<'a, A, T> { priv iter: T, - priv predicate: 'self |&A| -> bool + priv predicate: 'a |&A| -> bool } -impl<'self, A, T: Iterator> Iterator for Filter<'self, A, T> { +impl<'a, A, T: Iterator> Iterator for Filter<'a, A, T> { #[inline] fn next(&mut self) -> Option { for x in self.iter { @@ -1195,7 +1195,7 @@ impl<'self, A, T: Iterator> Iterator for Filter<'self, A, T> { } } -impl<'self, A, T: DoubleEndedIterator> DoubleEndedIterator for Filter<'self, A, T> { +impl<'a, A, T: DoubleEndedIterator> DoubleEndedIterator for Filter<'a, A, T> { #[inline] fn next_back(&mut self) -> Option { loop { @@ -1214,12 +1214,12 @@ impl<'self, A, T: DoubleEndedIterator> DoubleEndedIterator for Filter<'sel } /// An iterator which uses `f` to both filter and map elements from `iter` -pub struct FilterMap<'self, A, B, T> { +pub struct FilterMap<'a, A, B, T> { priv iter: T, - priv f: 'self |A| -> Option + priv f: 'a |A| -> Option } -impl<'self, A, B, T: Iterator> Iterator for FilterMap<'self, A, B, T> { +impl<'a, A, B, T: Iterator> Iterator for FilterMap<'a, A, B, T> { #[inline] fn next(&mut self) -> Option { for x in self.iter { @@ -1238,8 +1238,8 @@ impl<'self, A, B, T: Iterator> Iterator for FilterMap<'self, A, B, T> { } } -impl<'self, A, B, T: DoubleEndedIterator> DoubleEndedIterator -for FilterMap<'self, A, B, T> { +impl<'a, A, B, T: DoubleEndedIterator> DoubleEndedIterator +for FilterMap<'a, A, B, T> { #[inline] fn next_back(&mut self) -> Option { loop { @@ -1340,11 +1340,11 @@ impl> Iterator for Peekable { } } -impl<'self, A, T: Iterator> Peekable { +impl<'a, A, T: Iterator> Peekable { /// Return a reference to the next element of the iterator with out advancing it, /// or None if the iterator is exhausted. #[inline] - pub fn peek(&'self mut self) -> Option<&'self A> { + pub fn peek(&'a mut self) -> Option<&'a A> { if self.peeked.is_none() { self.peeked = self.iter.next(); } @@ -1356,13 +1356,13 @@ impl<'self, A, T: Iterator> Peekable { } /// An iterator which rejects elements while `predicate` is true -pub struct SkipWhile<'self, A, T> { +pub struct SkipWhile<'a, A, T> { priv iter: T, priv flag: bool, - priv predicate: 'self |&A| -> bool + priv predicate: 'a |&A| -> bool } -impl<'self, A, T: Iterator> Iterator for SkipWhile<'self, A, T> { +impl<'a, A, T: Iterator> Iterator for SkipWhile<'a, A, T> { #[inline] fn next(&mut self) -> Option { let mut next = self.iter.next(); @@ -1394,13 +1394,13 @@ impl<'self, A, T: Iterator> Iterator for SkipWhile<'self, A, T> { } /// An iterator which only accepts elements while `predicate` is true -pub struct TakeWhile<'self, A, T> { +pub struct TakeWhile<'a, A, T> { priv iter: T, priv flag: bool, - priv predicate: 'self |&A| -> bool + priv predicate: 'a |&A| -> bool } -impl<'self, A, T: Iterator> Iterator for TakeWhile<'self, A, T> { +impl<'a, A, T: Iterator> Iterator for TakeWhile<'a, A, T> { #[inline] fn next(&mut self) -> Option { if self.flag { @@ -1542,15 +1542,15 @@ impl> RandomAccessIterator for Take { /// An iterator to maintain state while iterating another iterator -pub struct Scan<'self, A, B, T, St> { +pub struct Scan<'a, A, B, T, St> { priv iter: T, - priv f: 'self |&mut St, A| -> Option, + priv f: 'a |&mut St, A| -> Option, /// The current internal state to be passed to the closure next. state: St } -impl<'self, A, B, T: Iterator, St> Iterator for Scan<'self, A, B, T, St> { +impl<'a, A, B, T: Iterator, St> Iterator for Scan<'a, A, B, T, St> { #[inline] fn next(&mut self) -> Option { self.iter.next().and_then(|a| (self.f)(&mut self.state, a)) @@ -1566,14 +1566,14 @@ impl<'self, A, B, T: Iterator, St> Iterator for Scan<'self, A, B, T, St> { /// An iterator that maps each element to an iterator, /// and yields the elements of the produced iterators /// -pub struct FlatMap<'self, A, T, U> { +pub struct FlatMap<'a, A, T, U> { priv iter: T, - priv f: 'self |A| -> U, + priv f: 'a |A| -> U, priv frontiter: Option, priv backiter: Option, } -impl<'self, A, T: Iterator, B, U: Iterator> Iterator for FlatMap<'self, A, T, U> { +impl<'a, A, T: Iterator, B, U: Iterator> Iterator for FlatMap<'a, A, T, U> { #[inline] fn next(&mut self) -> Option { loop { @@ -1601,10 +1601,10 @@ impl<'self, A, T: Iterator, B, U: Iterator> Iterator for FlatMap<'self, } } -impl<'self, +impl<'a, A, T: DoubleEndedIterator, B, U: DoubleEndedIterator> DoubleEndedIterator - for FlatMap<'self, A, T, U> { + for FlatMap<'a, A, T, U> { #[inline] fn next_back(&mut self) -> Option { loop { @@ -1697,12 +1697,12 @@ impl Fuse { /// An iterator that calls a function with a reference to each /// element before yielding it. -pub struct Inspect<'self, A, T> { +pub struct Inspect<'a, A, T> { priv iter: T, - priv f: 'self |&A| + priv f: 'a |&A| } -impl<'self, A, T> Inspect<'self, A, T> { +impl<'a, A, T> Inspect<'a, A, T> { #[inline] fn do_inspect(&self, elt: Option) -> Option { match elt { @@ -1714,7 +1714,7 @@ impl<'self, A, T> Inspect<'self, A, T> { } } -impl<'self, A, T: Iterator> Iterator for Inspect<'self, A, T> { +impl<'a, A, T: Iterator> Iterator for Inspect<'a, A, T> { #[inline] fn next(&mut self) -> Option { let next = self.iter.next(); @@ -1727,8 +1727,8 @@ impl<'self, A, T: Iterator> Iterator for Inspect<'self, A, T> { } } -impl<'self, A, T: DoubleEndedIterator> DoubleEndedIterator -for Inspect<'self, A, T> { +impl<'a, A, T: DoubleEndedIterator> DoubleEndedIterator +for Inspect<'a, A, T> { #[inline] fn next_back(&mut self) -> Option { let next = self.iter.next_back(); @@ -1736,8 +1736,8 @@ for Inspect<'self, A, T> { } } -impl<'self, A, T: RandomAccessIterator> RandomAccessIterator -for Inspect<'self, A, T> { +impl<'a, A, T: RandomAccessIterator> RandomAccessIterator +for Inspect<'a, A, T> { #[inline] fn indexable(&self) -> uint { self.iter.indexable() @@ -1750,13 +1750,13 @@ for Inspect<'self, A, T> { } /// An iterator which just modifies the contained state throughout iteration. -pub struct Unfold<'self, A, St> { - priv f: 'self |&mut St| -> Option, +pub struct Unfold<'a, A, St> { + priv f: 'a |&mut St| -> Option, /// Internal state that will be yielded on the next iteration state: St } -impl<'self, A, St> Unfold<'self, A, St> { +impl<'a, A, St> Unfold<'a, A, St> { /// Creates a new iterator with the specified closure as the "iterator /// function" and an initial state to eventually pass to the iterator #[inline] @@ -1769,7 +1769,7 @@ impl<'self, A, St> Unfold<'self, A, St> { } } -impl<'self, A, St> Iterator for Unfold<'self, A, St> { +impl<'a, A, St> Iterator for Unfold<'a, A, St> { #[inline] fn next(&mut self) -> Option { (self.f)(&mut self.state) diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 303bb470991..53948dc8309 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -523,18 +523,18 @@ pub trait GenericPathUnsafe { } /// Helper struct for printing paths with format!() -pub struct Display<'self, P> { - priv path: &'self P, +pub struct Display<'a, P> { + priv path: &'a P, priv filename: bool } -impl<'self, P: GenericPath> fmt::Default for Display<'self, P> { +impl<'a, P: GenericPath> fmt::Default for Display<'a, P> { fn fmt(d: &Display