Skip to content

Commit 0d6b712

Browse files
committed
---
yaml --- r: 152201 b: refs/heads/try2 c: aec7f46 h: refs/heads/master i: 152199: 5ef3c12 v: v3
1 parent 65b468a commit 0d6b712

Some content is hidden

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

63 files changed

+1000
-949
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: 064dbb9200d25393abbc81c14621d41b6801ca13
8+
refs/heads/try2: aec7f469020c0fc1846a66fc607694644525a459
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/crates.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
TARGET_CRATES := libc std green rustuv native flate arena glob term semver \
5353
uuid serialize sync getopts collections num test time rand \
54-
url log regex graphviz core rlibc alloc debug
54+
workcache url log regex graphviz core rlibc alloc debug
5555
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros
5656
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5757
TOOLS := compiletest rustdoc rustc
@@ -88,6 +88,7 @@ DEPS_test := std collections getopts serialize term time regex
8888
DEPS_time := std serialize sync
8989
DEPS_rand := core
9090
DEPS_url := std collections
91+
DEPS_workcache := std serialize collections log
9192
DEPS_log := std sync
9293
DEPS_regex := std collections
9394
DEPS_regex_macros = syntax std regex

branches/try2/src/doc/complement-cheatsheet.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**Int to string**
66

7-
Use [`ToStr`](std/to_str/trait.ToStr.html).
7+
Use [`ToStr`](../std/to_str/trait.ToStr.html).
88

99
~~~
1010
let x: int = 42;
@@ -13,8 +13,8 @@ let y: String = x.to_str().to_string();
1313

1414
**String to int**
1515

16-
Use [`FromStr`](std/from_str/trait.FromStr.html), and its helper function,
17-
[`from_str`](std/from_str/fn.from_str.html).
16+
Use [`FromStr`](../std/from_str/trait.FromStr.html), and its helper function,
17+
[`from_str`](../std/from_str/fn.from_str.html).
1818

1919
~~~
2020
let x: Option<int> = from_str("42");
@@ -35,8 +35,8 @@ let y: String = format!("{:X}", x); // uppercase hexadecimal
3535

3636
**String to int, in non-base-10**
3737

38-
Use [`FromStrRadix`](std/num/trait.FromStrRadix.html), and its helper
39-
function, [`from_str_radix`](std/num/fn.from_str_radix.html).
38+
Use [`FromStrRadix`](../std/num/trait.FromStrRadix.html), and its helper
39+
function, [`from_str_radix`](../std/num/fn.from_str_radix.html).
4040

4141
~~~
4242
use std::num;
@@ -48,7 +48,7 @@ let y: i64 = x.unwrap();
4848
**Vector of Bytes to String**
4949

5050
To return a Borrowed String Slice (&str) use the str helper function
51-
[`from_utf8`](std/str/fn.from_utf8.html).
51+
[`from_utf8`](../std/str/fn.from_utf8.html).
5252

5353
~~~
5454
use std::str;
@@ -58,7 +58,7 @@ let x: &str = str::from_utf8(bytes).unwrap();
5858
~~~
5959

6060
To return an Owned String use the str helper function
61-
[`from_utf8_owned`](std/str/fn.from_utf8_owned.html).
61+
[`from_utf8_owned`](../std/str/fn.from_utf8_owned.html).
6262

6363
~~~
6464
use std::str;
@@ -68,8 +68,8 @@ let x: Option<String> =
6868
let y: String = x.unwrap();
6969
~~~
7070

71-
To return a [`MaybeOwned`](std/str/type.MaybeOwned.html) use the str helper
72-
function [`from_utf8_lossy`](std/str/fn.from_utf8_owned.html).
71+
To return a [`MaybeOwned`](../std/str/enum.MaybeOwned.html) use the str helper
72+
function [`from_utf8_lossy`](../std/str/fn.from_utf8_owned.html).
7373
This function also replaces non-valid utf-8 sequences with U+FFFD replacement
7474
character.
7575

@@ -80,16 +80,34 @@ let x = bytes!(72u8,"ello ",0xF0,0x90,0x80,"World!");
8080
let y = str::from_utf8_lossy(x);
8181
~~~
8282

