Skip to content

Commit 7843b8a

Browse files
committed
---
yaml --- r: 107962 b: refs/heads/dist-snap c: 882b482 h: refs/heads/master v: v3
1 parent e38e5ad commit 7843b8a

Some content is hidden

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

42 files changed

+643
-1662
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: c1395ea58866ede7f52864ab36b8052f88d20bc4
9+
refs/heads/dist-snap: 882b4829ce340e6b1a54bdbc3322484ff8c9ffcd
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: 1 addition & 2 deletions
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 semver
52+
TARGET_CRATES := std extra green rustuv native flate arena glob term
5353
HOST_CRATES := syntax rustc rustdoc
5454
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5555
TOOLS := compiletest rustdoc rustc
@@ -66,7 +66,6 @@ DEPS_flate := std native:miniz
6666
DEPS_arena := std extra
6767
DEPS_glob := std
6868
DEPS_term := std
69-
DEPS_semver := std
7069

7170
TOOL_DEPS_compiletest := extra green rustuv
7271
TOOL_DEPS_rustdoc := rustdoc green rustuv

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ 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)
4443
* [The `term` terminal-handling library](term/index.html)
4544

4645
# Tooling

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

Lines changed: 57 additions & 12 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-
`~`
2429+
`@` and `~`
24302430
: [Boxing](#pointer-types) operators. Allocate a box to hold the value they are applied to,
2431-
and store the value in it. `~` creates an owned box.
2431+
and store the value in it. `@` creates a managed box, whereas `~` 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,6 +3203,16 @@ 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+
32063216
Owning pointers (`~`)
32073217
: These point to owned heap allocations (or "boxes") in the shared, inter-task heap.
32083218
Each owned box has a single owning pointer; pointer and pointee retain a 1:1 relationship at all times.
@@ -3511,28 +3521,63 @@ state. Subsequent statements within a function may or may not initialize the
35113521
local variables. Local variables can be used only after they have been
35123522
initialized; this is enforced by the compiler.
35133523

3514-
### Owned boxes
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 `~`.
35153532

3516-
An _owned box_ is a reference to a heap allocation holding another value, which is constructed
3517-
by the prefix *tilde* sigil `~`
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).
35183537

3519-
An example of an owned box type and value:
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:
35203542

35213543
~~~~
3544+
let x: @int = @10;
35223545
let x: ~int = ~10;
35233546
~~~~
35243547

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.
3548+
Some operations (such as field selection) implicitly dereference boxes. An
3549+
example of an _implicit dereference_ operation performed on box values:
35283550

35293551
~~~~
3530-
let x: ~int = ~10;
3531-
let y = x;
3532-
// attempting to use `x` will result in an error here
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+
35333568
~~~~
3569+
fn takes_boxed(b: @int) {
3570+
}
35343571
3572+
fn takes_unboxed(b: int) {
3573+
}
35353574
3575+
fn main() {
3576+
let x: @int = @10;
3577+
takes_boxed(x);
3578+
takes_unboxed(*x);
3579+
}
3580+
~~~~
35363581

35373582
## Tasks
35383583

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
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
4544
]
4645

4746
def check_license(name, contents):

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

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

branches/dist-snap/src/libsemver/lib.rs renamed to branches/dist-snap/src/libextra/semver.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828
//! An example version number with all five components is
2929
//! `0.8.1-rc.3.0+20130922.linux`.
3030
31-
#[crate_id = "semver#0.10-pre"];
32-
#[crate_type = "rlib"];
33-
#[crate_type = "dylib"];
34-
#[license = "MIT/ASL2"];
35-
3631
use std::char;
3732
use std::cmp;
3833
use std::option::{Option, Some, None};

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

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

20-
use std::cast;
20+
2121
use std::comm;
22-
use std::kinds::marker;
22+
use std::unstable::sync::Exclusive;
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;
2728

2829
use arc::MutexArc;
2930

3031
/****************************************************************************
3132
* Internals
3233
****************************************************************************/
3334

