about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-08-08 04:56:41 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-08-14 21:13:06 +1000
commit8296ad04568597fbfab4460530032cd54f5cd26b (patch)
treeb63ddf8b7d14fca5de66358f868d558f41ac21fc /library/core/src
parent3672a55b7cfd0a12e7097197b6242872473ffaa7 (diff)
Print regions in `type_name`.
Currently they are skipped, which is a bit weird, and it sometimes
causes malformed output like `Foo<>` and `dyn Bar<, A = u32>`.

Most regions are erased by the time `type_name` does its work. So all
regions are now printed as `'_` in non-optional places. Not perfect, but
better than the status quo.

`c_name` is updated to trim lifetimes from MIR pass names, so that the
`PASS_NAMES` sanity check still works. It is also renamed as
`simplify_pass_type_name` and made non-const, because it doesn't need
to be const and the non-const implementation is much shorter.

The commit also renames `should_print_region` as
`should_print_optional_region`, which makes it clearer that it only
applies to some regions.

Fixes #145168.
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/any.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/core/src/any.rs b/library/core/src/any.rs
index ceb9748e7fe..e7d9763d46e 100644
--- a/library/core/src/any.rs
+++ b/library/core/src/any.rs
@@ -835,9 +835,9 @@ impl fmt::Debug for TypeId {
 ///
 /// The returned string must not be considered to be a unique identifier of a
 /// type as multiple types may map to the same type name. Similarly, there is no
-/// guarantee that all parts of a type will appear in the returned string: for
-/// example, lifetime specifiers are currently not included. In addition, the
-/// output may change between versions of the compiler.
+/// guarantee that all parts of a type will appear in the returned string. In
+/// addition, the output may change between versions of the compiler. For
+/// example, lifetime specifiers were omitted in some earlier versions.
 ///
 /// The current implementation uses the same infrastructure as compiler
 /// diagnostics and debuginfo, but this is not guaranteed.