Skip to content

Commit 4a3d41d

Browse files
authored
Add the necessary changes to any.rs
Specifically the `#[rustc_const_unstable(feature = "const_type_name")]` attribute, as well as marking the actual function as `const`.
1 parent 873b361 commit 4a3d41d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libcore/any.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ impl TypeId {
468468
/// The current implementation uses the same infrastructure as compiler
469469
/// diagnostics and debuginfo, but this is not guaranteed.
470470
#[stable(feature = "type_name", since = "1.38.0")]
471-
pub fn type_name<T: ?Sized>() -> &'static str {
471+
#[rustc_const_unstable(feature = "const_type_name")]
472+
pub const fn type_name<T: ?Sized>() -> &'static str {
472473
#[cfg(bootstrap)]
473474
unsafe {
474475
intrinsics::type_name::<T>()

0 commit comments

Comments
 (0)