Deprecate Reflect
[tracking issue](https://github.com/rust-lang/rust/issues/27749)
This commit is contained in:
parent
a94f5934cd
commit
14c62f91b7
@ -73,7 +73,6 @@
|
||||
|
||||
use fmt;
|
||||
use intrinsics;
|
||||
use marker::Reflect;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Any trait
|
||||
@ -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
|
||||
@ -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>() }
|
||||
}
|
||||
|
||||
@ -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>() },
|
||||
}
|
||||
|
@ -587,6 +587,7 @@ 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 {}
|
||||
@ -594,4 +595,6 @@ 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 .. { }
|
||||
|
@ -55,7 +55,6 @@ use any::TypeId;
|
||||
use cell;
|
||||
use char;
|
||||
use fmt::{self, Debug, Display};
|
||||
use marker::Reflect;
|
||||
use mem::transmute;
|
||||
use num;
|
||||
use str;
|
||||
@ -63,7 +62,7 @@ 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
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
use io::prelude::*;
|
||||
|
||||
use marker::Reflect;
|
||||
use cmp;
|
||||
use error;
|
||||
use fmt;
|
||||
@ -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())
|
||||
}
|
||||
|
@ -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)]
|
||||
|
@ -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")]
|
||||
@ -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"
|
||||
}
|
||||
@ -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 {
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
use error::{Error};
|
||||
use fmt;
|
||||
use marker::Reflect;
|
||||
use sync::atomic::{AtomicBool, Ordering};
|
||||
use thread;
|
||||
|
||||
@ -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"
|
||||
}
|
||||
@ -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(),
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user