about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-31 00:43:25 +0000
committerbors <bors@rust-lang.org>2023-12-31 00:43:25 +0000
commit64d5515cc3a2a5dfe406d67334c3337991f7ea9b (patch)
tree27996bb462c001a1b42fdf9e2f6979445c9db536
parentd868bc28422a5b296ba6a23a83384fbfefa40264 (diff)
parente36a24ec8f21d1fd4da171c223874bc6f4023028 (diff)
downloadrust-64d5515cc3a2a5dfe406d67334c3337991f7ea9b.tar.gz
rust-64d5515cc3a2a5dfe406d67334c3337991f7ea9b.zip
Auto merge of #119447 - Nilstrieb:STACKOVERFLOW, r=compiler-errors
Fix `<BoundConstness as Display>`

There was infinite recursion, which is not very good. I'm not sure what the best way to implement this is, I just did something that felt right.

r? `@fmease`
-rw-r--r--compiler/rustc_middle/src/ty/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index 5911f23552e..757d3337afc 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -333,7 +333,8 @@ impl fmt::Display for BoundConstness {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self {
             Self::NotConst => f.write_str("normal"),
-            _ => write!(f, "`{self}`"),
+            Self::Const => f.write_str("const"),
+            Self::ConstIfConst => f.write_str("~const"),
         }
     }
 }