about summary refs log tree commit diff
path: root/compiler/rustc_const_eval
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-07 20:49:48 +1000
committerGitHub <noreply@github.com>2025-08-07 20:49:48 +1000
commit33f1862ef0ae67ef94414eee99c63d9a7c1e1055 (patch)
treecb68384b2d0bf3e5575bd35fa3b1b2e811562a63 /compiler/rustc_const_eval
parent3af6bb1f22862e3c06805fde36990d69e20badf2 (diff)
parent8074e672f05b134bea95783ceeac83bceec3956a (diff)
downloadrust-33f1862ef0ae67ef94414eee99c63d9a7c1e1055.tar.gz
rust-33f1862ef0ae67ef94414eee99c63d9a7c1e1055.zip
Rollup merge of #145033 - nnethercote:fix-144994, r=fmease
Reimplement `print_region` in `type_name.rs`.

Broken by rust-lang/rust#144776; this is reachable after all.

Fixes rust-lang/rust#144994.

The commit also adds a lot more cases to the `type-name-basic.rs`, because it's currently very anaemic. This includes some cases where region omission does very badly; these are marked with FIXME.

r? `@fmease`
Diffstat (limited to 'compiler/rustc_const_eval')
-rw-r--r--compiler/rustc_const_eval/src/util/type_name.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/util/type_name.rs b/compiler/rustc_const_eval/src/util/type_name.rs
index e6b9759819f..2dc746754f8 100644
--- a/compiler/rustc_const_eval/src/util/type_name.rs
+++ b/compiler/rustc_const_eval/src/util/type_name.rs
@@ -18,7 +18,9 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
     }
 
     fn print_region(&mut self, _region: ty::Region<'_>) -> Result<(), PrintError> {
-        unreachable!(); // because `<Self As PrettyPrinter>::should_print_region` returns false
+        // This is reachable (via `pretty_print_dyn_existential`) even though
+        // `<Self As PrettyPrinter>::should_print_region` returns false. See #144994.
+        Ok(())
     }
 
     fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> {