提交 9b2c8d86 编写于 作者: A Ashley Mannix

revert const_type_id stabilization

This reverts commit e3856616.
上级 e0bc2675
......@@ -435,7 +435,7 @@ impl TypeId {
/// assert_eq!(is_string(&"cookie monster".to_string()), true);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_type_id", since = "1.46.0")]
#[rustc_const_unstable(feature = "const_type_id", issue = "63084")]
pub const fn of<T: ?Sized + 'static>() -> TypeId {
TypeId { t: intrinsics::type_id::<T>() }
}
......
......@@ -807,7 +807,7 @@
/// crate it is invoked in.
///
/// The stabilized version of this intrinsic is [`crate::any::TypeId::of`].
#[rustc_const_stable(feature = "const_type_id", since = "1.46.0")]
#[rustc_const_unstable(feature = "const_type_id", issue = "63084")]
pub fn type_id<T: ?Sized + 'static>() -> u64;
/// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited:
......
......@@ -90,6 +90,7 @@
#![feature(const_slice_ptr_len)]
#![feature(const_size_of_val)]
#![feature(const_align_of_val)]
#![feature(const_type_id)]
#![feature(const_type_name)]
#![feature(const_likely)]
#![feature(const_unreachable_unchecked)]
......
// run-pass
#![feature(const_type_id)]
#![feature(core_intrinsics)]
use std::any::TypeId;
......
......@@ -5,6 +5,7 @@
// 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};
......
......@@ -5,6 +5,7 @@
// 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};
......
error: constant pattern depends on a generic parameter
--> $DIR/issue-73976-polymorphic.rs:19:37
--> $DIR/issue-73976-polymorphic.rs:20:37
|
LL | matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^
error: constant pattern depends on a generic parameter
--> $DIR/issue-73976-polymorphic.rs:31:42
--> $DIR/issue-73976-polymorphic.rs:32:42
|
LL | matches!(GetTypeNameLen::<T>::VALUE, GetTypeNameLen::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant pattern depends on a generic parameter
--> $DIR/issue-73976-polymorphic.rs:19:37
--> $DIR/issue-73976-polymorphic.rs:20:37
|
LL | matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^
error: constant pattern depends on a generic parameter
--> $DIR/issue-73976-polymorphic.rs:31:42
--> $DIR/issue-73976-polymorphic.rs:32:42
|
LL | matches!(GetTypeNameLen::<T>::VALUE, GetTypeNameLen::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册