Skip to content

Commit 210fc80

Browse files
committed
---
yaml --- r: 236164 b: refs/heads/stable c: 0919f4a h: refs/heads/master v: v3
1 parent 9da910c commit 210fc80

21 files changed

+181
-50
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 554efc013481b45b8336299074a86491e4ef436e
32+
refs/heads/stable: 0919f4ad862bc3ae771fc56a8fe9905bca299fe2
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/RELEASES.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Highlights
1616
jobs). It's not enabled by default, but will be "in the near
1717
future". It can be activated with the `-C codegen-units=N` flag to
1818
`rustc`.
19+
* This is the first release with [experimental support for linking
20+
with the MSVC linker and lib C on Windows (instead of using the GNU
21+
variants via MinGW)][win]. It is yet recommended only for the most
22+
intrepid Rusticians.
23+
* Benchmark compilations are showing a 30% improvement in
24+
bootstrapping over 1.1.
1925

2026
Breaking Changes
2127
----------------
@@ -31,6 +37,10 @@ Breaking Changes
3137
* [The `#[packed]` attribute is no longer silently accepted by the
3238
compiler][packed]. This attribute did nothing and code that
3339
mentioned it likely did not work as intended.
40+
* Associated type defaults are [now behind the
41+
`associated_type_defaults` feature gate][ad]. In 1.1 associated type
42+
defaults *did not work*, but could be mentioned syntactically. As
43+
such this breakage has minimal impact.
3444

3545
Language
3646
--------
@@ -46,12 +56,11 @@ Libraries
4656
`LinkedList`, `VecDeque`, `EnumSet`, `BinaryHeap`, `VecMap`,
4757
`BTreeSet` and `BTreeMap`. [RFC][extend-rfc].
4858
* The [`iter::once`] function returns an iterator that yields a single
49-
element.
50-
* The [`iter::empty`] function returns an iterator that yields no
59+
element, and [`iter::empty`] returns an iterator that yields no
5160
elements.
5261
* The [`matches`] and [`rmatches`] methods on `str` return iterators
5362
over substring matches.
54-
* [`Cell`] and [`RefCell`] both implement [`Eq`].
63+
* [`Cell`] and [`RefCell`] both implement `Eq`.
5564
* A number of methods for wrapping arithmetic are added to the
5665
integral types, [`wrapping_div`], [`wrapping_rem`],
5766
[`wrapping_neg`], [`wrapping_shl`], [`wrapping_shr`]. These are in
@@ -144,6 +153,8 @@ Misc
144153
[dst]: https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md
145154
[parcodegen]: https://github.com/rust-lang/rust/pull/26018
146155
[packed]: https://github.com/rust-lang/rust/pull/25541
156+
[ad]: https://github.com/rust-lang/rust/pull/27382
157+
[win]: https://github.com/rust-lang/rust/pull/25350
147158

148159
Version 1.1.0 (June 2015)
149160
=========================

branches/stable/src/doc/tarpl/races.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ race condition can't violate memory safety in a Rust program on
2727
its own. Only in conjunction with some other unsafe code can a race condition
2828
actually violate memory safety. For instance:
2929

