diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-06-09 08:15:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-09 08:15:57 +0200 |
| commit | 009fc56471eec39a6de6476703b4fc407c4324e5 (patch) | |
| tree | e1c01ae8e9f319be19671207f43c27b56b27531d | |
| parent | a4490b18a7b0fcf48f2effb806f67e6c82cc5758 (diff) | |
| parent | 80e9ca93981f6fa8fae4e95111b78b9093348b2c (diff) | |
| download | rust-009fc56471eec39a6de6476703b4fc407c4324e5.tar.gz rust-009fc56471eec39a6de6476703b4fc407c4324e5.zip | |
Rollup merge of #112444 - compiler-errors:intern-debug, r=nnethercote
Don't debug-print `Interned` or `PrivateZst`
Instead of, e.g.
`PredefinedOpaques(Interned(PredefinedOpaquesData { ... }, PrivateZst))`
print:
`PredefinedOpaques(PredefinedOpaquesData { ... })`
Mostly observable in debug logs, or ICE backtraces where I saw this.
r? ``@nnethercote``
| -rw-r--r-- | compiler/rustc_data_structures/src/intern.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_data_structures/src/intern.rs b/compiler/rustc_data_structures/src/intern.rs index ba94f3776eb..e0f8c350c2a 100644 --- a/compiler/rustc_data_structures/src/intern.rs +++ b/compiler/rustc_data_structures/src/intern.rs @@ -1,5 +1,6 @@ use crate::stable_hasher::{HashStable, StableHasher}; use std::cmp::Ordering; +use std::fmt::{self, Debug}; use std::hash::{Hash, Hasher}; use std::ops::Deref; use std::ptr; @@ -20,7 +21,6 @@ mod private { /// The `PrivateZst` field means you can pattern match with `Interned(v, _)` /// but you can only construct a `Interned` with `new_unchecked`, and not /// directly. -#[derive(Debug)] #[rustc_pass_by_value] pub struct Interned<'a, T>(pub &'a T, pub private::PrivateZst); @@ -108,5 +108,11 @@ where } } +impl<T: Debug> Debug for Interned<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +} + #[cfg(test)] mod tests; |
