]> git.lizzy.rs Git - rust.git/commitdiff
librustc: Modify all code to use new lifetime binder syntax
authorPatrick Walton <pcwalton@mimiga.net>
Mon, 25 Mar 2013 20:21:04 +0000 (13:21 -0700)
committerPatrick Walton <pcwalton@mimiga.net>
Wed, 27 Mar 2013 04:30:17 +0000 (21:30 -0700)
138 files changed:
doc/rust.md
doc/tutorial-borrowed-ptr.md
src/libcore/at_vec.rs
src/libcore/cast.rs
src/libcore/cleanup.rs
src/libcore/condition.rs
src/libcore/gc.rs
src/libcore/hashmap.rs
src/libcore/io.rs
src/libcore/iter.rs
src/libcore/pipes.rs
src/libcore/ptr.rs
src/libcore/result.rs
src/libcore/rt/uv/mod.rs
src/libcore/str.rs
src/libcore/sys.rs
src/libcore/task/local_data.rs
src/libcore/task/spawn.rs
src/libcore/to_bytes.rs
src/libcore/to_str.rs
src/libcore/trie.rs
src/libcore/tuple.rs
src/libcore/unstable.rs
src/libcore/unstable/finally.rs
src/libcore/unstable/global.rs
src/libcore/vec.rs
src/librust/rust.rc
src/librustc/metadata/decoder.rs
src/librustc/metadata/filesearch.rs
src/librustc/metadata/tydecode.rs
src/librustc/middle/borrowck/preserve.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/lint.rs
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/callee.rs
src/librustc/middle/trans/tvec.rs
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/coherence.rs
src/librustc/middle/typeck/infer/lattice.rs
src/librustc/middle/typeck/infer/unify.rs
src/librustdoc/astsrv.rs
src/libstd/arc.rs
src/libstd/base64.rs
src/libstd/deque.rs
src/libstd/flatpipes.rs
src/libstd/json.rs
src/libstd/serialize.rs
src/libstd/smallintmap.rs
src/libstd/sort.rs
src/libstd/stats.rs
src/libstd/sync.rs
src/libstd/treemap.rs
src/libsyntax/ast.rs
src/libsyntax/ext/deriving/mod.rs
src/libsyntax/fold.rs
src/libsyntax/parse/parser.rs
src/test/compile-fail/auto-ref-borrowck-failure.rs
src/test/compile-fail/auto-ref-slice-plus-ref.rs
src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs
src/test/compile-fail/issue-1896-1.rs
src/test/compile-fail/issue-3154.rs
src/test/compile-fail/issue-3311.rs
src/test/compile-fail/issue-3888.rs
src/test/compile-fail/non-constant-expr-for-fixed-len-vec.rs
src/test/compile-fail/regions-bounds.rs
src/test/compile-fail/regions-creating-enums.rs
src/test/compile-fail/regions-creating-enums3.rs
src/test/compile-fail/regions-creating-enums4.rs
src/test/compile-fail/regions-escape-via-trait-or-not.rs
src/test/compile-fail/regions-fn-subtyping.rs
src/test/compile-fail/regions-fns.rs
src/test/compile-fail/regions-glb-free-free.rs
src/test/compile-fail/regions-in-enums.rs
src/test/compile-fail/regions-in-structs.rs
src/test/compile-fail/regions-in-type-items.rs
src/test/compile-fail/regions-infer-at-fn-not-param.rs
src/test/compile-fail/regions-infer-borrow-scope-too-big.rs
src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
src/test/compile-fail/regions-infer-call-3.rs
src/test/compile-fail/regions-infer-contravariance-due-to-immutability.rs
src/test/compile-fail/regions-infer-covariance-due-to-arg.rs
src/test/compile-fail/regions-infer-invariance-due-to-mutability-1.rs
src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs
src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
src/test/compile-fail/regions-nested-fns-2.rs
src/test/compile-fail/regions-nested-fns.rs
src/test/compile-fail/regions-ret-borrowed-1.rs
src/test/compile-fail/regions-ret.rs
src/test/compile-fail/regions-scoping.rs [deleted file]
src/test/compile-fail/regions-steal-closure.rs
src/test/compile-fail/regions-trait-1.rs
src/test/run-pass/assignability-trait.rs
src/test/run-pass/auto-ref-slice-plus-ref.rs
src/test/run-pass/borrow-by-val-method-receiver.rs
src/test/run-pass/borrowck-root-while-cond.rs
src/test/run-pass/borrowed-ptr-pattern-3.rs
src/test/run-pass/borrowed-ptr-pattern-option.rs
src/test/run-pass/class-impl-very-parameterized-trait.rs
src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs
src/test/run-pass/const-fn-val.rs
src/test/run-pass/const-region-ptrs-noncopy.rs
src/test/run-pass/const-region-ptrs.rs
src/test/run-pass/explicit-self.rs
src/test/run-pass/infer-with-expected.rs
src/test/run-pass/issue-2502.rs
src/test/run-pass/issue-2735-2.rs
src/test/run-pass/issue-2735-3.rs
src/test/run-pass/issue-2748-a.rs
src/test/run-pass/issue-2748-b.rs
src/test/run-pass/issue-3447.rs
src/test/run-pass/issue-3888-2.rs
src/test/run-pass/rcvr-borrowed-to-slice.rs
src/test/run-pass/region-dependent-addr-of.rs
src/test/run-pass/region-return-interior-of-option.rs
src/test/run-pass/regions-addr-of-interior-of-unique-box.rs
src/test/run-pass/regions-addr-of-ret.rs
src/test/run-pass/regions-copy-closure.rs
src/test/run-pass/regions-creating-enums2.rs
src/test/run-pass/regions-creating-enums5.rs
src/test/run-pass/regions-equiv-fns.rs [deleted file]
src/test/run-pass/regions-escape-into-other-fn.rs
src/test/run-pass/regions-fn-subtyping.rs
src/test/run-pass/regions-infer-borrow-scope-view.rs
src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs
src/test/run-pass/regions-infer-borrow-scope.rs
src/test/run-pass/regions-infer-call-2.rs
src/test/run-pass/regions-infer-call.rs
src/test/run-pass/regions-infer-contravariance-due-to-ret.rs
src/test/run-pass/regions-infer-contravariance.rs [deleted file]
src/test/run-pass/regions-mock-trans-impls.rs
src/test/run-pass/regions-mock-trans.rs
src/test/run-pass/regions-nullary-variant.rs
src/test/run-pass/regions-params.rs
src/test/run-pass/regions-self-in-enums.rs
src/test/run-pass/regions-static-closure.rs
src/test/run-pass/regions-trait.rs
src/test/run-pass/struct-field-assignability.rs

index 287dcb950f77260565762758c7ccbf79c05d3105..26ea276dd7c8c8c467bb2c7d9045fe7fdbff16b8 100644 (file)
@@ -1116,7 +1116,7 @@ static bit2: uint = 1 << 1;
 static bits: [uint, ..2] = [bit1, bit2];
 static string: &'static str = "bitstring";
 
-struct BitsNStrings {
+struct BitsNStrings<'self> {
     mybits: [uint, ..2],
     mystring: &'self str
 }
index e8b5ab9dda22f814671d8cff571d2914fea8fec6..039721fb12e63f2e254138d0cbab32db38cc54e8 100644 (file)
@@ -485,7 +485,7 @@ For example, we could write a subroutine like this:
 
 ~~~
 struct Point {x: float, y: float}
-fn get_x(p: &'r Point) -> &'r float { &p.x }
+fn get_x<'r>(p: &'r Point) -> &'r float { &p.x }
 ~~~
 
 Here, the function `get_x()` returns a pointer into the structure it
@@ -571,8 +571,8 @@ function:
 #     Rectangle(Point, Size)  // upper-left, dimensions
 # }
 # fn compute_area(shape: &Shape) -> float { 0f }
-fn select<T>(shape: &'r Shape, threshold: float,
-             a: &'r T, b: &'r T) -> &'r T {
+fn select<'r, T>(shape: &'r Shape, threshold: float,
+                 a: &'r T, b: &'r T) -> &'r T {
     if compute_area(shape) > threshold {a} else {b}
 }
 ~~~
@@ -591,12 +591,12 @@ example:
 #     Rectangle(Point, Size)  // upper-left, dimensions
 # }
 # fn compute_area(shape: &Shape) -> float { 0f }
-# fn select<T>(shape: &Shape, threshold: float,
-#              a: &'r T, b: &'r T) -> &'r T {
+# fn select<'r, T>(shape: &Shape, threshold: float,
+#                  a: &'r T, b: &'r T) -> &'r T {
 #     if compute_area(shape) > threshold {a} else {b}
 # }
                                                      // -+ r
-fn select_based_on_unit_circle<T>(                   //  |-+ B
+fn select_based_on_unit_circle<'r, T>(               //  |-+ B
     threshold: float, a: &'r T, b: &'r T) -> &'r T { //  | |
                                                      //  | |
     let shape = Circle(Point {x: 0., y: 0.}, 1.);    //  | |
@@ -628,8 +628,8 @@ returned. Here is how the new `select()` might look:
 #     Rectangle(Point, Size)  // upper-left, dimensions
 # }
 # fn compute_area(shape: &Shape) -> float { 0f }
-fn select<T>(shape: &'tmp Shape, threshold: float,
-             a: &'r T, b: &'r T) -> &'r T {
+fn select<'r, 'tmp, T>(shape: &'tmp Shape, threshold: float,
+                       a: &'r T, b: &'r T) -> &'r T {
     if compute_area(shape) > threshold {a} else {b}
 }
 ~~~
@@ -647,8 +647,8 @@ concise to just omit the named lifetime for `shape` altogether:
 #     Rectangle(Point, Size)  // upper-left, dimensions
 # }
 # fn compute_area(shape: &Shape) -> float { 0f }
-fn select<T>(shape: &Shape, threshold: float,
-             a: &'r T, b: &'r T) -> &'r T {
+fn select<'r, T>(shape: &Shape, threshold: float,
+                 a: &'r T, b: &'r T) -> &'r T {
     if compute_area(shape) > threshold {a} else {b}
 }
 ~~~
