From 2a94a2d385657dfa89bf2d46d2a6114be70afef0 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 3 Nov 2022 08:12:19 +0000 Subject: [PATCH] Prefer not accessing the private field of newtype_index types --- compiler/rustc_span/src/def_id.rs | 2 +- compiler/rustc_span/src/hygiene.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs index bbeabdb55a72..f5555846d20a 100644 --- a/compiler/rustc_span/src/def_id.rs +++ b/compiler/rustc_span/src/def_id.rs @@ -34,7 +34,7 @@ impl CrateNum { impl fmt::Display for CrateNum { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Display::fmt(&self.private, f) + fmt::Display::fmt(&self.as_u32(), f) } } diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index 191186af6fa0..99a8b03fa39a 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -76,7 +76,7 @@ pub struct ExpnId { impl fmt::Debug for ExpnId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // Generate crate_::{{expn_}}. - write!(f, "{:?}::{{{{expn{}}}}}", self.krate, self.local_id.private) + write!(f, "{:?}::{{{{expn{}}}}}", self.krate, self.local_id.as_u32()) } }