Skip to content

Commit 299995c

Browse files
committed
librustc: Convert all uses of old lifetime notation to new lifetime notation. rs=delifetiming
1 parent f54adca commit 299995c

File tree

147 files changed

+523
-501
lines changed

Some content is hidden

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

147 files changed

+523
-501
lines changed

src/libcore/at_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ pub mod traits {
174174
use kinds::Copy;
175175
use ops::Add;
176176

177-
impl<T:Copy> Add<&self/[const T],@[T]> for @[T] {
177+
impl<T:Copy> Add<&'self [const T],@[T]> for @[T] {
178178
#[inline(always)]
179-
pure fn add(&self, rhs: & &self/[const T]) -> @[T] {
179+
pure fn add(&self, rhs: & &'self [const T]) -> @[T] {
180180
append(*self, (*rhs))
181181
}
182182
}

src/libcore/cast.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ pub unsafe fn transmute<L, G>(thing: L) -> G {
5959

6060
/// Coerce an immutable reference to be mutable.
6161
#[inline(always)]
62-
pub unsafe fn transmute_mut<T>(ptr: &a/T) -> &a/mut T { transmute(ptr) }
62+
pub unsafe fn transmute_mut<T>(ptr: &'a T) -> &'a mut T { transmute(ptr) }
6363

6464
/// Coerce a mutable reference to be immutable.
6565
#[inline(always)]
66-
pub unsafe fn transmute_immut<T>(ptr: &a/mut T) -> &a/T {
66+
pub unsafe fn transmute_immut<T>(ptr: &'a mut T) -> &'a T {
6767
transmute(ptr)
6868
}
6969

7070
/// Coerce a borrowed pointer to have an arbitrary associated region.
7171
#[inline(always)]
72-
pub unsafe fn transmute_region<T>(ptr: &a/T) -> &b/T { transmute(ptr) }
72+
pub unsafe fn transmute_region<T>(ptr: &'a T) -> &'b T { transmute(ptr) }
7373

7474
/// Coerce an immutable reference to be mutable.
7575
#[inline(always)]
@@ -85,19 +85,19 @@ pub unsafe fn transmute_immut_unsafe<T>(ptr: *const T) -> *T {
8585

8686
/// Coerce a borrowed mutable pointer to have an arbitrary associated region.
8787
#[inline(always)]
88-
pub unsafe fn transmute_mut_region<T>(ptr: &a/mut T) -> &b/mut T {
88+
pub unsafe fn transmute_mut_region<T>(ptr: &'a mut T) -> &'b mut T {
8989
transmute(ptr)
9090
}
9191

9292
/// Transforms lifetime of the second pointer to match the first.
9393
#[inline(always)]
94-
pub unsafe fn copy_lifetime<S,T>(_ptr: &a/S, ptr: &T) -> &a/T {
94+
pub unsafe fn copy_lifetime<S,T>(_ptr: &'a S, ptr: &T) -> &'a T {
9595
transmute_region(ptr)
9696
}
9797

9898
/// Transforms lifetime of the second pointer to match the first.
9999
#[inline(always)]
100-
pub unsafe fn copy_lifetime_vec<S,T>(_ptr: &a/[S], ptr: &T) -> &a/T {
100+
pub unsafe fn copy_lifetime_vec<S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {
101101
transmute_region(ptr)
102102
}
103103

src/libcore/cleanup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ use cast::transmute;
2222
* NB: These must match the representation in the C++ runtime.
2323
*/
2424

25-
type DropGlue = &self/fn(**TypeDesc, *c_void);
26-
type FreeGlue = &self/fn(**TypeDesc, *c_void);
25+
type DropGlue = &'self fn(**TypeDesc, *c_void);
26+
type FreeGlue = &'self fn(**TypeDesc, *c_void);
2727

2828
type TaskID = uintptr_t;
2929

src/libcore/condition.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ pub struct Handler<T, U> {
2121
}
2222

2323
pub struct Condition<T, U> {
24-
name: &static/str,
24+
name: &'static str,
2525
key: task::local_data::LocalDataKey/&self<Handler<T, U>>
2626
}
2727

2828
pub impl<T, U> Condition/&self<T, U> {
29-
fn trap(&self, h: &self/fn(T) -> U) -> Trap/&self<T, U> {
29+
fn trap(&self, h: &'self fn(T) -> U) -> Trap/&self<T, U> {
3030
unsafe {
3131
let p : *RustClosure = ::cast::transmute(&h);
3232
let prev = task::local_data::local_data_get(self.key);
@@ -65,12 +65,12 @@ pub impl<T, U> Condition/&self<T, U> {
6565
}
6666

6767
struct Trap<T, U> {
68-
cond: &self/Condition/&self<T, U>,
68+
cond: &'self Condition/&self<T, U>,
6969
handler: @Handler<T, U>
7070
}
7171

7272
pub impl<T, U> Trap/&self<T, U> {
73-
fn in<V>(&self, inner: &self/fn() -> V) -> V {
73+
fn in<V>(&self, inner: &'self fn() -> V) -> V {
7474
unsafe {
7575
let _g = Guard { cond: self.cond };
7676
debug!("Trap: pushing handler to TLS");
@@ -81,7 +81,7 @@ pub impl<T, U> Trap/&self<T, U> {
8181
}
8282

8383
struct Guard<T, U> {
84-
cond: &self/Condition/&self<T, U>
84+
cond: &'self Condition/&self<T, U>
8585
}
8686

8787
impl<T, U> Drop for Guard/&self<T, U> {

src/libcore/container.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub trait Map<K, V>: Mutable {
3939
fn mutate_values(&mut self, f: &fn(&K, &mut V) -> bool);
4040

4141
/// Return the value corresponding to the key in the map
42-
pure fn find(&self, key: &K) -> Option<&self/V>;
42+
pure fn find(&self, key: &K) -> Option<&'self V>;
4343

4444
/// Insert a key-value pair into the map. An existing value for a
4545
/// key is replaced by the new value. Return true if the key did

src/libcore/gc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ unsafe fn is_safe_point(pc: *Word) -> Option<SafePoint> {
122122
return None;
123123
}
124124

125-
type Visitor = &self/fn(root: **Word, tydesc: *Word) -> bool;
125+
type Visitor = &'self fn(root: **Word, tydesc: *Word) -> bool;
126126

127127
// Walks the list of roots for the given safe point, and calls visitor
128128
// on each root.

src/libcore/hashmap.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub mod linear {
185185
}
186186

187187
#[inline(always)]
188-
pure fn value_for_bucket(&self, idx: uint) -> &self/V {
188+
pure fn value_for_bucket(&self, idx: uint) -> &'self V {
189189
match self.buckets[idx] {
190190
Some(ref bkt) => &bkt.value,
191191
None => fail!(~"LinearMap::find: internal logic error"),
@@ -270,10 +270,10 @@ pub mod linear {
270270
}
271271
272272
impl<K:Hash + IterBytes + Eq,V>
273-
BaseIter<(&self/K, &self/V)> for LinearMap<K, V>
273+
BaseIter<(&'self K, &'self V)> for LinearMap<K, V>
274274
{
275275
/// Visit all key-value pairs
276-
pure fn each(&self, blk: &fn(&(&self/K, &self/V)) -> bool) {
276+
pure fn each(&self, blk: &fn(&(&'self K, &'self V)) -> bool) {
277277
for uint::range(0, self.buckets.len()) |i| {
278278
let mut broke = false;
279279
do self.buckets[i].map |bucket| {
@@ -339,7 +339,7 @@ pub mod linear {
339339
}
340340
341341
/// Return the value corresponding to the key in the map
342-
pure fn find(&self, k: &K) -> Option<&self/V> {
342+
pure fn find(&self, k: &K) -> Option<&'self V> {
343343
match self.bucket_for_key(k) {
344344
FoundEntry(idx) => Some(self.value_for_bucket(idx)),
345345
TableFull | FoundHole(_) => None,
@@ -412,7 +412,7 @@ pub mod linear {
412412
413413
/// Return the value corresponding to the key in the map, or insert
414414
/// and return the value if it doesn't exist.
415-
fn find_or_insert(&mut self, k: K, v: V) -> &self/V {
415+
fn find_or_insert(&mut self, k: K, v: V) -> &'self V {
416416
if self.size >= self.resize_at {
417417
// n.b.: We could also do this after searching, so
418418
// that we do not resize if this call to insert is
@@ -442,7 +442,7 @@ pub mod linear {
442442
443443
/// Return the value corresponding to the key in the map, or create,
444444
/// insert, and return a new value if it doesn't exist.
445-
fn find_or_insert_with(&mut self, k: K, f: &fn(&K) -> V) -> &self/V {
445+
fn find_or_insert_with(&mut self, k: K, f: &fn(&K) -> V) -> &'self V {
446446
if self.size >= self.resize_at {
447447
// n.b.: We could also do this after searching, so
448448
// that we do not resize if this call to insert is
@@ -487,7 +487,7 @@ pub mod linear {
487487
}
488488
}
489489
490-
pure fn get(&self, k: &K) -> &self/V {
490+
pure fn get(&self, k: &K) -> &'self V {
491491
match self.find(k) {
492492
Some(v) => v,
493493
None => fail!(fmt!("No entry found for key: %?", k)),
@@ -509,7 +509,7 @@ pub mod linear {
509509
/// Return the value corresponding to the key in the map, using
510510
/// equivalence
511511
pure fn find_equiv<Q:Hash + IterBytes + Equiv<K>>(&self, k: &Q)
512-
-> Option<&self/V> {
512+
-> Option<&'self V> {
513513
match self.bucket_for_key_equiv(k) {
514514
FoundEntry(idx) => Some(self.value_for_bucket(idx)),
515515
TableFull | FoundHole(_) => None,

src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ pub fn file_reader(path: &Path) -> Result<@Reader, ~str> {
589589
590590
// Byte readers
591591
pub struct BytesReader {
592-
bytes: &self/[u8],
592+
bytes: &'self [u8],
593593
mut pos: uint
594594
}
595595

src/libcore/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use option::{None, Option, Some};
2020
use vec;
2121

2222
/// A function used to initialize the elements of a sequence
23-
pub type InitOp<T> = &self/fn(uint) -> T;
23+
pub type InitOp<T> = &'self fn(uint) -> T;
2424

2525
pub trait BaseIter<A> {
2626
pure fn each(&self, blk: &fn(v: &A) -> bool);

src/libcore/option.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub pure fn get<T:Copy>(opt: Option<T>) -> T {
122122
}
123123
124124
#[inline(always)]
125-
pub pure fn get_ref<T>(opt: &r/Option<T>) -> &r/T {
125+
pub pure fn get_ref<T>(opt: &'r Option<T>) -> &'r T {
126126
/*!
127127
Gets an immutable reference to the value inside an option.
128128
@@ -143,7 +143,7 @@ pub pure fn get_ref<T>(opt: &r/Option<T>) -> &r/T {
143143
}
144144
}
145145
146-
pub pure fn get_mut_ref<T>(opt: &r/mut Option<T>) -> &r/mut T {
146+
pub pure fn get_mut_ref<T>(opt: &'r mut Option<T>) -> &'r mut T {
147147
/*!
148148
Gets a mutable reference to the value inside an option.
149149
@@ -165,7 +165,7 @@ pub pure fn get_mut_ref<T>(opt: &r/mut Option<T>) -> &r/mut T {
165165
}
166166
167167
#[inline(always)]
168-
pub pure fn map<T, U>(opt: &r/Option<T>, f: &fn(x: &r/T) -> U) -> Option<U> {
168+
pub pure fn map<T, U>(opt: &'r Option<T>, f: &fn(x: &'r T) -> U) -> Option<U> {
169169
//! Maps a `some` value by reference from one type to another
170170
171171
match *opt { Some(ref x) => Some(f(x)), None => None }
@@ -256,8 +256,8 @@ pub pure fn get_or_default<T:Copy>(opt: Option<T>, def: T) -> T {
256256
}
257257
258258
#[inline(always)]
259-
pub pure fn map_default<T, U>(opt: &r/Option<T>, def: U,
260-
f: &fn(&r/T) -> U) -> U {
259+
pub pure fn map_default<T, U>(opt: &'r Option<T>, def: U,
260+
f: &fn(&'r T) -> U) -> U {
261261
//! Applies a function to the contained value or returns a default
262262
263263
match *opt { None => def, Some(ref t) => f(t) }
@@ -313,7 +313,7 @@ pub pure fn expect<T>(opt: Option<T>, reason: &str) -> T {
313313
impl<T> BaseIter<T> for Option<T> {
314314
/// Performs an operation on the contained value by reference
315315
#[inline(always)]
316-
pure fn each(&self, f: &fn(x: &self/T) -> bool) {
316+
pure fn each(&self, f: &fn(x: &'self T) -> bool) {
317317
match *self { None => (), Some(ref t) => { f(t); } }
318318
}
319319
@@ -350,7 +350,7 @@ pub impl<T> Option<T> {
350350
351351
/// Maps a `some` value from one type to another by reference
352352
#[inline(always)]
353-
pure fn map<U>(&self, f: &fn(&self/T) -> U) -> Option<U> { map(self, f) }
353+
pure fn map<U>(&self, f: &fn(&'self T) -> U) -> Option<U> { map(self, f) }
354354
355355
/// As `map`, but consumes the option and gives `f` ownership to avoid
356356
/// copying.
@@ -361,7 +361,7 @@ pub impl<T> Option<T> {
361361
362362
/// Applies a function to the contained value or returns a default
363363
#[inline(always)]
364-
pure fn map_default<U>(&self, def: U, f: &fn(&self/T) -> U) -> U {
364+
pure fn map_default<U>(&self, def: U, f: &fn(&'self T) -> U) -> U {
365365
map_default(self, def, f)
366366
}
367367
@@ -403,7 +403,7 @@ pub impl<T> Option<T> {
403403
case explicitly.
404404
*/
405405
#[inline(always)]
406-
pure fn get_ref(&self) -> &self/T { get_ref(self) }
406+
pure fn get_ref(&self) -> &'self T { get_ref(self) }
407407
408408
/**
409409
Gets a mutable reference to the value inside an option.
@@ -420,7 +420,7 @@ pub impl<T> Option<T> {
420420
case explicitly.
421421
*/
422422
#[inline(always)]
423-
pure fn get_mut_ref(&mut self) -> &self/mut T { get_mut_ref(self) }
423+
pure fn get_mut_ref(&mut self) -> &'self mut T { get_mut_ref(self) }
424424
425425
/**
426426
* Gets the value out of an option without copying.

src/libcore/os.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,11 +1170,11 @@ pub mod consts {
11701170
pub use os::consts::windows::*;
11711171
11721172
pub mod unix {
1173-
pub const FAMILY: &static/str = "unix";
1173+
pub const FAMILY: &'static str = "unix";
11741174
}
11751175
11761176
pub mod windows {
1177-
pub const FAMILY: &static/str = "windows";
1177+
pub const FAMILY: &'static str = "windows";
11781178
}
11791179
11801180
#[cfg(target_os = "macos")]
@@ -1193,38 +1193,38 @@ pub mod consts {
11931193
pub use os::consts::win32::*;
11941194
11951195
pub mod macos {
1196-
pub const SYSNAME: &static/str = "macos";
1197-
pub const DLL_PREFIX: &static/str = "lib";
1198-
pub const DLL_SUFFIX: &static/str = ".dylib";
1199-
pub const EXE_SUFFIX: &static/str = "";
1196+
pub const SYSNAME: &'static str = "macos";
1197+
pub const DLL_PREFIX: &'static str = "lib";
1198+
pub const DLL_SUFFIX: &'static str = ".dylib";
1199+
pub const EXE_SUFFIX: &'static str = "";
12001200
}
12011201
12021202
pub mod freebsd {
1203-
pub const SYSNAME: &static/str = "freebsd";
1204-
pub const DLL_PREFIX: &static/str = "lib";
1205-
pub const DLL_SUFFIX: &static/str = ".so";
1206-
pub const EXE_SUFFIX: &static/str = "";
1203+
pub const SYSNAME: &'static str = "freebsd";
1204+
pub const DLL_PREFIX: &'static str = "lib";
1205+
pub const DLL_SUFFIX: &'static str = ".so";
1206+
pub const EXE_SUFFIX: &'static str = "";
12071207
}
12081208
12091209
pub mod linux {
1210-
pub const SYSNAME: &static/str = "linux";
1211-
pub const DLL_PREFIX: &static/str = "lib";
1212-
pub const DLL_SUFFIX: &static/str = ".so";
1213-
pub const EXE_SUFFIX: &static/str = "";
1210+
pub const SYSNAME: &'static str = "linux";
1211+
pub const DLL_PREFIX: &'static str = "lib";
1212+
pub const DLL_SUFFIX: &'static str = ".so";
1213+
pub const EXE_SUFFIX: &'static str = "";
12141214
}
12151215
12161216
pub mod android {
1217-
pub const SYSNAME: &static/str = "android";
1218-
pub const DLL_PREFIX: &static/str = "lib";
1219-
pub const DLL_SUFFIX: &static/str = ".so";
1220-
pub const EXE_SUFFIX: &static/str = "";
1217+
pub const SYSNAME: &'static str = "android";
1218+
pub const DLL_PREFIX: &'static str = "lib";
1219+
pub const DLL_SUFFIX: &'static str = ".so";
1220+
pub const EXE_SUFFIX: &'static str = "";
12211221
}
12221222
12231223
pub mod win32 {
1224-
pub const SYSNAME: &static/str = "win32";
1225-
pub const DLL_PREFIX: &static/str = "";
1226-
pub const DLL_SUFFIX: &static/str = ".dll";
1227-
pub const EXE_SUFFIX: &static/str = ".exe";
1224+
pub const SYSNAME: &'static str = "win32";
1225+
pub const DLL_PREFIX: &'static str = "";
1226+
pub const DLL_SUFFIX: &'static str = ".dll";
1227+
pub const EXE_SUFFIX: &'static str = ".exe";
12281228
}
12291229
12301230

src/libcore/pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ pub fn try_recv<T:Owned,Tbuffer:Owned>(p: RecvPacketBuffered<T, Tbuffer>)
446446
let p = unsafe { &*p_ };
447447
448448
struct DropState {
449-
p: &self/PacketHeader,
449+
p: &'self PacketHeader,
450450
451451
drop {
452452
if task::failing() {

0 commit comments

Comments
 (0)