diff options
| author | Ashley Mannix <ashleymannix@live.com.au> | 2020-05-23 15:17:19 +1000 |
|---|---|---|
| committer | Ashley Mannix <ashleymannix@live.com.au> | 2020-07-28 13:30:29 +1000 |
| commit | cac16c9793ef78b16f1da948bb3cd55599591ffb (patch) | |
| tree | 5e6dd86cca748f9d83cb84d4819adfdd348d128f | |
| parent | ac48e62db85e6db4bbe026490381ab205f4a614d (diff) | |
| download | rust-cac16c9793ef78b16f1da948bb3cd55599591ffb.tar.gz rust-cac16c9793ef78b16f1da948bb3cd55599591ffb.zip | |
stabilize const_type_id feature
| -rw-r--r-- | library/core/src/any.rs | 2 | ||||
| -rw-r--r-- | library/core/src/intrinsics.rs | 2 | ||||
| -rw-r--r-- | library/core/src/lib.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/consts/const-typeid-of-rpass.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/consts/const-typeid-of.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/consts/const-typeid-of.stderr | 10 |
6 files changed, 2 insertions, 22 deletions
diff --git a/library/core/src/any.rs b/library/core/src/any.rs index 79b6304958d..f112d73cdca 100644 --- a/library/core/src/any.rs +++ b/library/core/src/any.rs @@ -435,7 +435,7 @@ impl TypeId { /// assert_eq!(is_string(&"cookie monster".to_string()), true); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_type_id", issue = "41875")] + #[rustc_const_stable(feature = "const_type_id", since = "1.45.0")] pub const fn of<T: ?Sized + 'static>() -> TypeId { TypeId { t: intrinsics::type_id::<T>() } } diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 71780361d29..b5dd92ecb15 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -1024,7 +1024,7 @@ extern "rust-intrinsic" { /// /// The stabilized version of this intrinsic is /// [`std::any::TypeId::of`](../../std/any/struct.TypeId.html#method.of) - #[rustc_const_unstable(feature = "const_type_id", issue = "41875")] + #[rustc_const_stable(feature = "const_type_id", since = "1.45.0")] pub fn type_id<T: ?Sized + 'static>() -> u64; /// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited: diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index e4b499a8022..c2bd5d16088 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -145,7 +145,6 @@ #![feature(maybe_uninit_slice)] #![feature(external_doc)] #![feature(associated_type_bounds)] -#![feature(const_type_id)] #![feature(const_caller_location)] #![feature(slice_ptr_get)] #![feature(no_niche)] // rust-lang/rust#68303 diff --git a/src/test/ui/consts/const-typeid-of-rpass.rs b/src/test/ui/consts/const-typeid-of-rpass.rs index 225acb60ac4..c49141050b2 100644 --- a/src/test/ui/consts/const-typeid-of-rpass.rs +++ b/src/test/ui/consts/const-typeid-of-rpass.rs @@ -1,6 +1,5 @@ // run-pass #![feature(core_intrinsics)] -#![feature(const_type_id)] use std::any::TypeId; diff --git a/src/test/ui/consts/const-typeid-of.rs b/src/test/ui/consts/const-typeid-of.rs deleted file mode 100644 index 3829c481da8..00000000000 --- a/src/test/ui/consts/const-typeid-of.rs +++ /dev/null @@ -1,8 +0,0 @@ -use std::any::TypeId; - -struct A; - -fn main() { - const A_ID: TypeId = TypeId::of::<A>(); - //~^ ERROR `std::any::TypeId::of` is not yet stable as a const fn -} diff --git a/src/test/ui/consts/const-typeid-of.stderr b/src/test/ui/consts/const-typeid-of.stderr deleted file mode 100644 index 05347fbc819..00000000000 --- a/src/test/ui/consts/const-typeid-of.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: `std::any::TypeId::of` is not yet stable as a const fn - --> $DIR/const-typeid-of.rs:6:26 - | -LL | const A_ID: TypeId = TypeId::of::<A>(); - | ^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(const_type_id)]` to the crate attributes to enable - -error: aborting due to previous error - |
