1
Fork 0

librustc: Add explicit lifetime binders and new lifetime notation in core/std/syntax/rustc

This commit is contained in:
Patrick Walton 2013-03-22 15:52:50 -07:00
parent 68cb53672b
commit 6d81307a9b
16 changed files with 135 additions and 116 deletions

View file

@ -22,11 +22,11 @@ pub struct Handler<T, U> {
pub struct Condition<T, U> { pub struct Condition<T, U> {
name: &'static str, name: &'static str,
key: task::local_data::LocalDataKey/&self<Handler<T, U>> key: task::local_data::LocalDataKey<'self, Handler<T, U>>
} }
pub impl<T, U> Condition/&self<T, U> { pub impl<T, U> Condition<'self, T, U> {
fn trap(&self, h: &'self fn(T) -> U) -> Trap/&self<T, U> { fn trap(&self, h: &'self fn(T) -> U) -> Trap<'self, T, U> {
unsafe { unsafe {
let p : *RustClosure = ::cast::transmute(&h); let p : *RustClosure = ::cast::transmute(&h);
let prev = task::local_data::local_data_get(self.key); let prev = task::local_data::local_data_get(self.key);
@ -65,11 +65,11 @@ pub impl<T, U> Condition/&self<T, U> {
} }
struct Trap<T, U> { struct Trap<T, U> {
cond: &'self Condition/&self<T, U>, cond: &'self Condition<'self, T, U>,
handler: @Handler<T, U> handler: @Handler<T, U>
} }
pub impl<T, U> Trap/&self<T, U> { pub impl<T, U> Trap<'self, T, U> {
fn in<V>(&self, inner: &'self fn() -> V) -> V { fn in<V>(&self, inner: &'self fn() -> V) -> V {
unsafe { unsafe {
let _g = Guard { cond: self.cond }; let _g = Guard { cond: self.cond };
@ -81,11 +81,11 @@ pub impl<T, U> Trap/&self<T, U> {
} }
struct Guard<T, U> { struct Guard<T, U> {
cond: &'self Condition/&self<T, U> cond: &'self Condition<'self, T, U>
} }
#[unsafe_destructor] #[unsafe_destructor]
impl<T, U> Drop for Guard/&self<T, U> { impl<T, U> Drop for Guard<'self, T, U> {
fn finalize(&self) { fn finalize(&self) {
unsafe { unsafe {
debug!("Guard: popping handler from TLS"); debug!("Guard: popping handler from TLS");

View file

@ -41,12 +41,12 @@ impl<T> Finally<T> for &'self fn() -> T {
} }
} }
struct Finallyalizer { struct Finallyalizer<'self> {
dtor: &'self fn() dtor: &'self fn()
} }
#[unsafe_destructor] #[unsafe_destructor]
impl Drop for Finallyalizer/&self { impl<'self> Drop for Finallyalizer<'self> {
fn finalize(&self) { fn finalize(&self) {
(self.dtor)(); (self.dtor)();
} }

View file

@ -79,7 +79,7 @@ struct PreserveCtxt {
root_managed_data: bool root_managed_data: bool
} }
pub impl PreserveCtxt/&self { pub impl<'self> PreserveCtxt<'self> {
fn tcx(&self) -> ty::ctxt { self.bccx.tcx } fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
fn preserve(&self, cmt: cmt) -> bckres<PreserveCondition> { fn preserve(&self, cmt: cmt) -> bckres<PreserveCondition> {

View file

@ -481,7 +481,7 @@ pub fn check_durable(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool {
} }
/// This is rather subtle. When we are casting a value to a /// This is rather subtle. When we are casting a value to a
/// instantiated trait like `a as trait/&r`, regionck already ensures /// instantiated trait like `a as trait<'r>`, regionck already ensures
/// that any borrowed pointers that appear in the type of `a` are /// that any borrowed pointers that appear in the type of `a` are
/// bounded by `&r`. However, it is possible that there are *type /// bounded by `&r`. However, it is possible that there are *type
/// parameters* in the type of `a`, and those *type parameters* may /// parameters* in the type of `a`, and those *type parameters* may

View file

@ -255,10 +255,10 @@ pub impl LanguageItems {
} }
} }
fn LanguageItemCollector(crate: @crate, fn LanguageItemCollector<'r>(crate: @crate,
session: Session, session: Session,
items: &'r mut LanguageItems) items: &'r mut LanguageItems)
-> LanguageItemCollector/&r { -> LanguageItemCollector<'r> {
let item_refs = HashMap(); let item_refs = HashMap();
item_refs.insert(@~"const", ConstTraitLangItem as uint); item_refs.insert(@~"const", ConstTraitLangItem as uint);
@ -320,7 +320,7 @@ struct LanguageItemCollector {
item_refs: HashMap<@~str, uint>, item_refs: HashMap<@~str, uint>,
} }
pub impl LanguageItemCollector/&self { pub impl<'self> LanguageItemCollector<'self> {
fn match_and_collect_meta_item(&self, item_def_id: def_id, fn match_and_collect_meta_item(&self, item_def_id: def_id,
meta_item: @meta_item) { meta_item: @meta_item) {
match meta_item.node { match meta_item.node {

View file

@ -331,9 +331,9 @@ pub struct ArmData {
bindings_map: BindingsMap bindings_map: BindingsMap
} }
pub struct Match { pub struct Match<'self> {
pats: ~[@ast::pat], pats: ~[@ast::pat],
data: @ArmData/&self data: @ArmData<'self>
} }
pub fn match_to_str(bcx: block, m: &Match) -> ~str { pub fn match_to_str(bcx: block, m: &Match) -> ~str {
@ -359,9 +359,11 @@ pub fn has_nested_bindings(m: &[@Match], col: uint) -> bool {
return false; return false;
} }
pub fn expand_nested_bindings(bcx: block, m: &[@Match/&r], pub fn expand_nested_bindings<'r>(bcx: block,
col: uint, val: ValueRef) m: &[@Match<'r>],
-> ~[@Match/&r] { col: uint,
val: ValueRef)
-> ~[@Match<'r>] {
debug!("expand_nested_bindings(bcx=%s, m=%s, col=%u, val=%?)", debug!("expand_nested_bindings(bcx=%s, m=%s, col=%u, val=%?)",
bcx.to_str(), bcx.to_str(),
matches_to_str(bcx, m), matches_to_str(bcx, m),
@ -402,9 +404,13 @@ pub fn assert_is_binding_or_wild(bcx: block, p: @ast::pat) {
} }
} }
pub fn enter_match(bcx: block, dm: DefMap, m: &[@Match/&r], pub fn enter_match<'r>(bcx: block,
col: uint, val: ValueRef, e: enter_pat) dm: DefMap,
-> ~[@Match/&r] { m: &[@Match<'r>],
col: uint,
val: ValueRef,
e: enter_pat)
-> ~[@Match<'r>] {
debug!("enter_match(bcx=%s, m=%s, col=%u, val=%?)", debug!("enter_match(bcx=%s, m=%s, col=%u, val=%?)",
bcx.to_str(), bcx.to_str(),
matches_to_str(bcx, m), matches_to_str(bcx, m),
@ -445,9 +451,12 @@ pub fn enter_match(bcx: block, dm: DefMap, m: &[@Match/&r],
return result; return result;
} }
pub fn enter_default(bcx: block, dm: DefMap, m: &[@Match/&r], pub fn enter_default<'r>(bcx: block,
col: uint, val: ValueRef) dm: DefMap,
-> ~[@Match/&r] { m: &[@Match<'r>],
col: uint,
val: ValueRef)
-> ~[@Match<'r>] {
debug!("enter_default(bcx=%s, m=%s, col=%u, val=%?)", debug!("enter_default(bcx=%s, m=%s, col=%u, val=%?)",
bcx.to_str(), bcx.to_str(),
matches_to_str(bcx, m), matches_to_str(bcx, m),
@ -488,9 +497,13 @@ pub fn enter_default(bcx: block, dm: DefMap, m: &[@Match/&r],
// <nmatsakis> so all patterns must either be records (resp. tuples) or // <nmatsakis> so all patterns must either be records (resp. tuples) or
// wildcards // wildcards
pub fn enter_opt(bcx: block, m: &[@Match/&r], opt: &Opt, col: uint, pub fn enter_opt<'r>(bcx: block,
variant_size: uint, val: ValueRef) m: &[@Match<'r>],
-> ~[@Match/&r] { opt: &Opt,
col: uint,
variant_size: uint,
val: ValueRef)
-> ~[@Match<'r>] {
debug!("enter_opt(bcx=%s, m=%s, col=%u, val=%?)", debug!("enter_opt(bcx=%s, m=%s, col=%u, val=%?)",
bcx.to_str(), bcx.to_str(),
matches_to_str(bcx, m), matches_to_str(bcx, m),
@ -599,11 +612,11 @@ pub fn enter_opt(bcx: block, m: &[@Match/&r], opt: &Opt, col: uint,
pub fn enter_rec_or_struct(bcx: block, pub fn enter_rec_or_struct(bcx: block,
dm: DefMap, dm: DefMap,
m: &[@Match/&r], m: &[@Match<'r>],
col: uint, col: uint,
fields: &[ast::ident], fields: &[ast::ident],
val: ValueRef) val: ValueRef)
-> ~[@Match/&r] { -> ~[@Match<'r>] {
debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%?)", debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%?)",
bcx.to_str(), bcx.to_str(),
matches_to_str(bcx, m), matches_to_str(bcx, m),
@ -632,9 +645,13 @@ pub fn enter_rec_or_struct(bcx: block,
} }
} }
pub fn enter_tup(bcx: block, dm: DefMap, m: &[@Match/&r], pub fn enter_tup<'r>(bcx: block,
col: uint, val: ValueRef, n_elts: uint) dm: DefMap,
-> ~[@Match/&r] { m: &[@Match<'r>],
col: uint,
val: ValueRef,
n_elts: uint)
-> ~[@Match<'r>] {
debug!("enter_tup(bcx=%s, m=%s, col=%u, val=%?)", debug!("enter_tup(bcx=%s, m=%s, col=%u, val=%?)",
bcx.to_str(), bcx.to_str(),
matches_to_str(bcx, m), matches_to_str(bcx, m),
@ -656,13 +673,13 @@ pub fn enter_tup(bcx: block, dm: DefMap, m: &[@Match/&r],
} }
} }
pub fn enter_tuple_struct(bcx: block, pub fn enter_tuple_struct<'r>(bcx: block,
dm: DefMap, dm: DefMap,
m: &[@Match/&r], m: &[@Match<'r>],
col: uint, col: uint,
val: ValueRef, val: ValueRef,
n_elts: uint) n_elts: uint)
-> ~[@Match/&r] { -> ~[@Match<'r>] {
debug!("enter_tuple_struct(bcx=%s, m=%s, col=%u, val=%?)", debug!("enter_tuple_struct(bcx=%s, m=%s, col=%u, val=%?)",
bcx.to_str(), bcx.to_str(),
matches_to_str(bcx, m), matches_to_str(bcx, m),
@ -682,12 +699,12 @@ pub fn enter_tuple_struct(bcx: block,
} }
} }
pub fn enter_box(bcx: block, pub fn enter_box<'r>(bcx: block,
dm: DefMap, dm: DefMap,
m: &[@Match/&r], m: &[@Match<'r>],
col: uint, col: uint,
val: ValueRef) val: ValueRef)
-> ~[@Match/&r] { -> ~[@Match<'r>] {
debug!("enter_box(bcx=%s, m=%s, col=%u, val=%?)", debug!("enter_box(bcx=%s, m=%s, col=%u, val=%?)",
bcx.to_str(), bcx.to_str(),
matches_to_str(bcx, m), matches_to_str(bcx, m),
@ -709,12 +726,12 @@ pub fn enter_box(bcx: block,
} }
} }
pub fn enter_uniq(bcx: block, pub fn enter_uniq<'r>(bcx: block,
dm: DefMap, dm: DefMap,
m: &[@Match/&r], m: &[@Match<'r>],
col: uint, col: uint,
val: ValueRef) val: ValueRef)
-> ~[@Match/&r] { -> ~[@Match<'r>] {
debug!("enter_uniq(bcx=%s, m=%s, col=%u, val=%?)", debug!("enter_uniq(bcx=%s, m=%s, col=%u, val=%?)",
bcx.to_str(), bcx.to_str(),
matches_to_str(bcx, m), matches_to_str(bcx, m),
@ -736,12 +753,12 @@ pub fn enter_uniq(bcx: block,
} }
} }
pub fn enter_region(bcx: block, pub fn enter_region<'r>(bcx: block,
dm: DefMap, dm: DefMap,
m: &[@Match/&r], m: &[@Match<'r>],
col: uint, col: uint,
val: ValueRef) val: ValueRef)
-> ~[@Match/&r] { -> ~[@Match<'r>] {
debug!("enter_region(bcx=%s, m=%s, col=%u, val=%?)", debug!("enter_region(bcx=%s, m=%s, col=%u, val=%?)",
bcx.to_str(), bcx.to_str(),
matches_to_str(bcx, m), matches_to_str(bcx, m),

View file

@ -192,7 +192,7 @@ pub enum TransformTypeFlag {
TransformTypeForObject, TransformTypeForObject,
} }
pub impl LookupContext/&self { pub impl<'self> LookupContext<'self> {
fn do_lookup(&self, self_ty: ty::t) -> Option<method_map_entry> { fn do_lookup(&self, self_ty: ty::t) -> Option<method_map_entry> {
let mut self_ty = structurally_resolved_type(self.fcx, let mut self_ty = structurally_resolved_type(self.fcx,
self.self_expr.span, self.self_expr.span,

View file

@ -25,13 +25,13 @@ use core::ptr;
use core::task; use core::task;
/// As sync::condvar, a mechanism for unlock-and-descheduling and signalling. /// As sync::condvar, a mechanism for unlock-and-descheduling and signalling.
pub struct Condvar { pub struct Condvar<'self> {
is_mutex: bool, is_mutex: bool,
failed: &'self mut bool, failed: &'self mut bool,
cond: &'self sync::Condvar/&self cond: &'self sync::Condvar<'self>
} }
pub impl Condvar/&self { pub impl<'self> Condvar<'self> {
/// 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(always)] #[inline(always)]
fn wait(&self) { self.wait_on(0) } fn wait(&self) { self.wait_on(0) }
@ -375,7 +375,7 @@ pub impl<T:Const + Owned> RWARC<T> {
} }
/// To be called inside of the write_downgrade block. /// To be called inside of the write_downgrade block.
fn downgrade(&self, token: RWWriteMode/&a<T>) -> RWReadMode/&a<T> { fn downgrade(&self, token: RWWriteMode<'a, T>) -> RWReadMode<'a, T> {
// The rwlock should assert that the token belongs to us for us. // The rwlock should assert that the token belongs to us for us.
let state = unsafe { get_shared_immutable_state(&self.x) }; let state = unsafe { get_shared_immutable_state(&self.x) };
let RWWriteMode { let RWWriteMode {
@ -420,7 +420,7 @@ pub struct RWReadMode<'self, T> {
token: sync::RWlockReadMode<'self>, token: sync::RWlockReadMode<'self>,
} }
pub impl<T:Const + Owned> RWWriteMode/&self<T> { pub impl<T:Const + Owned> RWWriteMode<'self, T> {
/// Access the pre-downgrade RWARC in write mode. /// Access the pre-downgrade RWARC in write mode.
fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U { fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
match *self { match *self {
@ -458,7 +458,7 @@ pub impl<T:Const + Owned> RWWriteMode/&self<T> {
} }
} }
pub impl<T:Const + Owned> RWReadMode/&self<T> { pub impl<T:Const + Owned> RWReadMode<'self, T> {
/// Access the post-downgrade rwlock in read mode. /// Access the post-downgrade rwlock in read mode.
fn read<U>(&self, blk: &fn(x: &T) -> U) -> U { fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
match *self { match *self {

View file

@ -466,8 +466,8 @@ pub mod flatteners {
fn from_writer(w: @Writer) -> Self; fn from_writer(w: @Writer) -> Self;
} }
impl FromReader for json::Decoder/&self { impl FromReader for json::Decoder<'self> {
fn from_reader(r: @Reader) -> json::Decoder/&self { fn from_reader(r: @Reader) -> json::Decoder<'self> {
match json::from_reader(r) { match json::from_reader(r) {
Ok(json) => { Ok(json) => {
json::Decoder(json) json::Decoder(json)

View file

@ -749,7 +749,7 @@ pub fn Decoder(json: Json) -> Decoder {
Decoder { json: json, stack: ~[] } Decoder { json: json, stack: ~[] }
} }
priv impl Decoder/&self { priv impl Decoder<'self> {
fn peek(&self) -> &'self Json { fn peek(&self) -> &'self Json {
if vec::uniq_len(&const self.stack) == 0 { if vec::uniq_len(&const self.stack) == 0 {
self.stack.push(&self.json); self.stack.push(&self.json);
@ -765,7 +765,7 @@ priv impl Decoder/&self {
} }
} }
impl serialize::Decoder for Decoder/&self { impl serialize::Decoder for Decoder<'self> {
fn read_nil(&self) -> () { fn read_nil(&self) -> () {
debug!("read_nil"); debug!("read_nil");
match *self.pop() { match *self.pop() {

View file

@ -1191,7 +1191,7 @@ mod big_tests {
} }
#[unsafe_destructor] #[unsafe_destructor]
impl Drop for LVal/&self { impl<'self> Drop for LVal<'self> {
fn finalize(&self) { fn finalize(&self) {
let x = unsafe { task::local_data::local_data_get(self.key) }; let x = unsafe { task::local_data::local_data_get(self.key) };
match x { match x {
@ -1205,17 +1205,17 @@ mod big_tests {
} }
} }
impl Ord for LVal/&self { impl<'self> Ord for LVal<'self> {
fn lt(&self, other: &'a LVal/&self) -> bool { fn lt(&self, other: &'a LVal<'self>) -> bool {
(*self).val < other.val (*self).val < other.val
} }
fn le(&self, other: &'a LVal/&self) -> bool { fn le(&self, other: &'a LVal<'self>) -> bool {
(*self).val <= other.val (*self).val <= other.val
} }
fn gt(&self, other: &'a LVal/&self) -> bool { fn gt(&self, other: &'a LVal<'self>) -> bool {
(*self).val > other.val (*self).val > other.val
} }
fn ge(&self, other: &'a LVal/&self) -> bool { fn ge(&self, other: &'a LVal<'self>) -> bool {
(*self).val >= other.val (*self).val >= other.val
} }
} }

View file

@ -168,7 +168,7 @@ type SemAndSignalRelease = SemReleaseGeneric<'self, ~[Waitqueue]>;
struct SemReleaseGeneric<Q> { sem: &'self Sem<Q> } struct SemReleaseGeneric<Q> { sem: &'self Sem<Q> }
#[unsafe_destructor] #[unsafe_destructor]
impl<Q:Owned> Drop for SemReleaseGeneric/&self<Q> { impl<Q:Owned> Drop for SemReleaseGeneric<'self, Q> {
fn finalize(&self) { fn finalize(&self) {
unsafe { unsafe {
self.sem.release(); self.sem.release();
@ -176,26 +176,26 @@ impl<Q:Owned> Drop for SemReleaseGeneric/&self<Q> {
} }
} }
fn SemRelease(sem: &'r Sem<()>) -> SemRelease/&r { fn SemRelease(sem: &'r Sem<()>) -> SemRelease<'r> {
SemReleaseGeneric { SemReleaseGeneric {
sem: sem sem: sem
} }
} }
fn SemAndSignalRelease(sem: &'r Sem<~[Waitqueue]>) fn SemAndSignalRelease(sem: &'r Sem<~[Waitqueue]>)
-> SemAndSignalRelease/&r { -> SemAndSignalRelease<'r> {
SemReleaseGeneric { SemReleaseGeneric {
sem: sem sem: sem
} }
} }
/// A mechanism for atomic-unlock-and-deschedule blocking and signalling. /// A mechanism for atomic-unlock-and-deschedule blocking and signalling.
pub struct Condvar { priv sem: &'self Sem<~[Waitqueue]> } pub struct Condvar<'self> { priv sem: &'self Sem<~[Waitqueue]> }
#[unsafe_destructor] #[unsafe_destructor]
impl Drop for Condvar/&self { fn finalize(&self) {} } impl<'self> Drop for Condvar<'self> { fn finalize(&self) {} }
pub impl Condvar/&self { pub impl Condvar<'self> {
/** /**
* Atomically drop the associated lock, and block until a signal is sent. * Atomically drop the associated lock, and block until a signal is sent.
* *
@ -266,7 +266,7 @@ pub impl Condvar/&self {
} }
#[unsafe_destructor] #[unsafe_destructor]
impl Drop for SemAndSignalReacquire/&self { impl<'self> Drop for SemAndSignalReacquire<'self> {
fn finalize(&self) { fn finalize(&self) {
unsafe { unsafe {
// Needs to succeed, instead of itself dying. // Needs to succeed, instead of itself dying.
@ -278,7 +278,7 @@ pub impl Condvar/&self {
} }
fn SemAndSignalReacquire(sem: &'r Sem<~[Waitqueue]>) fn SemAndSignalReacquire(sem: &'r Sem<~[Waitqueue]>)
-> SemAndSignalReacquire/&r { -> SemAndSignalReacquire<'r> {
SemAndSignalReacquire { SemAndSignalReacquire {
sem: sem sem: sem
} }
@ -586,7 +586,9 @@ pub impl RWlock {
} }
/// To be called inside of the write_downgrade block. /// To be called inside of the write_downgrade block.
fn downgrade(&self, token: RWlockWriteMode/&a) -> RWlockReadMode/&a { fn downgrade<'a>(&self,
token: RWlockWriteMode<'a>)
-> RWlockReadMode<'a> {
if !ptr::ref_eq(self, token.lock) { if !ptr::ref_eq(self, token.lock) {
fail!(~"Can't downgrade() with a different rwlock's write_mode!"); fail!(~"Can't downgrade() with a different rwlock's write_mode!");
} }
@ -619,7 +621,7 @@ struct RWlockReleaseRead {
} }
#[unsafe_destructor] #[unsafe_destructor]
impl Drop for RWlockReleaseRead/&self { impl<'self> Drop for RWlockReleaseRead<'self> {
fn finalize(&self) { fn finalize(&self) {
unsafe { unsafe {
do task::unkillable { do task::unkillable {
@ -641,7 +643,7 @@ impl Drop for RWlockReleaseRead/&self {
} }
} }
fn RWlockReleaseRead(lock: &'r RWlock) -> RWlockReleaseRead/&r { fn RWlockReleaseRead<'r>(lock: &'r RWlock) -> RWlockReleaseRead<'r> {
RWlockReleaseRead { RWlockReleaseRead {
lock: lock lock: lock
} }
@ -655,7 +657,7 @@ struct RWlockReleaseDowngrade {
} }
#[unsafe_destructor] #[unsafe_destructor]
impl Drop for RWlockReleaseDowngrade/&self { impl<'self> Drop for RWlockReleaseDowngrade<'self> {
fn finalize(&self) { fn finalize(&self) {
unsafe { unsafe {
do task::unkillable { do task::unkillable {
@ -685,23 +687,24 @@ impl Drop for RWlockReleaseDowngrade/&self {
} }
} }
fn RWlockReleaseDowngrade(lock: &'r RWlock) -> RWlockReleaseDowngrade/&r { fn RWlockReleaseDowngrade<'r>(lock: &'r RWlock)
-> RWlockReleaseDowngrade<'r> {
RWlockReleaseDowngrade { RWlockReleaseDowngrade {
lock: lock lock: lock
} }
} }
/// The "write permission" token used for rwlock.write_downgrade(). /// The "write permission" token used for rwlock.write_downgrade().
pub struct RWlockWriteMode { priv lock: &'self RWlock } pub struct RWlockWriteMode<'self> { priv lock: &'self RWlock }
#[unsafe_destructor] #[unsafe_destructor]
impl Drop for RWlockWriteMode/&self { fn finalize(&self) {} } impl<'self> Drop for RWlockWriteMode<'self> { fn finalize(&self) {} }
/// The "read permission" token used for rwlock.write_downgrade(). /// The "read permission" token used for rwlock.write_downgrade().
pub struct RWlockReadMode { priv lock: &'self RWlock } pub struct RWlockReadMode { priv lock: &'self RWlock }
#[unsafe_destructor] #[unsafe_destructor]
impl Drop for RWlockReadMode/&self { fn finalize(&self) {} } impl<'self> Drop for RWlockReadMode<'self> { fn finalize(&self) {} }
pub impl RWlockWriteMode/&self { pub impl<'self> RWlockWriteMode<'self> {
/// Access the pre-downgrade rwlock in write mode. /// Access the pre-downgrade rwlock in write mode.
fn write<U>(&self, blk: &fn() -> U) -> U { blk() } fn write<U>(&self, blk: &fn() -> 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.
@ -710,7 +713,7 @@ pub impl RWlockWriteMode/&self {
} }
} }
pub impl RWlockReadMode/&self { pub impl<'self> RWlockReadMode<'self> {
/// Access the post-downgrade rwlock in read mode. /// Access the post-downgrade rwlock in read mode.
fn read<U>(&self, blk: &fn() -> U) -> U { blk() } fn read<U>(&self, blk: &fn() -> U) -> U { blk() }
} }

View file

@ -186,7 +186,7 @@ pub impl<K: TotalOrd, V> TreeMap<K, V> {
/// Get a lazy iterator over the key-value pairs in the map. /// Get a lazy iterator over the key-value pairs in the map.
/// Requires that it be frozen (immutable). /// Requires that it be frozen (immutable).
fn iter(&self) -> TreeMapIterator/&self<K, V> { fn iter(&self) -> TreeMapIterator<'self, K, V> {
TreeMapIterator{stack: ~[], node: &self.root} TreeMapIterator{stack: ~[], node: &self.root}
} }
} }
@ -200,8 +200,8 @@ pub struct TreeMapIterator<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`.
pub fn map_next<K, V>(iter: &mut TreeMapIterator/&r<K, V>) pub fn map_next<'r, K, V>(iter: &mut TreeMapIterator<'r, K, V>)
-> Option<(&'r K, &'r V)> { -> Option<(&'r K, &'r V)> {
while !iter.stack.is_empty() || iter.node.is_some() { while !iter.stack.is_empty() || iter.node.is_some() {
match *iter.node { match *iter.node {
Some(ref x) => { Some(ref x) => {
@ -219,8 +219,8 @@ pub fn map_next<K, V>(iter: &mut TreeMapIterator/&r<K, V>)
} }
/// Advance the iterator through the map /// Advance the iterator through the map
pub fn map_advance<K, V>(iter: &mut TreeMapIterator/&r<K, V>, pub fn map_advance<'r, K, V>(iter: &mut TreeMapIterator<'r, K, V>,
f: &fn((&'r K, &'r V)) -> bool) { f: &fn((&'r K, &'r V)) -> bool) {
loop { loop {
match map_next(iter) { match map_next(iter) {
Some(x) => { Some(x) => {
@ -490,27 +490,27 @@ pub impl <T: TotalOrd> TreeSet<T> {
/// Get a lazy iterator over the values in the set. /// Get a lazy iterator over the values in the set.
/// Requires that it be frozen (immutable). /// Requires that it be frozen (immutable).
#[inline(always)] #[inline(always)]
fn iter(&self) -> TreeSetIterator/&self<T> { fn iter(&self) -> TreeSetIterator<'self, T> {
TreeSetIterator{iter: self.map.iter()} TreeSetIterator{iter: self.map.iter()}
} }
} }
/// Lazy forward iterator over a set /// Lazy forward iterator over a set
pub struct TreeSetIterator<T> { pub struct TreeSetIterator<'self, T> {
priv iter: TreeMapIterator/&self<T, ()> priv iter: TreeMapIterator<'self, T, ()>
} }
/// Advance the iterator to the next node (in order). If this iterator is /// Advance the iterator to the next node (in order). If this iterator is
/// finished, does nothing. /// finished, does nothing.
#[inline(always)] #[inline(always)]
pub fn set_next<T>(iter: &mut TreeSetIterator/&r<T>) -> Option<&'r T> { pub fn set_next<'r, T>(iter: &mut TreeSetIterator<'r, T>) -> Option<&'r T> {
do map_next(&mut iter.iter).map |&(value, _)| { value } do map_next(&mut iter.iter).map |&(value, _)| { value }
} }
/// Advance the iterator through the set /// Advance the iterator through the set
#[inline(always)] #[inline(always)]
pub fn set_advance<T>(iter: &mut TreeSetIterator/&r<T>, pub fn set_advance<'r, T>(iter: &mut TreeSetIterator<'r, T>,
f: &fn(&'r T) -> bool) { f: &fn(&'r T) -> bool) {
do map_advance(&mut iter.iter) |(k, _)| { f(k) } do map_advance(&mut iter.iter) |(k, _)| { f(k) }
} }

View file

@ -234,9 +234,8 @@ fn json_encode<T:Encodable<json::Encoder>>(t: &T) -> ~str {
} }
} }
fn json_decode<T:Decodable<json::Decoder/&static>>( // FIXME(#5121) // FIXME(#5121)
s: &str) -> T fn json_decode<T:Decodable<json::Decoder<'static>>>(s: &str) -> T {
{
do io::with_str_reader(s) |rdr| { do io::with_str_reader(s) |rdr| {
let j = result::unwrap(json::from_reader(rdr)); let j = result::unwrap(json::from_reader(rdr));
Decodable::decode(&json::Decoder(j)) Decodable::decode(&json::Decoder(j))
@ -266,7 +265,7 @@ pub impl Context {
fn prep<T:Owned + fn prep<T:Owned +
Encodable<json::Encoder> + Encodable<json::Encoder> +
Decodable<json::Decoder/&static>>( // FIXME(#5121) Decodable<json::Decoder<'static>>>( // FIXME(#5121)
@self, @self,
fn_name:&str, fn_name:&str,
blk: &fn(@Mut<Prep>)->Work<T>) -> Work<T> { blk: &fn(@Mut<Prep>)->Work<T>) -> Work<T> {
@ -284,7 +283,7 @@ trait TPrep {
fn all_fresh(&self, cat:&str, map:&WorkMap) -> bool; fn all_fresh(&self, cat:&str, map:&WorkMap) -> bool;
fn exec<T:Owned + fn exec<T:Owned +
Encodable<json::Encoder> + Encodable<json::Encoder> +
Decodable<json::Decoder/&static>>( // FIXME(#5121) Decodable<json::Decoder<'static>>>( // FIXME(#5121)
&self, blk: ~fn(&Exec) -> T) -> Work<T>; &self, blk: ~fn(&Exec) -> T) -> Work<T>;
} }
@ -325,7 +324,7 @@ impl TPrep for @Mut<Prep> {
fn exec<T:Owned + fn exec<T:Owned +
Encodable<json::Encoder> + Encodable<json::Encoder> +
Decodable<json::Decoder/&static>>( // FIXME(#5121) Decodable<json::Decoder<'static>>>( // FIXME(#5121)
&self, blk: ~fn(&Exec) -> T) -> Work<T> { &self, blk: ~fn(&Exec) -> T) -> Work<T> {
let mut bo = Some(blk); let mut bo = Some(blk);
@ -366,7 +365,7 @@ impl TPrep for @Mut<Prep> {
pub impl<T:Owned + pub impl<T:Owned +
Encodable<json::Encoder> + Encodable<json::Encoder> +
Decodable<json::Decoder/&static>> Work<T> { // FIXME(#5121) Decodable<json::Decoder<'static>>> Work<T> { // FIXME(#5121)
fn new(p: @Mut<Prep>, e: Either<T,PortOne<(Exec,T)>>) -> Work<T> { fn new(p: @Mut<Prep>, e: Either<T,PortOne<(Exec,T)>>) -> Work<T> {
Work { prep: p, res: Some(e) } Work { prep: p, res: Some(e) }
} }
@ -375,7 +374,7 @@ pub impl<T:Owned +
// FIXME (#3724): movable self. This should be in impl Work. // FIXME (#3724): movable self. This should be in impl Work.
fn unwrap<T:Owned + fn unwrap<T:Owned +
Encodable<json::Encoder> + Encodable<json::Encoder> +
Decodable<json::Decoder/&static>>( // FIXME(#5121) Decodable<json::Decoder<'static>>>( // FIXME(#5121)
w: Work<T>) -> T { w: Work<T>) -> T {
let mut ww = w; let mut ww = w;
let mut s = None; let mut s = None;

View file

@ -494,7 +494,7 @@ pub fn core_macros() -> ~str {
fn key(_x: @::core::condition::Handler<$in,$out>) { } fn key(_x: @::core::condition::Handler<$in,$out>) { }
pub static cond : pub static cond :
::core::condition::Condition/&static<$in,$out> = ::core::condition::Condition<'static,$in,$out> =
::core::condition::Condition { ::core::condition::Condition {
name: stringify!($c), name: stringify!($c),
key: key key: key

View file

@ -109,7 +109,7 @@ pub fn is_some(&&mpu: matcher_pos_up) -> bool {
} }
pub struct MatcherPos { pub struct MatcherPos {
elts: ~[ast::matcher], // maybe should be /&? Need to understand regions. elts: ~[ast::matcher], // maybe should be <'>? Need to understand regions.
sep: Option<Token>, sep: Option<Token>,
idx: uint, idx: uint,
up: matcher_pos_up, // mutable for swapping only up: matcher_pos_up, // mutable for swapping only