30-
```rust,norun
30+
```rust,no_run
3131
use std::thread;
3232
use std::sync::atomic::{AtomicUsize, Ordering};
3333
use std::sync::Arc;
@@ -58,7 +58,7 @@ thread::spawn(move || {
5858
println!("{}", data[idx.load(Ordering::SeqCst)]);
5959
```
6060

61-
```rust,norun
61+
```rust,no_run
6262
use std::thread;
6363
use std::sync::atomic::{AtomicUsize, Ordering};
6464
use std::sync::Arc;

branches/stable/src/libcore/hash/mod.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ pub trait Hash {
9191
fn hash<H: Hasher>(&self, state: &mut H);
9292

9393
/// Feeds a slice of this type into the state provided.
94-
#[unstable(feature = "hash_slice",
95-
reason = "module was recently redesigned")]
94+
#[stable(feature = "hash_slice", since = "1.3.0")]
9695
fn hash_slice<H: Hasher>(data: &[Self], state: &mut H) where Self: Sized {
9796
for piece in data {
9897
piece.hash(state);
@@ -113,29 +112,29 @@ pub trait Hasher {
113112

114113
/// Write a single `u8` into this hasher
115114
#[inline]
116-
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
115+
#[stable(feature = "hasher_write", since = "1.3.0")]
117116
fn write_u8(&mut self, i: u8) { self.write(&[i]) }
118117
/// Write a single `u16` into this hasher.
119118
#[inline]
120-
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
119+
#[stable(feature = "hasher_write", since = "1.3.0")]
121120
fn write_u16(&mut self, i: u16) {
122121
self.write(&unsafe { mem::transmute::<_, [u8; 2]>(i) })
123122
}
124123
/// Write a single `u32` into this hasher.
125124
#[inline]
126-
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
125+
#[stable(feature = "hasher_write", since = "1.3.0")]
127126
fn write_u32(&mut self, i: u32) {
128127
self.write(&unsafe { mem::transmute::<_, [u8; 4]>(i) })
129128
}
130129
/// Write a single `u64` into this hasher.
131130
#[inline]
132-
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
131+
#[stable(feature = "hasher_write", since = "1.3.0")]
133132
fn write_u64(&mut self, i: u64) {
134133
self.write(&unsafe { mem::transmute::<_, [u8; 8]>(i) })
135134
}
136135
/// Write a single `usize` into this hasher.
137136
#[inline]
138-
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
137+
#[stable(feature = "hasher_write", since = "1.3.0")]
139138
fn write_usize(&mut self, i: usize) {
140139
if cfg!(target_pointer_width = "32") {
141140
self.write_u32(i as u32)
@@ -146,23 +145,23 @@ pub trait Hasher {
146145

147146
/// Write a single `i8` into this hasher.
148147
#[inline]
149-
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
148+
#[stable(feature = "hasher_write", since = "1.3.0")]
150149
fn write_i8(&mut self, i: i8) { self.write_u8(i as u8) }
151150
/// Write a single `i16` into this hasher.
152151
#[inline]
153-
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
152+
#[stable(feature = "hasher_write", since = "1.3.0")]
154153
fn write_i16(&mut self, i: i16) { self.write_u16(i as u16) }
155154
/// Write a single `i32` into this hasher.
156155
#[inline]
157-
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
156+
#[stable(feature = "hasher_write", since = "1.3.0")]
158157
fn write_i32(&mut self, i: i32) { self.write_u32(i as u32) }
159158
/// Write a single `i64` into this hasher.
160159
#[inline]
161-
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
160+
#[stable(feature = "hasher_write", since = "1.3.0")]
162161
fn write_i64(&mut self, i: i64) { self.write_u64(i as u64) }
163162
/// Write a single `isize` into this hasher.
164163
#[inline]
165-
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
164+
#[stable(feature = "hasher_write", since = "1.3.0")]
166165
fn write_isize(&mut self, i: isize) { self.write_usize(i as usize) }
167166
}
168167

branches/stable/src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#![allow(raw_pointer_derive)]
6666
#![deny(missing_docs)]
6767

68+
#![feature(associated_type_defaults)]
6869
#![feature(intrinsics)]
6970
#![feature(lang_items)]
7071
#![feature(on_unimplemented)]

branches/stable/src/librustc_resolve/diagnostics.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -583,9 +583,10 @@ Please verify you didn't misspell the import's name.
583583
"##,
584584

585585
E0437: r##"
586-
Trait impls can only implement associated types that are members of the trait in
587-
question. This error indicates that you attempted to implement an associated
588-
type whose name does not match the name of any associated type in the trait.
586+
Trait implementations can only implement associated types that are members of
587+
the trait in question. This error indicates that you attempted to implement
588+
an associated type whose name does not match the name of any associated type
589+
in the trait.
589590
590591
Here is an example that demonstrates the error:
591592
@@ -607,10 +608,10 @@ impl Foo for i32 {}
607608
"##,
608609

609610
E0438: r##"
610-
Trait impls can only implement associated constants that are members of the
611-
trait in question. This error indicates that you attempted to implement an
612-
associated constant whose name does not match the name of any associated
613-
constant in the trait.
611+
Trait implementations can only implement associated constants that are
612+
members of the trait in question. This error indicates that you
613+
attempted to implement an associated constant whose name does not
614+
match the name of any associated constant in the trait.
614615
615616
Here is an example that demonstrates the error:
616617

branches/stable/src/librustdoc/markdown.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ use test::{TestOptions, Collector};
2929
/// Separate any lines at the start of the file that begin with `%`.
3030
fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
3131
let mut metadata = Vec::new();
32+
let mut count = 0;
3233
for line in s.lines() {
3334
if line.starts_with("%") {
3435
// remove %<whitespace>
35-
metadata.push(line[1..].trim_left())
36+
metadata.push(line[1..].trim_left());
37+
count += line.len() + 1;
3638
} else {
37-
let line_start_byte = s.find(line).unwrap();
38-
return (metadata, &s[line_start_byte..]);
39+
return (metadata, &s[count..]);
3940
}
4041
}
4142
// if we're here, then all lines were metadata % lines.

branches/stable/src/libstd/error.rs

Lines changed: 93 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl Error for string::FromUtf16Error {
168168
// copied from any.rs
169169
impl Error + 'static {
170170
/// Returns true if the boxed type is the same as `T`
171-
#[unstable(feature = "error_downcast", reason = "recently added")]
171+
#[stable(feature = "error_downcast", since = "1.3.0")]
172172
#[inline]
173173
pub fn is<T: Error + 'static>(&self) -> bool {
174174
// Get TypeId of the type this function is instantiated with
@@ -183,7 +183,7 @@ impl Error + 'static {
183183

184184
/// Returns some reference to the boxed value if it is of type `T`, or
185185
/// `None` if it isn't.
186-
#[unstable(feature = "error_downcast", reason = "recently added")]
186+
#[stable(feature = "error_downcast", since = "1.3.0")]
187187
#[inline]
188188
pub fn downcast_ref<T: Error + 'static>(&self) -> Option<&T> {
189189
if self.is::<T>() {
@@ -201,7 +201,7 @@ impl Error + 'static {
201201

202202
/// Returns some mutable reference to the boxed value if it is of type `T`, or
203203
/// `None` if it isn't.
204-
#[unstable(feature = "error_downcast", reason = "recently added")]
204+
#[stable(feature = "error_downcast", since = "1.3.0")]
205205
#[inline]
206206
pub fn downcast_mut<T: Error + 'static>(&mut self) -> Option<&mut T> {
207207
if self.is::<T>() {
@@ -220,21 +220,44 @@ impl Error + 'static {
220220

221221
impl Error + 'static + Send {
222222
/// Forwards to the method defined on the type `Any`.
223-
#[unstable(feature = "error_downcast", reason = "recently added")]
223+
#[stable(feature = "error_downcast", since = "1.3.0")]
224224
#[inline]
225225
pub fn is<T: Error + 'static>(&self) -> bool {
226226
<Error + 'static>::is::<T>(self)
227227
}
228228

229229
/// Forwards to the method defined on the type `Any`.
230-
#[unstable(feature = "error_downcast", reason = "recently added")]
230+
#[stable(feature = "error_downcast", since = "1.3.0")]
231231
#[inline]
232232
pub fn downcast_ref<T: Error + 'static>(&self) -> Option<&T> {
233233
<Error + 'static>::downcast_ref::<T>(self)
234234
}
235235

236236
/// Forwards to the method defined on the type `Any`.
237-
#[unstable(feature = "error_downcast", reason = "recently added")]
237+
#[stable(feature = "error_downcast", since = "1.3.0")]
238+
#[inline]
239+
pub fn downcast_mut<T: Error + 'static>(&mut self) -> Option<&mut T> {
240+
<Error + 'static>::downcast_mut::<T>(self)
241+
}
242+
}
243+
244+
impl Error + 'static + Send + Sync {
245+
/// Forwards to the method defined on the type `Any`.
246+
#[stable(feature = "error_downcast", since = "1.3.0")]
247+
#[inline]
248+
pub fn is<T: Error + 'static>(&self) -> bool {
249+
<Error + 'static>::is::<T>(self)
250+
}
251+
252+
/// Forwards to the method defined on the type `Any`.
253+
#[stable(feature = "error_downcast", since = "1.3.0")]
254+
#[inline]
255+
pub fn downcast_ref<T: Error + 'static>(&self) -> Option<&T> {
256+
<Error + 'static>::downcast_ref::<T>(self)
257+
}
258+
259+
/// Forwards to the method defined on the type `Any`.
260+
#[stable(feature = "error_downcast", since = "1.3.0")]
238261
#[inline]
239262
pub fn downcast_mut<T: Error + 'static>(&mut self) -> Option<&mut T> {
240263
<Error + 'static>::downcast_mut::<T>(self)
@@ -243,7 +266,7 @@ impl Error + 'static + Send {
243266

244267
impl Error {
245268
#[inline]
246-
#[unstable(feature = "error_downcast", reason = "recently added")]
269+
#[stable(feature = "error_downcast", since = "1.3.0")]
247270
/// Attempt to downcast the box to a concrete type.
248271
pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<Error>> {
249272
if self.is::<T>() {
@@ -264,13 +287,74 @@ impl Error {
264287

265288
impl Error + Send {
266289
#[inline]
267-
#[unstable(feature = "error_downcast", reason = "recently added")]
290+
#[stable(feature = "error_downcast", since = "1.3.0")]
268291
/// Attempt to downcast the box to a concrete type.
269-
pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<Error + Send>> {
292+
pub fn downcast<T: Error + 'static>(self: Box<Self>)
293+
-> Result<Box<T>, Box<Error + Send>> {
270294
let err: Box<Error> = self;
271295
<Error>::downcast(err).map_err(|s| unsafe {
272296
// reapply the Send marker
273297
transmute::<Box<Error>, Box<Error + Send>>(s)
274298
})
275299
}
276300
}
301+
302+
impl Error + Send + Sync {
303+
#[inline]
304+
#[stable(feature = "error_downcast", since = "1.3.0")]
305+
/// Attempt to downcast the box to a concrete type.
306+
pub fn downcast<T: Error + 'static>(self: Box<Self>)
307+
-> Result<Box<T>, Box<Self>> {
308+
let err: Box<Error> = self;
309+
<Error>::downcast(err).map_err(|s| unsafe {
310+
// reapply the Send+Sync marker
311+
transmute::<Box<Error>, Box<Error + Send + Sync>>(s)
312+
})
313+
}
314+
}
315+
316+
#[cfg(test)]
317+
mod tests {
318+
use prelude::v1::*;
319+
use super::Error;
320+
use fmt;
321+
322+
#[derive(Debug, PartialEq)]
323+
struct A;
324+
#[derive(Debug, PartialEq)]
325+
struct B;
326+
327+
impl fmt::Display for A {
328+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
329+
write!(f, "A")
330+
}
331+
}
332+
impl fmt::Display for B {
333+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
334+
write!(f, "B")
335+
}
336+
}
337+
338+
impl Error for A {
339+
fn description(&self) -> &str { "A-desc" }
340+
}
341+
impl Error for B {
342+
fn description(&self) -> &str { "A-desc" }
343+
}
344+
345+
#[test]
346+
fn downcasting() {
347+
let mut a = A;
348+
let mut a = &mut a as &mut (Error + 'static);
349+
assert_eq!(a.downcast_ref::<A>(), Some(&A));
350+
assert_eq!(a.downcast_ref::<B>(), None);
351+
assert_eq!(a.downcast_mut::<A>(), Some(&mut A));
352+
assert_eq!(a.downcast_mut::<B>(), None);
353+
354+
let a: Box<Error> = Box::new(A);
355+
match a.downcast::<B>() {
356+
Ok(..) => panic!("expected error"),
357+
Err(e) => assert_eq!(*e.downcast::<A>().unwrap(), A),
358+
}
359+
}
360+
}

0 commit comments

Comments
 (0)