diff --git a/library/core/src/any.rs b/library/core/src/any.rs index 79b6304958d51..b28471337c6be 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.46.0")] pub const fn of() -> TypeId { TypeId { t: intrinsics::type_id::() } } diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 71780361d298e..585e54342b773 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.46.0")] pub fn type_id() -> 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 e4b499a80229c..c2bd5d16088fd 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 225acb60ac44d..c49141050b20f 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 3829c481da837..0000000000000 --- 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::(); - //~^ 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 05347fbc81950..0000000000000 --- 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::(); - | ^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(const_type_id)]` to the crate attributes to enable - -error: aborting due to previous error - diff --git a/src/test/ui/consts/issue-73976-monomorphic.rs b/src/test/ui/consts/issue-73976-monomorphic.rs index 7706a97f23b48..1db0fdc87c37e 100644 --- a/src/test/ui/consts/issue-73976-monomorphic.rs +++ b/src/test/ui/consts/issue-73976-monomorphic.rs @@ -5,7 +5,6 @@ // will be properly rejected. This test will ensure that monomorphic use of these // would not be wrongly rejected in patterns. -#![feature(const_type_id)] #![feature(const_type_name)] use std::any::{self, TypeId}; diff --git a/src/test/ui/consts/issue-73976-polymorphic.rs b/src/test/ui/consts/issue-73976-polymorphic.rs index 28b84518719a1..7cf20296062ab 100644 --- a/src/test/ui/consts/issue-73976-polymorphic.rs +++ b/src/test/ui/consts/issue-73976-polymorphic.rs @@ -5,7 +5,6 @@ // This test case should either run-pass or be rejected at compile time. // Currently we just disallow this usage and require pattern is monomorphic. -#![feature(const_type_id)] #![feature(const_type_name)] use std::any::{self, TypeId}; diff --git a/src/test/ui/consts/issue-73976-polymorphic.stderr b/src/test/ui/consts/issue-73976-polymorphic.stderr index c90ce2bd06a67..971573e14aad8 100644 --- a/src/test/ui/consts/issue-73976-polymorphic.stderr +++ b/src/test/ui/consts/issue-73976-polymorphic.stderr @@ -1,23 +1,23 @@ error: could not evaluate constant pattern - --> $DIR/issue-73976-polymorphic.rs:20:37 + --> $DIR/issue-73976-polymorphic.rs:19:37 | LL | matches!(GetTypeId::::VALUE, GetTypeId::::VALUE) | ^^^^^^^^^^^^^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/issue-73976-polymorphic.rs:32:42 + --> $DIR/issue-73976-polymorphic.rs:31:42 | LL | matches!(GetTypeNameLen::::VALUE, GetTypeNameLen::::VALUE) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/issue-73976-polymorphic.rs:20:37 + --> $DIR/issue-73976-polymorphic.rs:19:37 | LL | matches!(GetTypeId::::VALUE, GetTypeId::::VALUE) | ^^^^^^^^^^^^^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/issue-73976-polymorphic.rs:32:42 + --> $DIR/issue-73976-polymorphic.rs:31:42 | LL | matches!(GetTypeNameLen::::VALUE, GetTypeNameLen::::VALUE) | ^^^^^^^^^^^^^^^^^^^^^^^^^^