]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_span/src/def_id.rs
Auto merge of #84762 - cjgillot:resolve-span-opt, r=petrochenkov
[rust.git] / compiler / rustc_span / src / def_id.rs
index e62ce2c266aa04ca507edd377ab92672d193a336..221f65b66e6d4b77a1a0f63bc27acf3905e718b5 100644 (file)
 use std::hash::{Hash, Hasher};
 
 rustc_index::newtype_index! {
-    pub struct CrateNum {
-        ENCODABLE = custom
-        DEBUG_FORMAT = "crate{}"
-    }
+    #[custom_encodable]
+    #[debug_format = "crate{}"]
+    pub struct CrateNum {}
 }
 
 /// Item definitions in the currently-compiled crate would have the `CrateNum`
@@ -194,13 +193,12 @@ pub fn new(crate_name: Symbol, is_exe: bool, mut metadata: Vec<String>) -> Stabl
     /// A DefIndex is an index into the hir-map for a crate, identifying a
     /// 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 {
-        ENCODABLE = custom // (only encodable in metadata)
-
-        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,
+        const CRATE_DEF_INDEX = 0;
     }
 }