Skip to content

Commit 8a40670

Browse files
committed
---
yaml --- r: 46777 b: refs/heads/auto c: 3168fe0 h: refs/heads/master i: 46775: 326a41e v: v3
1 parent bc775c3 commit 8a40670

File tree

131 files changed

+572
-538
lines changed

Some content is hidden

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

131 files changed

+572
-538
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 02623871ed4e7d5b4d74bf21c0a710ee648a149b
17+
refs/heads/auto: 3168fe06ff69970be329583f560a3ccd9c00c874

branches/auto/doc/rust.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,22 +1144,23 @@ Constants are declared with the `const` keyword.
11441144
A constant item must have an expression giving its definition.
11451145
The definition expression of a constant is limited to expression forms that can be evaluated at compile time.
11461146

1147-
Constants must be explicitly typed. The type may be ```bool```, ```char```, a number, or a type derived from
1148-
those primitive types. The derived types are borrowed pointers, static arrays, tuples, and structs.
1147+
Constants must be explicitly typed. The type may be ```bool```, ```char```, a number, or a type derived from those primitive types.
1148+
The derived types are borrowed pointers, static arrays, tuples, and structs.
1149+
Borrowed pointers must be have the `'static` lifetime.
11491150

11501151
~~~~
11511152
const bit1: uint = 1 << 0;
11521153
const bit2: uint = 1 << 1;
11531154
11541155
const bits: [uint * 2] = [bit1, bit2];
1155-
const string: &str = "bitstring";
1156+
const string: &'static str = "bitstring";
11561157
11571158
struct BitsNStrings {
11581159
mybits: [uint *2],
1159-
mystring: &str
1160+
mystring: &'self str
11601161
}
11611162
1162-
const bits_n_strings: BitsNStrings = BitsNStrings {
1163+
const bits_n_strings: BitsNStrings<'static> = BitsNStrings {
11631164
mybits: bits,
11641165
mystring: string
11651166
};
@@ -1630,7 +1631,7 @@ The following are examples of structure expressions:
16301631
~~~~
16311632
# struct Point { x: float, y: float }
16321633
# struct TuplePoint(float, float);
1633-
# mod game { pub struct User { name: &str, age: uint, score: uint } }
1634+
# mod game { pub struct User<'self> { name: &'self str, age: uint, score: uint } }
16341635
# struct Cookie; fn some_fn<T>(t: T) {}
16351636
Point {x: 10f, y: 20f};
16361637
TuplePoint(10f, 20f);
@@ -2556,8 +2557,8 @@ order specified by the tuple type.
25562557
An example of a tuple type and its use:
25572558

