1
Fork 0

Make #[no_ord_impl] an attribute in newtype_index

This commit is contained in:
Nilstrieb 2022-12-18 21:06:44 +01:00
parent 88d5f7f4ce
commit 93429948cf
2 changed files with 5 additions and 9 deletions

View file

@ -7,7 +7,6 @@ mod kw {
syn::custom_keyword!(DEBUG_FORMAT); syn::custom_keyword!(DEBUG_FORMAT);
syn::custom_keyword!(MAX); syn::custom_keyword!(MAX);
syn::custom_keyword!(custom); syn::custom_keyword!(custom);
syn::custom_keyword!(ORD_IMPL);
} }
#[derive(Debug)] #[derive(Debug)]
@ -56,6 +55,10 @@ impl Parse for Newtype {
encodable = false; encodable = false;
false false
} }
"no_ord_impl" => {
ord = false;
false
}
_ => true, _ => true,
}, },
_ => true, _ => true,
@ -91,13 +94,6 @@ impl Parse for Newtype {
} }
continue; continue;
} }
if body.lookahead1().peek(kw::ORD_IMPL) {
body.parse::<kw::ORD_IMPL>()?;
body.parse::<Token![=]>()?;
body.parse::<kw::custom>()?;
ord = false;
continue;
}
// We've parsed everything that the user provided, so we're done // We've parsed everything that the user provided, so we're done
if body.is_empty() { if body.is_empty() {

View file

@ -83,8 +83,8 @@ impl fmt::Debug for ExpnId {
rustc_index::newtype_index! { rustc_index::newtype_index! {
/// A unique ID associated with a macro invocation and expansion. /// A unique ID associated with a macro invocation and expansion.
#[custom_encodable] #[custom_encodable]
#[no_ord_impl]
pub struct LocalExpnId { pub struct LocalExpnId {
ORD_IMPL = custom
DEBUG_FORMAT = "expn{}" DEBUG_FORMAT = "expn{}"
} }
} }