diff options
| author | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2022-12-18 21:02:14 +0100 |
|---|---|---|
| committer | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2022-12-18 21:02:14 +0100 |
| commit | 88d5f7f4ce72e3489193fb41e687c53809b5c6bd (patch) | |
| tree | 7db76b11fa1b3b9621793929691bac32d86d0116 /compiler/rustc_span/src | |
| parent | b4d739ef1285bc983383ec726314d9455f6bfb77 (diff) | |
| download | rust-88d5f7f4ce72e3489193fb41e687c53809b5c6bd.tar.gz rust-88d5f7f4ce72e3489193fb41e687c53809b5c6bd.zip | |
Make `#[custom_encodable]` an attribute for `newtype_index`
Makes the syntax a little more rusty.
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/def_id.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_span/src/hygiene.rs | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs index e62ce2c266a..326dce7838d 100644 --- a/compiler/rustc_span/src/def_id.rs +++ b/compiler/rustc_span/src/def_id.rs @@ -10,8 +10,8 @@ use std::fmt; use std::hash::{Hash, Hasher}; rustc_index::newtype_index! { + #[custom_encodable] pub struct CrateNum { - ENCODABLE = custom DEBUG_FORMAT = "crate{}" } } @@ -194,9 +194,8 @@ 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) 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`. diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index 038699154c7..4fb56dac856 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -61,8 +61,8 @@ pub struct SyntaxContextData { rustc_index::newtype_index! { /// A unique ID associated with a macro invocation and expansion. + #[custom_encodable] pub struct ExpnIndex { - ENCODABLE = custom } } @@ -82,8 +82,8 @@ impl fmt::Debug for ExpnId { rustc_index::newtype_index! { /// A unique ID associated with a macro invocation and expansion. + #[custom_encodable] pub struct LocalExpnId { - ENCODABLE = custom ORD_IMPL = custom DEBUG_FORMAT = "expn{}" } |