25582559
~~~~
2559-
type Pair = (int,&str);
2560-
let p: Pair = (10,"hello");
2560+
type Pair<'self> = (int,&'self str);
2561+
let p: Pair<'static> = (10,"hello");
25612562
let (a, b) = p;
25622563
assert b != "world";
25632564
~~~~
@@ -2718,7 +2719,7 @@ fn add(x: int, y: int) -> int {
27182719
27192720
let mut x = add(5,7);
27202721
2721-
type Binop = fn(int,int) -> int;
2722+
type Binop<'self> = &'self fn(int,int) -> int;
27222723
let bo: Binop = add;
27232724
x = bo(5,7);
27242725
~~~~~~~~

branches/auto/doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@ trait Printable {
19511951
Traits may be implemented for specific types with [impls]. An impl
19521952
that implements a trait includes the name of the trait at the start of
19531953
the definition, as in the following impls of `Printable` for `int`
1954-
and `&str`.
1954+
and `~str`.
19551955

19561956
[impls]: #functions-and-methods
19571957

@@ -1961,12 +1961,12 @@ impl Printable for int {
19611961
fn print(&self) { io::println(fmt!("%d", *self)) }
19621962
}
19631963
1964-
impl Printable for &str {
1964+
impl Printable for ~str {
19651965
fn print(&self) { io::println(*self) }
19661966
}
19671967
19681968
# 1.print();
1969-
# ("foo").print();
1969+
# (~"foo").print();
19701970
~~~~
19711971

19721972
Methods defined in an implementation of a trait may be called just like

branches/auto/src/libcore/at_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pub mod traits {
168168
use kinds::Copy;
169169
use ops::Add;
170170

171-
impl<T:Copy> Add<&[const T],@[T]> for @[T] {
171+
impl<T:Copy> Add<&self/[const T],@[T]> for @[T] {
172172
#[inline(always)]
173173
pure fn add(&self, rhs: & &self/[const T]) -> @[T] {
174174
append(*self, (*rhs))

branches/auto/src/libcore/cleanup.rs

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

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

2828
type TaskID = uintptr_t;
2929

branches/auto/src/libcore/condition.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ pub struct Handler<T, U> {
2222

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

28-
pub impl<T, U> Condition<T, U> {
28+
pub impl<T, U> Condition/&self<T, U> {
2929
fn trap(&self, h: &self/fn(T) -> U) -> Trap/&self<T, U> {
3030
unsafe {
3131
let p : *RustClosure = ::cast::transmute(&h);
@@ -65,11 +65,11 @@ pub impl<T, U> Condition<T, U> {
6565
}
6666

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

72-
pub impl<T, U> Trap<T, U> {
72+
pub impl<T, U> Trap/&self<T, U> {
7373
fn in<V>(&self, inner: &self/fn() -> V) -> V {
7474
unsafe {
7575
let _g = Guard { cond: self.cond };
@@ -81,10 +81,10 @@ pub impl<T, U> Trap<T, U> {
8181
}
8282

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

87-
impl<T, U> Drop for Guard<T, U> {
87+
impl<T, U> Drop for Guard/&self<T, U> {
8888
fn finalize(&self) {
8989
unsafe {
9090
debug!("Guard: popping handler from TLS");

branches/auto/src/libcore/container.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
//! Container traits
1212
13-
use cmp::Equiv;
1413
use option::Option;
1514

1615
pub trait Container {

branches/auto/src/libcore/gc.rs

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

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

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

branches/auto/src/libcore/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ impl io::Writer for SipState {
298298
}
299299
}
300300

301-
impl Streaming for &SipState {
301+
impl Streaming for SipState {
302302

303303
#[inline(always)]
304304
fn input(&self, buf: &[const u8]) {

branches/auto/src/libcore/hashmap.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ pub mod linear {
268268
}
269269
}
270270
271-
impl<K:Hash + IterBytes + Eq,V> BaseIter<(&K, &V)> for LinearMap<K, V> {
271+
impl<K:Hash + IterBytes + Eq,V>
272+
BaseIter<(&self/K, &self/V)> for LinearMap<K, V>
273+
{
272274
/// Visit all key-value pairs
273275
pure fn each(&self, blk: fn(&(&self/K, &self/V)) -> bool) {
274276
for uint::range(0, self.buckets.len()) |i| {

branches/auto/src/libcore/io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,11 +585,11 @@ pub fn file_reader(path: &Path) -> Result<@Reader, ~str> {
585585
586586
// Byte readers
587587
pub struct BytesReader {
588-
bytes: &[u8],
588+
bytes: &self/[u8],
589589
mut pos: uint
590590
}
591591
592-
impl Reader for BytesReader {
592+
impl Reader for BytesReader/&self {
593593
fn read(&self, bytes: &mut [u8], len: uint) -> uint {
594594
let count = uint::min(len, self.bytes.len() - self.pos);
595595

branches/auto/src/libcore/iter.rs

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

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

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

branches/auto/src/libcore/os.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,11 +1028,11 @@ pub mod consts {
10281028
pub use os::consts::windows::*;
10291029
10301030
pub mod unix {
1031-
pub const FAMILY: &str = "unix";
1031+
pub const FAMILY: &static/str = "unix";
10321032
}
10331033
10341034
pub mod windows {
1035-
pub const FAMILY: &str = "windows";
1035+
pub const FAMILY: &static/str = "windows";
10361036
}
10371037
10381038
#[cfg(target_os = "macos")]
@@ -1051,38 +1051,38 @@ pub mod consts {
10511051
pub use os::consts::win32::*;
10521052
10531053
pub mod macos {
1054-
pub const SYSNAME: &str = "macos";
1055-
pub const DLL_PREFIX: &str = "lib";
1056-
pub const DLL_SUFFIX: &str = ".dylib";
1057-
pub const EXE_SUFFIX: &str = "";
1054+
pub const SYSNAME: &static/str = "macos";
1055+
pub const DLL_PREFIX: &static/str = "lib";
1056+
pub const DLL_SUFFIX: &static/str = ".dylib";
1057+
pub const EXE_SUFFIX: &static/str = "";
10581058
}
10591059
10601060
pub mod freebsd {
1061-
pub const SYSNAME: &str = "freebsd";
1062-
pub const DLL_PREFIX: &str = "lib";
1063-
pub const DLL_SUFFIX: &str = ".so";
1064-
pub const EXE_SUFFIX: &str = "";
1061+
pub const SYSNAME: &static/str = "freebsd";
1062+
pub const DLL_PREFIX: &static/str = "lib";
1063+
pub const DLL_SUFFIX: &static/str = ".so";
1064+
pub const EXE_SUFFIX: &static/str = "";
10651065
}
10661066
10671067
pub mod linux {
1068-
pub const SYSNAME: &str = "linux";
1069-
pub const DLL_PREFIX: &str = "lib";
1070-
pub const DLL_SUFFIX: &str = ".so";
1071-
pub const EXE_SUFFIX: &str = "";
1068+
pub const SYSNAME: &static/str = "linux";
1069+
pub const DLL_PREFIX: &static/str = "lib";
1070+
pub const DLL_SUFFIX: &static/str = ".so";
1071+
pub const EXE_SUFFIX: &static/str = "";
10721072
}
10731073
10741074
pub mod android {
1075-
pub const SYSNAME: &str = "android";
1076-
pub const DLL_PREFIX: &str = "lib";
1077-
pub const DLL_SUFFIX: &str = ".so";
1078-
pub const EXE_SUFFIX: &str = "";
1075+
pub const SYSNAME: &static/str = "android";
1076+
pub const DLL_PREFIX: &static/str = "lib";
1077+
pub const DLL_SUFFIX: &static/str = ".so";
1078+
pub const EXE_SUFFIX: &static/str = "";
10791079
}
10801080
10811081
pub mod win32 {
1082-
pub const SYSNAME: &str = "win32";
1083-
pub const DLL_PREFIX: &str = "";
1084-
pub const DLL_SUFFIX: &str = ".dll";
1085-
pub const EXE_SUFFIX: &str = ".exe";
1082+
pub const SYSNAME: &static/str = "win32";
1083+
pub const DLL_PREFIX: &static/str = "";
1084+
pub const DLL_SUFFIX: &static/str = ".dll";
1085+
pub const EXE_SUFFIX: &static/str = ".exe";
10861086
}
10871087
10881088
@@ -1099,16 +1099,16 @@ pub mod consts {
10991099
use os::consts::mips::*;
11001100
11011101
pub mod x86 {
1102-
pub const ARCH: &str = "x86";
1102+
pub const ARCH: &'static str = "x86";
11031103
}
11041104
pub mod x86_64 {
1105-
pub const ARCH: &str = "x86_64";
1105+
pub const ARCH: &'static str = "x86_64";
11061106
}
11071107
pub mod arm {
1108-
pub const ARCH: &str = "arm";
1108+
pub const ARCH: &'static str = "arm";
11091109
}
11101110
pub mod mips {
1111-
pub const ARCH: &str = "mips";
1111+
pub const ARCH: &'static str = "mips";
11121112
}
11131113
}
11141114

branches/auto/src/libcore/pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ pub fn try_recv<T:Owned,Tbuffer:Owned>(p: RecvPacketBuffered<T, Tbuffer>)
440440
let p = unsafe { &*p_ };
441441
442442
struct DropState {
443-
p: &PacketHeader,
443+
p: &self/PacketHeader,
444444
445445
drop {
446446
if task::failing() {

branches/auto/src/libcore/ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl<T> Ord for *const T {
264264

265265
// Equality for region pointers
266266
#[cfg(notest)]
267-
impl<T:Eq> Eq for &const T {
267+
impl<T:Eq> Eq for &self/const T {
268268
#[inline(always)]
269269
pure fn eq(&self, other: & &self/const T) -> bool {
270270
return *(*self) == *(*other);
@@ -277,7 +277,7 @@ impl<T:Eq> Eq for &const T {
277277

278278
// Comparison for region pointers
279279
#[cfg(notest)]
280-
impl<T:Ord> Ord for &const T {
280+
impl<T:Ord> Ord for &self/const T {
281281
#[inline(always)]
282282
pure fn lt(&self, other: & &self/const T) -> bool {
283283
*(*self) < *(*other)

branches/auto/src/libcore/str.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ pure fn cmp(a: &str, b: &str) -> Ordering {
787787
}
788788

789789
#[cfg(notest)]
790-
impl TotalOrd for &str {
790+
impl TotalOrd for &'self str {
791791
pure fn cmp(&self, other: & &self/str) -> Ordering { cmp(*self, *other) }
792792
}
793793

@@ -833,7 +833,7 @@ pure fn gt(a: &str, b: &str) -> bool {
833833
}
834834

835835
#[cfg(notest)]
836-
impl Eq for &str {
836+
impl Eq for &self/str {
837837
#[inline(always)]
838838
pure fn eq(&self, other: & &self/str) -> bool {
839839
eq_slice((*self), (*other))
@@ -875,7 +875,7 @@ impl Ord for ~str {
875875
}
876876

877877
#[cfg(notest)]
878-
impl Ord for &str {
878+
impl Ord for &self/str {
879879
#[inline(always)]
880880
pure fn lt(&self, other: & &self/str) -> bool { lt((*self), (*other)) }
881881
#[inline(always)]
@@ -899,7 +899,7 @@ impl Ord for @str {
899899
}
900900

901901
#[cfg(notest)]
902-
impl Equiv<~str> for &str {
902+
impl Equiv<~str> for &'self str {
903903
#[inline(always)]
904904
pure fn equiv(&self, other: &~str) -> bool { eq_slice(*self, *other) }
905905
}
@@ -2226,7 +2226,7 @@ pub mod traits {
22262226
use ops::Add;
22272227
use str::append;
22282228

2229-
impl Add<&str,~str> for ~str {
2229+
impl Add<&self/str,~str> for ~str {
22302230
#[inline(always)]
22312231
pure fn add(&self, rhs: & &self/str) -> ~str {
22322232
append(copy *self, (*rhs))
@@ -2270,7 +2270,7 @@ pub trait StrSlice {
22702270
}
22712271

22722272
/// Extension methods for strings
2273-
impl StrSlice for &str {
2273+
impl StrSlice for &self/str {
22742274
/**
22752275
* Return true if a predicate matches all characters or if the string
22762276
* contains no characters

branches/auto/src/libcore/sys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use libc::{c_void, c_char, size_t};
1919
use repr;
2020
use str;
2121

22-
pub type FreeGlue = fn(*TypeDesc, *c_void);
22+
pub type FreeGlue = &self/fn(*TypeDesc, *c_void);
2323

2424
// Corresponds to runtime type_desc type
2525
pub enum TypeDesc = {

0 commit comments

Comments
 (0)