summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_span/src/def_id.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_span/src/def_id.rs')
-rw-r--r--compiler/rustc_span/src/def_id.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs
index e62ce2c26..7c5e1427d 100644
--- a/compiler/rustc_span/src/def_id.rs
+++ b/compiler/rustc_span/src/def_id.rs
@@ -10,10 +10,9 @@ use std::fmt;
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 @@ rustc_index::newtype_index! {
/// 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;
}
}
@@ -305,7 +303,7 @@ impl DefId {
// i.e. don't use closures.
match self.as_local() {
Some(local_def_id) => local_def_id,
- None => panic!("DefId::expect_local: `{:?}` isn't local", self),
+ None => panic!("DefId::expect_local: `{self:?}` isn't local"),
}
}