Skip to content

Commit 85cbfac

Browse files
committed
Auto merge of rust-lang#145284 - nnethercote:type_name-print-regions, r=lcnr
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 rust-lang#145168. r? `@lcnr`
2 parents 90ada38 + f2d2871 commit 85cbfac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/src/any.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -835,9 +835,9 @@ impl fmt::Debug for TypeId {
835835
///
836836
/// The returned string must not be considered to be a unique identifier of a
837837
/// type as multiple types may map to the same type name. Similarly, there is no
838-
/// guarantee that all parts of a type will appear in the returned string: for
839-
/// example, lifetime specifiers are currently not included. In addition, the
840-
/// output may change between versions of the compiler.
838+
/// guarantee that all parts of a type will appear in the returned string. In
839+
/// addition, the output may change between versions of the compiler. For
840+
/// example, lifetime specifiers were omitted in some earlier versions.
841841
///
842842
/// The current implementation uses the same infrastructure as compiler
843843
/// diagnostics and debuginfo, but this is not guaranteed.

0 commit comments

Comments
 (0)