Skip to content

Commit 2d0c2ca

Browse files
committed
---
yaml --- r: 195699 b: refs/heads/auto c: 5872ae4 h: refs/heads/master i: 195697: 45ea570 195695: defb8ab v: v3
1 parent cceb557 commit 2d0c2ca

Some content is hidden

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

87 files changed

+1411
-1523
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 6d2c640cf00aad6345bd93b0b64c8b3d3d2fcf50
13+
refs/heads/auto: 5872ae4a7a76ba67e702323d2de09a86fb5ba692
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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[..];
113+
/// let local_numbers = child_numbers.as_slice();
114114
///
115115
/// // Work with the local numbers
116116
/// });

branches/auto/src/liballoc/boxed.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,24 @@ impl<T: ?Sized + Hash> Hash for Box<T> {
233233
}
234234
}
235235

236-
impl Box<Any> {
237-
#[inline]
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.
238246
#[stable(feature = "rust1", since = "1.0.0")]
239-
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
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> {
252+
#[inline]
253+
fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
240254
if self.is::<T>() {
241255
unsafe {
242256
// Get the raw representation of the trait object
@@ -253,10 +267,10 @@ impl Box<Any> {
253267
}
254268
}
255269

256-
impl Box<Any+Send> {
270+
#[stable(feature = "rust1", since = "1.0.0")]
271+
impl BoxAny for Box<Any+Send> {
257272
#[inline]
258-
#[stable(feature = "rust1", since = "1.0.0")]
259-
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
273+
fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
260274
<Box<Any>>::downcast(self)
261275
}
262276
}

branches/auto/src/liballoc/boxed_test.rs

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

1818
use std::boxed;
1919
use std::boxed::Box;
20+
use std::boxed::BoxAny;
2021

2122
#[test]
2223
fn test_owned_clone() {

branches/auto/src/liballoc/heap.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ mod imp {
189189
use core::option::Option;
190190
use core::option::Option::None;
191191
use core::ptr::{null_mut, null};
192+
use core::num::Int;
192193
use libc::{c_char, c_int, c_void, size_t};
193194
use super::MIN_ALIGN;
194195

branches/auto/src/libcollections/bit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ use core::hash;
9191
use core::iter::RandomAccessIterator;
9292
use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
9393
use core::iter::{self, FromIterator, IntoIterator};
94+
use core::num::Int;
9495
use core::ops::Index;
9596
use core::slice;
9697
use core::{u8, u32, usize};

branches/auto/src/libcollections/borrow.rs

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,6 @@ 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-
/// ```
6143
#[stable(feature = "rust1", since = "1.0.0")]
6244
fn borrow(&self) -> &Borrowed;
6345
}
@@ -68,20 +50,6 @@ pub trait Borrow<Borrowed: ?Sized> {
6850
#[stable(feature = "rust1", since = "1.0.0")]
6951
pub trait BorrowMut<Borrowed: ?Sized> : Borrow<Borrowed> {
7052
/// 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-
/// ```
8553
#[stable(feature = "rust1", since = "1.0.0")]
8654
fn borrow_mut(&mut self) -> &mut Borrowed;
8755
}
@@ -203,18 +171,6 @@ impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned {
203171
/// Acquire a mutable reference to the owned form of the data.
204172
///
205173
/// 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-
/// ```
218174
#[stable(feature = "rust1", since = "1.0.0")]
219175
pub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned {
220176
match *self {
@@ -229,18 +185,6 @@ impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned {
229185
/// Extract the owned data.
230186
///
231187
/// 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-
/// ```
244188
#[stable(feature = "rust1", since = "1.0.0")]
245189
pub fn into_owned(self) -> <B as ToOwned>::Owned {
246190
match self {

branches/auto/src/libcollections/enum_set.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use core::prelude::*;
1717
use core::marker;
1818
use core::fmt;
19+
use core::num::Int;
1920
use core::iter::{FromIterator, IntoIterator};
2021
use core::ops::{Sub, BitOr, BitAnd, BitXor};
2122

branches/auto/src/libcollections/slice.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ use core::iter::MultiplicativeIterator;
8989
use core::marker::Sized;
9090
use core::mem::size_of;
9191
use core::mem;
92-
#[cfg(stage0)]
9392
use core::num::wrapping::WrappingOps;
9493
use core::ops::FnMut;
9594
use core::option::Option::{self, Some, None};
@@ -557,6 +556,7 @@ impl<T> [T] {
557556
/// ```rust
558557
/// # #![feature(core)]
559558
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
559+
/// let s = s.as_slice();
560560
///
561561
/// let seek = 13;
562562
/// assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Ok(9));
@@ -923,6 +923,7 @@ impl<T> [T] {
923923
/// ```rust
924924
/// # #![feature(core)]
925925
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
926+
/// let s = s.as_slice();
926927
///
927928
/// assert_eq!(s.binary_search(&13), Ok(9));
928929
/// assert_eq!(s.binary_search(&4), Err(7));

branches/auto/src/libcollections/str.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
//! (see below). It is not possible to move out of borrowed strings because they
1919
//! are owned elsewhere.
2020
//!
21+
//! Basic operations are implemented directly by the compiler, but more advanced
22+
//! operations are defined as methods on the `str` type.
23+
//!
2124
//! # Examples
2225
//!
2326
//! Here's some code that uses a `&str`:
@@ -1470,12 +1473,12 @@ impl str {
14701473
/// let gr1 = "a\u{310}e\u{301}o\u{308}\u{332}".graphemes(true).collect::<Vec<&str>>();
14711474
/// let b: &[_] = &["a\u{310}", "e\u{301}", "o\u{308}\u{332}"];
14721475
///
1473-
/// assert_eq!(&gr1[..], b);
1476+
/// assert_eq!(gr1.as_slice(), b);
14741477
///
14751478
/// let gr2 = "a\r\nb🇷🇺🇸🇹".graphemes(true).collect::<Vec<&str>>();
14761479
/// let b: &[_] = &["a", "\r\n", "b", "🇷🇺🇸🇹"];
14771480
///
1478-
/// assert_eq!(&gr2[..], b);
1481+
/// assert_eq!(gr2.as_slice(), b);
14791482
/// ```
14801483
#[unstable(feature = "unicode",
14811484
reason = "this functionality may only be provided by libunicode")]
@@ -1493,7 +1496,7 @@ impl str {
14931496
/// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::<Vec<(usize, &str)>>();
14941497
/// let b: &[_] = &[(0, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")];
14951498
///
1496-
/// assert_eq!(&gr_inds[..], b);
1499+
/// assert_eq!(gr_inds.as_slice(), b);
14971500
/// ```
14981501
#[unstable(feature = "unicode",
14991502
reason = "this functionality may only be provided by libunicode")]

branches/auto/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
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[..], "hello");
96+
/// assert_eq!(s.as_slice(), "hello");
9797
/// ```
9898
#[inline]
9999
#[unstable(feature = "collections",

branches/auto/src/libcollections/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,13 +823,13 @@ impl<T> Vec<T> {
823823
/// # #![feature(collections, core)]
824824
/// let v = vec![0, 1, 2];
825825
/// let w = v.map_in_place(|i| i + 3);
826-
/// assert_eq!(&w[..], &[3, 4, 5]);
826+
/// assert_eq!(w.as_slice(), [3, 4, 5].as_slice());
827827
///
828828
/// #[derive(PartialEq, Debug)]
829829
/// struct Newtype(u8);
830830
/// let bytes = vec![0x11, 0x22];
831831
/// let newtyped_bytes = bytes.map_in_place(|x| Newtype(x));
832-
/// assert_eq!(&newtyped_bytes[..], &[Newtype(0x11), Newtype(0x22)]);
832+
/// assert_eq!(newtyped_bytes.as_slice(), [Newtype(0x11), Newtype(0x22)].as_slice());
833833
/// ```
834834
#[unstable(feature = "collections",
835835
reason = "API may change to provide stronger guarantees")]

branches/auto/src/libcollections/vec_deque.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +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)]
2928
use core::num::wrapping::WrappingOps;
3029
use core::ops::{Index, IndexMut};
3130
use core::ptr::{self, Unique};
@@ -527,8 +526,7 @@ impl<T> VecDeque<T> {
527526
/// buf.push_back(3);
528527
/// buf.push_back(4);
529528
/// let b: &[_] = &[&5, &3, &4];
530-
/// let c: Vec<&i32> = buf.iter().collect();
531-
/// assert_eq!(&c[..], b);
529+
/// assert_eq!(buf.iter().collect::<Vec<&i32>>().as_slice(), b);
532530
/// ```
533531
#[stable(feature = "rust1", since = "1.0.0")]
534532
pub fn iter(&self) -> Iter<T> {

branches/auto/src/libcollectionstest/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ use std::fmt;
1313
#[test]
1414
fn test_format() {
1515
let s = fmt::format(format_args!("Hello, {}!", "world"));
16-
assert_eq!(&s[..], "Hello, world!");
16+
assert_eq!(s.as_slice(), "Hello, world!");
1717
}

branches/auto/src/libcollectionstest/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn test_from_elem() {
5959
// Test on-heap from_elem.
6060
v = vec![20; 6];
6161
{
62-
let v = &v[..];
62+
let v = v.as_slice();
6363
assert_eq!(v[0], 20);
6464
assert_eq!(v[1], 20);
6565
assert_eq!(v[2], 20);

branches/auto/src/libcollectionstest/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,9 +1470,9 @@ fn test_split_strator() {
14701470
fn test_str_default() {
14711471
use std::default::Default;
14721472

1473-
fn t<S: Default + AsRef<str>>() {
1473+
fn t<S: Default + Str>() {
14741474
let s: S = Default::default();
1475-
assert_eq!(s.as_ref(), "");
1475+
assert_eq!(s.as_slice(), "");
14761476
}
14771477

14781478
t::<&str>();

branches/auto/src/libcore/any.rs

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

branches/auto/src/libcore/cmp.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
//!
2121
//! ```
2222
//! # #![feature(core)]
23+
//! use std::num::SignedInt;
24+
//!
2325
//! struct FuzzyNum {
2426
//! num: i32,
2527
//! }
@@ -360,8 +362,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
360362

361363
/// Compare and return the minimum of two values.
362364
///
363-
/// Returns the first argument if the comparison determines them to be equal.
364-
///
365365
/// # Examples
366366
///
367367
/// ```
@@ -373,13 +373,11 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
373373
#[inline]
374374
#[stable(feature = "rust1", since = "1.0.0")]
375375
pub fn min<T: Ord>(v1: T, v2: T) -> T {
376-
if v1 <= v2 { v1 } else { v2 }
376+
if v1 < v2 { v1 } else { v2 }
377377
}
378378

379379
/// Compare and return the maximum of two values.
380380
///
381-
/// Returns the second argument if the comparison determines them to be equal.
382-
///
383381
/// # Examples
384382
///
385383
/// ```
@@ -391,7 +389,7 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
391389
#[inline]
392390
#[stable(feature = "rust1", since = "1.0.0")]
393391
pub fn max<T: Ord>(v1: T, v2: T) -> T {
394-
if v2 >= v1 { v2 } else { v1 }
392+
if v1 > v2 { v1 } else { v2 }
395393
}
396394

397395
/// Compare and return the minimum of two values if there is one.
@@ -429,7 +427,7 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
429427

430428
/// Compare and return the maximum of two values if there is one.
431429
///
432-
/// Returns the second argument if the comparison determines them to be equal.
430+
/// Returns the first argument if the comparison determines them to be equal.
433431
///
434432
/// # Examples
435433
///
@@ -454,8 +452,8 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
454452
#[unstable(feature = "core")]
455453
pub fn partial_max<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
456454
match v1.partial_cmp(&v2) {
457-
Some(Equal) | Some(Less) => Some(v2),
458-
Some(Greater) => Some(v1),
455+
Some(Less) => Some(v2),
456+
Some(Equal) | Some(Greater) => Some(v1),
459457
None => None
460458
}
461459
}

branches/auto/src/libcore/fmt/num.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ trait GenericRadix {
3333
fn digit(&self, x: u8) -> u8;
3434

3535
/// Format an integer using the radix using a formatter.
36-
#[allow(deprecated)] // Int
3736
fn fmt_int<T: Int>(&self, mut x: T, f: &mut fmt::Formatter) -> fmt::Result {
3837
// The radix can be as low as 2, so we need a buffer of at least 64
3938
// characters for a base 2 number.

0 commit comments

Comments
 (0)