Skip to content

Commit 385670b

Browse files
committed
---
yaml --- r: 206325 b: refs/heads/beta c: ede7a6d h: refs/heads/master i: 206323: c67a6e8 v: v3
1 parent 85b7636 commit 385670b

Some content is hidden

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

91 files changed

+768
-1004
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: 82158c9d1cc97d03b7e3a48fda0ff8c1e9209041
32+
refs/heads/beta: ede7a6dc8ff5455f9d0d39a90e6d11e9a374e93b
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 579e31929feff51dcaf8d444648eff8de735f91a

branches/beta/src/doc/reference.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,8 @@ warnings are generated, or otherwise "you used a private item of another module
15571557
and weren't allowed to."
15581558

15591559
By default, everything in Rust is *private*, with one exception. Enum variants
1560-
in a `pub` enum are also public by default. When an item is declared as `pub`,
1560+
in a `pub` enum are also public by default. You are allowed to alter this
1561+
default visibility with the `priv` keyword. When an item is declared as `pub`,
15611562
it can be thought of as being accessible to the outside world. For example:
15621563

15631564
```
@@ -2425,18 +2426,11 @@ Tuples are written by enclosing zero or more comma-separated expressions in
24252426
parentheses. They are used to create [tuple-typed](#tuple-types) values.
24262427

24272428
```{.tuple}
2429+
(0,);
24282430
(0.0, 4.5);
24292431
("a", 4usize, true);
24302432
```
24312433

2432-
You can disambiguate a single-element tuple from a value in parentheses with a
2433-
comma:
2434-
2435-
```
2436-
(0,); // single-element tuple
2437-
(0); // zero in parentheses
2438-
```
2439-
24402434
### Unit expressions
24412435

24422436
The expression `()` denotes the _unit value_, the only value of the type with

branches/beta/src/doc/trpl/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,5 @@ fn main() {
190190
We created an inner scope with an additional set of curly braces. `y` will go out of
191191
scope before we call `push()`, and so we’re all good.
192192

193-
This concept of ownership isn’t just good for preventing dangling pointers, but an
193+
This concept of ownership isn’t just good for preventing danging pointers, but an
194194
entire set of related problems, like iterator invalidation, concurrency, and more.

branches/beta/src/doc/trpl/attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ Rust attributes are used for a number of different things. There is a full list
6767
of attributes [in the reference][reference]. Currently, you are not allowed to
6868
create your own attributes, the Rust compiler defines them.
6969

70-
[reference]: ../reference.html#attributes
70+
[reference]: reference.html#attributes

branches/beta/src/doc/trpl/const-and-static.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ this reason.
1919
# `static`
2020

2121
Rust provides a ‘global variable’ sort of facility in static items. They’re
22-
similar to constants, but static items aren’t inlined upon use. This means that
23-
there is only one instance for each value, and it’s at a fixed location in
24-
memory.
22+
similar to [constants][const], but static items aren’t inlined upon use. This
23+
means that there is only one instance for each value, and it’s at a fixed
24+
location in memory.
2525

2626
Here’s an example:
2727

2828
```rust
2929
static N: i32 = 5;
3030
```
3131

32+
[const]: const.html
33+
3234
Unlike [`let`][let] bindings, you must annotate the type of a `static`.
3335

3436
[let]: variable-bindings.html

branches/beta/src/doc/trpl/iterators.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,26 @@ Ranges are one of two basic iterators that you'll see. The other is `iter()`.
235235
in turn:
236236

237237
```rust
238-
let nums = vec![1, 2, 3];
238+
let nums = [1, 2, 3];
239239

240240
for num in nums.iter() {
241241
println!("{}", num);
242242
}
243243
```
244244

245245
These two basic iterators should serve you well. There are some more
246-
advanced iterators, including ones that are infinite.
246+
advanced iterators, including ones that are infinite. Like using range syntax
247+
and `step_by`:
248+
249+
```rust
250+
# #![feature(step_by)]
251+
(1..).step_by(5);
252+
```
253+
254+
This iterator counts up from one, adding five each time. It will give
255+
you a new integer every time, forever (well, technically, until it reaches the
256+
maximum number representable by an `i32`). But since iterators are lazy,
257+
that's okay! You probably don't want to use `collect()` on it, though...
247258

248259
That's enough about iterators. Iterator adapters are the last concept
249260
we need to talk about with regards to iterators. Let's get to it!

branches/beta/src/doc/trpl/nightly-rust.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ If not, there are a number of places where you can get help. The easiest is
9393
[the #rust IRC channel on irc.mozilla.org][irc], which you can access through
9494
[Mibbit][mibbit]. Click that link, and you'll be chatting with other Rustaceans
9595
(a silly nickname we call ourselves), and we can help you out. Other great
96-
resources include [the user’s forum][users], and [Stack Overflow][stack overflow].
96+
resources include [the user’s forum][users], and [Stack Overflow][stack
97+
overflow].
9798

9899
[irc]: irc://irc.mozilla.org/#rust
99100
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust

branches/beta/src/doc/trpl/primitive-types.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,6 @@ or “breaks up” the tuple, and assigns the bits to three bindings.
248248

249249
This pattern is very powerful, and we’ll see it repeated more later.
250250

251-
You can disambiguate a single-element tuple from a value in parentheses with a
252-
comma:
253-
254-
```
255-
(0,); // single-element tuple
256-
(0); // zero in parentheses
257-
```
258-
259251
## Tuple Indexing
260252

261253
You can also access fields of a tuple with indexing syntax:

branches/beta/src/doc/trpl/raw-pointers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Raw pointers are useful for FFI: Rust’s `*const T` and `*mut T` are similar to
8080
C’s `const T*` and `T*`, respectfully. For more about this use, consult the
8181
[FFI chapter][ffi].
8282

83-
[ffi]: ffi.html
83+
[ffi]: ffi.md
8484

8585
# References and raw pointers
8686

branches/beta/src/doc/trpl/unsafe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Rust has a feature called ‘`static mut`’ which allows for mutable global sta
101101
Doing so can cause a data race, and as such is inherently not safe. For more
102102
details, see the [static][static] section of the book.
103103

104-
[static]: const-and-static.html#static
104+
[static]: static.html
105105

106106
## Dereference a raw pointer
107107

branches/beta/src/doc/trpl/unsized-types.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ impl Foo for &str {
3838
```
3939