34-
pub mod mutex;
35-
pub mod one;
36-
mod mpsc_intrusive;
37-
3835
// Each waiting task receives on one of these.
3936
#[doc(hidden)]
4037
type WaitEnd = Port<()>;
@@ -57,7 +54,7 @@ impl WaitQueue {
5754
comm::Data(ch) => {
5855
// Send a wakeup signal. If the waiter was killed, its port will
5956
// have closed. Keep trying until we get a live task.
60-
if ch.try_send(()) {
57+
if ch.try_send_deferred(()) {
6158
true
6259
} else {
6360
self.signal()
@@ -72,7 +69,7 @@ impl WaitQueue {
7269
loop {
7370
match self.head.try_recv() {
7471
comm::Data(ch) => {
75-
if ch.try_send(()) {
72+
if ch.try_send_deferred(()) {
7673
count += 1;
7774
}
7875
}
@@ -84,45 +81,36 @@ impl WaitQueue {
8481

8582
fn wait_end(&self) -> WaitEnd {
8683
let (wait_end, signal_end) = Chan::new();
87-
assert!(self.tail.try_send(signal_end));
84+
assert!(self.tail.try_send_deferred(signal_end));
8885
wait_end
8986
}
9087
}
9188

9289
// The building-block used to make semaphores, mutexes, and rwlocks.
90+
#[doc(hidden)]
9391
struct SemInner<Q> {
94-
lock: mutex::Mutex,
9592
count: int,
9693
waiters: WaitQueue,
9794
// Can be either unit or another waitqueue. Some sems shouldn't come with
9895
// a condition variable attached, others should.
9996
blocked: Q
10097
}
10198

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

104102
#[doc(hidden)]
105103
impl<Q:Send> Sem<Q> {
106104
fn new(count: int, q: Q) -> Sem<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));
105+
Sem(Exclusive::new(SemInner {
106+
count: count, waiters: WaitQueue::new(), blocked: q }))
120107
}
121108

122109
pub fn acquire(&self) {
123110
unsafe {
124111
let mut waiter_nobe = None;
125-
self.with(|state| {
112+
let Sem(ref lock) = *self;
113+
lock.with(|state| {
126114
state.count -= 1;
127115
if state.count < 0 {
128116
// Create waiter nobe, enqueue ourself, and tell
@@ -141,7 +129,8 @@ impl<Q:Send> Sem<Q> {
141129

142130
pub fn release(&self) {
143131
unsafe {
144-
self.with(|state| {
132+
let Sem(ref lock) = *self;
133+
lock.with(|state| {
145134
state.count += 1;
146135
if state.count <= 0 {
147136
state.waiters.signal();
@@ -191,7 +180,7 @@ pub struct Condvar<'a> {
191180
// See the comment in write_cond for more detail.
192181
priv order: ReacquireOrderLock<'a>,
193182
// Make sure condvars are non-copyable.
194-
priv nopod: marker::NoPod,
183+
priv token: util::NonCopyable,
195184
}
196185

197186
impl<'a> Condvar<'a> {
@@ -221,7 +210,8 @@ impl<'a> Condvar<'a> {
221210
let mut out_of_bounds = None;
222211
// Release lock, 'atomically' enqueuing ourselves in so doing.
223212
unsafe {
224-
self.sem.with(|state| {
213+
let Sem(ref queue) = *self.sem;
214+
queue.with(|state| {
225215
if condvar_id < state.blocked.len() {
226216
// Drop the lock.
227217
state.count += 1;
@@ -263,7 +253,8 @@ impl<'a> Condvar<'a> {
263253
unsafe {
264254
let mut out_of_bounds = None;
265255
let mut result = false;
266-
self.sem.with(|state| {
256+
let Sem(ref lock) = *self.sem;
257+
lock.with(|state| {
267258
if condvar_id < state.blocked.len() {
268259
result = state.blocked[condvar_id].signal();
269260
} else {
@@ -285,7 +276,8 @@ impl<'a> Condvar<'a> {
285276
let mut out_of_bounds = None;
286277
let mut queue = None;
287278
unsafe {
288-
self.sem.with(|state| {
279+
let Sem(ref lock) = *self.sem;
280+
lock.with(|state| {
289281
if condvar_id < state.blocked.len() {
290282
// To avoid :broadcast_heavy, we make a new waitqueue,
291283
// swap it out with the old one, and broadcast on the
@@ -334,7 +326,7 @@ impl Sem<~[WaitQueue]> {
334326
blk(&Condvar {
335327
sem: self,
336328
order: Nothing,
337-
nopod: marker::NoPod
329+
token: NonCopyable
338330
})
339331
})
340332
}
@@ -574,7 +566,7 @@ impl RWLock {
574566
(&self.order_lock).release();
575567
let opt_lock = Just(&self.order_lock);
576568
blk(&Condvar { sem: cond.sem, order: opt_lock,
577-
nopod: marker::NoPod })
569+
token: NonCopyable })
578570
})
579571
}
580572

@@ -609,7 +601,7 @@ impl RWLock {
609601
(&self.access_lock).acquire();
610602
(&self.order_lock).release();
611603
(|| {
612-
blk(RWLockWriteMode { lock: self, nopod: marker::NoPod })
604+
blk(RWLockWriteMode { lock: self, token: NonCopyable })
613605
}).finally(|| {
614606
let writer_or_last_reader;
615607
// Check if we're releasing from read mode or from write mode.
@@ -662,16 +654,16 @@ impl RWLock {
662654
(&self.access_lock).release();
663655
}
664656
}
665-
RWLockReadMode { lock: token.lock, nopod: marker::NoPod }
657+
RWLockReadMode { lock: token.lock, token: NonCopyable }
666658
}
667659
}
668660

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

676668
impl<'a> RWLockWriteMode<'a> {
677669
/// Access the pre-downgrade rwlock in write mode.
@@ -682,7 +674,7 @@ impl<'a> RWLockWriteMode<'a> {
682674
// access lock. See comment in RWLock::write_cond for why.
683675
blk(&Condvar { sem: &self.lock.access_lock,
684676
order: Just(&self.lock.order_lock),
685-
nopod: marker::NoPod })
677+
token: NonCopyable })
686678
}
687679
}
688680

0 commit comments

Comments
 (0)