Make #[custom_encodable]
an attribute for newtype_index
Makes the syntax a little more rusty.
This commit is contained in:
parent
b4d739ef12
commit
88d5f7f4ce
6 changed files with 19 additions and 18 deletions
|
@ -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`.
|
||||
|
|
|
@ -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{}"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue