mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
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``
This commit is contained in:
commit
009fc56471
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user