Skip to content

Commit abb5f13

Browse files
committed
---
yaml --- r: 107963 b: refs/heads/dist-snap c: 346d378 h: refs/heads/master i: 107961: e38e5ad 107959: 1e0726c v: v3
1 parent 7843b8a commit abb5f13

File tree

41 files changed

+1662
-642
lines changed

Some content is hidden

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

41 files changed

+1662
-642
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 882b4829ce340e6b1a54bdbc3322484ff8c9ffcd
9+
refs/heads/dist-snap: 346d378ad58ec32ad2eb500af1613a53b95bf143
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/mk/crates.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
# automatically generated for all stage/host/target combinations.
5050
################################################################################
5151

52-
TARGET_CRATES := std extra green rustuv native flate arena glob term
52+
TARGET_CRATES := std extra green rustuv native flate arena glob term semver
5353
HOST_CRATES := syntax rustc rustdoc
5454
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5555
TOOLS := compiletest rustdoc rustc
@@ -66,6 +66,7 @@ DEPS_flate := std native:miniz
6666
DEPS_arena := std extra
6767
DEPS_glob := std
6868
DEPS_term := std
69+
DEPS_semver := std
6970

7071
TOOL_DEPS_compiletest := extra green rustuv
7172
TOOL_DEPS_rustdoc := rustdoc green rustuv

branches/dist-snap/src/doc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ li {list-style-type: none; }
4040
* [The `arena` allocation library](arena/index.html)
4141
* [The `flate` compression library](flate/index.html)
4242
* [The `glob` file path matching library](glob/index.html)
43+
* [The `semver` version collation library](semver/index.html)
4344
* [The `term` terminal-handling library](term/index.html)
4445

4546
# Tooling

branches/dist-snap/src/doc/rust.md

Lines changed: 12 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,9 +2426,9 @@ before the expression they apply to.
24262426
: Logical negation. On the boolean type, this flips between `true` and
24272427
`false`. On integer types, this inverts the individual bits in the
24282428
two's complement representation of the value.
2429-
`@` and `~`
2429+
`~`
24302430
: [Boxing](#pointer-types) operators. Allocate a box to hold the value they are applied to,
2431-
and store the value in it. `@` creates a managed box, whereas `~` creates an owned box.
2431+
and store the value in it. `~` creates an owned box.
24322432
`&`
24332433
: Borrow operator. Returns a reference, pointing to its operand.
24342434
The operand of a borrow is statically proven to outlive the resulting pointer.
@@ -3203,16 +3203,6 @@ All pointers in Rust are explicit first-class values.
32033203
They can be copied, stored into data structures, and returned from functions.
32043204
There are four varieties of pointer in Rust:
32053205

3206-
Managed pointers (`@`)
3207-
: These point to managed heap allocations (or "boxes") in the task-local, managed heap.
3208-
Managed pointers are written `@content`,
3209-
for example `@int` means a managed pointer to a managed box containing an integer.
3210-
Copying a managed pointer is a "shallow" operation:
3211-
it involves only copying the pointer itself
3212-
(as well as any reference-count or GC-barriers required by the managed heap).
3213-
Dropping a managed pointer does not necessarily release the box it points to;
3214-
the lifecycles of managed boxes are subject to an unspecified garbage collection algorithm.
3215-
32163206
Owning pointers (`~`)
32173207
: These point to owned heap allocations (or "boxes") in the shared, inter-task heap.
32183208
Each owned box has a single owning pointer; pointer and pointee retain a 1:1 relationship at all times.
@@ -3521,63 +3511,28 @@ state. Subsequent statements within a function may or may not initialize the
35213511
local variables. Local variables can be used only after they have been
35223512
initialized; this is enforced by the compiler.
35233513

3524-
### Memory boxes
3525-
3526-
A _box_ is a reference to a heap allocation holding another value. There
3527-
are two kinds of boxes: *managed boxes* and *owned boxes*.
3528-
3529-
A _managed box_ type or value is constructed by the prefix *at* sigil `@`.
3530-
3531-
An _owned box_ type or value is constructed by the prefix *tilde* sigil `~`.
3514+
### Owned boxes
35323515

3533-
Multiple managed box values can point to the same heap allocation; copying a
3534-
managed box value makes a shallow copy of the pointer (optionally incrementing
3535-
a reference count, if the managed box is implemented through
3536-
reference-counting).
3516+
An _owned box_ is a reference to a heap allocation holding another value, which is constructed
3517+
by the prefix *tilde* sigil `~`
35373518

3538-
Owned box values exist in 1:1 correspondence with their heap allocation.
3539-
3540-
An example of constructing one managed box type and value, and one owned box
3541-
type and value:
3519+
An example of an owned box type and value:
35423520

35433521
~~~~
3544-
let x: @int = @10;
35453522
let x: ~int = ~10;
35463523
~~~~
35473524

3548-
Some operations (such as field selection) implicitly dereference boxes. An
3549-
example of an _implicit dereference_ operation performed on box values:
3525+
Owned box values exist in 1:1 correspondence with their heap allocation
3526+
copying an owned box value makes a shallow copy of the pointer
3527+
Rust will consider a shallow copy of an owned box to move ownership of the value. After a value has been moved, the source location cannot be used unless it is reinitialized.
35503528

35513529
~~~~
3552-
struct Foo { y: int }
3553-
let x = @Foo{y: 10};
3554-
assert!(x.y == 10);
3555-
~~~~
3556-
3557-
Other operations act on box values as single-word-sized address values. For
3558-
these operations, to access the value held in the box requires an explicit
3559-
dereference of the box value. Explicitly dereferencing a box is indicated with
3560-
the unary *star* operator `*`. Examples of such _explicit dereference_
3561-
operations are:
3562-
3563-
* copying box values (`x = y`)
3564-
* passing box values to functions (`f(x,y)`)
3565-
3566-
An example of an explicit-dereference operation performed on box values:
3567-
3530+
let x: ~int = ~10;
3531+
let y = x;
3532+
// attempting to use `x` will result in an error here
35683533
~~~~
3569-
fn takes_boxed(b: @int) {
3570-
}
35713534

3572-
fn takes_unboxed(b: int) {
3573-
}
35743535

3575-
fn main() {
3576-
let x: @int = @10;
3577-
takes_boxed(x);
3578-
takes_unboxed(*x);
3579-
}
3580-
~~~~
35813536

35823537
## Tasks
35833538

branches/dist-snap/src/etc/licenseck.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"libstd/sync/mpsc_queue.rs", # BSD
4242
"libstd/sync/spsc_queue.rs", # BSD
4343
"libstd/sync/mpmc_bounded_queue.rs", # BSD
44+
"libextra/sync/mpsc_intrusive.rs", # BSD
4445
]
4546

