about summary refs log tree commit diff
path: root/compiler/rustc_const_eval
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-09-08 05:27:52 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-09-08 19:35:47 +1000
commit9a52a8354e50bd824bdefebc659d8c3c38eccc0a (patch)
tree88299f618837e4d51a78ea0b2c8f20151d26b147 /compiler/rustc_const_eval
parent55b9b4d1e1bb5b46c04237a2fb2f8a85f39ef97d (diff)
downloadrust-9a52a8354e50bd824bdefebc659d8c3c38eccc0a.tar.gz
rust-9a52a8354e50bd824bdefebc659d8c3c38eccc0a.zip
Allow static regions in `type_name`.
Fixes #146249.
Diffstat (limited to 'compiler/rustc_const_eval')
-rw-r--r--compiler/rustc_const_eval/src/util/type_name.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/util/type_name.rs b/compiler/rustc_const_eval/src/util/type_name.rs
index 2ae6655901b..5bcf96abd8c 100644
--- a/compiler/rustc_const_eval/src/util/type_name.rs
+++ b/compiler/rustc_const_eval/src/util/type_name.rs
@@ -168,10 +168,11 @@ impl<'tcx> PrettyPrinter<'tcx> for TypeNamePrinter<'tcx> {
         // Bound regions are always printed (as `'_`), which gives some idea that they are special,
         // even though the `for` is omitted by the pretty printer.
         // E.g. `for<'a, 'b> fn(&'a u32, &'b u32)` is printed as "fn(&'_ u32, &'_ u32)".
+        let kind = region.kind();
         match region.kind() {
-            ty::ReErased | ty::ReEarlyParam(_) => false,
+            ty::ReErased | ty::ReEarlyParam(_) | ty::ReStatic => false,
             ty::ReBound(..) => true,
-            _ => unreachable!(),
+            _ => panic!("type_name unhandled region: {kind:?}"),
         }
     }