Skip to content

Commit 9692ba3

Browse files
committed
---
yaml --- r: 56563 b: refs/heads/auto c: 849f814 h: refs/heads/master i: 56561: 39e7031 56559: 9dfdd28 v: v3
1 parent 8448cca commit 9692ba3

File tree

213 files changed

+3510
-3776
lines changed

Some content is hidden

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

213 files changed

+3510
-3776
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ 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: c2b8f98917597dd719ad93b25dcf000aeaa6d5d0
17+
refs/heads/auto: 849f8142a244ae08c06ed190c234aa809a68f6c0
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/doc/rust.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ A loop expression denotes an infinite loop;
21872187
see [Continue expressions](#continue-expressions) for continue expressions.
21882188

21892189
~~~~~~~~{.ebnf .gram}
2190-
loop_expr : [ lifetime ':' ] "loop" '{' block '}';
2190+
loop_expr : "loop" [ ident ':' ] '{' block '}';
21912191
~~~~~~~~
21922192

21932193
A `loop` expression may optionally have a _label_.
@@ -2198,7 +2198,7 @@ See [Break expressions](#break-expressions).
21982198
### Break expressions
21992199

22002200
~~~~~~~~{.ebnf .gram}
2201-
break_expr : "break" [ lifetime ];
2201+
break_expr : "break" [ ident ];
22022202
~~~~~~~~
22032203

22042204
A `break` expression has an optional `label`.
@@ -2211,7 +2211,7 @@ but must enclose it.
22112211
### Continue expressions
22122212

22132213
~~~~~~~~{.ebnf .gram}
2214-
continue_expr : "loop" [ lifetime ];
2214+
continue_expr : "loop" [ ident ];
22152215
~~~~~~~~
22162216

22172217
A continue expression, written `loop`, also has an optional `label`.
@@ -2393,7 +2393,7 @@ variables in the arm's block, and control enters the block.
23932393
An example of an `match` expression:
23942394

23952395

2396-
~~~~ {.xfail-test}
2396+
~~~~
23972397
# fn process_pair(a: int, b: int) { }
23982398
# fn process_ten() { }
23992399

branches/auto/doc/tutorial.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,7 +1981,7 @@ struct TimeBomb {
19811981
19821982
impl Drop for TimeBomb {
19831983
fn finalize(&self) {
1984-
for old_iter::repeat(self.explosivity) {
1984+
for iter::repeat(self.explosivity) {
19851985
io::println("blam!");
19861986
}
19871987
}
@@ -2056,10 +2056,11 @@ method declarations. So, re-declaring the type parameter
20562056
`T` as an explicit type parameter for `len`, in either the trait or
20572057
the impl, would be a compile-time error.
20582058

2059-
Within a trait definition, `Self` is a special type that you can think
2059+
Within a trait definition, `self` is a special type that you can think
20602060
of as a type parameter. An implementation of the trait for any given
2061-
type `T` replaces the `Self` type parameter with `T`. The following
2062-
trait describes types that support an equality operation:
2061+
type `T` replaces the `self` type parameter with `T`. Simply, in a
2062+
trait, `self` is a type, and in an impl, `self` is a value. The
2063+
following trait describes types that support an equality operation:
20632064

20642065
~~~~
20652066
// In a trait, `self` refers to the self argument.
@@ -2075,7 +2076,7 @@ impl Eq for int {
20752076
~~~~
20762077

20772078
Notice that in the trait definition, `equals` takes a
2078-
second parameter of type `Self`.
2079+
second parameter of type `self`.
20792080
In contrast, in the `impl`, `equals` takes a second parameter of
20802081
type `int`, only using `self` as the name of the receiver.
20812082

branches/auto/src/libcore/at_vec.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
1313
use cast::transmute;
1414
use kinds::Copy;
15-
use old_iter;
15+
use iter;
1616
use option::Option;
17+
use ptr::addr_of;
1718
use sys;
1819
use uint;
1920
use vec;
@@ -39,7 +40,8 @@ pub mod rustrt {
3940
#[inline(always)]
4041
pub fn capacity<T>(v: @[T]) -> uint {
4142
unsafe {
42-
let repr: **raw::VecRepr = transmute(&v);
43+
let repr: **raw::VecRepr =
44+
::cast::transmute(addr_of(&v));
4345
(**repr).unboxed.alloc / sys::size_of::<T>()
4446
}
4547
}
@@ -123,7 +125,7 @@ pub fn map<T, U>(v: &[T], f: &fn(x: &T) -> U) -> @[U] {
123125
* Creates an immutable vector of size `n_elts` and initializes the elements
124126
* to the value returned by the function `op`.
125127
*/
126-
pub fn from_fn<T>(n_elts: uint, op: old_iter::InitOp<T>) -> @[T] {
128+
pub fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> @[T] {
127129
do build_sized(n_elts) |push| {
128130
let mut i: uint = 0u;
129131
while i < n_elts { push(op(i)); i += 1u; }
@@ -185,12 +187,13 @@ pub mod traits {}
185187

186188
pub mod raw {
187189
use at_vec::{capacity, rustrt};
188-
use cast::{transmute, transmute_copy};
190+
use cast::transmute;
189191
use libc;
192+
use unstable::intrinsics::{move_val_init};
193+
use ptr::addr_of;
190194
use ptr;
191195
use sys;
192196
use uint;
193-
use unstable::intrinsics::{move_val_init};
194197
use vec;
195198

196199
pub type VecRepr = vec::raw::VecRepr;
@@ -205,17 +208,18 @@ pub mod raw {
205208
*/
206209
#[inline(always)]
207210
pub unsafe fn set_len<T>(v: @[T], new_len: uint) {
208-
let repr: **mut VecRepr = transmute(&v);
211+
let repr: **mut VecRepr = ::cast::transmute(addr_of(&v));
209212
(**repr).unboxed.fill = new_len * sys::size_of::<T>();
210213
}
211214

212215
#[inline(always)]
213216
pub unsafe fn push<T>(v: &mut @[T], initval: T) {
214-
let repr: **VecRepr = transmute_copy(&v);
217+
let repr: **VecRepr = ::cast::reinterpret_cast(&v);
215218
let fill = (**repr).unboxed.fill;
216219
if (**repr).unboxed.alloc > fill {
217220
push_fast(v, initval);
218-
} else {
221+
}
222+
else {
219223
push_slow(v, initval);
220224
}
221225
}
@@ -225,7 +229,7 @@ pub mod raw {
225229
let repr: **mut VecRepr = ::cast::transmute(v);
226230
let fill = (**repr).unboxed.fill;
227231
(**repr).unboxed.fill += sys::size_of::<T>();
228-
let p = &((**repr).unboxed.data);
232+
let p = addr_of(&((**repr).unboxed.data));
229233
let p = ptr::offset(p, fill) as *mut T;
230234
move_val_init(&mut(*p), initval);
231235
}

branches/auto/src/libcore/cast.rs

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,56 +10,21 @@
1010

1111
//! Unsafe casting functions
1212
13-
use sys;
14-
use unstable;
15-
1613
pub mod rusti {
1714
#[abi = "rust-intrinsic"]
1815
#[link_name = "rusti"]
1916
pub extern "rust-intrinsic" {
2017
fn forget<T>(+x: T);
21-
22-
#[cfg(stage0)]
2318
fn reinterpret_cast<T, U>(&&e: T) -> U;
24-
25-
#[cfg(stage1)]
26-
#[cfg(stage2)]
27-
#[cfg(stage3)]
28-
fn transmute<T,U>(e: T) -> U;
2919
}
3020
}
3121

3222
/// Casts the value at `src` to U. The two types must have the same length.
3323
#[inline(always)]
34-
#[cfg(stage0)]
3524
pub unsafe fn reinterpret_cast<T, U>(src: &T) -> U {
3625
rusti::reinterpret_cast(*src)
3726
}
3827

39-
/// Unsafely copies and casts the value at `src` to U, even if the value is
40-
/// noncopyable. The two types must have the same length.
41-
#[inline(always)]
42-
#[cfg(stage0)]
43-
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
44-
rusti::reinterpret_cast(*src)
45-
}
46-
47-
#[inline(always)]
48-
#[cfg(stage1)]
49-
#[cfg(stage2)]
50-
#[cfg(stage3)]
51-
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
52-
let mut dest: U = unstable::intrinsics::init();
53-
{
54-
let dest_ptr: *mut u8 = rusti::transmute(&mut dest);
55-
let src_ptr: *u8 = rusti::transmute(src);
56-
unstable::intrinsics::memmove64(dest_ptr,
57-
src_ptr,
58-
sys::size_of::<U>() as u64);
59-
}
60-
dest
61-
}
62-
6328
/**
6429
* Move a thing into the void
6530
*
@@ -88,21 +53,12 @@ pub unsafe fn bump_box_refcount<T>(t: @T) { forget(t); }
8853
* assert!(transmute("L") == ~[76u8, 0u8]);
8954
*/
9055
#[inline(always)]
91-
#[cfg(stage0)]
9256
pub unsafe fn transmute<L, G>(thing: L) -> G {
9357
let newthing: G = reinterpret_cast(&thing);
9458
forget(thing);
9559
newthing
9660
}
9761

98-
#[inline(always)]
99-
#[cfg(stage1)]
100-
#[cfg(stage2)]
101-
#[cfg(stage3)]
102-
pub unsafe fn transmute<L, G>(thing: L) -> G {
103-
rusti::transmute(thing)
104-
}
105-
10662
/// Coerce an immutable reference to be mutable.
10763
#[inline(always)]
10864
pub unsafe fn transmute_mut<'a,T>(ptr: &'a T) -> &'a mut T { transmute(ptr) }
@@ -156,20 +112,11 @@ pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {
156112

157113
#[cfg(test)]
158114
mod tests {
159-
use cast::{bump_box_refcount, transmute};
115+
use cast::{bump_box_refcount, reinterpret_cast, transmute};
160116

161117
#[test]
162-
#[cfg(stage0)]
163118
fn test_reinterpret_cast() {
164-
assert!(1u == unsafe { ::cast::reinterpret_cast(&1) });
165-
}
166-
167-
#[test]
168-
#[cfg(stage1)]
169-
#[cfg(stage2)]
170-
#[cfg(stage3)]
171-
fn test_transmute_copy() {
172-
assert!(1u == unsafe { ::cast::transmute_copy(&1) });
119+
assert!(1u == unsafe { reinterpret_cast(&1) });
173120
}
174121

175122
#[test]
@@ -178,8 +125,8 @@ mod tests {
178125
let box = @~"box box box"; // refcount 1
179126
bump_box_refcount(box); // refcount 2
180127
let ptr: *int = transmute(box); // refcount 2
181-
let _box1: @~str = ::cast::transmute_copy(&ptr);
182-
let _box2: @~str = ::cast::transmute_copy(&ptr);
128+
let _box1: @~str = reinterpret_cast(&ptr);
129+
let _box2: @~str = reinterpret_cast(&ptr);
183130
assert!(*_box1 == ~"box box box");
184131
assert!(*_box2 == ~"box box box");
185132
// Will destroy _box1 and _box2. Without the bump, this would

0 commit comments

Comments
 (0)