Skip to content

Commit b774ed0

Browse files
committed
---
yaml --- r: 195963 b: refs/heads/beta c: 554946c h: refs/heads/master i: 195961: 0595bbb 195959: a48f1f3 v: v3
1 parent 136b786 commit b774ed0

Some content is hidden

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

75 files changed

+796
-344
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: d4a2c941809f303b97d153e06ba07e95cd245f88
32+
refs/heads/beta: 554946c81eeb4fcfceda782f6c5af394ab3fe8d3
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 9de34a84bb300bab1bf0227f577331620cd60511

branches/beta/src/compiletest/compiletest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#![feature(std_misc)]
1919
#![feature(test)]
2020
#![feature(path_ext)]
21-
#![feature(convert)]
2221
#![feature(str_char)]
2322

2423
#![deny(warnings)]

branches/beta/src/liballoc/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ use heap::deallocate;
110110
/// let child_numbers = shared_numbers.clone();
111111
///
112112
/// thread::spawn(move || {
113-
/// let local_numbers = child_numbers.as_slice();
113+
/// let local_numbers = &child_numbers[..];
114114
///
115115
/// // Work with the local numbers
116116
/// });

branches/beta/src/liballoc/boxed.rs

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use core::prelude::*;
5151
use core::any::Any;
5252
use core::cmp::Ordering;
5353
use core::default::Default;
54-
use core::error::{Error, FromError};
54+
use core::error::Error;
5555
use core::fmt;
5656
use core::hash::{self, Hash};
5757
use core::mem;
@@ -233,24 +233,10 @@ impl<T: ?Sized + Hash> Hash for Box<T> {
233233
}
234234
}
235235

