1
Fork 0

Replace no_ord_impl with orderable.

Similar to the previous commit, this replaces `newtype_index`'s opt-out
`no_ord_impl` attribute with the opt-in `orderable` attribute.
This commit is contained in:
Nicholas Nethercote 2023-11-21 17:35:46 +11:00
parent 3ef9d4d0ed
commit 7060fc8327
28 changed files with 43 additions and 4 deletions

View file

@ -13,6 +13,7 @@ pub type StableCrateIdMap =
indexmap::IndexMap<StableCrateId, CrateNum, BuildHasherDefault<Unhasher>>;
rustc_index::newtype_index! {
#[orderable]
#[debug_format = "crate{}"]
pub struct CrateNum {}
}
@ -212,6 +213,7 @@ 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.
#[orderable]
#[debug_format = "DefIndex({})"]
pub struct DefIndex {
/// The crate root is always assigned index 0 by the AST Map code,

View file

@ -60,6 +60,7 @@ pub struct SyntaxContextData {
rustc_index::newtype_index! {
/// A unique ID associated with a macro invocation and expansion.
#[orderable]
pub struct ExpnIndex {}
}
@ -79,7 +80,6 @@ impl fmt::Debug for ExpnId {
rustc_index::newtype_index! {
/// A unique ID associated with a macro invocation and expansion.
#[no_ord_impl]
#[debug_format = "expn{}"]
pub struct LocalExpnId {}
}

View file

@ -2018,6 +2018,7 @@ impl fmt::Display for MacroRulesNormalizedIdent {
pub struct Symbol(SymbolIndex);
rustc_index::newtype_index! {
#[orderable]
struct SymbolIndex {}
}