Skip to content

Commit ac84fcc

Browse files
committed
---
yaml --- r: 148819 b: refs/heads/try2 c: 3e39e3e h: refs/heads/master i: 148817: 8b0795f 148815: f0c39a8 v: v3
1 parent c32def4 commit ac84fcc

File tree

221 files changed

+3638
-3174
lines changed

Some content is hidden

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

221 files changed

+3638
-3174
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: dab864098a814830dfed4b9ed6887cd2139d4bad
8+
refs/heads/try2: 3e39e3e80dcf726a96ec0fe778f96e2a9dde620b
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ fetch snapshots, and an OS that can execute the available snapshot binaries.
7171

7272
Snapshot binaries are currently built and tested on several platforms:
7373

74-
* Windows (7, Server 2008 R2), x86 only
75-
* Linux (various distributions), x86 and x86-64
76-
* OSX 10.6 ("Snow Leopard") or greater, x86 and x86-64
74+
* Windows (7, 8, Server 2008 R2), x86 only
75+
* Linux (2.6.18 or later, various distributions), x86 and x86-64
76+
* OSX 10.7 (Lion) or greater, x86 and x86-64
7777

7878
You may find that other platforms work, but these are our officially
7979
supported build environments that are most likely to work.

branches/try2/doc/rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3079,7 +3079,7 @@ A value of type `str` is a Unicode string,
30793079
represented as a vector of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.
30803080
Since `str` is of unknown size, it is not a _first class_ type,
30813081
but can only be instantiated through a pointer type,
3082-
such as `&str`, `@str` or `~str`.
3082+
such as `&str` or `~str`.
30833083

30843084
### Tuple types
30853085

@@ -3115,7 +3115,7 @@ Such a definite-sized vector type is a first-class type, since its size is known
31153115
A vector without such a size is said to be of _indefinite_ size,
31163116
and is therefore not a _first-class_ type.
31173117
An indefinite-size vector can only be instantiated through a pointer type,
3118-
such as `&[T]`, `@[T]` or `~[T]`.
3118+
such as `&[T]` or `~[T]`.
31193119
The kind of a vector type depends on the kind of its element type,
31203120
as with other simple structural types.
31213121

branches/try2/doc/rustdoc.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,14 @@ that one can still write things like `#[deriving(Eq)]`).
139139

140140
~~~
141141
```rust
142-
# // showing 'fib' in this documentation would just be tedious and detracts from
143-
# // what's actualy being documented.
144-
# fn fib(n: int) { n + 2 }
142+
# /!\ The three following lines are comments, which are usually stripped off by
143+
# the doc-generating tool. In order to display them anyway in this particular
144+
# case, the character following the leading '#' is not a usual space like in
145+
# these first five lines but a non breakable one.
146+
#
147+
# // showing 'fib' in this documentation would just be tedious and detracts from
148+
# // what's actualy being documented.
149+
# fn fib(n: int) { n + 2 }
145150
146151
do spawn { fib(200); }
147152
```

branches/try2/doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ from the Internet on our supported platforms.
7272

7373
Snapshot binaries are currently built and tested on several platforms:
7474

75-
* Windows (7, Server 2008 R2), x86 only
76-
* Linux (various distributions), x86 and x86-64
77-
* OSX 10.6 ("Snow Leopard") or greater, x86 and x86-64
75+
* Windows (7, 8, Server 2008 R2), x86 only
76+
* Linux (2.6.18 or later, various distributions), x86 and x86-64
77+
* OSX 10.7 (Lion) or greater, x86 and x86-64
7878

7979
You may find that other platforms work, but these are our "tier 1"
8080
supported build environments that are most likely to work.

branches/try2/src/libarena/lib.rs

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,38 @@ extern mod extra;
2727
use extra::list::{List, Cons, Nil};
2828
use extra::list;
2929

