Skip to content

Commit b5cbd56

Browse files
committed
---
yaml --- r: 130063 b: refs/heads/snap-stage3 c: e59a458 h: refs/heads/master i: 130061: bb4b666 130059: cedb6c0 130055: 5fb31f3 130047: 7a2c647 v: v3
1 parent 1b9586e commit b5cbd56

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 0bdac78da87605f6f7f6e7924872617226b19c85
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 5520ea81a1ce986e0ca1a6305c82290571a0be4c
4+
refs/heads/snap-stage3: e59a4584c98e0eb21be5ba0a972a647025f14df5
55
refs/heads/try: 28d5878c1f0465c11c8e7a3085008b0c592d48d0
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,32 +3668,17 @@ let a: List<int> = Cons(7, box Cons(13, box Nil));
36683668

36693669
All pointers in Rust are explicit first-class values.
36703670
They can be copied, stored into data structures, and returned from functions.
3671-
There are four varieties of pointer in Rust:
3672-
3673-
* Owning pointers (`Box`)
3674-
: These point to owned heap allocations (or "boxes") in the shared, inter-task heap.
3675-
Each owned box has a single owning pointer; pointer and pointee retain a 1:1 relationship at all times.
3676-
Owning pointers are written `Box<content>`,
3677-
for example `Box<int>` means an owning pointer to an owned box containing an integer.
3678-
Copying an owned box is a "deep" operation:
3679-
it involves allocating a new owned box and copying the contents of the old box into the new box.
3680-
Releasing an owning pointer immediately releases its corresponding owned box.
3671+
There are two varieties of pointer in Rust:
36813672

36823673
* References (`&`)
36833674
: These point to memory _owned by some other value_.
3684-
References arise by (automatic) conversion from owning pointers, managed pointers,
3685-
or by applying the borrowing operator `&` to some other value,
3686-
including [lvalues, rvalues or temporaries](#lvalues,-rvalues-and-temporaries).
3687-
A borrow expression is written `&content`.
3688-
3689-
A reference type is written `&'f type` for some lifetime-variable `f`,
3690-
or just `&type` when the lifetime can be elided;
3691-
for example `&int` means a reference to an integer.
3675+
A reference type is written `&type` for some lifetime-variable `f`,
3676+
or just `&'a type` when you need an explicit lifetime.
36923677
Copying a reference is a "shallow" operation:
36933678
it involves only copying the pointer itself.
36943679
Releasing a reference typically has no effect on the value it points to,
3695-
with the exception of temporary values,
3696-
which are released when the last reference to them is released.
3680+
with the exception of temporary values, which are released when the last
3681+
reference to them is released.
36973682

36983683
* Raw pointers (`*`)
36993684
: Raw pointers are pointers without safety or liveness guarantees.
@@ -3706,6 +3691,9 @@ There are four varieties of pointer in Rust:
37063691
they exist to support interoperability with foreign code,
37073692
and writing performance-critical or low-level functions.
37083693

3694+
The standard library contains addtional 'smart pointer' types beyond references
3695+
and raw pointers.
3696+
37093697
### Function types
37103698

37113699
The function type constructor `fn` forms new function types.

branches/snap-stage3/src/libcore/slice.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,15 @@ impl<'a, T> Collection for &'a [T] {
996996
}
997997
}
998998

999+
#[experimental = "trait is experimental"]
1000+
impl<'a, T> Collection for &'a mut [T] {
1001+
/// Returns the length of a vector
1002+
#[inline]
1003+
fn len(&self) -> uint {
1004+
self.repr().len
1005+
}
1006+
}
1007+
9991008
#[unstable = "waiting for DST"]
10001009
impl<'a, T> Default for &'a [T] {
10011010
fn default() -> &'a [T] { &[] }

0 commit comments

Comments
 (0)