Skip to content

Commit 705af05

Browse files
committed
---
yaml --- r: 140701 b: refs/heads/try2 c: 96de2b0 h: refs/heads/master i: 140699: 83f7642 v: v3
1 parent b6ae4dc commit 705af05

File tree

343 files changed

+7009
-3192
lines changed

Some content is hidden

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

343 files changed

+7009
-3192
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 9b30fa31168c9337da36a95484b2550954528216
8+
refs/heads/try2: 96de2b0273e828edf45d4b3e6c4dc5c3cf665fd5
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,35 +1946,6 @@ fn avg(v: &[float]) -> float {
19461946
}
19471947
~~~~
19481948

1949-
#### Swap expressions
1950-
1951-
A _swap expression_ consists of an [lvalue](#lvalues-rvalues-and-temporaries) followed by a bi-directional arrow (`<->`) and another [lvalue](#lvalues-rvalues-and-temporaries).
1952-
1953-
Evaluating a swap expression causes, as a side effect, the values held in the left-hand-side and right-hand-side [lvalues](#lvalues-rvalues-and-temporaries) to be exchanged indivisibly.
1954-
1955-
Evaluating a swap expression neither changes reference counts,
1956-
nor deeply copies any owned structure pointed to by the moved [rvalue](#lvalues-rvalues-and-temporaries).
1957-
Instead, the swap expression represents an indivisible *exchange of ownership*,
1958-
between the right-hand-side and the left-hand-side of the expression.
1959-
No allocation or destruction is entailed.
1960-
1961-
An example of three different swap expressions:
1962-
1963-
~~~~~~~~
1964-
# let mut x = &mut [0];
1965-
# let mut a = &mut [0];
1966-
# let i = 0;
1967-
# struct S1 { z: int };
1968-
# struct S2 { c: int };
1969-
# let mut y = S1{z: 0};
1970-
# let mut b = S2{c: 0};
1971-
1972-
x <-> a;
1973-
x[i] <-> a[i];
1974-
y.z <-> b.c;
1975-
~~~~~~~~
1976-
1977-
19781949
#### Assignment expressions
19791950

19801951
An _assignment expression_ consists of an [lvalue](#lvalues-rvalues-and-temporaries) expression followed by an
@@ -2015,7 +1986,7 @@ as
20151986
== !=
20161987
&&
20171988
||
2018-
= <->
1989+
=
20191990
~~~~
20201991

20211992
Operators at the same precedence level are evaluated left-to-right.

branches/try2/doc/tutorial-ffi.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,14 @@ wrapping `malloc` and `free`:
151151
~~~~
152152
use core::libc::{c_void, size_t, malloc, free};
153153
use core::unstable::intrinsics;
154+
use core::util;
154155
155156
// a wrapper around the handle returned by the foreign code
156157
pub struct Unique<T> {
157158
priv ptr: *mut T
158159
}
159160
160-
pub impl<'self, T: Owned> Unique<T> {
161+
pub impl<T: Owned> Unique<T> {
161162
fn new(value: T) -> Unique<T> {
162163
unsafe {
163164
let ptr = malloc(core::sys::size_of::<T>() as size_t) as *mut T;
@@ -168,14 +169,14 @@ pub impl<'self, T: Owned> Unique<T> {
168169
}
169170
}
170171
171-
// the 'self lifetime results in the same semantics as `&*x` with ~T
172-
fn borrow(&self) -> &'self T {
173-
unsafe { cast::transmute(self.ptr) }
172+
// the 'r lifetime results in the same semantics as `&*x` with ~T
173+
fn borrow<'r>(&'r self) -> &'r T {
174+
unsafe { cast::copy_lifetime(self, &*self.ptr) }
174175
}
175176
176-
// the 'self lifetime results in the same semantics as `&mut *x` with ~T
177-
fn borrow_mut(&mut self) -> &'self mut T {
178-
unsafe { cast::transmute(self.ptr) }
177+
// the 'r lifetime results in the same semantics as `&mut *x` with ~T
178+
fn borrow_mut<'r>(&'r mut self) -> &'r mut T {
179+
unsafe { cast::copy_mut_lifetime(self, &mut *self.ptr) }
179180
}
180181
}
181182
@@ -184,7 +185,8 @@ impl<T: Owned> Drop for Unique<T> {
184185
fn finalize(&self) {
185186
unsafe {
186187
let mut x = intrinsics::init(); // dummy value to swap in
187-
x <-> *self.ptr; // moving the object out is needed to call the destructor
188+
// moving the object out is needed to call the destructor
189+
util::replace_ptr(self.ptr, x);
188190
free(self.ptr as *c_void)
189191
}
190192
}

branches/try2/mk/platform.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,12 @@ AR_mips-unknown-linux-gnu=mips-linux-gnu-ar
247247
CFG_LIB_NAME_mips-unknown-linux-gnu=lib$(1).so
248248
CFG_LIB_GLOB_mips-unknown-linux-gnu=lib$(1)-*.so
249249
CFG_LIB_DSYM_GLOB_mips-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
250-
CFG_GCCISH_CFLAGS_mips-unknown-linux-gnu := -Wall -g -fPIC -mips32r2 -msoft-float -mabi=32
250+
CFG_GCCISH_CFLAGS_mips-unknown-linux-gnu := -Wall -g -fPIC -mips32r2 -msoft-float -mabi=32 -mno-compact-eh
251251
CFG_GCCISH_CXXFLAGS_mips-unknown-linux-gnu := -fno-rtti
252252
CFG_GCCISH_LINK_FLAGS_mips-unknown-linux-gnu := -shared -fPIC -g -mips32r2 -msoft-float -mabi=32
253253
CFG_GCCISH_DEF_FLAG_mips-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
254254
CFG_GCCISH_PRE_LIB_FLAGS_mips-unknown-linux-gnu := -Wl,-whole-archive
255-
CFG_GCCISH_POST_LIB_FLAGS_mips-unknown-linux-gnu := -Wl,-no-whole-archive -Wl,-znoexecstack
255+
CFG_GCCISH_POST_LIB_FLAGS_mips-unknown-linux-gnu := -Wl,-no-whole-archive
256256
CFG_DEF_SUFFIX_mips-unknown-linux-gnu := .linux.def
257257
CFG_INSTALL_NAME_mips-unknown-linux-gnu =
258258
CFG_LIBUV_LINK_FLAGS_mips-unknown-linux-gnu =

branches/try2/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ fn _arm_exec_compiled_test(config: config, props: TestProps,
764764
logv(config, fmt!("executing (%s) %s", config.target, cmdline));
765765
766766
// adb shell dose not forward stdout and stderr of internal result
767-
// to stdout and stderr seperately but to stdout only
767+
// to stdout and stderr separately but to stdout only
768768
let mut newargs_out = ~[];
769769
let mut newargs_err = ~[];
770770
let subargs = args.args;

branches/try2/src/libcore/at_vec.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ pub mod rustrt {
2929
#[abi = "cdecl"]
3030
#[link_name = "rustrt"]
3131
pub extern {
32-
pub unsafe fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
33-
++v: **vec::raw::VecRepr,
34-
++n: libc::size_t);
32+
pub unsafe fn vec_reserve_shared_actual(t: *sys::TypeDesc,
33+
v: **vec::raw::VecRepr,
34+
n: libc::size_t);
3535
}
3636
}
3737

@@ -52,15 +52,15 @@ pub fn capacity<T>(v: @[T]) -> uint {
5252
* # Arguments
5353
*
5454
* * size - An initial size of the vector to reserve
55-
* * builder - A function that will construct the vector. It recieves
55+
* * builder - A function that will construct the vector. It receives
5656
* as an argument a function that will push an element
5757
* onto the vector being constructed.
5858
*/
5959
#[inline(always)]
6060
pub fn build_sized<A>(size: uint, builder: &fn(push: &fn(v: A))) -> @[A] {
6161
let mut vec: @[A] = @[];
6262
unsafe { raw::reserve(&mut vec, size); }
63-
builder(|+x| unsafe { raw::push(&mut vec, x) });
63+
builder(|x| unsafe { raw::push(&mut vec, x) });
6464
return unsafe { transmute(vec) };
6565
}
6666

@@ -70,7 +70,7 @@ pub fn build_sized<A>(size: uint, builder: &fn(push: &fn(v: A))) -> @[A] {
7070
*
7171
* # Arguments
7272
*
73-
* * builder - A function that will construct the vector. It recieves
73+
* * builder - A function that will construct the vector. It receives
7474
* as an argument a function that will push an element
7575
* onto the vector being constructed.
7676
*/
@@ -87,7 +87,7 @@ pub fn build<A>(builder: &fn(push: &fn(v: A))) -> @[A] {
8787
* # Arguments
8888
*
8989
* * size - An option, maybe containing initial size of the vector to reserve
90-
* * builder - A function that will construct the vector. It recieves
90+
* * builder - A function that will construct the vector. It receives
9191
* as an argument a function that will push an element
9292
* onto the vector being constructed.
9393
*/
@@ -102,7 +102,7 @@ pub fn build_sized_opt<A>(size: Option<uint>,
102102
#[inline(always)]
103103
pub fn append<T:Copy>(lhs: @[T], rhs: &const [T]) -> @[T] {
104104
do build_sized(lhs.len() + rhs.len()) |push| {
105-
for vec::each(lhs) |x| { push(*x); }
105+
for lhs.each |x| { push(*x); }
106106
for uint::range(0, rhs.len()) |i| { push(rhs[i]); }
107107
}
108108
}
@@ -111,7 +111,7 @@ pub fn append<T:Copy>(lhs: @[T], rhs: &const [T]) -> @[T] {
111111
/// Apply a function to each element of a vector and return the results
112112
pub fn map<T, U>(v: &[T], f: &fn(x: &T) -> U) -> @[U] {
113113
do build_sized(v.len()) |push| {
114-
for vec::each(v) |elem| {
114+
for v.each |elem| {
115115
push(f(elem));
116116
}
117117
}
@@ -166,7 +166,7 @@ pub fn from_slice<T:Copy>(v: &[T]) -> @[T] {
166166
from_fn(v.len(), |i| v[i])
167167
}
168168

169-
#[cfg(notest)]
169+
#[cfg(not(test))]
170170
pub mod traits {
171171
use at_vec::append;
172172
use kinds::Copy;

branches/try2/src/libcore/bool.rs

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

1111
//! Boolean logic
1212
13-
#[cfg(notest)]
13+
#[cfg(not(test))]
1414
use cmp::{Eq, Ord, TotalOrd, Ordering};
1515
use option::{None, Option, Some};
1616
use from_str::FromStr;
@@ -75,7 +75,7 @@ pub fn all_values(blk: &fn(v: bool)) {
7575
#[inline(always)]
7676
pub fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
7777

78-
#[cfg(notest)]
78+
#[cfg(not(test))]
7979
impl Ord for bool {
8080
#[inline(always)]
8181
fn lt(&self, other: &bool) -> bool { to_bit(*self) < to_bit(*other) }
@@ -87,13 +87,13 @@ impl Ord for bool {
8787
fn ge(&self, other: &bool) -> bool { to_bit(*self) >= to_bit(*other) }
8888
}
8989

90-
#[cfg(notest)]
90+
#[cfg(not(test))]
9191
impl TotalOrd for bool {
9292
#[inline(always)]
9393
fn cmp(&self, other: &bool) -> Ordering { to_bit(*self).cmp(&to_bit(*other)) }
9494
}
9595

96-
#[cfg(notest)]
96+
#[cfg(not(test))]
9797
impl Eq for bool {
9898
#[inline(always)]
9999
fn eq(&self, other: &bool) -> bool { (*self) == (*other) }

branches/try2/src/libcore/cast.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,27 @@ pub mod rusti {
1717
#[abi = "rust-intrinsic"]
1818
#[link_name = "rusti"]
1919
pub extern "rust-intrinsic" {
20-
fn forget<T>(+x: T);
20+
fn forget<T>(x: T);
2121

2222
fn transmute<T,U>(e: T) -> U;
2323
}
2424
}
2525

2626
/// Casts the value at `src` to U. The two types must have the same length.
27+
#[cfg(not(stage0))]
28+
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
29+
let mut dest: U = unstable::intrinsics::uninit();
30+
{
31+
let dest_ptr: *mut u8 = rusti::transmute(&mut dest);
32+
let src_ptr: *u8 = rusti::transmute(src);
33+
unstable::intrinsics::memmove64(dest_ptr,
34+
src_ptr,
35+
sys::size_of::<U>() as u64);
36+
}
37+
dest
38+
}
39+
40+
#[cfg(stage0)]
2741
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
2842
let mut dest: U = unstable::intrinsics::init();
2943
{
@@ -108,6 +122,12 @@ pub unsafe fn copy_lifetime<'a,S,T>(_ptr: &'a S, ptr: &T) -> &'a T {
108122
transmute_region(ptr)
109123
}
110124

125+
/// Transforms lifetime of the second pointer to match the first.
126+
#[inline(always)]
127+
pub unsafe fn copy_mut_lifetime<'a,S,T>(_ptr: &'a mut S, ptr: &mut T) -> &'a mut T {
128+
transmute_mut_region(ptr)
129+
}
130+
111131
/// Transforms lifetime of the second pointer to match the first.
112132
#[inline(always)]
113133
pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {

branches/try2/src/libcore/cell.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
1313
use cast::transmute_mut;
1414
use prelude::*;
15+
use util::replace;
1516

1617
/*
1718
A dynamic, mutable location.
@@ -48,9 +49,7 @@ pub impl<T> Cell<T> {
4849
fail!(~"attempt to take an empty cell");
4950
}
5051
51-
let mut value = None;
52-
value <-> self.value;
53-
value.unwrap()
52+
replace(&mut self.value, None).unwrap()
5453
}
5554
5655
/// Returns the value, failing if the cell is full.

branches/try2/src/libcore/char.rs

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

1111
//! Utilities for manipulating the char type
1212
13-
#[cfg(notest)]
13+
#[cfg(not(test))]
1414
use cmp::Ord;
1515
use option::{None, Option, Some};
1616
use str;
1717
use u32;
1818
use uint;
1919
use unicode::{derived_property, general_category};
2020

21-
#[cfg(notest)] use cmp::Eq;
21+
#[cfg(not(test))] use cmp::Eq;
2222

2323
/*
2424
Lu Uppercase_Letter an uppercase letter
@@ -244,15 +244,15 @@ pub fn len_utf8_bytes(c: char) -> uint {
244244
else { fail!(~"invalid character!") }
245245
}
246246
247-
#[cfg(notest)]
247+
#[cfg(not(test))]
248248
impl Eq for char {
249249
#[inline(always)]
250250
fn eq(&self, other: &char) -> bool { (*self) == (*other) }
251251
#[inline(always)]
252252
fn ne(&self, other: &char) -> bool { (*self) != (*other) }
253253
}
254254
255-
#[cfg(notest)]
255+
#[cfg(not(test))]
256256
impl Ord for char {
257257
#[inline(always)]
258258
fn lt(&self, other: &char) -> bool { *self < *other }

0 commit comments

Comments
 (0)