Skip to content

Commit 16d7125

Browse files
committed
---
yaml --- r: 107983 b: refs/heads/dist-snap c: 8d8c783 h: refs/heads/master i: 107981: 58b5f92 107979: 9ec3abf 107975: 88986bc 107967: 07755de v: v3
1 parent 43afd4a commit 16d7125

Some content is hidden

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

45 files changed

+618
-421
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: 4509b49451cbd2e078fa81c6adb218ff33d6d779
9+
refs/heads/dist-snap: 8d8c7835f76ff835f1bb71481bf564c2785a32e8
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 uuid
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
@@ -67,7 +67,6 @@ DEPS_arena := std extra
6767
DEPS_glob := std
6868
DEPS_term := std
6969
DEPS_semver := std
70-
DEPS_uuid := std extra
7170

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

branches/dist-snap/mk/tests.mk

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ check-test: cleantestlibs cleantmptestlogs all check-stage2-rfail
183183
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
184184

185185
check-lite: cleantestlibs cleantmptestlogs \
186-
$(foreach crate,$(TARGET_CRATES),check-stage2-$(crate)) \
187-
check-stage2-rpass \
186+
check-stage2-std check-stage2-extra check-stage2-rpass \
187+
check-stage2-rustuv check-stage2-native check-stage2-green \
188188
check-stage2-rfail check-stage2-cfail check-stage2-rmake
189189
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
190190

@@ -861,8 +861,7 @@ $(foreach host,$(CFG_HOST), \
861861
$(eval $(foreach target,$(CFG_TARGET), \
862862
$(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))
863863

864-
check-fast: tidy check-fast-H-$(CFG_BUILD) \
865-
$(foreach crate,$(TARGET_CRATES),check-stage2-$(crate))
864+
check-fast: tidy check-fast-H-$(CFG_BUILD) check-stage2-std check-stage2-extra
866865
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
867866

868867
define DEF_CHECK_FAST_FOR_H

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ li {list-style-type: none; }
4242
* [The `glob` file path matching library](glob/index.html)
4343
* [The `semver` version collation library](semver/index.html)
4444
* [The `term` terminal-handling library](term/index.html)
45-
* [The UUID library](uuid/index.html)
4645

4746
# Tooling
4847

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/libextra/arc.rs

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -554,50 +554,6 @@ impl<'a, T:Freeze + Send> RWReadMode<'a, T> {
554554
}
555555
}
556556

557-
/****************************************************************************
558-
* Copy-on-write Arc
559-
****************************************************************************/
560-
561-
pub struct CowArc<T> { priv x: UnsafeArc<T> }
562-
563-
/// A Copy-on-write Arc functions the same way as an `arc` except it allows
564-
/// mutation of the contents if there is only a single reference to
565-
/// the data. If there are multiple references the data is automatically
566-
/// cloned and the task modifies the cloned data in place of the shared data.
567-
impl<T:Clone+Send+Freeze> CowArc<T> {
568-
/// Create a copy-on-write atomically reference counted wrapper
569-
#[inline]
570-
pub fn new(data: T) -> CowArc<T> {
571-
CowArc { x: UnsafeArc::new(data) }
572-
}
573-
574-
#[inline]
575-
pub fn get<'a>(&'a self) -> &'a T {
576-
unsafe { &*self.x.get_immut() }
577-
}
578-
579-
/// get a mutable reference to the contents. If there are more then one
580-
/// reference to the contents of the `CowArc` will be cloned
581-
/// and this reference updated to point to the cloned data.
582-
#[inline]
583-
pub fn get_mut<'a>(&'a mut self) -> &'a mut T {
584-
if !self.x.is_owned() {
585-
*self = CowArc::new(self.get().clone())
586-
}
587-
unsafe { &mut *self.x.get() }
588-
}
589-
}
590-
591-
impl<T:Clone+Send+Freeze> Clone for CowArc<T> {
592-
/// Duplicate a Copy-on-write Arc. See arc::clone for more details.
593-
#[inline]
594-
fn clone(&self) -> CowArc<T> {
595-
CowArc { x: self.x.clone() }
596-
}
597-
}
598-
599-
600-
601557
/****************************************************************************
602558
* Tests
603559
****************************************************************************/
@@ -1007,68 +963,4 @@ mod tests {
1007963
// and I wasn't sure why :( . This is a mediocre "next best" option.
1008964
for _ in range(0, 8) { test_rw_write_cond_downgrade_read_race_helper(); }
1009965
}
1010-
1011-
#[test]
1012-
fn test_cowarc_clone()
1013-
{
1014-
let cow0 = CowArc::new(75u);
1015-
let cow1 = cow0.clone();
1016-
let cow2 = cow1.clone();
1017-
1018-
assert!(75 == *cow0.get());
1019-
assert!(75 == *cow1.get());
1020-
assert!(75 == *cow2.get());
1021-
1022-
assert!(cow0.get() == cow1.get());
1023-
assert!(cow0.get() == cow2.get());
1024-
}
1025-
1026-
#[test]
1027-
fn test_cowarc_clone_get_mut()
1028-
{
1029-
let mut cow0 = CowArc::new(75u);
1030-
let mut cow1 = cow0.clone();
1031-
let mut cow2 = cow1.clone();
1032-
1033-
assert!(75 == *cow0.get_mut());
1034-
assert!(75 == *cow1.get_mut());
1035-
assert!(75 == *cow2.get_mut());
1036-
1037-
*cow0.get_mut() += 1;
1038-
*cow1.get_mut() += 2;
1039-
*cow2.get_mut() += 3;
1040-
1041-
assert!(76 == *cow0.get());
1042-
assert!(77 == *cow1.get());
1043-
assert!(78 == *cow2.get());
1044-
1045-
// none should point to the same backing memory
1046-
assert!(cow0.get() != cow1.get());
1047-
assert!(cow0.get() != cow2.get());
1048-
assert!(cow1.get() != cow2.get());
1049-
}
1050-
1051-
#[test]
1052-
fn test_cowarc_clone_get_mut2()
1053-
{
1054-
let mut cow0 = CowArc::new(75u);
1055-
let cow1 = cow0.clone();
1056-
let cow2 = cow1.clone();
1057-
1058-
assert!(75 == *cow0.get());
1059-
assert!(75 == *cow1.get());
1060-
assert!(75 == *cow2.get());
1061-
1062-
*cow0.get_mut() += 1;
1063-
1064-
assert!(76 == *cow0.get());
1065-
assert!(75 == *cow1.get());
1066-
assert!(75 == *cow2.get());
1067-
1068-
// cow1 and cow2 should share the same contents
1069-
// cow0 should have a unique reference
1070-
assert!(cow0.get() != cow1.get());
1071-
assert!(cow0.get() != cow2.get());
1072-
assert!(cow1.get() == cow2.get());
1073-
}
1074966
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ Rust extras are part of the standard Rust distribution.
3434
#[deny(non_camel_case_types)];
3535
#[deny(missing_doc)];
3636

