stabilize const_type_id feature
This commit is contained in:
parent
ac48e62db8
commit
cac16c9793
6 changed files with 2 additions and 22 deletions
|
@ -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>() }
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// run-pass
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(const_type_id)]
|
||||
|
||||
use std::any::TypeId;
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
|
Loading…
Add table
Reference in a new issue