index 9a8645723a42fc8a69c8a515a35d7371396af9cc..c96a6502eecf75eecb245a30691742d2467b0fc3 100644 (file)
@@ -174,7 +174,7 @@ pub mod traits {
     use kinds::Copy;
     use ops::Add;
 
-    impl<T:Copy> Add<&'self const [T],@[T]> for @[T] {
+    impl<'self,T:Copy> Add<&'self const [T],@[T]> for @[T] {
         #[inline(always)]
         fn add(&self, rhs: & &'self const [T]) -> @[T] {
             append(*self, (*rhs))
index c1c7bd237702a743e135e9384823c83b60cf5286..6d8674caf870b75fdf068c89820847ed4774839a 100644 (file)
@@ -61,17 +61,19 @@ pub unsafe fn transmute<L, G>(thing: L) -> G {
 
 /// Coerce an immutable reference to be mutable.
 #[inline(always)]
-pub unsafe fn transmute_mut<T>(ptr: &'a T) -> &'a mut T { transmute(ptr) }
+pub unsafe fn transmute_mut<'a,T>(ptr: &'a T) -> &'a mut T { transmute(ptr) }
 
 /// Coerce a mutable reference to be immutable.
 #[inline(always)]
-pub unsafe fn transmute_immut<T>(ptr: &'a mut T) -> &'a T {
+pub unsafe fn transmute_immut<'a,T>(ptr: &'a mut T) -> &'a T {
     transmute(ptr)
 }
 
 /// Coerce a borrowed pointer to have an arbitrary associated region.
 #[inline(always)]
-pub unsafe fn transmute_region<T>(ptr: &'a T) -> &'b T { transmute(ptr) }
+pub unsafe fn transmute_region<'a,'b,T>(ptr: &'a T) -> &'b T {
+    transmute(ptr)
+}
 
 /// Coerce an immutable reference to be mutable.
 #[inline(always)]
@@ -87,19 +89,19 @@ pub unsafe fn transmute_immut_unsafe<T>(ptr: *const T) -> *T {
 
 /// Coerce a borrowed mutable pointer to have an arbitrary associated region.
 #[inline(always)]
-pub unsafe fn transmute_mut_region<T>(ptr: &'a mut T) -> &'b mut T {
+pub unsafe fn transmute_mut_region<'a,'b,T>(ptr: &'a mut T) -> &'b mut T {
     transmute(ptr)
 }
 
 /// Transforms lifetime of the second pointer to match the first.
 #[inline(always)]
-pub unsafe fn copy_lifetime<S,T>(_ptr: &'a S, ptr: &T) -> &'a T {
+pub unsafe fn copy_lifetime<'a,S,T>(_ptr: &'a S, ptr: &T) -> &'a T {
     transmute_region(ptr)
 }
 
 /// Transforms lifetime of the second pointer to match the first.
 #[inline(always)]
-pub unsafe fn copy_lifetime_vec<S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {
+pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {
     transmute_region(ptr)
 }
 
index 3beb1add3eac9c09f8b65a39e96c25d890926ba5..8223ab650f2a36e3ea0a9e552a839a6f1d9dbf3f 100644 (file)
@@ -22,8 +22,8 @@
  * NB: These must match the representation in the C++ runtime.
  */
 
-type DropGlue = &'self fn(**TypeDesc, *c_void);
-type FreeGlue = &'self fn(**TypeDesc, *c_void);
+type DropGlue<'self> = &'self fn(**TypeDesc, *c_void);
+type FreeGlue<'self> = &'self fn(**TypeDesc, *c_void);
 
 type TaskID = uintptr_t;
 
index 6b5d8b91439e784e81c23f05d4a06aad00c7af67..41504f1a0e1094e136d56be884a7a078c0aa7a90 100644 (file)
@@ -22,12 +22,12 @@ pub struct Handler<T, U> {
     prev: Option<@Handler<T, U>>,
 }
 
-pub struct Condition<T, U> {
+pub struct Condition<'self, T, U> {
     name: &'static str,
     key: task::local_data::LocalDataKey<'self, Handler<T, U>>
 }
 
-pub impl<T, U> Condition<'self, T, U> {
+pub impl<'self, 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);
@@ -66,12 +66,12 @@ fn raise_default(&self, t: T, default: &fn() -> U) -> U {
     }
 }
 
-struct Trap<T, U> {
+struct Trap<'self, T, U> {
     cond: &'self Condition<'self, T, U>,
     handler: @Handler<T, U>
 }
 
-pub impl<T, U> Trap<'self, T, U> {
+pub impl<'self, T, U> Trap<'self, T, U> {
     fn in<V>(&self, inner: &'self fn() -> V) -> V {
         unsafe {
             let _g = Guard { cond: self.cond };
@@ -82,12 +82,12 @@ fn in<V>(&self, inner: &'self fn() -> V) -> V {
     }
 }
 
-struct Guard<T, U> {
+struct Guard<'self, T, U> {
     cond: &'self Condition<'self, T, U>
 }
 
 #[unsafe_destructor]
-impl<T, U> Drop for Guard<'self, T, U> {
+impl<'self, T, U> Drop for Guard<'self, T, U> {
     fn finalize(&self) {
         unsafe {
             debug!("Guard: popping handler from TLS");
index f2fe73e501e2db4466bd5ef7db615704ac0c68a1..85d288dda6cc49586efab84f38672c4849f1821b 100644 (file)
@@ -124,7 +124,7 @@ unsafe fn is_safe_point(pc: *Word) -> Option<SafePoint> {
     return None;
 }
 
-type Visitor = &'self fn(root: **Word, tydesc: *Word) -> bool;
+type Visitor<'self> = &'self fn(root: **Word, tydesc: *Word) -> bool;
 
 // Walks the list of roots for the given safe point, and calls visitor
 // on each root.
index 6f97bf6dde231d8b649b3af332d3a5826e2cfeea..7d9320b9b0f933ec0c4ca3eea3798deb421dbae7 100644 (file)
@@ -278,9 +278,8 @@ fn search(&self, hash: uint,
         }
     }
 
-    impl<K:Hash + IterBytes + Eq,V>
-        BaseIter<(&'self K, &'self V)> for LinearMap<K, V>
-    {
+    impl<'self,K:Hash + IterBytes + Eq,V>
+            BaseIter<(&'self K, &'self V)> for LinearMap<K, V> {
         /// Visit all key-value pairs
         fn each(&self, blk: &fn(&(&'self K, &'self V)) -> bool) {
             for uint::range(0, self.buckets.len()) |i| {
@@ -315,7 +314,7 @@ fn clear(&mut self) {
         }
     }
 
-    impl<K:Hash + IterBytes + Eq,V> Map<K, V> for LinearMap<K, V> {
+    impl<'self,K:Hash + IterBytes + Eq,V> Map<K, V> for LinearMap<K, V> {
         /// Return true if the map contains a value for the specified key
         fn contains_key(&self, k: &K) -> bool {
             match self.bucket_for_key(k) {
index 2b66fdb38ab11d881cceb5fb3aabf6d703c57030..9ad6693c8d02cf615ef768cf5a30e71c0ae78dce 100644 (file)
@@ -616,12 +616,12 @@ pub fn file_reader(path: &Path) -> Result<@Reader, ~str> {
 
 
 // Byte readers
-pub struct BytesReader {
+pub struct BytesReader<'self> {
     bytes: &'self [u8],
     mut pos: uint
 }
 
-impl Reader for BytesReader<'self> {
+impl<'self> Reader for BytesReader<'self> {
     fn read(&self, bytes: &mut [u8], len: uint) -> uint {
         let count = uint::min(len, self.bytes.len() - self.pos);
 
index 58a514dc0eeebb4eb93dbc0f914e9aed39280ba9..7ed4c3c36ea6d421bd4cf3f344ee8a97fe061f84 100644 (file)
@@ -20,7 +20,7 @@
 use vec;
 
 /// A function used to initialize the elements of a sequence
-pub type InitOp<T> = &'self fn(uint) -> T;
+pub type InitOp<'self,T> = &'self fn(uint) -> T;
 
 pub trait BaseIter<A> {
     fn each(&self, blk: &fn(v: &A) -> bool);
index ae01a3d57f34741363a425a272134c90a6ee9bcc..5e995d777c9b0f45d8aad4e4ac319fffdd7df3c4 100644 (file)
@@ -439,7 +439,7 @@ pub fn try_recv<T:Owned,Tbuffer:Owned>(p: RecvPacketBuffered<T, Tbuffer>)
     let p = unsafe { &*p_ };
 
     #[unsafe_destructor]
-    struct DropState {
+    struct DropState<'self> {
         p: &'self PacketHeader,
 
         drop {
index fa96467cb0f674642c6cf969b7024166b67e1918..69e7b401431bbc11a96499d9a6f29e2d9e380074 100644 (file)
@@ -178,7 +178,7 @@ pub fn to_uint<T>(thing: &T) -> uint {
 
 /// Determine if two borrowed pointers point to the same thing.
 #[inline(always)]
-pub fn ref_eq<T>(thing: &'a T, other: &'b T) -> bool {
+pub fn ref_eq<'a,'b,T>(thing: &'a T, other: &'b T) -> bool {
     to_uint(thing) == to_uint(other)
 }
 
@@ -312,7 +312,7 @@ fn gt(&self, other: &*const T) -> bool {
 
 // Equality for region pointers
 #[cfg(notest)]
-impl<T:Eq> Eq for &'self const T {
+impl<'self,T:Eq> Eq for &'self const T {
     #[inline(always)]
     fn eq(&self, other: & &'self const T) -> bool {
         return *(*self) == *(*other);
@@ -325,7 +325,7 @@ fn ne(&self, other: & &'self const T) -> bool {
 
 // Comparison for region pointers
 #[cfg(notest)]
-impl<T:Ord> Ord for &'self const T {
+impl<'self,T:Ord> Ord for &'self const T {
     #[inline(always)]
     fn lt(&self, other: & &'self const T) -> bool {
         *(*self) < *(*other)
index 0df9f78a3d6d77494a8ab2fb7b4b1b5f80dbfd9e..0a2c803ff0714f942b2b23d1828bd3e0e0aedd74 100644 (file)
@@ -53,7 +53,7 @@ pub fn get<T:Copy,U>(res: &Result<T, U>) -> T {
  * If the result is an error
  */
 #[inline(always)]
-pub fn get_ref<T, U>(res: &'a Result<T, U>) -> &'a T {
+pub fn get_ref<'a, T, U>(res: &'a Result<T, U>) -> &'a T {
     match *res {
         Ok(ref t) => t,
         Err(ref the_err) => unsafe {
index 94a3b562fd875697a797fca0a018a87a57f31c2d..5965a767763cba789f037c4f58ca59291cc31c02 100644 (file)
@@ -321,7 +321,7 @@ pub fn install_watcher_data<H, W: Watcher + NativeHandle<*H>>(watcher: &mut W) {
     }
 }
 
-pub fn get_watcher_data<H, W: Watcher + NativeHandle<*H>>(
+pub fn get_watcher_data<'r, H, W: Watcher + NativeHandle<*H>>(
     watcher: &'r mut W) -> &'r mut WatcherData {
 
     unsafe {
index 4539b373e7016f6151876a5eba48a8494bc0dc6d..e78c5dfffab8972ea0e227e7634c6a0c39649cd5 100644 (file)
@@ -58,7 +58,7 @@ impl ToStr for ~str {
     #[inline(always)]
     fn to_str(&self) -> ~str { from_slice(*self) }
 }
-impl ToStr for &'self str {
+impl<'self> ToStr for &'self str {
     #[inline(always)]
     fn to_str(&self) -> ~str { from_slice(*self) }
 }
@@ -293,7 +293,7 @@ pub fn shift_char(s: &mut ~str) -> char {
  * If the string does not contain any characters
  */
 #[inline]
-pub fn slice_shift_char(s: &'a str) -> (char, &'a str) {
+pub fn slice_shift_char<'a>(s: &'a str) -> (char, &'a str) {
     let CharRange {ch, next} = char_range_at(s, 0u);
     let next_s = unsafe { raw::slice_bytes(s, next, len(s)) };
     return (ch, next_s);
@@ -313,7 +313,7 @@ pub fn unshift_char(s: &mut ~str, ch: char) {
  * * chars_to_trim - A vector of chars
  *
  */
-pub fn trim_left_chars(s: &'a str, chars_to_trim: &[char]) -> &'a str {
+pub fn trim_left_chars<'a>(s: &'a str, chars_to_trim: &[char]) -> &'a str {
     if chars_to_trim.is_empty() { return s; }
 
     match find(s, |c| !chars_to_trim.contains(&c)) {
@@ -331,7 +331,7 @@ pub fn trim_left_chars(s: &'a str, chars_to_trim: &[char]) -> &'a str {
  * * chars_to_trim - A vector of chars
  *
  */
-pub fn trim_right_chars(s: &'a str, chars_to_trim: &[char]) -> &'a str {
+pub fn trim_right_chars<'a>(s: &'a str, chars_to_trim: &[char]) -> &'a str {
     if chars_to_trim.is_empty() { return s; }
 
     match rfind(s, |c| !chars_to_trim.contains(&c)) {
@@ -352,12 +352,12 @@ pub fn trim_right_chars(s: &'a str, chars_to_trim: &[char]) -> &'a str {
  * * chars_to_trim - A vector of chars
  *
  */
-pub fn trim_chars(s: &'a str, chars_to_trim: &[char]) -> &'a str {
+pub fn trim_chars<'a>(s: &'a str, chars_to_trim: &[char]) -> &'a str {
     trim_left_chars(trim_right_chars(s, chars_to_trim), chars_to_trim)
 }
 
 /// Returns a string with leading whitespace removed
-pub fn trim_left(s: &'a str) -> &'a str {
+pub fn trim_left<'a>(s: &'a str) -> &'a str {
     match find(s, |c| !char::is_whitespace(c)) {
       None => "",
       Some(first) => unsafe { raw::slice_bytes(s, first, len(s)) }
@@ -365,7 +365,7 @@ pub fn trim_left(s: &'a str) -> &'a str {
 }
 
 /// Returns a string with trailing whitespace removed
-pub fn trim_right(s: &'a str) -> &'a str {
+pub fn trim_right<'a>(s: &'a str) -> &'a str {
     match rfind(s, |c| !char::is_whitespace(c)) {
       None => "",
       Some(last) => {
@@ -376,7 +376,7 @@ pub fn trim_right(s: &'a str) -> &'a str {
 }
 
 /// Returns a string with leading and trailing whitespace removed
-pub fn trim(s: &'a str) -> &'a str { trim_left(trim_right(s)) }
+pub fn trim<'a>(s: &'a str) -> &'a str { trim_left(trim_right(s)) }
 
 /*
 Section: Transforming strings
@@ -418,7 +418,7 @@ pub fn to_chars(s: &str) -> ~[char] {
  * Returns a slice pointing at `n` characters starting from byte offset
  * `begin`.
  */
-pub fn substr(s: &'a str, begin: uint, n: uint) -> &'a str {
+pub fn substr<'a>(s: &'a str, begin: uint, n: uint) -> &'a str {
     slice(s, begin, begin + count_bytes(s, begin, n))
 }
 
@@ -428,7 +428,7 @@ pub fn substr(s: &'a str, begin: uint, n: uint) -> &'a str {
  * Fails when `begin` and `end` do not point to valid characters or beyond
  * the last character of the string
  */
-pub fn slice(s: &'a str, begin: uint, end: uint) -> &'a str {
+pub fn slice<'a>(s: &'a str, begin: uint, end: uint) -> &'a str {
     fail_unless!(is_char_boundary(s, begin));
     fail_unless!(is_char_boundary(s, end));
     unsafe { raw::slice_bytes(s, begin, end) }
@@ -528,7 +528,7 @@ fn each_split_inner(s: &'a str, sepfn: &fn(cc: char) -> bool, count: uint,
 }
 
 // See Issue #1932 for why this is a naive search
-fn iter_matches(s: &'a str, sep: &'b str, f: &fn(uint, uint) -> bool) {
+fn iter_matches<'a,'b>(s: &'a str, sep: &'b str, f: &fn(uint, uint) -> bool) {
     let sep_len = len(sep), l = len(s);
     fail_unless!(sep_len > 0u);
     let mut i = 0u, match_start = 0u, match_i = 0u;
@@ -555,7 +555,9 @@ fn iter_matches(s: &'a str, sep: &'b str, f: &fn(uint, uint) -> bool) {
     }
 }
 
-fn iter_between_matches(s: &'a str, sep: &'b str, f: &fn(uint, uint) -> bool) {
+fn iter_between_matches<'a,'b>(s: &'a str,
+                               sep: &'b str,
+                               f: &fn(uint, uint) -> bool) {
     let mut last_end = 0u;
     for iter_matches(s, sep) |from, to| {
         if !f(last_end, from) { return; }
@@ -575,13 +577,17 @@ fn iter_between_matches(s: &'a str, sep: &'b str, f: &fn(uint, uint) -> bool) {
  * fail_unless!(v == ["", "XXX", "YYY", ""]);
  * ~~~
  */
-pub fn each_split_str(s: &'a str, sep: &'b str, it: &fn(&'a str) -> bool) {
+pub fn each_split_str<'a,'b>(s: &'a str,
+                             sep: &'b str,
+                             it: &fn(&'a str) -> bool) {
     for iter_between_matches(s, sep) |from, to| {
         if !it( unsafe { raw::slice_bytes(s, from, to) } ) { return; }
     }
 }
 
-pub fn each_split_str_nonempty(s: &'a str, sep: &'b str, it: &fn(&'a str) -> bool) {
+pub fn each_split_str_nonempty<'a,'b>(s: &'a str,
+                                      sep: &'b str,
+                                      it: &fn(&'a str) -> bool) {
     for iter_between_matches(s, sep) |from, to| {
         if to > from {
             if !it( unsafe { raw::slice_bytes(s, from, to) } ) { return; }
@@ -823,7 +829,7 @@ fn cmp(a: &str, b: &str) -> Ordering {
 }
 
 #[cfg(notest)]
-impl TotalOrd for &'self str {
+impl<'self> TotalOrd for &'self str {
     fn cmp(&self, other: & &'self str) -> Ordering { cmp(*self, *other) }
 }
 
@@ -869,7 +875,7 @@ fn gt(a: &str, b: &str) -> bool {
 }
 
 #[cfg(notest)]
-impl Eq for &'self str {
+impl<'self> Eq for &'self str {
     #[inline(always)]
     fn eq(&self, other: & &'self str) -> bool {
         eq_slice((*self), (*other))
@@ -911,7 +917,7 @@ fn gt(&self, other: &~str) -> bool { gt((*self), (*other)) }
 }
 
 #[cfg(notest)]
-impl Ord for &'self str {
+impl<'self> Ord for &'self str {
     #[inline(always)]
     fn lt(&self, other: & &'self str) -> bool { lt((*self), (*other)) }
     #[inline(always)]
@@ -935,7 +941,7 @@ fn gt(&self, other: &@str) -> bool { gt((*self), (*other)) }
 }
 
 #[cfg(notest)]
-impl Equiv<~str> for &'self str {
+impl<'self> Equiv<~str> for &'self str {
     #[inline(always)]
     fn equiv(&self, other: &~str) -> bool { eq_slice(*self, *other) }
 }
@@ -1370,7 +1376,7 @@ pub fn rfind_between(s: &str, start: uint, end: uint, f: &fn(char) -> bool) -> O
 }
 
 // Utility used by various searching functions
-fn match_at(haystack: &'a str, needle: &'b str, at: uint) -> bool {
+fn match_at<'a,'b>(haystack: &'a str, needle: &'b str, at: uint) -> bool {
     let mut i = at;
     for each(needle) |c| { if haystack[i] != c { return false; } i += 1u; }
     return true;
@@ -1389,7 +1395,7 @@ fn match_at(haystack: &'a str, needle: &'b str, at: uint) -> bool {
  * An `option` containing the byte index of the first matching substring
  * or `none` if there is no match
  */
-pub fn find_str(haystack: &'a str, needle: &'b str) -> Option<uint> {
+pub fn find_str<'a,'b>(haystack: &'a str, needle: &'b str) -> Option<uint> {
     find_str_between(haystack, needle, 0u, len(haystack))
 }
 
@@ -1412,7 +1418,10 @@ pub fn find_str(haystack: &'a str, needle: &'b str) -> Option<uint> {
  *
  * `start` must be less than or equal to `len(s)`
  */
-pub fn find_str_from(haystack: &'a str, needle: &'b str, start: uint) -> Option<uint> {
+pub fn find_str_from<'a,'b>(haystack: &'a str,
+                            needle: &'b str,
+                            start: uint)
+                         -> Option<uint> {
     find_str_between(haystack, needle, start, len(haystack))
 }
 
@@ -1436,8 +1445,11 @@ pub fn find_str_from(haystack: &'a str, needle: &'b str, start: uint) -> Option<
  * `start` must be less than or equal to `end` and `end` must be less than
  * or equal to `len(s)`.
  */
-pub fn find_str_between(haystack: &'a str, needle: &'b str, start: uint, end:uint)
-        -> Option<uint> {
+pub fn find_str_between<'a,'b>(haystack: &'a str,
+                               needle: &'b str,
+                               start: uint,
+                               end:uint)
+                            -> Option<uint> {
     // See Issue #1932 for why this is a naive search
     fail_unless!(end <= len(haystack));
     let needle_len = len(needle);
@@ -1461,7 +1473,7 @@ pub fn find_str_between(haystack: &'a str, needle: &'b str, start: uint, end:uin
  * * haystack - The string to look in
  * * needle - The string to look for
  */
-pub fn contains(haystack: &'a str, needle: &'b str) -> bool {
+pub fn contains<'a,'b>(haystack: &'a str, needle: &'b str) -> bool {
     find_str(haystack, needle).is_some()
 }
 
@@ -1485,7 +1497,7 @@ pub fn contains_char(haystack: &str, needle: char) -> bool {
  * * haystack - The string to look in
  * * needle - The string to look for
  */
-pub fn starts_with(haystack: &'a str, needle: &'b str) -> bool {
+pub fn starts_with<'a,'b>(haystack: &'a str, needle: &'b str) -> bool {
     let haystack_len = len(haystack), needle_len = len(needle);
     if needle_len == 0u { true }
     else if needle_len > haystack_len { false }
@@ -1500,7 +1512,7 @@ pub fn starts_with(haystack: &'a str, needle: &'b str) -> bool {
  * * haystack - The string to look in
  * * needle - The string to look for
  */
-pub fn ends_with(haystack: &'a str, needle: &'b str) -> bool {
+pub fn ends_with<'a,'b>(haystack: &'a str, needle: &'b str) -> bool {
     let haystack_len = len(haystack), needle_len = len(needle);
     if needle_len == 0u { true }
     else if needle_len > haystack_len { false }
@@ -1681,7 +1693,7 @@ pub fn count_chars(s: &str, start: uint, end: uint) -> uint {
 }
 
 /// Counts the number of bytes taken by the `n` in `s` starting from `start`.
-pub fn count_bytes(s: &'b str, start: uint, n: uint) -> uint {
+pub fn count_bytes<'b>(s: &'b str, start: uint, n: uint) -> uint {
     fail_unless!(is_char_boundary(s, start));
     let mut end = start, cnt = n;
     let l = len(s);
@@ -1921,7 +1933,7 @@ pub fn as_bytes<T>(s: &const ~str, f: &fn(&~[u8]) -> T) -> T {
  *
  * The byte slice does not include the null terminator.
  */
-pub fn as_bytes_slice(s: &'a str) -> &'a [u8] {
+pub fn as_bytes_slice<'a>(s: &'a str) -> &'a [u8] {
     unsafe {
         let (ptr, len): (*u8, uint) = ::cast::reinterpret_cast(&s);
         let outgoing_tuple: (*u8, uint) = (ptr, len - 1);
@@ -2229,7 +2241,7 @@ pub mod traits {
     use ops::Add;
     use str::append;
 
-    impl Add<&'self str,~str> for ~str {
+    impl<'self> Add<&'self str,~str> for ~str {
         #[inline(always)]
         fn add(&self, rhs: & &'self str) -> ~str {
             append(copy *self, (*rhs))
@@ -2243,7 +2255,7 @@ pub mod traits {}
 pub trait StrSlice<'self> {
     fn all(&self, it: &fn(char) -> bool) -> bool;
     fn any(&self, it: &fn(char) -> bool) -> bool;
-    fn contains(&self, needle: &'a str) -> bool;
+    fn contains<'a>(&self, needle: &'a str) -> bool;
     fn contains_char(&self, needle: char) -> bool;
     fn each(&self, it: &fn(u8) -> bool);
     fn eachi(&self, it: &fn(uint, u8) -> bool);
@@ -2262,8 +2274,8 @@ pub trait StrSlice<'self> {
     fn slice(&self, begin: uint, end: uint) -> &'self str;
     fn each_split(&self, sepfn: &fn(char) -> bool, it: &fn(&'self str) -> bool);
     fn each_split_char(&self, sep: char, it: &fn(&'self str) -> bool);
-    fn each_split_str(&self, sep: &'a str, it: &fn(&'self str) -> bool);
-    fn starts_with(&self, needle: &'a str) -> bool;
+    fn each_split_str<'a>(&self, sep: &'a str, it: &fn(&'self str) -> bool);
+    fn starts_with<'a>(&self, needle: &'a str) -> bool;
     fn substr(&self, begin: uint, n: uint) -> &'self str;
     fn to_lower(&self) -> ~str;
     fn to_upper(&self) -> ~str;
@@ -2283,7 +2295,7 @@ pub trait StrSlice<'self> {
 }
 
 /// Extension methods for strings
-impl StrSlice<'self> for &'self str {
+impl<'self> StrSlice<'self> for &'self str {
     /**
      * Return true if a predicate matches all characters or if the string
      * contains no characters
@@ -2298,7 +2310,7 @@ fn all(&self, it: &fn(char) -> bool) -> bool { all(*self, it) }
     fn any(&self, it: &fn(char) -> bool) -> bool { any(*self, it) }
     /// Returns true if one string contains another
     #[inline]
-    fn contains(&self, needle: &'a str) -> bool {
+    fn contains<'a>(&self, needle: &'a str) -> bool {
         contains(*self, needle)
     }
     /// Returns true if a string contains a char
@@ -2397,12 +2409,12 @@ fn each_split_char(&self, sep: char, it: &fn(&'self str) -> bool) {
      * string
      */
     #[inline]
-    fn each_split_str(&self, sep: &'a str, it: &fn(&'self str) -> bool)  {
+    fn each_split_str<'a>(&self, sep: &'a str, it: &fn(&'self str) -> bool) {
         each_split_str(*self, sep, it)
     }
     /// Returns true if one string starts with another
     #[inline]
-    fn starts_with(&self, needle: &'a str) -> bool {
+    fn starts_with<'a>(&self, needle: &'a str) -> bool {
         starts_with(*self, needle)
     }
     /**
@@ -2710,7 +2722,7 @@ fn t(s: &str, c: char, u: &[~str]) {
 
     #[test]
     fn test_split_str() {
-        fn t(s: &str, sep: &'a str, u: &[~str]) {
+        fn t<'a>(s: &str, sep: &'a str, u: &[~str]) {
             let mut v = ~[];
             for each_split_str(s, sep) |s| { v.push(s.to_owned()) }
             fail_unless!(vec::all2(v, u, |a,b| a == b));
index 69991259cf29ea0d20c3ba58dc5b4c8ebc232595..f8905e4faa79629be320a83b2892cfbc575de182 100644 (file)
@@ -19,7 +19,7 @@
 use repr;
 use str;
 
-pub type FreeGlue = &'self fn(*TypeDesc, *c_void);
+pub type FreeGlue<'self> = &'self fn(*TypeDesc, *c_void);
 
 // Corresponds to runtime type_desc type
 pub struct TypeDesc {
index ccd9170947989e4653e579ed1371dadfdf645ca3..e386f93a4290080802f6ea84eec8a31350a18f8e 100644 (file)
@@ -44,7 +44,7 @@
  *
  * These two cases aside, the interface is safe.
  */
-pub type LocalDataKey<T> = &'self fn(v: @T);
+pub type LocalDataKey<'self,T> = &'self fn(v: @T);
 
 /**
  * Remove a task-local data value from the table, returning the
index f353db5ae7098099bfa92797fdcaf841c85af7ac..cc075ed2a9291f6144b814c80e565c52f1565348 100644 (file)
@@ -122,7 +122,7 @@ struct TaskGroupData {
 }
 type TaskGroupArc = unstable::Exclusive<Option<TaskGroupData>>;
 
-type TaskGroupInner = &'self mut Option<TaskGroupData>;
+type TaskGroupInner<'self> = &'self mut Option<TaskGroupData>;
 
 // A taskgroup is 'dead' when nothing can cause it to fail; only members can.
 fn taskgroup_is_dead(tg: &TaskGroupData) -> bool {
index 32b123979cd5a4eeb7d2b4f25829678d42d5a720..7b4b6994e50a57cb71d248cd4c3ad1533f488a46 100644 (file)
@@ -19,7 +19,7 @@
 use option::{None, Option, Some};
 use str;
 
-pub type Cb = &'self fn(buf: &const [u8]) -> bool;
+pub type Cb<'self> = &'self fn(buf: &const [u8]) -> bool;
 
 /**
  * A trait to implement in order to make a type hashable;
@@ -197,7 +197,7 @@ fn iter_bytes(&self, lsb0: bool, f: Cb) {
     }
 }
 
-impl<A:IterBytes> IterBytes for &'self [A] {
+impl<'self,A:IterBytes> IterBytes for &'self [A] {
     #[inline(always)]
     fn iter_bytes(&self, lsb0: bool, f: Cb) {
         for (*self).each |elt| {
@@ -231,7 +231,7 @@ fn iter_bytes(&self, lsb0: bool, f: Cb) {
 }
 
 // Move this to vec, probably.
-fn borrow<A>(a: &'x [A]) -> &'x [A] {
+fn borrow<'x,A>(a: &'x [A]) -> &'x [A] {
     a
 }
 
@@ -352,7 +352,7 @@ pub fn iter_bytes_7<A: IterBytes,
     g.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag});
 }
 
-impl IterBytes for &'self str {
+impl<'self> IterBytes for &'self str {
     #[inline(always)]
     fn iter_bytes(&self, _lsb0: bool, f: Cb) {
         do str::byte_slice(*self) |bytes| {
@@ -389,7 +389,7 @@ fn iter_bytes(&self, lsb0: bool, f: Cb) {
     }
 }
 
-impl<A:IterBytes> IterBytes for &'self A {
+impl<'self,A:IterBytes> IterBytes for &'self A {
     #[inline(always)]
     fn iter_bytes(&self, lsb0: bool, f: Cb) {
         (**self).iter_bytes(lsb0, f);
index c942f508be8415c031f5871666eb9a95f0be897e..fa4074047b90a1402fb755268a8a7e5b12bd051e 100644 (file)
@@ -69,7 +69,7 @@ fn to_str(&self) -> ~str {
     }
 }
 
-impl<A:ToStr> ToStr for &'self [A] {
+impl<'self,A:ToStr> ToStr for &'self [A] {
     #[inline(always)]
     fn to_str(&self) -> ~str {
         unsafe {
index 4c4be33ea173079a5be16009463fcda2d15373f0..52298992bd17f894fd33955910cde61087a036eb 100644 (file)
@@ -28,7 +28,7 @@ pub struct TrieMap<T> {
     priv length: uint
 }
 
-impl<T> BaseIter<(uint, &'self T)> for TrieMap<T> {
+impl<'self,T> BaseIter<(uint, &'self T)> for TrieMap<T> {
     /// Visit all key-value pairs in order
     #[inline(always)]
     fn each(&self, f: &fn(&(uint, &'self T)) -> bool) {
@@ -38,7 +38,7 @@ fn each(&self, f: &fn(&(uint, &'self T)) -> bool) {
     fn size_hint(&self) -> Option<uint> { Some(self.len()) }
 }
 
-impl<T> ReverseIter<(uint, &'self T)> for TrieMap<T> {
+impl<'self,T> ReverseIter<(uint, &'self T)> for TrieMap<T> {
     /// Visit all key-value pairs in reverse order
     #[inline(always)]
     fn each_reverse(&self, f: &fn(&(uint, &'self T)) -> bool) {
@@ -282,7 +282,8 @@ fn chunk(n: uint, idx: uint) -> uint {
     (n >> sh) & MASK
 }
 
-fn find_mut<T>(child: &'r mut Child<T>, key: uint, idx: uint) -> Option<&'r mut T> {
+fn find_mut<'r, T>(child: &'r mut Child<T>, key: uint, idx: uint)
+                -> Option<&'r mut T> {
     unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
         (match *child {
             External(_, ref value) => Some(cast::transmute_mut(value)),
index 1762c2c64262c79e0c2a68680cfb34c15dc4b9cc..6fbcee959cea5c99d3e8bfe25b98529e20acf7b3 100644 (file)
@@ -71,7 +71,7 @@ pub trait ExtendedTupleOps<A,B> {
     fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C];
 }
 
-impl<A:Copy,B:Copy> ExtendedTupleOps<A,B> for (&'self [A], &'self [B]) {
+impl<'self,A:Copy,B:Copy> ExtendedTupleOps<A,B> for (&'self [A], &'self [B]) {
     #[inline(always)]
     fn zip(&self) -> ~[(A, B)] {
         match *self {
index 5daccd9f879f4954c37c41fe893d90797e117a68..b5cf4766af0461e262188298702983fc28e276ec 100644 (file)
@@ -170,7 +170,7 @@ pub unsafe fn get_shared_mutable_state<T:Owned>(
     }
 }
 #[inline(always)]
-pub unsafe fn get_shared_immutable_state<T:Owned>(
+pub unsafe fn get_shared_immutable_state<'a,T:Owned>(
         rc: &'a SharedMutableState<T>) -> &'a T {
     unsafe {
         let ptr: ~ArcData<T> = cast::reinterpret_cast(&(*rc).data);
index 04d1d6f11b929caed14380e53a1847da4a8e1a8c..93cc4a4342d8ed671a9cd685f6668b2cb700b33b 100644 (file)
@@ -31,7 +31,7 @@ pub trait Finally<T> {
     fn finally(&self, dtor: &fn()) -> T;
 }
 
-impl<T> Finally<T> for &'self fn() -> T {
+impl<'self,T> Finally<T> for &'self fn() -> T {
     fn finally(&self, dtor: &fn()) -> T {
         let _d = Finallyalizer {
             dtor: dtor
index 32e1b35d7db9f2e3002fffc4126190277ab22724..f160a350e0dd587b94dd41b1a23d50427783e071 100644 (file)
@@ -42,7 +42,7 @@
 #[cfg(test)] use task::spawn;
 #[cfg(test)] use uint;
 
-pub type GlobalDataKey<T> = &'self fn(v: T);
+pub type GlobalDataKey<'self,T> = &'self fn(v: T);
 
 pub unsafe fn global_data_clone_create<T:Owned + Clone>(
     key: GlobalDataKey<T>, create: &fn() -> ~T) -> T {
index 256b4c4922e505efe429206ebe58f4de70fa60c3..702ae73852ee37b6117d0e2fc8ccab9efeb99944 100644 (file)
@@ -225,46 +225,46 @@ pub fn build_sized_opt<A>(size: Option<uint>,
 // Accessors
 
 /// Returns the first element of a vector
-pub fn head<T>(v: &'r [T]) -> &'r T {
+pub fn head<'r,T>(v: &'r [T]) -> &'r T {
     if v.len() == 0 { fail!(~"head: empty vector") }
     &v[0]
 }
 
 /// Returns `Some(x)` where `x` is the first element of the slice `v`,
 /// or `None` if the vector is empty.
-pub fn head_opt<T>(v: &'r [T]) -> Option<&'r T> {
+pub fn head_opt<'r,T>(v: &'r [T]) -> Option<&'r T> {
     if v.len() == 0 { None } else { Some(&v[0]) }
 }
 
 /// Returns a vector containing all but the first element of a slice
-pub fn tail<T>(v: &'r [T]) -> &'r [T] { slice(v, 1, v.len()) }
+pub fn tail<'r,T>(v: &'r [T]) -> &'r [T] { slice(v, 1, v.len()) }
 
 /// Returns a vector containing all but the first `n` elements of a slice
-pub fn tailn<T>(v: &'r [T], n: uint) -> &'r [T] { slice(v, n, v.len()) }
+pub fn tailn<'r,T>(v: &'r [T], n: uint) -> &'r [T] { slice(v, n, v.len()) }
 
 /// Returns a vector containing all but the last element of a slice
-pub fn init<T>(v: &'r [T]) -> &'r [T] { slice(v, 0, v.len() - 1) }
+pub fn init<'r,T>(v: &'r [T]) -> &'r [T] { slice(v, 0, v.len() - 1) }
 
 /// Returns a vector containing all but the last `n' elements of a slice
-pub fn initn<T>(v: &'r [T], n: uint) -> &'r [T] {
+pub fn initn<'r,T>(v: &'r [T], n: uint) -> &'r [T] {
     slice(v, 0, v.len() - n)
 }
 
 /// Returns the last element of the slice `v`, failing if the slice is empty.
-pub fn last<T>(v: &'r [T]) -> &'r T {
+pub fn last<'r,T>(v: &'r [T]) -> &'r T {
     if v.len() == 0 { fail!(~"last: empty vector") }
     &v[v.len() - 1]
 }
 
 /// Returns `Some(x)` where `x` is the last element of the slice `v`, or
 /// `None` if the vector is empty.
-pub fn last_opt<T>(v: &'r [T]) -> Option<&'r T> {
+pub fn last_opt<'r,T>(v: &'r [T]) -> Option<&'r T> {
     if v.len() == 0 { None } else { Some(&v[v.len() - 1]) }
 }
 
 /// Return a slice that points into another slice.
 #[inline(always)]
-pub fn slice<T>(v: &'r [T], start: uint, end: uint) -> &'r [T] {
+pub fn slice<'r,T>(v: &'r [T], start: uint, end: uint) -> &'r [T] {
     fail_unless!(start <= end);
     fail_unless!(end <= len(v));
     do as_imm_buf(v) |p, _len| {
@@ -278,7 +278,8 @@ pub fn slice<T>(v: &'r [T], start: uint, end: uint) -> &'r [T] {
 
 /// Return a slice that points into another slice.
 #[inline(always)]
-pub fn mut_slice<T>(v: &'r mut [T], start: uint, end: uint) -> &'r mut [T] {
+pub fn mut_slice<'r,T>(v: &'r mut [T], start: uint, end: uint)
+                    -> &'r mut [T] {
     fail_unless!(start <= end);
     fail_unless!(end <= v.len());
     do as_mut_buf(v) |p, _len| {
@@ -292,8 +293,8 @@ pub fn mut_slice<T>(v: &'r mut [T], start: uint, end: uint) -> &'r mut [T] {
 
 /// Return a slice that points into another slice.
 #[inline(always)]
-pub fn const_slice<T>(v: &'r const [T], start: uint, end: uint)
-                   -> &'r const [T] {
+pub fn const_slice<'r,T>(v: &'r const [T], start: uint, end: uint)
+                      -> &'r const [T] {
     fail_unless!(start <= end);
     fail_unless!(end <= len(v));
     do as_const_buf(v) |p, _len| {
@@ -1343,7 +1344,7 @@ pub fn reversed<T:Copy>(v: &const [T]) -> ~[T] {
  * ~~~
  */
 #[inline(always)]
-pub fn each<T>(v: &'r [T], f: &fn(&'r T) -> bool) {
+pub fn each<'r,T>(v: &'r [T], f: &fn(&'r T) -> bool) {
     //             ^^^^
     // NB---this CANNOT be &const [T]!  The reason
     // is that you are passing it to `f()` using
@@ -1367,7 +1368,7 @@ pub fn each<T>(v: &'r [T], f: &fn(&'r T) -> bool) {
 /// a vector with mutable contents and you would like
 /// to mutate the contents as you iterate.
 #[inline(always)]
-pub fn each_mut<T>(v: &'r mut [T], f: &fn(elem: &'r mut T) -> bool) {
+pub fn each_mut<'r,T>(v: &'r mut [T], f: &fn(elem: &'r mut T) -> bool) {
     let mut i = 0;
     let n = v.len();
     while i < n {
@@ -1398,7 +1399,7 @@ pub fn each_const<T>(v: &const [T], f: &fn(elem: &const T) -> bool) {
  * Return true to continue, false to break.
  */
 #[inline(always)]
-pub fn eachi<T>(v: &'r [T], f: &fn(uint, v: &'r T) -> bool) {
+pub fn eachi<'r,T>(v: &'r [T], f: &fn(uint, v: &'r T) -> bool) {
     let mut i = 0;
     for each(v) |p| {
         if !f(i, p) { return; }
@@ -1412,7 +1413,7 @@ pub fn eachi<T>(v: &'r [T], f: &fn(uint, v: &'r T) -> bool) {
  * Return true to continue, false to break.
  */
 #[inline(always)]
-pub fn each_reverse<T>(v: &'r [T], blk: &fn(v: &'r T) -> bool) {
+pub fn each_reverse<'r,T>(v: &'r [T], blk: &fn(v: &'r T) -> bool) {
     eachi_reverse(v, |_i, v| blk(v))
 }
 
@@ -1422,7 +1423,7 @@ pub fn each_reverse<T>(v: &'r [T], blk: &fn(v: &'r T) -> bool) {
  * Return true to continue, false to break.
  */
 #[inline(always)]
-pub fn eachi_reverse<T>(v: &'r [T], blk: &fn(i: uint, v: &'r T) -> bool) {
+pub fn eachi_reverse<'r,T>(v: &'r [T], blk: &fn(i: uint, v: &'r T) -> bool) {
     let mut i = v.len();
     while i > 0 {
         i -= 1;
@@ -1560,7 +1561,7 @@ fn eq<T:Eq>(a: &[T], b: &[T]) -> bool {
 }
 
 #[cfg(notest)]
-impl<T:Eq> Eq for &'self [T] {
+impl<'self,T:Eq> Eq for &'self [T] {
     #[inline(always)]
     fn eq(&self, other: & &'self [T]) -> bool { eq((*self), (*other)) }
     #[inline(always)]
@@ -1585,7 +1586,7 @@ fn ne(&self, other: &@[T]) -> bool { !(*self).eq(other) }
 }
 
 #[cfg(notest)]
-impl<T:Eq> Equiv<~[T]> for &'self [T] {
+impl<'self,T:Eq> Equiv<~[T]> for &'self [T] {
     #[inline(always)]
     fn equiv(&self, other: &~[T]) -> bool { eq(*self, *other) }
 }
@@ -1607,7 +1608,7 @@ fn cmp<T: TotalOrd>(a: &[T], b: &[T]) -> Ordering {
 }
 
 #[cfg(notest)]
-impl<T: TotalOrd> TotalOrd for &'self [T] {
+impl<'self,T:TotalOrd> TotalOrd for &'self [T] {
     #[inline(always)]
     fn cmp(&self, other: & &'self [T]) -> Ordering { cmp(*self, *other) }
 }
@@ -1644,7 +1645,7 @@ fn ge<T:Ord>(a: &[T], b: &[T]) -> bool { !lt(a, b) }
 fn gt<T:Ord>(a: &[T], b: &[T]) -> bool { lt(b, a)  }
 
 #[cfg(notest)]
-impl<T:Ord> Ord for &'self [T] {
+impl<'self,T:Ord> Ord for &'self [T] {
     #[inline(always)]
     fn lt(&self, other: & &'self [T]) -> bool { lt((*self), (*other)) }
     #[inline(always)]
@@ -1685,7 +1686,7 @@ pub mod traits {
     use ops::Add;
     use vec::append;
 
-    impl<T:Copy> Add<&'self const [T],~[T]> for ~[T] {
+    impl<'self,T:Copy> Add<&'self const [T],~[T]> for ~[T] {
         #[inline(always)]
         fn add(&self, rhs: & &'self const [T]) -> ~[T] {
             append(copy *self, (*rhs))
@@ -1693,7 +1694,7 @@ fn add(&self, rhs: & &'self const [T]) -> ~[T] {
     }
 }
 
-impl<T> Container for &'self const [T] {
+impl<'self,T> Container for &'self const [T] {
     /// Returns true if a vector contains no elements
     #[inline]
     fn is_empty(&const self) -> bool { is_empty(*self) }
@@ -1708,7 +1709,7 @@ pub trait CopyableVector<T> {
 }
 
 /// Extension methods for vectors
-impl<T: Copy> CopyableVector<T> for &'self const [T] {
+impl<'self,T:Copy> CopyableVector<T> for &'self const [T] {
     /// Returns a copy of `v`.
     #[inline]
     fn to_owned(&self) -> ~[T] {
@@ -1747,7 +1748,7 @@ pub trait ImmutableVector<T> {
 }
 
 /// Extension methods for vectors
-impl<T> ImmutableVector<T> for &'self [T] {
+impl<'self,T> ImmutableVector<T> for &'self [T] {
     /// Return a slice that points into another slice.
     #[inline]
     fn slice(&self, start: uint, end: uint) -> &'self [T] {
@@ -1862,7 +1863,7 @@ pub trait ImmutableEqVector<T:Eq> {
     fn rposition_elem(&self, t: &T) -> Option<uint>;
 }
 
-impl<T:Eq> ImmutableEqVector<T> for &'self [T] {
+impl<'self,T:Eq> ImmutableEqVector<T> for &'self [T] {
     /**
      * Find the first index matching some predicate
      *
@@ -1907,7 +1908,7 @@ pub trait ImmutableCopyableVector<T> {
 }
 
 /// Extension methods for vectors
-impl<T:Copy> ImmutableCopyableVector<T> for &'self [T] {
+impl<'self,T:Copy> ImmutableCopyableVector<T> for &'self [T] {
     /**
      * Construct a new vector from the elements of a vector for which some
      * predicate holds.
@@ -2309,7 +2310,7 @@ pub fn copy_memory(dst: &mut [u8], src: &const [u8], count: uint) {
 // ___________________________________________________________________________
 // ITERATION TRAIT METHODS
 
-impl<A> iter::BaseIter<A> for &'self [A] {
+impl<'self,A> iter::BaseIter<A> for &'self [A] {
     #[inline(always)]
     fn each(&self, blk: &fn(v: &'self A) -> bool) { each(*self, blk) }
     #[inline(always)]
@@ -2332,7 +2333,7 @@ fn each(&self, blk: &fn(v: &'self A) -> bool) { each(*self, blk) }
     fn size_hint(&self) -> Option<uint> { Some(self.len()) }
 }
 
-impl<A> iter::MutableIter<A> for &'self mut [A] {
+impl<'self,A> iter::MutableIter<A> for &'self mut [A] {
     #[inline(always)]
     fn each_mut(&mut self, blk: &fn(v: &'self mut A) -> bool) {
         each_mut(*self, blk)
@@ -2355,7 +2356,7 @@ fn each_mut(&mut self, blk: &fn(v: &mut A) -> bool) {
     }
 }
 
-impl<A> iter::ExtendedIter<A> for &'self [A] {
+impl<'self,A> iter::ExtendedIter<A> for &'self [A] {
     pub fn eachi(&self, blk: &fn(uint, v: &A) -> bool) {
         iter::eachi(self, blk)
     }
@@ -2432,7 +2433,7 @@ fn flat_map_to_vec<B,IB:BaseIter<B>>(&self, op: &fn(&A) -> IB)
     }
 }
 
-impl<A:Eq> iter::EqIter<A> for &'self [A] {
+impl<'self,A:Eq> iter::EqIter<A> for &'self [A] {
     pub fn contains(&self, x: &A) -> bool { iter::contains(self, x) }
     pub fn count(&self, x: &A) -> uint { iter::count(self, x) }
 }
@@ -2449,7 +2450,7 @@ pub fn contains(&self, x: &A) -> bool { iter::contains(self, x) }
     pub fn count(&self, x: &A) -> uint { iter::count(self, x) }
 }
 
-impl<A:Copy> iter::CopyableIter<A> for &'self [A] {
+impl<'self,A:Copy> iter::CopyableIter<A> for &'self [A] {
     fn filter_to_vec(&self, pred: &fn(&A) -> bool) -> ~[A] {
         iter::filter_to_vec(self, pred)
     }
@@ -2481,7 +2482,7 @@ pub fn find(&self, f: &fn(&A) -> bool) -> Option<A> {
     }
 }
 
-impl<A:Copy + Ord> iter::CopyableOrderedIter<A> for &'self [A] {
+impl<'self,A:Copy + Ord> iter::CopyableOrderedIter<A> for &'self [A] {
     fn min(&self) -> A { iter::min(self) }
     fn max(&self) -> A { iter::max(self) }
 }
@@ -2498,7 +2499,7 @@ fn min(&self) -> A { iter::min(self) }
     fn max(&self) -> A { iter::max(self) }
 }
 
-impl<A:Copy> iter::CopyableNonstrictIter<A> for &'self [A] {
+impl<'self,A:Copy> iter::CopyableNonstrictIter<A> for &'self [A] {
     fn each_val(&const self, f: &fn(A) -> bool) {
         let mut i = 0;
         while i < self.len() {
index ffd7669c2d2eebe948cc339f9c888ac7393e5a48..d407cf216a88ec2f7d8452a67a7390e9353e43ca 100644 (file)
@@ -37,12 +37,12 @@ impl ValidUsage {
     }
 }
 
-enum Action {
+enum Action<'self> {
     Exec(&'self str),
     Call(&'self fn(args: &[~str]) -> ValidUsage)
 }
 
-enum UsageSource {
+enum UsageSource<'self> {
     UsgExec(&'self str),
     UsgStr(&'self str)
 }
index 5f74dcb27ac603d60e4a5a79075db23538982f8b..14b455651a571dcb2985c93ec6ca8b89dbc31098 100644 (file)
@@ -66,7 +66,7 @@ fn lookup_hash(d: ebml::Doc, eq_fn: &fn(x:&[u8]) -> bool, hash: uint) ->
     None
 }
 
-pub type GetCrateDataCb = &'self fn(ast::crate_num) -> cmd;
+pub type GetCrateDataCb<'self> = &'self fn(ast::crate_num) -> cmd;
 
 pub fn maybe_find_item(item_id: int, items: ebml::Doc) -> Option<ebml::Doc> {
     fn eq_item(bytes: &[u8], item_id: int) -> bool {
@@ -547,7 +547,7 @@ pub fn get_item_path(intr: @ident_interner, cdata: cmd, id: ast::node_id)
     item_path(intr, lookup_item(id, cdata.data))
 }
 
-pub type decode_inlined_item = &'self fn(
+pub type decode_inlined_item<'self> = &'self fn(
     cdata: @cstore::crate_metadata,
     tcx: ty::ctxt,
     path: ast_map::path,
index ad5b0274c0d5dac36926ba9b5e7dfac735889b8c..1e58ac5e94a84c5d2956dce68218bfaf7b7a282d 100644 (file)
@@ -21,7 +21,7 @@
 use core::result;
 use core::str;
 
-pub type pick<T> = &'self fn(path: &Path) -> Option<T>;
+pub type pick<'self, T> = &'self fn(path: &Path) -> Option<T>;
 
 pub fn pick_file(file: Path, path: &Path) -> Option<Path> {
     if path.file_path() == file { option::Some(copy *path) }
index 1eb82c6277eb56ee2737528a2e5418022f6f9426..8b88b39a84c23b5c40a4b4a82edcfd4ce0a4ce42 100644 (file)
@@ -49,7 +49,8 @@ pub enum DefIdSource {
     // Identifies a type parameter (`fn foo<X>() { ... }`).
     TypeParameter
 }
-type conv_did = &'self fn(source: DefIdSource, ast::def_id) -> ast::def_id;
+type conv_did<'self> =
+    &'self fn(source: DefIdSource, ast::def_id) -> ast::def_id;
 
 pub struct PState {
     data: @~[u8],
index 2ce47d8d0a17c0374166d4985d615ebebc9bd9f1..3056edea233fb431ce1669919db46059f21698b9 100644 (file)
@@ -63,7 +63,7 @@ fn preserve(&self,
     }
 }
 
-struct PreserveCtxt {
+struct PreserveCtxt<'self> {
     bccx: &'self BorrowckCtxt,
 
     // the region scope for which we must preserve the memory
index 5ead4f3a5278fcb440394ec232f7bdf13c5dae02..f2534bad58853dc7cf11db42514ec19a81358e2f 100644 (file)
@@ -311,7 +311,7 @@ fn LanguageItemCollector<'r>(crate: @crate,
     }
 }
 
-struct LanguageItemCollector {
+struct LanguageItemCollector<'self> {
     items: &'self mut LanguageItems,
 
     crate: @crate,
index a75ade0c585d3da0d101da2da5da35d94099503e..c6d9b5068dce4459daddf66662bc78538ea7dd9f 100644 (file)
@@ -889,14 +889,14 @@ fn is_camel_case(cx: ty::ctxt, ident: ast::ident) -> bool {
             !ident.contains_char('_')
     }
 
-    fn ident_without_trailing_underscores(ident: &'r str) -> &'r str {
+    fn ident_without_trailing_underscores<'r>(ident: &'r str) -> &'r str {
         match str::rfind(ident, |c| c != '_') {
             Some(idx) => str::slice(ident, 0, idx + 1),
             None => ident, // all underscores
         }
     }
 
-    fn ident_without_leading_underscores(ident: &'r str) -> &'r str {
+    fn ident_without_leading_underscores<'r>(ident: &'r str) -> &'r str {
         match str::find(ident, |c| c != '_') {
             Some(idx) => str::slice(ident, idx, ident.len()),
             None => ident // all underscores
index d4081352468da0072f1839128464194fc9ba0cf0..f324640ef2cf4e7c58e023026836ac69611f6ab2 100644 (file)
@@ -325,7 +325,7 @@ pub struct BindingInfo {
 
 pub type BindingsMap = LinearMap<ident, BindingInfo>;
 
-pub struct ArmData {
+pub struct ArmData<'self> {
     bodycx: block,
     arm: &'self ast::arm,
     bindings_map: BindingsMap
@@ -393,7 +393,7 @@ pub fn expand_nested_bindings<'r>(bcx: block,
     }
 }
 
-pub type enter_pat = &'self fn(@ast::pat) -> Option<~[@ast::pat]>;
+pub type enter_pat<'self> = &'self fn(@ast::pat) -> Option<~[@ast::pat]>;
 
 pub fn assert_is_binding_or_wild(bcx: block, p: @ast::pat) {
     if !pat_is_binding_or_wild(bcx.tcx().def_map, p) {
@@ -610,13 +610,13 @@ pub fn enter_opt<'r>(bcx: block,
     }
 }
 
-pub fn enter_rec_or_struct(bcx: block,
-                           dm: DefMap,
-                           m: &[@Match<'r>],
-                           col: uint,
-                           fields: &[ast::ident],
-                           val: ValueRef)
-                        -> ~[@Match<'r>] {
+pub fn enter_rec_or_struct<'r>(bcx: block,
+                               dm: DefMap,
+                               m: &[@Match<'r>],
+                               col: uint,
+                               fields: &[ast::ident],
+                               val: ValueRef)
+                            -> ~[@Match<'r>] {
     debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%?)",
            bcx.to_str(),
            matches_to_str(bcx, m),
index 7ba0b706e436e4ddee76ff72ffe6d971a8f91861..8a22e90b8474b37605e26738111814ba1c40a4a1 100644 (file)
@@ -560,7 +560,7 @@ pub fn trans_call_inner(
 }
 
 
-pub enum CallArgs {
+pub enum CallArgs<'self> {
     ArgExprs(&'self [@ast::expr]),
     ArgVals(&'self [ValueRef])
 }
index 5bb94a18e7227beec57524d25f186eba0d0e653d..30a7648e7eafb26f79b1c4e74a61d4cf5e6362bd 100644 (file)
@@ -547,7 +547,7 @@ pub fn get_base_and_len(bcx: block,
 
 pub type val_and_ty_fn = @fn(block, ValueRef, ty::t) -> Result;
 
-pub type iter_vec_block = &'self fn(block, ValueRef, ty::t) -> block;
+pub type iter_vec_block<'self> = &'self fn(block, ValueRef, ty::t) -> block;
 
 pub fn iter_vec_raw(bcx: block, data_ptr: ValueRef, vec_ty: ty::t,
                     fill: ValueRef, f: iter_vec_block) -> block {
index fcaf1c08342be22dfc68dfdcc82f38f370a245dd..aefd95ab78726a87b3372d156fd24a893103942a 100644 (file)
@@ -152,7 +152,7 @@ pub fn lookup(
     return mme;
 }
 
-pub struct LookupContext {
+pub struct LookupContext<'self> {
     fcx: @mut FnCtxt,
     expr: @ast::expr,
     self_expr: @ast::expr,
index 7e97edf8f8aa62000219f6f8c043cf940bfbc506..7089ac4dd1283885e57dd153491e7cf2a0cd4120 100644 (file)
@@ -566,10 +566,11 @@ fn universally_quantify_polytype(&self, polytype: ty_param_bounds_and_ty)
         }
     }
 
-    fn can_unify_universally_quantified(&self,
-                                        a: &'a UniversalQuantificationResult,
-                                        b: &'a UniversalQuantificationResult)
-                                     -> bool {
+    fn can_unify_universally_quantified<'a>
+            (&self,
+             a: &'a UniversalQuantificationResult,
+             b: &'a UniversalQuantificationResult)
+          -> bool {
         let mut might_unify = true;
         let _ = do self.inference_context.probe {
             let result = self.inference_context.sub(true, dummy_sp())
index a83d6f1755ecca254fac682df37196731e9b380d..27d3b3ddd86a16150a16554cbc74bc6b6ded9fff 100644 (file)
@@ -56,7 +56,8 @@ pub trait LatticeValue {
     fn glb(cf: &CombineFields, a: &Self, b: &Self) -> cres<Self>;
 }
 
-pub type LatticeOp<T> = &'self fn(cf: &CombineFields, a: &T, b: &T) -> cres<T>;
+pub type LatticeOp<'self, T> =
+    &'self fn(cf: &CombineFields, a: &T, b: &T) -> cres<T>;
 
 impl LatticeValue for ty::t {
     fn sub(cf: &CombineFields, a: &ty::t, b: &ty::t) -> ures {
@@ -374,7 +375,7 @@ pub fn super_lattice_tys<L:LatticeDir + TyLatticeDir + Combine>(
     }
 }
 
-pub type LatticeDirOp<T> = &'self fn(a: &T, b: &T) -> cres<T>;
+pub type LatticeDirOp<'self, T> = &'self fn(a: &T, b: &T) -> cres<T>;
 
 pub enum LatticeVarResult<V,T> {
     VarResult(V),
index 7711794d91db514a0dd29fe05ea21a16005206d9..f31568a50a365272d559409e8b86b5e727974523 100644 (file)
@@ -35,8 +35,8 @@ pub struct Node<V, T> {
 }
 
 pub trait UnifyVid<T> {
-    fn appropriate_vals_and_bindings(infcx: &'v mut InferCtxt)
-                                  -> &'v mut ValsAndBindings<Self, T>;
+    fn appropriate_vals_and_bindings<'v>(infcx: &'v mut InferCtxt)
+                                      -> &'v mut ValsAndBindings<Self, T>;
 }
 
 pub impl InferCtxt {
@@ -235,14 +235,14 @@ fn simple_var_t<T:Copy + Eq + InferStr + SimplyUnifiable,
 // ______________________________________________________________________
 
 impl UnifyVid<Bounds<ty::t>> for ty::TyVid {
-    fn appropriate_vals_and_bindings(infcx: &'v mut InferCtxt)
+    fn appropriate_vals_and_bindings<'v>(infcx: &'v mut InferCtxt)
         -> &'v mut ValsAndBindings<ty::TyVid, Bounds<ty::t>> {
         return &mut infcx.ty_var_bindings;
     }
 }
 
 impl UnifyVid<Option<IntVarValue>> for ty::IntVid {
-    fn appropriate_vals_and_bindings(infcx: &'v mut InferCtxt)
+    fn appropriate_vals_and_bindings<'v>(infcx: &'v mut InferCtxt)
         -> &'v mut ValsAndBindings<ty::IntVid, Option<IntVarValue>> {
         return &mut infcx.int_var_bindings;
     }
@@ -255,7 +255,7 @@ fn to_type_err(err: expected_found<IntVarValue>) -> ty::type_err {
 }
 
 impl UnifyVid<Option<ast::float_ty>> for ty::FloatVid {
-    fn appropriate_vals_and_bindings(infcx: &'v mut InferCtxt)
+    fn appropriate_vals_and_bindings<'v>(infcx: &'v mut InferCtxt)
         -> &'v mut ValsAndBindings<ty::FloatVid, Option<ast::float_ty>> {
         return &mut infcx.float_var_bindings;
     }
index b5793cc0abde28d644f6c1b1f9c80a8b145dd592..8f02b789121be221d276f907c576b1bcc0f5a4a7 100644 (file)
@@ -36,7 +36,7 @@ pub struct Ctxt {
     ast_map: ast_map::map
 }
 
-type SrvOwner<T> = &'self fn(srv: Srv) -> T;
+type SrvOwner<'self,T> = &'self fn(srv: Srv) -> T;
 pub type CtxtHandler<T> = ~fn(ctxt: Ctxt) -> T;
 type Parser = ~fn(Session, s: ~str) -> @ast::crate;
 
index d037acff0ede71369d8dbf18e71dc653949d6c59..02c50cc7c985811e2d09b5b2dba8fac05d869f35 100644 (file)
@@ -95,7 +95,7 @@ pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
  * Access the underlying data in an atomically reference counted
  * wrapper.
  */
-pub fn get<T:Const + Owned>(rc: &'a ARC<T>) -> &'a T {
+pub fn get<'a, T:Const + Owned>(rc: &'a ARC<T>) -> &'a T {
     unsafe { get_shared_immutable_state(&rc.x) }
 }
 
@@ -191,7 +191,7 @@ unsafe fn access<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
 
     /// As access(), but with a condvar, as sync::mutex.lock_cond().
     #[inline(always)]
-    unsafe fn access_cond<U>(
+    unsafe fn access_cond<'x, 'c, U>(
         &self,
         blk: &fn(x: &'x mut T, c: &'c Condvar) -> U) -> U
     {
@@ -239,7 +239,7 @@ fn finalize(&self) {
     }
 }
 
-fn PoisonOnFail(failed: &'r mut bool) -> PoisonOnFail {
+fn PoisonOnFail<'r>(failed: &'r mut bool) -> PoisonOnFail {
     PoisonOnFail {
         failed: ptr::to_mut_unsafe_ptr(failed)
     }
@@ -313,7 +313,9 @@ fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
     }
     /// As write(), but with a condvar, as sync::rwlock.write_cond().
     #[inline(always)]
-    fn write_cond<U>(&self, blk: &fn(x: &'x mut T, c: &'c Condvar) -> U) -> U {
+    fn write_cond<'x, 'c, U>(&self,
+                             blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
+                          -> U {
         unsafe {
             let state = get_shared_mutable_state(&self.x);
             do (*borrow_rwlock(state)).write_cond |cond| {
@@ -375,7 +377,7 @@ fn write_downgrade<U>(&self, blk: &fn(v: RWWriteMode<T>) -> U) -> U {
     }
 
     /// To be called inside of the write_downgrade block.
-    fn downgrade(&self, token: RWWriteMode<'a, T>) -> RWReadMode<'a, T> {
+    fn downgrade<'a>(&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 +422,7 @@ pub struct RWReadMode<'self, T> {
     token: sync::RWlockReadMode<'self>,
 }
 
-pub impl<T:Const + Owned> RWWriteMode<'self, T> {
+pub impl<'self, 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 {
@@ -436,7 +438,9 @@ fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
         }
     }
     /// Access the pre-downgrade RWARC in write mode with a condvar.
-    fn write_cond<U>(&self, blk: &fn(x: &'x mut T, c: &'c Condvar) -> U) -> U {
+    fn write_cond<'x, 'c, U>(&self,
+                             blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
+                          -> U {
         match *self {
             RWWriteMode {
                 data: ref data,
@@ -458,7 +462,7 @@ fn write_cond<U>(&self, blk: &fn(x: &'x mut T, c: &'c Condvar) -> U) -> U {
     }
 }
 
-pub impl<T:Const + Owned> RWReadMode<'self, T> {
+pub impl<'self, 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 {
index 02858de9b347fffca6015ef1a3e6a542e2771ce4..2267d19292cbc0b50f4ac10406ce94844cad57eb 100644 (file)
@@ -24,7 +24,7 @@ pub trait ToBase64 {
     '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
 ];
 
-impl ToBase64 for &'self [u8] {
+impl<'self> ToBase64 for &'self [u8] {
     fn to_base64(&self) -> ~str {
         let mut s = ~"";
         unsafe {
@@ -73,7 +73,7 @@ fn to_base64(&self) -> ~str {
     }
 }
 
-impl ToBase64 for &'self str {
+impl<'self> ToBase64 for &'self str {
     fn to_base64(&self) -> ~str {
         str::to_bytes(*self).to_base64()
     }
index e6fcbdc84c8771cc30697fe6e09437d0feb06d4d..72b68f8fe3aff3c0069809895e1c86b27d698b85 100644 (file)
@@ -132,7 +132,7 @@ fn grow<T>(nelts: uint, lo: uint, elts: &mut [Option<T>]) -> ~[Option<T>] {
     rv
 }
 
-fn get<T>(elts: &'r [Option<T>], i: uint) -> &'r T {
+fn get<'r, T>(elts: &'r [Option<T>], i: uint) -> &'r T {
     match elts[i] { Some(ref t) => t, _ => fail!() }
 }
 
index 01a7cbfe604fadd51ee06cdc4cb70d81c8ad2d48..1a3a28f7492794b72a589b7ed7e4b7c90c7abbb5 100644 (file)
@@ -466,7 +466,7 @@ pub trait FromWriter {
         fn from_writer(w: @Writer) -> Self;
     }
 
-    impl FromReader for json::Decoder<'self> {
+    impl<'self> FromReader for json::Decoder<'self> {
         fn from_reader(r: @Reader) -> json::Decoder<'self> {
             match json::from_reader(r) {
                 Ok(json) => {
index 8b8771e989a06dd8bd553b9837e6dd7c30716d9b..7c9b15bfded3871f1b3a7191cbce27a04b3595c5 100644 (file)
@@ -741,7 +741,7 @@ pub fn from_str(s: &str) -> Result<Json, Error> {
     }
 }
 
-pub struct Decoder {
+pub struct Decoder<'self> {
     priv json: Json,
     priv mut stack: ~[&'self Json],
 }
@@ -750,7 +750,7 @@ pub fn Decoder(json: Json) -> Decoder {
     Decoder { json: json, stack: ~[] }
 }
 
-priv impl Decoder<'self> {
+priv impl<'self> Decoder<'self> {
     fn peek(&self) -> &'self Json {
         if vec::uniq_len(&const self.stack) == 0 {
             self.stack.push(&self.json);
@@ -766,7 +766,7 @@ fn pop(&self) -> &'self Json {
     }
 }
 
-impl serialize::Decoder for Decoder<'self> {
+impl<'self> serialize::Decoder for Decoder<'self> {
     fn read_nil(&self) -> () {
         debug!("read_nil");
         match *self.pop() {
index d288c06d2935cfc9c295850755f56884f2ca3c54..326b9e4dc07e9abd75ed5b717afb8b2899accf69 100644 (file)
@@ -213,7 +213,7 @@ fn decode(d: &D) -> i64 {
     }
 }
 
-impl<S:Encoder> Encodable<S> for &'self str {
+impl<'self, S:Encoder> Encodable<S> for &'self str {
     fn encode(&self, s: &S) { s.emit_borrowed_str(*self) }
 }
 
@@ -286,7 +286,7 @@ fn decode(d: &D) -> () {
     }
 }
 
-impl<S:Encoder,T:Encodable<S>> Encodable<S> for &'self T {
+impl<'self, S:Encoder,T:Encodable<S>> Encodable<S> for &'self T {
     fn encode(&self, s: &S) {
         s.emit_borrowed(|| (**self).encode(s))
     }
@@ -316,7 +316,7 @@ fn decode(d: &D) -> @T {
     }
 }
 
-impl<S:Encoder,T:Encodable<S>> Encodable<S> for &'self [T] {
+impl<'self, S:Encoder,T:Encodable<S>> Encodable<S> for &'self [T] {
     fn encode(&self, s: &S) {
         do s.emit_borrowed_vec(self.len()) {
             for self.eachi |i, e| {
index 4ad8d38b072b15d48dc39397fd0336a7f46c2d60..16f7c0ba860be1e3b1097fcadad530de592d0b75 100644 (file)
@@ -22,7 +22,7 @@ pub struct SmallIntMap<T> {
     priv v: ~[Option<T>],
 }
 
-impl<V> BaseIter<(uint, &'self V)> for SmallIntMap<V> {
+impl<'self, V> BaseIter<(uint, &'self V)> for SmallIntMap<V> {
     /// Visit all key-value pairs in order
     fn each(&self, it: &fn(&(uint, &'self V)) -> bool) {
         for uint::range(0, self.v.len()) |i| {
@@ -36,7 +36,7 @@ fn each(&self, it: &fn(&(uint, &'self V)) -> bool) {
     fn size_hint(&self) -> Option<uint> { Some(self.len()) }
 }
 
-impl<V> ReverseIter<(uint, &'self V)> for SmallIntMap<V> {
+impl<'self, V> ReverseIter<(uint, &'self V)> for SmallIntMap<V> {
     /// Visit all key-value pairs in reverse order
     fn each_reverse(&self, it: &fn(&(uint, &'self V)) -> bool) {
         for uint::range_rev(self.v.len(), 0) |i| {
index 2d83c4bd9d0dd4b89fe49cb5246ca0ae011b7c7a..1588d688148d55b42c5239acc6ab30f89357f28b 100644 (file)
@@ -16,7 +16,7 @@
 use core::vec::{len, push};
 use core::vec;
 
-type Le<T> = &'self fn(v1: &T, v2: &T) -> bool;
+type Le<'self, T> = &'self fn(v1: &T, v2: &T) -> bool;
 
 /**
  * Merge sort. Returns a new vector containing the sorted list.
@@ -173,7 +173,7 @@ pub trait Sort {
     fn qsort(self);
 }
 
-impl<T:Copy + Ord + Eq> Sort for &'self mut [T] {
+impl<'self, T:Copy + Ord + Eq> Sort for &'self mut [T] {
     fn qsort(self) { quick_sort3(self); }
 }
 
@@ -1188,7 +1188,7 @@ fn isSorted<T:Ord>(arr: &const [@T]) {
         }
     }
 
-    struct LVal {
+    struct LVal<'self> {
         val: uint,
         key: &'self fn(@uint),
     }
@@ -1209,16 +1209,16 @@ fn finalize(&self) {
     }
 
     impl<'self> Ord for LVal<'self> {
-        fn lt(&self, other: &'a LVal<'self>) -> bool {
+        fn lt<'a>(&self, other: &'a LVal<'self>) -> bool {
             (*self).val < other.val
         }
-        fn le(&self, other: &'a LVal<'self>) -> bool {
+        fn le<'a>(&self, other: &'a LVal<'self>) -> bool {
             (*self).val <= other.val
         }
-        fn gt(&self, other: &'a LVal<'self>) -> bool {
+        fn gt<'a>(&self, other: &'a LVal<'self>) -> bool {
             (*self).val > other.val
         }
-        fn ge(&self, other: &'a LVal<'self>) -> bool {
+        fn ge<'a>(&self, other: &'a LVal<'self>) -> bool {
             (*self).val >= other.val
         }
     }
index cecf9686327d1aba329956572cd50acb97856433..04059a49511909e132acfc141c797026dee95e10 100644 (file)
@@ -30,7 +30,7 @@ pub trait Stats {
     fn median_abs_dev_pct(self) -> f64;
 }
 
-impl Stats for &'self [f64] {
+impl<'self> Stats for &'self [f64] {
     fn sum(self) -> f64 {
         vec::foldl(0.0, self, |p,q| p + *q)
     }
index 22ba33ba04e43b5be5c22fbfbd4a6f5a92838d0d..ea9455b1e981cc3a61df9d96412c5d8ec43eeb34 100644 (file)
@@ -162,12 +162,12 @@ fn access<U>(&self, blk: &fn() -> U) -> U {
 
 // FIXME(#3588) should go inside of access()
 #[doc(hidden)]
-type SemRelease = SemReleaseGeneric<'self, ()>;
-type SemAndSignalRelease = SemReleaseGeneric<'self, ~[Waitqueue]>;
-struct SemReleaseGeneric<Q> { sem: &'self Sem<Q> }
+type SemRelease<'self> = SemReleaseGeneric<'self, ()>;
+type SemAndSignalRelease<'self> = SemReleaseGeneric<'self, ~[Waitqueue]>;
+struct SemReleaseGeneric<'self, Q> { sem: &'self Sem<Q> }
 
 #[unsafe_destructor]
-impl<Q:Owned> Drop for SemReleaseGeneric<'self, Q> {
+impl<'self, Q:Owned> Drop for SemReleaseGeneric<'self, Q> {
     fn finalize(&self) {
         unsafe {
             self.sem.release();
@@ -175,14 +175,14 @@ fn finalize(&self) {
     }
 }
 
-fn SemRelease(sem: &'r Sem<()>) -> SemRelease<'r> {
+fn SemRelease<'r>(sem: &'r Sem<()>) -> SemRelease<'r> {
     SemReleaseGeneric {
         sem: sem
     }
 }
 
-fn SemAndSignalRelease(sem: &'r Sem<~[Waitqueue]>)
-                    -> SemAndSignalRelease<'r> {
+fn SemAndSignalRelease<'r>(sem: &'r Sem<~[Waitqueue]>)
+                        -> SemAndSignalRelease<'r> {
     SemReleaseGeneric {
         sem: sem
     }
@@ -194,7 +194,7 @@ pub struct Condvar<'self> { priv sem: &'self Sem<~[Waitqueue]> }
 #[unsafe_destructor]
 impl<'self> Drop for Condvar<'self> { fn finalize(&self) {} }
 
-pub impl Condvar<'self> {
+pub impl<'self> Condvar<'self> {
     /**
      * Atomically drop the associated lock, and block until a signal is sent.
      *
@@ -260,7 +260,7 @@ fn wait_on(&self, condvar_id: uint) {
         // This is needed for a failing condition variable to reacquire the
         // mutex during unwinding. As long as the wrapper (mutex, etc) is
         // bounded in when it gets released, this shouldn't hang forever.
-        struct SemAndSignalReacquire {
+        struct SemAndSignalReacquire<'self> {
             sem: &'self Sem<~[Waitqueue]>,
         }
 
@@ -276,8 +276,8 @@ fn finalize(&self) {
             }
         }
 
-        fn SemAndSignalReacquire(sem: &'r Sem<~[Waitqueue]>)
-                              -> SemAndSignalReacquire<'r> {
+        fn SemAndSignalReacquire<'r>(sem: &'r Sem<~[Waitqueue]>)
+                                  -> SemAndSignalReacquire<'r> {
             SemAndSignalReacquire {
                 sem: sem
             }
@@ -615,7 +615,7 @@ fn downgrade<'a>(&self,
 
 // FIXME(#3588) should go inside of read()
 #[doc(hidden)]
-struct RWlockReleaseRead {
+struct RWlockReleaseRead<'self> {
     lock: &'self RWlock,
 }
 
@@ -651,7 +651,7 @@ fn RWlockReleaseRead<'r>(lock: &'r RWlock) -> RWlockReleaseRead<'r> {
 // FIXME(#3588) should go inside of downgrade()
 #[doc(hidden)]
 #[unsafe_destructor]
-struct RWlockReleaseDowngrade {
+struct RWlockReleaseDowngrade<'self> {
     lock: &'self RWlock,
 }
 
@@ -699,7 +699,7 @@ pub struct RWlockWriteMode<'self> { priv lock: &'self RWlock }
 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 }
+pub struct RWlockReadMode<'self> { priv lock: &'self RWlock }
 #[unsafe_destructor]
 impl<'self> Drop for RWlockReadMode<'self> { fn finalize(&self) {} }
 
index fccf58ddb6f74a79b81553acc6fd9ccddcba30a0..9a184ca86823441f66a9b9199d47f3464d78a3ec 100644 (file)
@@ -198,7 +198,7 @@ fn iter(&self) -> TreeMapIterator<'self, K, V> {
 }
 
 /// Lazy forward iterator over a map
-pub struct TreeMapIterator<K, V> {
+pub struct TreeMapIterator<'self, K, V> {
     priv stack: ~[&'self ~TreeNode<K, V>],
     priv node: &'self Option<~TreeNode<K, V>>
 }
@@ -537,24 +537,25 @@ fn new(key: K, value: V) -> TreeNode<K, V> {
     }
 }
 
-fn each<K: TotalOrd, V>(node: &'r Option<~TreeNode<K, V>>,
-                             f: &fn(&(&'r K, &'r V)) -> bool) {
+fn each<'r, K: TotalOrd, V>(node: &'r Option<~TreeNode<K, V>>,
+                            f: &fn(&(&'r K, &'r V)) -> bool) {
     for node.each |x| {
         each(&x.left, f);
         if f(&(&x.key, &x.value)) { each(&x.right, f) }
     }
 }
 
-fn each_reverse<K: TotalOrd, V>(node: &'r Option<~TreeNode<K, V>>,
-                                     f: &fn(&(&'r K, &'r V)) -> bool) {
+fn each_reverse<'r, K: TotalOrd, V>(node: &'r Option<~TreeNode<K, V>>,
+                                    f: &fn(&(&'r K, &'r V)) -> bool) {
     for node.each |x| {
         each_reverse(&x.right, f);
         if f(&(&x.key, &x.value)) { each_reverse(&x.left, f) }
     }
 }
 
-fn mutate_values<K: TotalOrd, V>(node: &'r mut Option<~TreeNode<K, V>>,
-                                 f: &fn(&'r K, &'r mut V) -> bool) -> bool {
+fn mutate_values<'r, K: TotalOrd, V>(node: &'r mut Option<~TreeNode<K, V>>,
+                                     f: &fn(&'r K, &'r mut V) -> bool)
+                                  -> bool {
     match *node {
       Some(~TreeNode{key: ref key, value: ref mut value, left: ref mut left,
                      right: ref mut right, _}) => {
@@ -590,7 +591,9 @@ fn split<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>) {
     }
 }
 
-fn find_mut<K: TotalOrd, V>(node: &'r mut Option<~TreeNode<K, V>>, key: &K) -> Option<&'r mut V> {
+fn find_mut<'r, K: TotalOrd, V>(node: &'r mut Option<~TreeNode<K, V>>,
+                                key: &K)
+                             -> Option<&'r mut V> {
     match *node {
       Some(ref mut x) => {
         match key.cmp(&x.key) {
index bef88e58a1795877808c77076a278dd96cc64e31..6071cc643a36770867f0c96cb609bbe15afd841a 100644 (file)
@@ -892,6 +892,7 @@ fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
 pub struct TyClosure {
     sigil: Sigil,
     region: Option<@Lifetime>,
+    lifetimes: OptVec<Lifetime>,
     purity: purity,
     onceness: Onceness,
     decl: fn_decl
index 57fddd623d4745f0695d1cc5f32cee6331cb78b7..e879bcdc4764f438412e61872f279a3c5b396b0a 100644 (file)
 pub mod eq;
 pub mod iter_bytes;
 
-type ExpandDerivingStructDefFn = &'self fn(@ext_ctxt,
-                                          span,
-                                          x: &struct_def,
-                                          ident,
-                                          y: &Generics) -> @item;
-type ExpandDerivingEnumDefFn = &'self fn(@ext_ctxt,
-                                        span,
-                                        x: &enum_def,
-                                        ident,
-                                        y: &Generics) -> @item;
+type ExpandDerivingStructDefFn<'self> = &'self fn(@ext_ctxt,
+                                                  span,
+                                                  x: &struct_def,
+                                                  ident,
+                                                  y: &Generics)
+                                               -> @item;
+type ExpandDerivingEnumDefFn<'self> = &'self fn(@ext_ctxt,
+                                                span,
+                                                x: &enum_def,
+                                                ident,
+                                                y: &Generics)
+                                             -> @item;
 
 pub fn expand_meta_deriving(cx: @ext_ctxt,
                             _span: span,
index b3974acc6741a08825cc2e856c1ebc349b0d35ab..017e95ab4c11cf4ace2fb66671f0b4583d108eb7 100644 (file)
@@ -609,7 +609,8 @@ fn fold_field(f: ty_field, fld: @ast_fold) -> ty_field {
                 purity: f.purity,
                 region: f.region,
                 onceness: f.onceness,
-                decl: fold_fn_decl(&f.decl, fld)
+                decl: fold_fn_decl(&f.decl, fld),
+                lifetimes: f.lifetimes,
             })
         }
         ty_bare_fn(ref f) => {
index 962607ffec429d1e6b15279eb833bf83abd59acb..cc0196d18deb49c64e818858ecd9d2e3691d1e6a 100644 (file)
@@ -362,10 +362,11 @@ fn parse_ty_bare_fn(&self) -> ty_
 
         let purity = self.parse_purity();
         self.expect_keyword(&~"fn");
+        let (decl, _) = self.parse_ty_fn_decl();
         return ty_bare_fn(@TyBareFn {
             abi: RustAbi,
             purity: purity,
-            decl: self.parse_ty_fn_decl()
+            decl: decl
         });
     }
 
@@ -400,12 +401,15 @@ fn parse_ty_closure(&self,
                           ObsoletePostFnTySigil);
         }
 
+        let (decl, lifetimes) = self.parse_ty_fn_decl();
+
         return ty_closure(@TyClosure {
             sigil: sigil,
             region: region,
             purity: purity,
             onceness: onceness,
-            decl: self.parse_ty_fn_decl()
+            decl: decl,
+            lifetimes: lifetimes,
         });
 
         fn parse_onceness(self: &Parser) -> Onceness {
@@ -424,7 +428,7 @@ fn parse_purity(&self) -> purity {
         }
     }
 
-    fn parse_ty_fn_decl(&self) -> fn_decl {
+    fn parse_ty_fn_decl(&self) -> (fn_decl, OptVec<ast::Lifetime>) {
         /*
 
         (fn) <'lt> (S) -> T
@@ -435,10 +439,14 @@ fn parse_ty_fn_decl(&self) -> fn_decl {
            Lifetimes
 
         */
-        if self.eat(&token::LT) {
-            let _lifetimes = self.parse_lifetimes();
+        let lifetimes = if self.eat(&token::LT) {
+            let lifetimes = self.parse_lifetimes();
             self.expect_gt();
-        }
+            lifetimes
+        } else {
+            opt_vec::Empty
+        };
+
         let inputs = self.parse_unspanned_seq(
             &token::LPAREN,
             &token::RPAREN,
@@ -446,7 +454,12 @@ fn parse_ty_fn_decl(&self) -> fn_decl {
             |p| p.parse_arg_general(false)
         );
         let (ret_style, ret_ty) = self.parse_ret_ty();
-        ast::fn_decl { inputs: inputs, output: ret_ty, cf: ret_style }
+        let decl = ast::fn_decl {
+            inputs: inputs,
+            output: ret_ty,
+            cf: ret_style
+        };
+        (decl, lifetimes)
     }
 
     fn parse_trait_methods(&self) -> ~[trait_method] {
index 9fe7ae40dbbc3db47fe1bad7c77f4b4f6462f8e7..90b9b44cfbea38b275d3e119ced5fe53142ec7c8 100644 (file)
@@ -18,7 +18,7 @@ trait Stuff {
     fn printme(self);
 }
 
-impl Stuff for &'self mut Foo {
+impl<'self> Stuff for &'self mut Foo {
     fn printme(self) {
         io::println(fmt!("%d", self.x));
     }
index 609e8de87d68b58cf3229c07baf90f71592f802e..d8164be6ea63cbdeb43492fedaadd289c4f12989 100644 (file)
@@ -23,6 +23,6 @@ trait MyIter {
     fn test_mut(&mut self);
 }
 
-impl MyIter for &'self [int] {
+impl<'self> MyIter for &'self [int] {
     fn test_mut(&mut self) { }
 }
index fe7b29cf9a8680f0ddadcf74492c76ae8e0744c8..4a6a90ae5167f1ebecb9b64e0756a60cdd9fd061 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct defer {
+struct defer<'self> {
     x: &'self [&'self str],
 }
 
 #[unsafe_destructor]
-impl Drop for defer<'self> {
+impl<'self> Drop for defer<'self> {
     fn finalize(&self) {
         unsafe {
             error!("%?", self.x);
@@ -21,7 +21,7 @@ fn finalize(&self) {
     }
 }
 
-fn defer(x: &'r [&'r str]) -> defer<'r> {
+fn defer<'r>(x: &'r [&'r str]) -> defer<'r> {
     defer {
         x: x
     }
index bf130addb6bf6fb057d28a653adba25854d7795a..e42382fc2aa484f3863709f32bb7f04c8403b5fc 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct boxedFn { theFn: &'self fn() -> uint }
+struct boxedFn<'self> { theFn: &'self fn() -> uint }
 
 fn createClosure (closedUint: uint) -> boxedFn {
     let theFn: @fn() -> uint = || closedUint;
index 615bf64eed54e1456c8f73a03d0c3d94d39734bb..bcbf90b660eff7b674de88ba65658ab5d26f81e4 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct thing<Q> {
+struct thing<'self, Q> {
     x: &'self Q
 }
 
index 295b6c989b5f3028b33efa0e287319a35d2c8fc1..67059e4623e8f836bdc8f72dd3c9ec4a335d1aaa 100644 (file)
@@ -9,12 +9,12 @@
 // except according to those terms.
 
 #[legacy_mode]
-struct Foo {
+struct Foo<'self> {
     s: &'self str,
     u: ~()
 }
 
-pub impl Foo<'self> {
+pub impl<'self> Foo<'self> {
     fn get_s(&self) -> &'self str {
         self.s
     }
index c9a5507f8de0fb5a0f7bf9de92143ced1ec775af..d9ea384d820c41349f3a55fed3c17813d6af2790 100644 (file)
@@ -10,7 +10,7 @@
 
 // n.b. This should be a run-pass test, but for now I'm testing
 // that we don't see an "unknown scope" error.
-fn vec_peek<T>(v: &'r [T]) -> Option< (&'r T, &'r [T]) > {
+fn vec_peek<'r, T>(v: &'r [T]) -> Option< (&'r T, &'r [T]) > {
     if v.len() == 0 {
         None
     } else {
index 86262008ff943246e72c0dba4199fb4dd10b68d7..857b53a2c226e5471dc8df18a5c0e226cbaccc33 100644 (file)
@@ -12,6 +12,6 @@
 
 fn main() {
     fn bar(n: int) {
-        let _x: [int * n]; //~ ERROR expected constant expr for vector length: Non-constant path in constant expr
+        let _x: [int, ..n]; //~ ERROR expected constant expr for vector length: Non-constant path in constant expr
     }
 }
index 3821035a0f6e3d24e52d66607e942a01a4643caa..cccd135e9f8367e1855aecee55d2d5a61d82d7fb 100644 (file)
 // nominal types (but not on other types) and that they are type
 // checked.
 
-struct an_enum(&'self int);
-struct a_class { x:&'self int }
+struct an_enum<'self>(&'self int);
+struct a_class<'self> { x:&'self int }
 
-fn a_fn1(e: an_enum<'a>) -> an_enum<'b> {
+fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> {
     return e; //~ ERROR mismatched types: expected `an_enum/&'b ` but found `an_enum/&'a `
 }
 
-fn a_fn3(e: a_class<'a>) -> a_class<'b> {
+fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> {
     return e; //~ ERROR mismatched types: expected `a_class/&'b ` but found `a_class/&'a `
 }
 
-fn a_fn4(e: int<'a>) -> int<'b> {
+fn a_fn4<'a,'b>(e: int<'a>) -> int<'b> {
     //~^ ERROR region parameters are not allowed on this type
     //~^^ ERROR region parameters are not allowed on this type
     return e;
index 88f2eefd369052fd72cd1ca940e31f4c576e8817..7a8038bbb887a98273c57acf9c9c445933b1d510 100644 (file)
@@ -10,7 +10,7 @@
 
 #[legacy_modes];
 
-enum ast {
+enum ast<'self> {
     num(uint),
     add(&'self ast<'self>, &'self ast<'self>)
 }
index de0f18392e643e20990f8540f9683e718bdef5d1..08243bace90af53315b6986dd882e9e4d8c3de01 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-enum ast {
+enum ast<'self> {
     num(uint),
     add(&'self ast<'self>, &'self ast<'self>)
 }
 
-fn mk_add_bad1(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> {
+fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> {
     add(x, y) //~ ERROR cannot infer an appropriate lifetime
 }
 
index d9a6c48fa27e5ea45e7ec0b90a2b16f541528113..1cb378cf406f84c9c9f7a2aec2a81b0d49e57b15 100644 (file)
@@ -13,7 +13,7 @@ enum ast<'self> {
     add(&'self ast<'self>, &'self ast<'self>)
 }
 
-fn mk_add_bad2(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast {
+fn mk_add_bad2<'a>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast {
     add(x, y)
          //~^ ERROR cannot infer an appropriate lifetime
 }
index 1b737c273dbf0266a8915977c92d4f6e640c3f31..fb9d963dc80a7b475514c2df2b9468769c54fb1d 100644 (file)
@@ -12,7 +12,7 @@ trait deref {
     fn get(self) -> int;
 }
 
-impl deref for &'self int {
+impl<'self> deref for &'self int {
     fn get(self) -> int {
         *self
     }
index a90b3d0f42970450df9197ba54f8ecdbc0564dee..face9c742141d97e441f05c082f7d262ebcdcc58 100644 (file)
 fn of<T>() -> @fn(T) { fail!(); }
 fn subtype<T>(x: @fn(T)) { fail!(); }
 
-fn test_fn<T>(_x: &'x T, _y: &'y T, _z: &'z T) {
+fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) {
     // Here, x, y, and z are free.  Other letters
     // are bound.  Note that the arrangement
     // subtype::<T1>(of::<T2>()) will typecheck
     // iff T1 <: T2.
 
-    subtype::<&fn(&'a T)>(
-        of::<&fn(&'a T)>());
+    subtype::<&fn<'a>(&'a T)>(
+        of::<&fn<'a>(&'a T)>());
 
-    subtype::<&fn(&'a T)>(
-        of::<&fn(&'b T)>());
+    subtype::<&fn<'a>(&'a T)>(
+        of::<&fn<'b>(&'b T)>());
 
-    subtype::<&fn(&'b T)>(
-        of::<&fn(&'x T)>());
+    subtype::<&fn<'b>(&'b T)>(
+        of::<&fn<'x>(&'x T)>());
 
-    subtype::<&fn(&'x T)>(
-        of::<&fn(&'b T)>());  //~ ERROR mismatched types
+    subtype::<&fn<'x>(&'x T)>(
+        of::<&fn<'b>(&'b T)>());  //~ ERROR mismatched types
 
-    subtype::<&fn(&'a T, &'b T)>(
-        of::<&fn(&'a T, &'a T)>());
+    subtype::<&fn<'a,'b>(&'a T, &'b T)>(
+        of::<&fn<'a>(&'a T, &'a T)>());
 
-    subtype::<&fn(&'a T, &'a T)>(
-        of::<&fn(&'a T, &'b T)>()); //~ ERROR mismatched types
+    subtype::<&fn<'a>(&'a T, &'a T)>(
+        of::<&fn<'a,'b>(&'a T, &'b T)>()); //~ ERROR mismatched types
 
-    subtype::<&fn(&'a T, &'b T)>(
-        of::<&fn(&'x T, &'y T)>());
+    subtype::<&fn<'a,'b>(&'a T, &'b T)>(
+        of::<&fn<'x,'y>(&'x T, &'y T)>());
 
-    subtype::<&fn(&'x T, &'y T)>(
-        of::<&fn(&'a T, &'b T)>()); //~ ERROR mismatched types
+    subtype::<&fn<'x,'y>(&'x T, &'y T)>(
+        of::<&fn<'a,'b>(&'a T, &'b T)>()); //~ ERROR mismatched types
 
-    subtype::<&fn(&'x T) -> @fn(&'a T)>(
-        of::<&fn(&'x T) -> @fn(&'a T)>());
+    subtype::<&fn<'x,'a>(&'x T) -> @fn(&'a T)>(
+        of::<&fn<'x,'a>(&'x T) -> @fn(&'a T)>());
 
-    subtype::<&fn(&'a T) -> @fn(&'a T)>(
-        of::<&fn(&'a T) -> @fn(&'b T)>()); //~ ERROR mismatched types
+    subtype::<&fn<'a>(&'a T) -> @fn(&'a T)>(
+        of::<&fn<'a,'b>(&'a T) -> @fn(&'b T)>()); //~ ERROR mismatched types
 
-    subtype::<&fn(&'a T) -> @fn(&'a T)>(
-        of::<&fn(&'x T) -> @fn(&'b T)>()); //~ ERROR mismatched types
+    subtype::<&fn<'a>(&'a T) -> @fn(&'a T)>(
+        of::<&fn<'x,'b>(&'x T) -> @fn(&'b T)>()); //~ ERROR mismatched types
 
-    subtype::<&fn(&'a T) -> @fn(&'b T)>(
-        of::<&fn(&'a T) -> @fn(&'a T)>());
+    subtype::<&fn<'a,'b>(&'a T) -> @fn(&'b T)>(
+        of::<&fn<'a>(&'a T) -> @fn(&'a T)>());
 }
 
 fn main() {}
index 50eba71ac564795b719150a6bc1d34f6b64ade5d..4f6cbdfdd6556bbb6e08622405b97fe0bc124588 100644 (file)
@@ -11,7 +11,7 @@
 // Before fn subtyping was properly implemented,
 // we reported errors in this case:
 
-fn not_ok(a: &uint, b: &'b uint) {
+fn not_ok<'b>(a: &uint, b: &'b uint) {
     let mut g: @fn(x: &uint) = |x: &'b uint| {};
     //~^ ERROR mismatched types
     g(a);
index f5e304dbe722c51c7e174aee637456992ff3562c..1ae97d690ac242bb4a7310d756d038fccfc4e938 100644 (file)
@@ -18,11 +18,11 @@ pub struct Flag<'self> {
         value: uint
     }
 
-    pub fn flag(name: &'r str, desc: &'r str) -> Flag<'r> {
+    pub fn flag<'r>(name: &'r str, desc: &'r str) -> Flag<'r> {
         Flag { name: name, desc: desc, max_count: 1, value: 0 }
     }
 
-    pub impl Flag<'self> {
+    pub impl<'self> Flag<'self> {
         fn set_desc(self, s: &str) -> Flag<'self> {
             Flag { //~ ERROR cannot infer an appropriate lifetime
                 name: self.name,
index 0adfaccdc017420fcfb91f4676bcf9744ee5c6ab..0111be367c228d773afb1bc024f2fdae5177ad26 100644 (file)
 
 enum yes0<'lt> {
     // This will eventually be legal (and in fact the only way):
-    X3(&'lt uint) //~ ERROR Illegal lifetime 'lt: only 'self is allowed allowed as part of a type declaration
+    X3(&'lt uint) //~ ERROR Illegal lifetime 'lt: this lifetime must be declared
 }
 
-enum yes1 {
+enum yes1<'self> {
     X4(&'self uint)
 }
 
 enum yes2 {
-    X5(&'foo uint) //~ ERROR Illegal lifetime 'foo: only 'self is allowed allowed as part of a type declaration
+    X5(&'foo uint) //~ ERROR Illegal lifetime 'foo: this lifetime must be declared
 }
 
 fn main() {}
index b425a40114a3d038aa6859d1eb9643d6c3dfa1d1..977c9fc55196c009d418d1993f217e6b4601732d 100644 (file)
@@ -17,7 +17,7 @@ struct yes1<'self> {
 }
 
 struct yes2<'self> {
-  x: &'foo uint, //~ ERROR Illegal lifetime 'foo: only 'self is allowed allowed as part of a type declaration
+  x: &'foo uint, //~ ERROR Illegal lifetime 'foo: this lifetime must be declared
 }
 
 fn main() {}
index 2a72744c9b6fe50ef4bec845218ce73e2d8ba03c..65bc64815b61a04f4ec48ad778e9c540392fe832 100644 (file)
@@ -8,16 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct item_ty_yes0 {
+struct item_ty_yes0<'self> {
     x: &'self uint
 }
 
-struct item_ty_yes1 {
+struct item_ty_yes1<'self> {
     x: &'self uint
 }
 
 struct item_ty_yes2 {
-    x: &'a uint //~ ERROR only 'self is allowed
+    x: &'a uint //~ ERROR this lifetime must be declared
 }
 
 fn main() {}
index bde0e3f80c0fdb2e1735da92c5dfca4fa2e2749b..c8813b73e6b3adad0e243e2cd80cb3d50e6da6dc 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct parameterized1 {
+struct parameterized1<'self> {
     g: &'self fn()
 }
 
index 6402982a9e1541ff14454c51c23e5de1a200a9c3..7e96ecd4142a7d30fc28f67d55437b605880fc4f 100644 (file)
@@ -13,7 +13,7 @@ struct point {
     y: int,
 }
 
-fn x_coord(p: &'r point) -> &'r int {
+fn x_coord<'r>(p: &'r point) -> &'r int {
     return &p.x;
 }
 
index c873e2519bd020f7db6041384067a58f5157e748..d982d3c95a5789157f0862273bc4ba41eb967192 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn borrow<T>(x: &'r T) -> &'r T {x}
+fn borrow<'r, T>(x: &'r T) -> &'r T {x}
 
 fn foo(cond: &fn() -> bool, box: &fn() -> @int) {
     let mut y: &int;
index a3bc55228d853cba082b917e4b0fd9e72a27843f..585b56d5a420b38b465ab565a40a699f9019a3e0 100644 (file)
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn select(x: &'r int, y: &'r int) -> &'r int { x }
+fn select<'r>(x: &'r int, y: &'r int) -> &'r int { x }
 
 fn with<T>(f: &fn(x: &int) -> T) -> T {
     f(&20)
 }
 
-fn manip(x: &'a int) -> int {
+fn manip<'a>(x: &'a int) -> int {
     let z = do with |y| { select(x, y) };
     //~^ ERROR cannot infer an appropriate lifetime
     *z
index 0b7477a30989e55915c57e46ceb1a885e832b298..83e39ebd9f4d022ae3a016f5e67934fba7bbfb9c 100644 (file)
@@ -8,19 +8,19 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct contravariant {
+struct contravariant<'self> {
     f: &'self int
 }
 
-fn to_same_lifetime(bi: contravariant<'r>) {
+fn to_same_lifetime<'r>(bi: contravariant<'r>) {
     let bj: contravariant<'r> = bi;
 }
 
-fn to_shorter_lifetime(bi: contravariant<'r>) {
+fn to_shorter_lifetime<'r>(bi: contravariant<'r>) {
     let bj: contravariant<'blk> = bi;
 }
 
-fn to_longer_lifetime(bi: contravariant<'r>) -> contravariant<'static> {
+fn to_longer_lifetime<'r>(bi: contravariant<'r>) -> contravariant<'static> {
     bi //~ ERROR mismatched types
 }
 
index c92d770b1b6e49cdbd80fa1b7de9d2b5261016d3..85cc6e6ce24877b83fe3570ff5b271962574a636 100644 (file)
@@ -12,7 +12,7 @@
 //
 // You can upcast to a *larger region* but not a smaller one.
 
-struct covariant {
+struct covariant<'self> {
     f: @fn(x: &'self int) -> int
 }
 
index b1d0249380f46e8729aa9783399bc4ae5b5ca81a..a5eeb83989f8225bc8ea27204bcaa397e60fc567 100644 (file)
@@ -8,19 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct invariant {
+struct invariant<'self> {
     f: @mut &'self int
 }
 
-fn to_same_lifetime(bi: invariant<'r>) {
+fn to_same_lifetime<'r>(bi: invariant<'r>) {
     let bj: invariant<'r> = bi;
 }
 
-fn to_shorter_lifetime(bi: invariant<'r>) {
-    let bj: invariant<'blk> = bi; //~ ERROR mismatched types
-}
-
-fn to_longer_lifetime(bi: invariant<'r>) -> invariant<'static> {
+fn to_longer_lifetime<'r>(bi: invariant<'r>) -> invariant<'static> {
     bi //~ ERROR mismatched types
 }
 
index ae62ef6f39a264c3d3d03feb371c49841e887d54..8adf353bb82f6077a98983ae8ddcbae8758d6380 100644 (file)
@@ -12,15 +12,11 @@ struct invariant<'self> {
     f: @mut [&'self int]
 }
 
-fn to_same_lifetime(bi: invariant<'r>) {
+fn to_same_lifetime<'r>(bi: invariant<'r>) {
     let bj: invariant<'r> = bi;
 }
 
-fn to_shorter_lifetime(bi: invariant<'r>) {
-    let bj: invariant<'blk> = bi; //~ ERROR mismatched types
-}
-
-fn to_longer_lifetime(bi: invariant<'r>) -> invariant<'static> {
+fn to_longer_lifetime<'r>(bi: invariant<'r>) -> invariant<'static> {
     bi //~ ERROR mismatched types
 }
 
index 4c9d397f971dae7be2931a7d6b1ba3fe0aeeb476..92447c1ef8d4571f13c83d5a9be5420c83c21b21 100644 (file)
@@ -16,11 +16,7 @@ fn to_same_lifetime<'r>(bi: invariant<'r>) {
     let bj: invariant<'r> = bi;
 }
 
-fn to_shorter_lifetime(bi: invariant<'r>) {
-    let bj: invariant<'blk> = bi; //~ ERROR mismatched types
-}
-
-fn to_longer_lifetime(bi: invariant<'r>) -> invariant<'static> {
+fn to_longer_lifetime<'r>(bi: invariant<'r>) -> invariant<'static> {
     bi //~ ERROR mismatched types
 }
 
index 6789476974b7a1209b8cf00e17bcd6377d965ee7..61adba3aec13457c063c80f5abf4c3b29309a070 100644 (file)
@@ -12,15 +12,11 @@ struct invariant<'self> {
     f: @fn() -> @mut &'self int
 }
 
-fn to_same_lifetime(bi: invariant<'r>) {
+fn to_same_lifetime<'r>(bi: invariant<'r>) {
     let bj: invariant<'r> = bi;
 }
 
-fn to_shorter_lifetime(bi: invariant<'r>) {
-    let bj: invariant<'blk> = bi; //~ ERROR mismatched types
-}
-
-fn to_longer_lifetime(bi: invariant<'r>) -> invariant<'static> {
+fn to_longer_lifetime<'r>(bi: invariant<'r>) -> invariant<'static> {
     bi //~ ERROR mismatched types
 }
 
index 26d6bbd5303142bc368758c3410f59eb7c0577fd..2e9a4eb141037ae88d2568a871b23bedb62b0453 100644 (file)
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn ignore<T>(_t: T) {}
+fn ignore(_f: &fn<'z>(&'z int) -> &'z int) {}
 
 fn nested() {
     let y = 3;
-    ignore(|z: &'z int| -> &'z int {
+    ignore(|z| {
         if false { &y } else { z } //~ ERROR illegal borrow
     });
 }
index 6ef37efeb418e1ef5a2d42e9416626cc33b3078d..3089c362a5044caceaad52b893499316e0e78b1e 100644 (file)
 
 fn ignore<T>(t: T) {}
 
-fn nested(x: &'x int) {
+fn nested<'x>(x: &'x int) {
     let y = 3;
     let mut ay = &y; //~ ERROR cannot infer an appropriate lifetime
 
-    ignore(|z: &'z int| {
+    ignore::<&fn<'z>(&'z int)>(|z| {
         ay = x;
         ay = &y;  //~ ERROR cannot infer an appropriate lifetime
         ay = z;
     });
 
-    ignore(|z: &'z int| -> &'z int {
+    ignore::<&fn<'z>(&'z int) -> &'z int>(|z| {
         if false { return x; }  //~ ERROR mismatched types
         if false { return ay; }
         return z;
index 7218dcf379b95e48ac52db33e077bf025c82dfac..f916b0d95c2ee7f57131b4a94f7b8a79d4e20732 100644 (file)
 // some point regions-ret-borrowed reported an error but this file did
 // not, due to special hardcoding around the anonymous region.
 
-fn with<R>(f: &fn(x: &'a int) -> R) -> R {
+fn with<'a, R>(f: &fn(x: &'a int) -> R) -> R {
     f(&3)
 }
 
-fn return_it() -> &'a int {
+fn return_it<'a>() -> &'a int {
     with(|o| o) //~ ERROR mismatched types
         //~^ ERROR reference is not valid outside of its lifetime
 }
index cecd847843ca54d936f48066e594ef1b78e707b1..be7b28f6ef4b5c104a5ca6ae7f2089889edc68f4 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn f(_x : &'a int) -> &'a int {
+fn f<'a>(_x : &'a int) -> &'a int {
     return &3; //~ ERROR illegal borrow
 }
 
diff --git a/src/test/compile-fail/regions-scoping.rs b/src/test/compile-fail/regions-scoping.rs
deleted file mode 100644 (file)
index f0c81d1..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn with<T>(t: T, f: &fn(T)) { f(t) }
-
-fn nested<'x>(x: &'x int) {  // (1)
-    do with(
-        |x: &'x int, // Refers to the region `x` at (1)
-         y: &'y int, // A fresh region `y` (2)
-         z: &fn<'z>(x: &'x int, // Refers to `x` at (1)
-                    y: &'y int, // Refers to `y` at (2)
-                    z: &'z int) -> &'z int| // A fresh region `z` (3)
-                 -> &'x int {
-            if false { return z(x, y, x); }
-
-            if false { return z(x, y, y); }
-            //~^ ERROR cannot infer an appropriate lifetime
-
-            return z(y, x, x);
-            //~^ ERROR cannot infer an appropriate lifetime
-        }
-    ) |foo| {
-
-        let a: &'x int = foo(x, x, |_x, _y, z| z );
-        let b: &'x int = foo(x, a, |_x, _y, z| z );
-        let c: &'x int = foo(a, a, |_x, _y, z| z );
-
-        let z = 3i;
-        let d: &'x int = foo(x, x, |_x, _y, z| z );
-        let e: &'x int = foo(x, &z, |_x, _y, z| z );
-
-        // This would result in an error, but it is not reported by typeck
-        // anymore but rather borrowck. Therefore, it doesn't end up
-        // getting printed out since compilation fails after typeck.
-        //
-        // let f: &'x int = foo(&z, &z, |_x, _y, z| z ); // ERROR mismatched types: expected `&'x int` but found
-
-        foo(x, &z, |x, _y, _z| x); //~ ERROR mismatched types: expected `&'z int` but found `&'x int`
-
-        // Note: originally I had foo(x, &z, ...) here, but in that
-        // case the region inferencer deduced that this was valid if
-        // &y==&static, and so inference would succeed but borrow
-        // check would fail because the lifetime of &z is not &static.
-        foo(x, x, |_x, y, _z| y); //~ ERROR cannot infer an appropriate lifetime
-    }
-}
-
-fn main() {}
index 8b12813447ef2919bd78b961ab4e80b6949b49d2..be034eda67dcf2b05d2e6932ab569cc019e80358 100644 (file)
@@ -12,7 +12,7 @@ struct closure_box<'self> {
     cl: &'self fn()
 }
 
-fn box_it(x: &'r fn()) -> closure_box<'r> {
+fn box_it<'r>(x: &'r fn()) -> closure_box<'r> {
     closure_box {cl: x}
 }
 
index 74afdf117588c38359ac59ece6ced5686012248d..2f455e89dff909114481377977e7d10d6338224d 100644 (file)
@@ -15,9 +15,9 @@ trait get_ctxt {
     fn get_ctxt(&self) -> &ctxt;
 }
 
-struct has_ctxt { c: &'self ctxt }
+struct has_ctxt<'self> { c: &'self ctxt }
 
-impl get_ctxt for has_ctxt<'self> {
+impl<'self> get_ctxt for has_ctxt<'self> {
 
     // Here an error occurs because we used `&self` but
     // the definition used `&`:
index 78bdee1430c690139ae40fe7dcd32d2a9784c64d..c9e42aadfd4462b0c79c1a86478f0997c2e88929 100644 (file)
@@ -16,7 +16,7 @@ trait iterable<A> {
     fn iterate(&self, blk: &fn(x: &A) -> bool);
 }
 
-impl<A> iterable<A> for &'self [A] {
+impl<'self,A> iterable<A> for &'self [A] {
     fn iterate(&self, f: &fn(x: &A) -> bool) {
         for vec::each(*self) |e| {
             if !f(e) { break; }
index 65366a350efa3716f2fd7100f9d272ab6d90ec08..36c4ac2ad4939842c3701dfe2f4d06b86e7dbd37 100644 (file)
@@ -16,12 +16,12 @@ trait MyIter {
     fn test_const(&const self);
 }
 
-impl MyIter for &'self [int] {
+impl<'self> MyIter for &'self [int] {
     fn test_imm(&self) { fail_unless!(self[0] == 1) }
     fn test_const(&const self) { fail_unless!(self[0] == 1) }
 }
 
-impl MyIter for &'self str {
+impl<'self> MyIter for &'self str {
     fn test_imm(&self) { fail_unless!(*self == "test") }
     fn test_const(&const self) { fail_unless!(*self == "test") }
 }
index 02dbfeda2586953f61b683490f96f923fc93a0d3..fdb51124f0eb91edad1f0c39aa96de88012f7281 100644 (file)
@@ -12,7 +12,7 @@ trait Foo {
     fn foo(self);
 }
 
-impl Foo for &'self [int] {
+impl<'self> Foo for &'self [int] {
     fn foo(self) {}
 }
 
index a8823c477aa3cef316b6e3943450be31e9aafac6..77e4f512ebf4b2dd32a7f258c24cebe92c491abc 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn borrow<T>(x: &'r T) -> &'r T {x}
+fn borrow<'r,T>(x: &'r T) -> &'r T {x}
 
 struct Rec { f: @int }
 
index 1e9175ac1963c1ee46273ef117e9ba9e49d19399..4bdecd5eeec0e39903347c578658dc781aa145fc 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn foo(s: &'r uint) -> bool {
+fn foo<'r>(s: &'r uint) -> bool {
     match s {
         &3 => true,
         _ => false
index 42c0795b3dd2995c3aad4a996dbea1c699b50b69..ebd5cf41db5505afb4f87eed83e8e30ee0383122 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn select(x: &'r Option<int>, y: &'r Option<int>) -> &'r Option<int> {
+fn select<'r>(x: &'r Option<int>, y: &'r Option<int>) -> &'r Option<int> {
     match (x, y) {
         (&None, &None) => x,
         (&Some(_), _) => x,
index 281d520be0f60a211403f577db5392ccfd9d074f..bc6972bfb27533b2f977fd599b8fe71c5d328b83 100644 (file)
@@ -49,7 +49,7 @@ fn eat(&mut self) -> bool {
     }
 }
 
-impl<T> BaseIter<(int, &'self T)> for cat<T> {
+impl<'self,T> BaseIter<(int, &'self T)> for cat<T> {
     fn each(&self, f: &fn(&(int, &'self T)) -> bool) {
         let mut n = int::abs(self.meows);
         while n > 0 {
index 2ca19b2299ac24bc28abd1895e36700a91e0c7d1..c656dfd1530d58711fb0bed746abdb688206bc39 100644 (file)
@@ -2,7 +2,7 @@ trait Reverser {
     fn reverse(&self);
 }
 
-impl Reverser for &'self mut [uint] {
+impl<'self> Reverser for &'self mut [uint] {
     fn reverse(&self) {
         vec::reverse(*self);
     }
index b3667d4f81ebe3d3a09ec5ba7e9f9f33ec2c5f7f..f08fc3be0742a9a73ba3af6195a1ee5fbf5b3c57 100644 (file)
@@ -12,7 +12,7 @@ fn foo() -> int {
     return 0xca7f000d;
 }
 
-struct Bar { f: &'self fn() -> int }
+struct Bar<'self> { f: &'self fn() -> int }
 
 static b : Bar<'static> = Bar { f: foo };
 
index 46f9fdb08217b8977789b738302d17e542f5a4fe..a0d16a3ec3ab1c963083e380c20d6b25d34968e4 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 type Big = [u64, ..8];
-struct Pair { a: int, b: &'self Big }
+struct Pair<'self> { a: int, b: &'self Big }
 static x: &'static Big = &([13, 14, 10, 13, 11, 14, 14, 15]);
 static y: &'static Pair<'static> = &Pair {a: 15, b: x};
 
index 32c5f65bf3adeb75090f53e1fe86e96bb232ba40..6c501ebf9389abf2ae3148a42b2d4d65287a8a96 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-struct Pair { a: int, b: &'self int }
+struct Pair<'self> { a: int, b: &'self int }
 
 static x: &'static int = &10;
 
index 3e48b8f05baee1d31e341cc0dc6bd9e6d7eaf383..c41fa52bf15f4fd4a5329ce8d28d73e7ac6e4e6e 100644 (file)
@@ -28,13 +28,13 @@ fn compute_area(shape: &shape) -> float {
 
 pub impl shape {
     // self is in the implicit self region
-    fn select<T>(&self, threshold: float,
-                 a: &'r T, b: &'r T) -> &'r T {
+    fn select<'r, T>(&self, threshold: float,
+                     a: &'r T, b: &'r T) -> &'r T {
         if compute_area(self) > threshold {a} else {b}
     }
 }
 
-fn select_based_on_unit_circle<T>(
+fn select_based_on_unit_circle<'r, T>(
     threshold: float, a: &'r T, b: &'r T) -> &'r T {
 
     let shape = &circle(Point{x: 0.0, y: 0.0}, 1.0);
index 1bd6304fabc261711ee12b2d9aa74b7d891968ee..9dfe7e45c1194864c19a4102a057f5e8c8f7956f 100644 (file)
@@ -16,7 +16,7 @@
 fn eat_tup(_r: ~@(int, @fn(Pair) -> int)) {}
 fn eat_rec(_r: @~Rec) {}
 
-struct Rec { a: int, b: &'self fn(Pair) -> int }
+struct Rec<'self> { a: int, b: &'self fn(Pair) -> int }
 struct Pair { x: int, y: int }
 
 pub fn main() {
index 6dd8e3d83de87de0c3637467f2dbd0c147c9e0d5..34eb591b73aa4252f5868ef4adb0ab4bb9653c36 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct font {
+struct font<'self> {
     fontbuf: &'self ~[u8],
 }
 
@@ -18,7 +18,7 @@ fn buf(&self) -> &'self ~[u8] {
     }
 }
 
-fn font(fontbuf: &'r ~[u8]) -> font<'r> {
+fn font<'r>(fontbuf: &'r ~[u8]) -> font<'r> {
     font {
         fontbuf: fontbuf
     }
index 3f13b9f9e67adcbe26791329acc0ad03a4362e55..396175716b21067df6fc088b3f5e68b65bc45620 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // This test should behave exactly like issue-2735-3
-struct defer {
+struct defer<'self> {
     b: &'self mut bool,
 }
 
index 40c71eec4d38ae424bc3a6724a87594e2c144e6c..7b5f19f1434dcdf06e2f2b00d127f12c7a2d925c 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // This test should behave exactly like issue-2735-2
-struct defer {
+struct defer<'self> {
     b: &'self mut bool,
 }
 
@@ -22,7 +22,7 @@ fn finalize(&self) {
     }
 }
 
-fn defer(b: &'r mut bool) -> defer<'r> {
+fn defer<'r>(b: &'r mut bool) -> defer<'r> {
     defer {
         b: b
     }
index 8a0f64b32d4971d49b82ce526b4b09f0778a811e..63807de22dd428cb1756109ecb732ef75589ed5a 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct CMap {
+struct CMap<'self> {
     buf: &'self [u8],
 }
 
index 62016abf74b35c7f693191c93cfb2821c726f3e6..630448d27821474e0513485982425434447d613c 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn thing(x: &'r [int]) -> &'r [int] { x }
+fn thing<'r>(x: &'r [int]) -> &'r [int] { x }
+
 pub fn main() {
     let x = &[1,2,3];
     let y = x;
index 816678fa3208ea528794e1b92c17f910def88054..191259e5a57e2076a0b13efad62ae75553826b25 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct list<T> {
+struct list<'self, T> {
     element: &'self T,
     next: Option<@mut list<'self, T>>
 }
index 38aeab0888c603ce6f1bcbc38e770ca45de0afde..2992d9a4ac837d2ae2c6fb03a67f3e37774a3ccc 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn vec_peek<T>(v: &'r [T]) -> &'r [T] {
+fn vec_peek<'r, T>(v: &'r [T]) -> &'r [T] {
 // This doesn't work, and should.
 //    v.slice(1, 5)
     vec::slice(v, 1, 5)
index 9328189c47cc3b0308636aa2792d59f85517801c..fc62ea67eab218e3d0dc803bc6d5913505c28efb 100644 (file)
@@ -13,7 +13,7 @@ trait sum {
 }
 
 // Note: impl on a slice
-impl sum for &'self [int] {
+impl<'self> sum for &'self [int] {
     fn sum(self) -> int {
         let mut sum = 0;
         for vec::each(self) |e| { sum += *e; }
index 982515b61219fc586836a1fea15417ec5b6ecd13..e7edeca3b9a1986f0ab5426434272d1ac30368e6 100644 (file)
@@ -25,54 +25,54 @@ struct C {
     f: int
 }
 
-fn get_v1(a: &'v A) -> &'v int {
+fn get_v1<'v>(a: &'v A) -> &'v int {
     // Region inferencer must deduce that &v < L2 < L1
     let foo = &a.value; // L1
     &foo.v1             // L2
 }
 
-fn get_v2(a: &'v A, i: uint) -> &'v int {
+fn get_v2<'v>(a: &'v A, i: uint) -> &'v int {
     let foo = &a.value;
     &foo.v2[i]
 }
 
-fn get_v3(a: &'v A, i: uint) -> &'v int {
+fn get_v3<'v>(a: &'v A, i: uint) -> &'v int {
     let foo = &a.value;
     &foo.v3[i]
 }
 
-fn get_v4(a: &'v A, i: uint) -> &'v int {
+fn get_v4<'v>(a: &'v A, i: uint) -> &'v int {
     let foo = &a.value;
     &foo.v4.f
 }
 
-fn get_v5(a: &'v A, i: uint) -> &'v int {
+fn get_v5<'v>(a: &'v A, i: uint) -> &'v int {
     let foo = &a.value;
     &foo.v5.f
 }
 
-fn get_v6_a(a: &'v A, i: uint) -> &'v int {
+fn get_v6_a<'v>(a: &'v A, i: uint) -> &'v int {
     match a.value.v6 {
         Some(ref v) => &v.f,
         None => fail!()
     }
 }
 
-fn get_v6_b(a: &'v A, i: uint) -> &'v int {
+fn get_v6_b<'v>(a: &'v A, i: uint) -> &'v int {
     match *a {
         A { value: B { v6: Some(ref v), _ } } => &v.f,
         _ => fail!()
     }
 }
 
-fn get_v6_c(a: &'v A, i: uint) -> &'v int {
+fn get_v6_c<'v>(a: &'v A, i: uint) -> &'v int {
     match a {
         &A { value: B { v6: Some(ref v), _ } } => &v.f,
         _ => fail!()
     }
 }
 
-fn get_v5_ref(a: &'v A, i: uint) -> &'v int {
+fn get_v5_ref<'v>(a: &'v A, i: uint) -> &'v int {
     match &a.value {
         &B {v5: ~C {f: ref v}, _} => v
     }
index ced2948545f4a1e022bb4d499329975079d61339..5fd3da67a1779f81567322a33ef13e8412b826ac 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn get<T>(opt: &'r Option<T>) -> &'r T {
+fn get<'r, T>(opt: &'r Option<T>) -> &'r T {
     match *opt {
       Some(ref v) => v,
       None => fail!(~"none")
index 40a8b6164dc75cdc61044d66fbd44e1bf478d602..1fb9c126e74e2b056c3c76bf10a12714d69531c3 100644 (file)
@@ -17,7 +17,7 @@ struct Character {
     pos: ~Point
 }
 
-fn get_x(x: &'r Character) -> &'r int {
+fn get_x<'r>(x: &'r Character) -> &'r int {
     // interesting case because the scope of this
     // borrow of the unique pointer is in fact
     // larger than the fn itself
index 622a1eb9954cf5e7bee36f4fa268ee790a769c45..a9c65d012954ce4f90a24040839cc8a06c49e6d4 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn f(x : &'a int) -> &'a int {
+fn f<'a>(x : &'a int) -> &'a int {
     return &*x;
 }
 
index 0fc8cb49f07770a28b9d9bb513c84b3197160817..54cfb5f5fcc75264f6cfabd74baaebb8ce4d883b 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct closure_box {
+struct closure_box<'self> {
     cl: &'self fn(),
 }
 
index c0bbdca07aafb7ceda81679e1376eee8efaa1bac..a9a6aa0c7091772eecc8c7e59b3a4af9a4f33484 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-enum ast {
+enum ast<'self> {
     num(uint),
     add(&'self ast<'self>, &'self ast<'self>)
 }
 
-fn mk_add_ok(x: &'r ast<'r>, y: &'r ast<'r>) -> ast<'r> {
+fn mk_add_ok<'r>(x: &'r ast<'r>, y: &'r ast<'r>) -> ast<'r> {
     add(x, y)
 }
 
index aeb167c5b6d18c6a72fd0f1a21882b9d01904792..1c8ed8a3dcd5b9f9d88399db0f1fdb193ea94c98 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-enum ast {
+enum ast<'self> {
     num(uint),
     add(&'self ast<'self>, &'self ast<'self>)
 }
 
-fn mk_add_ok(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'a> {
+fn mk_add_ok<'a>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'a> {
     add(x, y)
 }
 
diff --git a/src/test/run-pass/regions-equiv-fns.rs b/src/test/run-pass/regions-equiv-fns.rs
deleted file mode 100644 (file)
index 86b997a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Before fn subtyping was properly implemented,
-// we reported errors in this case:
-
-fn ok(a: &uint) {
-    // Here &r is an alias for &:
-    let mut g: @fn(x: &uint) = |x: &'r uint| {};
-    g(a);
-}
-
-pub fn main() {
-}
-
-
index e38bd64da64fa1ba09ee3750c327af827e762e87..d9e5831024615699c60b894e50a4335a1b63ff09 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn foo(x: &'r uint) -> &'r uint { x }
+fn foo<'r>(x: &'r uint) -> &'r uint { x }
 fn bar(x: &uint) -> uint { *x }
 
 pub fn main() {
index 981eace6754981ef03bcf24509373da8ed98ccd9..652a7a33396176d28509b41fd30b4646f02e303e 100644 (file)
@@ -18,14 +18,14 @@ fn ok(f: @fn(x: &uint)) {
     // f's type should be a subtype of g's type), because f can be
     // used in any context that expects g's type.  But this currently
     // fails.
-    let mut g: @fn(y: &'r uint) = |x: &'r uint| { };
+    let mut g: @fn<'r>(y: &'r uint) = |x| { };
     g = f;
 }
 
 // This version is the same as above, except that here, g's type is
 // inferred.
 fn ok_inferred(f: @fn(x: &uint)) {
-    let mut g: @fn(x: &'r uint) = |_| {};
+    let mut g: @fn<'r>(x: &'r uint) = |_| {};
     g = f;
 }
 
index 5aff0274dc47ce1938af4fd62244916e0cc26e63..7c970253b98abc422ee1c7c95a9d6a878c6af89d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn view<T>(x: &'r [T]) -> &'r [T] {x}
+fn view<'r, T>(x: &'r [T]) -> &'r [T] {x}
 
 pub fn main() {
     let v = ~[1, 2, 3];
index fd48402dd10ab1b716a89a250ac8e0f66076b16a..a184f47b65f5786bdece952d2d7479c5f4d1395e 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn borrow<T>(x: &'r T) -> &'r T {x}
+fn borrow<'r, T>(x: &'r T) -> &'r T {x}
 
 pub fn main() {
     let x = @3;
index b5dbf0fde5cdf19f99f7220f03038888b8964cf9..a3cb1e32eb5e6eeb08a3f3f31ec97ab911f8dba5 100644 (file)
@@ -10,7 +10,7 @@
 
 struct Point {x: int, y: int}
 
-fn x_coord(p: &'r Point) -> &'r int {
+fn x_coord<'r>(p: &'r Point) -> &'r int {
     return &p.x;
 }
 
index 74c4c4260fc1acc2dba4bece8502122413891f12..9933d55f7476e457f2bde4a3b4dc2ae447347f5a 100644 (file)
@@ -14,7 +14,7 @@ fn with<T>(f: &fn(x: &int) -> T) -> T {
     f(&20)
 }
 
-fn has_one(x: &'a int) -> int {
+fn has_one<'a>(x: &'a int) -> int {
     do with |y| { takes_two(x, y) }
 }
 
index 66baaf401089501384bd5c794180c0ff87b77dbb..e83f11de31d121c88d7549da75aa6861744d9eaa 100644 (file)
@@ -10,7 +10,7 @@
 
 fn takes_two(x: &int, y: &int) -> int { *x + *y }
 
-fn has_two(x: &'a int, y: &'b int) -> int {
+fn has_two<'a,'b>(x: &'a int, y: &'b int) -> int {
     takes_two(x, y)
 }
 
index c45212eaa6264fb752056e8a6f30e939dbdbbeda..d45925229fa7ceaa50a66086ca16370e9fd48d62 100644 (file)
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct boxed_int {
+struct boxed_int<'self> {
     f: &'self int,
 }
 
-fn max(bi: &'r boxed_int, f: &'r int) -> int {
+fn max<'r>(bi: &'r boxed_int, f: &'r int) -> int {
     if *bi.f > *f {*bi.f} else {*f}
 }
 
diff --git a/src/test/run-pass/regions-infer-contravariance.rs b/src/test/run-pass/regions-infer-contravariance.rs
deleted file mode 100644 (file)
index ef2be39..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct boxed_int {
-    f: &'self int,
-}
-
-fn get(bi: &'r boxed_int<'r>) -> &'r int {
-    bi.f
-}
-
-fn with(bi: &'r boxed_int) {
-    // Here, the upcast is allowed because the `boxed_int` type is
-    // contravariant with respect to `&r`.  See also
-    // compile-fail/regions-infer-invariance-due-to-mutability.rs
-    let bi: &'blk boxed_int<'blk> = bi;
-    fail_unless!(*get(bi) == 22);
-}
-
-pub fn main() {
-    let g = 22;
-    let foo = boxed_int { f: &g };
-    with(&foo);
-}
index df8a4f6f770b6543282a09942031a98bb474763e..c1f7a713ca679e79b530c6187cb497784dda148e 100644 (file)
 use core::cast;
 use std::arena::Arena;
 
-struct Bcx {
+struct Bcx<'self> {
     fcx: &'self Fcx<'self>
 }
 
-struct Fcx {
+struct Fcx<'self> {
     arena: &'self Arena,
     ccx: &'self Ccx
 }
@@ -29,7 +29,7 @@ struct Ccx {
     x: int
 }
 
-fn h(bcx : &'r Bcx<'r>) -> &'r Bcx<'r> {
+fn h<'r>(bcx : &'r Bcx<'r>) -> &'r Bcx<'r> {
     return bcx.fcx.arena.alloc(|| Bcx { fcx: bcx.fcx });
 }
 
index 717588ab4cb9dc7718d116328804001a1b9ed5c6..a74bc82569bf042b07534b910ee459ab23662f13 100644 (file)
 
 struct arena(());
 
-struct Bcx {
+struct Bcx<'self> {
     fcx: &'self Fcx<'self>
 }
 
-struct Fcx {
+struct Fcx<'self> {
     arena: &'self arena,
     ccx: &'self Ccx
 }
@@ -23,14 +23,14 @@ struct Ccx {
     x: int
 }
 
-fn alloc(_bcx : &'a arena) -> &'a Bcx<'a> {
+fn alloc<'a>(_bcx : &'a arena) -> &'a Bcx<'a> {
     unsafe {
         return cast::reinterpret_cast(
             &libc::malloc(sys::size_of::<Bcx<'blk>>() as libc::size_t));
     }
 }
 
-fn h(bcx : &'a Bcx<'a>) -> &'a Bcx<'a> {
+fn h<'a>(bcx : &'a Bcx<'a>) -> &'a Bcx<'a> {
     return alloc(bcx.fcx.arena);
 }
 
index da03864338bdc9b6d0de6719f1b5b9113f2bbf51..e842ed585be8093bfc7ba0ff89fc9d231feb1144 100644 (file)
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-enum roption {
+enum roption<'self> {
     a, b(&'self uint)
 }
 
-fn mk(cond: bool, ptr: &'r uint) -> roption<'r> {
+fn mk<'r>(cond: bool, ptr: &'r uint) -> roption<'r> {
     if cond {a} else {b(ptr)}
 }
 
index 1066c5fd4ca70759b2ab49787ce132ac1e8de281..cc5b89405aac9e8f7b51aa02bd31a04355173c15 100644 (file)
@@ -10,7 +10,7 @@
 
 // xfail-fast
 
-fn region_identity(x: &'r uint) -> &'r uint { x }
+fn region_identity<'r>(x: &'r uint) -> &'r uint { x }
 
 fn apply<T>(t: T, f: &fn(T) -> T) -> T { f(t) }
 
index e71dbb0054bcc9ee28557c8c29e4a038b89ae28c..78045e5e5d4109f80652ae35baf1a47cfb2f0d17 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-enum int_wrapper {
+enum int_wrapper<'self> {
     int_wrapper_ctor(&'self int)
 }
 
index 5673a1e50f0704a643da5ddaee08e3ba02bd24d6..5221bc28fb83830bf56336b60ed1817dda0877bf 100644 (file)
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct closure_box {
+struct closure_box<'self> {
     cl: &'self fn(),
 }
 
-fn box_it(+x: &'r fn()) -> closure_box<'r> {
+fn box_it<'r>(+x: &'r fn()) -> closure_box<'r> {
     closure_box {cl: x}
 }
 
index 481f25745cd4dc8831fbe283e479bff6a4b8f572..92ef18967b361f42ed1cdbca7cf58b4988ca52e3 100644 (file)
 
 struct Ctxt { v: uint }
 
-trait get_ctxt {
+trait get_ctxt<'self> {
     fn get_ctxt(&self) -> &'self Ctxt;
 }
 
-struct HasCtxt { c: &'self Ctxt }
+struct HasCtxt<'self> { c: &'self Ctxt }
 
-impl get_ctxt for HasCtxt<'self> {
+impl<'self> get_ctxt for HasCtxt<'self> {
     fn get_ctxt(&self) -> &'self Ctxt {
         self.c
     }
index 61b09239bc1d92a9c98c1b2273658502b997b35f..f877a766ead6fb5a1204f7e2d7db76a8fc998ec5 100644 (file)
@@ -1,4 +1,4 @@
-struct Foo {
+struct Foo<'self> {
     x: &'self int
 }