Skip to content

Commit b5248ca

Browse files
committed
---
yaml --- r: 140657 b: refs/heads/try2 c: d3ca9c6 h: refs/heads/master i: 140655: 10be25b v: v3
1 parent ca4795b commit b5248ca

File tree

115 files changed

+688
-1232
lines changed

Some content is hidden

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

115 files changed

+688
-1232
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: 3e106cf2c2556be6bbcd9a93e5ef2a73b98f0e7a
8+
refs/heads/try2: d3ca9c61a0685c5add1ce2115402dfc3e2f48912
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial-ffi.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub struct Unique<T> {
157157
priv ptr: *mut T
158158
}
159159
160-
pub impl<T: Owned> Unique<T> {
160+
pub impl<'self, T: Owned> Unique<T> {
161161
fn new(value: T) -> Unique<T> {
162162
unsafe {
163163
let ptr = malloc(core::sys::size_of::<T>() as size_t) as *mut T;
@@ -168,14 +168,14 @@ pub impl<T: Owned> Unique<T> {
168168
}
169169
}
170170
171-
// the 'r lifetime results in the same semantics as `&*x` with ~T
172-
fn borrow<'r>(&'r self) -> &'r T {
173-
unsafe { cast::copy_lifetime(self, &*self.ptr) }
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) }
174174
}
175175
176-
// the 'r lifetime results in the same semantics as `&mut *x` with ~T
177-
fn borrow_mut<'r>(&'r mut self) -> &'r mut T {
178-
unsafe { cast::copy_mut_lifetime(self, &mut *self.ptr) }
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) }
179179
}
180180
}
181181

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 separately but to stdout only
767+
// to stdout and stderr seperately 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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ 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 receives
55+
* * builder - A function that will construct the vector. It recieves
5656
* as an argument a function that will push an element
5757
* onto the vector being constructed.
5858
*/
@@ -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 receives
73+
* * builder - A function that will construct the vector. It recieves
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 receives
90+
* * builder - A function that will construct the vector. It recieves
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 lhs.each |x| { push(*x); }
105+
for vec::each(lhs) |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 v.each |elem| {
114+
for vec::each(v) |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(not(test))]
169+
#[cfg(notest)]
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(not(test))]
13+
#[cfg(notest)]
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(not(test))]
78+
#[cfg(notest)]
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(not(test))]
90+
#[cfg(notest)]
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(not(test))]
96+
#[cfg(notest)]
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: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,6 @@ pub mod rusti {
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)]
4127
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
4228
let mut dest: U = unstable::intrinsics::init();
4329
{
@@ -122,12 +108,6 @@ pub unsafe fn copy_lifetime<'a,S,T>(_ptr: &'a S, ptr: &T) -> &'a T {
122108
transmute_region(ptr)
123109
}
124110

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-
131111
/// Transforms lifetime of the second pointer to match the first.
132112
#[inline(always)]
133113
pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {

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(not(test))]
13+
#[cfg(notest)]
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(not(test))] use cmp::Eq;
21+
#[cfg(notest)] 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(not(test))]
247+
#[cfg(notest)]
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(not(test))]
255+
#[cfg(notest)]
256256
impl Ord for char {
257257
#[inline(always)]
258258
fn lt(&self, other: &char) -> bool { *self < *other }

branches/try2/src/libcore/cleanup.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use ptr::mut_null;
1515
use repr::BoxRepr;
1616
use sys::TypeDesc;
1717
use cast::transmute;
18-
#[cfg(not(test))] use unstable::lang::clear_task_borrow_list;
18+
#[cfg(notest)] use unstable::lang::clear_task_borrow_list;
1919

20-
#[cfg(not(test))] use ptr::to_unsafe_ptr;
20+
#[cfg(notest)] use ptr::to_unsafe_ptr;
2121

2222
/**
2323
* Runtime structures
@@ -164,7 +164,7 @@ fn debug_mem() -> bool {
164164
}
165165

166166
/// Destroys all managed memory (i.e. @ boxes) held by the current task.
167-
#[cfg(not(test))]
167+
#[cfg(notest)]
168168
#[lang="annihilate"]
169169
pub unsafe fn annihilate() {
170170
use unstable::lang::local_free;

branches/try2/src/libcore/core.rc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ they contained the following prologue:
6060
// Don't link to core. We are core.
6161
#[no_core];
6262

63+
#[warn(vecs_implicitly_copyable)];
6364
#[deny(non_camel_case_types)];
6465
#[allow(deprecated_mutable_fields)];
6566

@@ -178,9 +179,9 @@ pub mod managed;
178179

179180
/* Core language traits */
180181

181-
#[cfg(not(test))] pub mod kinds;
182-
#[cfg(not(test))] pub mod ops;
183-
#[cfg(not(test))] pub mod cmp;
182+
#[cfg(notest)] pub mod kinds;
183+
#[cfg(notest)] pub mod ops;
184+
#[cfg(notest)] pub mod cmp;
184185

185186

186187
/* Common traits */

branches/try2/src/libcore/either.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn lefts<T:Copy,U>(eithers: &[Either<T, U>]) -> ~[T] {
4444
//! Extracts from a vector of either all the left values
4545
4646
do vec::build_sized(eithers.len()) |push| {
47-
for eithers.each |elt| {
47+
for vec::each(eithers) |elt| {
4848
match *elt {
4949
Left(ref l) => { push(*l); }
5050
_ => { /* fallthrough */ }
@@ -57,7 +57,7 @@ pub fn rights<T, U: Copy>(eithers: &[Either<T, U>]) -> ~[U] {
5757
//! Extracts from a vector of either all the right values
5858
5959
do vec::build_sized(eithers.len()) |push| {
60-
for eithers.each |elt| {
60+
for vec::each(eithers) |elt| {
6161
match *elt {
6262
Right(ref r) => { push(*r); }
6363
_ => { /* fallthrough */ }

branches/try2/src/libcore/hash.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use cast;
2424
use rt::io::Writer;
2525
use to_bytes::IterBytes;
2626
use uint;
27+
use vec;
2728

2829
// Alias `SipState` to `State`.
2930
pub use State = hash::SipState;
@@ -377,7 +378,7 @@ impl Streaming for SipState {
377378
fn result_str(&mut self) -> ~str {
378379
let r = self.result_bytes();
379380
let mut s = ~"";
380-
for r.each |b| {
381+
for vec::each(r) |b| {
381382
s += uint::to_str_radix(*b as uint, 16u);
382383
}
383384
s
@@ -477,7 +478,7 @@ mod tests {
477478

478479
fn to_hex_str(r: &[u8, ..8]) -> ~str {
479480
let mut s = ~"";
480-
for (*r).each |b| {
481+
for vec::each(*r) |b| {
481482
s += uint::to_str_radix(*b as uint, 16u);
482483
}
483484
s

branches/try2/src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
12001200
fn wb() -> c_int { O_WRONLY as c_int }
12011201

12021202
let mut fflags: c_int = wb();
1203-
for flags.each |f| {
1203+
for vec::each(flags) |f| {
12041204
match *f {
12051205
Append => fflags |= O_APPEND as c_int,
12061206
Create => fflags |= O_CREAT as c_int,

branches/try2/src/libcore/iter.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ breaking out of iteration. The adaptors in the module work with any such iterato
1717
tied to specific traits. For example:
1818
1919
~~~~
20-
println(iter::to_vec(|f| uint::range(0, 20, f)).to_str());
20+
use core::iter::iter_to_vec;
21+
println(iter_to_vec(|f| uint::range(0, 20, f)).to_str());
2122
~~~~
2223
2324
An external iterator object implementing the interface in the `iterator` module can be used as an
@@ -54,12 +55,12 @@ pub trait Times {
5455
*
5556
* ~~~
5657
* let xs = ~[1, 2, 3];
57-
* let ys = do iter::to_vec |f| { xs.each(|x| f(*x)) };
58+
* let ys = do iter_to_vec |f| { xs.each(|x| f(*x)) };
5859
* assert_eq!(xs, ys);
5960
* ~~~
6061
*/
6162
#[inline(always)]
62-
pub fn to_vec<T>(iter: &fn(f: &fn(T) -> bool)) -> ~[T] {
63+
pub fn iter_to_vec<T>(iter: &fn(f: &fn(T) -> bool)) -> ~[T] {
6364
let mut v = ~[];
6465
for iter |x| { v.push(x) }
6566
v
@@ -184,9 +185,9 @@ mod tests {
184185
use prelude::*;
185186

186187
#[test]
187-
fn test_to_vec() {
188+
fn test_iter_to_vec() {
188189
let xs = ~[1, 2, 3];
189-
let ys = do to_vec |f| { xs.each(|x| f(*x)) };
190+
let ys = do iter_to_vec |f| { xs.each(|x| f(*x)) };
190191
assert_eq!(xs, ys);
191192
}
192193

branches/try2/src/libcore/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ mod tests {
378378
#[test]
379379
fn test_counter_to_vec() {
380380
let mut it = Counter::new(0, 5).take(10);
381-
let xs = iter::to_vec(|f| it.advance(f));
381+
let xs = iter::iter_to_vec(|f| it.advance(f));
382382
assert_eq!(xs, ~[0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);
383383
}
384384

branches/try2/src/libcore/logging.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn console_off() {
4242
}
4343
}
4444

45-
#[cfg(not(test))]
45+
#[cfg(notest)]
4646
#[lang="log_type"]
4747
pub fn log_type<T>(level: u32, object: &T) {
4848
use cast::transmute;

0 commit comments

Comments
 (0)