4647
def check_license(name, contents):

branches/dist-snap/src/libextra/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ pub mod rational;
8383
#[path="num/complex.rs"]
8484
pub mod complex;
8585
pub mod stats;
86-
pub mod semver;
8786
pub mod hex;
8887
pub mod uuid;
8988

branches/dist-snap/src/libextra/sync.rs renamed to branches/dist-snap/src/libextra/sync/mod.rs

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,24 @@
1717
* in std.
1818
*/
1919

20-
20+
use std::cast;
2121
use std::comm;
22-
use std::unstable::sync::Exclusive;
22+
use std::kinds::marker;
2323
use std::sync::arc::UnsafeArc;
2424
use std::sync::atomics;
2525
use std::unstable::finally::Finally;
2626
use std::util;
27-
use std::util::NonCopyable;
2827

2928
use arc::MutexArc;
3029

3130
/****************************************************************************
3231
* Internals
3332
****************************************************************************/
3433

34+
pub mod mutex;
35+
pub mod one;
36+
mod mpsc_intrusive;
37+
3538
// Each waiting task receives on one of these.
3639
#[doc(hidden)]
3740
type WaitEnd = Port<()>;
@@ -54,7 +57,7 @@ impl WaitQueue {
5457
comm::Data(ch) => {
5558
// Send a wakeup signal. If the waiter was killed, its port will
5659
// have closed. Keep trying until we get a live task.
57-
if ch.try_send_deferred(()) {
60+
if ch.try_send(()) {
5861
true
5962
} else {
6063
self.signal()
@@ -69,7 +72,7 @@ impl WaitQueue {
6972
loop {
7073
match self.head.try_recv() {
7174
comm::Data(ch) => {
72-
if ch.try_send_deferred(()) {
75+
if ch.try_send(()) {
7376
count += 1;
7477
}
7578
}
@@ -81,36 +84,45 @@ impl WaitQueue {
8184

8285
fn wait_end(&self) -> WaitEnd {
8386
let (wait_end, signal_end) = Chan::new();
84-
assert!(self.tail.try_send_deferred(signal_end));
87+
assert!(self.tail.try_send(signal_end));
8588
wait_end
8689
}
8790
}
8891

8992
// The building-block used to make semaphores, mutexes, and rwlocks.
90-
#[doc(hidden)]
9193
struct SemInner<Q> {
94+
lock: mutex::Mutex,
9295
count: int,
9396
waiters: WaitQueue,
9497
// Can be either unit or another waitqueue. Some sems shouldn't come with
9598
// a condition variable attached, others should.
9699
blocked: Q
97100
}
98101

99-
#[doc(hidden)]
100-
struct Sem<Q>(Exclusive<SemInner<Q>>);
102+
struct Sem<Q>(UnsafeArc<SemInner<Q>>);
101103

102104
#[doc(hidden)]
103105
impl<Q:Send> Sem<Q> {
104106
fn new(count: int, q: Q) -> Sem<Q> {
105-
Sem(Exclusive::new(SemInner {
106-
count: count, waiters: WaitQueue::new(), blocked: q }))
107+
Sem(UnsafeArc::new(SemInner {
108+
count: count,
109+
waiters: WaitQueue::new(),
110+
blocked: q,
111+
lock: mutex::Mutex::new(),
112+
}))
113+
}
114+
115+
unsafe fn with(&self, f: |&mut SemInner<Q>|) {
116+
let Sem(ref arc) = *self;
117+
let state = arc.get();
118+
let _g = (*state).lock.lock();
119+
f(cast::transmute(state));
107120
}
108121

109122
pub fn acquire(&self) {
110123
unsafe {
111124
let mut waiter_nobe = None;
112-
let Sem(ref lock) = *self;
113-
lock.with(|state| {
125+
self.with(|state| {
114126
state.count -= 1;
115127
if state.count < 0 {
116128
// Create waiter nobe, enqueue ourself, and tell
@@ -129,8 +141,7 @@ impl<Q:Send> Sem<Q> {
129141

130142
pub fn release(&self) {
131143
unsafe {
132-
let Sem(ref lock) = *self;
133-
lock.with(|state| {
144+
self.with(|state| {
134145
state.count += 1;
135146
if state.count <= 0 {
136147
state.waiters.signal();
@@ -180,7 +191,7 @@ pub struct Condvar<'a> {
180191
// See the comment in write_cond for more detail.
181192
priv order: ReacquireOrderLock<'a>,
182193
// Make sure condvars are non-copyable.
183-
priv token: util::NonCopyable,
194+
priv nopod: marker::NoPod,
184195
}
185196

186197
impl<'a> Condvar<'a> {
@@ -210,8 +221,7 @@ impl<'a> Condvar<'a> {
210221
let mut out_of_bounds = None;
211222
// Release lock, 'atomically' enqueuing ourselves in so doing.
212223
unsafe {
213-
let Sem(ref queue) = *self.sem;
214-
queue.with(|state| {
224+
self.sem.with(|state| {
215225
if condvar_id < state.blocked.len() {
216226
// Drop the lock.
217227
state.count += 1;
@@ -253,8 +263,7 @@ impl<'a> Condvar<'a> {
253263
unsafe {
254264
let mut out_of_bounds = None;
255265
let mut result = false;
256-
let Sem(ref lock) = *self.sem;
257-
lock.with(|state| {
266+
self.sem.with(|state| {
258267
if condvar_id < state.blocked.len() {
259268
result = state.blocked[condvar_id].signal();
260269
} else {
@@ -276,8 +285,7 @@ impl<'a> Condvar<'a> {
276285
let mut out_of_bounds = None;
277286
let mut queue = None;
278287
unsafe {
279-
let Sem(ref lock) = *self.sem;
280-
lock.with(|state| {
288+
self.sem.with(|state| {
281289
if condvar_id < state.blocked.len() {
282290
// To avoid :broadcast_heavy, we make a new waitqueue,
283291
// swap it out with the old one, and broadcast on the
@@ -326,7 +334,7 @@ impl Sem<~[WaitQueue]> {
326334
blk(&Condvar {
327335
sem: self,
328336
order: Nothing,
329-
token: NonCopyable
337+
nopod: marker::NoPod
330338
})
331339
})
332340
}
@@ -566,7 +574,7 @@ impl RWLock {
566574
(&self.order_lock).release();
567575
let opt_lock = Just(&self.order_lock);
568576
blk(&Condvar { sem: cond.sem, order: opt_lock,
569-
token: NonCopyable })
577+
nopod: marker::NoPod })
570578
})
571579
}
572580

@@ -601,7 +609,7 @@ impl RWLock {
601609
(&self.access_lock).acquire();
602610
(&self.order_lock).release();
603611
(|| {
604-
blk(RWLockWriteMode { lock: self, token: NonCopyable })
612+
blk(RWLockWriteMode { lock: self, nopod: marker::NoPod })
605613
}).finally(|| {
606614
let writer_or_last_reader;
607615
// Check if we're releasing from read mode or from write mode.
@@ -654,16 +662,16 @@ impl RWLock {
654662
(&self.access_lock).release();
655663
}
656664
}
657-
RWLockReadMode { lock: token.lock, token: NonCopyable }
665+
RWLockReadMode { lock: token.lock, nopod: marker::NoPod }
658666
}
659667
}
660668

661669
/// The "write permission" token used for rwlock.write_downgrade().
662670
663-
pub struct RWLockWriteMode<'a> { priv lock: &'a RWLock, priv token: NonCopyable }
671+
pub struct RWLockWriteMode<'a> { priv lock: &'a RWLock, priv nopod: marker::NoPod }
664672
/// The "read permission" token used for rwlock.write_downgrade().
665673
pub struct RWLockReadMode<'a> { priv lock: &'a RWLock,
666-
priv token: NonCopyable }
674+
priv nopod: marker::NoPod }
667675

668676
impl<'a> RWLockWriteMode<'a> {
669677
/// Access the pre-downgrade rwlock in write mode.
@@ -674,7 +682,7 @@ impl<'a> RWLockWriteMode<'a> {
674682
// access lock. See comment in RWLock::write_cond for why.
675683
blk(&Condvar { sem: &self.lock.access_lock,
676684
order: Just(&self.lock.order_lock),
677-
token: NonCopyable })
685+
nopod: marker::NoPod })
678686
}
679687
}
680688

0 commit comments

Comments
 (0)