30-
use std::at_vec;
3130
use std::cast::{transmute, transmute_mut, transmute_mut_region};
3231
use std::cast;
3332
use std::cell::{Cell, RefCell};
3433
use std::num;
3534
use std::ptr;
35+
use std::kinds::marker;
3636
use std::mem;
37+
use std::rc::Rc;
3738
use std::rt::global_heap;
38-
use std::uint;
3939
use std::unstable::intrinsics::{TyDesc, get_tydesc};
4040
use std::unstable::intrinsics;
4141
use std::util;
42+
use std::vec;
4243

4344
// The way arena uses arrays is really deeply awful. The arrays are
4445
// allocated, and have capacities reserved, but the fill for the array
4546
// will always stay at 0.
4647
#[deriving(Clone)]
4748
struct Chunk {
48-
data: RefCell<@[u8]>,
49+
data: Rc<RefCell<~[u8]>>,
4950
fill: Cell<uint>,
5051
is_pod: Cell<bool>,
5152
}
53+
impl Chunk {
54+
fn capacity(&self) -> uint {
55+
self.data.borrow().borrow().get().capacity()
56+
}
57+
58+
unsafe fn as_ptr(&self) -> *u8 {
59+
self.data.borrow().borrow().get().as_ptr()
60+
}
61+
}
5262

5363
// Arenas are used to quickly allocate objects that share a
5464
// lifetime. The arena uses ~[u8] vectors as a backing store to
@@ -71,14 +81,14 @@ struct Chunk {
7181
// different chunks than objects without destructors. This reduces
7282
// overhead when initializing plain-old-data and means we don't need
7383
// to waste time running the destructors of POD.
74-
#[no_freeze]
7584
pub struct Arena {
7685
// The head is separated out from the list as a unbenchmarked
7786
// microoptimization, to avoid needing to case on the list to
7887
// access the head.
7988
priv head: Chunk,
8089
priv pod_head: Chunk,
8190
priv chunks: RefCell<@List<Chunk>>,
91+
priv no_freeze: marker::NoFreeze,
8292
}
8393

8494
impl Arena {
@@ -91,15 +101,14 @@ impl Arena {
91101
head: chunk(initial_size, false),
92102
pod_head: chunk(initial_size, true),
93103
chunks: RefCell::new(@Nil),
104+
no_freeze: marker::NoFreeze,
94105
}
95106
}
96107
}
97108

