diff --git a/doc/rust.md b/doc/rust.md index b45a6a3dd450d..4d42aa2b06704 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -1144,22 +1144,23 @@ Constants are declared with the `const` keyword. A constant item must have an expression giving its definition. The definition expression of a constant is limited to expression forms that can be evaluated at compile time. -Constants must be explicitly typed. The type may be ```bool```, ```char```, a number, or a type derived from -those primitive types. The derived types are borrowed pointers, static arrays, tuples, and structs. +Constants must be explicitly typed. The type may be ```bool```, ```char```, a number, or a type derived from those primitive types. +The derived types are borrowed pointers, static arrays, tuples, and structs. +Borrowed pointers must be have the `'static` lifetime. ~~~~ const bit1: uint = 1 << 0; const bit2: uint = 1 << 1; const bits: [uint * 2] = [bit1, bit2]; -const string: &str = "bitstring"; +const string: &'static str = "bitstring"; struct BitsNStrings { mybits: [uint *2], - mystring: &str + mystring: &'self str } -const bits_n_strings: BitsNStrings = BitsNStrings { +const bits_n_strings: BitsNStrings<'static> = BitsNStrings { mybits: bits, mystring: string }; @@ -1630,7 +1631,7 @@ The following are examples of structure expressions: ~~~~ # struct Point { x: float, y: float } # struct TuplePoint(float, float); -# mod game { pub struct User { name: &str, age: uint, score: uint } } +# mod game { pub struct User<'self> { name: &'self str, age: uint, score: uint } } # struct Cookie; fn some_fn(t: T) {} Point {x: 10f, y: 20f}; TuplePoint(10f, 20f); @@ -2556,8 +2557,8 @@ order specified by the tuple type. An example of a tuple type and its use: ~~~~ -type Pair = (int,&str); -let p: Pair = (10,"hello"); +type Pair<'self> = (int,&'self str); +let p: Pair<'static> = (10,"hello"); let (a, b) = p; assert b != "world"; ~~~~ @@ -2718,7 +2719,7 @@ fn add(x: int, y: int) -> int { let mut x = add(5,7); -type Binop = fn(int,int) -> int; +type Binop<'self> = &'self fn(int,int) -> int; let bo: Binop = add; x = bo(5,7); ~~~~~~~~ diff --git a/doc/tutorial.md b/doc/tutorial.md index b425c595f82eb..b1eceeab70eb6 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1951,7 +1951,7 @@ trait Printable { Traits may be implemented for specific types with [impls]. An impl that implements a trait includes the name of the trait at the start of the definition, as in the following impls of `Printable` for `int` -and `&str`. +and `~str`. [impls]: #functions-and-methods @@ -1961,12 +1961,12 @@ impl Printable for int { fn print(&self) { io::println(fmt!("%d", *self)) } } -impl Printable for &str { +impl Printable for ~str { fn print(&self) { io::println(*self) } } # 1.print(); -# ("foo").print(); +# (~"foo").print(); ~~~~ Methods defined in an implementation of a trait may be called just like diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index d89481766c0af..d87979f2a79d0 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -168,7 +168,7 @@ pub mod traits { use kinds::Copy; use ops::Add; - impl Add<&[const T],@[T]> for @[T] { + impl Add<&self/[const T],@[T]> for @[T] { #[inline(always)] pure fn add(&self, rhs: & &self/[const T]) -> @[T] { append(*self, (*rhs)) diff --git a/src/libcore/cleanup.rs b/src/libcore/cleanup.rs index 4d599640f36fa..45628318f905f 100644 --- a/src/libcore/cleanup.rs +++ b/src/libcore/cleanup.rs @@ -22,8 +22,8 @@ use cast::transmute; * NB: These must match the representation in the C++ runtime. */ -type DropGlue = fn(**TypeDesc, *c_void); -type FreeGlue = fn(**TypeDesc, *c_void); +type DropGlue = &self/fn(**TypeDesc, *c_void); +type FreeGlue = &self/fn(**TypeDesc, *c_void); type TaskID = uintptr_t; diff --git a/src/libcore/condition.rs b/src/libcore/condition.rs index 87752cff1bfa2..566de2e880ebd 100644 --- a/src/libcore/condition.rs +++ b/src/libcore/condition.rs @@ -22,10 +22,10 @@ pub struct Handler { pub struct Condition { name: &static/str, - key: task::local_data::LocalDataKey> + key: task::local_data::LocalDataKey/&self> } -pub impl Condition { +pub impl Condition/&self { fn trap(&self, h: &self/fn(T) -> U) -> Trap/&self { unsafe { let p : *RustClosure = ::cast::transmute(&h); @@ -65,11 +65,11 @@ pub impl Condition { } struct Trap { - cond: &Condition, + cond: &self/Condition/&self, handler: @Handler } -pub impl Trap { +pub impl Trap/&self { fn in(&self, inner: &self/fn() -> V) -> V { unsafe { let _g = Guard { cond: self.cond }; @@ -81,10 +81,10 @@ pub impl Trap { } struct Guard { - cond: &Condition + cond: &self/Condition/&self } -impl Drop for Guard { +impl Drop for Guard/&self { fn finalize(&self) { unsafe { debug!("Guard: popping handler from TLS"); diff --git a/src/libcore/container.rs b/src/libcore/container.rs index d7e05a62c5118..36424d1bfaaa3 100644 --- a/src/libcore/container.rs +++ b/src/libcore/container.rs @@ -10,7 +10,6 @@ //! Container traits -use cmp::Equiv; use option::Option; pub trait Container { diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs index 3e3c327af5f68..a077a6003b495 100644 --- a/src/libcore/gc.rs +++ b/src/libcore/gc.rs @@ -115,7 +115,7 @@ unsafe fn is_safe_point(pc: *Word) -> Option { return None; } -type Visitor = fn(root: **Word, tydesc: *Word) -> bool; +type Visitor = &self/fn(root: **Word, tydesc: *Word) -> bool; // Walks the list of roots for the given safe point, and calls visitor // on each root. diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs index 8f3f81d167e7f..4c455e8d6b2c7 100644 --- a/src/libcore/hash.rs +++ b/src/libcore/hash.rs @@ -298,7 +298,7 @@ impl io::Writer for SipState { } } -impl Streaming for &SipState { +impl Streaming for SipState { #[inline(always)] fn input(&self, buf: &[const u8]) { diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs index 43ec6294bdc5b..c74e8ecee75e1 100644 --- a/src/libcore/hashmap.rs +++ b/src/libcore/hashmap.rs @@ -268,7 +268,9 @@ pub mod linear { } } - impl BaseIter<(&K, &V)> for LinearMap { + impl + BaseIter<(&self/K, &self/V)> for LinearMap + { /// Visit all key-value pairs pure fn each(&self, blk: fn(&(&self/K, &self/V)) -> bool) { for uint::range(0, self.buckets.len()) |i| { diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 65879f88a5dad..0621d78ec7e20 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -585,11 +585,11 @@ pub fn file_reader(path: &Path) -> Result<@Reader, ~str> { // Byte readers pub struct BytesReader { - bytes: &[u8], + bytes: &self/[u8], mut pos: uint } -impl Reader for BytesReader { +impl Reader for BytesReader/&self { fn read(&self, bytes: &mut [u8], len: uint) -> uint { let count = uint::min(len, self.bytes.len() - self.pos); diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index e90bbc2e6f769..c92f747fc9872 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -20,7 +20,7 @@ use option::{None, Option, Some}; use vec; /// A function used to initialize the elements of a sequence -pub type InitOp = &fn(uint) -> T; +pub type InitOp = &self/fn(uint) -> T; pub trait BaseIter { pure fn each(&self, blk: fn(v: &A) -> bool); diff --git a/src/libcore/os.rs b/src/libcore/os.rs index d617060925056..d5e38664270c1 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -1028,11 +1028,11 @@ pub mod consts { pub use os::consts::windows::*; pub mod unix { - pub const FAMILY: &str = "unix"; + pub const FAMILY: &static/str = "unix"; } pub mod windows { - pub const FAMILY: &str = "windows"; + pub const FAMILY: &static/str = "windows"; } #[cfg(target_os = "macos")] @@ -1051,38 +1051,38 @@ pub mod consts { pub use os::consts::win32::*; pub mod macos { - pub const SYSNAME: &str = "macos"; - pub const DLL_PREFIX: &str = "lib"; - pub const DLL_SUFFIX: &str = ".dylib"; - pub const EXE_SUFFIX: &str = ""; + pub const SYSNAME: &static/str = "macos"; + pub const DLL_PREFIX: &static/str = "lib"; + pub const DLL_SUFFIX: &static/str = ".dylib"; + pub const EXE_SUFFIX: &static/str = ""; } pub mod freebsd { - pub const SYSNAME: &str = "freebsd"; - pub const DLL_PREFIX: &str = "lib"; - pub const DLL_SUFFIX: &str = ".so"; - pub const EXE_SUFFIX: &str = ""; + pub const SYSNAME: &static/str = "freebsd"; + pub const DLL_PREFIX: &static/str = "lib"; + pub const DLL_SUFFIX: &static/str = ".so"; + pub const EXE_SUFFIX: &static/str = ""; } pub mod linux { - pub const SYSNAME: &str = "linux"; - pub const DLL_PREFIX: &str = "lib"; - pub const DLL_SUFFIX: &str = ".so"; - pub const EXE_SUFFIX: &str = ""; + pub const SYSNAME: &static/str = "linux"; + pub const DLL_PREFIX: &static/str = "lib"; + pub const DLL_SUFFIX: &static/str = ".so"; + pub const EXE_SUFFIX: &static/str = ""; } pub mod android { - pub const SYSNAME: &str = "android"; - pub const DLL_PREFIX: &str = "lib"; - pub const DLL_SUFFIX: &str = ".so"; - pub const EXE_SUFFIX: &str = ""; + pub const SYSNAME: &static/str = "android"; + pub const DLL_PREFIX: &static/str = "lib"; + pub const DLL_SUFFIX: &static/str = ".so"; + pub const EXE_SUFFIX: &static/str = ""; } pub mod win32 { - pub const SYSNAME: &str = "win32"; - pub const DLL_PREFIX: &str = ""; - pub const DLL_SUFFIX: &str = ".dll"; - pub const EXE_SUFFIX: &str = ".exe"; + pub const SYSNAME: &static/str = "win32"; + pub const DLL_PREFIX: &static/str = ""; + pub const DLL_SUFFIX: &static/str = ".dll"; + pub const EXE_SUFFIX: &static/str = ".exe"; } @@ -1099,16 +1099,16 @@ pub mod consts { use os::consts::mips::*; pub mod x86 { - pub const ARCH: &str = "x86"; + pub const ARCH: &'static str = "x86"; } pub mod x86_64 { - pub const ARCH: &str = "x86_64"; + pub const ARCH: &'static str = "x86_64"; } pub mod arm { - pub const ARCH: &str = "arm"; + pub const ARCH: &'static str = "arm"; } pub mod mips { - pub const ARCH: &str = "mips"; + pub const ARCH: &'static str = "mips"; } } diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 72215e4863f79..6682aaa896832 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -440,7 +440,7 @@ pub fn try_recv(p: RecvPacketBuffered) let p = unsafe { &*p_ }; struct DropState { - p: &PacketHeader, + p: &self/PacketHeader, drop { if task::failing() { diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index c8f5d32252301..6a2e5003d1822 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -264,7 +264,7 @@ impl Ord for *const T { // Equality for region pointers #[cfg(notest)] -impl Eq for &const T { +impl Eq for &self/const T { #[inline(always)] pure fn eq(&self, other: & &self/const T) -> bool { return *(*self) == *(*other); @@ -277,7 +277,7 @@ impl Eq for &const T { // Comparison for region pointers #[cfg(notest)] -impl Ord for &const T { +impl Ord for &self/const T { #[inline(always)] pure fn lt(&self, other: & &self/const T) -> bool { *(*self) < *(*other) diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 19453c5e96fde..4b76b2b89f2a0 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -787,7 +787,7 @@ pure fn cmp(a: &str, b: &str) -> Ordering { } #[cfg(notest)] -impl TotalOrd for &str { +impl TotalOrd for &'self str { pure fn cmp(&self, other: & &self/str) -> Ordering { cmp(*self, *other) } } @@ -833,7 +833,7 @@ pure fn gt(a: &str, b: &str) -> bool { } #[cfg(notest)] -impl Eq for &str { +impl Eq for &self/str { #[inline(always)] pure fn eq(&self, other: & &self/str) -> bool { eq_slice((*self), (*other)) @@ -875,7 +875,7 @@ impl Ord for ~str { } #[cfg(notest)] -impl Ord for &str { +impl Ord for &self/str { #[inline(always)] pure fn lt(&self, other: & &self/str) -> bool { lt((*self), (*other)) } #[inline(always)] @@ -899,7 +899,7 @@ impl Ord for @str { } #[cfg(notest)] -impl Equiv<~str> for &str { +impl Equiv<~str> for &'self str { #[inline(always)] pure fn equiv(&self, other: &~str) -> bool { eq_slice(*self, *other) } } @@ -2226,7 +2226,7 @@ pub mod traits { use ops::Add; use str::append; - impl Add<&str,~str> for ~str { + impl Add<&self/str,~str> for ~str { #[inline(always)] pure fn add(&self, rhs: & &self/str) -> ~str { append(copy *self, (*rhs)) @@ -2270,7 +2270,7 @@ pub trait StrSlice { } /// Extension methods for strings -impl StrSlice for &str { +impl StrSlice for &self/str { /** * Return true if a predicate matches all characters or if the string * contains no characters diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index da2f68166ce23..b080cd58c605a 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -19,7 +19,7 @@ use libc::{c_void, c_char, size_t}; use repr; use str; -pub type FreeGlue = fn(*TypeDesc, *c_void); +pub type FreeGlue = &self/fn(*TypeDesc, *c_void); // Corresponds to runtime type_desc type pub enum TypeDesc = { diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index d9fdd51fdcee2..725bb4ff89f60 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -44,7 +44,7 @@ use task::rt; * * These two cases aside, the interface is safe. */ -pub type LocalDataKey = &fn(v: @T); +pub type LocalDataKey = &self/fn(v: @T); /** * Remove a task-local data value from the table, returning the diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 75b38d07ece33..9605e4a43561f 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -123,7 +123,7 @@ struct TaskGroupData { } type TaskGroupArc = unstable::Exclusive>; -type TaskGroupInner = &mut Option; +type TaskGroupInner = &self/mut Option; // A taskgroup is 'dead' when nothing can cause it to fail; only members can. pure fn taskgroup_is_dead(tg: &TaskGroupData) -> bool { diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index 1f0f3b0779cbe..60665bcddf6bd 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -19,7 +19,7 @@ use io::Writer; use option::{None, Option, Some}; use str; -pub type Cb = &fn(buf: &[const u8]) -> bool; +pub type Cb = &self/fn(buf: &[const u8]) -> bool; /** * A trait to implement in order to make a type hashable; @@ -197,7 +197,7 @@ impl IterBytes for int { } } -impl IterBytes for &[A] { +impl IterBytes for &self/[A] { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { for (*self).each |elt| { @@ -352,7 +352,7 @@ pub pure fn iter_bytes_7 IterBytes for Option { } } -impl IterBytes for &A { +impl IterBytes for &self/A { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { (**self).iter_bytes(lsb0, f); diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index dec6cbeb20173..3b5d1f9e2ae4c 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -32,7 +32,7 @@ impl ToStr for ~str { #[inline(always)] pure fn to_str(&self) -> ~str { copy *self } } -impl ToStr for &str { +impl ToStr for &self/str { #[inline(always)] pure fn to_str(&self) -> ~str { ::str::from_slice(*self) } } @@ -72,7 +72,7 @@ impl ToStr for (A, B, C) { } } -impl ToStr for &[A] { +impl ToStr for &self/[A] { #[inline(always)] pure fn to_str(&self) -> ~str { unsafe { diff --git a/src/libcore/trie.rs b/src/libcore/trie.rs index 0ad87dcf03e2e..02c14b155bbb5 100644 --- a/src/libcore/trie.rs +++ b/src/libcore/trie.rs @@ -29,7 +29,7 @@ pub struct TrieMap { priv length: uint } -impl BaseIter<(uint, &T)> for TrieMap { +impl BaseIter<(uint, &'self T)> for TrieMap { /// Visit all key-value pairs in order #[inline(always)] pure fn each(&self, f: fn(&(uint, &self/T)) -> bool) { @@ -39,7 +39,7 @@ impl BaseIter<(uint, &T)> for TrieMap { pure fn size_hint(&self) -> Option { Some(self.len()) } } -impl ReverseIter<(uint, &T)> for TrieMap { +impl ReverseIter<(uint, &'self T)> for TrieMap { /// Visit all key-value pairs in reverse order #[inline(always)] pure fn each_reverse(&self, f: fn(&(uint, &self/T)) -> bool) { diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index 15fe2a5246179..14d35078d0d2e 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -71,7 +71,7 @@ pub trait ExtendedTupleOps { fn map(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C]; } -impl ExtendedTupleOps for (&[A], &[B]) { +impl ExtendedTupleOps for (&self/[A], &self/[B]) { #[inline(always)] fn zip(&self) -> ~[(A, B)] { match *self { diff --git a/src/libcore/unstable/finally.rs b/src/libcore/unstable/finally.rs index 9a8b9bdde023d..3ad580389df19 100644 --- a/src/libcore/unstable/finally.rs +++ b/src/libcore/unstable/finally.rs @@ -31,7 +31,7 @@ pub trait Finally { fn finally(&self, dtor: &fn()) -> T; } -impl Finally for &fn() -> T { +impl Finally for &self/fn() -> T { fn finally(&self, dtor: &fn()) -> T { let _d = Finallyalizer { dtor: dtor @@ -42,10 +42,10 @@ impl Finally for &fn() -> T { } struct Finallyalizer { - dtor: &fn() + dtor: &self/fn() } -impl Drop for Finallyalizer { +impl Drop for Finallyalizer/&self { fn finalize(&self) { (self.dtor)(); } diff --git a/src/libcore/unstable/global.rs b/src/libcore/unstable/global.rs index a0c2955673de1..ac42e26fedda9 100644 --- a/src/libcore/unstable/global.rs +++ b/src/libcore/unstable/global.rs @@ -42,7 +42,7 @@ use sys::Closure; #[cfg(test)] use task::spawn; #[cfg(test)] use uint; -pub type GlobalDataKey = &fn(v: T); +pub type GlobalDataKey = &self/fn(v: T); pub unsafe fn global_data_clone_create( key: GlobalDataKey, create: &fn() -> ~T) -> T { diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 1be0daf21ba94..b3707be9869ca 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1549,7 +1549,7 @@ pure fn eq(a: &[T], b: &[T]) -> bool { } #[cfg(notest)] -impl Eq for &[T] { +impl Eq for &self/[T] { #[inline(always)] pure fn eq(&self, other: & &self/[T]) -> bool { eq((*self), (*other)) } #[inline(always)] @@ -1574,7 +1574,7 @@ impl Eq for @[T] { } #[cfg(notest)] -impl Equiv<~[T]> for &[T] { +impl Equiv<~[T]> for &'self [T] { #[inline(always)] pure fn equiv(&self, other: &~[T]) -> bool { eq(*self, *other) } } @@ -1596,7 +1596,7 @@ pure fn cmp(a: &[T], b: &[T]) -> Ordering { } #[cfg(notest)] -impl TotalOrd for &[T] { +impl TotalOrd for &'self [T] { #[inline(always)] pure fn cmp(&self, other: & &self/[T]) -> Ordering { cmp(*self, *other) } } @@ -1633,7 +1633,7 @@ pure fn ge(a: &[T], b: &[T]) -> bool { !lt(a, b) } pure fn gt(a: &[T], b: &[T]) -> bool { lt(b, a) } #[cfg(notest)] -impl Ord for &[T] { +impl Ord for &self/[T] { #[inline(always)] pure fn lt(&self, other: & &self/[T]) -> bool { lt((*self), (*other)) } #[inline(always)] @@ -1674,7 +1674,7 @@ pub mod traits { use ops::Add; use vec::append; - impl Add<&[const T],~[T]> for ~[T] { + impl Add<&self/[const T],~[T]> for ~[T] { #[inline(always)] pure fn add(&self, rhs: & &self/[const T]) -> ~[T] { append(copy *self, (*rhs)) @@ -1682,7 +1682,7 @@ pub mod traits { } } -impl Container for &[const T] { +impl Container for &self/[const T] { /// Returns true if a vector contains no elements #[inline] pure fn is_empty(&self) -> bool { is_empty(*self) } @@ -1697,7 +1697,7 @@ pub trait CopyableVector { } /// Extension methods for vectors -impl CopyableVector for &[const T] { +impl CopyableVector for &'self [const T] { /// Returns a copy of the elements from [`start`..`end`) from `v`. #[inline] pure fn slice(&self, start: uint, end: uint) -> ~[T] { @@ -1725,7 +1725,7 @@ pub trait ImmutableVector { } /// Extension methods for vectors -impl ImmutableVector for &[T] { +impl ImmutableVector for &self/[T] { /// Return a slice that points into another slice. #[inline] pure fn view(&self, start: uint, end: uint) -> &self/[T] { @@ -1828,7 +1828,7 @@ pub trait ImmutableEqVector { pure fn rposition_elem(&self, t: &T) -> Option; } -impl ImmutableEqVector for &[T] { +impl ImmutableEqVector for &self/[T] { /** * Find the first index matching some predicate * @@ -1873,7 +1873,7 @@ pub trait ImmutableCopyableVector { } /// Extension methods for vectors -impl ImmutableCopyableVector for &[T] { +impl ImmutableCopyableVector for &self/[T] { /** * Construct a new vector from the elements of a vector for which some * predicate holds. @@ -2266,7 +2266,7 @@ pub mod bytes { // This cannot be used with iter-trait.rs because of the region pointer // required in the slice. -impl iter::BaseIter for &[A] { +impl iter::BaseIter for &self/[A] { pub pure fn each(&self, blk: fn(v: &A) -> bool) { // FIXME(#2263)---should be able to call each(self, blk) for each(*self) |e| { @@ -2304,7 +2304,7 @@ impl iter::BaseIter for @[A] { pure fn size_hint(&self) -> Option { Some(len(*self)) } } -impl iter::ExtendedIter for &[A] { +impl iter::ExtendedIter for &self/[A] { pub pure fn eachi(&self, blk: fn(uint, v: &A) -> bool) { iter::eachi(self, blk) } @@ -2381,7 +2381,7 @@ impl iter::ExtendedIter for @[A] { } } -impl iter::EqIter for &[A] { +impl iter::EqIter for &self/[A] { pub pure fn contains(&self, x: &A) -> bool { iter::contains(self, x) } pub pure fn count(&self, x: &A) -> uint { iter::count(self, x) } } @@ -2398,7 +2398,7 @@ impl iter::EqIter for @[A] { pub pure fn count(&self, x: &A) -> uint { iter::count(self, x) } } -impl iter::CopyableIter for &[A] { +impl iter::CopyableIter for &self/[A] { pure fn filter_to_vec(&self, pred: fn(&A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } @@ -2430,7 +2430,7 @@ impl iter::CopyableIter for @[A] { } } -impl iter::CopyableOrderedIter for &[A] { +impl iter::CopyableOrderedIter for &self/[A] { pure fn min(&self) -> A { iter::min(self) } pure fn max(&self) -> A { iter::max(self) } } @@ -2447,7 +2447,7 @@ impl iter::CopyableOrderedIter for @[A] { pure fn max(&self) -> A { iter::max(self) } } -impl iter::CopyableNonstrictIter for &[A] { +impl iter::CopyableNonstrictIter for &self/[A] { pure fn each_val(&const self, f: fn(A) -> bool) { let mut i = 0; while i < self.len() { diff --git a/src/librust/rust.rc b/src/librust/rust.rc index 235ed6412a356..023383b3dccc8 100644 --- a/src/librust/rust.rc +++ b/src/librust/rust.rc @@ -36,23 +36,23 @@ impl ValidUsage { } enum Action { - Exec(&str), - Call(&fn(args: &[~str]) -> ValidUsage) + Exec(&self/str), + Call(&self/fn(args: &[~str]) -> ValidUsage) } enum UsageSource { - UsgExec(&str), - UsgStr(&str) + UsgExec(&self/str), + UsgStr(&self/str) } struct Command { - cmd: &str, - action: Action, - usage_line: &str, - usage_full: UsageSource + cmd: &self/str, + action: Action/&self, + usage_line: &self/str, + usage_full: UsageSource/&self } -const commands: &[Command] = &[ +const commands: &static/[Command/&static] = &[ Command{ cmd: "build", action: Exec("rustc"), diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 0bf1fc3870449..3ffcd5838162e 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -68,7 +68,7 @@ fn lookup_hash(d: ebml::Doc, eq_fn: fn(x:&[u8]) -> bool, hash: uint) -> None } -pub type GetCrateDataCb = &fn(ast::crate_num) -> cmd; +pub type GetCrateDataCb = &self/fn(ast::crate_num) -> cmd; pub fn maybe_find_item(item_id: int, items: ebml::Doc) -> Option { fn eq_item(bytes: &[u8], item_id: int) -> bool { @@ -546,7 +546,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 = fn( +pub type decode_inlined_item = &self/fn( cdata: @cstore::crate_metadata, tcx: ty::ctxt, path: ast_map::path, diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 0569d5f03a9d7..3d81b01a0c9f8 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1276,11 +1276,12 @@ fn encode_hash(ebml_w: writer::Encoder, hash: &str) { } // NB: Increment this as you change the metadata encoding version. -pub const metadata_encoding_version : &[u8] = &[0x72, //'r' as u8, - 0x75, //'u' as u8, - 0x73, //'s' as u8, - 0x74, //'t' as u8, - 0, 0, 0, 1 ]; +pub const metadata_encoding_version : &static/[u8] = + &[0x72, //'r' as u8, + 0x75, //'u' as u8, + 0x73, //'s' as u8, + 0x74, //'t' as u8, + 0, 0, 0, 1 ]; pub fn encode_metadata(parms: EncodeParams, crate: &crate) -> ~[u8] { let wr = @io::BytesWriter(); diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 1a7c7b0793a42..cd2c26a5ff46c 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -21,7 +21,7 @@ use core::result::Result; use core::result; use core::str; -pub type pick = fn(path: &Path) -> Option; +pub type pick = &self/fn(path: &Path) -> Option; pub fn pick_file(file: Path, path: &Path) -> Option { if path.file_path() == file { option::Some(copy *path) } diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 5cd4c17b4ee1d..64da6e5cabd94 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -49,7 +49,7 @@ pub enum DefIdSource { // Identifies a type parameter (`fn foo() { ... }`). TypeParameter } -type conv_did = fn(source: DefIdSource, ast::def_id) -> ast::def_id; +type conv_did = &self/fn(source: DefIdSource, ast::def_id) -> ast::def_id; pub struct PState { data: @~[u8], diff --git a/src/librustc/middle/borrowck/preserve.rs b/src/librustc/middle/borrowck/preserve.rs index c7f2dd9cb51e6..328fe1c4f3e74 100644 --- a/src/librustc/middle/borrowck/preserve.rs +++ b/src/librustc/middle/borrowck/preserve.rs @@ -64,7 +64,7 @@ pub impl BorrowckCtxt { } struct PreserveCtxt { - bccx: &BorrowckCtxt, + bccx: &self/BorrowckCtxt, // the region scope for which we must preserve the memory scope_region: ty::Region, @@ -79,7 +79,7 @@ struct PreserveCtxt { root_managed_data: bool } -pub impl PreserveCtxt { +pub impl PreserveCtxt/&self { fn tcx(&self) -> ty::ctxt { self.bccx.tcx } fn preserve(&self, cmt: cmt) -> bckres { diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 98a05d9b8dfd9..84de194915ad0 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -55,7 +55,7 @@ use syntax::{visit, ast_util}; // primitives in the stdlib are explicitly annotated to only take sendable // types. -pub const try_adding: &str = "Try adding a move"; +pub const try_adding: &static/str = "Try adding a move"; pub type rval_map = HashMap; diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 0f3051f60442d..32567d71cd965 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -312,7 +312,7 @@ fn LanguageItemCollector(crate: @crate, } struct LanguageItemCollector { - items: &mut LanguageItems, + items: &self/mut LanguageItems, crate: @crate, session: Session, @@ -320,7 +320,7 @@ struct LanguageItemCollector { item_refs: HashMap<@~str, uint>, } -pub impl LanguageItemCollector { +pub impl LanguageItemCollector/&self { fn match_and_collect_meta_item(&self, item_def_id: def_id, meta_item: @meta_item) { match meta_item.node { diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 49898885a6603..5479dac4d95be 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -212,9 +212,9 @@ pub impl ResolveResult { } pub enum TypeParameters/& { - NoTypeParameters, //< No type parameters. - HasTypeParameters(&Generics, //< Type parameters. - node_id, //< ID of the enclosing item + NoTypeParameters, //< No type parameters. + HasTypeParameters(&self/Generics, //< Type parameters. + node_id, //< ID of the enclosing item // The index to start numbering the type parameters at. // This is zero if this is the outermost set of type diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 0d3524ed7fb2f..2db3cae74e33b 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -328,13 +328,13 @@ pub type BindingsMap = HashMap; pub struct ArmData { bodycx: block, - arm: &ast::arm, + arm: &self/ast::arm, bindings_map: BindingsMap } pub struct Match { pats: ~[@ast::pat], - data: @ArmData + data: @ArmData/&self } pub fn match_to_str(bcx: block, m: &Match) -> ~str { @@ -392,7 +392,7 @@ pub fn expand_nested_bindings(bcx: block, m: &[@Match/&r], } } -pub type enter_pat = fn(@ast::pat) -> Option<~[@ast::pat]>; +pub type enter_pat = &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) { diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index 8bc47531d7208..4e416549b2299 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -550,8 +550,8 @@ pub fn trans_call_inner( pub enum CallArgs { - ArgExprs(&[@ast::expr]), - ArgVals(&[ValueRef]) + ArgExprs(&self/[@ast::expr]), + ArgVals(&self/[ValueRef]) } pub struct Args { diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index 54ef40df68457..1e3c4f21bd875 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -97,11 +97,11 @@ fn c_stack_tys(ccx: @CrateContext, }; } -type shim_arg_builder = fn(bcx: block, tys: @c_stack_tys, - llargbundle: ValueRef) -> ~[ValueRef]; +type shim_arg_builder = &self/fn(bcx: block, tys: @c_stack_tys, + llargbundle: ValueRef) -> ~[ValueRef]; -type shim_ret_builder = fn(bcx: block, tys: @c_stack_tys, - llargbundle: ValueRef, llretval: ValueRef); +type shim_ret_builder = &self/fn(bcx: block, tys: @c_stack_tys, + llargbundle: ValueRef, llretval: ValueRef); fn build_shim_fn_(ccx: @CrateContext, +shim_name: ~str, @@ -133,12 +133,12 @@ fn build_shim_fn_(ccx: @CrateContext, return llshimfn; } -type wrap_arg_builder = fn(bcx: block, tys: @c_stack_tys, - llwrapfn: ValueRef, - llargbundle: ValueRef); +type wrap_arg_builder = &self/fn(bcx: block, tys: @c_stack_tys, + llwrapfn: ValueRef, + llargbundle: ValueRef); -type wrap_ret_builder = fn(bcx: block, tys: @c_stack_tys, - llargbundle: ValueRef); +type wrap_ret_builder = &self/fn(bcx: block, tys: @c_stack_tys, + llargbundle: ValueRef); fn build_wrap_fn_(ccx: @CrateContext, tys: @c_stack_tys, diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index e88d95b0ebb1e..3e4486476c0b9 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -520,7 +520,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 = &fn(block, ValueRef, ty::t) -> block; +pub type iter_vec_block = &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 { diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 5d0b3f948e2d2..e437563647e2b 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -143,7 +143,7 @@ pub struct LookupContext { self_expr: @ast::expr, callee_id: node_id, m_name: ast::ident, - supplied_tps: &[ty::t], + supplied_tps: &self/[ty::t], impl_dups: HashMap, inherent_candidates: DVec, extension_candidates: DVec, @@ -176,7 +176,7 @@ pub enum TransformTypeFlag { TransformTypeForObject, } -pub impl LookupContext { +pub impl LookupContext/&self { fn do_lookup(&self, self_ty: ty::t) -> Option { debug!("do_lookup(self_ty=%s, expr=%s, self_expr=%s)", self.ty_to_str(self_ty), diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index fe12af52d26e1..5c59f1215e499 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -58,7 +58,7 @@ pub trait LatticeValue { -> cres; } -pub type LatticeOp = &fn(cf: &CombineFields, a: &T, b: &T) -> cres; +pub type LatticeOp = &self/fn(cf: &CombineFields, a: &T, b: &T) -> cres; impl LatticeValue for ty::t { static fn sub(&self, cf: &CombineFields, a: &ty::t, b: &ty::t) -> ures { @@ -378,7 +378,7 @@ pub fn super_lattice_tys( } } -pub type LatticeDirOp = &fn(a: &T, b: &T) -> cres; +pub type LatticeDirOp = &self/fn(a: &T, b: &T) -> cres; pub enum LatticeVarResult { VarResult(V), diff --git a/src/librustdoc/astsrv.rs b/src/librustdoc/astsrv.rs index 9b5f476009b64..85d9dfe6fa68e 100644 --- a/src/librustdoc/astsrv.rs +++ b/src/librustdoc/astsrv.rs @@ -36,7 +36,7 @@ pub struct Ctxt { ast_map: ast_map::map } -type SrvOwner = &fn(srv: Srv) -> T; +type SrvOwner = &'self fn(srv: Srv) -> T; pub type CtxtHandler = ~fn(ctxt: Ctxt) -> T; type Parser = ~fn(Session, s: ~str) -> @ast::crate; diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index e29474f82effc..b9b39063667ef 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -25,12 +25,17 @@ use core::ptr; use core::task; /// As sync::condvar, a mechanism for unlock-and-descheduling and signalling. -pub struct Condvar { is_mutex: bool, failed: &mut bool, cond: &sync::Condvar } +pub struct Condvar { + is_mutex: bool, + failed: &self/mut bool, + cond: &self/sync::Condvar/&self +} -pub impl &Condvar { +pub impl Condvar/&self { /// Atomically exit the associated ARC and block until a signal is sent. #[inline(always)] - fn wait() { self.wait_on(0) } + fn wait(&self) { self.wait_on(0) } + /** * Atomically exit the associated ARC and block on a specified condvar * until a signal is sent on that same condvar (as sync::cond.wait_on). @@ -38,33 +43,37 @@ pub impl &Condvar { * wait() is equivalent to wait_on(0). */ #[inline(always)] - fn wait_on(condvar_id: uint) { + fn wait_on(&self, condvar_id: uint) { assert !*self.failed; self.cond.wait_on(condvar_id); // This is why we need to wrap sync::condvar. check_poison(self.is_mutex, *self.failed); } + /// Wake up a blocked task. Returns false if there was no blocked task. #[inline(always)] - fn signal() -> bool { self.signal_on(0) } + fn signal(&self) -> bool { self.signal_on(0) } + /** * Wake up a blocked task on a specified condvar (as * sync::cond.signal_on). Returns false if there was no blocked task. */ #[inline(always)] - fn signal_on(condvar_id: uint) -> bool { + fn signal_on(&self, condvar_id: uint) -> bool { assert !*self.failed; self.cond.signal_on(condvar_id) } + /// Wake up all blocked tasks. Returns the number of tasks woken. #[inline(always)] - fn broadcast() -> uint { self.broadcast_on(0) } + fn broadcast(&self) -> uint { self.broadcast_on(0) } + /** * Wake up all blocked tasks on a specified condvar (as * sync::cond.broadcast_on). Returns Returns the number of tasks woken. */ #[inline(always)] - fn broadcast_on(condvar_id: uint) -> uint { + fn broadcast_on(&self, condvar_id: uint) -> uint { assert !*self.failed; self.cond.broadcast_on(condvar_id) } @@ -141,7 +150,7 @@ impl Clone for MutexARC { } } -pub impl &MutexARC { +pub impl MutexARC { /** * Access the underlying mutable data with mutual exclusion from other @@ -167,7 +176,7 @@ pub impl &MutexARC { * blocked on the mutex) will also fail immediately. */ #[inline(always)] - unsafe fn access(blk: fn(x: &mut T) -> U) -> U { + unsafe fn access(&self, blk: fn(x: &mut T) -> U) -> U { unsafe { let state = get_shared_mutable_state(&self.x); // Borrowck would complain about this if the function were @@ -179,9 +188,13 @@ pub impl &MutexARC { } } } + /// As access(), but with a condvar, as sync::mutex.lock_cond(). #[inline(always)] - unsafe fn access_cond(blk: fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { + unsafe fn access_cond( + &self, + blk: &fn(x: &x/mut T, c: &c/Condvar) -> U) -> U + { unsafe { let state = get_shared_mutable_state(&self.x); do (&(*state).lock).lock_cond |cond| { @@ -276,7 +289,7 @@ pub impl RWARC { } -pub impl &RWARC { +pub impl RWARC { /** * Access the underlying data mutably. Locks the rwlock in write mode; * other readers and writers will block. @@ -288,7 +301,7 @@ pub impl &RWARC { * poison the ARC, so subsequent readers and writers will both also fail. */ #[inline(always)] - fn write(blk: fn(x: &mut T) -> U) -> U { + fn write(&self, blk: fn(x: &mut T) -> U) -> U { unsafe { let state = get_shared_mutable_state(&self.x); do (*borrow_rwlock(state)).write { @@ -300,7 +313,7 @@ pub impl &RWARC { } /// As write(), but with a condvar, as sync::rwlock.write_cond(). #[inline(always)] - fn write_cond(blk: fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { + fn write_cond(&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| { @@ -389,13 +402,13 @@ fn borrow_rwlock(state: *const RWARCInner) -> *RWlock { /// The "write permission" token used for RWARC.write_downgrade(). pub enum RWWriteMode = - (&mut T, sync::RWlockWriteMode, PoisonOnFail); + (&self/mut T, sync::RWlockWriteMode/&self, PoisonOnFail); /// The "read permission" token used for RWARC.write_downgrade(). -pub enum RWReadMode = (&T, sync::RWlockReadMode); +pub enum RWReadMode = (&self/T, sync::RWlockReadMode/&self); -pub impl &RWWriteMode { +pub impl RWWriteMode/&self { /// Access the pre-downgrade RWARC in write mode. - fn write(blk: fn(x: &mut T) -> U) -> U { + fn write(&self, blk: fn(x: &mut T) -> U) -> U { match *self { RWWriteMode((ref data, ref token, _)) => { do token.write { @@ -405,7 +418,7 @@ pub impl &RWWriteMode { } } /// Access the pre-downgrade RWARC in write mode with a condvar. - fn write_cond(blk: fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { + fn write_cond(&self, blk: fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { match *self { RWWriteMode((ref data, ref token, ref poison)) => { do token.write_cond |cond| { @@ -423,9 +436,9 @@ pub impl &RWWriteMode { } } -pub impl &RWReadMode { +pub impl RWReadMode/&self { /// Access the post-downgrade rwlock in read mode. - fn read(blk: fn(x: &T) -> U) -> U { + fn read(&self, blk: fn(x: &T) -> U) -> U { match *self { RWReadMode((data, ref token)) => { do token.read { blk(data) } diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs index c7b50bf89083a..7bbd5cd41a3f4 100644 --- a/src/libstd/arena.rs +++ b/src/libstd/arena.rs @@ -160,9 +160,9 @@ unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) { (reinterpret_cast(&(p & !1)), p & 1 == 1) } -pub impl &Arena { +pub impl Arena { // Functions for the POD part of the arena - fn alloc_pod_grow(n_bytes: uint, align: uint) -> *u8 { + fn alloc_pod_grow(&self, n_bytes: uint, align: uint) -> *u8 { // Allocate a new chunk. let chunk_size = at_vec::capacity(self.pod_head.data); let new_min_chunk_size = uint::max(n_bytes, chunk_size); @@ -174,7 +174,7 @@ pub impl &Arena { } #[inline(always)] - fn alloc_pod_inner(n_bytes: uint, align: uint) -> *u8 { + fn alloc_pod_inner(&self, n_bytes: uint, align: uint) -> *u8 { let head = &mut self.pod_head; let start = round_up_to(head.fill, align); @@ -193,7 +193,7 @@ pub impl &Arena { } #[inline(always)] - fn alloc_pod(op: fn() -> T) -> &self/T { + fn alloc_pod(&self, op: fn() -> T) -> &self/T { unsafe { let tydesc = sys::get_type_desc::(); let ptr = self.alloc_pod_inner((*tydesc).size, (*tydesc).align); @@ -204,7 +204,7 @@ pub impl &Arena { } // Functions for the non-POD part of the arena - fn alloc_nonpod_grow(n_bytes: uint, align: uint) -> (*u8, *u8) { + fn alloc_nonpod_grow(&self, n_bytes: uint, align: uint) -> (*u8, *u8) { // Allocate a new chunk. let chunk_size = at_vec::capacity(self.head.data); let new_min_chunk_size = uint::max(n_bytes, chunk_size); @@ -216,7 +216,7 @@ pub impl &Arena { } #[inline(always)] - fn alloc_nonpod_inner(n_bytes: uint, align: uint) -> (*u8, *u8) { + fn alloc_nonpod_inner(&self, n_bytes: uint, align: uint) -> (*u8, *u8) { let head = &mut self.head; let tydesc_start = head.fill; @@ -238,7 +238,7 @@ pub impl &Arena { } #[inline(always)] - fn alloc_nonpod(op: fn() -> T) -> &self/T { + fn alloc_nonpod(&self, op: fn() -> T) -> &self/T { unsafe { let tydesc = sys::get_type_desc::(); let (ty_ptr, ptr) = @@ -260,7 +260,7 @@ pub impl &Arena { // The external interface #[inline(always)] - fn alloc(op: fn() -> T) -> &self/T { + fn alloc(&self, op: fn() -> T) -> &self/T { unsafe { if !rusti::needs_drop::() { self.alloc_pod(op) diff --git a/src/libstd/base64.rs b/src/libstd/base64.rs index 17b3cda07138d..dceb39312daf3 100644 --- a/src/libstd/base64.rs +++ b/src/libstd/base64.rs @@ -16,7 +16,7 @@ pub trait ToBase64 { pure fn to_base64() -> ~str; } -impl ToBase64 for &[u8] { +impl ToBase64 for &self/[u8] { pure fn to_base64() -> ~str { let chars = str::chars( ~"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" @@ -69,7 +69,7 @@ impl ToBase64 for &[u8] { } } -impl ToBase64 for &str { +impl ToBase64 for &self/str { pure fn to_base64() -> ~str { str::to_bytes(self).to_base64() } diff --git a/src/libstd/bigint.rs b/src/libstd/bigint.rs index e8836c5866284..a3109c00c0125 100644 --- a/src/libstd/bigint.rs +++ b/src/libstd/bigint.rs @@ -1045,7 +1045,9 @@ mod biguint_tests { assert BigUint::new(~[0, 0, -1]).to_uint() == uint::max_value; } - const sum_triples: &[(&[BigDigit], &[BigDigit], &[BigDigit])] = &[ + const sum_triples: &static/[(&static/[BigDigit], + &static/[BigDigit], + &static/[BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[ 1]), (&[ 1], &[ 1], &[ 2]), @@ -1083,7 +1085,9 @@ mod biguint_tests { } } - const mul_triples: &[(&[BigDigit], &[BigDigit], &[BigDigit])] = &[ + const mul_triples: &static/[(&static/[BigDigit], + &static/[BigDigit], + &static/[BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[]), (&[ 2], &[], &[]), @@ -1107,8 +1111,10 @@ mod biguint_tests { (&[ 0, 0, 1], &[ 0, 0, 0, 1], &[0, 0, 0, 0, 0, 1]) ]; - const divmod_quadruples: &[(&[BigDigit], &[BigDigit], - &[BigDigit], &[BigDigit])] + const divmod_quadruples: &static/[(&static/[BigDigit], + &static/[BigDigit], + &static/[BigDigit], + &static/[BigDigit])] = &[ (&[ 1], &[ 2], &[], &[1]), (&[ 1, 1], &[ 2], &[-1/2+1], &[1]), @@ -1393,7 +1399,9 @@ mod bigint_tests { ).to_uint() == 0; } - const sum_triples: &[(&[BigDigit], &[BigDigit], &[BigDigit])] = &[ + const sum_triples: &static/[(&static/[BigDigit], + &static/[BigDigit], + &static/[BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[ 1]), (&[ 1], &[ 1], &[ 2]), @@ -1443,7 +1451,9 @@ mod bigint_tests { } } - const mul_triples: &[(&[BigDigit], &[BigDigit], &[BigDigit])] = &[ + const mul_triples: &static/[(&static/[BigDigit], + &static/[BigDigit], + &static/[BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[]), (&[ 2], &[], &[]), @@ -1467,8 +1477,10 @@ mod bigint_tests { (&[ 0, 0, 1], &[ 0, 0, 0, 1], &[0, 0, 0, 0, 0, 1]) ]; - const divmod_quadruples: &[(&[BigDigit], &[BigDigit], - &[BigDigit], &[BigDigit])] + const divmod_quadruples: &static/[(&static/[BigDigit], + &static/[BigDigit], + &static/[BigDigit], + &static/[BigDigit])] = &[ (&[ 1], &[ 2], &[], &[1]), (&[ 1, 1], &[ 2], &[-1/2+1], &[1]), diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index 8f6ec2b9cd96e..798c5ae57c782 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -468,8 +468,8 @@ pub mod flatteners { static fn from_writer(w: Writer) -> Self; } - impl FromReader for json::Decoder { - static fn from_reader(r: Reader) -> json::Decoder { + impl FromReader for json::Decoder/&self { + static fn from_reader(r: Reader) -> json::Decoder/&self { match json::from_reader(r) { Ok(json) => { json::Decoder(json) diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 7993f15f622c8..cfa66ae000aa5 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -749,14 +749,14 @@ pub fn from_str(s: &str) -> Result { pub struct Decoder { priv json: Json, - priv mut stack: ~[&Json], + priv mut stack: ~[&self/Json], } pub fn Decoder(json: Json) -> Decoder { Decoder { json: json, stack: ~[] } } -priv impl Decoder { +priv impl Decoder/&self { fn peek(&self) -> &self/Json { if self.stack.len() == 0 { self.stack.push(&self.json); } self.stack[self.stack.len() - 1] @@ -768,7 +768,7 @@ priv impl Decoder { } } -impl serialize::Decoder for Decoder { +impl serialize::Decoder for Decoder/&self { fn read_nil(&self) -> () { debug!("read_nil"); match *self.pop() { diff --git a/src/libstd/serialize.rs b/src/libstd/serialize.rs index 66db951e12bde..5bbd926ba6beb 100644 --- a/src/libstd/serialize.rs +++ b/src/libstd/serialize.rs @@ -213,7 +213,7 @@ impl Decodable for i64 { } } -impl Encodable for &str { +impl Encodable for &self/str { fn encode(&self, s: &S) { s.emit_borrowed_str(*self) } } @@ -286,7 +286,7 @@ impl Decodable for () { } } -impl> Encodable for &T { +impl> Encodable for &self/T { fn encode(&self, s: &S) { s.emit_borrowed(|| (**self).encode(s)) } @@ -316,7 +316,7 @@ impl> Decodable for @T { } } -impl> Encodable for &[T] { +impl> Encodable for &self/[T] { fn encode(&self, s: &S) { do s.emit_borrowed_vec(self.len()) { for self.eachi |i, e| { diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index 68d22f7c919a6..aad8fab834f34 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -22,7 +22,7 @@ pub struct SmallIntMap { priv v: ~[Option], } -impl BaseIter<(uint, &V)> for SmallIntMap { +impl BaseIter<(uint, &self/V)> for SmallIntMap { /// Visit all key-value pairs in order pure fn each(&self, it: fn(&(uint, &self/V)) -> bool) { for uint::range(0, self.v.len()) |i| { @@ -36,7 +36,7 @@ impl BaseIter<(uint, &V)> for SmallIntMap { pure fn size_hint(&self) -> Option { Some(self.len()) } } -impl ReverseIter<(uint, &V)> for SmallIntMap { +impl ReverseIter<(uint, &self/V)> for SmallIntMap { /// Visit all key-value pairs in reverse order pure fn each_reverse(&self, it: fn(&(uint, &self/V)) -> bool) { for uint::range_rev(self.v.len(), 0) |i| { diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 43fab9df1631e..5c037b5bac5bf 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -17,7 +17,7 @@ use core::util; use core::vec::{len, push}; use core::vec; -type Le = pure fn(v1: &T, v2: &T) -> bool; +type Le = &self/pure fn(v1: &T, v2: &T) -> bool; /** * Merge sort. Returns a new vector containing the sorted list. @@ -169,7 +169,7 @@ pub trait Sort { fn qsort(self); } -impl Sort for &mut [T] { +impl Sort for &self/mut [T] { fn qsort(self) { quick_sort3(self); } } @@ -1178,11 +1178,10 @@ mod big_tests { struct LVal { val: uint, - key: fn(@uint), - + key: &self/fn(@uint), } - impl Drop for LVal { + impl Drop for LVal/&self { fn finalize(&self) { let x = unsafe { task::local_data::local_data_get(self.key) }; match x { @@ -1196,7 +1195,7 @@ mod big_tests { } } - impl Ord for LVal { + impl Ord for LVal/&self { pure fn lt(&self, other: &a/LVal/&self) -> bool { (*self).val < other.val } diff --git a/src/libstd/stats.rs b/src/libstd/stats.rs index 7dafdec95e072..b786699351e35 100644 --- a/src/libstd/stats.rs +++ b/src/libstd/stats.rs @@ -30,7 +30,7 @@ pub trait Stats { fn median_abs_dev_pct(self) -> f64; } -impl Stats for &[f64] { +impl Stats for &self/[f64] { fn sum(self) -> f64 { vec::foldl(0.0, self, |p,q| p + *q) } diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index 83f80f9438203..e02d09954d32a 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -98,7 +98,7 @@ fn new_sem_and_signal(count: int, num_condvars: uint) } #[doc(hidden)] -pub impl &Sem { +pub impl &self/Sem { fn acquire() { let mut waiter_nobe = None; unsafe { @@ -134,7 +134,7 @@ pub impl &Sem { } // FIXME(#3154) move both copies of this into Sem, and unify the 2 structs #[doc(hidden)] -pub impl &Sem<()> { +pub impl &self/Sem<()> { fn access(blk: fn() -> U) -> U { let mut release = None; unsafe { @@ -147,7 +147,7 @@ pub impl &Sem<()> { } } #[doc(hidden)] -pub impl &Sem<~[Waitqueue]> { +pub impl &self/Sem<~[Waitqueue]> { fn access(blk: fn() -> U) -> U { let mut release = None; unsafe { @@ -162,11 +162,11 @@ pub impl &Sem<~[Waitqueue]> { // FIXME(#3588) should go inside of access() #[doc(hidden)] -type SemRelease = SemReleaseGeneric<()>; -type SemAndSignalRelease = SemReleaseGeneric<~[Waitqueue]>; -struct SemReleaseGeneric { sem: &Sem } +type SemRelease = SemReleaseGeneric/&self<()>; +type SemAndSignalRelease = SemReleaseGeneric/&self<~[Waitqueue]>; +struct SemReleaseGeneric { sem: &self/Sem } -impl Drop for SemReleaseGeneric { +impl Drop for SemReleaseGeneric/&self { fn finalize(&self) { self.sem.release(); } @@ -186,11 +186,11 @@ fn SemAndSignalRelease(sem: &r/Sem<~[Waitqueue]>) } /// A mechanism for atomic-unlock-and-deschedule blocking and signalling. -pub struct Condvar { priv sem: &Sem<~[Waitqueue]> } +pub struct Condvar { priv sem: &self/Sem<~[Waitqueue]> } -impl Drop for Condvar { fn finalize(&self) {} } +impl Drop for Condvar/&self { fn finalize(&self) {} } -pub impl &Condvar { +pub impl Condvar/&self { /** * Atomically drop the associated lock, and block until a signal is sent. * @@ -199,7 +199,8 @@ pub impl &Condvar { * while waiting on a condition variable will wake up, fail, and unlock * the associated lock as it unwinds. */ - fn wait() { self.wait_on(0) } + fn wait(&self) { self.wait_on(0) } + /** * As wait(), but can specify which of multiple condition variables to * wait on. Only a signal_on() or broadcast_on() with the same condvar_id @@ -211,7 +212,7 @@ pub impl &Condvar { * * wait() is equivalent to wait_on(0). */ - fn wait_on(condvar_id: uint) { + fn wait_on(&self, condvar_id: uint) { // Create waiter nobe. let (WaitEnd, SignalEnd) = comm::oneshot(); let mut WaitEnd = Some(WaitEnd); @@ -256,10 +257,10 @@ pub impl &Condvar { // mutex during unwinding. As long as the wrapper (mutex, etc) is // bounded in when it gets released, this shouldn't hang forever. struct SemAndSignalReacquire { - sem: &Sem<~[Waitqueue]>, + sem: &self/Sem<~[Waitqueue]>, } - impl Drop for SemAndSignalReacquire { + impl Drop for SemAndSignalReacquire/&self { fn finalize(&self) { unsafe { // Needs to succeed, instead of itself dying. @@ -279,9 +280,10 @@ pub impl &Condvar { } /// Wake up a blocked task. Returns false if there was no blocked task. - fn signal() -> bool { self.signal_on(0) } + fn signal(&self) -> bool { self.signal_on(0) } + /// As signal, but with a specified condvar_id. See wait_on. - fn signal_on(condvar_id: uint) -> bool { + fn signal_on(&self, condvar_id: uint) -> bool { let mut out_of_bounds = None; let mut result = false; unsafe { @@ -299,9 +301,10 @@ pub impl &Condvar { } /// Wake up all blocked tasks. Returns the number of tasks woken. - fn broadcast() -> uint { self.broadcast_on(0) } + fn broadcast(&self) -> uint { self.broadcast_on(0) } + /// As broadcast, but with a specified condvar_id. See wait_on. - fn broadcast_on(condvar_id: uint) -> uint { + fn broadcast_on(&self, condvar_id: uint) -> uint { let mut out_of_bounds = None; let mut queue = None; unsafe { @@ -342,9 +345,9 @@ fn check_cvar_bounds(out_of_bounds: Option, id: uint, act: &str, } #[doc(hidden)] -pub impl &Sem<~[Waitqueue]> { +pub impl Sem<~[Waitqueue]> { // The only other place that condvars get built is rwlock_write_mode. - fn access_cond(blk: fn(c: &Condvar) -> U) -> U { + fn access_cond(&self, blk: fn(c: &Condvar) -> U) -> U { do self.access { blk(&Condvar { sem: self }) } } } @@ -368,18 +371,18 @@ impl Clone for Semaphore { } } -pub impl &Semaphore { +pub impl Semaphore { /** * Acquire a resource represented by the semaphore. Blocks if necessary * until resource(s) become available. */ - fn acquire() { (&self.sem).acquire() } + fn acquire(&self) { (&self.sem).acquire() } /** * Release a held resource represented by the semaphore. Wakes a blocked * contending task, if any exist. Won't block the caller. */ - fn release() { (&self.sem).release() } + fn release(&self) { (&self.sem).release() } /// Run a function with ownership of one of the semaphore's resources. fn access(blk: fn() -> U) -> U { (&self.sem).access(blk) } @@ -416,12 +419,12 @@ impl Clone for Mutex { fn clone(&self) -> Mutex { Mutex { sem: Sem((*self.sem).clone()) } } } -pub impl &Mutex { +pub impl Mutex { /// Run a function with ownership of the mutex. - fn lock(blk: fn() -> U) -> U { (&self.sem).access(blk) } + fn lock(&self, blk: fn() -> U) -> U { (&self.sem).access(blk) } /// Run a function with ownership of the mutex and a handle to a condvar. - fn lock_cond(blk: fn(c: &Condvar) -> U) -> U { + fn lock_cond(&self, blk: fn(c: &Condvar) -> U) -> U { (&self.sem).access_cond(blk) } } @@ -465,9 +468,9 @@ pub fn rwlock_with_condvars(num_condvars: uint) -> RWlock { read_count: 0 }) } } -pub impl &RWlock { +pub impl RWlock { /// Create a new handle to the rwlock. - fn clone() -> RWlock { + fn clone(&self) -> RWlock { RWlock { order_lock: (&(self.order_lock)).clone(), access_lock: Sem((*self.access_lock).clone()), state: self.state.clone() } @@ -477,7 +480,7 @@ pub impl &RWlock { * Run a function with the rwlock in read mode. Calls to 'read' from other * tasks may run concurrently with this one. */ - fn read(blk: fn() -> U) -> U { + fn read(&self, blk: fn() -> U) -> U { let mut release = None; unsafe { do task::unkillable { @@ -508,7 +511,7 @@ pub impl &RWlock { * Run a function with the rwlock in write mode. No calls to 'read' or * 'write' from other tasks will run concurrently with this one. */ - fn write(blk: fn() -> U) -> U { + fn write(&self, blk: fn() -> U) -> U { unsafe { do task::unkillable { (&self.order_lock).acquire(); @@ -526,7 +529,7 @@ pub impl &RWlock { * the waiting task is signalled. (Note: a writer that waited and then * was signalled might reacquire the lock before other waiting writers.) */ - fn write_cond(blk: fn(c: &Condvar) -> U) -> U { + fn write_cond(&self, blk: fn(c: &Condvar) -> U) -> U { // NB: You might think I should thread the order_lock into the cond // wait call, so that it gets waited on before access_lock gets // reacquired upon being woken up. However, (a) this would be not @@ -561,7 +564,7 @@ pub impl &RWlock { * } * ~~~ */ - fn write_downgrade(blk: fn(v: RWlockWriteMode) -> U) -> U { + fn write_downgrade(&self, blk: fn(v: RWlockWriteMode) -> U) -> U { // Implementation slightly different from the slicker 'write's above. // The exit path is conditional on whether the caller downgrades. let mut _release = None; @@ -577,7 +580,7 @@ pub impl &RWlock { } /// To be called inside of the write_downgrade block. - fn downgrade(token: RWlockWriteMode/&a) -> RWlockReadMode/&a { + fn downgrade(&self, token: RWlockWriteMode/&a) -> RWlockReadMode/&a { if !ptr::ref_eq(self, token.lock) { fail!(~"Can't downgrade() with a different rwlock's write_mode!"); } @@ -606,10 +609,10 @@ pub impl &RWlock { // FIXME(#3588) should go inside of read() #[doc(hidden)] struct RWlockReleaseRead { - lock: &RWlock, + lock: &self/RWlock, } -impl Drop for RWlockReleaseRead { +impl Drop for RWlockReleaseRead/&self { fn finalize(&self) { unsafe { do task::unkillable { @@ -640,10 +643,10 @@ fn RWlockReleaseRead(lock: &r/RWlock) -> RWlockReleaseRead/&r { // FIXME(#3588) should go inside of downgrade() #[doc(hidden)] struct RWlockReleaseDowngrade { - lock: &RWlock, + lock: &self/RWlock, } -impl Drop for RWlockReleaseDowngrade { +impl Drop for RWlockReleaseDowngrade/&self { fn finalize(&self) { unsafe { do task::unkillable { @@ -680,23 +683,25 @@ fn RWlockReleaseDowngrade(lock: &r/RWlock) -> RWlockReleaseDowngrade/&r { } /// The "write permission" token used for rwlock.write_downgrade(). -pub struct RWlockWriteMode { priv lock: &RWlock } -impl Drop for RWlockWriteMode { fn finalize(&self) {} } +pub struct RWlockWriteMode { priv lock: &self/RWlock } +impl Drop for RWlockWriteMode/&self { fn finalize(&self) {} } + /// The "read permission" token used for rwlock.write_downgrade(). -pub struct RWlockReadMode { priv lock: &RWlock } -impl Drop for RWlockReadMode { fn finalize(&self) {} } +pub struct RWlockReadMode { priv lock: &self/RWlock } +impl Drop for RWlockReadMode/&self { fn finalize(&self) {} } -pub impl &RWlockWriteMode { +pub impl RWlockWriteMode/&self { /// Access the pre-downgrade rwlock in write mode. - fn write(blk: fn() -> U) -> U { blk() } + fn write(&self, blk: fn() -> U) -> U { blk() } /// Access the pre-downgrade rwlock in write mode with a condvar. - fn write_cond(blk: fn(c: &Condvar) -> U) -> U { + fn write_cond(&self, blk: fn(c: &Condvar) -> U) -> U { blk(&Condvar { sem: &self.lock.access_lock }) } } -pub impl &RWlockReadMode { + +pub impl RWlockReadMode/&self { /// Access the post-downgrade rwlock in read mode. - fn read(blk: fn() -> U) -> U { blk() } + fn read(&self, blk: fn() -> U) -> U { blk() } } /**************************************************************************** diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index a8d343f80987e..d1fe1d4c67a86 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -94,7 +94,7 @@ impl Ord for TreeMap { } } -impl BaseIter<(&K, &V)> for TreeMap { +impl<'self, K: TotalOrd, V> BaseIter<(&'self K, &'self V)> for TreeMap { /// Visit all key-value pairs in order pure fn each(&self, f: fn(&(&self/K, &self/V)) -> bool) { each(&self.root, f) @@ -102,7 +102,10 @@ impl BaseIter<(&K, &V)> for TreeMap { pure fn size_hint(&self) -> Option { Some(self.len()) } } -impl ReverseIter<(&K, &V)> for TreeMap { +impl<'self, K: TotalOrd, V> + ReverseIter<(&'self K, &'self V)> + for TreeMap +{ /// Visit all key-value pairs in reverse order pure fn each_reverse(&self, f: fn(&(&self/K, &self/V)) -> bool) { each_reverse(&self.root, f); @@ -195,8 +198,8 @@ pub impl TreeMap { /// Lazy forward iterator over a map pub struct TreeMapIterator { - priv stack: ~[&~TreeNode], - priv node: &Option<~TreeNode> + priv stack: ~[&self/~TreeNode], + priv node: &self/Option<~TreeNode> } /// Advance the iterator to the next node (in order) and return a @@ -494,7 +497,7 @@ pub impl TreeSet { /// Lazy forward iterator over a set pub struct TreeSetIterator { - priv iter: TreeMapIterator + priv iter: TreeMapIterator/&self } /// Advance the iterator to the next node (in order). If this iterator is diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs index c46c2d17ed0c6..e5435ca18b7a1 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -168,7 +168,8 @@ struct Database { } pub impl Database { - fn prepare(&mut self, fn_name: &str, + fn prepare(&mut self, + fn_name: &str, declared_inputs: &WorkMap) -> Option<(WorkMap, WorkMap, ~str)> { let k = json_encode(&(fn_name, declared_inputs)); @@ -233,7 +234,9 @@ fn json_encode>(t: &T) -> ~str { } } -fn json_decode>(s: &str) -> T { +fn json_decode>( // FIXME(#5121) + s: &str) -> T +{ do io::with_str_reader(s) |rdr| { let j = result::unwrap(json::from_reader(rdr)); Decodable::decode(&json::Decoder(j)) @@ -261,7 +264,9 @@ pub impl Context { Context{db: db, logger: lg, cfg: cfg, freshness: LinearMap::new()} } - fn prep + Decodable>( + fn prep + + Decodable>( // FIXME(#5121) @self, fn_name:&str, blk: fn(@Mut)->Work) -> Work { @@ -277,7 +282,9 @@ trait TPrep { fn declare_input(&self, kind:&str, name:&str, val:&str); fn is_fresh(&self, cat:&str, kind:&str, name:&str, val:&str) -> bool; fn all_fresh(&self, cat:&str, map:&WorkMap) -> bool; - fn exec + Decodable>( + fn exec + + Decodable>( // FIXME(#5121) &self, blk: ~fn(&Exec) -> T) -> Work; } @@ -316,7 +323,9 @@ impl TPrep for @Mut { return true; } - fn exec + Decodable>( + fn exec + + Decodable>( // FIXME(#5121) &self, blk: ~fn(&Exec) -> T) -> Work { let mut bo = Some(blk); @@ -355,14 +364,18 @@ impl TPrep for @Mut { } } -pub impl+Decodable> Work { +pub impl + + Decodable> Work { // FIXME(#5121) static fn new(p: @Mut, e: Either>) -> Work { Work { prep: p, res: Some(e) } } } // FIXME (#3724): movable self. This should be in impl Work. -fn unwrap + Decodable>( +fn unwrap + + Decodable>( // FIXME(#5121) w: Work) -> T { let mut ww = w; let mut s = None; diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs index 07896236442c0..8c12bbad3607b 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -46,18 +46,16 @@ pub impl Junction { } } -type ExpandDerivingStructDefFn = &fn(ext_ctxt, - span, - x: &struct_def, - ident, - y: &Generics) - -> @item; -type ExpandDerivingEnumDefFn = &fn(ext_ctxt, - span, - x: &enum_def, - ident, - y: &Generics) - -> @item; +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; pub fn expand_deriving_eq(cx: ext_ctxt, span: span, diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 03633a89a8612..7b4f92ab3ca83 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -442,11 +442,12 @@ pub fn core_macros() -> ~str { mod $c { fn key(_x: @::core::condition::Handler<$in,$out>) { } - pub const cond : ::core::condition::Condition<$in,$out> = + pub const cond : + ::core::condition::Condition/&static<$in,$out> = ::core::condition::Condition { - name: stringify!($c), - key: key - }; + name: stringify!($c), + key: key + }; } } ) diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 275f5a433979a..3b4b198e59568 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -35,8 +35,8 @@ use core::u64; use core::vec; // The @ps is stored here to prevent recursive type. -pub enum ann_node/& { - node_block(@ps, &ast::blk), +pub enum ann_node<'self> { + node_block(@ps, &'self ast::blk), node_item(@ps, @ast::item), node_expr(@ps, @ast::expr), node_pat(@ps, @ast::pat), diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 4cc97dad97cf2..5e97793b48069 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -28,14 +28,14 @@ use opt_vec::OptVec; // hold functions that take visitors. A vt enum is used to break the cycle. pub enum vt { mk_vt(visitor), } -pub enum fn_kind { - fk_item_fn(ident, &Generics, purity), // fn foo() - fk_method(ident, &Generics, &method), // fn foo(&self) +pub enum fn_kind<'self> { + fk_item_fn(ident, &'self Generics, purity), // fn foo() + fk_method(ident, &'self Generics, &'self method), // fn foo(&self) fk_anon(ast::Sigil), // fn@(x, y) { ... } fk_fn_block, // |x, y| ... fk_dtor( // class destructor - &Generics, - &[attribute], + &'self Generics, + &'self [attribute], node_id /* self id */, def_id /* parent class id */ ) diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index c9d85eb758983..59ee07b2cf8eb 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -12,7 +12,10 @@ extern mod std; use std::arena; use methods = std::arena::Arena; -enum tree/& { nil, node(&tree, &tree, int), } +enum tree { + nil, + node(&'self tree<'self>, &'self tree<'self>, int), +} fn item_check(t: &tree) -> int { match *t { @@ -23,9 +26,9 @@ fn item_check(t: &tree) -> int { } } -fn bottom_up_tree(arena: &r/arena::Arena, +fn bottom_up_tree(arena: &'r arena::Arena, item: int, - depth: int) -> &r/tree { + depth: int) -> &'r tree<'r> { if depth > 0 { return arena.alloc( || node(bottom_up_tree(arena, 2 * item - 1, depth - 1), diff --git a/src/test/compile-fail/auto-ref-borrowck-failure.rs b/src/test/compile-fail/auto-ref-borrowck-failure.rs index f5dbef3c061bf..3cf1c770df794 100644 --- a/src/test/compile-fail/auto-ref-borrowck-failure.rs +++ b/src/test/compile-fail/auto-ref-borrowck-failure.rs @@ -18,7 +18,7 @@ trait Stuff { fn printme(); } -impl Stuff for &mut Foo { +impl Stuff for &'self mut Foo { fn printme() { io::println(fmt!("%d", self.x)); } diff --git a/src/test/compile-fail/auto-ref-slice-plus-ref.rs b/src/test/compile-fail/auto-ref-slice-plus-ref.rs index db89dcfea02b2..7faee6f7ea28f 100644 --- a/src/test/compile-fail/auto-ref-slice-plus-ref.rs +++ b/src/test/compile-fail/auto-ref-slice-plus-ref.rs @@ -23,6 +23,6 @@ trait MyIter { pure fn test_mut(&mut self); } -impl MyIter for &[int] { +impl MyIter for &'self [int] { pure fn test_mut(&mut self) { } } diff --git a/src/test/compile-fail/borrowck-autoref-3261.rs b/src/test/compile-fail/borrowck-autoref-3261.rs index 1d96c04f10559..7873adbf21d8e 100644 --- a/src/test/compile-fail/borrowck-autoref-3261.rs +++ b/src/test/compile-fail/borrowck-autoref-3261.rs @@ -9,7 +9,7 @@ // except according to those terms. enum X = Either<(uint,uint),extern fn()>; -pub impl &X { +pub impl &'self X { fn with(blk: fn(x: &Either<(uint,uint),extern fn()>)) { blk(&**self) } diff --git a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs index 404644e78e2e5..fd8190358c9d0 100644 --- a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs +++ b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs @@ -9,16 +9,16 @@ // except according to those terms. struct defer { - x: &[&str], + x: &'self [&'self str], } -impl Drop for defer { +impl Drop for defer<'self> { fn finalize(&self) { error!("%?", self.x); } } -fn defer(x: &r/[&r/str]) -> defer/&r { +fn defer(x: &'r [&'r str]) -> defer<'r> { defer { x: x } diff --git a/src/test/compile-fail/issue-1896-1.rs b/src/test/compile-fail/issue-1896-1.rs index af37949573108..1b66e8ecdc96e 100644 --- a/src/test/compile-fail/issue-1896-1.rs +++ b/src/test/compile-fail/issue-1896-1.rs @@ -8,11 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct boxedFn { theFn: ~fn() -> uint } +struct boxedFn { theFn: &'self fn() -> uint } fn createClosure (closedUint: uint) -> boxedFn { - let result: @fn() -> uint = || closedUint; - boxedFn { theFn: result } //~ ERROR mismatched types + boxedFn {theFn: @fn () -> uint { closedUint }} //~ ERROR illegal borrow } fn main () { diff --git a/src/test/compile-fail/issue-3154.rs b/src/test/compile-fail/issue-3154.rs index 8f638713742e5..615bf64eed54e 100644 --- a/src/test/compile-fail/issue-3154.rs +++ b/src/test/compile-fail/issue-3154.rs @@ -9,7 +9,7 @@ // except according to those terms. struct thing { - x: &Q + x: &'self Q } fn thing(x: &Q) -> thing { diff --git a/src/test/compile-fail/issue-3311.rs b/src/test/compile-fail/issue-3311.rs index 1207ddcb9a042..8872357a8d440 100644 --- a/src/test/compile-fail/issue-3311.rs +++ b/src/test/compile-fail/issue-3311.rs @@ -10,17 +10,17 @@ #[legacy_mode] struct Foo { - s: &str, + s: &'self str, u: ~() } -pub impl Foo { +pub impl Foo<'self> { fn get_s(&self) -> &self/str { self.s } } -fn bar(s: &str, f: fn(Option)) { +fn bar(s: &str, f: &fn(Option)) { f(Some(Foo {s: s, u: ~()})); } diff --git a/src/test/compile-fail/issue-4523.rs b/src/test/compile-fail/issue-4523.rs index 49510c33858be..6045ac6cba351 100644 --- a/src/test/compile-fail/issue-4523.rs +++ b/src/test/compile-fail/issue-4523.rs @@ -10,7 +10,7 @@ fn foopy() {} -const f: fn() = foopy; //~ ERROR mismatched types: expected `&static/fn()` +const f: &'static fn() = foopy; //~ ERROR mismatched types: expected `&static/fn()` fn main () { f(); diff --git a/src/test/compile-fail/kindck-owned-trait-scoped.rs b/src/test/compile-fail/kindck-owned-trait-scoped.rs index 2e0f277486195..a51f7d8efbeb6 100644 --- a/src/test/compile-fail/kindck-owned-trait-scoped.rs +++ b/src/test/compile-fail/kindck-owned-trait-scoped.rs @@ -12,11 +12,11 @@ // be parameterized by a region due to the &self/int constraint. trait foo { - fn foo(i: &self/int) -> int; + fn foo(i: &'self int) -> int; } -impl foo for T { - fn foo(i: &self/int) -> int {*i} +impl foo<'self> for T { + fn foo(i: &'self int) -> int {*i} } fn to_foo(t: T) { diff --git a/src/test/compile-fail/regions-bounds.rs b/src/test/compile-fail/regions-bounds.rs index 47ddbf38e3de1..c7a951c9c056d 100644 --- a/src/test/compile-fail/regions-bounds.rs +++ b/src/test/compile-fail/regions-bounds.rs @@ -12,25 +12,25 @@ // nominal types (but not on other types) and that they are type // checked. -enum an_enum = ∫ +enum an_enum = &'self int; trait a_trait { fn foo() -> &'self int; } struct a_class { x:&'self int } -fn a_fn1(e: an_enum/&a) -> an_enum/&b { +fn a_fn1(e: an_enum<'a>) -> an_enum<'b> { return e; //~ ERROR mismatched types: expected `an_enum/&b` but found `an_enum/&a` } -fn a_fn2(e: a_trait/&a) -> a_trait/&b { +fn a_fn2(e: a_trait<'a>) -> a_trait<'b> { return e; //~ ERROR mismatched types: expected `@a_trait/&b` but found `@a_trait/&a` } -fn a_fn3(e: a_class/&a) -> a_class/&b { +fn a_fn3(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(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; diff --git a/src/test/compile-fail/regions-creating-enums.rs b/src/test/compile-fail/regions-creating-enums.rs index 5468cd55644c6..27fcd2338fa51 100644 --- a/src/test/compile-fail/regions-creating-enums.rs +++ b/src/test/compile-fail/regions-creating-enums.rs @@ -12,7 +12,7 @@ enum ast { num(uint), - add(&ast, &ast) + add(&'self ast<'self>, &'self ast<'self>) } fn build() { diff --git a/src/test/compile-fail/regions-creating-enums3.rs b/src/test/compile-fail/regions-creating-enums3.rs index d5e1a2a166d4c..de0f18392e643 100644 --- a/src/test/compile-fail/regions-creating-enums3.rs +++ b/src/test/compile-fail/regions-creating-enums3.rs @@ -10,10 +10,10 @@ enum ast { num(uint), - add(&ast, &ast) + add(&'self ast<'self>, &'self ast<'self>) } -fn mk_add_bad1(x: &a/ast, y: &b/ast) -> ast/&a { +fn mk_add_bad1(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> { add(x, y) //~ ERROR cannot infer an appropriate lifetime } diff --git a/src/test/compile-fail/regions-creating-enums4.rs b/src/test/compile-fail/regions-creating-enums4.rs index 355451c50e1be..d9a6c48fa27e5 100644 --- a/src/test/compile-fail/regions-creating-enums4.rs +++ b/src/test/compile-fail/regions-creating-enums4.rs @@ -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(&ast, &ast) + add(&'self ast<'self>, &'self ast<'self>) } -fn mk_add_bad2(x: &a/ast, y: &a/ast, z: &ast) -> ast { +fn mk_add_bad2(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast { add(x, y) //~^ ERROR cannot infer an appropriate lifetime } diff --git a/src/test/compile-fail/regions-escape-via-trait-or-not.rs b/src/test/compile-fail/regions-escape-via-trait-or-not.rs index e4598adca27df..0a1e917c361af 100644 --- a/src/test/compile-fail/regions-escape-via-trait-or-not.rs +++ b/src/test/compile-fail/regions-escape-via-trait-or-not.rs @@ -12,7 +12,7 @@ trait deref { fn get() -> int; } -impl deref for &int { +impl deref for &'self int { fn get() -> int { *self } diff --git a/src/test/compile-fail/regions-glb-free-free.rs b/src/test/compile-fail/regions-glb-free-free.rs index 44cd89ec0ea47..2732e49555894 100644 --- a/src/test/compile-fail/regions-glb-free-free.rs +++ b/src/test/compile-fail/regions-glb-free-free.rs @@ -11,19 +11,19 @@ mod argparse { extern mod std; - pub struct Flag { - name: &str, - desc: &str, + pub struct Flag<'self> { + name: &'self str, + desc: &'self str, max_count: uint, value: uint } - pub fn flag(name: &r/str, desc: &r/str) -> Flag/&r { + pub fn flag(name: &'r str, desc: &'r str) -> Flag<'r> { Flag { name: name, desc: desc, max_count: 1, value: 0 } } - pub impl Flag { - fn set_desc(self, s: &str) -> Flag { + pub impl Flag<'self> { + fn set_desc(self, s: &str) -> Flag<'self> { Flag { //~ ERROR cannot infer an appropriate lifetime name: self.name, desc: s, diff --git a/src/test/compile-fail/regions-in-consts.rs b/src/test/compile-fail/regions-in-consts.rs index 1d6ddc4cd9ade..d3e5bfd3e85b7 100644 --- a/src/test/compile-fail/regions-in-consts.rs +++ b/src/test/compile-fail/regions-in-consts.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const c_x: &blk/int = &22; //~ ERROR only the static region is allowed here -const c_y: &static/int = &22; +const c_x: &'blk int = &22; //~ ERROR only the static region is allowed here +const c_y: &int = &22; //~ ERROR only the static region is allowed here +const c_z: &'static int = &22; fn main() { } diff --git a/src/test/compile-fail/regions-in-rsrcs.rs b/src/test/compile-fail/regions-in-structs.rs similarity index 60% rename from src/test/compile-fail/regions-in-rsrcs.rs rename to src/test/compile-fail/regions-in-structs.rs index a3ff05634839d..a7656a53e39e2 100644 --- a/src/test/compile-fail/regions-in-rsrcs.rs +++ b/src/test/compile-fail/regions-in-structs.rs @@ -8,28 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct yes0 { - x: &uint, +struct yes0<'self> { + x: &uint, //~ ERROR anonymous region types are not permitted here } -impl Drop for yes0 { - fn finalize(&self) {} +struct yes1<'self> { + x: &'self uint, } -struct yes1 { - x: &self/uint, -} - -impl Drop for yes1 { - fn finalize(&self) {} -} - -struct yes2 { - x: &foo/uint, //~ ERROR named regions other than `self` are not allowed as part of a type declaration -} - -impl Drop for yes2 { - fn finalize(&self) {} +struct yes2<'self> { + x: &'foo uint, //~ ERROR named regions other than `self` are not allowed as part of a type declaration } fn main() {} diff --git a/src/test/compile-fail/regions-in-type-items.rs b/src/test/compile-fail/regions-in-type-items.rs index a83b747d2f11d..5519a99d4b8da 100644 --- a/src/test/compile-fail/regions-in-type-items.rs +++ b/src/test/compile-fail/regions-in-type-items.rs @@ -9,15 +9,15 @@ // except according to those terms. type item_ty_yes0 = { - x: &uint + x: &uint //~ ERROR anonymous region types are not permitted here }; type item_ty_yes1 = { - x: &self/uint + x: &'self uint }; type item_ty_yes2 = { - x: &foo/uint //~ ERROR named regions other than `self` are not allowed as part of a type declaration + x: &'foo uint //~ ERROR named regions other than `self` are not allowed as part of a type declaration }; fn main() {} diff --git a/src/test/compile-fail/regions-infer-at-fn-not-param.rs b/src/test/compile-fail/regions-infer-at-fn-not-param.rs index ff37a1bfb8914..bde0e3f80c0fd 100644 --- a/src/test/compile-fail/regions-infer-at-fn-not-param.rs +++ b/src/test/compile-fail/regions-infer-at-fn-not-param.rs @@ -8,25 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct param1 { - g: &fn() +struct parameterized1 { + g: &'self fn() } -struct param2 { - g: fn() -} - -struct not_param1 { +struct not_parameterized1 { g: @fn() } -struct not_param2 { +struct not_parameterized2 { g: @fn() } -fn take1(p: param1) -> param1 { p } //~ ERROR mismatched types -fn take2(p: param2) -> param2 { p } //~ ERROR mismatched types -fn take3(p: not_param1) -> not_param1 { p } -fn take4(p: not_param2) -> not_param2 { p } +fn take1(p: parameterized1) -> parameterized1 { p } //~ ERROR mismatched types +fn take3(p: not_parameterized1) -> not_parameterized1 { p } +fn take4(p: not_parameterized2) -> not_parameterized2 { p } fn main() {} diff --git a/src/test/compile-fail/regions-infer-contravariance-due-to-immutability.rs b/src/test/compile-fail/regions-infer-contravariance-due-to-immutability.rs index e9603dba74424..fca8f759da0b2 100644 --- a/src/test/compile-fail/regions-infer-contravariance-due-to-immutability.rs +++ b/src/test/compile-fail/regions-infer-contravariance-due-to-immutability.rs @@ -9,18 +9,18 @@ // except according to those terms. struct contravariant { - f: &int + f: &'self int } -fn to_same_lifetime(bi: contravariant/&r) { - let bj: contravariant/&r = bi; +fn to_same_lifetime(bi: contravariant<'r>) { + let bj: contravariant<'r> = bi; } -fn to_shorter_lifetime(bi: contravariant/&r) { - let bj: contravariant/&blk = bi; +fn to_shorter_lifetime(bi: contravariant<'r>) { + let bj: contravariant<'blk> = bi; } -fn to_longer_lifetime(bi: contravariant/&r) -> contravariant/&static { +fn to_longer_lifetime(bi: contravariant<'r>) -> contravariant/&static { bi //~ ERROR mismatched types } diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-arg-and-ret.rs b/src/test/compile-fail/regions-infer-invariance-due-to-arg-and-ret.rs index a22bc7c08c574..3ad841923e313 100644 --- a/src/test/compile-fail/regions-infer-invariance-due-to-arg-and-ret.rs +++ b/src/test/compile-fail/regions-infer-invariance-due-to-arg-and-ret.rs @@ -13,18 +13,18 @@ // You cannot convert between regions. struct invariant { - f: fn(x: &self/int) -> &self/int + f: &'self fn(x: &'self int) -> &'self int } -fn to_same_lifetime(bi: invariant/&r) { - let bj: invariant/&r = bi; +fn to_same_lifetime(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_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(bi: invariant<'r>) -> invariant/&static { bi //~ ERROR mismatched types } diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-1.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-1.rs index 83c2c5806e450..b1d0249380f46 100644 --- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-1.rs +++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-1.rs @@ -9,18 +9,18 @@ // except according to those terms. struct invariant { - f: @mut &int + f: @mut &'self int } -fn to_same_lifetime(bi: invariant/&r) { - let bj: invariant/&r = bi; +fn to_same_lifetime(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_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(bi: invariant<'r>) -> invariant<'static> { bi //~ ERROR mismatched types } diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs index 4b637b0195c31..ae62ef6f39a26 100644 --- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs +++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs @@ -8,19 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct invariant { - f: @mut [&int] +struct invariant<'self> { + f: @mut [&'self int] } -fn to_same_lifetime(bi: invariant/&r) { - let bj: invariant/&r = bi; +fn to_same_lifetime(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_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(bi: invariant<'r>) -> invariant<'static> { bi //~ ERROR mismatched types } diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability.rs index bdd9b372e4ef6..f9c6e2e36ec95 100644 --- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability.rs +++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability.rs @@ -9,18 +9,18 @@ // except according to those terms. struct invariant { - f: &int + f: @mut &'self int } -fn to_same_lifetime(bi: invariant/&r) { - let bj: invariant/&r = bi; +fn to_same_lifetime(bi: invariant<'r>) { + let bj: invariant<'r> = bi; } -fn to_shorter_lifetime(bi: invariant/&r) { - let bj: invariant/&blk = 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(bi: invariant<'r>) -> invariant/&static { bi //~ ERROR mismatched types } diff --git a/src/test/compile-fail/regions-infer-not-param.rs b/src/test/compile-fail/regions-infer-not-param.rs index ca105a1dd5e02..b5f8d99829870 100644 --- a/src/test/compile-fail/regions-infer-not-param.rs +++ b/src/test/compile-fail/regions-infer-not-param.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct direct { - f: &int +struct direct<'self> { + f: &'self int } struct indirect1 { @@ -21,7 +21,7 @@ struct indirect2 { } struct indirect3 { - g: @fn(direct/&self) + g: @fn(direct<'self>) } fn take_direct(p: direct) -> direct { p } //~ ERROR mismatched types diff --git a/src/test/compile-fail/regions-infer-paramd-indirect.rs b/src/test/compile-fail/regions-infer-paramd-indirect.rs index c3ce00594f4c1..ddf1454070c77 100644 --- a/src/test/compile-fail/regions-infer-paramd-indirect.rs +++ b/src/test/compile-fail/regions-infer-paramd-indirect.rs @@ -11,17 +11,17 @@ // Check that we correctly infer that b and c must be region // parameterized because they reference a which requires a region. -type a = ∫ -type b = @a; -type c = {f: @b}; +type a<'self> = &'self int; +type b<'self> = @a<'self>; +type c<'self> = {f: @b<'self>}; -trait set_f { - fn set_f_ok(b: @b/&self); +trait set_f<'self> { + fn set_f_ok(b: @b<'self>); fn set_f_bad(b: @b); } -impl set_f for c { - fn set_f_ok(b: @b/&self) { +impl<'self> set_f<'self> for c<'self> { + fn set_f_ok(b: @b<'self>) { self.f = b; } diff --git a/src/test/compile-fail/regions-infer-paramd-method.rs b/src/test/compile-fail/regions-infer-paramd-method.rs index 0f1b23b2839c6..32702663c6e06 100644 --- a/src/test/compile-fail/regions-infer-paramd-method.rs +++ b/src/test/compile-fail/regions-infer-paramd-method.rs @@ -11,22 +11,22 @@ // Here: foo is parameterized because it contains a method that // refers to self. -trait foo { - fn self_int() -> &self/int; +trait foo<'self> { + fn self_int() -> &'self int; fn any_int() -> ∫ } -struct with_foo { - f: foo +struct with_foo<'self> { + f: foo<'self> } trait set_foo_foo { - fn set_foo(&mut self, f: foo); + fn set_foo(&mut self, f: @foo); } -impl set_foo_foo for with_foo { - fn set_foo(&mut self, f: foo) { +impl<'self> set_foo_foo for with_foo<'self> { + fn set_foo(&mut self, f: @foo) { self.f = f; //~ ERROR mismatched types: expected `@foo/&self` but found `@foo/&` } } diff --git a/src/test/compile-fail/regions-steal-closure.rs b/src/test/compile-fail/regions-steal-closure.rs index 3079ef9bcbbd0..8b12813447ef2 100644 --- a/src/test/compile-fail/regions-steal-closure.rs +++ b/src/test/compile-fail/regions-steal-closure.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct closure_box { - cl: &fn() +struct closure_box<'self> { + cl: &'self fn() } -fn box_it(x: &r/fn()) -> closure_box/&r { +fn box_it(x: &'r fn()) -> closure_box<'r> { closure_box {cl: x} } diff --git a/src/test/compile-fail/regions-trait-1.rs b/src/test/compile-fail/regions-trait-1.rs index 811d7c452e386..8b81b31173099 100644 --- a/src/test/compile-fail/regions-trait-1.rs +++ b/src/test/compile-fail/regions-trait-1.rs @@ -15,13 +15,13 @@ trait get_ctxt { fn get_ctxt() -> &ctxt; } -struct has_ctxt { c: &ctxt } +struct has_ctxt { c: &'self ctxt } -impl get_ctxt for has_ctxt { +impl get_ctxt for has_ctxt<'self> { // Here an error occurs because we used `&self` but // the definition used `&`: - fn get_ctxt() -> &self/ctxt { //~ ERROR method `get_ctxt` has an incompatible type + fn get_ctxt() -> &'self ctxt { //~ ERROR method `get_ctxt` has an incompatible type self.c } diff --git a/src/test/compile-fail/regions-trait-2.rs b/src/test/compile-fail/regions-trait-2.rs index c5978e55fb3e4..12ab58ec8907e 100644 --- a/src/test/compile-fail/regions-trait-2.rs +++ b/src/test/compile-fail/regions-trait-2.rs @@ -10,13 +10,13 @@ struct ctxt { v: uint } -trait get_ctxt { - fn get_ctxt() -> &self/ctxt; +trait get_ctxt<'self> { + fn get_ctxt() -> &'self ctxt; } -struct has_ctxt { c: &ctxt } +struct has_ctxt<'self> { c: &'self ctxt } -impl get_ctxt for has_ctxt { +impl<'self> get_ctxt<'self> for has_ctxt<'self> { fn get_ctxt() -> &self/ctxt { self.c } } diff --git a/src/test/run-pass/assignability-trait.rs b/src/test/run-pass/assignability-trait.rs index 85efaa8aed225..c537eb9997f3f 100644 --- a/src/test/run-pass/assignability-trait.rs +++ b/src/test/run-pass/assignability-trait.rs @@ -16,7 +16,7 @@ trait iterable { fn iterate(blk: fn(x: &A) -> bool); } -impl iterable for &[A] { +impl iterable for &self/[A] { fn iterate(f: fn(x: &A) -> bool) { for vec::each(self) |e| { if !f(e) { break; } diff --git a/src/test/run-pass/auto-ref-slice-plus-ref.rs b/src/test/run-pass/auto-ref-slice-plus-ref.rs index e792930889792..eda0670969299 100644 --- a/src/test/run-pass/auto-ref-slice-plus-ref.rs +++ b/src/test/run-pass/auto-ref-slice-plus-ref.rs @@ -16,12 +16,12 @@ trait MyIter { pure fn test_const(&const self); } -impl MyIter for &[int] { +impl MyIter for &'self [int] { pure fn test_imm(&self) { assert self[0] == 1 } pure fn test_const(&const self) { assert self[0] == 1 } } -impl MyIter for &str { +impl MyIter for &'self str { pure fn test_imm(&self) { assert *self == "test" } pure fn test_const(&const self) { assert *self == "test" } } diff --git a/src/test/run-pass/auto-ref.rs b/src/test/run-pass/auto-ref.rs index ec5a17ffc54e4..b6d71fcfb55af 100644 --- a/src/test/run-pass/auto-ref.rs +++ b/src/test/run-pass/auto-ref.rs @@ -16,7 +16,7 @@ trait Stuff { fn printme(); } -impl Stuff for &Foo { +impl Stuff for &self/Foo { fn printme() { io::println(fmt!("%d", self.x)); } diff --git a/src/test/run-pass/borrow-by-val-method-receiver.rs b/src/test/run-pass/borrow-by-val-method-receiver.rs index c2b19d2ce35b8..02dbfeda25869 100644 --- a/src/test/run-pass/borrow-by-val-method-receiver.rs +++ b/src/test/run-pass/borrow-by-val-method-receiver.rs @@ -12,7 +12,7 @@ trait Foo { fn foo(self); } -impl Foo for &[int] { +impl Foo for &'self [int] { fn foo(self) {} } diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index f71675c06be0a..34203b091fe2a 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -49,8 +49,8 @@ pub impl cat { } } -impl BaseIter<(int, &T)> for cat { - pure fn each(&self, f: fn(&(int, &self/T)) -> bool) { +impl BaseIter<(int, &'self T)> for cat { + pure fn each(&self, f: fn(&(int, &'self T)) -> bool) { let mut n = int::abs(self.meows); while n > 0 { if !f(&(n, &self.name)) { break; } @@ -86,7 +86,7 @@ impl Map for cat { true } - pure fn find(&self, k: &int) -> Option<&self/T> { + pure fn find(&self, k: &int) -> Option<&'self T> { if *k <= self.meows { Some(&self.name) } else { @@ -104,7 +104,7 @@ impl Map for cat { } pub impl cat { - pure fn get(&self, k: &int) -> &self/T { + pure fn get(&self, k: &int) -> &'self T { match self.find(k) { Some(v) => { v } None => { fail!(~"epic fail"); } diff --git a/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs b/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs index 7797af14364c8..8f0a7a1a4dba3 100644 --- a/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs +++ b/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs @@ -2,7 +2,7 @@ trait Reverser { fn reverse(&self); } -impl Reverser for &mut [uint] { +impl Reverser for &'self mut [uint] { fn reverse(&self) { vec::reverse(*self); } diff --git a/src/test/run-pass/const-enum-vec-index.rs b/src/test/run-pass/const-enum-vec-index.rs index a9400ef1b6b04..bad2b71200c57 100644 --- a/src/test/run-pass/const-enum-vec-index.rs +++ b/src/test/run-pass/const-enum-vec-index.rs @@ -9,7 +9,7 @@ // except according to those terms. enum E { V1(int), V0 } -const C: &[E] = &[V0, V1(0xDEADBEE)]; +const C: &'static [E] = &[V0, V1(0xDEADBEE)]; const C0: E = C[0]; const C1: E = C[1]; diff --git a/src/test/run-pass/const-fields-and-indexing.rs b/src/test/run-pass/const-fields-and-indexing.rs index a417ad3ca6e23..c2c2792e0d2e7 100644 --- a/src/test/run-pass/const-fields-and-indexing.rs +++ b/src/test/run-pass/const-fields-and-indexing.rs @@ -10,7 +10,7 @@ const x : [int * 4] = [1,2,3,4]; const p : int = x[2]; -const y : &[int] = &[1,2,3,4]; +const y : &'static [int] = &[1,2,3,4]; const q : int = y[2]; struct S {a: int, b: int} diff --git a/src/test/run-pass/const-fn-val.rs b/src/test/run-pass/const-fn-val.rs index 4d4247ed5b91e..4e46d67cafeb9 100644 --- a/src/test/run-pass/const-fn-val.rs +++ b/src/test/run-pass/const-fn-val.rs @@ -12,9 +12,9 @@ fn foo() -> int { return 0xca7f000d; } -struct Bar { f: &fn() -> int } +struct Bar { f: &'self fn() -> int } -const b : Bar = Bar { f: foo }; +const b : Bar/&static = Bar { f: foo }; pub fn main() { assert (b.f)() == 0xca7f000d; diff --git a/src/test/run-pass/const-region-ptrs.rs b/src/test/run-pass/const-region-ptrs.rs index ce626cf612f94..c847b4ff0f12f 100644 --- a/src/test/run-pass/const-region-ptrs.rs +++ b/src/test/run-pass/const-region-ptrs.rs @@ -9,11 +9,11 @@ // except according to those terms. -struct Pair { a: int, b: &int } +struct Pair { a: int, b: &'self int } -const x: &int = &10; +const x: &'static int = &10; -const y: &Pair = &Pair {a: 15, b: x}; +const y: &'static Pair<'static> = &Pair {a: 15, b: x}; pub fn main() { io::println(fmt!("x = %?", *x)); diff --git a/src/test/run-pass/const-struct.rs b/src/test/run-pass/const-struct.rs index 24243601e09de..e49488a66e82a 100644 --- a/src/test/run-pass/const-struct.rs +++ b/src/test/run-pass/const-struct.rs @@ -22,7 +22,7 @@ impl cmp::Eq for foo { const x : foo = foo { a:1, b:2, c: 3 }; const y : foo = foo { b:2, c:3, a: 1 }; -const z : &foo = &foo { a: 10, b: 22, c: 12 }; +const z : &'static foo = &foo { a: 10, b: 22, c: 12 }; pub fn main() { assert x.b == 2; diff --git a/src/test/run-pass/const-vec-of-fns.rs b/src/test/run-pass/const-vec-of-fns.rs index bf7472aeb3612..5598756ac75a6 100644 --- a/src/test/run-pass/const-vec-of-fns.rs +++ b/src/test/run-pass/const-vec-of-fns.rs @@ -16,10 +16,9 @@ */ fn f() { } -const bare_fns: &[extern fn()] = &[f, f]; -// NOTE Why does this not type without the struct? -struct S(&fn()); -const closures: &[S] = &[S(f), S(f)]; +const bare_fns: &'static [extern fn()] = &[f, f]; +struct S<'self>(&'self fn()); +const closures: &'static [S<'static>] = &[S(f), S(f)]; pub fn main() { for bare_fns.each |&bare_fn| { bare_fn() } diff --git a/src/test/run-pass/const-vecs-and-slices.rs b/src/test/run-pass/const-vecs-and-slices.rs index a0ac67288cfc8..a719af7120edb 100644 --- a/src/test/run-pass/const-vecs-and-slices.rs +++ b/src/test/run-pass/const-vecs-and-slices.rs @@ -9,7 +9,7 @@ // except according to those terms. const x : [int * 4] = [1,2,3,4]; -const y : &[int] = &[1,2,3,4]; +const y : &'static [int] = &[1,2,3,4]; pub fn main() { io::println(fmt!("%?", x[1])); diff --git a/src/test/run-pass/infer-with-expected.rs b/src/test/run-pass/infer-with-expected.rs index 723cc8ef633e6..1bd6304fabc26 100644 --- a/src/test/run-pass/infer-with-expected.rs +++ b/src/test/run-pass/infer-with-expected.rs @@ -16,7 +16,7 @@ fn eat_tup(_r: ~@(int, @fn(Pair) -> int)) {} fn eat_rec(_r: @~Rec) {} -struct Rec { a: int, b: fn(Pair) -> int } +struct Rec { a: int, b: &'self fn(Pair) -> int } struct Pair { x: int, y: int } pub fn main() { diff --git a/src/test/run-pass/issue-2502.rs b/src/test/run-pass/issue-2502.rs index 57e5aa39864c0..c7a7dc539658c 100644 --- a/src/test/run-pass/issue-2502.rs +++ b/src/test/run-pass/issue-2502.rs @@ -9,10 +9,10 @@ // except according to those terms. struct font { - fontbuf: &self/~[u8], + fontbuf: &'self ~[u8], } -pub impl font { +pub impl font/&self { fn buf() -> &self/~[u8] { self.fontbuf } diff --git a/src/test/run-pass/issue-2735-2.rs b/src/test/run-pass/issue-2735-2.rs index a1619c69b3ce0..438abe9841337 100644 --- a/src/test/run-pass/issue-2735-2.rs +++ b/src/test/run-pass/issue-2735-2.rs @@ -10,16 +10,16 @@ // This test should behave exactly like issue-2735-3 struct defer { - b: &mut bool, + b: &'self mut bool, } -impl Drop for defer { +impl Drop for defer/&self { fn finalize(&self) { *(self.b) = true; } } -fn defer(b: &r/mut bool) -> defer/&r { +fn defer(b: &'r mut bool) -> defer/&r { defer { b: b } diff --git a/src/test/run-pass/issue-2735-3.rs b/src/test/run-pass/issue-2735-3.rs index c39b8a6c6d73c..75fc9f3a87e72 100644 --- a/src/test/run-pass/issue-2735-3.rs +++ b/src/test/run-pass/issue-2735-3.rs @@ -10,16 +10,16 @@ // This test should behave exactly like issue-2735-2 struct defer { - b: &mut bool, + b: &'self mut bool, } -impl Drop for defer { +impl Drop for defer/&self { fn finalize(&self) { *(self.b) = true; } } -fn defer(b: &r/mut bool) -> defer/&r { +fn defer(b: &'r mut bool) -> defer/&r { defer { b: b } diff --git a/src/test/run-pass/issue-2748-a.rs b/src/test/run-pass/issue-2748-a.rs index bdf9109abd9a8..f36b364aadda4 100644 --- a/src/test/run-pass/issue-2748-a.rs +++ b/src/test/run-pass/issue-2748-a.rs @@ -9,10 +9,10 @@ // except according to those terms. struct CMap { - buf: &[u8], + buf: &'self [u8], } -fn CMap(buf: &r/[u8]) -> CMap/&r { +fn CMap(buf: &'r [u8]) -> CMap/&r { CMap { buf: buf } diff --git a/src/test/run-pass/issue-3447.rs b/src/test/run-pass/issue-3447.rs index 2f7cb998e1ae6..816678fa3208e 100644 --- a/src/test/run-pass/issue-3447.rs +++ b/src/test/run-pass/issue-3447.rs @@ -9,12 +9,12 @@ // except according to those terms. struct list { - element: &self/T, - next: Option<@mut list> + element: &'self T, + next: Option<@mut list<'self, T>> } -pub impl list{ - fn addEnd(&mut self, element: &self/T) { +pub impl<'self, T> list<'self, T>{ + fn addEnd(&mut self, element: &'self T) { let newList = list { element: element, next: option::None diff --git a/src/test/run-pass/rcvr-borrowed-to-region.rs b/src/test/run-pass/rcvr-borrowed-to-region.rs index 7011f5ba1add0..12e54c9c1918d 100644 --- a/src/test/run-pass/rcvr-borrowed-to-region.rs +++ b/src/test/run-pass/rcvr-borrowed-to-region.rs @@ -13,7 +13,7 @@ trait get { } // Note: impl on a slice -impl get for &int { +impl get for &'self int { fn get() -> int { return *self; } diff --git a/src/test/run-pass/rcvr-borrowed-to-slice.rs b/src/test/run-pass/rcvr-borrowed-to-slice.rs index 6073295336049..0091962dcf3aa 100644 --- a/src/test/run-pass/rcvr-borrowed-to-slice.rs +++ b/src/test/run-pass/rcvr-borrowed-to-slice.rs @@ -13,7 +13,7 @@ trait sum { } // Note: impl on a slice -impl sum for &[int] { +impl sum for &'self [int] { fn sum() -> int { let mut sum = 0; for vec::each(self) |e| { sum += *e; } diff --git a/src/test/run-pass/regions-copy-closure.rs b/src/test/run-pass/regions-copy-closure.rs index ff3e115eda9b0..dd040767f6b1b 100644 --- a/src/test/run-pass/regions-copy-closure.rs +++ b/src/test/run-pass/regions-copy-closure.rs @@ -9,10 +9,10 @@ // except according to those terms. struct closure_box { - cl: &fn(), + cl: &'self fn(), } -fn box_it(+x: &r/fn()) -> closure_box/&r { +fn box_it(+x: &'r fn()) -> closure_box/&r { closure_box {cl: x} } diff --git a/src/test/run-pass/regions-creating-enums2.rs b/src/test/run-pass/regions-creating-enums2.rs index 9daec577cfa26..c0bbdca07aafb 100644 --- a/src/test/run-pass/regions-creating-enums2.rs +++ b/src/test/run-pass/regions-creating-enums2.rs @@ -10,10 +10,10 @@ enum ast { num(uint), - add(&ast, &ast) + add(&'self ast<'self>, &'self ast<'self>) } -fn mk_add_ok(x: &r/ast, y: &r/ast) -> ast/&r { +fn mk_add_ok(x: &'r ast<'r>, y: &'r ast<'r>) -> ast<'r> { add(x, y) } diff --git a/src/test/run-pass/regions-creating-enums5.rs b/src/test/run-pass/regions-creating-enums5.rs index 943ec3f9cb749..aeb167c5b6d18 100644 --- a/src/test/run-pass/regions-creating-enums5.rs +++ b/src/test/run-pass/regions-creating-enums5.rs @@ -10,10 +10,10 @@ enum ast { num(uint), - add(&ast, &ast) + add(&'self ast<'self>, &'self ast<'self>) } -fn mk_add_ok(x: &a/ast, y: &a/ast, z: &ast) -> ast/&a { +fn mk_add_ok(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'a> { add(x, y) } diff --git a/src/test/run-pass/regions-infer-contravariance-due-to-ret.rs b/src/test/run-pass/regions-infer-contravariance-due-to-ret.rs index d2a91db6bb8e8..ec5b30fa30854 100644 --- a/src/test/run-pass/regions-infer-contravariance-due-to-ret.rs +++ b/src/test/run-pass/regions-infer-contravariance-due-to-ret.rs @@ -9,7 +9,7 @@ // except according to those terms. struct boxed_int { - f: &int, + f: &'self int, } fn max(bi: &r/boxed_int, f: &r/int) -> int { diff --git a/src/test/run-pass/regions-infer-contravariance.rs b/src/test/run-pass/regions-infer-contravariance.rs index 11a24fdc96272..1406240c1d1cd 100644 --- a/src/test/run-pass/regions-infer-contravariance.rs +++ b/src/test/run-pass/regions-infer-contravariance.rs @@ -9,10 +9,10 @@ // except according to those terms. struct boxed_int { - f: &int, + f: &'self int, } -fn get(bi: &r/boxed_int) -> &r/int { +fn get(bi: &'r boxed_int<'r>) -> &'r int { bi.f } diff --git a/src/test/run-pass/regions-mock-trans-impls.rs b/src/test/run-pass/regions-mock-trans-impls.rs index 12e8ab1384fcc..df8a4f6f770b6 100644 --- a/src/test/run-pass/regions-mock-trans-impls.rs +++ b/src/test/run-pass/regions-mock-trans-impls.rs @@ -17,19 +17,19 @@ use core::cast; use std::arena::Arena; struct Bcx { - fcx: &Fcx + fcx: &'self Fcx<'self> } struct Fcx { - arena: &Arena, - ccx: &Ccx + arena: &'self Arena, + ccx: &'self Ccx } struct Ccx { x: int } -fn h(bcx : &r/Bcx) -> &r/Bcx { +fn h(bcx : &'r Bcx<'r>) -> &'r Bcx<'r> { return bcx.fcx.arena.alloc(|| Bcx { fcx: bcx.fcx }); } diff --git a/src/test/run-pass/regions-mock-trans.rs b/src/test/run-pass/regions-mock-trans.rs index d002de2249aed..7a1b9ae563aa5 100644 --- a/src/test/run-pass/regions-mock-trans.rs +++ b/src/test/run-pass/regions-mock-trans.rs @@ -11,26 +11,26 @@ enum arena = (); struct Bcx { - fcx: &Fcx + fcx: &'self Fcx<'self> } struct Fcx { - arena: &arena, - ccx: &Ccx + arena: &'self arena, + ccx: &'self Ccx } struct Ccx { x: int } -fn alloc(_bcx : &arena) -> &Bcx { +fn alloc(_bcx : &'a arena) -> &'a Bcx<'a> { unsafe { return cast::reinterpret_cast( &libc::malloc(sys::size_of::() as libc::size_t)); } } -fn h(bcx : &Bcx) -> &Bcx { +fn h(bcx : &'a Bcx<'a>) -> &'a Bcx<'a> { return alloc(bcx.fcx.arena); } diff --git a/src/test/run-pass/regions-nullary-variant.rs b/src/test/run-pass/regions-nullary-variant.rs index 27dc2dea40d4d..da03864338bdc 100644 --- a/src/test/run-pass/regions-nullary-variant.rs +++ b/src/test/run-pass/regions-nullary-variant.rs @@ -9,10 +9,10 @@ // except according to those terms. enum roption { - a, b(&uint) + a, b(&'self uint) } -fn mk(cond: bool, ptr: &r/uint) -> roption/&r { +fn mk(cond: bool, ptr: &'r uint) -> roption<'r> { if cond {a} else {b(ptr)} } diff --git a/src/test/run-pass/regions-self-in-enums.rs b/src/test/run-pass/regions-self-in-enums.rs index 8ddbea5d3ed91..6f1044e305407 100644 --- a/src/test/run-pass/regions-self-in-enums.rs +++ b/src/test/run-pass/regions-self-in-enums.rs @@ -9,7 +9,7 @@ // except according to those terms. enum int_wrapper { - int_wrapper_ctor(&int) + int_wrapper_ctor(&'self int) } pub fn main() { diff --git a/src/test/run-pass/regions-static-closure.rs b/src/test/run-pass/regions-static-closure.rs index 00f5e695475a2..0351f031e0937 100644 --- a/src/test/run-pass/regions-static-closure.rs +++ b/src/test/run-pass/regions-static-closure.rs @@ -9,10 +9,10 @@ // except according to those terms. struct closure_box { - cl: &fn(), + cl: &'self fn(), } -fn box_it(+x: &r/fn()) -> closure_box/&r { +fn box_it(+x: &'r fn()) -> closure_box<'r> { closure_box {cl: x} } diff --git a/src/test/run-pass/regions-trait.rs b/src/test/run-pass/regions-trait.rs index 2b9930778b249..819499b395331 100644 --- a/src/test/run-pass/regions-trait.rs +++ b/src/test/run-pass/regions-trait.rs @@ -14,9 +14,9 @@ trait get_ctxt { fn get_ctxt() -> &self/Ctxt; } -struct HasCtxt { c: &Ctxt } +struct HasCtxt { c: &'self Ctxt } -impl get_ctxt for HasCtxt { +impl get_ctxt<'self> for HasCtxt<'self> { fn get_ctxt() -> &self/Ctxt { self.c } diff --git a/src/test/run-pass/struct-field-assignability.rs b/src/test/run-pass/struct-field-assignability.rs index 2df92ace6a56d..64f75e37051de 100644 --- a/src/test/run-pass/struct-field-assignability.rs +++ b/src/test/run-pass/struct-field-assignability.rs @@ -1,5 +1,5 @@ struct Foo { - x: &int + x: &'self int } pub fn main() {