librustc: Add explicit lifetime binders and new lifetime notation in core/std/syntax/rustc
This commit is contained in:
parent
68cb53672b
commit
6d81307a9b
@ -22,11 +22,11 @@ pub struct Handler<T, U> {
|
||||
|
||||
pub struct Condition<T, U> {
|
||||
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> {
|
||||
fn trap(&self, h: &'self fn(T) -> U) -> Trap/&self<T, U> {
|
||||
pub impl<T, U> Condition<'self, T, U> {
|
||||
fn trap(&self, h: &'self fn(T) -> U) -> Trap<'self, T, U> {
|
||||
unsafe {
|
||||
let p : *RustClosure = ::cast::transmute(&h);
|
||||
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> {
|
||||
cond: &'self Condition/&self<T, U>,
|
||||
cond: &'self Condition<'self, 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 {
|
||||
unsafe {
|
||||
let _g = Guard { cond: self.cond };
|
||||
@ -81,11 +81,11 @@ pub impl<T, U> Trap/&self<T, U> {
|
||||
}
|
||||
|
||||
struct Guard<T, U> {
|
||||
cond: &'self Condition/&self<T, U>
|
||||
cond: &'self Condition<'self, T, U>
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl<T, U> Drop for Guard/&self<T, U> {
|
||||
impl<T, U> Drop for Guard<'self, T, U> {
|
||||
fn finalize(&self) {
|
||||
unsafe {
|
||||
debug!("Guard: popping handler from TLS");
|
||||
|
@ -41,12 +41,12 @@ impl<T> Finally<T> for &'self fn() -> T {
|
||||
}
|
||||
}
|
||||
|
||||
struct Finallyalizer {
|
||||
struct Finallyalizer<'self> {
|
||||
dtor: &'self fn()
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for Finallyalizer/&self {
|
||||
impl<'self> Drop for Finallyalizer<'self> {
|
||||
fn finalize(&self) {
|
||||
(self.dtor)();
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ struct PreserveCtxt {
|
||||
root_managed_data: bool
|
||||
}
|
||||
|
||||
pub impl PreserveCtxt/&self {
|
||||
pub impl<'self> PreserveCtxt<'self> {
|
||||
fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
|
||||
|
||||
fn preserve(&self, cmt: cmt) -> bckres<PreserveCondition> {
|
||||
|
@ -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
|
||||
/// 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
|
||||
/// bounded by `&r`. However, it is possible that there are *type
|
||||
/// parameters* in the type of `a`, and those *type parameters* may
|
||||
|
@ -255,10 +255,10 @@ pub impl LanguageItems {
|
||||
}
|
||||
}
|
||||
|
||||
fn LanguageItemCollector(crate: @crate,
|
||||
session: Session,
|
||||
items: &'r mut LanguageItems)
|
||||
-> LanguageItemCollector/&r {
|
||||
fn LanguageItemCollector<'r>(crate: @crate,
|
||||
session: Session,
|
||||
items: &'r mut LanguageItems)
|
||||
-> LanguageItemCollector<'r> {
|
||||
let item_refs = HashMap();
|
||||
|
||||
item_refs.insert(@~"const", ConstTraitLangItem as uint);
|
||||
@ -320,7 +320,7 @@ struct LanguageItemCollector {
|
||||
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,
|
||||
meta_item: @meta_item) {
|
||||
match meta_item.node {
|
||||
|
@ -331,9 +331,9 @@ pub struct ArmData {
|
||||
bindings_map: BindingsMap
|
||||
}
|
||||
|
||||
pub struct Match {
|
||||
pub struct Match<'self> {
|
||||
pats: ~[@ast::pat],
|
||||
data: @ArmData/&self
|
||||
data: @ArmData<'self>
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
pub fn expand_nested_bindings(bcx: block, m: &[@Match/&r],
|
||||
col: uint, val: ValueRef)
|
||||
-> ~[@Match/&r] {
|
||||
pub fn expand_nested_bindings<'r>(bcx: block,
|
||||
m: &[@Match<'r>],
|
||||
col: uint,
|
||||
val: ValueRef)
|
||||
-> ~[@Match<'r>] {
|
||||
debug!("expand_nested_bindings(bcx=%s, m=%s, col=%u, val=%?)",
|
||||
bcx.to_str(),
|
||||
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],
|
||||
col: uint, val: ValueRef, e: enter_pat)
|
||||
-> ~[@Match/&r] {
|
||||
pub fn enter_match<'r>(bcx: block,
|
||||
dm: DefMap,
|
||||
m: &[@Match<'r>],
|
||||
col: uint,
|
||||
val: ValueRef,
|
||||
e: enter_pat)
|
||||
-> ~[@Match<'r>] {
|
||||
debug!("enter_match(bcx=%s, m=%s, col=%u, val=%?)",
|
||||
bcx.to_str(),
|
||||
matches_to_str(bcx, m),
|
||||
@ -445,9 +451,12 @@ pub fn enter_match(bcx: block, dm: DefMap, m: &[@Match/&r],
|
||||
return result;
|
||||
}
|
||||
|
||||
pub fn enter_default(bcx: block, dm: DefMap, m: &[@Match/&r],
|
||||
col: uint, val: ValueRef)
|
||||
-> ~[@Match/&r] {
|
||||
pub fn enter_default<'r>(bcx: block,
|
||||
dm: DefMap,
|
||||
m: &[@Match<'r>],
|
||||
col: uint,
|
||||
val: ValueRef)
|
||||
-> ~[@Match<'r>] {
|
||||
debug!("enter_default(bcx=%s, m=%s, col=%u, val=%?)",
|
||||
bcx.to_str(),
|
||||
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
|
||||
// wildcards
|
||||
|
||||
pub fn enter_opt(bcx: block, m: &[@Match/&r], opt: &Opt, col: uint,
|
||||
variant_size: uint, val: ValueRef)
|
||||
-> ~[@Match/&r] {
|
||||
pub fn enter_opt<'r>(bcx: block,
|
||||
m: &[@Match<'r>],
|
||||
opt: &Opt,
|
||||
col: uint,
|
||||
variant_size: uint,
|
||||
val: ValueRef)
|
||||
-> ~[@Match<'r>] {
|
||||
debug!("enter_opt(bcx=%s, m=%s, col=%u, val=%?)",
|
||||
bcx.to_str(),
|
||||
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,
|
||||
dm: DefMap,
|
||||
m: &[@Match/&r],
|
||||
m: &[@Match<'r>],
|
||||
col: uint,
|
||||
fields: &[ast::ident],
|
||||
val: ValueRef)
|
||||
-> ~[@Match/&r] {
|
||||
-> ~[@Match<'r>] {
|
||||
debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%?)",
|
||||
bcx.to_str(),
|
||||
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],
|
||||
col: uint, val: ValueRef, n_elts: uint)
|
||||
-> ~[@Match/&r] {
|
||||
pub fn enter_tup<'r>(bcx: block,
|
||||
dm: DefMap,
|
||||
m: &[@Match<'r>],
|
||||
col: uint,
|
||||
val: ValueRef,
|
||||
n_elts: uint)
|
||||
-> ~[@Match<'r>] {
|
||||
debug!("enter_tup(bcx=%s, m=%s, col=%u, val=%?)",
|
||||
bcx.to_str(),
|
||||
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,
|
||||
dm: DefMap,
|
||||
m: &[@Match/&r],
|
||||
col: uint,
|
||||
val: ValueRef,
|
||||
n_elts: uint)
|
||||
-> ~[@Match/&r] {
|
||||
pub fn enter_tuple_struct<'r>(bcx: block,
|
||||
dm: DefMap,
|
||||
m: &[@Match<'r>],
|
||||
col: uint,
|
||||
val: ValueRef,
|
||||
n_elts: uint)
|
||||
-> ~[@Match<'r>] {
|
||||
debug!("enter_tuple_struct(bcx=%s, m=%s, col=%u, val=%?)",
|
||||
bcx.to_str(),
|
||||
matches_to_str(bcx, m),
|
||||
@ -682,12 +699,12 @@ pub fn enter_tuple_struct(bcx: block,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn enter_box(bcx: block,
|
||||
dm: DefMap,
|
||||
m: &[@Match/&r],
|
||||
col: uint,
|
||||
val: ValueRef)
|
||||
-> ~[@Match/&r] {
|
||||
pub fn enter_box<'r>(bcx: block,
|
||||
dm: DefMap,
|
||||
m: &[@Match<'r>],
|
||||
col: uint,
|
||||
val: ValueRef)
|
||||
-> ~[@Match<'r>] {
|
||||
debug!("enter_box(bcx=%s, m=%s, col=%u, val=%?)",
|
||||
bcx.to_str(),
|
||||
matches_to_str(bcx, m),
|
||||
@ -709,12 +726,12 @@ pub fn enter_box(bcx: block,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn enter_uniq(bcx: block,
|
||||
dm: DefMap,
|
||||
m: &[@Match/&r],
|
||||
col: uint,
|
||||
val: ValueRef)
|
||||
-> ~[@Match/&r] {
|
||||
pub fn enter_uniq<'r>(bcx: block,
|
||||
dm: DefMap,
|
||||
m: &[@Match<'r>],
|
||||
col: uint,
|
||||
val: ValueRef)
|
||||
-> ~[@Match<'r>] {
|
||||
debug!("enter_uniq(bcx=%s, m=%s, col=%u, val=%?)",
|
||||
bcx.to_str(),
|
||||
matches_to_str(bcx, m),
|
||||
@ -736,12 +753,12 @@ pub fn enter_uniq(bcx: block,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn enter_region(bcx: block,
|
||||
dm: DefMap,
|
||||
m: &[@Match/&r],
|
||||
col: uint,
|
||||
val: ValueRef)
|
||||
-> ~[@Match/&r] {
|
||||
pub fn enter_region<'r>(bcx: block,
|
||||
dm: DefMap,
|
||||
m: &[@Match<'r>],
|
||||
col: uint,
|
||||
val: ValueRef)
|
||||
-> ~[@Match<'r>] {
|
||||
debug!("enter_region(bcx=%s, m=%s, col=%u, val=%?)",
|
||||
bcx.to_str(),
|
||||
matches_to_str(bcx, m),
|
||||
|
@ -192,7 +192,7 @@ pub enum TransformTypeFlag {
|
||||
TransformTypeForObject,
|
||||
}
|
||||
|
||||
pub impl LookupContext/&self {
|
||||
pub impl<'self> LookupContext<'self> {
|
||||
fn do_lookup(&self, self_ty: ty::t) -> Option<method_map_entry> {
|
||||
let mut self_ty = structurally_resolved_type(self.fcx,
|
||||
self.self_expr.span,
|
||||
|
@ -25,13 +25,13 @@ use core::ptr;
|
||||
use core::task;
|
||||
|
||||
/// As sync::condvar, a mechanism for unlock-and-descheduling and signalling.
|
||||
pub struct Condvar {
|
||||
pub struct Condvar<'self> {
|
||||
is_mutex: 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.
|
||||
#[inline(always)]
|
||||
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.
|
||||
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.
|
||||
let state = unsafe { get_shared_immutable_state(&self.x) };
|
||||
let RWWriteMode {
|
||||
@ -420,7 +420,7 @@ pub struct RWReadMode<'self, T> {
|
||||
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.
|
||||
fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
|
||||
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.
|
||||
fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
|
||||
match *self {
|
||||
|
@ -466,8 +466,8 @@ pub mod flatteners {
|
||||
fn from_writer(w: @Writer) -> Self;
|
||||
}
|
||||
|
||||
impl FromReader for json::Decoder/&self {
|
||||
fn from_reader(r: @Reader) -> json::Decoder/&self {
|
||||
impl FromReader for json::Decoder<'self> {
|
||||
fn from_reader(r: @Reader) -> json::Decoder<'self> {
|
||||
match json::from_reader(r) {
|
||||
Ok(json) => {
|
||||
json::Decoder(json)
|
||||
|
@ -749,7 +749,7 @@ pub fn Decoder(json: Json) -> Decoder {
|
||||
Decoder { json: json, stack: ~[] }
|
||||
}
|
||||
|
||||
priv impl Decoder/&self {
|
||||
priv impl Decoder<'self> {
|
||||
fn peek(&self) -> &'self Json {
|
||||
if vec::uniq_len(&const self.stack) == 0 {
|
||||
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) -> () {
|
||||
debug!("read_nil");
|
||||
match *self.pop() {
|
||||
|
@ -1191,7 +1191,7 @@ mod big_tests {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for LVal/&self {
|
||||
impl<'self> Drop for LVal<'self> {
|
||||
fn finalize(&self) {
|
||||
let x = unsafe { task::local_data::local_data_get(self.key) };
|
||||
match x {
|
||||
@ -1205,17 +1205,17 @@ mod big_tests {
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for LVal/&self {
|
||||
fn lt(&self, other: &'a LVal/&self) -> bool {
|
||||
impl<'self> Ord for LVal<'self> {
|
||||
fn lt(&self, other: &'a LVal<'self>) -> bool {
|
||||
(*self).val < other.val
|
||||
}
|
||||
fn le(&self, other: &'a LVal/&self) -> bool {
|
||||
fn le(&self, other: &'a LVal<'self>) -> bool {
|
||||
(*self).val <= other.val
|
||||
}
|
||||
fn gt(&self, other: &'a LVal/&self) -> bool {
|
||||
fn gt(&self, other: &'a LVal<'self>) -> bool {
|
||||
(*self).val > other.val
|
||||
}
|
||||
fn ge(&self, other: &'a LVal/&self) -> bool {
|
||||
fn ge(&self, other: &'a LVal<'self>) -> bool {
|
||||
(*self).val >= other.val
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ type SemAndSignalRelease = SemReleaseGeneric<'self, ~[Waitqueue]>;
|
||||
struct SemReleaseGeneric<Q> { sem: &'self Sem<Q> }
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl<Q:Owned> Drop for SemReleaseGeneric/&self<Q> {
|
||||
impl<Q:Owned> Drop for SemReleaseGeneric<'self, Q> {
|
||||
fn finalize(&self) {
|
||||
unsafe {
|
||||
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 {
|
||||
sem: sem
|
||||
}
|
||||
}
|
||||
|
||||
fn SemAndSignalRelease(sem: &'r Sem<~[Waitqueue]>)
|
||||
-> SemAndSignalRelease/&r {
|
||||
-> SemAndSignalRelease<'r> {
|
||||
SemReleaseGeneric {
|
||||
sem: sem
|
||||
}
|
||||
}
|
||||
|
||||
/// 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]
|
||||
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.
|
||||
*
|
||||
@ -266,7 +266,7 @@ pub impl Condvar/&self {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for SemAndSignalReacquire/&self {
|
||||
impl<'self> Drop for SemAndSignalReacquire<'self> {
|
||||
fn finalize(&self) {
|
||||
unsafe {
|
||||
// Needs to succeed, instead of itself dying.
|
||||
@ -278,7 +278,7 @@ pub impl Condvar/&self {
|
||||
}
|
||||
|
||||
fn SemAndSignalReacquire(sem: &'r Sem<~[Waitqueue]>)
|
||||
-> SemAndSignalReacquire/&r {
|
||||
-> SemAndSignalReacquire<'r> {
|
||||
SemAndSignalReacquire {
|
||||
sem: sem
|
||||
}
|
||||
@ -586,7 +586,9 @@ pub impl RWlock {
|
||||
}
|
||||
|
||||
/// 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) {
|
||||
fail!(~"Can't downgrade() with a different rwlock's write_mode!");
|
||||
}
|
||||
@ -619,7 +621,7 @@ struct RWlockReleaseRead {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for RWlockReleaseRead/&self {
|
||||
impl<'self> Drop for RWlockReleaseRead<'self> {
|
||||
fn finalize(&self) {
|
||||
unsafe {
|
||||
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 {
|
||||
lock: lock
|
||||
}
|
||||
@ -655,7 +657,7 @@ struct RWlockReleaseDowngrade {
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for RWlockReleaseDowngrade/&self {
|
||||
impl<'self> Drop for RWlockReleaseDowngrade<'self> {
|
||||
fn finalize(&self) {
|
||||
unsafe {
|
||||
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 {
|
||||
lock: lock
|
||||
}
|
||||
}
|
||||
|
||||
/// 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]
|
||||
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().
|
||||
pub struct RWlockReadMode { priv lock: &'self RWlock }
|
||||
#[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.
|
||||
fn write<U>(&self, blk: &fn() -> U) -> U { blk() }
|
||||
/// 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.
|
||||
fn read<U>(&self, blk: &fn() -> U) -> U { blk() }
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ pub impl<K: TotalOrd, V> TreeMap<K, V> {
|
||||
|
||||
/// Get a lazy iterator over the key-value pairs in the map.
|
||||
/// 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}
|
||||
}
|
||||
}
|
||||
@ -200,8 +200,8 @@ pub struct TreeMapIterator<K, V> {
|
||||
/// 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
|
||||
/// more nodes, return `None`.
|
||||
pub fn map_next<K, V>(iter: &mut TreeMapIterator/&r<K, V>)
|
||||
-> Option<(&'r K, &'r V)> {
|
||||
pub fn map_next<'r, K, V>(iter: &mut TreeMapIterator<'r, K, V>)
|
||||
-> Option<(&'r K, &'r V)> {
|
||||
while !iter.stack.is_empty() || iter.node.is_some() {
|
||||
match *iter.node {
|
||||
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
|
||||
pub fn map_advance<K, V>(iter: &mut TreeMapIterator/&r<K, V>,
|
||||
f: &fn((&'r K, &'r V)) -> bool) {
|
||||
pub fn map_advance<'r, K, V>(iter: &mut TreeMapIterator<'r, K, V>,
|
||||
f: &fn((&'r K, &'r V)) -> bool) {
|
||||
loop {
|
||||
match map_next(iter) {
|
||||
Some(x) => {
|
||||
@ -490,27 +490,27 @@ pub impl <T: TotalOrd> TreeSet<T> {
|
||||
/// Get a lazy iterator over the values in the set.
|
||||
/// Requires that it be frozen (immutable).
|
||||
#[inline(always)]
|
||||
fn iter(&self) -> TreeSetIterator/&self<T> {
|
||||
fn iter(&self) -> TreeSetIterator<'self, T> {
|
||||
TreeSetIterator{iter: self.map.iter()}
|
||||
}
|
||||
}
|
||||
|
||||
/// Lazy forward iterator over a set
|
||||
pub struct TreeSetIterator<T> {
|
||||
priv iter: TreeMapIterator/&self<T, ()>
|
||||
pub struct TreeSetIterator<'self, T> {
|
||||
priv iter: TreeMapIterator<'self, T, ()>
|
||||
}
|
||||
|
||||
/// Advance the iterator to the next node (in order). If this iterator is
|
||||
/// finished, does nothing.
|
||||
#[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 }
|
||||
}
|
||||
|
||||
/// Advance the iterator through the set
|
||||
#[inline(always)]
|
||||
pub fn set_advance<T>(iter: &mut TreeSetIterator/&r<T>,
|
||||
f: &fn(&'r T) -> bool) {
|
||||
pub fn set_advance<'r, T>(iter: &mut TreeSetIterator<'r, T>,
|
||||
f: &fn(&'r T) -> bool) {
|
||||
do map_advance(&mut iter.iter) |(k, _)| { f(k) }
|
||||
}
|
||||
|
||||
|
@ -234,9 +234,8 @@ fn json_encode<T:Encodable<json::Encoder>>(t: &T) -> ~str {
|
||||
}
|
||||
}
|
||||
|
||||
fn json_decode<T:Decodable<json::Decoder/&static>>( // FIXME(#5121)
|
||||
s: &str) -> T
|
||||
{
|
||||
// FIXME(#5121)
|
||||
fn json_decode<T:Decodable<json::Decoder<'static>>>(s: &str) -> T {
|
||||
do io::with_str_reader(s) |rdr| {
|
||||
let j = result::unwrap(json::from_reader(rdr));
|
||||
Decodable::decode(&json::Decoder(j))
|
||||
@ -266,7 +265,7 @@ pub impl Context {
|
||||
|
||||
fn prep<T:Owned +
|
||||
Encodable<json::Encoder> +
|
||||
Decodable<json::Decoder/&static>>( // FIXME(#5121)
|
||||
Decodable<json::Decoder<'static>>>( // FIXME(#5121)
|
||||
@self,
|
||||
fn_name:&str,
|
||||
blk: &fn(@Mut<Prep>)->Work<T>) -> Work<T> {
|
||||
@ -284,7 +283,7 @@ trait TPrep {
|
||||
fn all_fresh(&self, cat:&str, map:&WorkMap) -> bool;
|
||||
fn exec<T:Owned +
|
||||
Encodable<json::Encoder> +
|
||||
Decodable<json::Decoder/&static>>( // FIXME(#5121)
|
||||
Decodable<json::Decoder<'static>>>( // FIXME(#5121)
|
||||
&self, blk: ~fn(&Exec) -> T) -> Work<T>;
|
||||
}
|
||||
|
||||
@ -325,7 +324,7 @@ impl TPrep for @Mut<Prep> {
|
||||
|
||||
fn exec<T:Owned +
|
||||
Encodable<json::Encoder> +
|
||||
Decodable<json::Decoder/&static>>( // FIXME(#5121)
|
||||
Decodable<json::Decoder<'static>>>( // FIXME(#5121)
|
||||
&self, blk: ~fn(&Exec) -> T) -> Work<T> {
|
||||
let mut bo = Some(blk);
|
||||
|
||||
@ -366,7 +365,7 @@ impl TPrep for @Mut<Prep> {
|
||||
|
||||
pub impl<T:Owned +
|
||||
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> {
|
||||
Work { prep: p, res: Some(e) }
|
||||
}
|
||||
@ -375,7 +374,7 @@ pub impl<T:Owned +
|
||||
// FIXME (#3724): movable self. This should be in impl Work.
|
||||
fn unwrap<T:Owned +
|
||||
Encodable<json::Encoder> +
|
||||
Decodable<json::Decoder/&static>>( // FIXME(#5121)
|
||||
Decodable<json::Decoder<'static>>>( // FIXME(#5121)
|
||||
w: Work<T>) -> T {
|
||||
let mut ww = w;
|
||||
let mut s = None;
|
||||
|
@ -494,7 +494,7 @@ pub fn core_macros() -> ~str {
|
||||
fn key(_x: @::core::condition::Handler<$in,$out>) { }
|
||||
|
||||
pub static cond :
|
||||
::core::condition::Condition/&static<$in,$out> =
|
||||
::core::condition::Condition<'static,$in,$out> =
|
||||
::core::condition::Condition {
|
||||
name: stringify!($c),
|
||||
key: key
|
||||
|
@ -109,7 +109,7 @@ pub fn is_some(&&mpu: matcher_pos_up) -> bool {
|
||||
}
|
||||
|
||||
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>,
|
||||
idx: uint,
|
||||
up: matcher_pos_up, // mutable for swapping only
|
||||
|
Loading…
x
Reference in New Issue
Block a user