Skip to content

Commit 009fc56

Browse files
authored
Rollup merge of rust-lang#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``
2 parents a4490b1 + 80e9ca9 commit 009fc56

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/rustc_data_structures/src/intern.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::stable_hasher::{HashStable, StableHasher};
22
use std::cmp::Ordering;
3+
use std::fmt::{self, Debug};
34
use std::hash::{Hash, Hasher};
45
use std::ops::Deref;
56
use std::ptr;
@@ -20,7 +21,6 @@ mod private {
2021
/// The `PrivateZst` field means you can pattern match with `Interned(v, _)`
2122
/// but you can only construct a `Interned` with `new_unchecked`, and not
2223
/// directly.
23-
#[derive(Debug)]
2424
#[rustc_pass_by_value]
2525
pub struct Interned<'a, T>(pub &'a T, pub private::PrivateZst);
2626

@@ -108,5 +108,11 @@ where
108108
}
109109
}
110110

111+
impl<T: Debug> Debug for Interned<'_, T> {
112+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
113+
self.0.fmt(f)
114+
}
115+
}
116+
111117
#[cfg(test)]
112118
mod tests;

0 commit comments

Comments
 (0)