98109
fn chunk(size: uint, is_pod: bool) -> Chunk {
99-
let mut v: @[u8] = @[];
100-
unsafe { at_vec::raw::reserve(&mut v, size); }
101110
Chunk {
102-
data: RefCell::new(unsafe { cast::transmute(v) }),
111+
data: Rc::new(RefCell::new(vec::with_capacity(size))),
103112
fill: Cell::new(0u),
104113
is_pod: Cell::new(is_pod),
105114
}
@@ -130,10 +139,7 @@ fn round_up(base: uint, align: uint) -> uint {
130139
// in it.
131140
unsafe fn destroy_chunk(chunk: &Chunk) {
132141
let mut idx = 0;
133-
let buf = {
134-
let data = chunk.data.borrow();
135-
data.get().as_ptr()
136-
};
142+
let buf = chunk.as_ptr();
137143
let fill = chunk.fill.get();
138144

139145
while idx < fill {
@@ -171,14 +177,16 @@ unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TyDesc, bool) {
171177
}
172178

173179
impl Arena {
180+
fn chunk_size(&self) -> uint {
181+
self.pod_head.capacity()
182+
}
174183
// Functions for the POD part of the arena
175184
fn alloc_pod_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
176185
// Allocate a new chunk.
177-
let chunk_size = at_vec::capacity(self.pod_head.data.get());
178-
let new_min_chunk_size = num::max(n_bytes, chunk_size);
186+
let new_min_chunk_size = num::max(n_bytes, self.chunk_size());
179187
self.chunks.set(@Cons(self.pod_head.clone(), self.chunks.get()));
180188
self.pod_head =
181-
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), true);
189+
chunk(num::next_power_of_two(new_min_chunk_size + 1u), true);
182190

183191
return self.alloc_pod_inner(n_bytes, align);
184192
}
@@ -189,15 +197,15 @@ impl Arena {
189197
let this = transmute_mut_region(self);
190198
let start = round_up(this.pod_head.fill.get(), align);
191199
let end = start + n_bytes;
192-
if end > at_vec::capacity(this.pod_head.data.get()) {
200+
if end > self.chunk_size() {
193201
return this.alloc_pod_grow(n_bytes, align);
194202
}
195203
this.pod_head.fill.set(end);
196204

197205
//debug!("idx = {}, size = {}, align = {}, fill = {}",
198206
// start, n_bytes, align, head.fill.get());
199207

200-
ptr::offset(this.pod_head.data.get().as_ptr(), start as int)
208+
this.pod_head.as_ptr().offset(start as int)
201209
}
202210
}
203211

@@ -216,11 +224,10 @@ impl Arena {
216224
fn alloc_nonpod_grow(&mut self, n_bytes: uint, align: uint)
217225
-> (*u8, *u8) {
218226
// Allocate a new chunk.
219-
let chunk_size = at_vec::capacity(self.head.data.get());
220-
let new_min_chunk_size = num::max(n_bytes, chunk_size);
227+
let new_min_chunk_size = num::max(n_bytes, self.chunk_size());
221228
self.chunks.set(@Cons(self.head.clone(), self.chunks.get()));
222229
self.head =
223-
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), false);
230+
chunk(num::next_power_of_two(new_min_chunk_size + 1u), false);
224231

225232
return self.alloc_nonpod_inner(n_bytes, align);
226233
}
@@ -243,7 +250,7 @@ impl Arena {
243250
end = start + n_bytes;
244251
}
245252

246-
if end > at_vec::capacity(self.head.data.get()) {
253+
if end > self.head.capacity() {
247254
return self.alloc_nonpod_grow(n_bytes, align);
248255
}
249256

@@ -253,7 +260,7 @@ impl Arena {
253260
//debug!("idx = {}, size = {}, align = {}, fill = {}",
254261
// start, n_bytes, align, head.fill);
255262

256-
let buf = self.head.data.get().as_ptr();
263+
let buf = self.head.as_ptr();
257264
return (ptr::offset(buf, tydesc_start as int), ptr::offset(buf, start as int));
258265
}
259266
}
@@ -605,5 +612,3 @@ mod test {
605612
})
606613
}
607614
}
608-
609-

branches/try2/src/libextra/arc.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ use sync;
4545
use sync::{Mutex, RWLock};
4646

4747
use std::cast;
48+
use std::kinds::marker;
4849
use std::sync::arc::UnsafeArc;
4950
use std::task;
5051

@@ -150,17 +151,19 @@ impl<T:Freeze + Send> Clone for Arc<T> {
150151
struct MutexArcInner<T> { lock: Mutex, failed: bool, data: T }
151152

152153
/// An Arc with mutable data protected by a blocking mutex.
153-
#[no_freeze]
154-
pub struct MutexArc<T> { priv x: UnsafeArc<MutexArcInner<T>> }
155-
154+
pub struct MutexArc<T> {
155+
priv x: UnsafeArc<MutexArcInner<T>>,
156+
priv marker: marker::NoFreeze,
157+
}
156158

157159
impl<T:Send> Clone for MutexArc<T> {
158160
/// Duplicate a mutex-protected Arc. See arc::clone for more details.
159161
#[inline]
160162
fn clone(&self) -> MutexArc<T> {
161163
// NB: Cloning the underlying mutex is not necessary. Its reference
162164
// count would be exactly the same as the shared state's.
163-
MutexArc { x: self.x.clone() }
165+
MutexArc { x: self.x.clone(),
166+
marker: marker::NoFreeze, }
164167
}
165168
}
166169

@@ -179,7 +182,8 @@ impl<T:Send> MutexArc<T> {
179182
lock: Mutex::new_with_condvars(num_condvars),
180183
failed: false, data: user_data
181184
};
182-
MutexArc { x: UnsafeArc::new(data) }
185+
MutexArc { x: UnsafeArc::new(data),
186+
marker: marker::NoFreeze, }
183187
}
184188

