Skip to content

Commit f1594d6

Browse files
committed
---
yaml --- r: 195470 b: refs/heads/master c: acdb0f9 h: refs/heads/master v: v3
1 parent 50e9434 commit f1594d6

Some content is hidden

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

86 files changed

+1522
-1410
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 5872ae4a7a76ba67e702323d2de09a86fb5ba692
2+
refs/heads/master: acdb0f9c788dca961d2b6cd5ca5304d4c63768a0
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b3317d68910900f135f9f38e43a7a699bc736b4a
55
refs/heads/try: 961e0358e1a5c0faaef606e31e9965742c1643bf

trunk/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
/// });

trunk/src/liballoc/boxed.rs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

trunk/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() {

trunk/src/liballoc/heap.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ 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;
193192
use libc::{c_char, c_int, c_void, size_t};
194193
use super::MIN_ALIGN;
195194

trunk/src/libcollections/bit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ 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;
9594
use core::ops::Index;
9695
use core::slice;
9796
use core::{u8, u32, usize};

trunk/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 {

trunk/src/libcollections/enum_set.rs

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

trunk/src/libcollections/slice.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ use core::iter::MultiplicativeIterator;
8989
use core::marker::Sized;
9090
use core::mem::size_of;
9191
use core::mem;
92+
#[cfg(stage0)]
9293
use core::num::wrapping::WrappingOps;
9394
use core::ops::FnMut;
9495
use core::option::Option::{self, Some, None};
@@ -556,7 +557,6 @@ impl<T> [T] {
556557
/// ```rust
557558
/// # #![feature(core)]
558559
/// 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,7 +923,6 @@ 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();
927926
///
928927
/// assert_eq!(s.binary_search(&13), Ok(9));
929928
/// assert_eq!(s.binary_search(&4), Err(7));

trunk/src/libcollections/str.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
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-
//!
2421
//! # Examples
2522
//!
2623
//! Here's some code that uses a `&str`:
@@ -1473,12 +1470,12 @@ impl str {
14731470
/// let gr1 = "a\u{310}e\u{301}o\u{308}\u{332}".graphemes(true).collect::<Vec<&str>>();
14741471
/// let b: &[_] = &["a\u{310}", "e\u{301}", "o\u{308}\u{332}"];
14751472
///
1476-
/// assert_eq!(gr1.as_slice(), b);
1473+
/// assert_eq!(&gr1[..], b);
14771474
///
14781475
/// let gr2 = "a\r\nb🇷🇺🇸🇹".graphemes(true).collect::<Vec<&str>>();
14791476
/// let b: &[_] = &["a", "\r\n", "b", "🇷🇺🇸🇹"];
14801477
///
1481-
/// assert_eq!(gr2.as_slice(), b);
1478+
/// assert_eq!(&gr2[..], b);
14821479
/// ```
14831480
#[unstable(feature = "unicode",
14841481
reason = "this functionality may only be provided by libunicode")]
@@ -1496,7 +1493,7 @@ impl str {
14961493
/// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::<Vec<(usize, &str)>>();
14971494
/// let b: &[_] = &[(0, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")];
14981495
///
1499-
/// assert_eq!(gr_inds.as_slice(), b);
1496+
/// assert_eq!(&gr_inds[..], b);
15001497
/// ```
15011498
#[unstable(feature = "unicode",
15021499
reason = "this functionality may only be provided by libunicode")]

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

trunk/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.as_slice(), [3, 4, 5].as_slice());
826+
/// assert_eq!(&w[..], &[3, 4, 5]);
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.as_slice(), [Newtype(0x11), Newtype(0x22)].as_slice());
832+
/// assert_eq!(&newtyped_bytes[..], &[Newtype(0x11), Newtype(0x22)]);
833833
/// ```
834834
#[unstable(feature = "collections",
835835
reason = "API may change to provide stronger guarantees")]

trunk/src/libcollections/vec_deque.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use core::default::Default;
2525
use core::fmt;
2626
use core::iter::{self, repeat, FromIterator, IntoIterator, RandomAccessIterator};
2727
use core::mem;
28+
#[cfg(stage0)]
2829
use core::num::wrapping::WrappingOps;
2930
use core::ops::{Index, IndexMut};
3031
use core::ptr::{self, Unique};
@@ -526,7 +527,8 @@ impl<T> VecDeque<T> {
526527
/// buf.push_back(3);
527528
/// buf.push_back(4);
528529
/// let b: &[_] = &[&5, &3, &4];
529-
/// assert_eq!(buf.iter().collect::<Vec<&i32>>().as_slice(), b);
530+
/// let c: Vec<&i32> = buf.iter().collect();
531+
/// assert_eq!(&c[..], b);
530532
/// ```
531533
#[stable(feature = "rust1", since = "1.0.0")]
532534
pub fn iter(&self) -> Iter<T> {

trunk/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.as_slice(), "Hello, world!");
16+
assert_eq!(&s[..], "Hello, world!");
1717
}

trunk/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.as_slice();
62+
let v = &v[..];
6363
assert_eq!(v[0], 20);
6464
assert_eq!(v[1], 20);
6565
assert_eq!(v[2], 20);

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

14781478
t::<&str>();

trunk/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>() },

trunk/src/libcore/cmp.rs

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

363361
/// Compare and return the minimum of two values.
364362
///
363+
/// Returns the first argument if the comparison determines them to be equal.
364+
///
365365
/// # Examples
366366
///
367367
/// ```
@@ -373,11 +373,13 @@ 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+
///
381383
/// # Examples
382384
///
383385
/// ```
@@ -389,7 +391,7 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
389391
#[inline]
390392
#[stable(feature = "rust1", since = "1.0.0")]
391393
pub fn max<T: Ord>(v1: T, v2: T) -> T {
392-
if v1 > v2 { v1 } else { v2 }
394+
if v2 >= v1 { v2 } else { v1 }
393395
}
394396

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

428430
/// Compare and return the maximum of two values if there is one.
429431
///
430-
/// Returns the first argument if the comparison determines them to be equal.
432+
/// Returns the second argument if the comparison determines them to be equal.
431433
///
432434
/// # Examples
433435
///
@@ -452,8 +454,8 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
452454
#[unstable(feature = "core")]
453455
pub fn partial_max<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
454456
match v1.partial_cmp(&v2) {
455-
Some(Less) => Some(v2),
456-
Some(Equal) | Some(Greater) => Some(v1),
457+
Some(Equal) | Some(Less) => Some(v2),
458+
Some(Greater) => Some(v1),
457459
None => None
458460
}
459461
}

trunk/src/libcore/fmt/num.rs

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

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

0 commit comments

Comments
 (0)