37+
#[cfg(stage0)]
38+
macro_rules! if_ok (
39+
($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) })
40+
)
41+
3742
// Utility modules
3843

3944
pub mod c_vec;
@@ -79,6 +84,8 @@ pub mod rational;
7984
pub mod complex;
8085
pub mod stats;
8186
pub mod hex;
87+
pub mod uuid;
88+
8289

8390
#[cfg(unicode)]
8491
mod unicode;

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,10 @@ impl<T:Ord> PriorityQueue<T> {
5151
/// Returns the number of elements the queue can hold without reallocating
5252
pub fn capacity(&self) -> uint { self.data.capacity() }
5353

54-
/// Reserve capacity for exactly n elements in the PriorityQueue.
55-
/// Do nothing if the capacity is already sufficient.
56-
pub fn reserve_exact(&mut self, n: uint) { self.data.reserve_exact(n) }
57-
58-
/// Reserve capacity for at least n elements in the PriorityQueue.
59-
/// Do nothing if the capacity is already sufficient.
60-
pub fn reserve(&mut self, n: uint) {
61-
self.data.reserve(n)
54+
pub fn reserve(&mut self, n: uint) { self.data.reserve(n) }
55+
56+
pub fn reserve_at_least(&mut self, n: uint) {
57+
self.data.reserve_at_least(n)
6258
}
6359

6460
/// Pop the greatest item from the queue - fails if empty
@@ -207,7 +203,7 @@ impl<T: Ord> Extendable<T> for PriorityQueue<T> {
207203
let (lower, _) = iter.size_hint();
208204

209205
let len = self.capacity();
210-
self.reserve(len + lower);
206+
self.reserve_at_least(len + lower);
211207

212208
for elem in *iter {
213209
self.push(elem);

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ impl<T> RingBuf<T> {
168168
/// # Arguments
169169
///
170170
/// * n - The number of elements to reserve space for
171-
pub fn reserve_exact(&mut self, n: uint) {
172-
self.elts.reserve_exact(n);
171+
pub fn reserve(&mut self, n: uint) {
172+
self.elts.reserve(n);
173173
}
174174

175175
/// Reserve capacity for at least `n` elements in the given RingBuf,
@@ -182,8 +182,8 @@ impl<T> RingBuf<T> {
182182
/// # Arguments
183183
///
184184
/// * n - The number of elements to reserve space for
185-
pub fn reserve(&mut self, n: uint) {
186-
self.elts.reserve(n);
185+
pub fn reserve_at_least(&mut self, n: uint) {
186+
self.elts.reserve_at_least(n);
187187
}
188188

189189
/// Front-to-back iterator.
@@ -641,26 +641,26 @@ mod tests {
641641
}
642642

643643
#[test]
644-
fn test_reserve_exact() {
644+
fn test_reserve() {
645645
let mut d = RingBuf::new();
646646
d.push_back(0u64);
647-
d.reserve_exact(50);
647+
d.reserve(50);
648648
assert_eq!(d.elts.capacity(), 50);
649649
let mut d = RingBuf::new();
650650
d.push_back(0u32);
651-
d.reserve_exact(50);
651+
d.reserve(50);
652652
assert_eq!(d.elts.capacity(), 50);
653653
}
654654

655655
#[test]
656-
fn test_reserve() {
656+
fn test_reserve_at_least() {
657657
let mut d = RingBuf::new();
658658
d.push_back(0u64);
659-
d.reserve(50);
659+
d.reserve_at_least(50);
660660
assert_eq!(d.elts.capacity(), 64);
661661
let mut d = RingBuf::new();
662662
d.push_back(0u32);
663-
d.reserve(50);
663+
d.reserve_at_least(50);
664664
assert_eq!(d.elts.capacity(), 64);
665665
}
666666

0 commit comments

Comments
 (0)