Skip to content

Rollup of 4 pull requests #23887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
26 changes: 6 additions & 20 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,24 +233,10 @@ impl<T: ?Sized + Hash> Hash for Box<T> {
}
}

/// Extension methods for an owning `Any` trait object.
#[unstable(feature = "alloc",
reason = "this trait will likely disappear once compiler bugs blocking \
a direct impl on `Box<Any>` have been fixed ")]
// FIXME(#18737): this should be a direct impl on `Box<Any>`. If you're
// removing this please make sure that you can downcase on
// `Box<Any + Send>` as well as `Box<Any>`
pub trait BoxAny {
/// Returns the boxed value if it is of type `T`, or
/// `Err(Self)` if it isn't.
#[stable(feature = "rust1", since = "1.0.0")]
fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>>;
}

#[stable(feature = "rust1", since = "1.0.0")]
impl BoxAny for Box<Any> {
impl Box<Any> {
#[inline]
fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
#[stable(feature = "rust1", since = "1.0.0")]
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
if self.is::<T>() {
unsafe {
// Get the raw representation of the trait object
Expand All @@ -267,10 +253,10 @@ impl BoxAny for Box<Any> {
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl BoxAny for Box<Any+Send> {
impl Box<Any+Send> {
#[inline]
fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
#[stable(feature = "rust1", since = "1.0.0")]
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
<Box<Any>>::downcast(self)
}
}
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/boxed_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use core::clone::Clone;

use std::boxed;
use std::boxed::Box;
use std::boxed::BoxAny;

#[test]
fn test_owned_clone() {
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ mod imp {
use core::option::Option;
use core::option::Option::None;
use core::ptr::{null_mut, null};
use core::num::Int;
use libc::{c_char, c_int, c_void, size_t};
use super::MIN_ALIGN;

Expand Down
1 change: 0 additions & 1 deletion src/libcollections/bit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ use core::hash;
use core::iter::RandomAccessIterator;
use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
use core::iter::{self, FromIterator, IntoIterator};
use core::num::Int;
use core::ops::Index;
use core::slice;
use core::{u8, u32, usize};
Expand Down
1 change: 0 additions & 1 deletion src/libcollections/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use core::prelude::*;
use core::marker;
use core::fmt;
use core::num::Int;
use core::iter::{FromIterator, IntoIterator};
use core::ops::{Sub, BitOr, BitAnd, BitXor};

Expand Down
1 change: 1 addition & 0 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ use core::iter::MultiplicativeIterator;
use core::marker::Sized;
use core::mem::size_of;
use core::mem;
#[cfg(stage0)]
use core::num::wrapping::WrappingOps;
use core::ops::FnMut;
use core::option::Option::{self, Some, None};
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
//! (see below). It is not possible to move out of borrowed strings because they
//! are owned elsewhere.
//!
//! Basic operations are implemented directly by the compiler, but more advanced
//! operations are defined as methods on the `str` type.
//!
//! # Examples
//!
//! Here's some code that uses a `&str`:
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use core::default::Default;
use core::fmt;
use core::iter::{self, repeat, FromIterator, IntoIterator, RandomAccessIterator};
use core::mem;
#[cfg(stage0)]
use core::num::wrapping::WrappingOps;
use core::ops::{Index, IndexMut};
use core::ptr::{self, Unique};
Expand Down
3 changes: 1 addition & 2 deletions src/libcore/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ pub struct TypeId {
impl TypeId {
/// Returns the `TypeId` of the type this generic function has been
/// instantiated with
#[unstable(feature = "core",
reason = "may grow a `Reflect` bound soon via marker traits")]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn of<T: ?Sized + Any>() -> TypeId {
TypeId {
t: unsafe { intrinsics::type_id::<T>() },
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
//!
//! ```
//! # #![feature(core)]
//! use std::num::SignedInt;
//!
//! struct FuzzyNum {
//! num: i32,
//! }
Expand Down
1 change: 1 addition & 0 deletions src/libcore/fmt/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ trait GenericRadix {
fn digit(&self, x: u8) -> u8;

/// Format an integer using the radix using a formatter.
#[allow(deprecated)] // Int
fn fmt_int<T: Int>(&self, mut x: T, f: &mut fmt::Formatter) -> fmt::Result {
// The radix can be as low as 2, so we need a buffer of at least 64
// characters for a base 2 number.
Expand Down
5 changes: 3 additions & 2 deletions src/libcore/hash/sip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@

//! An implementation of SipHash 2-4.

#![allow(deprecated)] // until the next snapshot for inherent wrapping ops

use prelude::*;
use default::Default;
use num::wrapping::WrappingOps;
use super::Hasher;

/// An implementation of SipHash 2-4.
Expand Down Expand Up @@ -71,7 +72,7 @@ macro_rules! u8to64_le {

macro_rules! rotl {
($x:expr, $b:expr) =>
(($x << $b) | ($x >> (64.wrapping_sub($b))))
(($x << $b) | ($x >> (64_i32.wrapping_sub($b))))
}

macro_rules! compress {
Expand Down
Loading