Skip to content

Commit 1b12dca

Browse files
committed
auto merge of #10897 : boredomist/rust/remove-self-lifetime, r=brson
Also remove all instances of 'self within the codebase. This fixes #10889. To make reviewing easier the following files were modified with more than a dumb text replacement: - `src/test/compile-fail/lifetime-no-keyword.rs` - `src/test/compile-fail/lifetime-obsoleted-self.rs` - `src/test/compile-fail/regions-free-region-ordering-incorrect.rs` - `src/libsyntax/parse/lexer.rs`
2 parents 47d10c7 + 5731ca3 commit 1b12dca

File tree

187 files changed

+1290
-1277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+1290
-1277
lines changed

doc/rust.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1239,9 +1239,9 @@ static BIT2: uint = 1 << 1;
12391239
static BITS: [uint, ..2] = [BIT1, BIT2];
12401240
static STRING: &'static str = "bitstring";
12411241
1242-
struct BitsNStrings<'self> {
1242+
struct BitsNStrings<'a> {
12431243
mybits: [uint, ..2],
1244-
mystring: &'self str
1244+
mystring: &'a str
12451245
}
12461246
12471247
static bits_n_strings: BitsNStrings<'static> = BitsNStrings {
@@ -2281,7 +2281,7 @@ The following are examples of structure expressions:
22812281
~~~~
22822282
# struct Point { x: f64, y: f64 }
22832283
# struct TuplePoint(f64, f64);
2284-
# mod game { pub struct User<'self> { name: &'self str, age: uint, score: uint } }
2284+
# mod game { pub struct User<'a> { name: &'a str, age: uint, score: uint } }
22852285
# struct Cookie; fn some_fn<T>(t: T) {}
22862286
Point {x: 10.0, y: 20.0};
22872287
TuplePoint(10.0, 20.0);
@@ -3055,7 +3055,7 @@ order specified by the tuple type.
30553055
An example of a tuple type and its use:
30563056

30573057
~~~~
3058-
type Pair<'self> = (int,&'self str);
3058+
type Pair<'a> = (int,&'a str);
30593059
let p: Pair<'static> = (10,"hello");
30603060
let (a, b) = p;
30613061
assert!(b != "world");
@@ -3220,7 +3220,7 @@ fn add(x: int, y: int) -> int {
32203220
32213221
let mut x = add(5,7);
32223222
3223-
type Binop<'self> = 'self |int,int| -> int;
3223+
type Binop<'a> = 'a |int,int| -> int;
32243224
let bo: Binop = add;
32253225
x = bo(5,7);
32263226
~~~~

src/libextra/arc.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ use std::task;
4949
use std::borrow;
5050

5151
/// As sync::condvar, a mechanism for unlock-and-descheduling and signaling.
52-
pub struct Condvar<'self> {
52+
pub struct Condvar<'a> {
5353
priv is_mutex: bool,
54-
priv failed: &'self mut bool,
55-
priv cond: &'self sync::Condvar<'self>
54+
priv failed: &'a mut bool,
55+
priv cond: &'a sync::Condvar<'a>
5656
}
5757

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

525525
/// The "write permission" token used for RWArc.write_downgrade().
526-
pub struct RWWriteMode<'self, T> {
527-
priv data: &'self mut T,
528-
priv token: sync::RWLockWriteMode<'self>,
526+
pub struct RWWriteMode<'a, T> {
527+
priv data: &'a mut T,
528+
priv token: sync::RWLockWriteMode<'a>,
529529
priv poison: PoisonOnFail,
530530
}
531531

532532
/// The "read permission" token used for RWArc.write_downgrade().
533-
pub struct RWReadMode<'self, T> {
534-
priv data: &'self T,
535-
priv token: sync::RWLockReadMode<'self>,
533+
pub struct RWReadMode<'a, T> {
534+
priv data: &'a T,
535+
priv token: sync::RWLockReadMode<'a>,
536536
}
537537

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

