Skip to content

Commit 4653b7a

Browse files
committed
Stabilize const TypeId::of
1 parent e05ab47 commit 4653b7a

15 files changed

+14
-21
lines changed

library/core/src/any.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ unsafe impl Send for TypeId {}
725725
unsafe impl Sync for TypeId {}
726726

727727
#[stable(feature = "rust1", since = "1.0.0")]
728-
#[rustc_const_unstable(feature = "const_type_id", issue = "77125")]
728+
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
729729
impl const PartialEq for TypeId {
730730
#[inline]
731731
fn eq(&self, other: &Self) -> bool {
@@ -773,7 +773,7 @@ impl TypeId {
773773
/// ```
774774
#[must_use]
775775
#[stable(feature = "rust1", since = "1.0.0")]
776-
#[rustc_const_unstable(feature = "const_type_id", issue = "77125")]
776+
#[rustc_const_stable(feature = "const_type_id", since = "CURRENT_RUSTC_VERSION")]
777777
pub const fn of<T: ?Sized + 'static>() -> TypeId {
778778
const { intrinsics::type_id::<T>() }
779779
}

tests/ui/const-generics/issues/issue-90318.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_type_id)]
21
#![feature(generic_const_exprs)]
32
#![feature(const_trait_impl, const_cmp)]
43
#![feature(core_intrinsics)]

tests/ui/const-generics/issues/issue-90318.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: overly complex generic constant
2-
--> $DIR/issue-90318.rs:15:8
2+
--> $DIR/issue-90318.rs:14:8
33
|
44
LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
55
| ^^-----------------^^^^^^^^^^^^^^^^^^^^^^^^
@@ -10,7 +10,7 @@ LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
1010
= note: this operation may be supported in the future
1111

1212
error: overly complex generic constant
13-
--> $DIR/issue-90318.rs:22:8
13+
--> $DIR/issue-90318.rs:21:8
1414
|
1515
LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
1616
| ^^-----------------^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/consts/const-typeid-of-rpass.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
//@ run-pass
2-
#![feature(const_type_id)]
3-
#![feature(core_intrinsics)]
42

53
use std::any::TypeId;
64

tests/ui/consts/const_cmp_type_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ compile-flags: -Znext-solver
2-
#![feature(const_type_id, const_trait_impl, const_cmp)]
2+
#![feature(const_trait_impl, const_cmp)]
33

44
use std::any::TypeId;
55

tests/ui/consts/const_transmute_type_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(const_type_id, const_trait_impl, const_cmp)]
1+
#![feature(const_trait_impl, const_cmp)]
22

33
use std::any::TypeId;
44

tests/ui/consts/const_transmute_type_id2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ normalize-stderr: "0x(ff)+" -> "<u128::MAX>"
22

3-
#![feature(const_type_id, const_trait_impl, const_cmp)]
3+
#![feature( const_trait_impl, const_cmp)]
44

55
use std::any::TypeId;
66

tests/ui/consts/const_transmute_type_id3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Test that all bytes of a TypeId must have the
22
//! TypeId marker provenance.
33
4-
#![feature(const_type_id, const_trait_impl, const_cmp)]
4+
#![feature( const_trait_impl, const_cmp)]
55

66
use std::any::TypeId;
77

tests/ui/consts/const_transmute_type_id4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(const_type_id, const_trait_impl, const_cmp)]
1+
#![feature(const_trait_impl, const_cmp)]
22

33
use std::any::TypeId;
44

tests/ui/consts/const_transmute_type_id5.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Test that we require an equal TypeId to have an integer part that properly
22
//! reflects the type id hash.
33
4-
#![feature(const_type_id, const_trait_impl, const_cmp)]
4+
#![feature(const_trait_impl, const_cmp)]
55

66
use std::any::TypeId;
77

0 commit comments

Comments
 (0)