Skip to content

Commit 8396fe4

Browse files
committed
---
yaml --- r: 207939 b: refs/heads/snap-stage3 c: 78c1ae2 h: refs/heads/master i: 207937: 22288f1 207935: f66a935 v: v3
1 parent 3b6fdd1 commit 8396fe4

File tree

28 files changed

+122
-472
lines changed

28 files changed

+122
-472
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: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 0d7d3ec9d2b314af0188a820c58fbd95ee905793
4+
refs/heads/snap-stage3: 78c1ae279175b78b0118a5acfd69f82085b9cfc1
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/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/snap-stage3/src/doc/trpl/concurrency.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ use std::thread;
116116
fn main() {
117117
let mut data = vec![1u32, 2, 3];
118118
119-
for i in 0..3 {
119+
for i in 0..2 {
120120
thread::spawn(move || {
121121
data[i] += 1;
122122
});
@@ -154,7 +154,7 @@ use std::sync::Mutex;
154154
fn main() {
155155
let mut data = Mutex::new(vec![1u32, 2, 3]);
156156
157-
for i in 0..3 {
157+
for i in 0..2 {
158158
let data = data.lock().unwrap();
159159
thread::spawn(move || {
160160
data[i] += 1;
@@ -196,7 +196,7 @@ use std::thread;
196196
fn main() {
197197
let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
198198
199-
for i in 0..3 {
199+
for i in 0..2 {
200200
let data = data.clone();
201201
thread::spawn(move || {
202202
let mut data = data.lock().unwrap();
@@ -217,7 +217,7 @@ thread more closely:
217217
# use std::thread;
218218
# fn main() {
219219
# let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
220-
# for i in 0..3 {
220+
# for i in 0..2 {
221221
# let data = data.clone();
222222
thread::spawn(move || {
223223
let mut data = data.lock().unwrap();

branches/snap-stage3/src/doc/trpl/patterns.md

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ This prints `something else`
7070

7171
# Bindings
7272

73-
You can bind values to names with `@`:
73+
If you’re matching multiple things, via a `|` or a `...`, you can bind
74+
the value to a name with `@`:
7475

7576
```rust
7677
let x = 1;
@@ -81,36 +82,7 @@ match x {
8182
}
8283
```
8384

84-
This prints `got a range element 1`. This is useful when you want to
85-
do a complicated match of part of a data structure:
86-
87-
```rust
88-
#[derive(Debug)]
89-
struct Person {
90-
name: Option<String>,
91-
}
92-
93-
let name = "Steve".to_string();
94-
let mut x: Option<Person> = Some(Person { name: Some(name) });
95-
match x {
96-
Some(Person { name: ref a @ Some(_), .. }) => println!("{:?}", a),
97-
_ => {}
98-
}
99-
```
100-
101-
This prints `Some("Steve")`: We’ve bound the inner `name` to `a`.
102-
103-
If you use `@` with `|`, you need to make sure the name is bound in each part
104-
of the pattern:
105-
106-
```rust
107-
let x = 5;
108-
109-
match x {
110-
e @ 1 ... 5 | e @ 8 ... 10 => println!("got a range element {}", e),
111-
_ => println!("anything"),
112-
}
113-
```
85+
This prints `got a range element 1`.
11486

11587
# Ignoring variants
11688

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,11 +1004,7 @@ pub trait SliceConcatExt<T: ?Sized, U> {
10041004
/// # Examples
10051005
///
10061006
/// ```
1007-
/// let v = vec!["hello", "world"];
1008-
///
1009-
/// let s: String = v.concat();
1010-
///
1011-
/// println!("{}", s); // prints "helloworld"
1007+
/// assert_eq!(["hello", "world"].concat(), "helloworld");
10121008
/// ```
10131009
#[stable(feature = "rust1", since = "1.0.0")]
10141010
fn concat(&self) -> U;
@@ -1018,11 +1014,7 @@ pub trait SliceConcatExt<T: ?Sized, U> {
10181014
/// # Examples
10191015
///
10201016
/// ```
1021-
/// let v = vec!["hello", "world"];
1022-
///
1023-
/// let s: String = v.connect(" ");
1024-
///
1025-
/// println!("{}", s); // prints "hello world"
1017+
/// assert_eq!(["hello", "world"].connect(" "), "hello world");
10261018
/// ```
10271019
#[stable(feature = "rust1", since = "1.0.0")]
10281020
fn connect(&self, sep: &T) -> U;

branches/snap-stage3/src/libcollections/string.rs

Lines changed: 1 addition & 107 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 {
@@ -1129,55 +1075,3 @@ impl fmt::Write for String {
11291075
Ok(())
11301076
}
11311077
}
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-
}

branches/snap-stage3/src/libcollectionstest/string.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -348,23 +348,6 @@ fn test_from_iterator() {
348348
assert_eq!(s, d);
349349
}
350350

351-
#[test]
352-
fn test_drain() {
353-
let mut s = String::from("αβγ");
354-
assert_eq!(s.drain(2..4).collect::<String>(), "β");
355-
assert_eq!(s, "αγ");
356-
357-
let mut t = String::from("abcd");
358-
t.drain(..0);
359-
assert_eq!(t, "abcd");
360-
t.drain(..1);
361-
assert_eq!(t, "bcd");
362-
t.drain(3..);
363-
assert_eq!(t, "bcd");
364-
t.drain(..);
365-
assert_eq!(t, "");
366-
}
367-
368351
#[bench]
369352
fn bench_with_capacity(b: &mut Bencher) {
370353
b.iter(|| {

branches/snap-stage3/src/libcore/num/float_macros.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ macro_rules! from_str_radix_float_impl {
3535
}
3636

3737
let (is_positive, src) = match src.slice_shift_char() {
38-
None => return Err(PFE { __kind: Empty }),
39-
Some(('-', "")) => return Err(PFE { __kind: Empty }),
38+
None => return Err(PFE { kind: Empty }),
39+
Some(('-', "")) => return Err(PFE { kind: Empty }),
4040
Some(('-', src)) => (false, src),
4141
Some((_, _)) => (true, src),
4242
};
@@ -88,7 +88,7 @@ macro_rules! from_str_radix_float_impl {
8888
break; // start of fractional part
8989
},
9090
_ => {
91-
return Err(PFE { __kind: Invalid });
91+
return Err(PFE { kind: Invalid });
9292
},
9393
},
9494
}
@@ -122,7 +122,7 @@ macro_rules! from_str_radix_float_impl {
122122
break; // start of exponent
123123
},
124124
_ => {
125-
return Err(PFE { __kind: Invalid });
125+
return Err(PFE { kind: Invalid });
126126
},
127127
},
128128
}
@@ -135,7 +135,7 @@ macro_rules! from_str_radix_float_impl {
135135
let base = match c {
136136
'E' | 'e' if radix == 10 => 10.0,
137137
'P' | 'p' if radix == 16 => 2.0,
138-
_ => return Err(PFE { __kind: Invalid }),
138+
_ => return Err(PFE { kind: Invalid }),
139139
};
140140

141141
// Parse the exponent as decimal integer
@@ -144,13 +144,13 @@ macro_rules! from_str_radix_float_impl {
144144
Some(('-', src)) => (false, src.parse::<usize>()),
145145
Some(('+', src)) => (true, src.parse::<usize>()),
146146
Some((_, _)) => (true, src.parse::<usize>()),
147-
None => return Err(PFE { __kind: Invalid }),
147+
None => return Err(PFE { kind: Invalid }),
148148
};
149149

150150
match (is_positive, exp) {
151151
(true, Ok(exp)) => base.powi(exp as i32),
152152
(false, Ok(exp)) => 1.0 / base.powi(exp as i32),
153-
(_, Err(_)) => return Err(PFE { __kind: Invalid }),
153+
(_, Err(_)) => return Err(PFE { kind: Invalid }),
154154
}
155155
},
156156
None => 1.0, // no exponent

branches/snap-stage3/src/libcore/num/mod.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,11 +1524,7 @@ impl fmt::Display for ParseIntError {
15241524

15251525
/// An error which can be returned when parsing a float.
15261526
#[derive(Debug, Clone, PartialEq)]
1527-
#[stable(feature = "rust1", since = "1.0.0")]
1528-
pub struct ParseFloatError {
1529-
#[doc(hidden)]
1530-
pub __kind: FloatErrorKind
1531-
}
1527+
pub struct ParseFloatError { pub kind: FloatErrorKind }
15321528

15331529
#[derive(Debug, Clone, PartialEq)]
15341530
pub enum FloatErrorKind {
@@ -1537,9 +1533,9 @@ pub enum FloatErrorKind {
15371533
}
15381534

15391535
impl ParseFloatError {
1540-
#[doc(hidden)]
1541-
pub fn __description(&self) -> &str {
1542-
match self.__kind {
1536+
#[unstable(feature = "core", reason = "available through Error trait")]
1537+
pub fn description(&self) -> &str {
1538+
match self.kind {
15431539
FloatErrorKind::Empty => "cannot parse float from empty string",
15441540
FloatErrorKind::Invalid => "invalid float literal",
15451541
}
@@ -1549,6 +1545,6 @@ impl ParseFloatError {
15491545
#[stable(feature = "rust1", since = "1.0.0")]
15501546
impl fmt::Display for ParseFloatError {
15511547
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1552-
self.__description().fmt(f)
1548+
self.description().fmt(f)
15531549
}
15541550
}

branches/snap-stage3/src/liblog/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ macro_rules! info {
136136
}
137137

138138
/// A convenience macro for logging at the debug log level. This macro can also
139-
/// be omitted at compile time by passing `-C debug-assertions` to the compiler. If
139+
/// be omitted at compile time by passing `--cfg ndebug` to the compiler. If
140140
/// this option is not passed, then debug statements will be compiled.
141141
///
142142
/// # Examples

branches/snap-stage3/src/librustc_typeck/check/cast.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,9 @@ pub fn check_cast<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, cast: &CastCheck<'tcx>) {
170170
demand::coerce(fcx, e.span, t_1, &e);
171171
}
172172
}
173-
} else if fcx.type_is_fat_ptr(t_e, span) != fcx.type_is_fat_ptr(t_1, span) {
173+
} else if fcx.type_is_fat_ptr(t_e, span) && !fcx.type_is_fat_ptr(t_1, span) {
174174
fcx.type_error_message(span, |actual| {
175-
format!("illegal cast; cast to or from fat pointer: `{}` as `{}` \
176-
involving incompatible type.",
175+
format!("illegal cast; cast from fat pointer: `{}` as `{}`",
177176
actual, fcx.infcx().ty_to_string(t_1))
178177
}, t_e, None);
179178
} else if !(t_e_is_scalar && t_1_is_trivial) {

branches/snap-stage3/src/libstd/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl Error for num::ParseIntError {
147147
#[stable(feature = "rust1", since = "1.0.0")]
148148
impl Error for num::ParseFloatError {
149149
fn description(&self) -> &str {
150-
self.__description()
150+
self.description()
151151
}
152152
}
153153

0 commit comments

Comments
 (0)