83+
**`Vec<T>`/`String` to `&[T]`/`&str`**
84+
85+
The `.as_slice` method on each type provides a borrowed slice pointing
86+
to the contents of a `Vec` or `String`. The slice points directly to
87+
the data already stored in the vector or string, and so is a very
88+
cheap operation (no allocations or complicated computations required).
89+
90+
~~~
91+
let vec: Vec<u32> = vec![1, 2, 3];
92+
let slice: &[u32] = vec.as_slice();
93+
94+
let string: String = "foo bar".to_string();
95+
let str_slice: &str = string.as_slice();
96+
~~~
97+
98+
`Vec` also provides the `.as_mut_slice` method for viewing the
99+
contained data as a `&mut [T]`.
100+
83101
# File operations
84102

85103
## How do I read from a file?
86104

87105
Use
88-
[`File::open`](std/io/fs/struct.File.html#method.open)
106+
[`File::open`](../std/io/fs/struct.File.html#method.open)
89107
to create a
90-
[`File`](std/io/fs/struct.File.html)
108+
[`File`](../std/io/fs/struct.File.html)
91109
struct, which implements the
92-
[`Reader`](std/io/trait.Reader.html)
110+
[`Reader`](../std/io/trait.Reader.html)
93111
trait.
94112

95113
~~~ {.ignore}
@@ -103,8 +121,7 @@ let reader : File = File::open(&path).unwrap_or_else(on_error);
103121

104122
## How do I iterate over the lines in a file?
105123

106-
Use the [`lines`](std/io/trait.Buffer.html#method.lines) method on a
107-
[`BufferedReader`](std/io/struct.BufferedReader.html).
124+
Use the [`lines`](../std/io/trait.Buffer.html#method.lines) method on a [`BufferedReader`](../std/io/buffered/struct.BufferedReader.html).
108125

109126
~~~
110127
use std::io::BufferedReader;
@@ -122,7 +139,7 @@ for line in reader.lines() {
122139

123140
## How do I search for a substring?
124141

125-
Use the [`find_str`](std/str/trait.StrSlice.html#tymethod.find_str) method.
142+
Use the [`find_str`](../std/str/trait.StrSlice.html#tymethod.find_str) method.
126143

127144
~~~
128145
let str = "Hello, this is some random string";
@@ -133,7 +150,7 @@ let index: Option<uint> = str.find_str("rand");
133150

134151
## How do I get the length of a vector?
135152

136-
The [`Container`](std/container/trait.Container.html) trait provides the `len` method.
153+
The [`Container`](../std/container/trait.Container.html) trait provides the `len` method.
137154

138155
~~~
139156
let u: Vec<u32> = vec![0, 1, 2];
@@ -145,7 +162,7 @@ println!("u: {}, v: {}, w: {}", u.len(), v.len(), w.len()); // 3, 4, 5
145162

146163
## How do I iterate over a vector?
147164

148-
Use the [`iter`](std/slice/trait.ImmutableVector.html#tymethod.iter) method.
165+
Use the [`iter`](../std/vec/trait.ImmutableVector.html#tymethod.iter) method.
149166

150167
~~~
151168
let values: Vec<int> = vec![1, 2, 3, 4, 5];
@@ -154,9 +171,9 @@ for value in values.iter() { // value: &int
154171
}
155172
~~~
156173

157-
(See also [`mut_iter`](std/slice/trait.MutableVector.html#tymethod.mut_iter)
174+
(See also [`mut_iter`](../std/vec/trait.MutableVector.html#tymethod.mut_iter)
158175
which yields `&mut int` and
159-
[`move_iter`](std/slice/trait.OwnedVector.html#tymethod.move_iter) which yields
176+
[`move_iter`](../std/vec/trait.OwnedVector.html#tymethod.move_iter) which yields
160177
`int` while consuming the `values` vector.)
161178

162179
# Type system

branches/try2/src/doc/complement-lang-faq.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Some examples that demonstrate different aspects of the language:
2121
* The extra library's [json] module. Enums and pattern matching
2222

2323
[sprocketnes]: https://github.com/pcwalton/sprocketnes
24-
[hash]: https://github.com/mozilla/rust/blob/master/src/libstd/hash/mod.rs
24+
[hash]: https://github.com/mozilla/rust/blob/master/src/libstd/hash.rs
2525
[HashMap]: https://github.com/mozilla/rust/blob/master/src/libcollections/hashmap.rs
2626
[json]: https://github.com/mozilla/rust/blob/master/src/libserialize/json.rs
2727

@@ -149,6 +149,6 @@ example we were setting RUST_LOG to the name of the hello crate. Multiple paths
149149
can be combined to control the exact logging you want to see. For example, when
150150
debugging linking in the compiler you might set
151151
`RUST_LOG=rustc::metadata::creader,rustc::util::filesearch,rustc::back::rpath`
152-
For a full description see [the logging crate][1].
152+
For a full description see [the language reference][1].
153153

154-
[1]:log/index.html
154+
[1]:http://doc.rust-lang.org/doc/master/rust.html#logging-system

branches/try2/src/doc/guide-lifetimes.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Now we can call `compute_distance()`:
6767
# let on_the_stack : Point = Point{x: 3.0, y: 4.0};
6868
# let on_the_heap : Box<Point> = box Point{x: 7.0, y: 9.0};
6969
# fn compute_distance(p1: &Point, p2: &Point) -> f64 { 0.0 }
70-
compute_distance(&on_the_stack, on_the_heap);
70+
compute_distance(&on_the_stack, &*on_the_heap);
7171
~~~
7272

7373
Here, the `&` operator takes the address of the variable
@@ -77,10 +77,9 @@ value. We also call this _borrowing_ the local variable
7777
`on_the_stack`, because we have created an alias: that is, another
7878
name for the same data.
7979

80-
In the case of `on_the_heap`, however, no explicit action is necessary.
81-
The compiler will automatically convert a box box point to a reference like &point.
82-
This is another form of borrowing; in this case, the contents of the owned box
83-
are being lent out.
80+
For the second argument, we need to extract the contents of `on_the_heap`
81+
by derefercing with the `*` symbol. Now that we have the data, we need
82+
to create a reference with the `&` symbol.
8483

8584
Whenever a caller lends data to a callee, there are some limitations on what
8685
the caller can do with the original. For example, if the contents of a

branches/try2/src/doc/guide-unsafe.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,9 @@ shouldn't get triggered.
499499

500500
The second of these two functions, `eh_personality`, is used by the failure
501501
mechanisms of the compiler. This is often mapped to GCC's personality function
502-
(see the [libstd implementation](std/rt/unwind/index.html) for more
503-
information), but crates which do not trigger failure can be assured that this
504-
function is never called.
502+
(see the [libstd implementation](../std/rt/unwind/) for more information), but
503+
crates which do not trigger failure can be assured that this function is never
504+
called.
505505

506506
## Using libcore
507507

@@ -511,8 +511,7 @@ function is never called.
511511
With the above techniques, we've got a bare-metal executable running some Rust
512512
code. There is a good deal of functionality provided by the standard library,
513513
however, that is necessary to be productive in Rust. If the standard library is
514-
not sufficient, then [libcore](core/index.html) is designed to be used
515-
instead.
514+
not sufficient, then [libcore](../core/) is designed to be used instead.
516515

517516
The core library has very few dependencies and is much more portable than the
518517
standard library itself. Additionally, the core library has most of the

branches/try2/src/doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ contains a point, but allocated in a different location:
14291429
~~~
14301430
# struct Point { x: f64, y: f64 }
14311431
let on_the_stack : Point = Point { x: 3.0, y: 4.0 };
1432-
let on_the_heap : Box<Point> = box Point { x: 7.0, y: 9.0 };
1432+
let owned_box : Box<Point> = box Point { x: 7.0, y: 9.0 };
14331433
~~~
14341434

14351435
Suppose we want to write a procedure that computes the distance
@@ -1454,9 +1454,9 @@ Now we can call `compute_distance()` in various ways:
14541454
~~~
14551455
# struct Point{ x: f64, y: f64 };
14561456
# let on_the_stack : Point = Point { x: 3.0, y: 4.0 };
1457-
# let on_the_heap : Box<Point> = box Point { x: 7.0, y: 9.0 };
1457+
# let owned_box : Box<Point> = box Point { x: 7.0, y: 9.0 };
14581458
# fn compute_distance(p1: &Point, p2: &Point) -> f64 { 0.0 }
1459-
compute_distance(&on_the_stack, on_the_heap);
1459+
compute_distance(&on_the_stack, owned_box);
14601460
~~~
14611461

14621462
Here the `&` operator is used to take the address of the variable

branches/try2/src/liballoc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ pub mod arc;
9797
pub mod rc;
9898

9999
#[cfg(not(test))]
100-
#[doc(hidden)]
101100
mod std {
102101
pub use core::fmt;
103102
pub use core::option;

branches/try2/src/libcore/bool.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
//!
1313
//! A `to_bit` conversion function.
1414
15-
#![doc(primitive = "bool")]
16-
1715
use num::{Int, one, zero};
1816

1917
/////////////////////////////////////////////////////////////////////////////

branches/try2/src/libcore/char.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
//! and, as such, should be performed via the `from_u32` function..
2525
2626
#![allow(non_snake_case_functions)]
27-
#![doc(primitive = "char")]
2827

2928
use mem::transmute;
3029
use option::{None, Option, Some};

branches/try2/src/libcore/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,10 @@ pub mod fmt;
134134
// crate.
135135
mod should_not_exist;
136136

137-
#[doc(hidden)]
138137
mod core {
139138
pub use failure;
140139
}
141140

142-
#[doc(hidden)]
143141
mod std {
144142
pub use clone;
145143
pub use cmp;

branches/try2/src/libcore/num/f32.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
//! Operations and constants for 32-bits floats (`f32` type)
1212
13-
#![doc(primitive = "f32")]
14-
1513
use intrinsics;
1614
use mem;
1715
use num::{FPNormal, FPCategory, FPZero, FPSubnormal, FPInfinite, FPNaN};

branches/try2/src/libcore/num/f64.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
//! Operations and constants for 64-bits floats (`f64` type)
1212
13-
#![doc(primitive = "f64")]
14-
1513
use intrinsics;
1614
use mem;
1715
use num::{FPNormal, FPCategory, FPZero, FPSubnormal, FPInfinite, FPNaN};

branches/try2/src/libcore/num/i16.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@
1010

1111
//! Operations and constants for signed 16-bits integers (`i16` type)
1212
13-
#![doc(primitive = "i16")]
14-
1513
int_module!(i16, 16)
1614

branches/try2/src/libcore/num/i32.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@
1010

1111
//! Operations and constants for signed 32-bits integers (`i32` type)
1212
13-
#![doc(primitive = "i32")]
14-
1513
int_module!(i32, 32)
1614

branches/try2/src/libcore/num/i64.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@
1010

1111
//! Operations and constants for signed 64-bits integers (`i64` type)
1212
13-
#![doc(primitive = "i64")]
14-
1513
int_module!(i64, 64)
1614

branches/try2/src/libcore/num/i8.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@
1010

1111
//! Operations and constants for signed 8-bits integers (`i8` type)
1212
13-
#![doc(primitive = "i8")]
14-
1513
int_module!(i8, 8)
1614

branches/try2/src/libcore/num/int.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
//! Operations and constants for architecture-sized signed integers (`int` type)
1212
13-
#![doc(primitive = "int")]
14-
1513
#[cfg(target_word_size = "32")] int_module!(int, 32)
1614
#[cfg(target_word_size = "64")] int_module!(int, 64)
1715

branches/try2/src/libcore/num/u16.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@
1010

1111
//! Operations and constants for unsigned 16-bits integers (`u16` type)
1212
13-
#![doc(primitive = "u16")]
14-
1513
uint_module!(u16, i16, 16)

branches/try2/src/libcore/num/u32.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@
1010

1111
//! Operations and constants for unsigned 32-bits integers (`u32` type)
1212
13-
#![doc(primitive = "u32")]
14-
1513
uint_module!(u32, i32, 32)
1614

branches/try2/src/libcore/num/u64.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@
1010

1111
//! Operations and constants for unsigned 64-bits integer (`u64` type)
1212
13-
#![doc(primitive = "u64")]
14-
1513
uint_module!(u64, i64, 64)
1614

branches/try2/src/libcore/num/u8.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@
1010

1111
//! Operations and constants for unsigned 8-bits integers (`u8` type)
1212
13-
#![doc(primitive = "u8")]
14-
1513
uint_module!(u8, i8, 8)
1614

branches/try2/src/libcore/num/uint.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@
1010

1111
//! Operations and constants for architecture-sized unsigned integers (`uint` type)
1212
13-
#![doc(primitive = "uint")]
14-
1513
uint_module!(uint, int, ::int::BITS)
1614

0 commit comments

Comments
 (0)