Skip to content

Make 'self lifetime illegal. #10897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -1239,9 +1239,9 @@ static BIT2: uint = 1 << 1;
static BITS: [uint, ..2] = [BIT1, BIT2];
static STRING: &'static str = "bitstring";

struct BitsNStrings<'self> {
struct BitsNStrings<'a> {
mybits: [uint, ..2],
mystring: &'self str
mystring: &'a str
}

static bits_n_strings: BitsNStrings<'static> = BitsNStrings {
Expand Down Expand Up @@ -2281,7 +2281,7 @@ The following are examples of structure expressions:
~~~~
# struct Point { x: f64, y: f64 }
# struct TuplePoint(f64, f64);
# mod game { pub struct User<'self> { name: &'self str, age: uint, score: uint } }
# mod game { pub struct User<'a> { name: &'a str, age: uint, score: uint } }
# struct Cookie; fn some_fn<T>(t: T) {}
Point {x: 10.0, y: 20.0};
TuplePoint(10.0, 20.0);
Expand Down Expand Up @@ -3055,7 +3055,7 @@ order specified by the tuple type.
An example of a tuple type and its use:

~~~~
type Pair<'self> = (int,&'self str);
type Pair<'a> = (int,&'a str);
let p: Pair<'static> = (10,"hello");
let (a, b) = p;
assert!(b != "world");
Expand Down Expand Up @@ -3220,7 +3220,7 @@ fn add(x: int, y: int) -> int {

let mut x = add(5,7);

type Binop<'self> = 'self |int,int| -> int;
type Binop<'a> = 'a |int,int| -> int;
let bo: Binop = add;
x = bo(5,7);
~~~~
Expand Down
24 changes: 12 additions & 12 deletions src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ use std::task;
use std::borrow;

/// As sync::condvar, a mechanism for unlock-and-descheduling and signaling.
pub struct Condvar<'self> {
pub struct Condvar<'a> {
priv is_mutex: bool,
priv failed: &'self mut bool,
priv cond: &'self sync::Condvar<'self>
priv failed: &'a mut bool,
priv cond: &'a sync::Condvar<'a>
}

impl<'self> Condvar<'self> {
impl<'a> Condvar<'a> {
/// Atomically exit the associated Arc and block until a signal is sent.
#[inline]
pub fn wait(&self) { self.wait_on(0) }
Expand Down Expand Up @@ -523,19 +523,19 @@ fn borrow_rwlock<T:Freeze + Send>(state: *mut RWArcInner<T>) -> *RWLock {
}

/// The "write permission" token used for RWArc.write_downgrade().
pub struct RWWriteMode<'self, T> {
priv data: &'self mut T,
priv token: sync::RWLockWriteMode<'self>,
pub struct RWWriteMode<'a, T> {
priv data: &'a mut T,
priv token: sync::RWLockWriteMode<'a>,
priv poison: PoisonOnFail,
}

/// The "read permission" token used for RWArc.write_downgrade().
pub struct RWReadMode<'self, T> {
priv data: &'self T,
priv token: sync::RWLockReadMode<'self>,
pub struct RWReadMode<'a, T> {
priv data: &'a T,
priv token: sync::RWLockReadMode<'a>,
}

impl<'self, T:Freeze + Send> RWWriteMode<'self, T> {
impl<'a, T:Freeze + Send> RWWriteMode<'a, T> {
/// Access the pre-downgrade RWArc in write mode.
pub fn write<U>(&mut self, blk: |x: &mut T| -> U) -> U {
match *self {
Expand Down Expand Up @@ -574,7 +574,7 @@ impl<'self, T:Freeze + Send> RWWriteMode<'self, T> {
}
}

impl<'self, T:Freeze + Send> RWReadMode<'self, T> {
impl<'a, T:Freeze + Send> RWReadMode<'a, T> {
/// Access the post-downgrade rwlock in read mode.
pub fn read<U>(&self, blk: |x: &T| -> U) -> U {
match *self {
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub trait ToBase64 {
fn to_base64(&self, config: Config) -> ~str;
}

impl<'self> ToBase64 for &'self [u8] {
impl<'a> ToBase64 for &'a [u8] {
/**
* Turn a vector of `u8` bytes into a base64 string.
*
Expand Down Expand Up @@ -157,7 +157,7 @@ pub trait FromBase64 {
fn from_base64(&self) -> Result<~[u8], ~str>;
}

impl<'self> FromBase64 for &'self str {
impl<'a> FromBase64 for &'a str {
/**
* Convert any base64 encoded string (literal, `@`, `&`, or `~`)
* to the byte values it encodes.
Expand Down
18 changes: 9 additions & 9 deletions src/libextra/bitv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,13 +578,13 @@ fn iterate_bits(base: uint, bits: uint, f: |uint| -> bool) -> bool {
}

/// An iterator for `Bitv`.
pub struct BitvIterator<'self> {
priv bitv: &'self Bitv,
pub struct BitvIterator<'a> {
priv bitv: &'a Bitv,
priv next_idx: uint,
priv end_idx: uint,
}

impl<'self> Iterator<bool> for BitvIterator<'self> {
impl<'a> Iterator<bool> for BitvIterator<'a> {
#[inline]
fn next(&mut self) -> Option<bool> {
if self.next_idx != self.end_idx {
Expand All @@ -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]
fn next_back(&mut self) -> Option<bool> {
if self.next_idx != self.end_idx {
Expand All @@ -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]
fn indexable(&self) -> uint {
self.end_idx - self.next_idx
Expand Down Expand Up @@ -903,12 +903,12 @@ impl BitvSet {
}
}

pub struct BitvSetIterator<'self> {
priv set: &'self BitvSet,
pub struct BitvSetIterator<'a> {
priv set: &'a BitvSet,
priv next_idx: uint
}

impl<'self> Iterator<uint> for BitvSetIterator<'self> {
impl<'a> Iterator<uint> for BitvSetIterator<'a> {
#[inline]
fn next(&mut self) -> Option<uint> {
while self.next_idx < self.set.capacity() {
Expand Down
32 changes: 16 additions & 16 deletions src/libextra/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ struct Node<T> {

/// Double-ended DList iterator
#[deriving(Clone)]
pub struct DListIterator<'self, T> {
priv head: &'self Link<T>,
pub struct DListIterator<'a, T> {
priv head: &'a Link<T>,
priv tail: Rawlink<Node<T>>,
priv nelem: uint,
}

/// Double-ended mutable DList iterator
pub struct MutDListIterator<'self, T> {
priv list: &'self mut DList<T>,
pub struct MutDListIterator<'a, T> {
priv list: &'a mut DList<T>,
priv head: Rawlink<Node<T>>,
priv tail: Rawlink<Node<T>>,
priv nelem: uint,
Expand Down Expand Up @@ -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]
fn next(&mut self) -> Option<&'self A> {
fn next(&mut self) -> Option<&'a A> {
if self.nelem == 0 {
return None;
}
Expand All @@ -458,9 +458,9 @@ impl<'self, A> Iterator<&'self A> for DListIterator<'self, A> {
}
}

impl<'self, A> DoubleEndedIterator<&'self A> for DListIterator<'self, A> {
impl<'a, A> DoubleEndedIterator<&'a A> for DListIterator<'a, A> {
#[inline]
fn next_back(&mut self) -> Option<&'self A> {
fn next_back(&mut self) -> Option<&'a A> {
if self.nelem == 0 {
return None;
}
Expand All @@ -473,11 +473,11 @@ impl<'self, A> DoubleEndedIterator<&'self A> for DListIterator<'self, A> {
}
}

impl<'self, A> ExactSize<&'self A> for DListIterator<'self, A> {}
impl<'a, A> ExactSize<&'a A> for DListIterator<'a, A> {}

impl<'self, A> Iterator<&'self mut A> for MutDListIterator<'self, A> {
impl<'a, A> Iterator<&'a mut A> for MutDListIterator<'a, A> {
#[inline]
fn next(&mut self) -> Option<&'self mut A> {
fn next(&mut self) -> Option<&'a mut A> {
if self.nelem == 0 {
return None;
}
Expand All @@ -497,9 +497,9 @@ impl<'self, A> Iterator<&'self mut A> for MutDListIterator<'self, A> {
}
}

impl<'self, A> DoubleEndedIterator<&'self mut A> for MutDListIterator<'self, A> {
impl<'a, A> DoubleEndedIterator<&'a mut A> for MutDListIterator<'a, A> {
#[inline]
fn next_back(&mut self) -> Option<&'self mut A> {
fn next_back(&mut self) -> Option<&'a mut A> {
if self.nelem == 0 {
return None;
}
Expand All @@ -511,7 +511,7 @@ impl<'self, A> DoubleEndedIterator<&'self mut A> for MutDListIterator<'self, A>
}
}

impl<'self, A> ExactSize<&'self mut A> for MutDListIterator<'self, A> {}
impl<'a, A> ExactSize<&'a mut A> for MutDListIterator<'a, A> {}

/// Allow mutating the DList while iterating
pub trait ListInsertion<A> {
Expand All @@ -525,7 +525,7 @@ pub trait ListInsertion<A> {
}

// 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>) {
// Insert before `self.head` so that it is between the
// previously yielded element and self.head.
Expand All @@ -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]
fn insert_next(&mut self, elt: A) {
self.insert_next_node(~Node::new(elt))
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub trait ToHex {

static CHARS: &'static[u8] = bytes!("0123456789abcdef");

impl<'self> ToHex for &'self [u8] {
impl<'a> ToHex for &'a [u8] {
/**
* Turn a vector of `u8` bytes into a hexadecimal string.
*
Expand Down Expand Up @@ -57,7 +57,7 @@ pub trait FromHex {
fn from_hex(&self) -> Result<~[u8], ~str>;
}

impl<'self> FromHex for &'self str {
impl<'a> FromHex for &'a str {
/**
* Convert any hexadecimal encoded string (literal, `@`, `&`, or `~`)
* to the byte values it encodes.
Expand Down
Loading