Make 'self lifetime illegal.

Also remove all instances of 'self within the codebase.

This fixes #10889.
This commit is contained in:
Erik Price 2013-12-09 23:16:18 -08:00
parent d441c54688
commit 5731ca3078
187 changed files with 1290 additions and 1277 deletions

View file

@ -1239,9 +1239,9 @@ static BIT2: uint = 1 << 1;
static BITS: [uint, ..2] = [BIT1, BIT2]; static BITS: [uint, ..2] = [BIT1, BIT2];
static STRING: &'static str = "bitstring"; static STRING: &'static str = "bitstring";
struct BitsNStrings<'self> { struct BitsNStrings<'a> {
mybits: [uint, ..2], mybits: [uint, ..2],
mystring: &'self str mystring: &'a str
} }
static bits_n_strings: BitsNStrings<'static> = BitsNStrings { 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 Point { x: f64, y: f64 }
# struct TuplePoint(f64, 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: T) {} # struct Cookie; fn some_fn<T>(t: T) {}
Point {x: 10.0, y: 20.0}; Point {x: 10.0, y: 20.0};
TuplePoint(10.0, 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: 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 p: Pair<'static> = (10,"hello");
let (a, b) = p; let (a, b) = p;
assert!(b != "world"); assert!(b != "world");
@ -3220,7 +3220,7 @@ fn add(x: int, y: int) -> int {
let mut x = add(5,7); let mut x = add(5,7);
type Binop<'self> = 'self |int,int| -> int; type Binop<'a> = 'a |int,int| -> int;
let bo: Binop = add; let bo: Binop = add;
x = bo(5,7); x = bo(5,7);
~~~~ ~~~~

View file

@ -49,13 +49,13 @@ use std::task;
use std::borrow; use std::borrow;
/// As sync::condvar, a mechanism for unlock-and-descheduling and signaling. /// As sync::condvar, a mechanism for unlock-and-descheduling and signaling.
pub struct Condvar<'self> { pub struct Condvar<'a> {
priv is_mutex: bool, priv is_mutex: bool,
priv failed: &'self mut bool, priv failed: &'a mut bool,
priv cond: &'self sync::Condvar<'self> 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. /// Atomically exit the associated Arc and block until a signal is sent.
#[inline] #[inline]
pub fn wait(&self) { self.wait_on(0) } pub fn wait(&self) { self.wait_on(0) }
@ -523,19 +523,19 @@ fn borrow_rwlock<T:Freeze + Send>(state: *mut RWArcInner<T>) -> *RWLock {
} }
/// The "write permission" token used for RWArc.write_downgrade(). /// The "write permission" token used for RWArc.write_downgrade().
pub struct RWWriteMode<'self, T> { pub struct RWWriteMode<'a, T> {
priv data: &'self mut T, priv data: &'a mut T,
priv token: sync::RWLockWriteMode<'self>, priv token: sync::RWLockWriteMode<'a>,
priv poison: PoisonOnFail, priv poison: PoisonOnFail,
} }
/// The "read permission" token used for RWArc.write_downgrade(). /// The "read permission" token used for RWArc.write_downgrade().
pub struct RWReadMode<'self, T> { pub struct RWReadMode<'a, T> {
priv data: &'self T, priv data: &'a T,
priv token: sync::RWLockReadMode<'self>, 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. /// Access the pre-downgrade RWArc in write mode.
pub fn write<U>(&mut self, blk: |x: &mut T| -> U) -> U { pub fn write<U>(&mut self, blk: |x: &mut T| -> U) -> U {
match *self { 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. /// Access the post-downgrade rwlock in read mode.
pub fn read<U>(&self, blk: |x: &T| -> U) -> U { pub fn read<U>(&self, blk: |x: &T| -> U) -> U {
match *self { match *self {

View file

@ -56,7 +56,7 @@ pub trait ToBase64 {
fn to_base64(&self, config: Config) -> ~str; 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. * Turn a vector of `u8` bytes into a base64 string.
* *
@ -157,7 +157,7 @@ pub trait FromBase64 {
fn from_base64(&self) -> Result<~[u8], ~str>; 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 `~`) * Convert any base64 encoded string (literal, `@`, `&`, or `~`)
* to the byte values it encodes. * to the byte values it encodes.

View file

@ -578,13 +578,13 @@ fn iterate_bits(base: uint, bits: uint, f: |uint| -> bool) -> bool {
} }
/// An iterator for `Bitv`. /// An iterator for `Bitv`.
pub struct BitvIterator<'self> { pub struct BitvIterator<'a> {
priv bitv: &'self Bitv, priv bitv: &'a Bitv,
priv next_idx: uint, priv next_idx: uint,
priv end_idx: uint, priv end_idx: uint,
} }
impl<'self> Iterator<bool> for BitvIterator<'self> { impl<'a> Iterator<bool> for BitvIterator<'a> {
#[inline] #[inline]
fn next(&mut self) -> Option<bool> { fn next(&mut self) -> Option<bool> {
if self.next_idx != self.end_idx { if self.next_idx != self.end_idx {
@ -602,7 +602,7 @@ impl<'self> Iterator<bool> for BitvIterator<'self> {
} }
} }
impl<'self> DoubleEndedIterator<bool> for BitvIterator<'self> { impl<'a> DoubleEndedIterator<bool> for BitvIterator<'a> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<bool> { fn next_back(&mut self) -> Option<bool> {
if self.next_idx != self.end_idx { if self.next_idx != self.end_idx {
@ -614,9 +614,9 @@ impl<'self> DoubleEndedIterator<bool> for BitvIterator<'self> {
} }
} }
impl<'self> ExactSize<bool> for BitvIterator<'self> {} impl<'a> ExactSize<bool> for BitvIterator<'a> {}
impl<'self> RandomAccessIterator<bool> for BitvIterator<'self> { impl<'a> RandomAccessIterator<bool> for BitvIterator<'a> {
#[inline] #[inline]
fn indexable(&self) -> uint { fn indexable(&self) -> uint {
self.end_idx - self.next_idx self.end_idx - self.next_idx
@ -903,12 +903,12 @@ impl BitvSet {
} }
} }
pub struct BitvSetIterator<'self> { pub struct BitvSetIterator<'a> {
priv set: &'self BitvSet, priv set: &'a BitvSet,
priv next_idx: uint priv next_idx: uint
} }
impl<'self> Iterator<uint> for BitvSetIterator<'self> { impl<'a> Iterator<uint> for BitvSetIterator<'a> {
#[inline] #[inline]
fn next(&mut self) -> Option<uint> { fn next(&mut self) -> Option<uint> {
while self.next_idx < self.set.capacity() { while self.next_idx < self.set.capacity() {

View file

@ -48,15 +48,15 @@ struct Node<T> {
/// Double-ended DList iterator /// Double-ended DList iterator
#[deriving(Clone)] #[deriving(Clone)]
pub struct DListIterator<'self, T> { pub struct DListIterator<'a, T> {
priv head: &'self Link<T>, priv head: &'a Link<T>,
priv tail: Rawlink<Node<T>>, priv tail: Rawlink<Node<T>>,
priv nelem: uint, priv nelem: uint,
} }
/// Double-ended mutable DList iterator /// Double-ended mutable DList iterator
pub struct MutDListIterator<'self, T> { pub struct MutDListIterator<'a, T> {
priv list: &'self mut DList<T>, priv list: &'a mut DList<T>,
priv head: Rawlink<Node<T>>, priv head: Rawlink<Node<T>>,
priv tail: Rawlink<Node<T>>, priv tail: Rawlink<Node<T>>,
priv nelem: uint, priv nelem: uint,
@ -439,9 +439,9 @@ impl<T> Drop for DList<T> {
} }
impl<'self, A> Iterator<&'self A> for DListIterator<'self, A> { impl<'a, A> Iterator<&'a A> for DListIterator<'a, A> {
#[inline] #[inline]
fn next(&mut self) -> Option<&'self A> { fn next(&mut self) -> Option<&'a A> {
if self.nelem == 0 { if self.nelem == 0 {
return None; 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] #[inline]
fn next_back(&mut self) -> Option<&'self A> { fn next_back(&mut self) -> Option<&'a A> {
if self.nelem == 0 { if self.nelem == 0 {
return None; 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] #[inline]
fn next(&mut self) -> Option<&'self mut A> { fn next(&mut self) -> Option<&'a mut A> {
if self.nelem == 0 { if self.nelem == 0 {
return None; 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] #[inline]
fn next_back(&mut self) -> Option<&'self mut A> { fn next_back(&mut self) -> Option<&'a mut A> {
if self.nelem == 0 { if self.nelem == 0 {
return None; 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 /// Allow mutating the DList while iterating
pub trait ListInsertion<A> { pub trait ListInsertion<A> {
@ -525,7 +525,7 @@ pub trait ListInsertion<A> {
} }
// private methods for MutDListIterator // 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<A>) { fn insert_next_node(&mut self, mut ins_node: ~Node<A>) {
// Insert before `self.head` so that it is between the // Insert before `self.head` so that it is between the
// previously yielded element and self.head. // previously yielded element and self.head.
@ -547,7 +547,7 @@ impl<'self, A> MutDListIterator<'self, A> {
} }
} }
impl<'self, A> ListInsertion<A> for MutDListIterator<'self, A> { impl<'a, A> ListInsertion<A> for MutDListIterator<'a, A> {
#[inline] #[inline]
fn insert_next(&mut self, elt: A) { fn insert_next(&mut self, elt: A) {
self.insert_next_node(~Node::new(elt)) self.insert_next_node(~Node::new(elt))

View file

@ -21,7 +21,7 @@ pub trait ToHex {
static CHARS: &'static[u8] = bytes!("0123456789abcdef"); 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. * Turn a vector of `u8` bytes into a hexadecimal string.
* *
@ -57,7 +57,7 @@ pub trait FromHex {
fn from_hex(&self) -> Result<~[u8], ~str>; 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 `~`) * Convert any hexadecimal encoded string (literal, `@`, `&`, or `~`)
* to the byte values it encodes. * to the byte values it encodes.

View file

@ -84,11 +84,11 @@ fn spaces(n: uint) -> ~str {
} }
/// A structure for implementing serialization to JSON. /// A structure for implementing serialization to JSON.
pub struct Encoder<'self> { pub struct Encoder<'a> {
priv wr: &'self mut io::Writer, 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 /// Creates a new JSON encoder whose output will be written to the writer
/// specified. /// specified.
pub fn new<'a>(wr: &'a mut io::Writer) -> Encoder<'a> { 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_nil(&mut self) { write!(self.wr, "null") }
fn emit_uint(&mut self, v: uint) { self.emit_f64(v as f64); } 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)) 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, fn emit_enum_variant(&mut self,
name: &str, name: &str,
_id: uint, _id: uint,
cnt: uint, cnt: uint,
f: |&mut Encoder<'self>|) { f: |&mut Encoder<'a>|) {
// enums are encoded as strings or objects // enums are encoded as strings or objects
// Bunny => "Bunny" // Bunny => "Bunny"
// Kangaroo(34,"William") => {"variant": "Kangaroo", "fields": [34,"William"]} // 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 { if idx != 0 {
write!(self.wr, ","); write!(self.wr, ",");
} }
@ -161,18 +161,18 @@ impl<'self> serialize::Encoder for Encoder<'self> {
name: &str, name: &str,
id: uint, id: uint,
cnt: uint, cnt: uint,
f: |&mut Encoder<'self>|) { f: |&mut Encoder<'a>|) {
self.emit_enum_variant(name, id, cnt, f) self.emit_enum_variant(name, id, cnt, f)
} }
fn emit_enum_struct_variant_field(&mut self, fn emit_enum_struct_variant_field(&mut self,
_: &str, _: &str,
idx: uint, idx: uint,
f: |&mut Encoder<'self>|) { f: |&mut Encoder<'a>|) {
self.emit_enum_variant_arg(idx, f) 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"\{"); write!(self.wr, r"\{");
f(self); f(self);
write!(self.wr, r"\}"); write!(self.wr, r"\}");
@ -181,58 +181,58 @@ impl<'self> serialize::Encoder for Encoder<'self> {
fn emit_struct_field(&mut self, fn emit_struct_field(&mut self,
name: &str, name: &str,
idx: uint, idx: uint,
f: |&mut Encoder<'self>|) { f: |&mut Encoder<'a>|) {
if idx != 0 { write!(self.wr, ",") } if idx != 0 { write!(self.wr, ",") }
write!(self.wr, "{}:", escape_str(name)); write!(self.wr, "{}:", escape_str(name));
f(self); 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) 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) self.emit_seq_elt(idx, f)
} }
fn emit_tuple_struct(&mut self, fn emit_tuple_struct(&mut self,
_name: &str, _name: &str,
len: uint, len: uint,
f: |&mut Encoder<'self>|) { f: |&mut Encoder<'a>|) {
self.emit_seq(len, f) 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) 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_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, "["); write!(self.wr, "[");
f(self); f(self);
write!(self.wr, "]"); 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 { if idx != 0 {
write!(self.wr, ","); write!(self.wr, ",");
} }
f(self) 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"\{"); write!(self.wr, r"\{");
f(self); f(self);
write!(self.wr, r"\}"); 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, ",") } if idx != 0 { write!(self.wr, ",") }
f(self) 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, ":"); write!(self.wr, ":");
f(self) 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 /// Another encoder for JSON, but prints out human-readable JSON instead of
/// compact data /// compact data
pub struct PrettyEncoder<'self> { pub struct PrettyEncoder<'a> {
priv wr: &'self mut io::Writer, priv wr: &'a mut io::Writer,
priv indent: uint, priv indent: uint,
} }
impl<'self> PrettyEncoder<'self> { impl<'a> PrettyEncoder<'a> {
/// Creates a new encoder whose output will be written to the specified writer /// Creates a new encoder whose output will be written to the specified writer
pub fn new<'a>(wr: &'a mut io::Writer) -> PrettyEncoder<'a> { pub fn new<'a>(wr: &'a mut io::Writer) -> PrettyEncoder<'a> {
PrettyEncoder { 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_nil(&mut self) { write!(self.wr, "null") }
fn emit_uint(&mut self, v: uint) { self.emit_f64(v as f64); } 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_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_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) f(self)
} }
@ -294,7 +294,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> {
name: &str, name: &str,
_: uint, _: uint,
cnt: uint, cnt: uint,
f: |&mut PrettyEncoder<'self>|) { f: |&mut PrettyEncoder<'a>|) {
if cnt == 0 { if cnt == 0 {
write!(self.wr, "{}", escape_str(name)); write!(self.wr, "{}", escape_str(name));
} else { } else {
@ -308,7 +308,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> {
fn emit_enum_variant_arg(&mut self, fn emit_enum_variant_arg(&mut self,
idx: uint, idx: uint,
f: |&mut PrettyEncoder<'self>|) { f: |&mut PrettyEncoder<'a>|) {
if idx != 0 { if idx != 0 {
write!(self.wr, ",\n"); write!(self.wr, ",\n");
} }
@ -320,14 +320,14 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> {
name: &str, name: &str,
id: uint, id: uint,
cnt: uint, cnt: uint,
f: |&mut PrettyEncoder<'self>|) { f: |&mut PrettyEncoder<'a>|) {
self.emit_enum_variant(name, id, cnt, f) self.emit_enum_variant(name, id, cnt, f)
} }
fn emit_enum_struct_variant_field(&mut self, fn emit_enum_struct_variant_field(&mut self,
_: &str, _: &str,
idx: uint, idx: uint,
f: |&mut PrettyEncoder<'self>|) { f: |&mut PrettyEncoder<'a>|) {
self.emit_enum_variant_arg(idx, f) self.emit_enum_variant_arg(idx, f)
} }
@ -335,7 +335,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> {
fn emit_struct(&mut self, fn emit_struct(&mut self,
_: &str, _: &str,
len: uint, len: uint,
f: |&mut PrettyEncoder<'self>|) { f: |&mut PrettyEncoder<'a>|) {
if len == 0 { if len == 0 {
write!(self.wr, "\\{\\}"); write!(self.wr, "\\{\\}");
} else { } else {
@ -350,7 +350,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> {
fn emit_struct_field(&mut self, fn emit_struct_field(&mut self,
name: &str, name: &str,
idx: uint, idx: uint,
f: |&mut PrettyEncoder<'self>|) { f: |&mut PrettyEncoder<'a>|) {
if idx == 0 { if idx == 0 {
write!(self.wr, "\n"); write!(self.wr, "\n");
} else { } else {
@ -360,30 +360,30 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> {
f(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) 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) self.emit_seq_elt(idx, f)
} }
fn emit_tuple_struct(&mut self, fn emit_tuple_struct(&mut self,
_: &str, _: &str,
len: uint, len: uint,
f: |&mut PrettyEncoder<'self>|) { f: |&mut PrettyEncoder<'a>|) {
self.emit_seq(len, f) self.emit_seq(len, f)
} }
fn emit_tuple_struct_arg(&mut self, fn emit_tuple_struct_arg(&mut self,
idx: uint, idx: uint,
f: |&mut PrettyEncoder<'self>|) { f: |&mut PrettyEncoder<'a>|) {
self.emit_seq_elt(idx, f) 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_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 { if len == 0 {
write!(self.wr, "[]"); write!(self.wr, "[]");
} else { } 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 { if idx == 0 {
write!(self.wr, "\n"); write!(self.wr, "\n");
} else { } else {
@ -405,7 +405,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> {
f(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 { if len == 0 {
write!(self.wr, "\\{\\}"); write!(self.wr, "\\{\\}");
} else { } 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 { if idx == 0 {
write!(self.wr, "\n"); write!(self.wr, "\n");
} else { } else {
@ -427,7 +427,7 @@ impl<'self> serialize::Encoder for PrettyEncoder<'self> {
f(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, ": "); write!(self.wr, ": ");
f(self); f(self);
} }

View file

@ -177,13 +177,13 @@ impl<T:Ord> PriorityQueue<T> {
} }
/// PriorityQueue iterator /// PriorityQueue iterator
pub struct PriorityQueueIterator <'self, T> { pub struct PriorityQueueIterator <'a, T> {
priv iter: vec::VecIterator<'self, 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] #[inline]
fn next(&mut self) -> Option<(&'self T)> { self.iter.next() } fn next(&mut self) -> Option<(&'a T)> { self.iter.next() }
#[inline] #[inline]
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }

View file

@ -229,16 +229,16 @@ impl<T> RingBuf<T> {
} }
/// RingBuf iterator /// RingBuf iterator
pub struct RingBufIterator<'self, T> { pub struct RingBufIterator<'a, T> {
priv lo: uint, priv lo: uint,
priv index: uint, priv index: uint,
priv rindex: uint, priv rindex: uint,
priv elts: &'self [Option<T>], priv elts: &'a [Option<T>],
} }
impl<'self, T> Iterator<&'self T> for RingBufIterator<'self, T> { impl<'a, T> Iterator<&'a T> for RingBufIterator<'a, T> {
#[inline] #[inline]
fn next(&mut self) -> Option<&'self T> { fn next(&mut self) -> Option<&'a T> {
if self.index == self.rindex { if self.index == self.rindex {
return None; 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] #[inline]
fn next_back(&mut self) -> Option<&'self T> { fn next_back(&mut self) -> Option<&'a T> {
if self.index == self.rindex { if self.index == self.rindex {
return None; 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] #[inline]
fn indexable(&self) -> uint { self.rindex - self.index } fn indexable(&self) -> uint { self.rindex - self.index }
#[inline] #[inline]
fn idx(&self, j: uint) -> Option<&'self T> { fn idx(&self, j: uint) -> Option<&'a T> {
if j >= self.indexable() { if j >= self.indexable() {
None None
} else { } else {
@ -284,15 +284,15 @@ impl<'self, T> RandomAccessIterator<&'self T> for RingBufIterator<'self, T> {
} }
/// RingBuf mutable iterator /// RingBuf mutable iterator
pub struct RingBufMutIterator<'self, T> { pub struct RingBufMutIterator<'a, T> {
priv remaining1: &'self mut [Option<T>], priv remaining1: &'a mut [Option<T>],
priv remaining2: &'self mut [Option<T>], priv remaining2: &'a mut [Option<T>],
priv nelts: uint, 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] #[inline]
fn next(&mut self) -> Option<&'self mut T> { fn next(&mut self) -> Option<&'a mut T> {
if self.nelts == 0 { if self.nelts == 0 {
return None; 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] #[inline]
fn next_back(&mut self) -> Option<&'self mut T> { fn next_back(&mut self) -> Option<&'a mut T> {
if self.nelts == 0 { if self.nelts == 0 {
return None; 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 /// Grow is only called on full elts, so nelts is also len(elts), unlike
/// elsewhere. /// elsewhere.

View file

@ -292,7 +292,7 @@ impl<D:Decoder> Decodable<D> for i64 {
} }
} }
impl<'self, S:Encoder> Encodable<S> for &'self str { impl<'a, S:Encoder> Encodable<S> for &'a str {
fn encode(&self, s: &mut S) { fn encode(&self, s: &mut S) {
s.emit_str(*self) s.emit_str(*self)
} }
@ -382,7 +382,7 @@ impl<D:Decoder> Decodable<D> for () {
} }
} }
impl<'self, S:Encoder,T:Encodable<S>> Encodable<S> for &'self T { impl<'a, S:Encoder,T:Encodable<S>> Encodable<S> for &'a T {
fn encode(&self, s: &mut S) { fn encode(&self, s: &mut S) {
(**self).encode(s) (**self).encode(s)
} }
@ -438,7 +438,7 @@ impl<D:Decoder,T:Decodable<D> + 'static> Decodable<D> for @mut T {
} }
} }
impl<'self, S:Encoder,T:Encodable<S>> Encodable<S> for &'self [T] { impl<'a, S:Encoder,T:Encodable<S>> Encodable<S> for &'a [T] {
fn encode(&self, s: &mut S) { fn encode(&self, s: &mut S) {
s.emit_seq(self.len(), |s| { s.emit_seq(self.len(), |s| {
for (i, e) in self.iter().enumerate() { for (i, e) in self.iter().enumerate() {

View file

@ -184,7 +184,7 @@ impl<V:Clone> SmallIntMap<V> {
macro_rules! iterator { macro_rules! iterator {
(impl $name:ident -> $elem:ty, $getter:ident) => { (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] #[inline]
fn next(&mut self) -> Option<$elem> { fn next(&mut self) -> Option<$elem> {
while self.front < self.back { while self.front < self.back {
@ -213,7 +213,7 @@ macro_rules! iterator {
macro_rules! double_ended_iterator { macro_rules! double_ended_iterator {
(impl $name:ident -> $elem:ty, $getter:ident) => { (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] #[inline]
fn next_back(&mut self) -> Option<$elem> { fn next_back(&mut self) -> Option<$elem> {
while self.front < self.back { 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 front: uint,
priv back: uint, priv back: uint,
priv iter: VecIterator<'self, Option<T>> priv iter: VecIterator<'a, Option<T>>
} }
iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref) iterator!(impl SmallIntMapIterator -> (uint, &'a T), get_ref)
double_ended_iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref) double_ended_iterator!(impl SmallIntMapIterator -> (uint, &'a T), get_ref)
pub type SmallIntMapRevIterator<'self, T> = Invert<SmallIntMapIterator<'self, T>>; pub type SmallIntMapRevIterator<'a, T> = Invert<SmallIntMapIterator<'a, T>>;
pub struct SmallIntMapMutIterator<'self, T> { pub struct SmallIntMapMutIterator<'a, T> {
priv front: uint, priv front: uint,
priv back: uint, priv back: uint,
priv iter: VecMutIterator<'self, Option<T>> priv iter: VecMutIterator<'a, Option<T>>
} }
iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref) iterator!(impl SmallIntMapMutIterator -> (uint, &'a mut T), get_mut_ref)
double_ended_iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref) double_ended_iterator!(impl SmallIntMapMutIterator -> (uint, &'a mut T), get_mut_ref)
pub type SmallIntMapMutRevIterator<'self, T> = Invert<SmallIntMapMutIterator<'self, T>>; pub type SmallIntMapMutRevIterator<'a, T> = Invert<SmallIntMapMutIterator<'a, T>>;
#[cfg(test)] #[cfg(test)]
mod test_map { mod test_map {

View file

@ -15,7 +15,7 @@ use std::cmp::{Eq, Ord};
use std::util::swap; use std::util::swap;
use std::vec; 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. * Merge sort. Returns a new vector containing the sorted list.
@ -173,7 +173,7 @@ pub trait Sort {
fn qsort(self); 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); } fn qsort(self) { quick_sort3(self); }
} }

View file

@ -145,7 +145,7 @@ impl Summary {
} }
} }
impl<'self> Stats for &'self [f64] { impl<'a> Stats for &'a [f64] {
fn sum(self) -> f64 { fn sum(self) -> f64 {
self.iter().fold(0.0, |p,q| p + *q) self.iter().fold(0.0, |p,q| p + *q)

View file

@ -155,28 +155,28 @@ impl Sem<~[WaitQueue]> {
// FIXME(#3598): Want to use an Option down below, but we need a custom enum // 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 // that's not polymorphic to get around the fact that lifetimes are invariant
// inside of type parameters. // inside of type parameters.
enum ReacquireOrderLock<'self> { enum ReacquireOrderLock<'a> {
Nothing, // c.c Nothing, // c.c
Just(&'self Semaphore), Just(&'a Semaphore),
} }
/// A mechanism for atomic-unlock-and-deschedule blocking and signalling. /// 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 // The 'Sem' object associated with this condvar. This is the one that's
// atomically-unlocked-and-descheduled upon and reacquired during wakeup. // 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 // 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 // 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 // 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 // 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, // 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. // See the comment in write_cond for more detail.
priv order: ReacquireOrderLock<'self>, priv order: ReacquireOrderLock<'a>,
// Make sure condvars are non-copyable. // Make sure condvars are non-copyable.
priv token: util::NonCopyable, priv token: util::NonCopyable,
} }
impl<'self> Condvar<'self> { impl<'a> Condvar<'a> {
/** /**
* Atomically drop the associated lock, and block until a signal is sent. * 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(). /// 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(). /// 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 } priv token: NonCopyable }
impl<'self> RWLockWriteMode<'self> { impl<'a> RWLockWriteMode<'a> {
/// Access the pre-downgrade rwlock in write mode. /// Access the pre-downgrade rwlock in write mode.
pub fn write<U>(&self, blk: || -> U) -> U { blk() } pub fn write<U>(&self, blk: || -> U) -> U { blk() }
/// Access the pre-downgrade rwlock in write mode with a condvar. /// 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. /// Access the post-downgrade rwlock in read mode.
pub fn read<U>(&self, blk: || -> U) -> U { blk() } pub fn read<U>(&self, blk: || -> U) -> U { blk() }
} }

View file

@ -228,9 +228,9 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
} }
/// Lazy forward iterator over a map /// Lazy forward iterator over a map
pub struct TreeMapIterator<'self, K, V> { pub struct TreeMapIterator<'a, K, V> {
priv stack: ~[&'self TreeNode<K, V>], priv stack: ~[&'a TreeNode<K, V>],
priv node: Option<&'self TreeNode<K, V>>, priv node: Option<&'a TreeNode<K, V>>,
priv remaining_min: uint, priv remaining_min: uint,
priv remaining_max: uint priv remaining_max: uint
} }
@ -245,9 +245,9 @@ fn deref<'a, K, V>(node: &'a Option<~TreeNode<K, V>>) -> Option<&'a TreeNode<K,
} }
} }
impl<'self, K, V> TreeMapIterator<'self, K, V> { impl<'a, K, V> TreeMapIterator<'a, K, V> {
#[inline(always)] #[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() { while !self.stack.is_empty() || self.node.is_some() {
match self.node { match self.node {
Some(x) => { 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 /// 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 /// tuple with a reference to the key and value. If there are no
/// more nodes, return `None`. /// 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) 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 /// Lazy backward iterator over a map
pub struct TreeMapRevIterator<'self, K, V> { pub struct TreeMapRevIterator<'a, K, V> {
priv iter: TreeMapIterator<'self, 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 /// 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 /// tuple with a reference to the key and value. If there are no
/// more nodes, return `None`. /// 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) self.iter.next_(false)
} }
@ -390,18 +390,18 @@ impl<K, V> Iterator<(K, V)> for TreeMapMoveIterator<K,V> {
} }
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`. /// Advance the iterator to the next node (in order). If there are no more nodes, return `None`.
#[inline] #[inline]
fn next(&mut self) -> Option<&'self T> { fn next(&mut self) -> Option<&'a T> {
self.iter.next().map(|(value, _)| value) 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`. /// Advance the iterator to the next node (in order). If there are no more nodes, return `None`.
#[inline] #[inline]
fn next(&mut self) -> Option<&'self T> { fn next(&mut self) -> Option<&'a T> {
self.iter.next().map(|(value, _)| value) self.iter.next().map(|(value, _)| value)
} }
} }
@ -561,37 +561,37 @@ impl<T: TotalOrd> TreeSet<T> {
} }
/// Lazy forward iterator over a set /// Lazy forward iterator over a set
pub struct TreeSetIterator<'self, T> { pub struct TreeSetIterator<'a, T> {
priv iter: TreeMapIterator<'self, T, ()> priv iter: TreeMapIterator<'a, T, ()>
} }
/// Lazy backward iterator over a set /// Lazy backward iterator over a set
pub struct TreeSetRevIterator<'self, T> { pub struct TreeSetRevIterator<'a, T> {
priv iter: TreeMapRevIterator<'self, T, ()> priv iter: TreeMapRevIterator<'a, T, ()>
} }
/// Lazy iterator producing elements in the set difference (in-order) /// Lazy iterator producing elements in the set difference (in-order)
pub struct Difference<'self, T> { pub struct Difference<'a, T> {
priv a: Peekable<&'self T, TreeSetIterator<'self, T>>, priv a: Peekable<&'a T, TreeSetIterator<'a, T>>,
priv b: Peekable<&'self T, TreeSetIterator<'self, T>>, priv b: Peekable<&'a T, TreeSetIterator<'a, T>>,
} }
/// Lazy iterator producing elements in the set symmetric difference (in-order) /// Lazy iterator producing elements in the set symmetric difference (in-order)
pub struct SymDifference<'self, T> { pub struct SymDifference<'a, T> {
priv a: Peekable<&'self T, TreeSetIterator<'self, T>>, priv a: Peekable<&'a T, TreeSetIterator<'a, T>>,
priv b: Peekable<&'self T, TreeSetIterator<'self, T>>, priv b: Peekable<&'a T, TreeSetIterator<'a, T>>,
} }
/// Lazy iterator producing elements in the set intersection (in-order) /// Lazy iterator producing elements in the set intersection (in-order)
pub struct Intersection<'self, T> { pub struct Intersection<'a, T> {
priv a: Peekable<&'self T, TreeSetIterator<'self, T>>, priv a: Peekable<&'a T, TreeSetIterator<'a, T>>,
priv b: Peekable<&'self T, TreeSetIterator<'self, T>>, priv b: Peekable<&'a T, TreeSetIterator<'a, T>>,
} }
/// Lazy iterator producing elements in the set intersection (in-order) /// Lazy iterator producing elements in the set intersection (in-order)
pub struct Union<'self, T> { pub struct Union<'a, T> {
priv a: Peekable<&'self T, TreeSetIterator<'self, T>>, priv a: Peekable<&'a T, TreeSetIterator<'a, T>>,
priv b: Peekable<&'self T, TreeSetIterator<'self, 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 /// Compare `x` and `y`, but return `short` if x is None and `long` if y is None
@ -604,8 +604,8 @@ fn cmp_opt<T: TotalOrd>(x: Option<&T>, y: Option<&T>,
} }
} }
impl<'self, T: TotalOrd> Iterator<&'self T> for Difference<'self, T> { impl<'a, T: TotalOrd> Iterator<&'a T> for Difference<'a, T> {
fn next(&mut self) -> Option<&'self T> { fn next(&mut self) -> Option<&'a T> {
loop { loop {
match cmp_opt(self.a.peek(), self.b.peek(), Less, Less) { match cmp_opt(self.a.peek(), self.b.peek(), Less, Less) {
Less => return self.a.next(), 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> { impl<'a, T: TotalOrd> Iterator<&'a T> for SymDifference<'a, T> {
fn next(&mut self) -> Option<&'self T> { fn next(&mut self) -> Option<&'a T> {
loop { loop {
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) { match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
Less => return self.a.next(), 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> { impl<'a, T: TotalOrd> Iterator<&'a T> for Intersection<'a, T> {
fn next(&mut self) -> Option<&'self T> { fn next(&mut self) -> Option<&'a T> {
loop { loop {
let o_cmp = match (self.a.peek(), self.b.peek()) { let o_cmp = match (self.a.peek(), self.b.peek()) {
(None , _ ) => None, (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> { impl<'a, T: TotalOrd> Iterator<&'a T> for Union<'a, T> {
fn next(&mut self) -> Option<&'self T> { fn next(&mut self) -> Option<&'a T> {
loop { loop {
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) { match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
Less => return self.a.next(), Less => return self.a.next(),

View file

@ -239,9 +239,9 @@ pub struct Context {
priv freshness: Arc<FreshnessMap> priv freshness: Arc<FreshnessMap>
} }
pub struct Prep<'self> { pub struct Prep<'a> {
priv ctxt: &'self Context, priv ctxt: &'a Context,
priv fn_name: &'self str, priv fn_name: &'a str,
priv declared_inputs: WorkMap, priv declared_inputs: WorkMap,
} }
@ -250,12 +250,12 @@ pub struct Exec {
priv discovered_outputs: WorkMap priv discovered_outputs: WorkMap
} }
enum Work<'self, T> { enum Work<'a, T> {
WorkValue(T), WorkValue(T),
WorkFromTask(&'self Prep<'self>, PortOne<(Exec, T)>), WorkFromTask(&'a Prep<'a>, PortOne<(Exec, T)>),
} }
fn json_encode<'self, T:Encodable<json::Encoder<'self>>>(t: &T) -> ~str { fn json_encode<'a, T:Encodable<json::Encoder<'a>>>(t: &T) -> ~str {
let mut writer = MemWriter::new(); let mut writer = MemWriter::new();
let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer); let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer);
t.encode(&mut encoder); t.encode(&mut encoder);
@ -336,8 +336,8 @@ impl Exec {
} }
} }
impl<'self> Prep<'self> { impl<'a> Prep<'a> {
fn new(ctxt: &'self Context, fn_name: &'self str) -> Prep<'self> { fn new(ctxt: &'a Context, fn_name: &'a str) -> Prep<'a> {
Prep { Prep {
ctxt: ctxt, ctxt: ctxt,
fn_name: fn_name, 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) { pub fn declare_input(&mut self, kind: &str, name: &str, val: &str) {
debug!("Declaring input {} {} {}", kind, name, val); debug!("Declaring input {} {} {}", kind, name, val);
self.declared_inputs.insert_work_key(WorkKey::new(kind, name), self.declared_inputs.insert_work_key(WorkKey::new(kind, name),
@ -395,17 +395,17 @@ impl<'self> Prep<'self> {
return true; return true;
} }
pub fn exec<'self, T:Send + pub fn exec<'a, T:Send +
Encodable<json::Encoder<'self>> + Encodable<json::Encoder<'a>> +
Decodable<json::Decoder>>( Decodable<json::Decoder>>(
&'self self, blk: proc(&mut Exec) -> T) -> T { &'a self, blk: proc(&mut Exec) -> T) -> T {
self.exec_work(blk).unwrap() self.exec_work(blk).unwrap()
} }
fn exec_work<'self, T:Send + fn exec_work<'a, T:Send +
Encodable<json::Encoder<'self>> + Encodable<json::Encoder<'a>> +
Decodable<json::Decoder>>( // FIXME(#5121) Decodable<json::Decoder>>( // 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); let mut bo = Some(blk);
debug!("exec_work: looking up {} and {:?}", self.fn_name, debug!("exec_work: looking up {} and {:?}", self.fn_name,
@ -445,16 +445,16 @@ impl<'self> Prep<'self> {
} }
} }
impl<'self, T:Send + impl<'a, T:Send +
Encodable<json::Encoder<'self>> + Encodable<json::Encoder<'a>> +
Decodable<json::Decoder>> Decodable<json::Decoder>>
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) WorkValue(elt)
} }
pub fn from_task(prep: &'self Prep<'self>, port: PortOne<(Exec, T)>) pub fn from_task(prep: &'a Prep<'a>, port: PortOne<(Exec, T)>)
-> Work<'self, T> { -> Work<'a, T> {
WorkFromTask(prep, port) WorkFromTask(prep, port)
} }

View file

@ -12,8 +12,8 @@
use syntax::fold::ast_fold; use syntax::fold::ast_fold;
use syntax::{ast, fold, attr}; use syntax::{ast, fold, attr};
struct Context<'self> { struct Context<'a> {
in_cfg: 'self |attrs: &[ast::Attribute]| -> bool, in_cfg: 'a |attrs: &[ast::Attribute]| -> bool,
} }
// Support conditional compilation by transforming the AST, stripping out // 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)) 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 { fn fold_mod(&self, module: &ast::_mod) -> ast::_mod {
fold_mod(self, module) fold_mod(self, module)
} }

View file

@ -73,7 +73,7 @@ fn lookup_hash(d: ebml::Doc, eq_fn: |&[u8]| -> bool, hash: u64) ->
ret 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<ebml::Doc> { pub fn maybe_find_item(item_id: ast::NodeId, items: ebml::Doc) -> Option<ebml::Doc> {
fn eq_item(bytes: &[u8], item_id: ast::NodeId) -> bool { 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)) 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, tcx: ty::ctxt,
path: ast_map::path, path: ast_map::path,
par_doc: ebml::Doc| par_doc: ebml::Doc|

View file

@ -51,21 +51,21 @@ use writer = extra::ebml::writer;
// used by astencode: // used by astencode:
type abbrev_map = @mut HashMap<ty::t, tyencode::ty_abbrev>; type abbrev_map = @mut HashMap<ty::t, tyencode::ty_abbrev>;
pub type encode_inlined_item<'self> = 'self |ecx: &EncodeContext, pub type encode_inlined_item<'a> = 'a |ecx: &EncodeContext,
ebml_w: &mut writer::Encoder, ebml_w: &mut writer::Encoder,
path: &[ast_map::path_elt], path: &[ast_map::path_elt],
ii: ast::inlined_item|; ii: ast::inlined_item|;
pub struct EncodeParams<'self> { pub struct EncodeParams<'a> {
diag: @mut span_handler, diag: @mut span_handler,
tcx: ty::ctxt, tcx: ty::ctxt,
reexports2: middle::resolve::ExportMap2, reexports2: middle::resolve::ExportMap2,
item_symbols: &'self HashMap<ast::NodeId, ~str>, item_symbols: &'a HashMap<ast::NodeId, ~str>,
discrim_symbols: &'self HashMap<ast::NodeId, @str>, discrim_symbols: &'a HashMap<ast::NodeId, @str>,
non_inlineable_statics: &'self HashSet<ast::NodeId>, non_inlineable_statics: &'a HashSet<ast::NodeId>,
link_meta: &'self LinkMeta, link_meta: &'a LinkMeta,
cstore: @mut cstore::CStore, cstore: @mut cstore::CStore,
encode_inlined_item: encode_inlined_item<'self>, encode_inlined_item: encode_inlined_item<'a>,
reachable: @mut HashSet<ast::NodeId>, reachable: @mut HashSet<ast::NodeId>,
} }
@ -85,17 +85,17 @@ struct Stats {
n_inlines: uint n_inlines: uint
} }
pub struct EncodeContext<'self> { pub struct EncodeContext<'a> {
diag: @mut span_handler, diag: @mut span_handler,
tcx: ty::ctxt, tcx: ty::ctxt,
stats: @mut Stats, stats: @mut Stats,
reexports2: middle::resolve::ExportMap2, reexports2: middle::resolve::ExportMap2,
item_symbols: &'self HashMap<ast::NodeId, ~str>, item_symbols: &'a HashMap<ast::NodeId, ~str>,
discrim_symbols: &'self HashMap<ast::NodeId, @str>, discrim_symbols: &'a HashMap<ast::NodeId, @str>,
non_inlineable_statics: &'self HashSet<ast::NodeId>, non_inlineable_statics: &'a HashSet<ast::NodeId>,
link_meta: &'self LinkMeta, link_meta: &'a LinkMeta,
cstore: &'self cstore::CStore, cstore: &'a cstore::CStore,
encode_inlined_item: encode_inlined_item<'self>, encode_inlined_item: encode_inlined_item<'a>,
type_abbrevs: abbrev_map, type_abbrevs: abbrev_map,
reachable: @mut HashSet<ast::NodeId>, reachable: @mut HashSet<ast::NodeId>,
} }
@ -1605,12 +1605,12 @@ fn encode_native_libraries(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
ebml_w.end_tag(); ebml_w.end_tag();
} }
struct ImplVisitor<'self> { struct ImplVisitor<'a> {
ecx: &'self EncodeContext<'self>, ecx: &'a EncodeContext<'a>,
ebml_w: &'self mut writer::Encoder, 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, _: ()) { fn visit_item(&mut self, item: @item, _: ()) {
match item.node { match item.node {
item_impl(_, Some(ref trait_ref), _, _) => { item_impl(_, Some(ref trait_ref), _, _) => {

View file

@ -23,7 +23,7 @@ pub enum FileMatch { FileMatches, FileDoesntMatch }
/// Functions with type `pick` take a parent directory as well as /// Functions with type `pick` take a parent directory as well as
/// a file found in that directory. /// 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<Path> { pub fn pick_file(file: Path, path: &Path) -> Option<Path> {
if path.filename() == Some(file.as_vec()) { if path.filename() == Some(file.as_vec()) {

View file

@ -52,11 +52,11 @@ pub enum DefIdSource {
// Identifies a region parameter (`fn foo<'X>() { ... }`). // Identifies a region parameter (`fn foo<'X>() { ... }`).
RegionParameter, RegionParameter,
} }
type conv_did<'self> = type conv_did<'a> =
'self |source: DefIdSource, ast::DefId| -> ast::DefId; 'a |source: DefIdSource, ast::DefId| -> ast::DefId;
pub struct PState<'self> { pub struct PState<'a> {
data: &'self [u8], data: &'a [u8],
crate: ast::CrateNum, crate: ast::CrateNum,
pos: uint, pos: uint,
tcx: ty::ctxt tcx: ty::ctxt

View file

@ -765,7 +765,7 @@ trait get_ty_str_ctxt {
fn ty_str_ctxt(&self) -> @tyencode::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 { fn ty_str_ctxt(&self) -> @tyencode::ctxt {
@tyencode::ctxt { @tyencode::ctxt {
diag: self.tcx.sess.diagnostic(), diag: self.tcx.sess.diagnostic(),

View file

@ -32,15 +32,15 @@ use syntax::visit;
use util::ppaux::Repr; use util::ppaux::Repr;
#[deriving(Clone)] #[deriving(Clone)]
struct CheckLoanCtxt<'self> { struct CheckLoanCtxt<'a> {
bccx: &'self BorrowckCtxt, bccx: &'a BorrowckCtxt,
dfcx_loans: &'self LoanDataFlow, dfcx_loans: &'a LoanDataFlow,
move_data: @move_data::FlowedMoveData, move_data: @move_data::FlowedMoveData,
all_loans: &'self [Loan], all_loans: &'a [Loan],
reported: @mut HashSet<ast::NodeId>, reported: @mut HashSet<ast::NodeId>,
} }
impl<'self> Visitor<()> for CheckLoanCtxt<'self> { impl<'a> Visitor<()> for CheckLoanCtxt<'a> {
fn visit_expr(&mut self, ex:@ast::Expr, _:()) { fn visit_expr(&mut self, ex:@ast::Expr, _:()) {
check_loans_in_expr(self, ex); check_loans_in_expr(self, ex);
@ -86,7 +86,7 @@ enum MoveError {
MoveWhileBorrowed(/*loan*/@LoanPath, /*loan*/Span) MoveWhileBorrowed(/*loan*/@LoanPath, /*loan*/Span)
} }
impl<'self> CheckLoanCtxt<'self> { impl<'a> CheckLoanCtxt<'a> {
pub fn tcx(&self) -> ty::ctxt { self.bccx.tcx } pub fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
pub fn each_issued_loan(&self, scope_id: ast::NodeId, op: |&Loan| -> bool) pub fn each_issued_loan(&self, scope_id: ast::NodeId, op: |&Loan| -> bool)

View file

@ -45,8 +45,8 @@ pub fn guarantee_lifetime(bccx: &BorrowckCtxt,
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Private // Private
struct GuaranteeLifetimeContext<'self> { struct GuaranteeLifetimeContext<'a> {
bccx: &'self BorrowckCtxt, bccx: &'a BorrowckCtxt,
// the node id of the function body for the enclosing item // the node id of the function body for the enclosing item
item_scope_id: ast::NodeId, item_scope_id: ast::NodeId,
@ -61,7 +61,7 @@ struct GuaranteeLifetimeContext<'self> {
cmt_original: mc::cmt cmt_original: mc::cmt
} }
impl<'self> GuaranteeLifetimeContext<'self> { impl<'a> GuaranteeLifetimeContext<'a> {
fn tcx(&self) -> ty::ctxt { fn tcx(&self) -> ty::ctxt {
self.bccx.tcx self.bccx.tcx
} }

View file

@ -64,8 +64,8 @@ mod gather_moves;
/// No good. Instead what will happen is that `root_ub` will be set to the /// 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` /// 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`. /// because it would have to be rooted for a region greater than `root_ub`.
struct GatherLoanCtxt<'self> { struct GatherLoanCtxt<'a> {
bccx: &'self BorrowckCtxt, bccx: &'a BorrowckCtxt,
id_range: id_range, id_range: id_range,
move_data: @mut move_data::MoveData, move_data: @mut move_data::MoveData,
all_loans: @mut ~[Loan], all_loans: @mut ~[Loan],
@ -73,7 +73,7 @@ struct GatherLoanCtxt<'self> {
repeating_ids: ~[ast::NodeId] 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, _:()) { fn visit_expr(&mut self, ex:@Expr, _:()) {
gather_loans_in_expr(self, ex); 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 tcx(&self) -> ty::ctxt { self.bccx.tcx }
pub fn push_repeating_id(&mut self, id: ast::NodeId) { pub fn push_repeating_id(&mut self, id: ast::NodeId) {

View file

@ -42,14 +42,14 @@ pub fn compute_restrictions(bccx: &BorrowckCtxt,
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Private // Private
struct RestrictionsContext<'self> { struct RestrictionsContext<'a> {
bccx: &'self BorrowckCtxt, bccx: &'a BorrowckCtxt,
span: Span, span: Span,
cmt_original: mc::cmt, cmt_original: mc::cmt,
loan_region: ty::Region, loan_region: ty::Region,
} }
impl<'self> RestrictionsContext<'self> { impl<'a> RestrictionsContext<'a> {
fn restrict(&self, fn restrict(&self,
cmt: mc::cmt, cmt: mc::cmt,
restrictions: RestrictionSet) -> RestrictionResult { restrictions: RestrictionSet) -> RestrictionResult {

View file

@ -77,12 +77,12 @@ pub trait DataFlowOperator {
fn walk_closures(&self) -> bool; fn walk_closures(&self) -> bool;
} }
struct PropagationContext<'self, O> { struct PropagationContext<'a, O> {
dfcx: &'self mut DataFlowContext<O>, dfcx: &'a mut DataFlowContext<O>,
changed: bool changed: bool
} }
struct LoopScope<'self> { struct LoopScope<'a> {
loop_id: ast::NodeId, loop_id: ast::NodeId,
break_bits: ~[uint] break_bits: ~[uint]
} }
@ -363,7 +363,7 @@ impl<O:DataFlowOperator+Clone+'static> DataFlowContext<O> {
} }
} }
impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { impl<'a, O:DataFlowOperator> PropagationContext<'a, O> {
fn tcx(&self) -> ty::ctxt { fn tcx(&self) -> ty::ctxt {
self.dfcx.tcx self.dfcx.tcx
} }

View file

@ -103,11 +103,11 @@ struct LanguageItemCollector {
item_refs: HashMap<&'static str, uint>, item_refs: HashMap<&'static str, uint>,
} }
struct LanguageItemVisitor<'self> { struct LanguageItemVisitor<'a> {
this: &'self mut LanguageItemCollector, this: &'a mut LanguageItemCollector,
} }
impl<'self> Visitor<()> for LanguageItemVisitor<'self> { impl<'a> Visitor<()> for LanguageItemVisitor<'a> {
fn visit_item(&mut self, item: @ast::item, _: ()) { fn visit_item(&mut self, item: @ast::item, _: ()) {
match extract(item.attrs) { match extract(item.attrs) {
Some(value) => { Some(value) => {

View file

@ -352,7 +352,7 @@ pub fn get_lint_dict() -> LintDict {
return map; return map;
} }
struct Context<'self> { struct Context<'a> {
// All known lint modes (string versions) // All known lint modes (string versions)
dict: @LintDict, dict: @LintDict,
// Current levels of each lint warning // Current levels of each lint warning
@ -360,7 +360,7 @@ struct Context<'self> {
// context we're checking in (used to access fields like sess) // context we're checking in (used to access fields like sess)
tcx: ty::ctxt, tcx: ty::ctxt,
// Items exported by the crate; used by the missing_doc lint. // 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. // The id of the current `ast::struct_def` being walked.
cur_struct_def_id: ast::NodeId, cur_struct_def_id: ast::NodeId,
// Whether some ancestor of the current node was marked // Whether some ancestor of the current node was marked
@ -376,7 +376,7 @@ struct Context<'self> {
negated_expr_id: ast::NodeId negated_expr_id: ast::NodeId
} }
impl<'self> Context<'self> { impl<'a> Context<'a> {
fn get_level(&self, lint: lint) -> level { fn get_level(&self, lint: lint) -> level {
match self.cur.find(&(lint as uint)) { match self.cur.find(&(lint as uint)) {
Some(&(lvl, _)) => lvl, Some(&(lvl, _)) => lvl,
@ -1234,7 +1234,7 @@ fn check_stability(cx: &Context, e: &ast::Expr) {
cx.span_lint(lint, e.span, msg); 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, _: ()) { fn visit_item(&mut self, it: @ast::item, _: ()) {
self.with_lint_attrs(it.attrs, |cx| { self.with_lint_attrs(it.attrs, |cx| {
check_item_ctypes(cx, it); check_item_ctypes(cx, it);
@ -1369,7 +1369,7 @@ impl<'self> Visitor<()> for Context<'self> {
fn visit_ty(&mut self, _t: &ast::Ty, _: ()) {} 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) { fn visit_id(&self, id: ast::NodeId) {
match self.tcx.sess.lints.pop(&id) { match self.tcx.sess.lints.pop(&id) {
None => {} None => {}

View file

@ -30,7 +30,7 @@ use syntax::opt_vec;
use syntax::visit; use syntax::visit;
use syntax::visit::Visitor; 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. /// A set of AST nodes exported by the crate.
pub type ExportedItems = HashSet<ast::NodeId>; pub type ExportedItems = HashSet<ast::NodeId>;
@ -143,9 +143,9 @@ impl Visitor<()> for ParentVisitor {
/// The embargo visitor, used to determine the exports of the ast /// The embargo visitor, used to determine the exports of the ast
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
struct EmbargoVisitor<'self> { struct EmbargoVisitor<'a> {
tcx: ty::ctxt, 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 // This flag is an indicator of whether the previous item in the
// hierarchical chain was exported or not. This is the indicator of whether // hierarchical chain was exported or not. This is the indicator of whether
@ -167,7 +167,7 @@ struct EmbargoVisitor<'self> {
reexports: HashSet<ast::NodeId>, reexports: HashSet<ast::NodeId>,
} }
impl<'self> Visitor<()> for EmbargoVisitor<'self> { impl<'a> Visitor<()> for EmbargoVisitor<'a> {
fn visit_item(&mut self, item: @ast::item, _: ()) { fn visit_item(&mut self, item: @ast::item, _: ()) {
let orig_all_pub = self.prev_exported; let orig_all_pub = self.prev_exported;
match item.node { match item.node {
@ -308,12 +308,12 @@ impl<'self> Visitor<()> for EmbargoVisitor<'self> {
/// The privacy visitor, where privacy checks take place (violations reported) /// The privacy visitor, where privacy checks take place (violations reported)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
struct PrivacyVisitor<'self> { struct PrivacyVisitor<'a> {
tcx: ty::ctxt, tcx: ty::ctxt,
curitem: ast::NodeId, curitem: ast::NodeId,
in_fn: bool, in_fn: bool,
in_foreign: bool, in_foreign: bool,
method_map: &'self method_map, method_map: &'a method_map,
parents: HashMap<ast::NodeId, ast::NodeId>, parents: HashMap<ast::NodeId, ast::NodeId>,
external_exports: resolve::ExternalExports, external_exports: resolve::ExternalExports,
last_private_map: resolve::LastPrivateMap, last_private_map: resolve::LastPrivateMap,
@ -325,7 +325,7 @@ enum PrivacyResult {
DisallowedBy(ast::NodeId), DisallowedBy(ast::NodeId),
} }
impl<'self> PrivacyVisitor<'self> { impl<'a> PrivacyVisitor<'a> {
// used when debugging // used when debugging
fn nodestr(&self, id: ast::NodeId) -> ~str { fn nodestr(&self, id: ast::NodeId) -> ~str {
ast_map::node_id_to_str(self.tcx.items, id, token::get_ident_interner()) 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, _: ()) { fn visit_item(&mut self, item: @ast::item, _: ()) {
// Do not check privacy inside items with the resolve_unexported // Do not check privacy inside items with the resolve_unexported
// attribute. This is used for the test runner. // attribute. This is used for the test runner.

View file

@ -185,9 +185,9 @@ impl<T> ResolveResult<T> {
} }
} }
enum TypeParameters<'self> { enum TypeParameters<'a> {
NoTypeParameters, //< No type parameters. NoTypeParameters, //< No type parameters.
HasTypeParameters(&'self Generics, //< Type parameters. HasTypeParameters(&'a Generics, //< Type parameters.
NodeId, //< ID of the enclosing item NodeId, //< ID of the enclosing item
// The index to start numbering the type parameters at. // The index to start numbering the type parameters at.
@ -881,11 +881,11 @@ struct Resolver {
used_imports: HashSet<NodeId>, used_imports: HashSet<NodeId>,
} }
struct BuildReducedGraphVisitor<'self> { struct BuildReducedGraphVisitor<'a> {
resolver: &'self mut Resolver, resolver: &'a mut Resolver,
} }
impl<'self> Visitor<ReducedGraphParent> for BuildReducedGraphVisitor<'self> { impl<'a> Visitor<ReducedGraphParent> for BuildReducedGraphVisitor<'a> {
fn visit_item(&mut self, item:@item, context:ReducedGraphParent) { fn visit_item(&mut self, item:@item, context:ReducedGraphParent) {
let p = self.resolver.build_reduced_graph_for_item(item, context); let p = self.resolver.build_reduced_graph_for_item(item, context);
@ -913,9 +913,9 @@ impl<'self> Visitor<ReducedGraphParent> 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, _:()) { fn visit_view_item(&mut self, vi:&view_item, _:()) {
self.resolver.check_for_item_unused_imports(vi); self.resolver.check_for_item_unused_imports(vi);
visit::walk_view_item(self, vi, ()); visit::walk_view_item(self, vi, ());

View file

@ -36,10 +36,10 @@ struct LifetimeContext {
named_region_map: @mut NamedRegionMap, named_region_map: @mut NamedRegionMap,
} }
enum ScopeChain<'self> { enum ScopeChain<'a> {
ItemScope(&'self OptVec<ast::Lifetime>), ItemScope(&'a OptVec<ast::Lifetime>),
FnScope(ast::NodeId, &'self OptVec<ast::Lifetime>, &'self ScopeChain<'self>), FnScope(ast::NodeId, &'a OptVec<ast::Lifetime>, &'a ScopeChain<'a>),
BlockScope(ast::NodeId, &'self ScopeChain<'self>), BlockScope(ast::NodeId, &'a ScopeChain<'a>),
RootScope RootScope
} }
@ -55,10 +55,10 @@ pub fn crate(sess: session::Session,
ctxt.named_region_map 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, fn visit_item(&mut self,
item: @ast::item, item: @ast::item,
_: &'self ScopeChain<'self>) { _: &'a ScopeChain<'a>) {
let scope = match item.node { let scope = match item.node {
ast::item_fn(..) | // fn lifetimes get added in visit_fn below ast::item_fn(..) | // fn lifetimes get added in visit_fn below
ast::item_mod(..) | ast::item_mod(..) |
@ -87,7 +87,7 @@ impl<'self> Visitor<&'self ScopeChain<'self>> for LifetimeContext {
b: ast::P<ast::Block>, b: ast::P<ast::Block>,
s: Span, s: Span,
n: ast::NodeId, n: ast::NodeId,
scope: &'self ScopeChain<'self>) { scope: &'a ScopeChain<'a>) {
match *fk { match *fk {
visit::fk_item_fn(_, generics, _, _) | visit::fk_item_fn(_, generics, _, _) |
visit::fk_method(_, generics, _) => { visit::fk_method(_, generics, _) => {
@ -105,7 +105,7 @@ impl<'self> Visitor<&'self ScopeChain<'self>> for LifetimeContext {
fn visit_ty(&mut self, fn visit_ty(&mut self,
ty: &ast::Ty, ty: &ast::Ty,
scope: &'self ScopeChain<'self>) { scope: &'a ScopeChain<'a>) {
match ty.node { match ty.node {
ast::ty_closure(@ast::TyClosure { lifetimes: ref lifetimes, .. }) | ast::ty_closure(@ast::TyClosure { lifetimes: ref lifetimes, .. }) |
ast::ty_bare_fn(@ast::TyBareFn { 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, fn visit_ty_method(&mut self,
m: &ast::TypeMethod, m: &ast::TypeMethod,
scope: &'self ScopeChain<'self>) { scope: &'a ScopeChain<'a>) {
let scope1 = FnScope(m.id, &m.generics.lifetimes, scope); let scope1 = FnScope(m.id, &m.generics.lifetimes, scope);
self.check_lifetime_names(&m.generics.lifetimes); self.check_lifetime_names(&m.generics.lifetimes);
debug!("pushing fn scope id={} due to ty_method", m.id); 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, fn visit_block(&mut self,
b: ast::P<ast::Block>, b: ast::P<ast::Block>,
scope: &'self ScopeChain<'self>) { scope: &'a ScopeChain<'a>) {
let scope1 = BlockScope(b.id, scope); let scope1 = BlockScope(b.id, scope);
debug!("pushing block scope {}", b.id); debug!("pushing block scope {}", b.id);
visit::walk_block(self, b, &scope1); visit::walk_block(self, b, &scope1);
@ -142,7 +142,7 @@ impl<'self> Visitor<&'self ScopeChain<'self>> for LifetimeContext {
fn visit_lifetime_ref(&mut self, fn visit_lifetime_ref(&mut self,
lifetime_ref: &ast::Lifetime, lifetime_ref: &ast::Lifetime,
scope: &'self ScopeChain<'self>) { scope: &'a ScopeChain<'a>) {
if lifetime_ref.ident == special_idents::statik { if lifetime_ref.ident == special_idents::statik {
self.insert_lifetime(lifetime_ref, ast::DefStaticRegion); self.insert_lifetime(lifetime_ref, ast::DefStaticRegion);
return; return;

View file

@ -45,12 +45,12 @@ impl Subst for ty::t {
} }
} }
struct SubstFolder<'self> { struct SubstFolder<'a> {
tcx: ty::ctxt, 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 tcx(&self) -> ty::ctxt { self.tcx }
fn fold_region(&mut self, r: ty::Region) -> ty::Region { fn fold_region(&mut self, r: ty::Region) -> ty::Region {

View file

@ -394,9 +394,9 @@ struct BindingInfo {
type BindingsMap = HashMap<Ident, BindingInfo>; type BindingsMap = HashMap<Ident, BindingInfo>;
#[deriving(Clone)] #[deriving(Clone)]
struct ArmData<'self> { struct ArmData<'a> {
bodycx: @mut Block, bodycx: @mut Block,
arm: &'self ast::Arm, arm: &'a ast::Arm,
bindings_map: @BindingsMap bindings_map: @BindingsMap
} }
@ -407,13 +407,13 @@ struct ArmData<'self> {
* these pointers are stored in llmatch variables just before executing `data` arm. * these pointers are stored in llmatch variables just before executing `data` arm.
*/ */
#[deriving(Clone)] #[deriving(Clone)]
struct Match<'self> { struct Match<'a> {
pats: ~[@ast::Pat], pats: ~[@ast::Pat],
data: ArmData<'self>, data: ArmData<'a>,
bound_ptrs: ~[(Ident, ValueRef)] bound_ptrs: ~[(Ident, ValueRef)]
} }
impl<'self> Repr for Match<'self> { impl<'a> Repr for Match<'a> {
fn repr(&self, tcx: ty::ctxt) -> ~str { fn repr(&self, tcx: ty::ctxt) -> ~str {
if tcx.sess.verbose() { if tcx.sess.verbose() {
// for many programs, this just take too long to serialize // 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, fn enter_match<'r>(bcx: @mut Block,
dm: DefMap, dm: DefMap,

View file

@ -130,16 +130,16 @@ pub fn push_ctxt(s: &'static str) -> _InsnCtxt {
_InsnCtxt { _x: () } _InsnCtxt { _x: () }
} }
struct StatRecorder<'self> { struct StatRecorder<'a> {
ccx: @mut CrateContext, ccx: @mut CrateContext,
name: &'self str, name: &'a str,
start: u64, start: u64,
istart: uint, istart: uint,
} }
impl<'self> StatRecorder<'self> { impl<'a> StatRecorder<'a> {
pub fn new(ccx: @mut CrateContext, pub fn new(ccx: @mut CrateContext,
name: &'self str) -> StatRecorder<'self> { name: &'a str) -> StatRecorder<'a> {
let start = if ccx.sess.trans_stats() { let start = if ccx.sess.trans_stats() {
time::precise_time_ns() time::precise_time_ns()
} else { } else {
@ -156,7 +156,7 @@ impl<'self> StatRecorder<'self> {
} }
#[unsafe_destructor] #[unsafe_destructor]
impl<'self> Drop for StatRecorder<'self> { impl<'a> Drop for StatRecorder<'a> {
fn drop(&mut self) { fn drop(&mut self) {
if self.ccx.sess.trans_stats() { if self.ccx.sess.trans_stats() {
let end = time::precise_time_ns(); 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; -> @mut Block;
pub fn load_inbounds(cx: @mut Block, p: ValueRef, idxs: &[uint]) -> ValueRef { pub fn load_inbounds(cx: @mut Block, p: ValueRef, idxs: &[uint]) -> ValueRef {

View file

@ -14,7 +14,7 @@ use std::iter::{Filter, Map};
pub struct BasicBlock(BasicBlockRef); 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 * Wrapper for LLVM BasicBlockRef

View file

@ -67,7 +67,7 @@ trait ClassList {
fn is_ret_bysret(&self) -> bool; fn is_ret_bysret(&self) -> bool;
} }
impl<'self> ClassList for &'self [RegClass] { impl<'a> ClassList for &'a [RegClass] {
fn is_pass_byval(&self) -> bool { fn is_pass_byval(&self) -> bool {
if self.len() == 0 { return false; } if self.len() == 0 { return false; }

View file

@ -750,9 +750,9 @@ pub fn trans_call_inner(in_cx: @mut Block,
}) })
} }
pub enum CallArgs<'self> { pub enum CallArgs<'a> {
ArgExprs(&'self [@ast::Expr]), ArgExprs(&'a [@ast::Expr]),
ArgVals(&'self [ValueRef]) ArgVals(&'a [ValueRef])
} }
pub fn trans_args(cx: @mut Block, pub fn trans_args(cx: @mut Block,

View file

@ -214,12 +214,12 @@ struct FunctionDebugContextData {
source_locations_enabled: bool, source_locations_enabled: bool,
} }
enum VariableAccess<'self> { enum VariableAccess<'a> {
// The llptr given is an alloca containing the variable's value // The llptr given is an alloca containing the variable's value
DirectVariable { alloca: ValueRef }, DirectVariable { alloca: ValueRef },
// The llptr given is an alloca containing the start of some pointer chain leading to the // The llptr given is an alloca containing the start of some pointer chain leading to the
// variable's content. // variable's content.
IndirectVariable { alloca: ValueRef, address_operations: &'self [ValueRef] } IndirectVariable { alloca: ValueRef, address_operations: &'a [ValueRef] }
} }
enum VariableKind { enum VariableKind {

View file

@ -641,7 +641,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
return inf; 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; -> @mut Block;
pub fn declare_generic_glue(ccx: &mut CrateContext, t: ty::t, llfnty: Type, pub fn declare_generic_glue(ccx: &mut CrateContext, t: ty::t, llfnty: Type,

View file

@ -16,7 +16,7 @@ pub trait LlvmRepr {
fn llrepr(&self, ccx: &CrateContext) -> ~str; 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 { fn llrepr(&self, ccx: &CrateContext) -> ~str {
let reprs = self.map(|t| t.llrepr(ccx)); let reprs = self.map(|t| t.llrepr(ccx));
format!("[{}]", reprs.connect(",")) format!("[{}]", reprs.connect(","))

View file

@ -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; -> @mut Block;
pub fn iter_vec_loop(bcx: @mut Block, pub fn iter_vec_loop(bcx: @mut Block,

View file

@ -1408,13 +1408,13 @@ pub fn subst_tps(tcx: ctxt, tps: &[t], self_ty_opt: Option<t>, typ: t) -> t {
let mut subst = TpsSubst { tcx: tcx, self_ty_opt: self_ty_opt, tps: tps }; let mut subst = TpsSubst { tcx: tcx, self_ty_opt: self_ty_opt, tps: tps };
return subst.fold_ty(typ); return subst.fold_ty(typ);
struct TpsSubst<'self> { struct TpsSubst<'a> {
tcx: ctxt, tcx: ctxt,
self_ty_opt: Option<t>, self_ty_opt: Option<t>,
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 tcx(&self) -> ty::ctxt { self.tcx }
fn fold_ty(&mut self, t: ty::t) -> ty::t { fn fold_ty(&mut self, t: ty::t) -> ty::t {

View file

@ -222,12 +222,12 @@ pub fn super_fold_trait_store<T:TypeFolder>(this: &mut T,
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Some sample folders // Some sample folders
pub struct BottomUpFolder<'self> { pub struct BottomUpFolder<'a> {
tcx: ty::ctxt, 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 tcx(&self) -> ty::ctxt { self.tcx }
fn fold_ty(&mut self, ty: ty::t) -> ty::t { fn fold_ty(&mut self, ty: ty::t) -> ty::t {
@ -239,17 +239,17 @@ impl<'self> TypeFolder for BottomUpFolder<'self> {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Region folder // Region folder
pub struct RegionFolder<'self> { pub struct RegionFolder<'a> {
tcx: ty::ctxt, tcx: ty::ctxt,
fld_t: 'self |ty::t| -> ty::t, fld_t: 'a |ty::t| -> ty::t,
fld_r: 'self |ty::Region| -> ty::Region, fld_r: 'a |ty::Region| -> ty::Region,
} }
impl<'self> RegionFolder<'self> { impl<'a> RegionFolder<'a> {
pub fn general(tcx: ty::ctxt, pub fn general(tcx: ty::ctxt,
fld_r: 'self |ty::Region| -> ty::Region, fld_r: 'a |ty::Region| -> ty::Region,
fld_t: 'self |ty::t| -> ty::t) fld_t: 'a |ty::t| -> ty::t)
-> RegionFolder<'self> { -> RegionFolder<'a> {
RegionFolder { RegionFolder {
tcx: tcx, tcx: tcx,
fld_t: fld_t, 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) pub fn regions(tcx: ty::ctxt, fld_r: 'a |ty::Region| -> ty::Region)
-> RegionFolder<'self> { -> RegionFolder<'a> {
fn noop(t: ty::t) -> ty::t { t } fn noop(t: ty::t) -> ty::t { t }
RegionFolder { 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 tcx(&self) -> ty::ctxt { self.tcx }
fn fold_ty(&mut self, ty: ty::t) -> ty::t { fn fold_ty(&mut self, ty: ty::t) -> ty::t {

View file

@ -40,7 +40,7 @@
* as it does not already appear in scope. * as it does not already appear in scope.
* *
* Case (b) says that if you have a type: * Case (b) says that if you have a type:
* type foo<'self> = ...; * type foo<'a> = ...;
* type bar = fn(&foo, &a.foo) * type bar = fn(&foo, &a.foo)
* The fully expanded version of type bar is: * The fully expanded version of type bar is:
* type bar = fn(&'foo &, &a.foo<'a>) * type bar = fn(&'foo &, &a.foo<'a>)

View file

@ -167,13 +167,13 @@ pub fn lookup(
return lcx.search(self_ty); return lcx.search(self_ty);
} }
pub struct LookupContext<'self> { pub struct LookupContext<'a> {
fcx: @mut FnCtxt, fcx: @mut FnCtxt,
expr: @ast::Expr, expr: @ast::Expr,
self_expr: @ast::Expr, self_expr: @ast::Expr,
callee_id: NodeId, callee_id: NodeId,
m_name: ast::Name, m_name: ast::Name,
supplied_tps: &'self [ty::t], supplied_tps: &'a [ty::t],
impl_dups: @mut HashSet<DefId>, impl_dups: @mut HashSet<DefId>,
inherent_candidates: @mut ~[Candidate], inherent_candidates: @mut ~[Candidate],
extension_candidates: @mut ~[Candidate], extension_candidates: @mut ~[Candidate],
@ -208,7 +208,7 @@ enum RcvrMatchCondition {
RcvrMatchesIfSubtype(ty::t) RcvrMatchesIfSubtype(ty::t)
} }
impl<'self> LookupContext<'self> { impl<'a> LookupContext<'a> {
fn search(&self, self_ty: ty::t) -> Option<method_map_entry> { fn search(&self, self_ty: ty::t) -> Option<method_map_entry> {
let mut self_ty = self_ty; let mut self_ty = self_ty;
let mut autoderefs = 0; let mut autoderefs = 0;

View file

@ -918,7 +918,7 @@ pub fn compare_impl_method(tcx: ty::ctxt,
// Create a substitution that maps the type parameters on the impl // Create a substitution that maps the type parameters on the impl
// to themselves and which replace any references to bound regions // to themselves and which replace any references to bound regions
// in the self type with free regions. So, for example, if the // 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`. // type with a free region `self`.
let dummy_impl_tps: ~[ty::t] = let dummy_impl_tps: ~[ty::t] =
impl_generics.type_param_defs.iter().enumerate(). impl_generics.type_param_defs.iter().enumerate().

View file

@ -85,17 +85,17 @@ pub fn relate_nested_regions(tcx: ty::ctxt,
} }
rr.fold_ty(ty); rr.fold_ty(ty);
struct RegionRelator<'self> { struct RegionRelator<'a> {
tcx: ty::ctxt, tcx: ty::ctxt,
stack: ~[ty::Region], 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 // FIXME(#10151) -- Define more precisely when a region is
// considered "nested". Consider taking variance into account as // considered "nested". Consider taking variance into account as
// well. // well.
impl<'self> TypeFolder for RegionRelator<'self> { impl<'a> TypeFolder for RegionRelator<'a> {
fn tcx(&self) -> ty::ctxt { fn tcx(&self) -> ty::ctxt {
self.tcx 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) { fn relate(&mut self, r_sub: ty::Region) {
for &r in self.stack.iter() { for &r in self.stack.iter() {
if !r.is_bound() && !r_sub.is_bound() { if !r.is_bound() && !r_sub.is_bound() {

View file

@ -69,12 +69,12 @@ pub struct LocationInfo {
/// A vtable context includes an inference context, a crate context, and a /// A vtable context includes an inference context, a crate context, and a
/// callback function to call in case of type error. /// callback function to call in case of type error.
pub struct VtableContext<'self> { pub struct VtableContext<'a> {
infcx: @mut infer::InferCtxt, 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 } pub fn tcx(&self) -> ty::ctxt { self.infcx.tcx }
} }

View file

@ -51,8 +51,8 @@ pub trait LatticeValue {
fn glb(cf: &CombineFields, a: &Self, b: &Self) -> cres<Self>; fn glb(cf: &CombineFields, a: &Self, b: &Self) -> cres<Self>;
} }
pub type LatticeOp<'self, T> = pub type LatticeOp<'a, T> =
'self |cf: &CombineFields, a: &T, b: &T| -> cres<T>; 'a |cf: &CombineFields, a: &T, b: &T| -> cres<T>;
impl LatticeValue for ty::t { impl LatticeValue for ty::t {
fn sub(cf: &CombineFields, a: &ty::t, b: &ty::t) -> ures { fn sub(cf: &CombineFields, a: &ty::t, b: &ty::t) -> ures {
@ -405,7 +405,7 @@ pub fn super_lattice_tys<L:LatticeDir+TyLatticeDir+Combine>(this: &L,
} }
} }
pub type LatticeDirOp<'self, T> = 'self |a: &T, b: &T| -> cres<T>; pub type LatticeDirOp<'a, T> = 'a |a: &T, b: &T| -> cres<T>;
#[deriving(Clone)] #[deriving(Clone)]
pub enum LatticeVarResult<V,T> { pub enum LatticeVarResult<V,T> {

View file

@ -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 `self` lifetime is defined somewhere outside and hence is not a
lifetime parameter bound by the function type (it "appears free"): lifetime parameter bound by the function type (it "appears free"):
fn<a>(&'a int) <: |&'self int|? (Yes, a => self) fn<a>(&'a int) <: |&'a int|? (Yes, a => self)
This subtyping relation does in fact hold. To see why, you have to 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 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: So, what if we reverse the order of the two function types, like this:
fn(&'self int) <: <a>|&'a int|? (No) fn(&'a int) <: <a>|&'a int|? (No)
Does the subtyping relationship still hold? The answer of course is Does the subtyping relationship still hold? The answer of course is
no. In this case, the function accepts *only the lifetime `&self`*, 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: Now let's look first at the third example, which was:
3. fn(&'self T) <: <b>|&'b T|? No! 3. fn(&'a T) <: <b>|&'b T|? No!
After steps 1 and 2 of the algorithm we will have replaced the types After steps 1 and 2 of the algorithm we will have replaced the types
like so: 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 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 `&self` was not bound, and hence was left as-is and not replaced with

View file

@ -218,7 +218,7 @@ pub fn infer_variance(tcx: ty::ctxt,
* *
* Terms are structured as a straightforward tree. Rather than rely on * Terms are structured as a straightforward tree. Rather than rely on
* GC, we allocate terms out of a bounded arena (the lifetime of this * 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 * We assign a unique index to each type/region parameter whose variance
* is to be inferred. We refer to such variables as "inferreds". An * 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. * a variable.
*/ */
type VarianceTermPtr<'self> = &'self VarianceTerm<'self>; type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
struct InferredIndex(uint); struct InferredIndex(uint);
enum VarianceTerm<'self> { enum VarianceTerm<'a> {
ConstantTerm(ty::Variance), ConstantTerm(ty::Variance),
TransformTerm(VarianceTermPtr<'self>, VarianceTermPtr<'self>), TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>),
InferredTerm(InferredIndex), InferredTerm(InferredIndex),
} }
impl<'self> ToStr for VarianceTerm<'self> { impl<'a> ToStr for VarianceTerm<'a> {
fn to_str(&self) -> ~str { fn to_str(&self) -> ~str {
match *self { match *self {
ConstantTerm(c1) => format!("{}", c1.to_str()), 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. * The first pass over the crate simply builds up the set of inferreds.
*/ */
struct TermsContext<'self> { struct TermsContext<'a> {
tcx: ty::ctxt, tcx: ty::ctxt,
arena: &'self Arena, arena: &'a Arena,
empty_variances: @ty::ItemVariances, empty_variances: @ty::ItemVariances,
@ -262,17 +262,17 @@ struct TermsContext<'self> {
inferred_map: HashMap<ast::NodeId, InferredIndex>, inferred_map: HashMap<ast::NodeId, InferredIndex>,
// Maps from an InferredIndex to the info for that variable. // Maps from an InferredIndex to the info for that variable.
inferred_infos: ~[InferredInfo<'self>], inferred_infos: ~[InferredInfo<'a>],
} }
enum ParamKind { TypeParam, RegionParam, SelfParam } enum ParamKind { TypeParam, RegionParam, SelfParam }
struct InferredInfo<'self> { struct InferredInfo<'a> {
item_id: ast::NodeId, item_id: ast::NodeId,
kind: ParamKind, kind: ParamKind,
index: uint, index: uint,
param_id: ast::NodeId, param_id: ast::NodeId,
term: VarianceTermPtr<'self>, term: VarianceTermPtr<'a>,
} }
fn determine_parameters_to_be_inferred<'a>(tcx: ty::ctxt, 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 terms_cx
} }
impl<'self> TermsContext<'self> { impl<'a> TermsContext<'a> {
fn add_inferred(&mut self, fn add_inferred(&mut self,
item_id: ast::NodeId, item_id: ast::NodeId,
kind: ParamKind, 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, fn visit_item(&mut self,
item: @ast::item, 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. * We walk the set of items and, for each member, generate new constraints.
*/ */
struct ConstraintContext<'self> { struct ConstraintContext<'a> {
terms_cx: TermsContext<'self>, terms_cx: TermsContext<'a>,
// These are pointers to common `ConstantTerm` instances // These are pointers to common `ConstantTerm` instances
covariant: VarianceTermPtr<'self>, covariant: VarianceTermPtr<'a>,
contravariant: VarianceTermPtr<'self>, contravariant: VarianceTermPtr<'a>,
invariant: VarianceTermPtr<'self>, invariant: VarianceTermPtr<'a>,
bivariant: VarianceTermPtr<'self>, bivariant: VarianceTermPtr<'a>,
constraints: ~[Constraint<'self>], constraints: ~[Constraint<'a>],
} }
/// Declares that the variable `decl_id` appears in a location with /// Declares that the variable `decl_id` appears in a location with
/// variance `variance`. /// variance `variance`.
struct Constraint<'self> { struct Constraint<'a> {
inferred: InferredIndex, inferred: InferredIndex,
variance: &'self VarianceTerm<'self>, variance: &'a VarianceTerm<'a>,
} }
fn add_constraints_from_crate<'a>(terms_cx: TermsContext<'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 constraint_cx
} }
impl<'self> Visitor<()> for ConstraintContext<'self> { impl<'a> Visitor<()> for ConstraintContext<'a> {
fn visit_item(&mut self, fn visit_item(&mut self,
item: @ast::item, 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 { fn tcx(&self) -> ty::ctxt {
self.terms_cx.tcx self.terms_cx.tcx
} }
@ -529,7 +529,7 @@ impl<'self> ConstraintContext<'self> {
item_def_id: ast::DefId, item_def_id: ast::DefId,
kind: ParamKind, kind: ParamKind,
index: uint) index: uint)
-> VarianceTermPtr<'self> { -> VarianceTermPtr<'a> {
/*! /*!
* Returns a variance term representing the declared variance of * Returns a variance term representing the declared variance of
* the type/region parameter with the given id. * the type/region parameter with the given id.
@ -557,7 +557,7 @@ impl<'self> ConstraintContext<'self> {
fn add_constraint(&mut self, fn add_constraint(&mut self,
index: InferredIndex, index: InferredIndex,
variance: VarianceTermPtr<'self>) { variance: VarianceTermPtr<'a>) {
debug!("add_constraint(index={}, variance={})", debug!("add_constraint(index={}, variance={})",
*index, variance.to_str()); *index, variance.to_str());
self.constraints.push(Constraint { inferred: index, self.constraints.push(Constraint { inferred: index,
@ -565,18 +565,18 @@ impl<'self> ConstraintContext<'self> {
} }
fn contravariant(&mut self, fn contravariant(&mut self,
variance: VarianceTermPtr<'self>) variance: VarianceTermPtr<'a>)
-> VarianceTermPtr<'self> { -> VarianceTermPtr<'a> {
self.xform(variance, self.contravariant) self.xform(variance, self.contravariant)
} }
fn invariant(&mut self, fn invariant(&mut self,
variance: VarianceTermPtr<'self>) variance: VarianceTermPtr<'a>)
-> VarianceTermPtr<'self> { -> VarianceTermPtr<'a> {
self.xform(variance, self.invariant) 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 { match v {
ty::Covariant => self.covariant, ty::Covariant => self.covariant,
ty::Invariant => self.invariant, ty::Invariant => self.invariant,
@ -586,9 +586,9 @@ impl<'self> ConstraintContext<'self> {
} }
fn xform(&mut self, fn xform(&mut self,
v1: VarianceTermPtr<'self>, v1: VarianceTermPtr<'a>,
v2: VarianceTermPtr<'self>) v2: VarianceTermPtr<'a>)
-> VarianceTermPtr<'self> { -> VarianceTermPtr<'a> {
match (*v1, *v2) { match (*v1, *v2) {
(_, ConstantTerm(ty::Covariant)) => { (_, ConstantTerm(ty::Covariant)) => {
// Applying a "covariant" transform is always a no-op // Applying a "covariant" transform is always a no-op
@ -609,7 +609,7 @@ impl<'self> ConstraintContext<'self> {
/// in a context with ambient variance `variance` /// in a context with ambient variance `variance`
fn add_constraints_from_ty(&mut self, fn add_constraints_from_ty(&mut self,
ty: ty::t, ty: ty::t,
variance: VarianceTermPtr<'self>) { variance: VarianceTermPtr<'a>) {
debug!("add_constraints_from_ty(ty={})", ty.repr(self.tcx())); debug!("add_constraints_from_ty(ty={})", ty.repr(self.tcx()));
match ty::get(ty).sty { match ty::get(ty).sty {
@ -704,7 +704,7 @@ impl<'self> ConstraintContext<'self> {
/// appearing in a context with ambient variance `variance` /// appearing in a context with ambient variance `variance`
fn add_constraints_from_vstore(&mut self, fn add_constraints_from_vstore(&mut self,
vstore: ty::vstore, vstore: ty::vstore,
variance: VarianceTermPtr<'self>) { variance: VarianceTermPtr<'a>) {
match vstore { match vstore {
ty::vstore_slice(r) => { ty::vstore_slice(r) => {
let contra = self.contravariant(variance); let contra = self.contravariant(variance);
@ -722,7 +722,7 @@ impl<'self> ConstraintContext<'self> {
def_id: ast::DefId, def_id: ast::DefId,
generics: &ty::Generics, generics: &ty::Generics,
substs: &ty::substs, substs: &ty::substs,
variance: VarianceTermPtr<'self>) { variance: VarianceTermPtr<'a>) {
debug!("add_constraints_from_substs(def_id={:?})", def_id); debug!("add_constraints_from_substs(def_id={:?})", def_id);
for (i, p) in generics.type_param_defs.iter().enumerate() { 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` /// `sig` appearing in a context with ambient variance `variance`
fn add_constraints_from_sig(&mut self, fn add_constraints_from_sig(&mut self,
sig: &ty::FnSig, sig: &ty::FnSig,
variance: VarianceTermPtr<'self>) { variance: VarianceTermPtr<'a>) {
let contra = self.contravariant(variance); let contra = self.contravariant(variance);
for &input in sig.inputs.iter() { for &input in sig.inputs.iter() {
self.add_constraints_from_ty(input, contra); self.add_constraints_from_ty(input, contra);
@ -761,7 +761,7 @@ impl<'self> ConstraintContext<'self> {
/// context with ambient variance `variance` /// context with ambient variance `variance`
fn add_constraints_from_region(&mut self, fn add_constraints_from_region(&mut self,
region: ty::Region, region: ty::Region,
variance: VarianceTermPtr<'self>) { variance: VarianceTermPtr<'a>) {
match region { match region {
ty::ReEarlyBound(param_id, _, _) => { ty::ReEarlyBound(param_id, _, _) => {
let index = self.inferred_index(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` /// appearing in a context with ambient variance `variance`
fn add_constraints_from_mt(&mut self, fn add_constraints_from_mt(&mut self,
mt: &ty::mt, mt: &ty::mt,
variance: VarianceTermPtr<'self>) { variance: VarianceTermPtr<'a>) {
match mt.mutbl { match mt.mutbl {
ast::MutMutable => { ast::MutMutable => {
let invar = self.invariant(variance); let invar = self.invariant(variance);
@ -813,9 +813,9 @@ impl<'self> ConstraintContext<'self> {
* inferred is then written into the `variance_map` in the tcx. * inferred is then written into the `variance_map` in the tcx.
*/ */
struct SolveContext<'self> { struct SolveContext<'a> {
terms_cx: TermsContext<'self>, terms_cx: TermsContext<'a>,
constraints: ~[Constraint<'self>], constraints: ~[Constraint<'a>],
// Maps from an InferredIndex to the inferred value for that variable. // Maps from an InferredIndex to the inferred value for that variable.
solutions: ~[ty::Variance] solutions: ~[ty::Variance]
@ -833,7 +833,7 @@ fn solve_constraints(constraints_cx: ConstraintContext) {
solutions_cx.write(); solutions_cx.write();
} }
impl<'self> SolveContext<'self> { impl<'a> SolveContext<'a> {
fn solve(&mut self) { fn solve(&mut self) {
// Propagate constraints until a fixed point is reached. Note // Propagate constraints until a fixed point is reached. Note
// that the maximum number of iterations is 2C where C is the // 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 { match *term {
ConstantTerm(v) => { ConstantTerm(v) => {
v v

View file

@ -69,12 +69,12 @@ pub fn field_exprs(fields: ~[ast::Field]) -> ~[@ast::Expr] {
fields.map(|f| f.expr) fields.map(|f| f.expr)
} }
struct LoopQueryVisitor<'self> { struct LoopQueryVisitor<'a> {
p: 'self |&ast::Expr_| -> bool, p: 'a |&ast::Expr_| -> bool,
flag: bool, flag: bool,
} }
impl<'self> Visitor<()> for LoopQueryVisitor<'self> { impl<'a> Visitor<()> for LoopQueryVisitor<'a> {
fn visit_expr(&mut self, e: @ast::Expr, _: ()) { fn visit_expr(&mut self, e: @ast::Expr, _: ()) {
self.flag |= (self.p)(&e.node); self.flag |= (self.p)(&e.node);
match e.node { match e.node {
@ -97,12 +97,12 @@ pub fn loop_query(b: ast::P<ast::Block>, p: |&ast::Expr_| -> bool) -> bool {
return v.flag; return v.flag;
} }
struct BlockQueryVisitor<'self> { struct BlockQueryVisitor<'a> {
p: 'self |@ast::Expr| -> bool, p: 'a |@ast::Expr| -> bool,
flag: bool, flag: bool,
} }
impl<'self> Visitor<()> for BlockQueryVisitor<'self> { impl<'a> Visitor<()> for BlockQueryVisitor<'a> {
fn visit_expr(&mut self, e: @ast::Expr, _:()) { fn visit_expr(&mut self, e: @ast::Expr, _:()) {
self.flag |= (self.p)(e); self.flag |= (self.p)(e);
visit::walk_expr(self, e, ()) visit::walk_expr(self, e, ())

View file

@ -567,7 +567,7 @@ fn repr_vec<T:Repr>(tcx: ctxt, v: &[T]) -> ~str {
vec_map_to_str(v, |t| t.repr(tcx)) 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 { fn repr(&self, tcx: ctxt) -> ~str {
repr_vec(tcx, *self) repr_vec(tcx, *self)
} }

View file

@ -239,7 +239,7 @@ impl Clean<Attribute> for ast::Attribute {
} }
// This is a rough approximation that gets us what we want. // 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 { fn name(&self) -> @str {
match **self { match **self {
Word(ref n) | List(ref n, _) | NameValue(ref n, _) => Word(ref n) | List(ref n, _) | NameValue(ref n, _) =>

View file

@ -17,10 +17,10 @@ use std::fmt;
/// Wrapper struct which will emit the HTML-escaped version of the contained /// Wrapper struct which will emit the HTML-escaped version of the contained
/// string when passed to a format string. /// 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> { impl<'a> fmt::Default for Escape<'a> {
fn fmt(s: &Escape<'self>, fmt: &mut fmt::Formatter) { fn fmt(s: &Escape<'a>, fmt: &mut fmt::Formatter) {
// Because the internet is always right, turns out there's not that many // Because the internet is always right, turns out there's not that many
// characters to escape: http://stackoverflow.com/questions/7381974 // characters to escape: http://stackoverflow.com/questions/7381974
let pile_o_bits = s.as_slice(); let pile_o_bits = s.as_slice();

View file

@ -33,7 +33,7 @@ pub struct VisSpace(Option<ast::visibility>);
/// space after it. /// space after it.
pub struct PuritySpace(ast::purity); pub struct PuritySpace(ast::purity);
/// Wrapper struct for properly emitting a method declaration. /// 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 { impl fmt::Default for clean::Generics {
fn fmt(g: &clean::Generics, f: &mut fmt::Formatter) { 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> { impl<'a> fmt::Default for Method<'a> {
fn fmt(m: &Method<'self>, f: &mut fmt::Formatter) { fn fmt(m: &Method<'a>, f: &mut fmt::Formatter) {
let Method(selfty, d) = *m; let Method(selfty, d) = *m;
let mut args = ~""; let mut args = ~"";
match *selfty { match *selfty {

View file

@ -18,10 +18,10 @@ pub struct Layout {
crate: ~str, crate: ~str,
} }
pub struct Page<'self> { pub struct Page<'a> {
title: &'self str, title: &'a str,
ty: &'self str, ty: &'a str,
root_path: &'self str, root_path: &'a str,
} }
pub fn render<T: fmt::Default, S: fmt::Default>( pub fn render<T: fmt::Default, S: fmt::Default>(

View file

@ -30,7 +30,7 @@ use std::vec;
/// A unit struct which has the `fmt::Default` trait implemented. When /// A unit struct which has the `fmt::Default` trait implemented. When
/// formatted, this struct will emit the HTML corresponding to the rendered /// formatted, this struct will emit the HTML corresponding to the rendered
/// version of the contained markdown string. /// 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 OUTPUT_UNIT: libc::size_t = 64;
static MKDEXT_NO_INTRA_EMPHASIS: libc::c_uint = 1 << 0; 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> { impl<'a> fmt::Default for Markdown<'a> {
fn fmt(md: &Markdown<'self>, fmt: &mut fmt::Formatter) { fn fmt(md: &Markdown<'a>, fmt: &mut fmt::Formatter) {
// This is actually common enough to special-case // This is actually common enough to special-case
if md.len() == 0 { return; } if md.len() == 0 { return; }
render(fmt.buf, md.as_slice()); render(fmt.buf, md.as_slice());

View file

@ -166,8 +166,8 @@ pub struct Cache {
} }
/// Helper struct to render all source code to HTML pages /// Helper struct to render all source code to HTML pages
struct SourceCollector<'self> { struct SourceCollector<'a> {
cx: &'self mut Context, cx: &'a mut Context,
/// Processed source-file paths /// Processed source-file paths
seen: HashSet<~str>, 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 /// Wrapper struct to render the source code of a file. This will do things like
/// adding line numbers to the left-hand side. /// 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 // Helper structs for rendering items/sidebars and carrying along contextual
// information // information
struct Item<'self> { cx: &'self Context, item: &'self clean::Item, } struct Item<'a> { cx: &'a Context, item: &'a clean::Item, }
struct Sidebar<'self> { cx: &'self Context, item: &'self 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 /// 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. /// 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; return Unknown;
} }
impl<'self> DocFolder for SourceCollector<'self> { impl<'a> DocFolder for SourceCollector<'a> {
fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> { fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
// If we're including source files, and we haven't seen this file yet, // If we're including source files, and we haven't seen this file yet,
// then we need to render it out to the filesystem // 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. /// Renders the given filename into its corresponding HTML source file.
fn emit_source(&mut self, filename: &str) -> bool { fn emit_source(&mut self, filename: &str) -> bool {
let p = Path::new(filename); 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) { fn generics(&mut self, generics: &clean::Generics) {
for typ in generics.type_params.iter() { for typ in generics.type_params.iter() {
self.typarams.insert(typ.id, typ.name.clone()); 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 { fn ismodule(&self) -> bool {
match self.item.inner { match self.item.inner {
clean::ModuleItem(..) => true, _ => false clean::ModuleItem(..) => true, _ => false
@ -870,8 +870,8 @@ impl<'self> Item<'self> {
} }
} }
impl<'self> fmt::Default for Item<'self> { impl<'a> fmt::Default for Item<'a> {
fn fmt(it: &Item<'self>, fmt: &mut fmt::Formatter) { fn fmt(it: &Item<'a>, fmt: &mut fmt::Formatter) {
match attr::find_stability(it.item.attrs.iter()) { match attr::find_stability(it.item.attrs.iter()) {
Some(stability) => { Some(stability) => {
write!(fmt.buf, write!(fmt.buf,
@ -1057,9 +1057,9 @@ fn item_module(w: &mut Writer, cx: &Context,
match myitem.inner { match myitem.inner {
clean::StaticItem(ref s) | clean::ForeignStaticItem(ref s) => { clean::StaticItem(ref s) | clean::ForeignStaticItem(ref s) => {
struct Initializer<'self>(&'self str); struct Initializer<'a>(&'a str);
impl<'self> fmt::Default for Initializer<'self> { impl<'a> fmt::Default for Initializer<'a> {
fn fmt(s: &Initializer<'self>, f: &mut fmt::Formatter) { fn fmt(s: &Initializer<'a>, f: &mut fmt::Formatter) {
if s.len() == 0 { return; } if s.len() == 0 { return; }
write!(f.buf, "<code> = </code>"); write!(f.buf, "<code> = </code>");
let tag = if s.contains("\n") { "pre" } else { "code" }; 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); document(w, it);
} }
impl<'self> fmt::Default for Sidebar<'self> { impl<'a> fmt::Default for Sidebar<'a> {
fn fmt(s: &Sidebar<'self>, fmt: &mut fmt::Formatter) { fn fmt(s: &Sidebar<'a>, fmt: &mut fmt::Formatter) {
let cx = s.cx; let cx = s.cx;
let it = s.item; let it = s.item;
write!(fmt.buf, "<p class='location'>"); write!(fmt.buf, "<p class='location'>");
@ -1628,8 +1628,8 @@ fn build_sidebar(m: &clean::Module) -> HashMap<~str, ~[~str]> {
return map; return map;
} }
impl<'self> fmt::Default for Source<'self> { impl<'a> fmt::Default for Source<'a> {
fn fmt(s: &Source<'self>, fmt: &mut fmt::Formatter) { fn fmt(s: &Source<'a>, fmt: &mut fmt::Formatter) {
let lines = s.lines().len(); let lines = s.lines().len();
let mut cols = 0; let mut cols = 0;
let mut tmp = lines; let mut tmp = lines;

View file

@ -76,12 +76,12 @@ pub fn strip_private(crate: clean::Crate) -> plugins::PluginResult {
(crate, None) (crate, None)
} }
struct Stripper<'self> { struct Stripper<'a> {
retained: &'self mut HashSet<ast::NodeId>, retained: &'a mut HashSet<ast::NodeId>,
exported_items: &'self HashSet<ast::NodeId>, exported_items: &'a HashSet<ast::NodeId>,
} }
impl<'self> fold::DocFolder for Stripper<'self> { impl<'a> fold::DocFolder for Stripper<'a> {
fn fold_item(&mut self, i: Item) -> Option<Item> { fn fold_item(&mut self, i: Item) -> Option<Item> {
match i.inner { match i.inner {
// These items can all get re-exported // 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 // This stripper discards all private impls of traits
struct ImplStripper<'self>(&'self HashSet<ast::NodeId>); struct ImplStripper<'a>(&'a HashSet<ast::NodeId>);
impl<'self> fold::DocFolder for ImplStripper<'self> { impl<'a> fold::DocFolder for ImplStripper<'a> {
fn fold_item(&mut self, i: Item) -> Option<Item> { fn fold_item(&mut self, i: Item) -> Option<Item> {
match i.inner { match i.inner {
clean::ImplItem(ref imp) => { clean::ImplItem(ref imp) => {

View file

@ -83,9 +83,9 @@ pub mod usage;
/// A PkgScript represents user-supplied custom logic for /// A PkgScript represents user-supplied custom logic for
/// special build hooks. This only exists for packages with /// special build hooks. This only exists for packages with
/// an explicit package script. /// an explicit package script.
struct PkgScript<'self> { struct PkgScript<'a> {
/// Uniquely identifies this package /// Uniquely identifies this package
id: &'self PkgId, id: &'a PkgId,
/// File path for the package script /// File path for the package script
input: Path, input: Path,
/// The session to use *only* for compiling the custom /// The session to use *only* for compiling the custom
@ -99,7 +99,7 @@ struct PkgScript<'self> {
build_dir: Path build_dir: Path
} }
impl<'self> PkgScript<'self> { impl<'a> PkgScript<'a> {
/// Given the path name for a package script /// Given the path name for a package script
/// and a package ID, parse the package script into /// and a package ID, parse the package script into
/// a PkgScript that we can then execute /// a PkgScript that we can then execute

View file

@ -427,18 +427,18 @@ pub fn compile_crate(ctxt: &BuildContext,
compile_input(ctxt, exec, pkg_id, crate, workspace, deps, flags, cfgs, opt, what) compile_input(ctxt, exec, pkg_id, crate, workspace, deps, flags, cfgs, opt, what)
} }
struct ViewItemVisitor<'self> { struct ViewItemVisitor<'a> {
context: &'self BuildContext, context: &'a BuildContext,
parent: &'self PkgId, parent: &'a PkgId,
parent_crate: &'self Path, parent_crate: &'a Path,
sess: session::Session, sess: session::Session,
exec: &'self mut workcache::Exec, exec: &'a mut workcache::Exec,
c: &'self ast::Crate, c: &'a ast::Crate,
save: 'self |Path|, save: 'a |Path|,
deps: &'self mut DepMap 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: ()) { fn visit_view_item(&mut self, vi: &ast::view_item, env: ()) {
use conditions::nonexistent_package::cond; use conditions::nonexistent_package::cond;

View file

@ -65,16 +65,16 @@ impl<T: 'static> Any for T {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Extension methods for a referenced `Any` trait object /// 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` /// Returns true if the boxed type is the same as `T`
fn is<T: 'static>(self) -> bool; fn is<T: 'static>(self) -> bool;
/// Returns some reference to the boxed value if it is of type `T`, or /// Returns some reference to the boxed value if it is of type `T`, or
/// `None` if it isn't. /// `None` if it isn't.
fn as_ref<T: 'static>(self) -> Option<&'self T>; fn as_ref<T: 'static>(self) -> Option<&'a T>;
} }
impl<'self> AnyRefExt<'self> for &'self Any { impl<'a> AnyRefExt<'a> for &'a Any {
#[inline] #[inline]
fn is<T: 'static>(self) -> bool { fn is<T: 'static>(self) -> bool {
// Get TypeId of the type this function is instantiated with // Get TypeId of the type this function is instantiated with
@ -88,7 +88,7 @@ impl<'self> AnyRefExt<'self> for &'self Any {
} }
#[inline] #[inline]
fn as_ref<T: 'static>(self) -> Option<&'self T> { fn as_ref<T: 'static>(self) -> Option<&'a T> {
if self.is::<T>() { if self.is::<T>() {
Some(unsafe { transmute(self.as_void_ptr()) }) Some(unsafe { transmute(self.as_void_ptr()) })
} else { } else {
@ -98,15 +98,15 @@ impl<'self> AnyRefExt<'self> for &'self Any {
} }
/// Extension methods for a mutable referenced `Any` trait object /// 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 /// Returns some mutable reference to the boxed value if it is of type `T`, or
/// `None` if it isn't. /// `None` if it isn't.
fn as_mut<T: 'static>(self) -> Option<&'self mut T>; fn as_mut<T: 'static>(self) -> Option<&'a mut T>;
} }
impl<'self> AnyMutRefExt<'self> for &'self mut Any { impl<'a> AnyMutRefExt<'a> for &'a mut Any {
#[inline] #[inline]
fn as_mut<T: 'static>(self) -> Option<&'self mut T> { fn as_mut<T: 'static>(self) -> Option<&'a mut T> {
if self.is::<T>() { if self.is::<T>() {
Some(unsafe { transmute(self.as_mut_void_ptr()) }) Some(unsafe { transmute(self.as_mut_void_ptr()) })
} else { } else {
@ -149,7 +149,7 @@ impl ToStr for ~Any {
fn to_str(&self) -> ~str { ~"~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" } fn to_str(&self) -> ~str { ~"&Any" }
} }

View file

@ -145,15 +145,15 @@ pub trait AsciiCast<T> {
fn is_ascii(&self) -> bool; fn is_ascii(&self) -> bool;
} }
impl<'self> AsciiCast<&'self[Ascii]> for &'self [u8] { impl<'a> AsciiCast<&'a[Ascii]> for &'a [u8] {
#[inline] #[inline]
fn to_ascii(&self) -> &'self[Ascii] { fn to_ascii(&self) -> &'a[Ascii] {
assert!(self.is_ascii()); assert!(self.is_ascii());
unsafe {self.to_ascii_nocheck()} unsafe {self.to_ascii_nocheck()}
} }
#[inline] #[inline]
unsafe fn to_ascii_nocheck(&self) -> &'self[Ascii] { unsafe fn to_ascii_nocheck(&self) -> &'a[Ascii] {
cast::transmute(*self) 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] #[inline]
fn to_ascii(&self) -> &'self [Ascii] { fn to_ascii(&self) -> &'a [Ascii] {
assert!(self.is_ascii()); assert!(self.is_ascii());
unsafe { self.to_ascii_nocheck() } unsafe { self.to_ascii_nocheck() }
} }
#[inline] #[inline]
unsafe fn to_ascii_nocheck(&self) -> &'self [Ascii] { unsafe fn to_ascii_nocheck(&self) -> &'a [Ascii] {
cast::transmute(*self) cast::transmute(*self)
} }
@ -272,7 +272,7 @@ pub trait AsciiStr {
fn eq_ignore_case(self, other: &[Ascii]) -> bool; fn eq_ignore_case(self, other: &[Ascii]) -> bool;
} }
impl<'self> AsciiStr for &'self [Ascii] { impl<'a> AsciiStr for &'a [Ascii] {
#[inline] #[inline]
fn as_str_ascii<'a>(&'a self) -> &'a str { fn as_str_ascii<'a>(&'a self) -> &'a str {
unsafe { cast::transmute(*self) } unsafe { cast::transmute(*self) }
@ -351,7 +351,7 @@ pub trait StrAsciiExt {
fn eq_ignore_ascii_case(&self, other: &str) -> bool; fn eq_ignore_ascii_case(&self, other: &str) -> bool;
} }
impl<'self> StrAsciiExt for &'self str { impl<'a> StrAsciiExt for &'a str {
#[inline] #[inline]
fn to_ascii_upper(&self) -> ~str { fn to_ascii_upper(&self) -> ~str {
unsafe { str_copy_map_bytes(*self, ASCII_UPPER_MAP) } unsafe { str_copy_map_bytes(*self, ASCII_UPPER_MAP) }

View file

@ -153,7 +153,7 @@ pub mod traits {
use ops::Add; use ops::Add;
use vec::Vector; use vec::Vector;
impl<'self,T:Clone, V: Vector<T>> Add<V,@[T]> for @[T] { impl<'a,T:Clone, V: Vector<T>> Add<V,@[T]> for @[T] {
#[inline] #[inline]
fn add(&self, rhs: &V) -> @[T] { fn add(&self, rhs: &V) -> @[T] {
append(*self, rhs.as_slice()) append(*self, rhs.as_slice())

View file

@ -27,48 +27,48 @@ pub fn ref_eq<'a, 'b, T>(thing: &'a T, other: &'b T) -> bool {
// Equality for region pointers // Equality for region pointers
#[cfg(not(test))] #[cfg(not(test))]
impl<'self, T: Eq> Eq for &'self T { impl<'a, T: Eq> Eq for &'a T {
#[inline] #[inline]
fn eq(&self, other: & &'self T) -> bool { fn eq(&self, other: & &'a T) -> bool {
*(*self) == *(*other) *(*self) == *(*other)
} }
#[inline] #[inline]
fn ne(&self, other: & &'self T) -> bool { fn ne(&self, other: & &'a T) -> bool {
*(*self) != *(*other) *(*self) != *(*other)
} }
} }
// Comparison for region pointers // Comparison for region pointers
#[cfg(not(test))] #[cfg(not(test))]
impl<'self, T: Ord> Ord for &'self T { impl<'a, T: Ord> Ord for &'a T {
#[inline] #[inline]
fn lt(&self, other: & &'self T) -> bool { fn lt(&self, other: & &'a T) -> bool {
*(*self) < *(*other) *(*self) < *(*other)
} }
#[inline] #[inline]
fn le(&self, other: & &'self T) -> bool { fn le(&self, other: & &'a T) -> bool {
*(*self) <= *(*other) *(*self) <= *(*other)
} }
#[inline] #[inline]
fn ge(&self, other: & &'self T) -> bool { fn ge(&self, other: & &'a T) -> bool {
*(*self) >= *(*other) *(*self) >= *(*other)
} }
#[inline] #[inline]
fn gt(&self, other: & &'self T) -> bool { fn gt(&self, other: & &'a T) -> bool {
*(*self) > *(*other) *(*self) > *(*other)
} }
} }
#[cfg(not(test))] #[cfg(not(test))]
impl<'self, T: TotalOrd> TotalOrd for &'self T { impl<'a, T: TotalOrd> TotalOrd for &'a T {
#[inline] #[inline]
fn cmp(&self, other: & &'self T) -> Ordering { (**self).cmp(*other) } fn cmp(&self, other: & &'a T) -> Ordering { (**self).cmp(*other) }
} }
#[cfg(not(test))] #[cfg(not(test))]
impl<'self, T: TotalEq> TotalEq for &'self T { impl<'a, T: TotalEq> TotalEq for &'a T {
#[inline] #[inline]
fn equals(&self, other: & &'self T) -> bool { (**self).equals(*other) } fn equals(&self, other: & &'a T) -> bool { (**self).equals(*other) }
} }
#[cfg(test)] #[cfg(test)]

View file

@ -234,7 +234,7 @@ pub trait ToCStr {
} }
} }
impl<'self> ToCStr for &'self str { impl<'a> ToCStr for &'a str {
#[inline] #[inline]
fn to_c_str(&self) -> CString { fn to_c_str(&self) -> CString {
self.as_bytes().to_c_str() 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()` // The length of the stack allocated buffer for `vec.with_c_str()`
static BUF_LEN: uint = 128; static BUF_LEN: uint = 128;
impl<'self> ToCStr for &'self [u8] { impl<'a> ToCStr for &'a [u8] {
fn to_c_str(&self) -> CString { fn to_c_str(&self) -> CString {
let mut cs = unsafe { self.to_c_str_unchecked() }; let mut cs = unsafe { self.to_c_str_unchecked() };
cs.with_mut_ref(|buf| check_for_null(*self, buf)); 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. /// External iterator for a CString's bytes.
/// ///
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
pub struct CStringIterator<'self> { pub struct CStringIterator<'a> {
priv ptr: *libc::c_char, priv ptr: *libc::c_char,
priv lifetime: &'self libc::c_char, // FIXME: #5922 priv lifetime: &'a libc::c_char, // FIXME: #5922
} }
impl<'self> Iterator<libc::c_char> for CStringIterator<'self> { impl<'a> Iterator<libc::c_char> for CStringIterator<'a> {
fn next(&mut self) -> Option<libc::c_char> { fn next(&mut self) -> Option<libc::c_char> {
let ch = unsafe { *self.ptr }; let ch = unsafe { *self.ptr };
if ch == 0 { if ch == 0 {

View file

@ -15,7 +15,7 @@ use ptr;
use unstable::intrinsics::TyDesc; use unstable::intrinsics::TyDesc;
use unstable::raw; use unstable::raw;
type DropGlue<'self> = 'self |**TyDesc, *c_void|; type DropGlue<'a> = 'a |**TyDesc, *c_void|;
/* /*
* Box annihilation * Box annihilation

View file

@ -64,22 +64,22 @@ impl<T> Clone for @mut T {
fn clone(&self) -> @mut T { *self } 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. /// Return a shallow copy of the borrowed pointer.
#[inline] #[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. /// Return a shallow copy of the slice.
#[inline] #[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. /// Return a shallow copy of the slice.
#[inline] #[inline]
fn clone(&self) -> &'self str { *self } fn clone(&self) -> &'a str { *self }
} }
macro_rules! clone_impl( macro_rules! clone_impl(

View file

@ -162,12 +162,12 @@ impl<T, U> Condition<T, U> {
/// ///
/// Normally this object is not dealt with directly, but rather it's directly /// Normally this object is not dealt with directly, but rather it's directly
/// used after being returned from `trap` /// used after being returned from `trap`
pub struct Trap<'self, T, U> { pub struct Trap<'a, T, U> {
priv cond: &'self Condition<T, U>, priv cond: &'a Condition<T, U>,
priv handler: @Handler<T, U> priv handler: @Handler<T, U>
} }
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 /// Execute a block of code with this trap handler's exception handler
/// registered. /// registered.
/// ///
@ -181,7 +181,7 @@ impl<'self, T, U> Trap<'self, T, U> {
/// }); /// });
/// assert_eq!(result, 7); /// assert_eq!(result, 7);
/// ``` /// ```
pub fn inside<V>(&self, inner: 'self || -> V) -> V { pub fn inside<V>(&self, inner: 'a || -> V) -> V {
let _g = Guard { cond: self.cond }; let _g = Guard { cond: self.cond };
debug!("Trap: pushing handler to TLS"); debug!("Trap: pushing handler to TLS");
local_data::set(self.cond.key, self.handler); 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 /// Returns a guard that will automatically reset the condition upon
/// exit of the scope. This is useful if you want to use conditions with /// exit of the scope. This is useful if you want to use conditions with
/// an RAII pattern. /// an RAII pattern.
pub fn guard(&self) -> Guard<'self,T,U> { pub fn guard(&self) -> Guard<'a,T,U> {
let guard = Guard { let guard = Guard {
cond: self.cond 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 /// 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 /// the scope. This is useful if you want to use conditions with an RAII
/// pattern. /// pattern.
pub struct Guard<'self, T, U> { pub struct Guard<'a, T, U> {
priv cond: &'self Condition<T, U> priv cond: &'a Condition<T, U>
} }
#[unsafe_destructor] #[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) { fn drop(&mut self) {
debug!("Guard: popping handler from TLS"); debug!("Guard: popping handler from TLS");
let curr = local_data::pop(self.cond.key); let curr = local_data::pop(self.cond.key);

View file

@ -476,7 +476,7 @@ pub mod rt;
/// A struct to represent both where to emit formatting strings to and how they /// 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 /// should be formatted. A mutable version of this is passed to all formatting
/// traits. /// traits.
pub struct Formatter<'self> { pub struct Formatter<'a> {
/// Flags for formatting (packed version of rt::Flag) /// Flags for formatting (packed version of rt::Flag)
flags: uint, flags: uint,
/// Character used as 'fill' whenever there is alignment /// Character used as 'fill' whenever there is alignment
@ -489,21 +489,21 @@ pub struct Formatter<'self> {
precision: Option<uint>, precision: Option<uint>,
/// Output buffer. /// Output buffer.
buf: &'self mut io::Writer, buf: &'a mut io::Writer,
priv curarg: vec::VecIterator<'self, Argument<'self>>, priv curarg: vec::VecIterator<'a, Argument<'a>>,
priv args: &'self [Argument<'self>], priv args: &'a [Argument<'a>],
} }
/// This struct represents the generic "argument" which is taken by the Xprintf /// 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 /// 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 /// 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. /// 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 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 /// When using the format_args!() macro, this function is used to generate the
/// Arguments structure. The compiler inserts an `unsafe` block to call this, /// Arguments structure. The compiler inserts an `unsafe` block to call this,
/// which is valid because the compiler performs all necessary validation to /// 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 /// 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 /// string at compile-time so usage of the `write` and `format` functions can
/// be safely performed. /// be safely performed.
pub struct Arguments<'self> { pub struct Arguments<'a> {
priv fmt: &'self [rt::Piece<'self>], priv fmt: &'a [rt::Piece<'a>],
priv args: &'self [Argument<'self>], priv args: &'a [Argument<'a>],
} }
/// When a format is not otherwise specified, types are formatted by ascribing /// 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()); 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 // 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 // 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) { fn fmt(s: &T, f: &mut Formatter) {
f.pad(s.as_slice()); f.pad(s.as_slice());
} }
@ -1111,7 +1111,7 @@ impl<T> Pointer for *mut T {
// Implementation of Default for various core types // Implementation of Default for various core types
macro_rules! delegate(($ty:ty to $other:ident) => { 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) { fn fmt(me: &$ty, f: &mut Formatter) {
$other::fmt(me, f) $other::fmt(me, f)
} }
@ -1129,7 +1129,7 @@ delegate!( u32 to Unsigned)
delegate!( u64 to Unsigned) delegate!( u64 to Unsigned)
delegate!(@str to String) delegate!(@str to String)
delegate!(~str to String) delegate!(~str to String)
delegate!(&'self str to String) delegate!(&'a str to String)
delegate!(bool to Bool) delegate!(bool to Bool)
delegate!(char to Char) delegate!(char to Char)
delegate!(f32 to Float) delegate!(f32 to Float)

View file

@ -24,31 +24,31 @@ condition! { pub parse_error: ~str -> (); }
/// A piece is a portion of the format string which represents the next part to /// 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. /// emit. These are emitted as a stream by the `Parser` class.
#[deriving(Eq)] #[deriving(Eq)]
pub enum Piece<'self> { pub enum Piece<'a> {
/// A literal string which should directly be emitted /// 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 /// A back-reference to whatever the current argument is. This is used
/// inside of a method call to refer back to the original argument. /// inside of a method call to refer back to the original argument.
CurrentArgument, CurrentArgument,
/// This describes that formatting should process the next argument (as /// This describes that formatting should process the next argument (as
/// specified inside) for emission. /// specified inside) for emission.
Argument(Argument<'self>), Argument(Argument<'a>),
} }
/// Representation of an argument specification. /// Representation of an argument specification.
#[deriving(Eq)] #[deriving(Eq)]
pub struct Argument<'self> { pub struct Argument<'a> {
/// Where to find this argument /// Where to find this argument
position: Position<'self>, position: Position<'a>,
/// How to format the argument /// How to format the argument
format: FormatSpec<'self>, format: FormatSpec<'a>,
/// If not `None`, what method to invoke on the argument /// 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. /// Specification for the formatting of an argument in the format string.
#[deriving(Eq)] #[deriving(Eq)]
pub struct FormatSpec<'self> { pub struct FormatSpec<'a> {
/// Optionally specified character to fill alignment with /// Optionally specified character to fill alignment with
fill: Option<char>, fill: Option<char>,
/// Optionally specified alignment /// Optionally specified alignment
@ -56,20 +56,20 @@ pub struct FormatSpec<'self> {
/// Packed version of various flags provided /// Packed version of various flags provided
flags: uint, flags: uint,
/// The integer precision to use /// The integer precision to use
precision: Count<'self>, precision: Count<'a>,
/// The string width requested for the resulting format /// 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 /// The descriptor string representing the name of the format desired for
/// this argument, this can be empty or any number of characters, although /// this argument, this can be empty or any number of characters, although
/// it is required to be one word. /// it is required to be one word.
ty: &'self str ty: &'a str
} }
/// Enum describing where an argument for a format can be located. /// Enum describing where an argument for a format can be located.
#[deriving(Eq)] #[deriving(Eq)]
#[allow(missing_doc)] #[allow(missing_doc)]
pub enum Position<'self> { pub enum Position<'a> {
ArgumentNext, ArgumentIs(uint), ArgumentNamed(&'self str) ArgumentNext, ArgumentIs(uint), ArgumentNamed(&'a str)
} }
/// Enum of alignments which are supported. /// Enum of alignments which are supported.
@ -92,9 +92,9 @@ pub enum Flag {
/// can reference either an argument or a literal integer. /// can reference either an argument or a literal integer.
#[deriving(Eq)] #[deriving(Eq)]
#[allow(missing_doc)] #[allow(missing_doc)]
pub enum Count<'self> { pub enum Count<'a> {
CountIs(uint), CountIs(uint),
CountIsName(&'self str), CountIsName(&'a str),
CountIsParam(uint), CountIsParam(uint),
CountIsNextParam, CountIsNextParam,
CountImplied, CountImplied,
@ -103,7 +103,7 @@ pub enum Count<'self> {
/// Enum describing all of the possible methods which the formatting language /// Enum describing all of the possible methods which the formatting language
/// currently supports. /// currently supports.
#[deriving(Eq)] #[deriving(Eq)]
pub enum Method<'self> { pub enum Method<'a> {
/// A plural method selects on an integer over a list of either integer or /// 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 /// keyword-defined clauses. The meaning of the keywords is defined by the
/// current locale. /// current locale.
@ -113,23 +113,23 @@ pub enum Method<'self> {
/// ///
/// The final element of this enum is the default "other" case which is /// The final element of this enum is the default "other" case which is
/// always required to be specified. /// always required to be specified.
Plural(Option<uint>, ~[PluralArm<'self>], ~[Piece<'self>]), Plural(Option<uint>, ~[PluralArm<'a>], ~[Piece<'a>]),
/// A select method selects over a string. Each arm is a different string /// A select method selects over a string. Each arm is a different string
/// which can be selected for. /// which can be selected for.
/// ///
/// As with `Plural`, a default "other" case is required as well. /// 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. /// Structure representing one "arm" of the `plural` function.
#[deriving(Eq)] #[deriving(Eq)]
pub struct PluralArm<'self> { pub struct PluralArm<'a> {
/// A selector can either be specified by a keyword or with an integer /// A selector can either be specified by a keyword or with an integer
/// literal. /// literal.
selector: Either<PluralKeyword, uint>, selector: Either<PluralKeyword, uint>,
/// Array of pieces which are the format of this arm /// 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 /// 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. /// Structure representing one "arm" of the `select` function.
#[deriving(Eq)] #[deriving(Eq)]
pub struct SelectArm<'self> { pub struct SelectArm<'a> {
/// String selector which guards this arm /// String selector which guards this arm
selector: &'self str, selector: &'a str,
/// Array of pieces which are the format of this arm /// 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 /// 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 /// This is a recursive-descent parser for the sake of simplicity, and if
/// necessary there's probably lots of room for improvement performance-wise. /// necessary there's probably lots of room for improvement performance-wise.
pub struct Parser<'self> { pub struct Parser<'a> {
priv input: &'self str, priv input: &'a str,
priv cur: str::CharOffsetIterator<'self>, priv cur: str::CharOffsetIterator<'a>,
priv depth: uint, priv depth: uint,
} }
impl<'self> Iterator<Piece<'self>> for Parser<'self> { impl<'a> Iterator<Piece<'a>> for Parser<'a> {
fn next(&mut self) -> Option<Piece<'self>> { fn next(&mut self) -> Option<Piece<'a>> {
match self.cur.clone().next() { match self.cur.clone().next() {
Some((_, '#')) => { self.cur.next(); Some(CurrentArgument) } Some((_, '#')) => { self.cur.next(); Some(CurrentArgument) }
Some((_, '{')) => { Some((_, '{')) => {
@ -191,7 +191,7 @@ impl<'self> Iterator<Piece<'self>> for Parser<'self> {
} }
} }
impl<'self> Parser<'self> { impl<'a> Parser<'a> {
/// Creates a new parser for the given format string /// Creates a new parser for the given format string
pub fn new<'a>(s: &'a str) -> Parser<'a> { pub fn new<'a>(s: &'a str) -> Parser<'a> {
Parser { Parser {
@ -276,7 +276,7 @@ impl<'self> Parser<'self> {
/// Parses all of a string which is to be considered a "raw literal" in a /// Parses all of a string which is to be considered a "raw literal" in a
/// format string. This is everything outside of the braces. /// 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 { loop {
// we may not consume the character, so clone the iterator // we may not consume the character, so clone the iterator
match self.cur.clone().next() { match self.cur.clone().next() {
@ -295,7 +295,7 @@ impl<'self> Parser<'self> {
/// Parses an Argument structure, or what's contained within braces inside /// Parses an Argument structure, or what's contained within braces inside
/// the format string /// the format string
fn argument(&mut self) -> Argument<'self> { fn argument(&mut self) -> Argument<'a> {
Argument { Argument {
position: self.position(), position: self.position(),
format: self.format(), format: self.format(),
@ -305,7 +305,7 @@ impl<'self> Parser<'self> {
/// Parses a positional argument for a format. This could either be an /// Parses a positional argument for a format. This could either be an
/// integer index of an argument, a named argument, or a blank string. /// 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() { match self.integer() {
Some(i) => { ArgumentIs(i) } Some(i) => { ArgumentIs(i) }
None => { None => {
@ -321,7 +321,7 @@ impl<'self> Parser<'self> {
/// Parses a format specifier at the current position, returning all of the /// Parses a format specifier at the current position, returning all of the
/// relevant information in the FormatSpec struct. /// relevant information in the FormatSpec struct.
fn format(&mut self) -> FormatSpec<'self> { fn format(&mut self) -> FormatSpec<'a> {
let mut spec = FormatSpec { let mut spec = FormatSpec {
fill: None, fill: None,
align: AlignUnknown, align: AlignUnknown,
@ -396,7 +396,7 @@ impl<'self> Parser<'self> {
/// Parses a method to be applied to the previously specified argument and /// Parses a method to be applied to the previously specified argument and
/// its format. The two current supported methods are 'plural' and 'select' /// 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(',') { if !self.wsconsume(',') {
return None; return None;
} }
@ -422,7 +422,7 @@ impl<'self> Parser<'self> {
} }
/// Parses a 'select' statement (after the initial 'select' word) /// 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 other = None;
let mut arms = ~[]; let mut arms = ~[];
// Consume arms one at a time // Consume arms one at a time
@ -464,7 +464,7 @@ impl<'self> Parser<'self> {
} }
/// Parses a 'plural' statement (after the initial 'plural' word) /// 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 offset = None;
let mut other = None; let mut other = None;
let mut arms = ~[]; let mut arms = ~[];
@ -564,7 +564,7 @@ impl<'self> Parser<'self> {
/// Parses a Count parameter at the current position. This does not check /// Parses a Count parameter at the current position. This does not check
/// for 'CountIsNextParam' because that is only used in precision, not /// for 'CountIsNextParam' because that is only used in precision, not
/// width. /// width.
fn count(&mut self) -> Count<'self> { fn count(&mut self) -> Count<'a> {
match self.integer() { match self.integer() {
Some(i) => { Some(i) => {
if self.consume('$') { if self.consume('$') {
@ -591,7 +591,7 @@ impl<'self> Parser<'self> {
/// Parses a word starting at the current position. A word is considered to /// Parses a word starting at the current position. A word is considered to
/// be an alphabetic character followed by any number of alphanumeric /// be an alphabetic character followed by any number of alphanumeric
/// characters. /// characters.
fn word(&mut self) -> &'self str { fn word(&mut self) -> &'a str {
let start = match self.cur.clone().next() { let start = match self.cur.clone().next() {
Some((pos, c)) if char::is_XID_start(c) => { Some((pos, c)) if char::is_XID_start(c) => {
self.cur.next(); self.cur.next();

View file

@ -21,17 +21,17 @@ use either::Either;
use fmt::parse; use fmt::parse;
use option::Option; use option::Option;
pub enum Piece<'self> { pub enum Piece<'a> {
String(&'self str), String(&'a str),
// FIXME(#8259): this shouldn't require the unit-value here // FIXME(#8259): this shouldn't require the unit-value here
CurrentArgument(()), CurrentArgument(()),
Argument(Argument<'self>), Argument(Argument<'a>),
} }
pub struct Argument<'self> { pub struct Argument<'a> {
position: Position, position: Position,
format: FormatSpec, format: FormatSpec,
method: Option<&'self Method<'self>> method: Option<&'a Method<'a>>
} }
pub struct FormatSpec { pub struct FormatSpec {
@ -50,17 +50,17 @@ pub enum Position {
ArgumentNext, ArgumentIs(uint) ArgumentNext, ArgumentIs(uint)
} }
pub enum Method<'self> { pub enum Method<'a> {
Plural(Option<uint>, &'self [PluralArm<'self>], &'self [Piece<'self>]), Plural(Option<uint>, &'a [PluralArm<'a>], &'a [Piece<'a>]),
Select(&'self [SelectArm<'self>], &'self [Piece<'self>]), Select(&'a [SelectArm<'a>], &'a [Piece<'a>]),
} }
pub struct PluralArm<'self> { pub struct PluralArm<'a> {
selector: Either<parse::PluralKeyword, uint>, selector: Either<parse::PluralKeyword, uint>,
result: &'self [Piece<'self>], result: &'a [Piece<'a>],
} }
pub struct SelectArm<'self> { pub struct SelectArm<'a> {
selector: &'self str, selector: &'a str,
result: &'self [Piece<'self>], result: &'a [Piece<'a>],
} }

View file

@ -305,8 +305,8 @@ mod tests {
use prelude::*; use prelude::*;
// Hash just the bytes of the slice, without length prefix // Hash just the bytes of the slice, without length prefix
struct Bytes<'self>(&'self [u8]); struct Bytes<'a>(&'a [u8]);
impl<'self> IterBytes for Bytes<'self> { impl<'a> IterBytes for Bytes<'a> {
fn iter_bytes(&self, _lsb0: bool, f: |&[u8]| -> bool) -> bool { fn iter_bytes(&self, _lsb0: bool, f: |&[u8]| -> bool) -> bool {
f(**self) f(**self)
} }

View file

@ -521,13 +521,13 @@ impl<K:Hash + Eq + Clone,V:Clone> Clone for HashMap<K,V> {
/// HashMap iterator /// HashMap iterator
#[deriving(Clone)] #[deriving(Clone)]
pub struct HashMapIterator<'self, K, V> { pub struct HashMapIterator<'a, K, V> {
priv iter: vec::VecIterator<'self, Option<Bucket<K, V>>>, priv iter: vec::VecIterator<'a, Option<Bucket<K, V>>>,
} }
/// HashMap mutable values iterator /// HashMap mutable values iterator
pub struct HashMapMutIterator<'self, K, V> { pub struct HashMapMutIterator<'a, K, V> {
priv iter: vec::VecMutIterator<'self, Option<Bucket<K, V>>>, priv iter: vec::VecMutIterator<'a, Option<Bucket<K, V>>>,
} }
/// HashMap move iterator /// HashMap move iterator
@ -537,8 +537,8 @@ pub struct HashMapMoveIterator<K, V> {
/// HashSet iterator /// HashSet iterator
#[deriving(Clone)] #[deriving(Clone)]
pub struct HashSetIterator<'self, K> { pub struct HashSetIterator<'a, K> {
priv iter: vec::VecIterator<'self, Option<Bucket<K, ()>>>, priv iter: vec::VecIterator<'a, Option<Bucket<K, ()>>>,
} }
/// HashSet move iterator /// HashSet move iterator
@ -546,9 +546,9 @@ pub struct HashSetMoveIterator<K> {
priv iter: vec::MoveRevIterator<Option<Bucket<K, ()>>>, priv iter: vec::MoveRevIterator<Option<Bucket<K, ()>>>,
} }
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] #[inline]
fn next(&mut self) -> Option<(&'self K, &'self V)> { fn next(&mut self) -> Option<(&'a K, &'a V)> {
for elt in self.iter { for elt in self.iter {
match elt { match elt {
&Some(ref bucket) => return Some((&bucket.key, &bucket.value)), &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] #[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 { for elt in self.iter {
match elt { match elt {
&Some(ref mut bucket) => return Some((&bucket.key, &mut bucket.value)), &Some(ref mut bucket) => return Some((&bucket.key, &mut bucket.value)),
@ -585,9 +585,9 @@ impl<K, V> Iterator<(K, V)> for HashMapMoveIterator<K, V> {
} }
} }
impl<'self, K> Iterator<&'self K> for HashSetIterator<'self, K> { impl<'a, K> Iterator<&'a K> for HashSetIterator<'a, K> {
#[inline] #[inline]
fn next(&mut self) -> Option<&'self K> { fn next(&mut self) -> Option<&'a K> {
for elt in self.iter { for elt in self.iter {
match elt { match elt {
&Some(ref bucket) => return Some(&bucket.key), &Some(ref bucket) => return Some(&bucket.key),
@ -798,9 +798,9 @@ impl<K: Eq + Hash> Default for HashSet<K> {
// `Repeat` is used to feed the filter closure an explicit capture // `Repeat` is used to feed the filter closure an explicit capture
// of a reference to the other set // of a reference to the other set
/// Set operations iterator /// Set operations iterator
pub type SetAlgebraIter<'self, T> = pub type SetAlgebraIter<'a, T> =
FilterMap<'static,(&'self HashSet<T>, &'self T), &'self T, FilterMap<'static,(&'a HashSet<T>, &'a T), &'a T,
Zip<Repeat<&'self HashSet<T>>,HashSetIterator<'self,T>>>; Zip<Repeat<&'a HashSet<T>>,HashSetIterator<'a,T>>>;
#[cfg(test)] #[cfg(test)]

View file

@ -148,12 +148,12 @@ impl Decorator<~[u8]> for MemReader {
/// ///
/// If a write will not fit in the buffer, it raises the `io_error` /// If a write will not fit in the buffer, it raises the `io_error`
/// condition and does not write any data. /// condition and does not write any data.
pub struct BufWriter<'self> { pub struct BufWriter<'a> {
priv buf: &'self mut [u8], priv buf: &'a mut [u8],
priv pos: uint priv pos: uint
} }
impl<'self> BufWriter<'self> { impl<'a> BufWriter<'a> {
pub fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a> { pub fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a> {
BufWriter { BufWriter {
buf: buf, 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]) { fn write(&mut self, buf: &[u8]) {
// raises a condition if the entire write does not fit in the buffer // raises a condition if the entire write does not fit in the buffer
let max_size = self.buf.len(); let max_size = self.buf.len();
@ -182,7 +182,7 @@ impl<'self> Writer for BufWriter<'self> {
} }
// FIXME(#10432) // FIXME(#10432)
impl<'self> Seek for BufWriter<'self> { impl<'a> Seek for BufWriter<'a> {
fn tell(&self) -> u64 { self.pos as u64 } fn tell(&self) -> u64 { self.pos as u64 }
fn seek(&mut self, pos: i64, style: SeekStyle) { 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 /// Reads from a fixed-size byte slice
pub struct BufReader<'self> { pub struct BufReader<'a> {
priv buf: &'self [u8], priv buf: &'a [u8],
priv pos: uint priv pos: uint
} }
impl<'self> BufReader<'self> { impl<'a> BufReader<'a> {
pub fn new<'a>(buf: &'a [u8]) -> BufReader<'a> { pub fn new<'a>(buf: &'a [u8]) -> BufReader<'a> {
BufReader { BufReader {
buf: buf, 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<uint> { fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
{ if self.eof() { return None; } } { 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() } 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 tell(&self) -> u64 { self.pos as u64 }
fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } 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 fill<'a>(&'a mut self) -> &'a [u8] { self.buf.slice_from(self.pos) }
fn consume(&mut self, amt: uint) { self.pos += amt; } fn consume(&mut self, amt: uint) { self.pos += amt; }
} }

View file

@ -811,7 +811,7 @@ impl Reader for ~Reader {
fn eof(&mut self) -> bool { self.eof() } 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<uint> { self.read(buf) } fn read(&mut self, buf: &mut [u8]) -> Option<uint> { self.read(buf) }
fn eof(&mut self) -> bool { self.eof() } fn eof(&mut self) -> bool { self.eof() }
} }
@ -972,7 +972,7 @@ impl Writer for ~Writer {
fn flush(&mut self) { self.flush() } 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 write(&mut self, buf: &[u8]) { self.write(buf) }
fn flush(&mut self) { self.flush() } fn flush(&mut self) { self.flush() }
} }
@ -1184,11 +1184,11 @@ pub trait Acceptor<T> {
/// The Some contains another Option representing whether the connection attempt was succesful. /// The Some contains another Option representing whether the connection attempt was succesful.
/// A successful connection will be wrapped in Some. /// A successful connection will be wrapped in Some.
/// A failed connection is represented as a None and raises a condition. /// A failed connection is represented as a None and raises a condition.
struct IncomingIterator<'self, A> { struct IncomingIterator<'a, A> {
priv inc: &'self mut A, priv inc: &'a mut A,
} }
impl<'self, T, A: Acceptor<T>> Iterator<Option<T>> for IncomingIterator<'self, A> { impl<'a, T, A: Acceptor<T>> Iterator<Option<T>> for IncomingIterator<'a, A> {
fn next(&mut self) -> Option<Option<T>> { fn next(&mut self) -> Option<Option<T>> {
Some(self.inc.accept()) Some(self.inc.accept())
} }

View file

@ -62,14 +62,14 @@ impl ToStr for SocketAddr {
} }
} }
struct Parser<'self> { struct Parser<'a> {
// parsing as ASCII, so can use byte array // parsing as ASCII, so can use byte array
s: &'self [u8], s: &'a [u8],
pos: uint, pos: uint,
} }
impl<'self> Parser<'self> { impl<'a> Parser<'a> {
fn new(s: &'self str) -> Parser<'self> { fn new(s: &'a str) -> Parser<'a> {
Parser { Parser {
s: s.as_bytes(), s: s.as_bytes(),
pos: 0, pos: 0,

View file

@ -33,20 +33,20 @@ pub struct Process {
/// This configuration describes how a new process should be spawned. This is /// This configuration describes how a new process should be spawned. This is
/// translated to libuv's own configuration /// translated to libuv's own configuration
pub struct ProcessConfig<'self> { pub struct ProcessConfig<'a> {
/// Path to the program to run /// Path to the program to run
program: &'self str, program: &'a str,
/// Arguments to pass to the program (doesn't include the program itself) /// 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 /// Optional environment to specify for the program. If this is None, then
/// it will inherit the current process's environment. /// 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 /// Optional working directory for the new process. If this is None, then
/// the current directory of the running process is inherited. /// 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 /// Any number of streams/file descriptors/pipes may be attached to this
/// process. This list enumerates the file descriptors and such for the /// process. This list enumerates the file descriptors and such for the
@ -58,7 +58,7 @@ pub struct ProcessConfig<'self> {
/// 0 - stdin /// 0 - stdin
/// 1 - stdout /// 1 - stdout
/// 2 - stderr /// 2 - stderr
io: &'self [StdioContainer] io: &'a [StdioContainer]
} }
/// Describes what to do with a standard io stream for a child process. /// Describes what to do with a standard io stream for a child process.

View file

@ -691,7 +691,7 @@ pub trait MutableDoubleEndedIterator {
fn reverse_(&mut self); 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` // FIXME: #5898: should be called `reverse`
/// Use an iterator to reverse a container in-place /// Use an iterator to reverse a container in-place
fn reverse_(&mut self) { fn reverse_(&mut self) {
@ -754,9 +754,9 @@ pub trait ExactSize<A> : DoubleEndedIterator<A> {
// All adaptors that preserve the size of the wrapped iterator are fine // All adaptors that preserve the size of the wrapped iterator are fine
// Adaptors that may overflow in `size_hint` are not, i.e. `Chain`. // Adaptors that may overflow in `size_hint` are not, i.e. `Chain`.
impl<A, T: ExactSize<A>> ExactSize<(uint, A)> for Enumerate<T> {} impl<A, T: ExactSize<A>> ExactSize<(uint, A)> for Enumerate<T> {}
impl<'self, A, T: ExactSize<A>> ExactSize<A> for Inspect<'self, A, T> {} impl<'a, A, T: ExactSize<A>> ExactSize<A> for Inspect<'a, A, T> {}
impl<A, T: ExactSize<A>> ExactSize<A> for Invert<T> {} impl<A, T: ExactSize<A>> ExactSize<A> for Invert<T> {}
impl<'self, A, B, T: ExactSize<A>> ExactSize<B> for Map<'self, A, B, T> {} impl<'a, A, B, T: ExactSize<A>> ExactSize<B> for Map<'a, A, B, T> {}
impl<A, B, T: ExactSize<A>, U: ExactSize<B>> ExactSize<(A, B)> for Zip<T, U> {} impl<A, B, T: ExactSize<A>, U: ExactSize<B>> ExactSize<(A, B)> for Zip<T, U> {}
/// An double-ended iterator with the direction inverted /// An double-ended iterator with the direction inverted
@ -788,17 +788,17 @@ impl<A, T: DoubleEndedIterator<A> + RandomAccessIterator<A>> RandomAccessIterato
} }
/// A mutable reference to an iterator /// A mutable reference to an iterator
pub struct ByRef<'self, T> { pub struct ByRef<'a, T> {
priv iter: &'self mut T priv iter: &'a mut T
} }
impl<'self, A, T: Iterator<A>> Iterator<A> for ByRef<'self, T> { impl<'a, A, T: Iterator<A>> Iterator<A> for ByRef<'a, T> {
#[inline] #[inline]
fn next(&mut self) -> Option<A> { self.iter.next() } fn next(&mut self) -> Option<A> { self.iter.next() }
// FIXME: #9629 we cannot implement &self methods like size_hint on ByRef // FIXME: #9629 we cannot implement &self methods like size_hint on ByRef
} }
impl<'self, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for ByRef<'self, T> { impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for ByRef<'a, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<A> { self.iter.next_back() } fn next_back(&mut self) -> Option<A> { self.iter.next_back() }
} }
@ -1121,12 +1121,12 @@ RandomAccessIterator<(A, B)> for Zip<T, U> {
} }
/// An iterator which maps the values of `iter` with `f` /// 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 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] #[inline]
fn do_map(&self, elt: Option<A>) -> Option<B> { fn do_map(&self, elt: Option<A>) -> Option<B> {
match elt { match elt {
@ -1136,7 +1136,7 @@ impl<'self, A, B, T> Map<'self, A, B, T> {
} }
} }
impl<'self, A, B, T: Iterator<A>> Iterator<B> for Map<'self, A, B, T> { impl<'a, A, B, T: Iterator<A>> Iterator<B> for Map<'a, A, B, T> {
#[inline] #[inline]
fn next(&mut self) -> Option<B> { fn next(&mut self) -> Option<B> {
let next = self.iter.next(); let next = self.iter.next();
@ -1149,7 +1149,7 @@ impl<'self, A, B, T: Iterator<A>> Iterator<B> for Map<'self, A, B, T> {
} }
} }
impl<'self, A, B, T: DoubleEndedIterator<A>> DoubleEndedIterator<B> for Map<'self, A, B, T> { impl<'a, A, B, T: DoubleEndedIterator<A>> DoubleEndedIterator<B> for Map<'a, A, B, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<B> { fn next_back(&mut self) -> Option<B> {
let next = self.iter.next_back(); let next = self.iter.next_back();
@ -1157,7 +1157,7 @@ impl<'self, A, B, T: DoubleEndedIterator<A>> DoubleEndedIterator<B> for Map<'sel
} }
} }
impl<'self, A, B, T: RandomAccessIterator<A>> RandomAccessIterator<B> for Map<'self, A, B, T> { impl<'a, A, B, T: RandomAccessIterator<A>> RandomAccessIterator<B> for Map<'a, A, B, T> {
#[inline] #[inline]
fn indexable(&self) -> uint { fn indexable(&self) -> uint {
self.iter.indexable() self.iter.indexable()
@ -1170,12 +1170,12 @@ impl<'self, A, B, T: RandomAccessIterator<A>> RandomAccessIterator<B> for Map<'s
} }
/// An iterator which filters the elements of `iter` with `predicate` /// 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 iter: T,
priv predicate: 'self |&A| -> bool priv predicate: 'a |&A| -> bool
} }
impl<'self, A, T: Iterator<A>> Iterator<A> for Filter<'self, A, T> { impl<'a, A, T: Iterator<A>> Iterator<A> for Filter<'a, A, T> {
#[inline] #[inline]
fn next(&mut self) -> Option<A> { fn next(&mut self) -> Option<A> {
for x in self.iter { for x in self.iter {
@ -1195,7 +1195,7 @@ impl<'self, A, T: Iterator<A>> Iterator<A> for Filter<'self, A, T> {
} }
} }
impl<'self, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Filter<'self, A, T> { impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Filter<'a, A, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<A> { fn next_back(&mut self) -> Option<A> {
loop { loop {
@ -1214,12 +1214,12 @@ impl<'self, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Filter<'sel
} }
/// An iterator which uses `f` to both filter and map elements from `iter` /// 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 iter: T,
priv f: 'self |A| -> Option<B> priv f: 'a |A| -> Option<B>
} }
impl<'self, A, B, T: Iterator<A>> Iterator<B> for FilterMap<'self, A, B, T> { impl<'a, A, B, T: Iterator<A>> Iterator<B> for FilterMap<'a, A, B, T> {
#[inline] #[inline]
fn next(&mut self) -> Option<B> { fn next(&mut self) -> Option<B> {
for x in self.iter { for x in self.iter {
@ -1238,8 +1238,8 @@ impl<'self, A, B, T: Iterator<A>> Iterator<B> for FilterMap<'self, A, B, T> {
} }
} }
impl<'self, A, B, T: DoubleEndedIterator<A>> DoubleEndedIterator<B> impl<'a, A, B, T: DoubleEndedIterator<A>> DoubleEndedIterator<B>
for FilterMap<'self, A, B, T> { for FilterMap<'a, A, B, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<B> { fn next_back(&mut self) -> Option<B> {
loop { loop {
@ -1340,11 +1340,11 @@ impl<A, T: Iterator<A>> Iterator<A> for Peekable<A, T> {
} }
} }
impl<'self, A, T: Iterator<A>> Peekable<A, T> { impl<'a, A, T: Iterator<A>> Peekable<A, T> {
/// Return a reference to the next element of the iterator with out advancing it, /// Return a reference to the next element of the iterator with out advancing it,
/// or None if the iterator is exhausted. /// or None if the iterator is exhausted.
#[inline] #[inline]
pub fn peek(&'self mut self) -> Option<&'self A> { pub fn peek(&'a mut self) -> Option<&'a A> {
if self.peeked.is_none() { if self.peeked.is_none() {
self.peeked = self.iter.next(); self.peeked = self.iter.next();
} }
@ -1356,13 +1356,13 @@ impl<'self, A, T: Iterator<A>> Peekable<A, T> {
} }
/// An iterator which rejects elements while `predicate` is true /// 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 iter: T,
priv flag: bool, priv flag: bool,
priv predicate: 'self |&A| -> bool priv predicate: 'a |&A| -> bool
} }
impl<'self, A, T: Iterator<A>> Iterator<A> for SkipWhile<'self, A, T> { impl<'a, A, T: Iterator<A>> Iterator<A> for SkipWhile<'a, A, T> {
#[inline] #[inline]
fn next(&mut self) -> Option<A> { fn next(&mut self) -> Option<A> {
let mut next = self.iter.next(); let mut next = self.iter.next();
@ -1394,13 +1394,13 @@ impl<'self, A, T: Iterator<A>> Iterator<A> for SkipWhile<'self, A, T> {
} }
/// An iterator which only accepts elements while `predicate` is true /// 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 iter: T,
priv flag: bool, priv flag: bool,
priv predicate: 'self |&A| -> bool priv predicate: 'a |&A| -> bool
} }
impl<'self, A, T: Iterator<A>> Iterator<A> for TakeWhile<'self, A, T> { impl<'a, A, T: Iterator<A>> Iterator<A> for TakeWhile<'a, A, T> {
#[inline] #[inline]
fn next(&mut self) -> Option<A> { fn next(&mut self) -> Option<A> {
if self.flag { if self.flag {
@ -1542,15 +1542,15 @@ impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Take<T> {
/// An iterator to maintain state while iterating another iterator /// 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 iter: T,
priv f: 'self |&mut St, A| -> Option<B>, priv f: 'a |&mut St, A| -> Option<B>,
/// The current internal state to be passed to the closure next. /// The current internal state to be passed to the closure next.
state: St state: St
} }
impl<'self, A, B, T: Iterator<A>, St> Iterator<B> for Scan<'self, A, B, T, St> { impl<'a, A, B, T: Iterator<A>, St> Iterator<B> for Scan<'a, A, B, T, St> {
#[inline] #[inline]
fn next(&mut self) -> Option<B> { fn next(&mut self) -> Option<B> {
self.iter.next().and_then(|a| (self.f)(&mut self.state, a)) self.iter.next().and_then(|a| (self.f)(&mut self.state, a))
@ -1566,14 +1566,14 @@ impl<'self, A, B, T: Iterator<A>, St> Iterator<B> for Scan<'self, A, B, T, St> {
/// An iterator that maps each element to an iterator, /// An iterator that maps each element to an iterator,
/// and yields the elements of the produced iterators /// 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 iter: T,
priv f: 'self |A| -> U, priv f: 'a |A| -> U,
priv frontiter: Option<U>, priv frontiter: Option<U>,
priv backiter: Option<U>, priv backiter: Option<U>,
} }
impl<'self, A, T: Iterator<A>, B, U: Iterator<B>> Iterator<B> for FlatMap<'self, A, T, U> { impl<'a, A, T: Iterator<A>, B, U: Iterator<B>> Iterator<B> for FlatMap<'a, A, T, U> {
#[inline] #[inline]
fn next(&mut self) -> Option<B> { fn next(&mut self) -> Option<B> {
loop { loop {
@ -1601,10 +1601,10 @@ impl<'self, A, T: Iterator<A>, B, U: Iterator<B>> Iterator<B> for FlatMap<'self,
} }
} }
impl<'self, impl<'a,
A, T: DoubleEndedIterator<A>, A, T: DoubleEndedIterator<A>,
B, U: DoubleEndedIterator<B>> DoubleEndedIterator<B> B, U: DoubleEndedIterator<B>> DoubleEndedIterator<B>
for FlatMap<'self, A, T, U> { for FlatMap<'a, A, T, U> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<B> { fn next_back(&mut self) -> Option<B> {
loop { loop {
@ -1697,12 +1697,12 @@ impl<T> Fuse<T> {
/// An iterator that calls a function with a reference to each /// An iterator that calls a function with a reference to each
/// element before yielding it. /// element before yielding it.
pub struct Inspect<'self, A, T> { pub struct Inspect<'a, A, T> {
priv iter: 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] #[inline]
fn do_inspect(&self, elt: Option<A>) -> Option<A> { fn do_inspect(&self, elt: Option<A>) -> Option<A> {
match elt { match elt {
@ -1714,7 +1714,7 @@ impl<'self, A, T> Inspect<'self, A, T> {
} }
} }
impl<'self, A, T: Iterator<A>> Iterator<A> for Inspect<'self, A, T> { impl<'a, A, T: Iterator<A>> Iterator<A> for Inspect<'a, A, T> {
#[inline] #[inline]
fn next(&mut self) -> Option<A> { fn next(&mut self) -> Option<A> {
let next = self.iter.next(); let next = self.iter.next();
@ -1727,8 +1727,8 @@ impl<'self, A, T: Iterator<A>> Iterator<A> for Inspect<'self, A, T> {
} }
} }
impl<'self, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A>
for Inspect<'self, A, T> { for Inspect<'a, A, T> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<A> { fn next_back(&mut self) -> Option<A> {
let next = self.iter.next_back(); let next = self.iter.next_back();
@ -1736,8 +1736,8 @@ for Inspect<'self, A, T> {
} }
} }
impl<'self, A, T: RandomAccessIterator<A>> RandomAccessIterator<A> impl<'a, A, T: RandomAccessIterator<A>> RandomAccessIterator<A>
for Inspect<'self, A, T> { for Inspect<'a, A, T> {
#[inline] #[inline]
fn indexable(&self) -> uint { fn indexable(&self) -> uint {
self.iter.indexable() self.iter.indexable()
@ -1750,13 +1750,13 @@ for Inspect<'self, A, T> {
} }
/// An iterator which just modifies the contained state throughout iteration. /// An iterator which just modifies the contained state throughout iteration.
pub struct Unfold<'self, A, St> { pub struct Unfold<'a, A, St> {
priv f: 'self |&mut St| -> Option<A>, priv f: 'a |&mut St| -> Option<A>,
/// Internal state that will be yielded on the next iteration /// Internal state that will be yielded on the next iteration
state: St 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 /// Creates a new iterator with the specified closure as the "iterator
/// function" and an initial state to eventually pass to the iterator /// function" and an initial state to eventually pass to the iterator
#[inline] #[inline]
@ -1769,7 +1769,7 @@ impl<'self, A, St> Unfold<'self, A, St> {
} }
} }
impl<'self, A, St> Iterator<A> for Unfold<'self, A, St> { impl<'a, A, St> Iterator<A> for Unfold<'a, A, St> {
#[inline] #[inline]
fn next(&mut self) -> Option<A> { fn next(&mut self) -> Option<A> {
(self.f)(&mut self.state) (self.f)(&mut self.state)

View file

@ -523,18 +523,18 @@ pub trait GenericPathUnsafe {
} }
/// Helper struct for printing paths with format!() /// Helper struct for printing paths with format!()
pub struct Display<'self, P> { pub struct Display<'a, P> {
priv path: &'self P, priv path: &'a P,
priv filename: bool 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<P>, f: &mut fmt::Formatter) { fn fmt(d: &Display<P>, f: &mut fmt::Formatter) {
d.with_str(|s| f.pad(s)) 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 /// Returns the path as a string
/// ///
/// If the path is not UTF-8, invalid sequences with be replaced with the /// 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 /// Provides the path as a string to a closure
/// ///
/// If the path is not UTF-8, invalid sequences will be replaced with the /// 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] #[inline]
fn container_as_bytes<'a>(&'a self) -> &'a [u8] { fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
self.as_bytes() self.as_bytes()
@ -584,7 +584,7 @@ impl<'self> BytesContainer for &'self str {
Some(*self) Some(*self)
} }
#[inline] #[inline]
fn is_str(_: Option<&'self str>) -> bool { true } fn is_str(_: Option<&'a str>) -> bool { true }
} }
impl BytesContainer for ~str { impl BytesContainer for ~str {
@ -625,7 +625,7 @@ impl BytesContainer for @str {
fn is_str(_: Option<@str>) -> bool { true } fn is_str(_: Option<@str>) -> bool { true }
} }
impl<'self> BytesContainer for &'self [u8] { impl<'a> BytesContainer for &'a [u8] {
#[inline] #[inline]
fn container_as_bytes<'a>(&'a self) -> &'a [u8] { fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
*self *self

View file

@ -25,16 +25,16 @@ use vec::{CopyableVector, RSplitIterator, SplitIterator, Vector, VectorVector};
use super::{BytesContainer, GenericPath, GenericPathUnsafe}; use super::{BytesContainer, GenericPath, GenericPathUnsafe};
/// Iterator that yields successive components of a Path as &[u8] /// 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] /// 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> /// Iterator that yields successive components of a Path as Option<&str>
pub type StrComponentIter<'self> = Map<'self, &'self [u8], Option<&'self str>, pub type StrComponentIter<'a> = Map<'a, &'a [u8], Option<&'a str>,
ComponentIter<'self>>; ComponentIter<'a>>;
/// Iterator that yields components of a Path in reverse as Option<&str> /// Iterator that yields components of a Path in reverse as Option<&str>
pub type RevStrComponentIter<'self> = Map<'self, &'self [u8], Option<&'self str>, pub type RevStrComponentIter<'a> = Map<'a, &'a [u8], Option<&'a str>,
RevComponentIter<'self>>; RevComponentIter<'a>>;
/// Represents a POSIX file path /// Represents a POSIX file path
#[deriving(Clone, DeepClone)] #[deriving(Clone, DeepClone)]
@ -103,7 +103,7 @@ impl BytesContainer for Path {
} }
} }
impl<'self> BytesContainer for &'self Path { impl<'a> BytesContainer for &'a Path {
#[inline] #[inline]
fn container_as_bytes<'a>(&'a self) -> &'a [u8] { fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
self.as_vec() self.as_vec()

View file

@ -27,21 +27,21 @@ use super::{contains_nul, BytesContainer, GenericPath, GenericPathUnsafe};
/// ///
/// Each component is yielded as Option<&str> for compatibility with PosixPath, but /// Each component is yielded as Option<&str> for compatibility with PosixPath, but
/// every component in WindowsPath is guaranteed to be Some. /// every component in WindowsPath is guaranteed to be Some.
pub type StrComponentIter<'self> = Map<'self, &'self str, Option<&'self str>, pub type StrComponentIter<'a> = Map<'a, &'a str, Option<&'a str>,
CharSplitIterator<'self, char>>; CharSplitIterator<'a, char>>;
/// Iterator that yields components of a Path in reverse as &str /// Iterator that yields components of a Path in reverse as &str
/// ///
/// Each component is yielded as Option<&str> for compatibility with PosixPath, but /// Each component is yielded as Option<&str> for compatibility with PosixPath, but
/// every component in WindowsPath is guaranteed to be Some. /// every component in WindowsPath is guaranteed to be Some.
pub type RevStrComponentIter<'self> = Invert<Map<'self, &'self str, Option<&'self str>, pub type RevStrComponentIter<'a> = Invert<Map<'a, &'a str, Option<&'a str>,
CharSplitIterator<'self, char>>>; CharSplitIterator<'a, char>>>;
/// Iterator that yields successive components of a Path as &[u8] /// Iterator that yields successive components of a Path as &[u8]
pub type ComponentIter<'self> = Map<'self, Option<&'self str>, &'self [u8], pub type ComponentIter<'a> = Map<'a, Option<&'a str>, &'a [u8],
StrComponentIter<'self>>; StrComponentIter<'a>>;
/// Iterator that yields components of a Path in reverse as &[u8] /// Iterator that yields components of a Path in reverse as &[u8]
pub type RevComponentIter<'self> = Map<'self, Option<&'self str>, &'self [u8], pub type RevComponentIter<'a> = Map<'a, Option<&'a str>, &'a [u8],
RevStrComponentIter<'self>>; RevStrComponentIter<'a>>;
/// Represents a Windows path /// Represents a Windows path
// Notes for Windows path impl: // Notes for Windows path impl:
@ -138,7 +138,7 @@ impl BytesContainer for Path {
fn is_str(_: Option<Path>) -> bool { true } fn is_str(_: Option<Path>) -> bool { true }
} }
impl<'self> BytesContainer for &'self Path { impl<'a> BytesContainer for &'a Path {
#[inline] #[inline]
fn container_as_bytes<'a>(&'a self) -> &'a [u8] { fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
self.as_vec() self.as_vec()
@ -152,7 +152,7 @@ impl<'self> BytesContainer for &'self Path {
self.as_str() self.as_str()
} }
#[inline] #[inline]
fn is_str(_: Option<&'self Path>) -> bool { true } fn is_str(_: Option<&'a Path>) -> bool { true }
} }
impl GenericPathUnsafe for Path { impl GenericPathUnsafe for Path {

View file

@ -188,8 +188,8 @@ impl Rng for IsaacRng {
} }
} }
impl<'self> SeedableRng<&'self [u32]> for IsaacRng { impl<'a> SeedableRng<&'a [u32]> for IsaacRng {
fn reseed(&mut self, seed: &'self [u32]) { fn reseed(&mut self, seed: &'a [u32]) {
// make the seed into [seed[0], seed[1], ..., seed[seed.len() // make the seed into [seed[0], seed[1], ..., seed[seed.len()
// - 1], 0, 0, ...], to fill rng.rsl. // - 1], 0, 0, ...], to fill rng.rsl.
let seed_iter = seed.iter().map(|&x| x).chain(Repeat::new(0u32)); 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 /// 256 and any more will be silently ignored. A generator
/// constructed with a given seed will generate the same sequence /// constructed with a given seed will generate the same sequence
/// of values as all other generators constructed with that seed. /// 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; let mut rng = EMPTY;
rng.reseed(seed); rng.reseed(seed);
rng rng
@ -399,8 +399,8 @@ impl Rng for Isaac64Rng {
} }
} }
impl<'self> SeedableRng<&'self [u64]> for Isaac64Rng { impl<'a> SeedableRng<&'a [u64]> for Isaac64Rng {
fn reseed(&mut self, seed: &'self [u64]) { fn reseed(&mut self, seed: &'a [u64]) {
// make the seed into [seed[0], seed[1], ..., seed[seed.len() // make the seed into [seed[0], seed[1], ..., seed[seed.len()
// - 1], 0, 0, ...], to fill rng.rsl. // - 1], 0, 0, ...], to fill rng.rsl.
let seed_iter = seed.iter().map(|&x| x).chain(Repeat::new(0u64)); 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 /// 256 and any more will be silently ignored. A generator
/// constructed with a given seed will generate the same sequence /// constructed with a given seed will generate the same sequence
/// of values as all other generators constructed with that seed. /// 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; let mut rng = EMPTY_64;
rng.reseed(seed); rng.reseed(seed);
rng rng

View file

@ -469,14 +469,14 @@ impl Rng for StdRng {
} }
} }
impl<'self> SeedableRng<&'self [uint]> for StdRng { impl<'a> SeedableRng<&'a [uint]> for StdRng {
fn reseed(&mut self, seed: &'self [uint]) { fn reseed(&mut self, seed: &'a [uint]) {
// the internal RNG can just be seeded from the above // the internal RNG can just be seeded from the above
// randomness. // randomness.
self.rng.reseed(unsafe {cast::transmute(seed)}) 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)}) } StdRng { rng: SeedableRng::from_seed(unsafe {cast::transmute(seed)}) }
} }
} }

View file

@ -97,11 +97,11 @@ enum VariantState {
AlreadyFound AlreadyFound
} }
pub struct ReprVisitor<'self> { pub struct ReprVisitor<'a> {
priv ptr: *c_void, priv ptr: *c_void,
priv ptr_stk: ~[*c_void], priv ptr_stk: ~[*c_void],
priv var_stk: ~[VariantState], priv var_stk: ~[VariantState],
priv writer: &'self mut io::Writer priv writer: &'a mut io::Writer
} }
pub fn ReprVisitor<'a>(ptr: *c_void, 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] #[inline]
fn move_ptr(&mut self, adjustment: |*c_void| -> *c_void) { fn move_ptr(&mut self, adjustment: |*c_void| -> *c_void) {
self.ptr = adjustment(self.ptr); 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 // Various helpers for the TyVisitor impl
#[inline] #[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 { fn visit_bot(&mut self) -> bool {
self.writer.write("!".as_bytes()); self.writer.write("!".as_bytes());
true true

View file

@ -510,7 +510,7 @@ impl<T: Send> Peekable<T> for Port<T> {
// of them, but a &Port<T> should also be selectable so you can select2 on it // of them, but a &Port<T> should also be selectable so you can select2 on it
// alongside a PortOne<U> without passing the port by value in recv_ready. // alongside a PortOne<U> without passing the port by value in recv_ready.
impl<'self, T: Send> SelectInner for &'self Port<T> { impl<'a, T: Send> SelectInner for &'a Port<T> {
#[inline] #[inline]
fn optimistic_check(&mut self) -> bool { fn optimistic_check(&mut self) -> bool {
self.next.with_mut(|pone| { pone.get_mut_ref().optimistic_check() }) self.next.with_mut(|pone| { pone.get_mut_ref().optimistic_check() })
@ -528,7 +528,7 @@ impl<'self, T: Send> SelectInner for &'self Port<T> {
} }
} }
impl<'self, T: Send> Select for &'self Port<T> { } impl<'a, T: Send> Select for &'a Port<T> { }
impl<T: Send> SelectInner for Port<T> { impl<T: Send> SelectInner for Port<T> {
#[inline] #[inline]
@ -549,7 +549,7 @@ impl<T: Send> SelectInner for Port<T> {
impl<T: Send> Select for Port<T> { } impl<T: Send> Select for Port<T> { }
impl<'self, T: Send> SelectPortInner<T> for &'self Port<T> { impl<'a, T: Send> SelectPortInner<T> for &'a Port<T> {
fn recv_ready(self) -> Option<T> { fn recv_ready(self) -> Option<T> {
let mut b = self.next.borrow_mut(); let mut b = self.next.borrow_mut();
match b.get().take_unwrap().recv_ready() { match b.get().take_unwrap().recv_ready() {
@ -562,7 +562,7 @@ impl<'self, T: Send> SelectPortInner<T> for &'self Port<T> {
} }
} }
impl<'self, T: Send> SelectPort<T> for &'self Port<T> { } impl<'a, T: Send> SelectPort<T> for &'a Port<T> { }
pub struct SharedChan<T> { pub struct SharedChan<T> {
// Just like Chan, but a shared AtomicOption // Just like Chan, but a shared AtomicOption

View file

@ -21,15 +21,15 @@ use rt::rtio::EventLoop;
#[link_args = "-Wl,-U,__rust_crate_map_toplevel"] #[link_args = "-Wl,-U,__rust_crate_map_toplevel"]
extern {} extern {}
pub struct ModEntry<'self> { pub struct ModEntry<'a> {
name: &'self str, name: &'a str,
log_level: *mut u32 log_level: *mut u32
} }
pub struct CrateMap<'self> { pub struct CrateMap<'a> {
version: i32, version: i32,
entries: &'self [ModEntry<'self>], entries: &'a [ModEntry<'a>],
children: &'self [&'self CrateMap<'self>], children: &'a [&'a CrateMap<'a>],
event_loop_factory: Option<extern "C" fn() -> ~EventLoop>, event_loop_factory: Option<extern "C" fn() -> ~EventLoop>,
} }

View file

@ -33,7 +33,7 @@ pub struct Process {
} }
/// Options that can be given when starting a 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 * If this is None then the new process will have the same initial
* environment as the parent process. * 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 * If this is Some(path) then the new process will use the given path
* for its initial working directory. * 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 * 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<c_int>, err_fd: Option<c_int>,
} }
impl <'self> ProcessOptions<'self> { impl <'a> ProcessOptions<'a> {
/// Return a ProcessOptions that has None in every field. /// Return a ProcessOptions that has None in every field.
pub fn new<'a>() -> ProcessOptions<'a> { pub fn new<'a>() -> ProcessOptions<'a> {
ProcessOptions { ProcessOptions {

View file

@ -108,7 +108,7 @@ pub fn select<A: Select>(ports: &mut [A]) -> uint {
/* FIXME(#5121, #7914) This all should be legal, but rust is not clever enough yet. /* 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 optimistic_check(&mut self) -> bool { self.optimistic_check() }
fn block_on(&mut self, sched: &mut Scheduler, task: BlockedTask) -> bool { fn block_on(&mut self, sched: &mut Scheduler, task: BlockedTask) -> bool {
self.block_on(sched, task) self.block_on(sched, task)

View file

@ -107,7 +107,7 @@ impl TotalOrd for SendStr {
} }
} }
impl<'self, S: Str> Equiv<S> for SendStr { impl<'a, S: Str> Equiv<S> for SendStr {
#[inline] #[inline]
fn equiv(&self, other: &S) -> bool { fn equiv(&self, other: &S) -> bool {
self.as_slice().equals(&other.as_slice()) self.as_slice().equals(&other.as_slice())

View file

@ -182,7 +182,7 @@ impl FromStr for ~str {
fn from_str(s: &str) -> Option<~str> { Some(s.to_owned()) } fn from_str(s: &str) -> Option<~str> { Some(s.to_owned()) }
} }
impl<'self> ToStr for &'self str { impl<'a> ToStr for &'a str {
#[inline] #[inline]
fn to_str(&self) -> ~str { self.to_owned() } fn to_str(&self) -> ~str { self.to_owned() }
} }
@ -192,7 +192,7 @@ impl ToStr for @str {
fn to_str(&self) -> ~str { self.to_owned() } fn to_str(&self) -> ~str { self.to_owned() }
} }
impl<'self> FromStr for @str { impl<'a> FromStr for @str {
#[inline] #[inline]
fn from_str(s: &str) -> Option<@str> { Some(s.to_managed()) } fn from_str(s: &str) -> Option<@str> { Some(s.to_managed()) }
} }
@ -238,7 +238,7 @@ pub trait StrVector {
fn connect(&self, sep: &str) -> ~str; 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 { fn concat(&self) -> ~str {
if self.is_empty() { return ~""; } if self.is_empty() { return ~""; }
@ -294,7 +294,7 @@ impl CharEq for char {
fn only_ascii(&self) -> bool { (*self as uint) < 128 } fn only_ascii(&self) -> bool { (*self as uint) < 128 }
} }
impl<'self> CharEq for 'self |char| -> bool { impl<'a> CharEq for 'a |char| -> bool {
#[inline] #[inline]
fn matches(&self, c: char) -> bool { (*self)(c) } 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 } fn only_ascii(&self) -> bool { false }
} }
impl<'self, C: CharEq> CharEq for &'self [C] { impl<'a, C: CharEq> CharEq for &'a [C] {
#[inline] #[inline]
fn matches(&self, c: char) -> bool { fn matches(&self, c: char) -> bool {
self.iter().any(|m| m.matches(c)) self.iter().any(|m| m.matches(c))
@ -326,12 +326,12 @@ Section: Iterators
/// External iterator for a string's characters. /// External iterator for a string's characters.
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
#[deriving(Clone)] #[deriving(Clone)]
pub struct CharIterator<'self> { pub struct CharIterator<'a> {
/// The slice remaining to be iterated /// The slice remaining to be iterated
priv string: &'self str, priv string: &'a str,
} }
impl<'self> Iterator<char> for CharIterator<'self> { impl<'a> Iterator<char> for CharIterator<'a> {
#[inline] #[inline]
fn next(&mut self) -> Option<char> { fn next(&mut self) -> Option<char> {
// Decode the next codepoint, then update // Decode the next codepoint, then update
@ -353,7 +353,7 @@ impl<'self> Iterator<char> for CharIterator<'self> {
} }
} }
impl<'self> DoubleEndedIterator<char> for CharIterator<'self> { impl<'a> DoubleEndedIterator<char> for CharIterator<'a> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<char> { fn next_back(&mut self) -> Option<char> {
if self.string.len() != 0 { if self.string.len() != 0 {
@ -371,13 +371,13 @@ impl<'self> DoubleEndedIterator<char> for CharIterator<'self> {
/// External iterator for a string's characters and their byte offsets. /// External iterator for a string's characters and their byte offsets.
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
#[deriving(Clone)] #[deriving(Clone)]
pub struct CharOffsetIterator<'self> { pub struct CharOffsetIterator<'a> {
/// The original string to be iterated /// The original string to be iterated
priv string: &'self str, priv string: &'a str,
priv iter: CharIterator<'self>, priv iter: CharIterator<'a>,
} }
impl<'self> Iterator<(uint, char)> for CharOffsetIterator<'self> { impl<'a> Iterator<(uint, char)> for CharOffsetIterator<'a> {
#[inline] #[inline]
fn next(&mut self) -> Option<(uint, char)> { fn next(&mut self) -> Option<(uint, char)> {
// Compute the byte offset by using the pointer offset between // 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] #[inline]
fn next_back(&mut self) -> Option<(uint, char)> { fn next_back(&mut self) -> Option<(uint, char)> {
self.iter.next_back().map(|ch| { 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. /// External iterator for a string's characters in reverse order.
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
pub type CharRevIterator<'self> = Invert<CharIterator<'self>>; pub type CharRevIterator<'a> = Invert<CharIterator<'a>>;
/// External iterator for a string's characters and their byte offsets in reverse order. /// External iterator for a string's characters and their byte offsets in reverse order.
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
pub type CharOffsetRevIterator<'self> = Invert<CharOffsetIterator<'self>>; pub type CharOffsetRevIterator<'a> = Invert<CharOffsetIterator<'a>>;
/// External iterator for a string's bytes. /// External iterator for a string's bytes.
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
pub type ByteIterator<'self> = pub type ByteIterator<'a> =
Map<'self, &'self u8, u8, vec::VecIterator<'self, u8>>; Map<'a, &'a u8, u8, vec::VecIterator<'a, u8>>;
/// External iterator for a string's bytes in reverse order. /// External iterator for a string's bytes in reverse order.
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
pub type ByteRevIterator<'self> = Invert<ByteIterator<'self>>; pub type ByteRevIterator<'a> = Invert<ByteIterator<'a>>;
/// An iterator over the substrings of a string, separated by `sep`. /// An iterator over the substrings of a string, separated by `sep`.
#[deriving(Clone)] #[deriving(Clone)]
pub struct CharSplitIterator<'self, Sep> { pub struct CharSplitIterator<'a, Sep> {
/// The slice remaining to be iterated /// The slice remaining to be iterated
priv string: &'self str, priv string: &'a str,
priv sep: Sep, priv sep: Sep,
/// Whether an empty string at the end is allowed /// Whether an empty string at the end is allowed
priv allow_trailing_empty: bool, 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`, /// An iterator over the substrings of a string, separated by `sep`,
/// starting from the back of the string. /// starting from the back of the string.
pub type CharRSplitIterator<'self, Sep> = Invert<CharSplitIterator<'self, Sep>>; pub type CharRSplitIterator<'a, Sep> = Invert<CharSplitIterator<'a, Sep>>;
/// An iterator over the substrings of a string, separated by `sep`, /// An iterator over the substrings of a string, separated by `sep`,
/// splitting at most `count` times. /// splitting at most `count` times.
#[deriving(Clone)] #[deriving(Clone)]
pub struct CharSplitNIterator<'self, Sep> { pub struct CharSplitNIterator<'a, Sep> {
priv iter: CharSplitIterator<'self, Sep>, priv iter: CharSplitIterator<'a, Sep>,
/// The number of splits remaining /// The number of splits remaining
priv count: uint, priv count: uint,
priv invert: bool, priv invert: bool,
} }
/// An iterator over the words of a string, separated by an sequence of whitespace /// An iterator over the words of a string, separated by an sequence of whitespace
pub type WordIterator<'self> = pub type WordIterator<'a> =
Filter<'self, &'self str, CharSplitIterator<'self, extern "Rust" fn(char) -> bool>>; 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`). /// An iterator over the lines of a string, separated by either `\n` or (`\r\n`).
pub type AnyLineIterator<'self> = pub type AnyLineIterator<'a> =
Map<'self, &'self str, &'self str, CharSplitIterator<'self, char>>; Map<'a, &'a str, &'a str, CharSplitIterator<'a, char>>;
impl<'self, Sep> CharSplitIterator<'self, Sep> { impl<'a, Sep> CharSplitIterator<'a, Sep> {
#[inline] #[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) { if !self.finished && (self.allow_trailing_empty || self.string.len() > 0) {
self.finished = true; self.finished = true;
Some(self.string) 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] #[inline]
fn next(&mut self) -> Option<&'self str> { fn next(&mut self) -> Option<&'a str> {
if self.finished { return None } if self.finished { return None }
let mut next_split = 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> impl<'a, Sep: CharEq> DoubleEndedIterator<&'a str>
for CharSplitIterator<'self, Sep> { for CharSplitIterator<'a, Sep> {
#[inline] #[inline]
fn next_back(&mut self) -> Option<&'self str> { fn next_back(&mut self) -> Option<&'a str> {
if self.finished { return None } if self.finished { return None }
if !self.allow_trailing_empty { 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] #[inline]
fn next(&mut self) -> Option<&'self str> { fn next(&mut self) -> Option<&'a str> {
if self.count != 0 { if self.count != 0 {
self.count -= 1; self.count -= 1;
if self.invert { self.iter.next_back() } else { self.iter.next() } 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 /// An iterator over the start and end indices of the matches of a
/// substring within a larger string /// substring within a larger string
#[deriving(Clone)] #[deriving(Clone)]
pub struct MatchesIndexIterator<'self> { pub struct MatchesIndexIterator<'a> {
priv haystack: &'self str, priv haystack: &'a str,
priv needle: &'self str, priv needle: &'a str,
priv position: uint, priv position: uint,
} }
/// An iterator over the substrings of a string separated by a given /// An iterator over the substrings of a string separated by a given
/// search string /// search string
#[deriving(Clone)] #[deriving(Clone)]
pub struct StrSplitIterator<'self> { pub struct StrSplitIterator<'a> {
priv it: MatchesIndexIterator<'self>, priv it: MatchesIndexIterator<'a>,
priv last_end: uint, priv last_end: uint,
priv finished: bool priv finished: bool
} }
impl<'self> Iterator<(uint, uint)> for MatchesIndexIterator<'self> { impl<'a> Iterator<(uint, uint)> for MatchesIndexIterator<'a> {
#[inline] #[inline]
fn next(&mut self) -> Option<(uint, uint)> { fn next(&mut self) -> Option<(uint, uint)> {
// See Issue #1932 for why this is a naive search // 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] #[inline]
fn next(&mut self) -> Option<&'self str> { fn next(&mut self) -> Option<&'a str> {
if self.finished { return None; } if self.finished { return None; }
match self.it.next() { match self.it.next() {
@ -656,14 +656,14 @@ enum NormalizationForm {
/// External iterator for a string's normalization's characters. /// External iterator for a string's normalization's characters.
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
#[deriving(Clone)] #[deriving(Clone)]
struct NormalizationIterator<'self> { struct NormalizationIterator<'a> {
priv kind: NormalizationForm, priv kind: NormalizationForm,
priv iter: CharIterator<'self>, priv iter: CharIterator<'a>,
priv buffer: ~[(char, u8)], priv buffer: ~[(char, u8)],
priv sorted: bool priv sorted: bool
} }
impl<'self> Iterator<char> for NormalizationIterator<'self> { impl<'a> Iterator<char> for NormalizationIterator<'a> {
#[inline] #[inline]
fn next(&mut self) -> Option<char> { fn next(&mut self) -> Option<char> {
use unicode::decompose::canonical_combining_class; use unicode::decompose::canonical_combining_class;
@ -1168,18 +1168,18 @@ pub mod traits {
use super::{Str, eq_slice}; use super::{Str, eq_slice};
use option::{Some, None}; use option::{Some, None};
impl<'self> Add<&'self str,~str> for &'self str { impl<'a> Add<&'a str,~str> for &'a str {
#[inline] #[inline]
fn add(&self, rhs: & &'self str) -> ~str { fn add(&self, rhs: & &'a str) -> ~str {
let mut ret = self.to_owned(); let mut ret = self.to_owned();
ret.push_str(*rhs); ret.push_str(*rhs);
ret ret
} }
} }
impl<'self> TotalOrd for &'self str { impl<'a> TotalOrd for &'a str {
#[inline] #[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()) { for (s_b, o_b) in self.bytes().zip(other.bytes()) {
match s_b.cmp(&o_b) { match s_b.cmp(&o_b) {
Greater => return Greater, Greater => return Greater,
@ -1202,13 +1202,13 @@ pub mod traits {
fn cmp(&self, other: &@str) -> Ordering { self.as_slice().cmp(&other.as_slice()) } 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] #[inline]
fn eq(&self, other: & &'self str) -> bool { fn eq(&self, other: & &'a str) -> bool {
eq_slice((*self), (*other)) eq_slice((*self), (*other))
} }
#[inline] #[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 { impl Eq for ~str {
@ -1225,9 +1225,9 @@ pub mod traits {
} }
} }
impl<'self> TotalEq for &'self str { impl<'a> TotalEq for &'a str {
#[inline] #[inline]
fn equals(&self, other: & &'self str) -> bool { fn equals(&self, other: & &'a str) -> bool {
eq_slice((*self), (*other)) eq_slice((*self), (*other))
} }
} }
@ -1246,9 +1246,9 @@ pub mod traits {
} }
} }
impl<'self> Ord for &'self str { impl<'a> Ord for &'a str {
#[inline] #[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 { impl Ord for ~str {
@ -1261,17 +1261,17 @@ pub mod traits {
fn lt(&self, other: &@str) -> bool { self.cmp(other) == Less } fn lt(&self, other: &@str) -> bool { self.cmp(other) == Less }
} }
impl<'self, S: Str> Equiv<S> for &'self str { impl<'a, S: Str> Equiv<S> for &'a str {
#[inline] #[inline]
fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) } fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) }
} }
impl<'self, S: Str> Equiv<S> for @str { impl<'a, S: Str> Equiv<S> for @str {
#[inline] #[inline]
fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) } fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) }
} }
impl<'self, S: Str> Equiv<S> for ~str { impl<'a, S: Str> Equiv<S> for ~str {
#[inline] #[inline]
fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) } fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) }
} }
@ -1289,7 +1289,7 @@ pub trait Str {
fn into_owned(self) -> ~str; fn into_owned(self) -> ~str;
} }
impl<'self> Str for &'self str { impl<'a> Str for &'a str {
#[inline] #[inline]
fn as_slice<'a>(&'a self) -> &'a str { *self } 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() } fn into_owned(self) -> ~str { self.to_owned() }
} }
impl<'self> Str for ~str { impl<'a> Str for ~str {
#[inline] #[inline]
fn as_slice<'a>(&'a self) -> &'a str { fn as_slice<'a>(&'a self) -> &'a str {
let s: &'a str = *self; s let s: &'a str = *self; s
@ -1307,7 +1307,7 @@ impl<'self> Str for ~str {
fn into_owned(self) -> ~str { self } fn into_owned(self) -> ~str { self }
} }
impl<'self> Str for @str { impl<'a> Str for @str {
#[inline] #[inline]
fn as_slice<'a>(&'a self) -> &'a str { fn as_slice<'a>(&'a self) -> &'a str {
let s: &'a str = *self; s let s: &'a str = *self; s
@ -1317,7 +1317,7 @@ impl<'self> Str for @str {
fn into_owned(self) -> ~str { self.to_owned() } fn into_owned(self) -> ~str { self.to_owned() }
} }
impl<'self> Container for &'self str { impl<'a> Container for &'a str {
#[inline] #[inline]
fn len(&self) -> uint { fn len(&self) -> uint {
self.as_imm_buf(|_p, n| n) self.as_imm_buf(|_p, n| n)
@ -1345,7 +1345,7 @@ impl Mutable for ~str {
} }
/// Methods for string slices /// Methods for string slices
pub trait StrSlice<'self> { pub trait StrSlice<'a> {
/// Returns true if one string contains another /// Returns true if one string contains another
/// ///
/// # Arguments /// # Arguments
@ -1369,23 +1369,23 @@ pub trait StrSlice<'self> {
/// let v: ~[char] = "abc åäö".chars().collect(); /// let v: ~[char] = "abc åäö".chars().collect();
/// assert_eq!(v, ~['a', 'b', 'c', ' ', 'å', 'ä', 'ö']); /// 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. /// 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` /// 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 /// 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. /// 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, /// An iterator over the characters of `self` and their byte offsets,
/// in reverse order. /// 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 /// An iterator over substrings of `self`, separated by characters
/// matched by `sep`. /// matched by `sep`.
@ -1402,7 +1402,7 @@ pub trait StrSlice<'self> {
/// let v: ~[&str] = "lionXXtigerXleopard".split('X').collect(); /// let v: ~[&str] = "lionXXtigerXleopard".split('X').collect();
/// assert_eq!(v, ~["lion", "", "tiger", "leopard"]); /// assert_eq!(v, ~["lion", "", "tiger", "leopard"]);
/// ``` /// ```
fn split<Sep: CharEq>(&self, sep: Sep) -> CharSplitIterator<'self, Sep>; fn split<Sep: CharEq>(&self, sep: Sep) -> CharSplitIterator<'a, Sep>;
/// An iterator over substrings of `self`, separated by characters /// An iterator over substrings of `self`, separated by characters
/// matched by `sep`, restricted to splitting at most `count` /// 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(); /// let v: ~[&str] = "lionXXtigerXleopard".splitn('X', 2).collect();
/// assert_eq!(v, ~["lion", "", "tigerXleopard"]); /// assert_eq!(v, ~["lion", "", "tigerXleopard"]);
/// ``` /// ```
fn splitn<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitNIterator<'self, Sep>; fn splitn<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitNIterator<'a, Sep>;
/// An iterator over substrings of `self`, separated by characters /// An iterator over substrings of `self`, separated by characters
/// matched by `sep`. /// matched by `sep`.
@ -1437,7 +1437,7 @@ pub trait StrSlice<'self> {
/// let v: ~[&str] = "A..B..".split_terminator('.').collect(); /// let v: ~[&str] = "A..B..".split_terminator('.').collect();
/// assert_eq!(v, ~["A", "", "B", ""]); /// assert_eq!(v, ~["A", "", "B", ""]);
/// ``` /// ```
fn split_terminator<Sep: CharEq>(&self, sep: Sep) -> CharSplitIterator<'self, Sep>; fn split_terminator<Sep: CharEq>(&self, sep: Sep) -> CharSplitIterator<'a, Sep>;
/// An iterator over substrings of `self`, separated by characters /// An iterator over substrings of `self`, separated by characters
/// matched by `sep`, in reverse order. /// matched by `sep`, in reverse order.
@ -1454,7 +1454,7 @@ pub trait StrSlice<'self> {
/// let v: ~[&str] = "lionXXtigerXleopard".rsplit('X').collect(); /// let v: ~[&str] = "lionXXtigerXleopard".rsplit('X').collect();
/// assert_eq!(v, ~["leopard", "tiger", "", "lion"]); /// assert_eq!(v, ~["leopard", "tiger", "", "lion"]);
/// ``` /// ```
fn rsplit<Sep: CharEq>(&self, sep: Sep) -> CharRSplitIterator<'self, Sep>; fn rsplit<Sep: CharEq>(&self, sep: Sep) -> CharRSplitIterator<'a, Sep>;
/// An iterator over substrings of `self`, separated by characters /// An iterator over substrings of `self`, separated by characters
/// matched by `sep`, starting from the end of the string. /// 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(); /// let v: ~[&str] = "lionXXtigerXleopard".rsplitn('X', 2).collect();
/// assert_eq!(v, ~["leopard", "tiger", "lionX"]); /// assert_eq!(v, ~["leopard", "tiger", "lionX"]);
/// ``` /// ```
fn rsplitn<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitNIterator<'self, Sep>; fn rsplitn<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitNIterator<'a, Sep>;
/// An iterator over the start and end indices of the disjoint /// An iterator over the start and end indices of the disjoint
/// matches of `sep` within `self`. /// matches of `sep` within `self`.
@ -1494,7 +1494,7 @@ pub trait StrSlice<'self> {
/// let v: ~[(uint, uint)] = "ababa".split_str("aba").collect(); /// let v: ~[(uint, uint)] = "ababa".split_str("aba").collect();
/// assert_eq!(v, ~[(0, 3)]); // only the first `aba` /// 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`. /// 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(); /// let v: ~[&str] = "1abcabc2".split_str("abc").collect();
/// assert_eq!(v, ~["1", "", "2"]); /// 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 /// An iterator over the lines of a string (subsequences separated
/// by `\n`). This does not include the empty string after a /// 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(); /// let v: ~[&str] = four_lines.lines().collect();
/// assert_eq!(v, ~["foo", "bar", "", "baz"]); /// 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 /// An iterator over the lines of a string, separated by either
/// `\n` or `\r\n`. As with `.lines()`, this does not include an /// `\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(); /// let v: ~[&str] = four_lines.lines_any().collect();
/// assert_eq!(v, ~["foo", "bar", "", "baz"]); /// 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 /// An iterator over the words of a string (subsequences separated
/// by any sequence of whitespace). Sequences of whitespace are /// by any sequence of whitespace). Sequences of whitespace are
@ -1546,15 +1546,15 @@ pub trait StrSlice<'self> {
/// let v: ~[&str] = some_words.words().collect(); /// let v: ~[&str] = some_words.words().collect();
/// assert_eq!(v, ~["Mary", "had", "a", "little", "lamb"]); /// 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 /// An Iterator over the string in Unicode Normalization Form D
/// (canonical decomposition). /// (canonical decomposition).
fn nfd_chars(&self) -> NormalizationIterator<'self>; fn nfd_chars(&self) -> NormalizationIterator<'a>;
/// An Iterator over the string in Unicode Normalization Form KD /// An Iterator over the string in Unicode Normalization Form KD
/// (compatibility decomposition). /// (compatibility decomposition).
fn nfkd_chars(&self) -> NormalizationIterator<'self>; fn nfkd_chars(&self) -> NormalizationIterator<'a>;
/// Returns true if the string contains only whitespace. /// Returns true if the string contains only whitespace.
/// ///
@ -1647,7 +1647,7 @@ pub trait StrSlice<'self> {
/// // byte 100 is outside the string /// // byte 100 is outside the string
/// // s.slice(3, 100); /// // 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. /// Returns a slice of the string from `begin` to its end.
/// ///
@ -1657,7 +1657,7 @@ pub trait StrSlice<'self> {
/// out of bounds. /// out of bounds.
/// ///
/// See also `slice`, `slice_to` and `slice_chars`. /// 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 /// Returns a slice of the string from the beginning to byte
/// `end`. /// `end`.
@ -1668,7 +1668,7 @@ pub trait StrSlice<'self> {
/// out of bounds. /// out of bounds.
/// ///
/// See also `slice`, `slice_from` and `slice_chars`. /// 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 /// Returns a slice of the string from the character range
/// [`begin`..`end`). /// [`begin`..`end`).
@ -1693,7 +1693,7 @@ pub trait StrSlice<'self> {
/// assert_eq!(s.slice_chars(0, 4), "Löwe"); /// assert_eq!(s.slice_chars(0, 4), "Löwe");
/// assert_eq!(s.slice_chars(6, 8), "老虎"); /// 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. /// Returns true if `needle` is a prefix of the string.
fn starts_with(&self, needle: &str) -> bool; fn starts_with(&self, needle: &str) -> bool;
@ -1708,13 +1708,13 @@ pub trait StrSlice<'self> {
fn escape_unicode(&self) -> ~str; fn escape_unicode(&self) -> ~str;
/// Returns a string with leading and trailing whitespace removed. /// 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. /// 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. /// 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. /// 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!("12foo1bar12".trim_chars(& &['1', '2']), "foo1bar")
/// assert_eq!("123foo1bar123".trim_chars(&|c: char| c.is_digit()), "foo1bar") /// assert_eq!("123foo1bar123".trim_chars(&|c: char| c.is_digit()), "foo1bar")
/// ``` /// ```
fn trim_chars<C: CharEq>(&self, to_trim: &C) -> &'self str; fn trim_chars<C: CharEq>(&self, to_trim: &C) -> &'a str;
/// Returns a string with leading `chars_to_trim` removed. /// 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!("12foo1bar12".trim_left_chars(& &['1', '2']), "foo1bar12")
/// assert_eq!("123foo1bar123".trim_left_chars(&|c: char| c.is_digit()), "foo1bar123") /// assert_eq!("123foo1bar123".trim_left_chars(&|c: char| c.is_digit()), "foo1bar123")
/// ``` /// ```
fn trim_left_chars<C: CharEq>(&self, to_trim: &C) -> &'self str; fn trim_left_chars<C: CharEq>(&self, to_trim: &C) -> &'a str;
/// Returns a string with trailing `chars_to_trim` removed. /// 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!("12foo1bar12".trim_right_chars(& &['1', '2']), "12foo1bar")
/// assert_eq!("123foo1bar123".trim_right_chars(&|c: char| c.is_digit()), "123foo1bar") /// assert_eq!("123foo1bar123".trim_right_chars(&|c: char| c.is_digit()), "123foo1bar")
/// ``` /// ```
fn trim_right_chars<C: CharEq>(&self, to_trim: &C) -> &'self str; fn trim_right_chars<C: CharEq>(&self, to_trim: &C) -> &'a str;
/// Replace all occurrences of one string with another. /// Replace all occurrences of one string with another.
/// ///
@ -1891,7 +1891,7 @@ pub trait StrSlice<'self> {
fn char_at_reverse(&self, i: uint) -> char; fn char_at_reverse(&self, i: uint) -> char;
/// Work with the byte buffer of a string as a byte slice. /// 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 /// Returns the byte index of the first character of `self` that
/// matches `search`. /// matches `search`.
@ -1986,7 +1986,7 @@ pub trait StrSlice<'self> {
/// assert_eq!(c, 'ö'); /// assert_eq!(c, 'ö');
/// assert_eq!(s2, "we 老虎 Léopard"); /// 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. /// Levenshtein Distance between two strings.
fn lev_distance(&self, t: &str) -> uint; fn lev_distance(&self, t: &str) -> uint;
@ -2013,7 +2013,7 @@ pub trait StrSlice<'self> {
fn as_imm_buf<T>(&self, f: |*u8, uint| -> T) -> T; fn as_imm_buf<T>(&self, f: |*u8, uint| -> T) -> T;
} }
impl<'self> StrSlice<'self> for &'self str { impl<'a> StrSlice<'a> for &'a str {
#[inline] #[inline]
fn contains<'a>(&self, needle: &'a str) -> bool { fn contains<'a>(&self, needle: &'a str) -> bool {
self.find_str(needle).is_some() self.find_str(needle).is_some()
@ -2025,37 +2025,37 @@ impl<'self> StrSlice<'self> for &'self str {
} }
#[inline] #[inline]
fn chars(&self) -> CharIterator<'self> { fn chars(&self) -> CharIterator<'a> {
CharIterator{string: *self} CharIterator{string: *self}
} }
#[inline] #[inline]
fn chars_rev(&self) -> CharRevIterator<'self> { fn chars_rev(&self) -> CharRevIterator<'a> {
self.chars().invert() self.chars().invert()
} }
#[inline] #[inline]
fn bytes(&self) -> ByteIterator<'self> { fn bytes(&self) -> ByteIterator<'a> {
self.as_bytes().iter().map(|&b| b) self.as_bytes().iter().map(|&b| b)
} }
#[inline] #[inline]
fn bytes_rev(&self) -> ByteRevIterator<'self> { fn bytes_rev(&self) -> ByteRevIterator<'a> {
self.bytes().invert() self.bytes().invert()
} }
#[inline] #[inline]
fn char_indices(&self) -> CharOffsetIterator<'self> { fn char_indices(&self) -> CharOffsetIterator<'a> {
CharOffsetIterator{string: *self, iter: self.chars()} CharOffsetIterator{string: *self, iter: self.chars()}
} }
#[inline] #[inline]
fn char_indices_rev(&self) -> CharOffsetRevIterator<'self> { fn char_indices_rev(&self) -> CharOffsetRevIterator<'a> {
self.char_indices().invert() self.char_indices().invert()
} }
#[inline] #[inline]
fn split<Sep: CharEq>(&self, sep: Sep) -> CharSplitIterator<'self, Sep> { fn split<Sep: CharEq>(&self, sep: Sep) -> CharSplitIterator<'a, Sep> {
CharSplitIterator { CharSplitIterator {
string: *self, string: *self,
only_ascii: sep.only_ascii(), only_ascii: sep.only_ascii(),
@ -2067,7 +2067,7 @@ impl<'self> StrSlice<'self> for &'self str {
#[inline] #[inline]
fn splitn<Sep: CharEq>(&self, sep: Sep, count: uint) fn splitn<Sep: CharEq>(&self, sep: Sep, count: uint)
-> CharSplitNIterator<'self, Sep> { -> CharSplitNIterator<'a, Sep> {
CharSplitNIterator { CharSplitNIterator {
iter: self.split(sep), iter: self.split(sep),
count: count, count: count,
@ -2077,7 +2077,7 @@ impl<'self> StrSlice<'self> for &'self str {
#[inline] #[inline]
fn split_terminator<Sep: CharEq>(&self, sep: Sep) fn split_terminator<Sep: CharEq>(&self, sep: Sep)
-> CharSplitIterator<'self, Sep> { -> CharSplitIterator<'a, Sep> {
CharSplitIterator { CharSplitIterator {
allow_trailing_empty: false, allow_trailing_empty: false,
..self.split(sep) ..self.split(sep)
@ -2085,13 +2085,13 @@ impl<'self> StrSlice<'self> for &'self str {
} }
#[inline] #[inline]
fn rsplit<Sep: CharEq>(&self, sep: Sep) -> CharRSplitIterator<'self, Sep> { fn rsplit<Sep: CharEq>(&self, sep: Sep) -> CharRSplitIterator<'a, Sep> {
self.split(sep).invert() self.split(sep).invert()
} }
#[inline] #[inline]
fn rsplitn<Sep: CharEq>(&self, sep: Sep, count: uint) fn rsplitn<Sep: CharEq>(&self, sep: Sep, count: uint)
-> CharSplitNIterator<'self, Sep> { -> CharSplitNIterator<'a, Sep> {
CharSplitNIterator { CharSplitNIterator {
iter: self.split(sep), iter: self.split(sep),
count: count, count: count,
@ -2100,7 +2100,7 @@ impl<'self> StrSlice<'self> for &'self str {
} }
#[inline] #[inline]
fn match_indices(&self, sep: &'self str) -> MatchesIndexIterator<'self> { fn match_indices(&self, sep: &'a str) -> MatchesIndexIterator<'a> {
assert!(!sep.is_empty()) assert!(!sep.is_empty())
MatchesIndexIterator { MatchesIndexIterator {
haystack: *self, haystack: *self,
@ -2110,7 +2110,7 @@ impl<'self> StrSlice<'self> for &'self str {
} }
#[inline] #[inline]
fn split_str(&self, sep: &'self str) -> StrSplitIterator<'self> { fn split_str(&self, sep: &'a str) -> StrSplitIterator<'a> {
StrSplitIterator { StrSplitIterator {
it: self.match_indices(sep), it: self.match_indices(sep),
last_end: 0, last_end: 0,
@ -2119,11 +2119,11 @@ impl<'self> StrSlice<'self> for &'self str {
} }
#[inline] #[inline]
fn lines(&self) -> CharSplitIterator<'self, char> { fn lines(&self) -> CharSplitIterator<'a, char> {
self.split_terminator('\n') self.split_terminator('\n')
} }
fn lines_any(&self) -> AnyLineIterator<'self> { fn lines_any(&self) -> AnyLineIterator<'a> {
self.lines().map(|line| { self.lines().map(|line| {
let l = line.len(); let l = line.len();
if l > 0 && line[l - 1] == '\r' as u8 { line.slice(0, l - 1) } 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] #[inline]
fn words(&self) -> WordIterator<'self> { fn words(&self) -> WordIterator<'a> {
self.split(char::is_whitespace).filter(|s| !s.is_empty()) self.split(char::is_whitespace).filter(|s| !s.is_empty())
} }
#[inline] #[inline]
fn nfd_chars(&self) -> NormalizationIterator<'self> { fn nfd_chars(&self) -> NormalizationIterator<'a> {
NormalizationIterator { NormalizationIterator {
iter: self.chars(), iter: self.chars(),
buffer: ~[], buffer: ~[],
@ -2147,7 +2147,7 @@ impl<'self> StrSlice<'self> for &'self str {
} }
#[inline] #[inline]
fn nfkd_chars(&self) -> NormalizationIterator<'self> { fn nfkd_chars(&self) -> NormalizationIterator<'a> {
NormalizationIterator { NormalizationIterator {
iter: self.chars(), iter: self.chars(),
buffer: ~[], buffer: ~[],
@ -2166,23 +2166,23 @@ impl<'self> StrSlice<'self> for &'self str {
fn char_len(&self) -> uint { self.chars().len() } fn char_len(&self) -> uint { self.chars().len() }
#[inline] #[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)); assert!(self.is_char_boundary(begin) && self.is_char_boundary(end));
unsafe { raw::slice_bytes(*self, begin, end) } unsafe { raw::slice_bytes(*self, begin, end) }
} }
#[inline] #[inline]
fn slice_from(&self, begin: uint) -> &'self str { fn slice_from(&self, begin: uint) -> &'a str {
self.slice(begin, self.len()) self.slice(begin, self.len())
} }
#[inline] #[inline]
fn slice_to(&self, end: uint) -> &'self str { fn slice_to(&self, end: uint) -> &'a str {
assert!(self.is_char_boundary(end)); assert!(self.is_char_boundary(end));
unsafe { raw::slice_bytes(*self, 0, 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); assert!(begin <= end);
let mut count = 0; let mut count = 0;
let mut begin_byte = None; let mut begin_byte = None;
@ -2236,27 +2236,27 @@ impl<'self> StrSlice<'self> for &'self str {
} }
#[inline] #[inline]
fn trim(&self) -> &'self str { fn trim(&self) -> &'a str {
self.trim_left().trim_right() self.trim_left().trim_right()
} }
#[inline] #[inline]
fn trim_left(&self) -> &'self str { fn trim_left(&self) -> &'a str {
self.trim_left_chars(&char::is_whitespace) self.trim_left_chars(&char::is_whitespace)
} }
#[inline] #[inline]
fn trim_right(&self) -> &'self str { fn trim_right(&self) -> &'a str {
self.trim_right_chars(&char::is_whitespace) self.trim_right_chars(&char::is_whitespace)
} }
#[inline] #[inline]
fn trim_chars<C: CharEq>(&self, to_trim: &C) -> &'self str { fn trim_chars<C: CharEq>(&self, to_trim: &C) -> &'a str {
self.trim_left_chars(to_trim).trim_right_chars(to_trim) self.trim_left_chars(to_trim).trim_right_chars(to_trim)
} }
#[inline] #[inline]
fn trim_left_chars<C: CharEq>(&self, to_trim: &C) -> &'self str { fn trim_left_chars<C: CharEq>(&self, to_trim: &C) -> &'a str {
match self.find(|c: char| !to_trim.matches(c)) { match self.find(|c: char| !to_trim.matches(c)) {
None => "", None => "",
Some(first) => unsafe { raw::slice_bytes(*self, first, self.len()) } Some(first) => unsafe { raw::slice_bytes(*self, first, self.len()) }
@ -2264,7 +2264,7 @@ impl<'self> StrSlice<'self> for &'self str {
} }
#[inline] #[inline]
fn trim_right_chars<C: CharEq>(&self, to_trim: &C) -> &'self str { fn trim_right_chars<C: CharEq>(&self, to_trim: &C) -> &'a str {
match self.rfind(|c: char| !to_trim.matches(c)) { match self.rfind(|c: char| !to_trim.matches(c)) {
None => "", None => "",
Some(last) => { Some(last) => {
@ -2408,7 +2408,7 @@ impl<'self> StrSlice<'self> for &'self str {
} }
#[inline] #[inline]
fn as_bytes(&self) -> &'self [u8] { fn as_bytes(&self) -> &'a [u8] {
unsafe { cast::transmute(*self) } unsafe { cast::transmute(*self) }
} }
@ -2453,7 +2453,7 @@ impl<'self> StrSlice<'self> for &'self str {
} }
#[inline] #[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 CharRange {ch, next} = self.char_range_at(0u);
let next_s = unsafe { raw::slice_bytes(*self, next, self.len()) }; let next_s = unsafe { raw::slice_bytes(*self, next, self.len()) };
return (ch, next_s); return (ch, next_s);
@ -2756,8 +2756,8 @@ impl Extendable<char> for ~str {
} }
// This works because every lifetime is a sub-lifetime of 'static // This works because every lifetime is a sub-lifetime of 'static
impl<'self> Default for &'self str { impl<'a> Default for &'a str {
fn default() -> &'self str { "" } fn default() -> &'a str { "" }
} }
impl Default for ~str { impl Default for ~str {

View file

@ -22,7 +22,7 @@ use rc::Rc;
use str::{Str, StrSlice}; use str::{Str, StrSlice};
use vec::{Vector, ImmutableVector}; 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; /// 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] #[inline]
fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool { fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
self.len().iter_bytes(lsb0, |b| f(b)) && self.len().iter_bytes(lsb0, |b| f(b)) &&
@ -273,7 +273,7 @@ impl<A:IterBytes> IterBytes for @[A] {
} }
} }
impl<'self> IterBytes for &'self str { impl<'a> IterBytes for &'a str {
#[inline] #[inline]
fn iter_bytes(&self, _lsb0: bool, f: Cb) -> bool { fn iter_bytes(&self, _lsb0: bool, f: Cb) -> bool {
// Terminate the string with a byte that does not appear in UTF-8 // Terminate the string with a byte that does not appear in UTF-8
@ -305,7 +305,7 @@ impl<A:IterBytes> IterBytes for Option<A> {
} }
} }
impl<'self,A:IterBytes> IterBytes for &'self A { impl<'a,A:IterBytes> IterBytes for &'a A {
#[inline] #[inline]
fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool { fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
(**self).iter_bytes(lsb0, f) (**self).iter_bytes(lsb0, f)

View file

@ -121,7 +121,7 @@ impl<A:ToStr,B:ToStr,C:ToStr> ToStr for (A, B, C) {
} }
} }
impl<'self,A:ToStr> ToStr for &'self [A] { impl<'a,A:ToStr> ToStr for &'a [A] {
#[inline] #[inline]
fn to_str(&self) -> ~str { fn to_str(&self) -> ~str {
let mut acc = ~"["; let mut acc = ~"[";

View file

@ -443,14 +443,14 @@ fn remove<T>(count: &mut uint, child: &mut Child<T>, key: uint,
} }
/// Forward iterator over a map /// Forward iterator over a map
pub struct TrieMapIterator<'self, T> { pub struct TrieMapIterator<'a, T> {
priv stack: ~[vec::VecIterator<'self, Child<T>>], priv stack: ~[vec::VecIterator<'a, Child<T>>],
priv remaining_min: uint, priv remaining_min: uint,
priv remaining_max: uint priv remaining_max: uint
} }
impl<'self, T> Iterator<(uint, &'self T)> for TrieMapIterator<'self, T> { impl<'a, T> Iterator<(uint, &'a T)> for TrieMapIterator<'a, T> {
fn next(&mut self) -> Option<(uint, &'self T)> { fn next(&mut self) -> Option<(uint, &'a T)> {
while !self.stack.is_empty() { while !self.stack.is_empty() {
match self.stack[self.stack.len() - 1].next() { match self.stack[self.stack.len() - 1].next() {
None => { None => {
@ -483,11 +483,11 @@ impl<'self, T> Iterator<(uint, &'self T)> for TrieMapIterator<'self, T> {
} }
/// Forward iterator over a set /// Forward iterator over a set
pub struct TrieSetIterator<'self> { pub struct TrieSetIterator<'a> {
priv iter: TrieMapIterator<'self, ()> priv iter: TrieMapIterator<'a, ()>
} }
impl<'self> Iterator<uint> for TrieSetIterator<'self> { impl<'a> Iterator<uint> for TrieSetIterator<'a> {
fn next(&mut self) -> Option<uint> { fn next(&mut self) -> Option<uint> {
self.iter.next().map(|(key, _)| key) self.iter.next().map(|(key, _)| key)
} }

View file

@ -62,7 +62,7 @@ impl DynamicLibrary {
/// Access the value at the symbol of the dynamic library /// Access the value at the symbol of the dynamic library
pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<T, ~str> { pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<T, ~str> {
// 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 // T but that feature is still unimplemented
let maybe_symbol_value = dl::check_for_errors_in(|| { let maybe_symbol_value = dl::check_for_errors_in(|| {

View file

@ -44,7 +44,7 @@ macro_rules! finally_fn {
} }
} }
impl<'self,T> Finally<T> for 'self || -> T { impl<'a,T> Finally<T> for 'a || -> T {
fn finally(&self, dtor: ||) -> T { fn finally(&self, dtor: ||) -> T {
let _d = Finallyalizer { let _d = Finallyalizer {
dtor: dtor dtor: dtor
@ -56,12 +56,12 @@ impl<'self,T> Finally<T> for 'self || -> T {
finally_fn!(extern "Rust" fn() -> T) finally_fn!(extern "Rust" fn() -> T)
struct Finallyalizer<'self> { struct Finallyalizer<'a> {
dtor: 'self || dtor: 'a ||
} }
#[unsafe_destructor] #[unsafe_destructor]
impl<'self> Drop for Finallyalizer<'self> { impl<'a> Drop for Finallyalizer<'a> {
fn drop(&mut self) { fn drop(&mut self) {
(self.dtor)(); (self.dtor)();
} }

View file

@ -53,8 +53,8 @@ pub trait Repr<T> {
fn repr(&self) -> T { unsafe { cast::transmute_copy(self) } } fn repr(&self) -> T { unsafe { cast::transmute_copy(self) } }
} }
impl<'self, T> Repr<Slice<T>> for &'self [T] {} impl<'a, T> Repr<Slice<T>> for &'a [T] {}
impl<'self> Repr<Slice<u8>> for &'self str {} impl<'a> Repr<Slice<u8>> for &'a str {}
impl<T> Repr<*Box<T>> for @T {} impl<T> Repr<*Box<T>> for @T {}
impl<T> Repr<*Box<Vec<T>>> for @[T] {} impl<T> Repr<*Box<Vec<T>>> for @[T] {}
impl Repr<*String> for ~str {} impl Repr<*String> for ~str {}

View file

@ -219,16 +219,16 @@ pub fn build<A>(size: Option<uint>, builder: |push: |v: A||) -> ~[A] {
/// An iterator over the slices of a vector separated by elements that /// An iterator over the slices of a vector separated by elements that
/// match a predicate function. /// match a predicate function.
pub struct SplitIterator<'self, T> { pub struct SplitIterator<'a, T> {
priv v: &'self [T], priv v: &'a [T],
priv n: uint, priv n: uint,
priv pred: 'self |t: &T| -> bool, priv pred: 'a |t: &T| -> bool,
priv finished: 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] #[inline]
fn next(&mut self) -> Option<&'self [T]> { fn next(&mut self) -> Option<&'a [T]> {
if self.finished { return None; } if self.finished { return None; }
if self.n == 0 { 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 /// An iterator over the slices of a vector separated by elements that
/// match a predicate function, from back to front. /// match a predicate function, from back to front.
pub struct RSplitIterator<'self, T> { pub struct RSplitIterator<'a, T> {
priv v: &'self [T], priv v: &'a [T],
priv n: uint, priv n: uint,
priv pred: 'self |t: &T| -> bool, priv pred: 'a |t: &T| -> bool,
priv finished: 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] #[inline]
fn next(&mut self) -> Option<&'self [T]> { fn next(&mut self) -> Option<&'a [T]> {
if self.finished { return None; } if self.finished { return None; }
if self.n == 0 { if self.n == 0 {
@ -355,7 +355,7 @@ pub trait VectorVector<T> {
fn connect_vec(&self, sep: &T) -> ~[T]; fn connect_vec(&self, sep: &T) -> ~[T];
} }
impl<'self, T: Clone, V: Vector<T>> VectorVector<T> for &'self [V] { impl<'a, T: Clone, V: Vector<T>> VectorVector<T> for &'a [V] {
fn concat_vec(&self) -> ~[T] { fn concat_vec(&self) -> ~[T] {
let size = self.iter().fold(0u, |acc, v| acc + v.as_slice().len()); let size = self.iter().fold(0u, |acc, v| acc + v.as_slice().len());
let mut result = with_capacity(size); let mut result = with_capacity(size);
@ -503,14 +503,14 @@ impl<T: Clone> Iterator<~[T]> for Permutations<T> {
/// An iterator over the (overlapping) slices of length `size` within /// An iterator over the (overlapping) slices of length `size` within
/// a vector. /// a vector.
#[deriving(Clone)] #[deriving(Clone)]
pub struct WindowIter<'self, T> { pub struct WindowIter<'a, T> {
priv v: &'self [T], priv v: &'a [T],
priv size: uint priv size: uint
} }
impl<'self, T> Iterator<&'self [T]> for WindowIter<'self, T> { impl<'a, T> Iterator<&'a [T]> for WindowIter<'a, T> {
#[inline] #[inline]
fn next(&mut self) -> Option<&'self [T]> { fn next(&mut self) -> Option<&'a [T]> {
if self.size > self.v.len() { if self.size > self.v.len() {
None None
} else { } 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, /// When the vector len is not evenly divided by the chunk size,
/// the last slice of the iteration will be the remainder. /// the last slice of the iteration will be the remainder.
#[deriving(Clone)] #[deriving(Clone)]
pub struct ChunkIter<'self, T> { pub struct ChunkIter<'a, T> {
priv v: &'self [T], priv v: &'a [T],
priv size: uint priv size: uint
} }
impl<'self, T> Iterator<&'self [T]> for ChunkIter<'self, T> { impl<'a, T> Iterator<&'a [T]> for ChunkIter<'a, T> {
#[inline] #[inline]
fn next(&mut self) -> Option<&'self [T]> { fn next(&mut self) -> Option<&'a [T]> {
if self.v.len() == 0 { if self.v.len() == 0 {
None None
} else { } 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] #[inline]
fn next_back(&mut self) -> Option<&'self [T]> { fn next_back(&mut self) -> Option<&'a [T]> {
if self.v.len() == 0 { if self.v.len() == 0 {
None None
} else { } 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] #[inline]
fn indexable(&self) -> uint { fn indexable(&self) -> uint {
self.v.len()/self.size + if self.v.len() % self.size != 0 { 1 } else { 0 } self.v.len()/self.size + if self.v.len() % self.size != 0 { 1 } else { 0 }
} }
#[inline] #[inline]
fn idx(&self, index: uint) -> Option<&'self [T]> { fn idx(&self, index: uint) -> Option<&'a [T]> {
if index < self.indexable() { if index < self.indexable() {
let lo = index * self.size; let lo = index * self.size;
let mut hi = lo + self.size; let mut hi = lo + self.size;
@ -616,12 +616,12 @@ pub mod traits {
use iter::order; use iter::order;
use ops::Add; use ops::Add;
impl<'self,T:Eq> Eq for &'self [T] { impl<'a,T:Eq> Eq for &'a [T] {
fn eq(&self, other: & &'self [T]) -> bool { fn eq(&self, other: & &'a [T]) -> bool {
self.len() == other.len() && self.len() == other.len() &&
order::eq(self.iter(), other.iter()) order::eq(self.iter(), other.iter())
} }
fn ne(&self, other: & &'self [T]) -> bool { fn ne(&self, other: & &'a [T]) -> bool {
self.len() != other.len() || self.len() != other.len() ||
order::ne(self.iter(), other.iter()) order::ne(self.iter(), other.iter())
} }
@ -641,8 +641,8 @@ pub mod traits {
fn ne(&self, other: &@[T]) -> bool { !self.eq(other) } fn ne(&self, other: &@[T]) -> bool { !self.eq(other) }
} }
impl<'self,T:TotalEq> TotalEq for &'self [T] { impl<'a,T:TotalEq> TotalEq for &'a [T] {
fn equals(&self, other: & &'self [T]) -> bool { fn equals(&self, other: & &'a [T]) -> bool {
self.len() == other.len() && self.len() == other.len() &&
order::equals(self.iter(), other.iter()) 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()) } fn equals(&self, other: &@[T]) -> bool { self.as_slice().equals(&other.as_slice()) }
} }
impl<'self,T:Eq, V: Vector<T>> Equiv<V> for &'self [T] { impl<'a,T:Eq, V: Vector<T>> Equiv<V> for &'a [T] {
#[inline] #[inline]
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
} }
impl<'self,T:Eq, V: Vector<T>> Equiv<V> for ~[T] { impl<'a,T:Eq, V: Vector<T>> Equiv<V> for ~[T] {
#[inline] #[inline]
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
} }
impl<'self,T:Eq, V: Vector<T>> Equiv<V> for @[T] { impl<'a,T:Eq, V: Vector<T>> Equiv<V> for @[T] {
#[inline] #[inline]
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
} }
impl<'self,T:TotalOrd> TotalOrd for &'self [T] { impl<'a,T:TotalOrd> TotalOrd for &'a [T] {
fn cmp(&self, other: & &'self [T]) -> Ordering { fn cmp(&self, other: & &'a [T]) -> Ordering {
order::cmp(self.iter(), other.iter()) 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()) } fn cmp(&self, other: &@[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) }
} }
impl<'self, T: Eq + Ord> Ord for &'self [T] { impl<'a, T: Eq + Ord> Ord for &'a [T] {
fn lt(&self, other: & &'self [T]) -> bool { fn lt(&self, other: & &'a [T]) -> bool {
order::lt(self.iter(), other.iter()) order::lt(self.iter(), other.iter())
} }
#[inline] #[inline]
fn le(&self, other: & &'self [T]) -> bool { fn le(&self, other: & &'a [T]) -> bool {
order::le(self.iter(), other.iter()) order::le(self.iter(), other.iter())
} }
#[inline] #[inline]
fn ge(&self, other: & &'self [T]) -> bool { fn ge(&self, other: & &'a [T]) -> bool {
order::ge(self.iter(), other.iter()) order::ge(self.iter(), other.iter())
} }
#[inline] #[inline]
fn gt(&self, other: & &'self [T]) -> bool { fn gt(&self, other: & &'a [T]) -> bool {
order::gt(self.iter(), other.iter()) 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() } fn gt(&self, other: &@[T]) -> bool { self.as_slice() > other.as_slice() }
} }
impl<'self,T:Clone, V: Vector<T>> Add<V, ~[T]> for &'self [T] { impl<'a,T:Clone, V: Vector<T>> Add<V, ~[T]> for &'a [T] {
#[inline] #[inline]
fn add(&self, rhs: &V) -> ~[T] { fn add(&self, rhs: &V) -> ~[T] {
let mut res = with_capacity(self.len() + rhs.as_slice().len()); let mut res = with_capacity(self.len() + rhs.as_slice().len());
@ -756,7 +756,7 @@ pub trait Vector<T> {
fn as_slice<'a>(&'a self) -> &'a [T]; fn as_slice<'a>(&'a self) -> &'a [T];
} }
impl<'self,T> Vector<T> for &'self [T] { impl<'a,T> Vector<T> for &'a [T] {
#[inline(always)] #[inline(always)]
fn as_slice<'a>(&'a self) -> &'a [T] { *self } fn as_slice<'a>(&'a self) -> &'a [T] { *self }
} }
@ -771,7 +771,7 @@ impl<T> Vector<T> for @[T] {
fn as_slice<'a>(&'a self) -> &'a [T] { let v: &'a [T] = *self; v } 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 /// Returns the length of a vector
#[inline] #[inline]
fn len(&self) -> uint { fn len(&self) -> uint {
@ -797,7 +797,7 @@ pub trait CopyableVector<T> {
} }
/// Extension methods for vector slices /// Extension methods for vector slices
impl<'self, T: Clone> CopyableVector<T> for &'self [T] { impl<'a, T: Clone> CopyableVector<T> for &'a [T] {
/// Returns a copy of `v`. /// Returns a copy of `v`.
#[inline] #[inline]
fn to_owned(&self) -> ~[T] { fn to_owned(&self) -> ~[T] {
@ -831,52 +831,52 @@ impl<T: Clone> CopyableVector<T> for @[T] {
} }
/// Extension methods for vectors /// Extension methods for vectors
pub trait ImmutableVector<'self, T> { pub trait ImmutableVector<'a, T> {
/** /**
* Returns a slice of self between `start` and `end`. * Returns a slice of self between `start` and `end`.
* *
* Fails when `start` or `end` point outside the bounds of self, * Fails when `start` or `end` point outside the bounds of self,
* or when `start` > `end`. * 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. * Returns a slice of self from `start` to the end of the vec.
* *
* Fails when `start` points outside the bounds of self. * 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`. * Returns a slice of self from the start of the vec to `end`.
* *
* Fails when `end` points outside the bounds of self. * 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 /// 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 /// 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 /// Returns an iterator over the subslices of the vector which are
/// separated by elements that match `pred`. The matched element /// separated by elements that match `pred`. The matched element
/// is not contained in the subslices. /// 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 /// Returns an iterator over the subslices of the vector which are
/// separated by elements that match `pred`, limited to splitting /// separated by elements that match `pred`, limited to splitting
/// at most `n` times. The matched element is not contained in /// at most `n` times. The matched element is not contained in
/// the subslices. /// 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 /// Returns an iterator over the subslices of the vector which are
/// separated by elements that match `pred`. This starts at the /// separated by elements that match `pred`. This starts at the
/// end of the vector and works backwards. The matched element is /// end of the vector and works backwards. The matched element is
/// not contained in the subslices. /// 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 /// Returns an iterator over the subslices of the vector which are
/// separated by elements that match `pred` limited to splitting /// separated by elements that match `pred` limited to splitting
/// at most `n` times. This starts at the end of the vector and /// at most `n` times. This starts at the end of the vector and
/// works backwards. The matched element is not contained in the /// works backwards. The matched element is not contained in the
/// subslices. /// 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 * 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 * 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 /// Returns the element of a vector at the given index, or `None` if the
/// index is out of bounds /// 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. /// 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 /// 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 /// 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 /// 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 /// 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 /// 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. /// 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. /// 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 * Apply a function to each element of a vector and return a concatenation
* of each result vector * of each result vector
@ -995,7 +995,7 @@ pub trait ImmutableVector<'self, T> {
* *
* Fails if slice is empty. * 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 * 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. * 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] #[inline]
fn slice(&self, start: uint, end: uint) -> &'self [T] { fn slice(&self, start: uint, end: uint) -> &'a [T] {
assert!(start <= end); assert!(start <= end);
assert!(end <= self.len()); assert!(end <= self.len());
self.as_imm_buf(|p, _len| { self.as_imm_buf(|p, _len| {
@ -1031,17 +1031,17 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
} }
#[inline] #[inline]
fn slice_from(&self, start: uint) -> &'self [T] { fn slice_from(&self, start: uint) -> &'a [T] {
self.slice(start, self.len()) self.slice(start, self.len())
} }
#[inline] #[inline]
fn slice_to(&self, end: uint) -> &'self [T] { fn slice_to(&self, end: uint) -> &'a [T] {
self.slice(0, end) self.slice(0, end)
} }
#[inline] #[inline]
fn iter(self) -> VecIterator<'self, T> { fn iter(self) -> VecIterator<'a, T> {
unsafe { unsafe {
let p = vec::raw::to_ptr(self); let p = vec::raw::to_ptr(self);
if mem::size_of::<T>() == 0 { if mem::size_of::<T>() == 0 {
@ -1057,17 +1057,17 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
} }
#[inline] #[inline]
fn rev_iter(self) -> RevIterator<'self, T> { fn rev_iter(self) -> RevIterator<'a, T> {
self.iter().invert() self.iter().invert()
} }
#[inline] #[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) self.splitn(uint::max_value, pred)
} }
#[inline] #[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 { SplitIterator {
v: self, v: self,
n: n, n: n,
@ -1077,12 +1077,12 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
} }
#[inline] #[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) self.rsplitn(uint::max_value, pred)
} }
#[inline] #[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 { RSplitIterator {
v: self, v: self,
n: n, n: n,
@ -1092,57 +1092,57 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
} }
#[inline] #[inline]
fn windows(self, size: uint) -> WindowIter<'self, T> { fn windows(self, size: uint) -> WindowIter<'a, T> {
assert!(size != 0); assert!(size != 0);
WindowIter { v: self, size: size } WindowIter { v: self, size: size }
} }
#[inline] #[inline]
fn chunks(self, size: uint) -> ChunkIter<'self, T> { fn chunks(self, size: uint) -> ChunkIter<'a, T> {
assert!(size != 0); assert!(size != 0);
ChunkIter { v: self, size: size } ChunkIter { v: self, size: size }
} }
#[inline] #[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 } if index < self.len() { Some(&self[index]) } else { None }
} }
#[inline] #[inline]
fn head(&self) -> &'self T { fn head(&self) -> &'a T {
if self.len() == 0 { fail!("head: empty vector") } if self.len() == 0 { fail!("head: empty vector") }
&self[0] &self[0]
} }
#[inline] #[inline]
fn head_opt(&self) -> Option<&'self T> { fn head_opt(&self) -> Option<&'a T> {
if self.len() == 0 { None } else { Some(&self[0]) } if self.len() == 0 { None } else { Some(&self[0]) }
} }
#[inline] #[inline]
fn tail(&self) -> &'self [T] { self.slice(1, self.len()) } fn tail(&self) -> &'a [T] { self.slice(1, self.len()) }
#[inline] #[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] #[inline]
fn init(&self) -> &'self [T] { fn init(&self) -> &'a [T] {
self.slice(0, self.len() - 1) self.slice(0, self.len() - 1)
} }
#[inline] #[inline]
fn initn(&self, n: uint) -> &'self [T] { fn initn(&self, n: uint) -> &'a [T] {
self.slice(0, self.len() - n) self.slice(0, self.len() - n)
} }
#[inline] #[inline]
fn last(&self) -> &'self T { fn last(&self) -> &'a T {
if self.len() == 0 { fail!("last: empty vector") } if self.len() == 0 { fail!("last: empty vector") }
&self[self.len() - 1] &self[self.len() - 1]
} }
#[inline] #[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]) } 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) f(s.data, s.len)
} }
fn shift_ref(&mut self) -> &'self T { fn shift_ref(&mut self) -> &'a T {
unsafe { unsafe {
let s: &mut Slice<T> = cast::transmute(self); let s: &mut Slice<T> = cast::transmute(self);
&*raw::shift_ptr(s) &*raw::shift_ptr(s)
} }
} }
fn pop_ref(&mut self) -> &'self T { fn pop_ref(&mut self) -> &'a T {
unsafe { unsafe {
let s: &mut Slice<T> = cast::transmute(self); let s: &mut Slice<T> = cast::transmute(self);
&*raw::pop_ptr(s) &*raw::pop_ptr(s)
@ -1218,7 +1218,7 @@ pub trait ImmutableEqVector<T:Eq> {
fn ends_with(&self, needle: &[T]) -> bool; fn ends_with(&self, needle: &[T]) -> bool;
} }
impl<'self,T:Eq> ImmutableEqVector<T> for &'self [T] { impl<'a,T:Eq> ImmutableEqVector<T> for &'a [T] {
#[inline] #[inline]
fn position_elem(&self, x: &T) -> Option<uint> { fn position_elem(&self, x: &T) -> Option<uint> {
self.iter().position(|y| *x == *y) self.iter().position(|y| *x == *y)
@ -1257,7 +1257,7 @@ pub trait ImmutableTotalOrdVector<T: TotalOrd> {
fn bsearch_elem(&self, x: &T) -> Option<uint>; fn bsearch_elem(&self, x: &T) -> Option<uint>;
} }
impl<'self, T: TotalOrd> ImmutableTotalOrdVector<T> for &'self [T] { impl<'a, T: TotalOrd> ImmutableTotalOrdVector<T> for &'a [T] {
fn bsearch_elem(&self, x: &T) -> Option<uint> { fn bsearch_elem(&self, x: &T) -> Option<uint> {
self.bsearch(|p| p.cmp(x)) self.bsearch(|p| p.cmp(x))
} }
@ -1278,7 +1278,7 @@ pub trait ImmutableCopyableVector<T> {
fn permutations(self) -> Permutations<T>; fn permutations(self) -> Permutations<T>;
} }
impl<'self,T:Clone> ImmutableCopyableVector<T> for &'self [T] { impl<'a,T:Clone> ImmutableCopyableVector<T> for &'a [T] {
#[inline] #[inline]
fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]) { fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]) {
let mut lefts = ~[]; let mut lefts = ~[];
@ -1913,34 +1913,34 @@ impl<T:Eq> OwnedEqVector<T> for ~[T] {
/// Extension methods for vectors such that their elements are /// Extension methods for vectors such that their elements are
/// mutable. /// mutable.
pub trait MutableVector<'self, T> { pub trait MutableVector<'a, T> {
/// Return a slice that points into another slice. /// 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. * Returns a slice of self from `start` to the end of the vec.
* *
* Fails when `start` points outside the bounds of self. * 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`. * Returns a slice of self from the start of the vec to `end`.
* *
* Fails when `end` points outside the bounds of self. * 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 /// 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 /// 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 /// Returns an iterator over the mutable subslices of the vector
/// which are separated by elements that match `pred`. The /// which are separated by elements that match `pred`. The
/// matched element is not contained in the subslices. /// 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. * 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. * 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 * 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. * 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 * 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. * 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 * Swaps two elements in a vector
@ -2004,8 +2004,8 @@ pub trait MutableVector<'self, T> {
* itself) and the second will contain all indices from * itself) and the second will contain all indices from
* `mid..len` (excluding the index `len` itself). * `mid..len` (excluding the index `len` itself).
*/ */
fn mut_split_at(self, mid: uint) -> (&'self mut [T], fn mut_split_at(self, mid: uint) -> (&'a mut [T],
&'self mut [T]); &'a mut [T]);
/// Reverse the order of elements in a vector, in place /// Reverse the order of elements in a vector, in place
fn reverse(self); fn reverse(self);
@ -2034,9 +2034,9 @@ pub trait MutableVector<'self, T> {
fn as_mut_buf<U>(self, f: |*mut T, uint| -> U) -> U; fn as_mut_buf<U>(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] #[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!(start <= end);
assert!(end <= self.len()); assert!(end <= self.len());
self.as_mut_buf(|p, _len| { self.as_mut_buf(|p, _len| {
@ -2050,27 +2050,27 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] {
} }
#[inline] #[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(); let len = self.len();
self.mut_slice(start, len) self.mut_slice(start, len)
} }
#[inline] #[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) self.mut_slice(0, end)
} }
#[inline] #[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 { unsafe {
let len = self.len(); 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)) (self.mut_slice(0, mid), self2.mut_slice(mid, len))
} }
} }
#[inline] #[inline]
fn mut_iter(self) -> VecMutIterator<'self, T> { fn mut_iter(self) -> VecMutIterator<'a, T> {
unsafe { unsafe {
let p = vec::raw::to_mut_ptr(self); let p = vec::raw::to_mut_ptr(self);
if mem::size_of::<T>() == 0 { if mem::size_of::<T>() == 0 {
@ -2086,30 +2086,30 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] {
} }
#[inline] #[inline]
fn mut_rev_iter(self) -> MutRevIterator<'self, T> { fn mut_rev_iter(self) -> MutRevIterator<'a, T> {
self.mut_iter().invert() self.mut_iter().invert()
} }
#[inline] #[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 } MutSplitIterator { v: self, pred: pred, finished: false }
} }
#[inline] #[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); assert!(chunk_size > 0);
let len = self.len(); let len = self.len();
MutChunkIter { v: self, chunk_size: chunk_size, remaining: 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 { unsafe {
let s: &mut Slice<T> = cast::transmute(self); let s: &mut Slice<T> = cast::transmute(self);
cast::transmute_mut(&*raw::shift_ptr(s)) 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 { unsafe {
let s: &mut Slice<T> = cast::transmute(self); let s: &mut Slice<T> = cast::transmute(self);
cast::transmute_mut(&*raw::pop_ptr(s)) cast::transmute_mut(&*raw::pop_ptr(s))
@ -2167,7 +2167,7 @@ pub trait MutableCloneableVector<T> {
fn copy_from(self, &[T]) -> uint; fn copy_from(self, &[T]) -> uint;
} }
impl<'self, T:Clone> MutableCloneableVector<T> for &'self mut [T] { impl<'a, T:Clone> MutableCloneableVector<T> for &'a mut [T] {
#[inline] #[inline]
fn copy_from(self, src: &[T]) -> uint { fn copy_from(self, src: &[T]) -> uint {
for (a, b) in self.mut_iter().zip(src.iter()) { for (a, b) in self.mut_iter().zip(src.iter()) {
@ -2368,7 +2368,7 @@ pub mod bytes {
fn set_memory(self, value: u8); fn set_memory(self, value: u8);
} }
impl<'self> MutableByteVector for &'self mut [u8] { impl<'a> MutableByteVector for &'a mut [u8] {
#[inline] #[inline]
fn set_memory(self, value: u8) { fn set_memory(self, value: u8) {
self.as_mut_buf(|p, len| { self.as_mut_buf(|p, len| {
@ -2483,8 +2483,8 @@ impl<A: DeepClone> DeepClone for ~[A] {
} }
// This works because every lifetime is a sub-lifetime of 'static // This works because every lifetime is a sub-lifetime of 'static
impl<'self, A> Default for &'self [A] { impl<'a, A> Default for &'a [A] {
fn default() -> &'self [A] { &'self [] } fn default() -> &'a [A] { &'a [] }
} }
impl<A> Default for ~[A] { impl<A> Default for ~[A] {
@ -2498,13 +2498,13 @@ impl<A> Default for @[A] {
macro_rules! iterator { macro_rules! iterator {
(struct $name:ident -> $ptr:ty, $elem:ty) => { (struct $name:ident -> $ptr:ty, $elem:ty) => {
/// An iterator for iterating over a vector. /// An iterator for iterating over a vector.
pub struct $name<'self, T> { pub struct $name<'a, T> {
priv ptr: $ptr, priv ptr: $ptr,
priv end: $ptr, priv end: $ptr,
priv lifetime: Option<$elem> // FIXME: #5922 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] #[inline]
fn next(&mut self) -> Option<$elem> { fn next(&mut self) -> Option<$elem> {
// could be implemented with slices, but this avoids bounds checks // 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] #[inline]
fn next_back(&mut self) -> Option<$elem> { fn next_back(&mut self) -> Option<$elem> {
// could be implemented with slices, but this avoids bounds checks // 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] #[inline]
fn indexable(&self) -> uint { fn indexable(&self) -> uint {
let (exact, _) = self.size_hint(); let (exact, _) = self.size_hint();
@ -2565,7 +2565,7 @@ impl<'self, T> RandomAccessIterator<&'self T> for VecIterator<'self, T> {
} }
#[inline] #[inline]
fn idx(&self, index: uint) -> Option<&'self T> { fn idx(&self, index: uint) -> Option<&'a T> {
unsafe { unsafe {
if index < self.indexable() { if index < self.indexable() {
cast::transmute(self.ptr.offset(index as int)) 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} iterator!{struct VecIterator -> *T, &'a T}
pub type RevIterator<'self, T> = Invert<VecIterator<'self, T>>; pub type RevIterator<'a, T> = Invert<VecIterator<'a, T>>;
impl<'self, T> ExactSize<&'self T> for VecIterator<'self, T> {} impl<'a, T> ExactSize<&'a T> for VecIterator<'a, T> {}
impl<'self, T> ExactSize<&'self mut T> for VecMutIterator<'self, T> {} impl<'a, T> ExactSize<&'a mut T> for VecMutIterator<'a, T> {}
impl<'self, T> Clone for VecIterator<'self, T> { impl<'a, T> Clone for VecIterator<'a, T> {
fn clone(&self) -> VecIterator<'self, T> { *self } fn clone(&self) -> VecIterator<'a, T> { *self }
} }
iterator!{struct VecMutIterator -> *mut T, &'self mut T} iterator!{struct VecMutIterator -> *mut T, &'a mut T}
pub type MutRevIterator<'self, T> = Invert<VecMutIterator<'self, T>>; pub type MutRevIterator<'a, T> = Invert<VecMutIterator<'a, T>>;
/// An iterator over the subslices of the vector which are separated /// An iterator over the subslices of the vector which are separated
/// by elements that match `pred`. /// by elements that match `pred`.
pub struct MutSplitIterator<'self, T> { pub struct MutSplitIterator<'a, T> {
priv v: &'self mut [T], priv v: &'a mut [T],
priv pred: 'self |t: &T| -> bool, priv pred: 'a |t: &T| -> bool,
priv finished: 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] #[inline]
fn next(&mut self) -> Option<&'self mut [T]> { fn next(&mut self) -> Option<&'a mut [T]> {
if self.finished { return None; } if self.finished { return None; }
match self.v.iter().position(|x| (self.pred)(x)) { 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] #[inline]
fn next_back(&mut self) -> Option<&'self mut [T]> { fn next_back(&mut self) -> Option<&'a mut [T]> {
if self.finished { return None; } if self.finished { return None; }
match self.v.iter().rposition(|x| (self.pred)(x)) { 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 /// 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 vector len is not evenly divided by the chunk size, the last slice of the iteration will be
/// the remainder. /// the remainder.
pub struct MutChunkIter<'self, T> { pub struct MutChunkIter<'a, T> {
priv v: &'self mut [T], priv v: &'a mut [T],
priv chunk_size: uint, priv chunk_size: uint,
priv remaining: 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] #[inline]
fn next(&mut self) -> Option<&'self mut [T]> { fn next(&mut self) -> Option<&'a mut [T]> {
if self.remaining == 0 { if self.remaining == 0 {
None None
} else { } 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] #[inline]
fn next_back(&mut self) -> Option<&'self mut [T]> { fn next_back(&mut self) -> Option<&'a mut [T]> {
if self.remaining == 0 { if self.remaining == 0 {
None None
} else { } else {

Some files were not shown because too many files have changed in this diff Show more