Skip to content

Commit 14c62f9

Browse files
committed
Deprecate Reflect
[tracking issue](#27749)
1 parent a94f593 commit 14c62f9

File tree

9 files changed

+13
-22
lines changed

9 files changed

+13
-22
lines changed

src/libcore/any.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373

7474
use fmt;
7575
use intrinsics;
76-
use marker::Reflect;
7776

7877
///////////////////////////////////////////////////////////////////////////////
7978
// Any trait
@@ -86,7 +85,7 @@ use marker::Reflect;
8685
///
8786
/// [mod]: index.html
8887
#[stable(feature = "rust1", since = "1.0.0")]
89-
pub trait Any: Reflect + 'static {
88+
pub trait Any: 'static {
9089
/// Gets the `TypeId` of `self`.
9190
///
9291
/// # Examples
@@ -112,7 +111,7 @@ pub trait Any: Reflect + 'static {
112111
}
113112

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

@@ -366,7 +365,7 @@ impl TypeId {
366365
/// }
367366
/// ```
368367
#[stable(feature = "rust1", since = "1.0.0")]
369-
pub fn of<T: ?Sized + Reflect + 'static>() -> TypeId {
368+
pub fn of<T: ?Sized + 'static>() -> TypeId {
370369
TypeId {
371370
t: unsafe { intrinsics::type_id::<T>() },
372371
}

src/libcore/marker.rs

+3
Original file line numberDiff line numberDiff line change
@@ -587,11 +587,14 @@ mod impls {
587587
#[unstable(feature = "reflect_marker",
588588
reason = "requires RFC and more experience",
589589
issue = "27749")]
590+
#[rustc_deprecated(since = "1.14.0", reason = "Specialization makes parametricity impossible")]
590591
#[rustc_on_unimplemented = "`{Self}` does not implement `Any`; \
591592
ensure all type parameters are bounded by `Any`"]
592593
pub trait Reflect {}
593594

594595
#[unstable(feature = "reflect_marker",
595596
reason = "requires RFC and more experience",
596597
issue = "27749")]
598+
#[rustc_deprecated(since = "1.14.0", reason = "Specialization makes parametricity impossible")]
599+
#[allow(deprecated)]
597600
impl Reflect for .. { }

src/libstd/error.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ use any::TypeId;
5555
use cell;
5656
use char;
5757
use fmt::{self, Debug, Display};
58-
use marker::Reflect;
5958
use mem::transmute;
6059
use num;
6160
use str;
6261
use string;
6362

6463
/// Base functionality for all errors in Rust.
6564
#[stable(feature = "rust1", since = "1.0.0")]
66-
pub trait Error: Debug + Display + Reflect {
65+
pub trait Error: Debug + Display {
6766
/// A short description of the error.
6867
///
6968
/// The description should not contain newlines or sentence-ending

src/libstd/io/buffered.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
1313
use io::prelude::*;
1414

15-
use marker::Reflect;
1615
use cmp;
1716
use error;
1817
use fmt;
@@ -578,7 +577,7 @@ impl<W> From<IntoInnerError<W>> for Error {
578577
}
579578

580579
#[stable(feature = "rust1", since = "1.0.0")]
581-
impl<W: Reflect + Send + fmt::Debug> error::Error for IntoInnerError<W> {
580+
impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
582581
fn description(&self) -> &str {
583582
error::Error::description(self.error())
584583
}

src/libstd/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@
258258
#![cfg_attr(stage0, feature(question_mark))]
259259
#![feature(rand)]
260260
#![feature(raw)]
261-
#![feature(reflect_marker)]
262261
#![feature(repr_simd)]
263262
#![feature(rustc_attrs)]
264263
#![feature(shared)]

src/libstd/sync/mpsc/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ use error;
270270
use fmt;
271271
use mem;
272272
use cell::UnsafeCell;
273-
use marker::Reflect;
274273
use time::{Duration, Instant};
275274

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

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

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

12031202
fn description(&self) -> &str {
12041203
match *self {

src/libstd/sys/common/poison.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use error::{Error};
1212
use fmt;
13-
use marker::Reflect;
1413
use sync::atomic::{AtomicBool, Ordering};
1514
use thread;
1615

@@ -117,7 +116,7 @@ impl<T> fmt::Display for PoisonError<T> {
117116
}
118117

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

176175
#[stable(feature = "rust1", since = "1.0.0")]
177-
impl<T: Reflect> Error for TryLockError<T> {
176+
impl<T> Error for TryLockError<T> {
178177
fn description(&self) -> &str {
179178
match *self {
180179
TryLockError::Poisoned(ref p) => p.description(),

src/test/compile-fail/issue-33876.rs

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(reflect_marker)]
12-
13-
use std::marker::Reflect;
1411
use std::any::Any;
1512

1613
struct Foo;

src/test/run-pass/issue-19404.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(reflect_marker)]
12-
1311
use std::any::TypeId;
14-
use std::marker::Reflect;
1512
use std::rc::Rc;
1613

1714
type Fp<T> = Rc<T>;
1815

1916
struct Engine;
2017

21-
trait Component: 'static + Reflect {}
18+
trait Component: 'static {}
2219
impl Component for Engine {}
2320

2421
trait Env {

0 commit comments

Comments
 (0)