-
Notifications
You must be signed in to change notification settings - Fork 13.9k
std: Stabilize TypeId and tweak BoxAny #21165
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
Conversation
|
r? @aturon |
|
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
src/libcore/any.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo limitation
5a234b8 to
d72e978
Compare
|
OK, I'm happy with this, but want to get @nikomatsakis's opinion as well. |
src/libcore/any.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So obviously the key question is this function, right? I'm roughly willing to go with this, but I'd like to get a better understanding of whether we could get by with some kind of bound here.
|
On Thu, Jan 15, 2015 at 10:51:22AM -0800, Aaron Turon wrote:
After discussing with @reem in IRC, it seems like we want to move to a
@flaper87 is actually pretty close to having the In the meantime it might make sense to keep |
d72e978 to
80d73e9
Compare
|
r? @aturon I've marked |
|
Sidenote: the (currently stable) blanket impl for |
|
It will actually require a |
This commit aims to stabilize the `TypeId` abstraction by moving it out of the `intrinsics` module into the `any` module of the standard library. Specifically, * `TypeId` is now defined at `std::any::TypeId` * `TypeId::hash` has been removed in favor of an implementation of `Hash`. This commit also performs a final pass over the `any` module, confirming the following: * `Any::get_type_id` remains unstable as *usage* of the `Any` trait will likely never require this, and the `Any` trait does not need to be implemented for any other types. As a result, this implementation detail can remain unstable until associated statics are implemented. * `Any::downcast_ref` is now stable * `Any::downcast_mut` is now stable * `BoxAny` remains unstable. While a direct impl on `Box<Any>` is allowed today it does not allow downcasting of trait objects like `Box<Any + Send>` (those returned from `Thread::join`). This is covered by #18737. * `BoxAny::downcast` is now stable.
|
@bors: retry |
80d73e9 to
e1e0450
Compare
|
@bors r=aturon e1e0450 |
This commit aims to stabilize the `TypeId` abstraction by moving it out of the `intrinsics` module into the `any` module of the standard library. Specifically, * `TypeId` is now defined at `std::any::TypeId` * `TypeId::hash` has been removed in favor of an implementation of `Hash`. This commit also performs a final pass over the `any` module, confirming the following: * `Any::get_type_id` remains unstable as *usage* of the `Any` trait will likely never require this, and the `Any` trait does not need to be implemented for any other types. As a result, this implementation detail can remain unstable until associated statics are implemented. * `Any::downcast_ref` is now stable * `Any::downcast_mut` is now stable * `BoxAny` remains unstable. While a direct impl on `Box<Any>` is allowed today it does not allow downcasting of trait objects like `Box<Any + Send>` (those returned from `Thread::join`). This is covered by rust-lang#18737. * `BoxAny::downcast` is now stable.
e1e0450 to
70f7165
Compare
|
@bors: r=aturon 70f165 |
|
🙀 You have the wrong number! Please try again with |
This commit aims to stabilize the `TypeId` abstraction by moving it out of the `intrinsics` module into the `any` module of the standard library. Specifically, * `TypeId` is now defined at `std::any::TypeId` * `TypeId::hash` has been removed in favor of an implementation of `Hash`. This commit also performs a final pass over the `any` module, confirming the following: * `Any::get_type_id` remains unstable as *usage* of the `Any` trait will likely never require this, and the `Any` trait does not need to be implemented for any other types. As a result, this implementation detail can remain unstable until associated statics are implemented. * `Any::downcast_ref` is now stable * `Any::downcast_mut` is now stable * `BoxAny` remains unstable. While a direct impl on `Box<Any>` is allowed today it does not allow downcasting of trait objects like `Box<Any + Send>` (those returned from `Thread::join`). This is covered by #18737. * `BoxAny::downcast` is now stable.
This commit aims to stabilize the
TypeIdabstraction by moving it out of theintrinsicsmodule into theanymodule of the standard library. Specifically,TypeIdis now defined atstd::any::TypeIdTypeId::hashhas been removed in favor of an implementation ofHash.This commit also performs a final pass over the
anymodule, confirming thefollowing:
Any::get_type_idremains unstable as usage of theAnytrait will likelynever require this, and the
Anytrait does not need to be implemented forany other types. As a result, this implementation detail can remain unstable
until associated statics are implemented.
Any::downcast_refis now stableAny::downcast_mutis now stableBoxAnyremains unstable. While a direct impl onBox<Any>is allowed todayit does not allow downcasting of trait objects like
Box<Any + Send>(thosereturned from
Thread::join). This is covered by Replace current quasi-subtyping relationship for object types with coercions #18737.BoxAny::downcastis now stable.