Skip to content

Commit 9b2c8d8

Browse files
committed
revert const_type_id stabilization
This reverts commit e385661.
1 parent e0bc267 commit 9b2c8d8

File tree

7 files changed

+10
-6
lines changed

7 files changed

+10
-6
lines changed

library/core/src/any.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ impl TypeId {
435435
/// assert_eq!(is_string(&"cookie monster".to_string()), true);
436436
/// ```
437437
#[stable(feature = "rust1", since = "1.0.0")]
438-
#[rustc_const_stable(feature = "const_type_id", since = "1.46.0")]
438+
#[rustc_const_unstable(feature = "const_type_id", issue = "63084")]
439439
pub const fn of<T: ?Sized + 'static>() -> TypeId {
440440
TypeId { t: intrinsics::type_id::<T>() }
441441
}

library/core/src/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ extern "rust-intrinsic" {
807807
/// crate it is invoked in.
808808
///
809809
/// The stabilized version of this intrinsic is [`crate::any::TypeId::of`].
810-
#[rustc_const_stable(feature = "const_type_id", since = "1.46.0")]
810+
#[rustc_const_unstable(feature = "const_type_id", issue = "63084")]
811811
pub fn type_id<T: ?Sized + 'static>() -> u64;
812812

813813
/// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited:

library/core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
#![feature(const_slice_ptr_len)]
9191
#![feature(const_size_of_val)]
9292
#![feature(const_align_of_val)]
93+
#![feature(const_type_id)]
9394
#![feature(const_type_name)]
9495
#![feature(const_likely)]
9596
#![feature(const_unreachable_unchecked)]

src/test/ui/consts/const-typeid-of-rpass.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// run-pass
2+
#![feature(const_type_id)]
23
#![feature(core_intrinsics)]
34

45
use std::any::TypeId;

src/test/ui/consts/issue-73976-monomorphic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// will be properly rejected. This test will ensure that monomorphic use of these
66
// would not be wrongly rejected in patterns.
77

8+
#![feature(const_type_id)]
89
#![feature(const_type_name)]
910

1011
use std::any::{self, TypeId};

src/test/ui/consts/issue-73976-polymorphic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// This test case should either run-pass or be rejected at compile time.
66
// Currently we just disallow this usage and require pattern is monomorphic.
77

8+
#![feature(const_type_id)]
89
#![feature(const_type_name)]
910

1011
use std::any::{self, TypeId};

src/test/ui/consts/issue-73976-polymorphic.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error: constant pattern depends on a generic parameter
2-
--> $DIR/issue-73976-polymorphic.rs:19:37
2+
--> $DIR/issue-73976-polymorphic.rs:20:37
33
|
44
LL | matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
55
| ^^^^^^^^^^^^^^^^^^^^^
66

77
error: constant pattern depends on a generic parameter
8-
--> $DIR/issue-73976-polymorphic.rs:31:42
8+
--> $DIR/issue-73976-polymorphic.rs:32:42
99
|
1010
LL | matches!(GetTypeNameLen::<T>::VALUE, GetTypeNameLen::<T>::VALUE)
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: constant pattern depends on a generic parameter
14-
--> $DIR/issue-73976-polymorphic.rs:19:37
14+
--> $DIR/issue-73976-polymorphic.rs:20:37
1515
|
1616
LL | matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
1717
| ^^^^^^^^^^^^^^^^^^^^^
1818

1919
error: constant pattern depends on a generic parameter
20-
--> $DIR/issue-73976-polymorphic.rs:31:42
20+
--> $DIR/issue-73976-polymorphic.rs:32:42
2121
|
2222
LL | matches!(GetTypeNameLen::<T>::VALUE, GetTypeNameLen::<T>::VALUE)
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)