4040
Meaning, this implementation would only work for [references][ref], and not
41-
other types of pointers. With the `impl for str`, all pointers, including (at
42-
some point, there are some bugs to fix first) user-defined custom smart
43-
pointers, can use this `impl`.
44-
45-
[ref]: references-and-borrowing.html
41+
other types of pointers. With this `impl`, all pointers, including (at some
42+
point, there are some bugs to fix first) user-defined custom smart pointers,
43+
can use this `impl`.
4644

4745
# ?Sized
4846

branches/beta/src/liballoc/boxed.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ impl<T: ?Sized + Hash> Hash for Box<T> {
240240
impl Box<Any> {
241241
#[inline]
242242
#[stable(feature = "rust1", since = "1.0.0")]
243-
/// Attempt to downcast the box to a concrete type.
244243
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
245244
if self.is::<T>() {
246245
unsafe {
@@ -258,15 +257,11 @@ impl Box<Any> {
258257
}
259258
}
260259

261-
impl Box<Any + Send> {
260+
impl Box<Any+Send> {
262261
#[inline]
263262
#[stable(feature = "rust1", since = "1.0.0")]
264-
/// Attempt to downcast the box to a concrete type.
265-
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any + Send>> {
266-
<Box<Any>>::downcast(self).map_err(|s| unsafe {
267-
// reapply the Send marker
268-
mem::transmute::<Box<Any>, Box<Any + Send>>(s)
269-
})
263+
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
264+
<Box<Any>>::downcast(self)
270265
}
271266
}
272267

branches/beta/src/libcollections/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@
398398
//! longer than this width, then it is truncated down to this many characters and only those are
399399
//! emitted.
400400
//!
401-
//! For integral types, this is ignored.
401+
//! For integral types, this has no meaning currently.
402402
//!
403403
//! For floating-point types, this indicates how many digits after the decimal point should be
404404
//! printed.

branches/beta/src/libcollections/string.rs

Lines changed: 10 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ use rustc_unicode::str as unicode_str;
2626
use rustc_unicode::str::Utf16Item;
2727

2828
use borrow::{Cow, IntoCow};
29-
use range::RangeArgument;
30-
use str::{self, FromStr, Utf8Error, Chars};
29+
use str::{self, FromStr, Utf8Error};
3130
use vec::{DerefVec, Vec, as_vec};
3231

3332
/// A growable string stored as a UTF-8 encoded buffer.
@@ -696,59 +695,6 @@ impl String {
696695
pub fn clear(&mut self) {
697696
self.vec.clear()
698697
}
699-
700-
/// Create a draining iterator that removes the specified range in the string
701-
/// and yields the removed chars from start to end. The element range is
702-
/// removed even if the iterator is not consumed until the end.
703-
///
704-
/// # Panics
705-
///
706-
/// Panics if the starting point or end point are not on character boundaries,
707-
/// or if they are out of bounds.
708-
///
709-
/// # Examples
710-
///
711-
/// ```
712-
/// # #![feature(collections_drain)]
713-
///
714-
/// let mut s = String::from("α is alpha, β is beta");
715-
/// let beta_offset = s.find('β').unwrap_or(s.len());
716-
///
717-
/// // Remove the range up until the β from the string
718-
/// let t: String = s.drain(..beta_offset).collect();
719-
/// assert_eq!(t, "α is alpha, ");
720-
/// assert_eq!(s, "β is beta");
721-
///
722-
/// // A full range clears the string
723-
/// s.drain(..);
724-
/// assert_eq!(s, "");
725-
/// ```
726-
#[unstable(feature = "collections_drain",
727-
reason = "recently added, matches RFC")]
728-
pub fn drain<R>(&mut self, range: R) -> Drain where R: RangeArgument<usize> {
729-
// Memory safety
730-
//
731-
// The String version of Drain does not have the memory safety issues
732-
// of the vector version. The data is just plain bytes.
733-
// Because the range removal happens in Drop, if the Drain iterator is leaked,
734-
// the removal will not happen.
735-
let len = self.len();
736-
let start = *range.start().unwrap_or(&0);
737-
let end = *range.end().unwrap_or(&len);
738-
739-
// Take out two simultaneous borrows. The &mut String won't be accessed
740-
// until iteration is over, in Drop.
741-
let self_ptr = self as *mut _;
742-
// slicing does the appropriate bounds checks
743-
let chars_iter = self[start..end].chars();
744-
745-
Drain {
746-
start: start,
747-
end: end,
748-
iter: chars_iter,
749-
string: self_ptr,
750-
}
751-
}
752698
}
753699

754700
impl FromUtf8Error {
@@ -794,7 +740,8 @@ impl<'a> FromIterator<&'a str> for String {
794740
}
795741
}
796742

797-
#[stable(feature = "rust1", since = "1.0.0")]
743+
#[unstable(feature = "collections",
744+
reason = "waiting on Extend stabilization")]
798745
impl Extend<char> for String {
799746
fn extend<I: IntoIterator<Item=char>>(&mut self, iterable: I) {
800747
let iterator = iterable.into_iter();
@@ -806,7 +753,8 @@ impl Extend<char> for String {
806753
}
807754
}
808755

809-
#[stable(feature = "rust1", since = "1.0.0")]
756+
#[unstable(feature = "collections",
757+
reason = "waiting on Extend stabilization")]
810758
impl<'a> Extend<&'a str> for String {
811759
fn extend<I: IntoIterator<Item=&'a str>>(&mut self, iterable: I) {
812760
let iterator = iterable.into_iter();
@@ -921,7 +869,8 @@ impl hash::Hash for String {
921869
}
922870
}
923871

