Skip to content

Commit 55cc0ba

Browse files
committed
Stabilize const TypeId::of
1 parent 6c0a912 commit 55cc0ba

17 files changed

+16
-33
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/mir-opt/gvn_const_eval_polymorphic.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
//! evaluated to the string "crate_name::generic::<T>", and
1111
//! `no_optimize` was incorrectly optimized to `false`.
1212
13-
#![feature(const_type_name)]
14-
1513
fn generic<T>() {}
1614

1715
const fn type_name_contains_i32<T>(_: &T) -> bool {

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-fn-type-name.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,12 @@ struct Struct<TA, TB, TC> {
1616

1717
type StructInstantiation = Struct<i8, f64, bool>;
1818

19-
const CONST_STRUCT: StructInstantiation = StructInstantiation {
20-
a: 12,
21-
b: 13.7,
22-
c: false,
23-
};
19+
const CONST_STRUCT: StructInstantiation = StructInstantiation { a: 12, b: 13.7, c: false };
2420

2521
const CONST_STRUCT_NAME: &'static str = type_name_wrapper(&CONST_STRUCT);
2622

2723
fn main() {
28-
let non_const_struct = StructInstantiation {
29-
a: 87,
30-
b: 65.99,
31-
c: true,
32-
};
24+
let non_const_struct = StructInstantiation { a: 87, b: 65.99, c: true };
3325

3426
let non_const_struct_name = type_name_wrapper(&non_const_struct);
3527

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

0 commit comments

Comments
 (0)