Skip to content

Commit

Permalink
Deprecate Reflect
Browse files Browse the repository at this point in the history
[tracking issue](#27749)
  • Loading branch information
nrc committed Oct 11, 2016
1 parent a94f593 commit 14c62f9
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 22 deletions.
7 changes: 3 additions & 4 deletions src/libcore/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@

use fmt;
use intrinsics;
use marker::Reflect;

///////////////////////////////////////////////////////////////////////////////
// Any trait
Expand All @@ -86,7 +85,7 @@ use marker::Reflect;
///
/// [mod]: index.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Any: Reflect + 'static {
pub trait Any: 'static {
/// Gets the `TypeId` of `self`.
///
/// # Examples
Expand All @@ -112,7 +111,7 @@ pub trait Any: Reflect + 'static {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Reflect + 'static + ?Sized > Any for T {
impl<T: 'static + ?Sized > Any for T {
fn get_type_id(&self) -> TypeId { TypeId::of::<T>() }
}

Expand Down Expand Up @@ -366,7 +365,7 @@ impl TypeId {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn of<T: ?Sized + Reflect + 'static>() -> TypeId {
pub fn of<T: ?Sized + 'static>() -> TypeId {
TypeId {
t: unsafe { intrinsics::type_id::<T>() },
}
Expand Down
3 changes: 3 additions & 0 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,14 @@ mod impls {
#[unstable(feature = "reflect_marker",
reason = "requires RFC and more experience",
issue = "27749")]
#[rustc_deprecated(since = "1.14.0", reason = "Specialization makes parametricity impossible")]
#[rustc_on_unimplemented = "`{Self}` does not implement `Any`; \
ensure all type parameters are bounded by `Any`"]
pub trait Reflect {}

#[unstable(feature = "reflect_marker",
reason = "requires RFC and more experience",
issue = "27749")]
#[rustc_deprecated(since = "1.14.0", reason = "Specialization makes parametricity impossible")]
#[allow(deprecated)]
impl Reflect for .. { }
3 changes: 1 addition & 2 deletions src/libstd/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@ use any::TypeId;
use cell;
use char;
use fmt::{self, Debug, Display};
use marker::Reflect;
use mem::transmute;
use num;
use str;
use string;

/// Base functionality for all errors in Rust.
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Error: Debug + Display + Reflect {
pub trait Error: Debug + Display {
/// A short description of the error.
///
/// The description should not contain newlines or sentence-ending
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/io/buffered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use io::prelude::*;

use marker::Reflect;
use cmp;
use error;
use fmt;
Expand Down Expand Up @@ -578,7 +577,7 @@ impl<W> From<IntoInnerError<W>> for Error {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<W: Reflect + Send + fmt::Debug> error::Error for IntoInnerError<W> {
impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
fn description(&self) -> &str {
error::Error::description(self.error())
}
Expand Down
1 change: 0 additions & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@
#![cfg_attr(stage0, feature(question_mark))]
#![feature(rand)]
#![feature(raw)]
#![feature(reflect_marker)]
#![feature(repr_simd)]
#![feature(rustc_attrs)]
#![feature(shared)]
Expand Down
5 changes: 2 additions & 3 deletions src/libstd/sync/mpsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ use error;
use fmt;
use mem;
use cell::UnsafeCell;
use marker::Reflect;
use time::{Duration, Instant};

#[unstable(feature = "mpsc_select", issue = "27800")]
Expand Down Expand Up @@ -1163,7 +1162,7 @@ impl<T> fmt::Display for SendError<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Send + Reflect> error::Error for SendError<T> {
impl<T: Send> error::Error for SendError<T> {
fn description(&self) -> &str {
"sending on a closed channel"
}
Expand Down Expand Up @@ -1198,7 +1197,7 @@ impl<T> fmt::Display for TrySendError<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Send + Reflect> error::Error for TrySendError<T> {
impl<T: Send> error::Error for TrySendError<T> {

fn description(&self) -> &str {
match *self {
Expand Down
5 changes: 2 additions & 3 deletions src/libstd/sys/common/poison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

use error::{Error};
use fmt;
use marker::Reflect;
use sync::atomic::{AtomicBool, Ordering};
use thread;

Expand Down Expand Up @@ -117,7 +116,7 @@ impl<T> fmt::Display for PoisonError<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Reflect> Error for PoisonError<T> {
impl<T> Error for PoisonError<T> {
fn description(&self) -> &str {
"poisoned lock: another task failed inside"
}
Expand Down Expand Up @@ -174,7 +173,7 @@ impl<T> fmt::Display for TryLockError<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Reflect> Error for TryLockError<T> {
impl<T> Error for TryLockError<T> {
fn description(&self) -> &str {
match *self {
TryLockError::Poisoned(ref p) => p.description(),
Expand Down
3 changes: 0 additions & 3 deletions src/test/compile-fail/issue-33876.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(reflect_marker)]

use std::marker::Reflect;
use std::any::Any;

struct Foo;
Expand Down
5 changes: 1 addition & 4 deletions src/test/run-pass/issue-19404.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(reflect_marker)]

use std::any::TypeId;
use std::marker::Reflect;
use std::rc::Rc;

type Fp<T> = Rc<T>;

struct Engine;

trait Component: 'static + Reflect {}
trait Component: 'static {}
impl Component for Engine {}

trait Env {
Expand Down

0 comments on commit 14c62f9

Please sign in to comment.