924-
#[stable(feature = "rust1", since = "1.0.0")]
872+
#[unstable(feature = "collections",
873+
reason = "recent addition, needs more experience")]
925874
impl<'a> Add<&'a str> for String {
926875
type Output = String;
927876

@@ -1015,17 +964,11 @@ pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {
1015964
DerefString { x: as_vec(x.as_bytes()) }
1016965
}
1017966

1018-
/// Error returned from `String::from_str`
1019-
#[unstable(feature = "str_parse_error", reason = "may want to be replaced with \
1020-
Void if it ever exists")]
1021-
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
1022-
pub struct ParseError(());
1023-
1024-
#[stable(feature = "rust1", since = "1.0.0")]
967+
#[unstable(feature = "collections", reason = "associated error type may change")]
1025968
impl FromStr for String {
1026-
type Err = ParseError;
969+
type Err = ();
1027970
#[inline]
1028-
fn from_str(s: &str) -> Result<String, ParseError> {
971+
fn from_str(s: &str) -> Result<String, ()> {
1029972
Ok(String::from_str(s))
1030973
}
1031974
}
@@ -1129,55 +1072,3 @@ impl fmt::Write for String {
11291072
Ok(())
11301073
}
11311074
}
1132-
1133-
/// A draining iterator for `String`.
1134-
#[unstable(feature = "collections_drain", reason = "recently added")]
1135-
pub struct Drain<'a> {
1136-
/// Will be used as &'a mut String in the destructor
1137-
string: *mut String,
1138-
/// Start of part to remove
1139-
start: usize,
1140-
/// End of part to remove
1141-
end: usize,
1142-
/// Current remaining range to remove
1143-
iter: Chars<'a>,
1144-
}
1145-
1146-
unsafe impl<'a> Sync for Drain<'a> {}
1147-
unsafe impl<'a> Send for Drain<'a> {}
1148-
1149-
#[unstable(feature = "collections_drain", reason = "recently added")]
1150-
impl<'a> Drop for Drain<'a> {
1151-
fn drop(&mut self) {
1152-
unsafe {
1153-
// Use Vec::drain. "Reaffirm" the bounds checks to avoid
1154-
// panic code being inserted again.
1155-
let self_vec = (*self.string).as_mut_vec();
1156-
if self.start <= self.end && self.end <= self_vec.len() {
1157-
self_vec.drain(self.start..self.end);
1158-
}
1159-
}
1160-
}
1161-
}
1162-
1163-
#[unstable(feature = "collections_drain", reason = "recently added")]
1164-
impl<'a> Iterator for Drain<'a> {
1165-
type Item = char;
1166-
1167-
#[inline]
1168-
fn next(&mut self) -> Option<char> {
1169-
self.iter.next()
1170-
}
1171-
1172-
fn size_hint(&self) -> (usize, Option<usize>) {
1173-
self.iter.size_hint()
1174-
}
1175-
}
1176-
1177-
#[unstable(feature = "collections_drain", reason = "recently added")]
1178-
impl<'a> DoubleEndedIterator for Drain<'a> {
1179-
#[inline]
1180-
fn next_back(&mut self) -> Option<char> {
1181-
self.iter.next_back()
1182-
}
1183-
}

0 commit comments

Comments
 (0)