about summary refs log tree commit diff
path: root/compiler/rustc_span
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-12-18 21:37:38 +0100
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-12-18 21:37:38 +0100
commitd679764fb6b84a5cb72f6a9c9fefce4c6b41f16c (patch)
tree926ed2d285303de0a64f833a46fee04744d0d7de /compiler/rustc_span
parent91c3c2040ce109d6e9ea00ffb8e8f69f3fd6d9bb (diff)
downloadrust-d679764fb6b84a5cb72f6a9c9fefce4c6b41f16c.tar.gz
rust-d679764fb6b84a5cb72f6a9c9fefce4c6b41f16c.zip
Make `#[debug_format]` an attribute in `newtype_index`
This removes the `custom` format functionality as its only user was
trivially migrated to using a normal format.

If a new use case for a custom formatting impl pops up, you can add it
back.
Diffstat (limited to 'compiler/rustc_span')
-rw-r--r--compiler/rustc_span/src/def_id.rs4
-rw-r--r--compiler/rustc_span/src/hygiene.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs
index 326dce7838d..5d15757f1ab 100644
--- a/compiler/rustc_span/src/def_id.rs
+++ b/compiler/rustc_span/src/def_id.rs
@@ -11,8 +11,8 @@ use std::hash::{Hash, Hasher};
 
 rustc_index::newtype_index! {
     #[custom_encodable]
+    #[debug_format = "crate{}"]
     pub struct CrateNum {
-        DEBUG_FORMAT = "crate{}"
     }
 }
 
@@ -195,8 +195,8 @@ rustc_index::newtype_index! {
     /// particular definition. It should really be considered an interned
     /// shorthand for a particular DefPath.
     #[custom_encodable] // (only encodable in metadata)
+    #[debug_format = "DefIndex({})"]
     pub struct DefIndex {
-        DEBUG_FORMAT = "DefIndex({})",
         /// The crate root is always assigned index 0 by the AST Map code,
         /// thanks to `NodeCollector::new`.
         const CRATE_DEF_INDEX = 0,
diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs
index 2de559c5a70..f80b5d99df6 100644
--- a/compiler/rustc_span/src/hygiene.rs
+++ b/compiler/rustc_span/src/hygiene.rs
@@ -84,8 +84,8 @@ rustc_index::newtype_index! {
     /// A unique ID associated with a macro invocation and expansion.
     #[custom_encodable]
     #[no_ord_impl]
+    #[debug_format = "expn{}"]
     pub struct LocalExpnId {
-        DEBUG_FORMAT = "expn{}"
     }
 }