185189
/**
@@ -318,16 +322,17 @@ struct RWArcInner<T> { lock: RWLock, failed: bool, data: T }
318322
*
319323
* Unlike mutex_arcs, rw_arcs are safe, because they cannot be nested.
320324
*/
321-
#[no_freeze]
322325
pub struct RWArc<T> {
323326
priv x: UnsafeArc<RWArcInner<T>>,
327+
priv marker: marker::NoFreeze,
324328
}
325329

326330
impl<T:Freeze + Send> Clone for RWArc<T> {
327331
/// Duplicate a rwlock-protected Arc. See arc::clone for more details.
328332
#[inline]
329333
fn clone(&self) -> RWArc<T> {
330-
RWArc { x: self.x.clone() }
334+
RWArc { x: self.x.clone(),
335+
marker: marker::NoFreeze, }
331336
}
332337

333338
}
@@ -347,7 +352,8 @@ impl<T:Freeze + Send> RWArc<T> {
347352
lock: RWLock::new_with_condvars(num_condvars),
348353
failed: false, data: user_data
349354
};
350-
RWArc { x: UnsafeArc::new(data), }
355+
RWArc { x: UnsafeArc::new(data),
356+
marker: marker::NoFreeze, }
351357
}
352358

353359
/**

branches/try2/src/libextra/hex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -60,7 +60,7 @@ pub trait FromHex {
6060
pub enum FromHexError {
6161
/// The input contained a character not part of the hex format
6262
InvalidHexCharacter(char, uint),
63-
/// The input had a invalid length
63+
/// The input had an invalid length
6464
InvalidHexLength,
6565
}
6666

branches/try2/src/libextra/num/bigint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub mod BigDigit {
8080
/**
8181
A big unsigned integer type.
8282
83-
A `BigUint`-typed value `BigUint { data: @[a, b, c] }` represents a number
83+
A `BigUint`-typed value `BigUint { data: ~[a, b, c] }` represents a number
8484
`(a + b * BigDigit::base + c * BigDigit::base^2)`.
8585
*/
8686
#[deriving(Clone)]
@@ -1292,7 +1292,7 @@ impl ToStrRadix for BigInt {
12921292
}
12931293
12941294
impl FromStrRadix for BigInt {
1295-
/// Creates and initializes an BigInt.
1295+
/// Creates and initializes a BigInt.
12961296
#[inline]
12971297
fn from_str_radix(s: &str, radix: uint) -> Option<BigInt> {
12981298
BigInt::parse_bytes(s.as_bytes(), radix)
@@ -1385,7 +1385,7 @@ impl<R: Rng> RandBigInt for R {
13851385
}
13861386
13871387
impl BigInt {
1388-
/// Creates and initializes an BigInt.
1388+
/// Creates and initializes a BigInt.
13891389
#[inline]
13901390
pub fn new(sign: Sign, v: ~[BigDigit]) -> BigInt {
13911391
BigInt::from_biguint(sign, BigUint::new(v))

branches/try2/src/libextra/ringbuf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {
303303
&mut self.remaining2
304304
};
305305
self.nelts -= 1;
306-
Some(r.mut_shift_ref().get_mut_ref())
306+
Some(r.mut_shift_ref().unwrap().get_mut_ref())
307307
}
308308

309309
#[inline]
@@ -325,7 +325,7 @@ impl<'a, T> DoubleEndedIterator<&'a mut T> for MutItems<'a, T> {
325325
&mut self.remaining1
326326
};
327327
self.nelts -= 1;
328-
Some(r.mut_pop_ref().get_mut_ref())
328+
Some(r.mut_pop_ref().unwrap().get_mut_ref())
329329
}
330330
}
331331

0 commit comments

Comments
 (0)