577-
impl<'self, T:Freeze + Send> RWReadMode<'self, T> {
577+
impl<'a, T:Freeze + Send> RWReadMode<'a, T> {
578578
/// Access the post-downgrade rwlock in read mode.
579579
pub fn read<U>(&self, blk: |x: &T| -> U) -> U {
580580
match *self {

src/libextra/base64.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub trait ToBase64 {
5656
fn to_base64(&self, config: Config) -> ~str;
5757
}
5858

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

160-
impl<'self> FromBase64 for &'self str {
160+
impl<'a> FromBase64 for &'a str {
161161
/**
162162
* Convert any base64 encoded string (literal, `@`, `&`, or `~`)
163163
* to the byte values it encodes.

src/libextra/bitv.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,13 @@ fn iterate_bits(base: uint, bits: uint, f: |uint| -> bool) -> bool {
578578
}
579579

580580
/// An iterator for `Bitv`.
581-
pub struct BitvIterator<'self> {
582-
priv bitv: &'self Bitv,
581+
pub struct BitvIterator<'a> {
582+
priv bitv: &'a Bitv,
583583
priv next_idx: uint,
584584
priv end_idx: uint,
585585
}
586586

587-
impl<'self> Iterator<bool> for BitvIterator<'self> {
587+
impl<'a> Iterator<bool> for BitvIterator<'a> {
588588
#[inline]
589589
fn next(&mut self) -> Option<bool> {
590590
if self.next_idx != self.end_idx {
@@ -602,7 +602,7 @@ impl<'self> Iterator<bool> for BitvIterator<'self> {
602602
}
603603
}
604604

605-
impl<'self> DoubleEndedIterator<bool> for BitvIterator<'self> {
605+
impl<'a> DoubleEndedIterator<bool> for BitvIterator<'a> {
606606
#[inline]
607607
fn next_back(&mut self) -> Option<bool> {
608608
if self.next_idx != self.end_idx {
@@ -614,9 +614,9 @@ impl<'self> DoubleEndedIterator<bool> for BitvIterator<'self> {
614614
}
615615
}
616616

617-
impl<'self> ExactSize<bool> for BitvIterator<'self> {}
617+
impl<'a> ExactSize<bool> for BitvIterator<'a> {}
618618

619-
impl<'self> RandomAccessIterator<bool> for BitvIterator<'self> {
619+
impl<'a> RandomAccessIterator<bool> for BitvIterator<'a> {
620620
#[inline]
621621
fn indexable(&self) -> uint {
622622
self.end_idx - self.next_idx
@@ -903,12 +903,12 @@ impl BitvSet {
903903
}
904904
}
905905

906-
pub struct BitvSetIterator<'self> {
907-
priv set: &'self BitvSet,
906+
pub struct BitvSetIterator<'a> {
907+
priv set: &'a BitvSet,
908908
priv next_idx: uint
909909
}
910910

911-
impl<'self> Iterator<uint> for BitvSetIterator<'self> {
911+
impl<'a> Iterator<uint> for BitvSetIterator<'a> {
912912
#[inline]
913913
fn next(&mut self) -> Option<uint> {
914914
while self.next_idx < self.set.capacity() {

src/libextra/dlist.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ struct Node<T> {
4848

4949
/// Double-ended DList iterator
5050
#[deriving(Clone)]
51-
pub struct DListIterator<'self, T> {
52-
priv head: &'self Link<T>,
51+
pub struct DListIterator<'a, T> {
52+
priv head: &'a Link<T>,
5353
priv tail: Rawlink<Node<T>>,
5454
priv nelem: uint,
5555
}
5656

5757
/// Double-ended mutable DList iterator
58-
pub struct MutDListIterator<'self, T> {
59-
priv list: &'self mut DList<T>,
58+
pub struct MutDListIterator<'a, T> {
59+
priv list: &'a mut DList<T>,
6060
priv head: Rawlink<Node<T>>,
6161
priv tail: Rawlink<Node<T>>,
6262
priv nelem: uint,
@@ -439,9 +439,9 @@ impl<T> Drop for DList<T> {
439439
}
440440

441441

442-
impl<'self, A> Iterator<&'self A> for DListIterator<'self, A> {
442+
impl<'a, A> Iterator<&'a A> for DListIterator<'a, A> {
443443
#[inline]
444-
fn next(&mut self) -> Option<&'self A> {
444+
fn next(&mut self) -> Option<&'a A> {
445445
if self.nelem == 0 {
446446
return None;
447447
}
@@ -458,9 +458,9 @@ impl<'self, A> Iterator<&'self A> for DListIterator<'self, A> {
458458
}
459459
}
460460

461-
impl<'self, A> DoubleEndedIterator<&'self A> for DListIterator<'self, A> {
461+
impl<'a, A> DoubleEndedIterator<&'a A> for DListIterator<'a, A> {
462462
#[inline]
463-
fn next_back(&mut self) -> Option<&'self A> {
463+
fn next_back(&mut self) -> Option<&'a A> {
464464
if self.nelem == 0 {
465465
return None;
466466
}
@@ -473,11 +473,11 @@ impl<'self, A> DoubleEndedIterator<&'self A> for DListIterator<'self, A> {
473473
}
474474
}
475475

476-
impl<'self, A> ExactSize<&'self A> for DListIterator<'self, A> {}
476+
impl<'a, A> ExactSize<&'a A> for DListIterator<'a, A> {}
477477

478-
impl<'self, A> Iterator<&'self mut A> for MutDListIterator<'self, A> {
478+
impl<'a, A> Iterator<&'a mut A> for MutDListIterator<'a, A> {
479479
#[inline]
480-
fn next(&mut self) -> Option<&'self mut A> {
480+
fn next(&mut self) -> Option<&'a mut A> {
481481
if self.nelem == 0 {
482482
return None;
483483
}
@@ -497,9 +497,9 @@ impl<'self, A> Iterator<&'self mut A> for MutDListIterator<'self, A> {
497497
}
498498
}
499499

500-
impl<'self, A> DoubleEndedIterator<&'self mut A> for MutDListIterator<'self, A> {
500+
impl<'a, A> DoubleEndedIterator<&'a mut A> for MutDListIterator<'a, A> {
501501
#[inline]
502-
fn next_back(&mut self) -> Option<&'self mut A> {
502+
fn next_back(&mut self) -> Option<&'a mut A> {
503503
if self.nelem == 0 {
504504
return None;
505505
}
@@ -511,7 +511,7 @@ impl<'self, A> DoubleEndedIterator<&'self mut A> for MutDListIterator<'self, A>
511511
}
512512
}
513513

514-
impl<'self, A> ExactSize<&'self mut A> for MutDListIterator<'self, A> {}
514+
impl<'a, A> ExactSize<&'a mut A> for MutDListIterator<'a, A> {}
515515

516516
/// Allow mutating the DList while iterating
517517
pub trait ListInsertion<A> {
@@ -525,7 +525,7 @@ pub trait ListInsertion<A> {
525525
}
526526

527527
// private methods for MutDListIterator
528-
impl<'self, A> MutDListIterator<'self, A> {
528+
impl<'a, A> MutDListIterator<'a, A> {
529529
fn insert_next_node(&mut self, mut ins_node: ~Node<A>) {
530530
// Insert before `self.head` so that it is between the
531531
// previously yielded element and self.head.
@@ -547,7 +547,7 @@ impl<'self, A> MutDListIterator<'self, A> {
547547
}
548548
}
549549

550-
impl<'self, A> ListInsertion<A> for MutDListIterator<'self, A> {
550+
impl<'a, A> ListInsertion<A> for MutDListIterator<'a, A> {
551551
#[inline]
552552
fn insert_next(&mut self, elt: A) {
553553
self.insert_next_node(~Node::new(elt))

src/libextra/hex.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub trait ToHex {
2121

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

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

60-
impl<'self> FromHex for &'self str {
60+
impl<'a> FromHex for &'a str {
6161
/**
6262
* Convert any hexadecimal encoded string (literal, `@`, `&`, or `~`)
6363
* to the byte values it encodes.

0 commit comments

Comments
 (0)