236-
/// Extension methods for an owning `Any` trait object.
237-
#[unstable(feature = "alloc",
238-
reason = "this trait will likely disappear once compiler bugs blocking \
239-
a direct impl on `Box<Any>` have been fixed ")]
240-
// FIXME(#18737): this should be a direct impl on `Box<Any>`. If you're
241-
// removing this please make sure that you can downcase on
242-
// `Box<Any + Send>` as well as `Box<Any>`
243-
pub trait BoxAny {
244-
/// Returns the boxed value if it is of type `T`, or
245-
/// `Err(Self)` if it isn't.
246-
#[stable(feature = "rust1", since = "1.0.0")]
247-
fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>>;
248-
}
249-
250-
#[stable(feature = "rust1", since = "1.0.0")]
251-
impl BoxAny for Box<Any> {
236+
impl Box<Any> {
252237
#[inline]
253-
fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
238+
#[stable(feature = "rust1", since = "1.0.0")]
239+
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
254240
if self.is::<T>() {
255241
unsafe {
256242
// Get the raw representation of the trait object
@@ -267,10 +253,10 @@ impl BoxAny for Box<Any> {
267253
}
268254
}
269255

270-
#[stable(feature = "rust1", since = "1.0.0")]
271-
impl BoxAny for Box<Any+Send> {
256+
impl Box<Any+Send> {
272257
#[inline]
273-
fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
258+
#[stable(feature = "rust1", since = "1.0.0")]
259+
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
274260
<Box<Any>>::downcast(self)
275261
}
276262
}
@@ -322,8 +308,8 @@ impl<I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for Box<I> {
322308
impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {}
323309

324310
#[stable(feature = "rust1", since = "1.0.0")]
325-
impl<'a, E: Error + 'a> FromError<E> for Box<Error + 'a> {
326-
fn from_error(err: E) -> Box<Error + 'a> {
311+
impl<'a, E: Error + 'a> From<E> for Box<Error + 'a> {
312+
fn from(err: E) -> Box<Error + 'a> {
327313
Box::new(err)
328314
}
329315
}

branches/beta/src/liballoc/boxed_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use core::clone::Clone;
1717

1818
use std::boxed;
1919
use std::boxed::Box;
20-
use std::boxed::BoxAny;
2120

2221
#[test]
2322
fn test_owned_clone() {

branches/beta/src/libcollections/borrow.rs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,24 @@ use self::Cow::*;
4040
#[stable(feature = "rust1", since = "1.0.0")]
4141
pub trait Borrow<Borrowed: ?Sized> {
4242
/// Immutably borrow from an owned value.
43+
///
44+
/// # Examples
45+
///
46+
/// ```
47+
/// use std::borrow::Borrow;
48+
///
49+
/// fn check<T: Borrow<str>>(s: T) {
50+
/// assert_eq!("Hello", s.borrow());
51+
/// }
52+
///
53+
/// let s = "Hello".to_string();
54+
///
55+
/// check(s);
56+
///
57+
/// let s = "Hello";
58+
///
59+
/// check(s);
60+
/// ```
4361
#[stable(feature = "rust1", since = "1.0.0")]
4462
fn borrow(&self) -> &Borrowed;
4563
}
@@ -50,6 +68,20 @@ pub trait Borrow<Borrowed: ?Sized> {
5068
#[stable(feature = "rust1", since = "1.0.0")]
5169
pub trait BorrowMut<Borrowed: ?Sized> : Borrow<Borrowed> {
5270
/// Mutably borrow from an owned value.
71+
///
72+
/// # Examples
73+
///
74+
/// ```
75+
/// use std::borrow::BorrowMut;
76+
///
77+
/// fn check<T: BorrowMut<[i32]>>(mut v: T) {
78+
/// assert_eq!(&mut [1, 2, 3], v.borrow_mut());
79+
/// }
80+
///
81+
/// let v = vec![1, 2, 3];
82+
///
83+
/// check(v);
84+
/// ```
5385
#[stable(feature = "rust1", since = "1.0.0")]
5486
fn borrow_mut(&mut self) -> &mut Borrowed;
5587
}
@@ -171,6 +203,18 @@ impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned {
171203
/// Acquire a mutable reference to the owned form of the data.
172204
///
173205
/// Copies the data if it is not already owned.
206+
///
207+
/// # Examples
208+
///
209+
/// ```
210+
/// use std::borrow::Cow;
211+
///
212+
/// let mut cow: Cow<[_]> = Cow::Owned(vec![1, 2, 3]);
213+
///
214+
/// let hello = cow.to_mut();
215+
///
216+
/// assert_eq!(&[1, 2, 3], hello);
217+
/// ```
174218
#[stable(feature = "rust1", since = "1.0.0")]
175219
pub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned {
176220
match *self {
@@ -185,6 +229,18 @@ impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned {
185229
/// Extract the owned data.
186230
///
187231
/// Copies the data if it is not already owned.
232+
///
233+
/// # Examples
234+
///
235+
/// ```
236+
/// use std::borrow::Cow;
237+
///
238+
/// let cow: Cow<[_]> = Cow::Owned(vec![1, 2, 3]);
239+
///
240+
/// let hello = cow.into_owned();
241+
///
242+
/// assert_eq!(vec![1, 2, 3], hello);
243+
/// ```
188244
#[stable(feature = "rust1", since = "1.0.0")]
189245
pub fn into_owned(self) -> <B as ToOwned>::Owned {
190246
match self {

branches/beta/src/libcollections/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#![feature(unsafe_no_drop_flag, filling_drop)]
3939
#![feature(step_by)]
4040
#![feature(str_char)]
41-
#![feature(convert)]
4241
#![feature(slice_patterns)]
4342
#![feature(debug_builders)]
4443
#![cfg_attr(test, feature(rand, rustc_private, test, hash, collections))]

branches/beta/src/libcollections/slice.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ use core::iter::MultiplicativeIterator;
8989
use core::marker::Sized;
9090
use core::mem::size_of;
9191
use core::mem;
92-
#[cfg(stage0)]
93-
use core::num::wrapping::WrappingOps;
9492
use core::ops::FnMut;
9593
use core::option::Option::{self, Some, None};
9694
use core::ptr;
@@ -529,7 +527,6 @@ impl<T> [T] {
529527
/// ```rust
530528
/// # #![feature(core)]
531529
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
532-
/// let s = s.as_slice();
533530
///
534531
/// let seek = 13;
535532
/// assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Ok(9));
@@ -860,7 +857,6 @@ impl<T> [T] {
860857
/// ```rust
861858
/// # #![feature(core)]
862859
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
863-
/// let s = s.as_slice();
864860
///
865861
/// assert_eq!(s.binary_search(&13), Ok(9));
866862
/// assert_eq!(s.binary_search(&4), Err(7));

branches/beta/src/libcollections/str.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,12 +1389,12 @@ impl str {
13891389
/// let gr1 = "a\u{310}e\u{301}o\u{308}\u{332}".graphemes(true).collect::<Vec<&str>>();
13901390
/// let b: &[_] = &["a\u{310}", "e\u{301}", "o\u{308}\u{332}"];
13911391
///
1392-
/// assert_eq!(gr1.as_slice(), b);
1392+
/// assert_eq!(&gr1[..], b);
13931393
///
13941394
/// let gr2 = "a\r\nb🇷🇺🇸🇹".graphemes(true).collect::<Vec<&str>>();
13951395
/// let b: &[_] = &["a", "\r\n", "b", "🇷🇺🇸🇹"];
13961396
///
1397-
/// assert_eq!(gr2.as_slice(), b);
1397+
/// assert_eq!(&gr2[..], b);
13981398
/// ```
13991399
#[unstable(feature = "unicode",
14001400
reason = "this functionality may only be provided by libunicode")]
@@ -1412,7 +1412,7 @@ impl str {
14121412
/// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::<Vec<(usize, &str)>>();
14131413
/// let b: &[_] = &[(0, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")];
14141414
///
1415-
/// assert_eq!(gr_inds.as_slice(), b);
1415+
/// assert_eq!(&gr_inds[..], b);
14161416
/// ```
14171417
#[unstable(feature = "unicode",
14181418
reason = "this functionality may only be provided by libunicode")]

branches/beta/src/libcollections/string.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl String {
9393
/// ```
9494
/// # #![feature(collections, core)]
9595
/// let s = String::from_str("hello");
96-
/// assert_eq!(s.as_slice(), "hello");
96+
/// assert_eq!(&s[..], "hello");
9797
/// ```
9898
#[inline]
9999
#[unstable(feature = "collections",
@@ -364,6 +364,14 @@ impl String {
364364
self.vec
365365
}
366366

367+
/// Extract a string slice containing the entire string.
368+
#[inline]
369+
#[unstable(feature = "convert",
370+
reason = "waiting on RFC revision")]
371+
pub fn as_str(&self) -> &str {
372+
self
373+
}
374+
367375
/// Pushes the given string onto this string buffer.
368376
///
369377
/// # Examples
@@ -848,7 +856,6 @@ impl<'a, 'b> PartialEq<Cow<'a, str>> for &'b str {
848856
#[allow(deprecated)]
849857
impl Str for String {
850858
#[inline]
851-
#[stable(feature = "rust1", since = "1.0.0")]
852859
fn as_slice(&self) -> &str {
853860
unsafe { mem::transmute(&*self.vec) }
854861
}

branches/beta/src/libcollections/vec.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,18 @@ impl<T> Vec<T> {
425425
}
426426
}
427427

428+
/// Extract a slice containing the entire vector.
429+
#[inline]
430+
#[unstable(feature = "convert",
431+
reason = "waiting on RFC revision")]
432+
pub fn as_slice(&self) -> &[T] {
433+
self
434+
}
435+
428436
/// Deprecated: use `&mut s[..]` instead.
429437
#[inline]
430-
#[unstable(feature = "collections",
431-
reason = "will be replaced by slice syntax")]
432-
#[deprecated(since = "1.0.0", reason = "use &mut s[..] instead")]
438+
#[unstable(feature = "convert",
439+
reason = "waiting on RFC revision")]
433440
pub fn as_mut_slice(&mut self) -> &mut [T] {
434441
&mut self[..]
435442
}
@@ -823,13 +830,13 @@ impl<T> Vec<T> {
823830
/// # #![feature(collections, core)]
824831
/// let v = vec![0, 1, 2];
825832
/// let w = v.map_in_place(|i| i + 3);
826-
/// assert_eq!(w.as_slice(), [3, 4, 5].as_slice());
833+
/// assert_eq!(&w[..], &[3, 4, 5]);
827834
///
828835
/// #[derive(PartialEq, Debug)]
829836
/// struct Newtype(u8);
830837
/// let bytes = vec![0x11, 0x22];
831838
/// let newtyped_bytes = bytes.map_in_place(|x| Newtype(x));
832-
/// assert_eq!(newtyped_bytes.as_slice(), [Newtype(0x11), Newtype(0x22)].as_slice());
839+
/// assert_eq!(&newtyped_bytes[..], &[Newtype(0x11), Newtype(0x22)]);
833840
/// ```
834841
#[unstable(feature = "collections",
835842
reason = "API may change to provide stronger guarantees")]
@@ -1642,13 +1649,6 @@ impl<T> AsRef<Vec<T>> for Vec<T> {
16421649
}
16431650
}
16441651

1645-
#[stable(feature = "rust1", since = "1.0.0")]
1646-
impl<T> Into<Vec<T>> for Vec<T> {
1647-
fn into(self) -> Vec<T> {
1648-
self
1649-
}
1650-
}
1651-
16521652
#[stable(feature = "rust1", since = "1.0.0")]
16531653
impl<T> AsRef<[T]> for Vec<T> {
16541654
fn as_ref(&self) -> &[T] {

branches/beta/src/libcollections/vec_deque.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ use core::default::Default;
2525
use core::fmt;
2626
use core::iter::{self, repeat, FromIterator, IntoIterator, RandomAccessIterator};
2727
use core::mem;
28-
#[cfg(stage0)]
29-
use core::num::wrapping::WrappingOps;
3028
use core::ops::{Index, IndexMut};
3129
use core::ptr::{self, Unique};
3230
use core::slice;
@@ -523,7 +521,8 @@ impl<T> VecDeque<T> {
523521
/// buf.push_back(3);
524522
/// buf.push_back(4);
525523
/// let b: &[_] = &[&5, &3, &4];
526-
/// assert_eq!(buf.iter().collect::<Vec<&i32>>().as_slice(), b);
524+
/// let c: Vec<&i32> = buf.iter().collect();
525+
/// assert_eq!(&c[..], b);
527526
/// ```
528527
#[stable(feature = "rust1", since = "1.0.0")]
529528
pub fn iter(&self) -> Iter<T> {

branches/beta/src/libcollectionstest/str.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,19 @@ fn test_splitator() {
14661466
t("zzzzz", "zz", &["","","z"]);
14671467
}
14681468

1469+
#[test]
1470+
fn test_str_default() {
1471+
use std::default::Default;
1472+
1473+
fn t<S: Default + AsRef<str>>() {
1474+
let s: S = Default::default();
1475+
assert_eq!(s.as_ref(), "");
1476+
}
1477+
1478+
t::<&str>();
1479+
t::<String>();
1480+
}
1481+
14691482
#[test]
14701483
fn test_str_container() {
14711484
fn sum_len(v: &[&str]) -> usize {

branches/beta/src/libcore/any.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ pub struct TypeId {
202202
impl TypeId {
203203
/// Returns the `TypeId` of the type this generic function has been
204204
/// instantiated with
205-
#[unstable(feature = "core",
206-
reason = "may grow a `Reflect` bound soon via marker traits")]
205+
#[stable(feature = "rust1", since = "1.0.0")]
207206
pub fn of<T: ?Sized + Any>() -> TypeId {
208207
TypeId {
209208
t: unsafe { intrinsics::type_id::<T>() },

0 commit comments

Comments
 (0)