-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Make last structs indexes definitions use newtype_index macro #45770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ macro_rules! newtype_index { | |
@pub [$($pub:tt)*] | ||
@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$debug_format:expr]) => ( | ||
@debug_format [$debug_format:tt]) => ( | ||
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)] | ||
pub struct $type($($pub)* u32); | ||
|
||
|
@@ -100,7 +100,7 @@ macro_rules! newtype_index { | |
(@handle_debug | ||
@derives [] | ||
@type [$type:ident] | ||
@debug_format [$debug_format:expr]) => ( | ||
@debug_format [$debug_format:tt]) => ( | ||
impl ::std::fmt::Debug for $type { | ||
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { | ||
write!(fmt, $debug_format, self.0) | ||
|
@@ -112,13 +112,13 @@ macro_rules! newtype_index { | |
(@handle_debug | ||
@derives [Debug, $($derives:ident,)*] | ||
@type [$type:ident] | ||
@debug_format [$debug_format:expr]) => (); | ||
@debug_format [$debug_format:tt]) => (); | ||
|
||
// It's not Debug, so just pop it off the front of the derives stack and check the rest. | ||
(@handle_debug | ||
@derives [$_derive:ident, $($derives:ident,)*] | ||
@type [$type:ident] | ||
@debug_format [$debug_format:expr]) => ( | ||
@debug_format [$debug_format:tt]) => ( | ||
newtype_index!( | ||
@handle_debug | ||
@derives [$($derives,)*] | ||
|
@@ -129,7 +129,7 @@ macro_rules! newtype_index { | |
// Handle the case where someone wants to make the internal field public | ||
(@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
pub idx | ||
$($tokens:tt)*) => ( | ||
newtype_index!( | ||
|
@@ -143,7 +143,7 @@ macro_rules! newtype_index { | |
// The default case is that the internal field is private | ||
(@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
$($tokens:tt)*) => ( | ||
newtype_index!( | ||
@pub [] | ||
|
@@ -157,7 +157,7 @@ macro_rules! newtype_index { | |
(@pub [$($pub:tt)*] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a side note, this could be using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could add that as a separate commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My attempt to make this change https://gist.github.com/spastorino/715079ea4839effe67fd9f0c3bee1c70 And I'm getting a lot of these errors ...
Ran with trace macros ...
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be #41949. Probably not worth it to fix in this PR :) |
||
@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
derive [$($derives:ident),*] | ||
$($tokens:tt)*) => ( | ||
newtype_index!( | ||
|
@@ -174,7 +174,7 @@ macro_rules! newtype_index { | |
(@pub [$($pub:tt)*] | ||
@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
derive [$($derives:ident,)+] | ||
ENCODABLE = custom | ||
$($tokens:tt)*) => ( | ||
|
@@ -192,7 +192,7 @@ macro_rules! newtype_index { | |
(@pub [$($pub:tt)*] | ||
@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
derive [$($derives:ident,)+] | ||
$($tokens:tt)*) => ( | ||
newtype_index!( | ||
|
@@ -209,7 +209,7 @@ macro_rules! newtype_index { | |
(@pub [$($pub:tt)*] | ||
@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
ENCODABLE = custom | ||
$($tokens:tt)*) => ( | ||
newtype_index!( | ||
|
@@ -225,7 +225,7 @@ macro_rules! newtype_index { | |
(@pub [$($pub:tt)*] | ||
@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
$($tokens:tt)*) => ( | ||
newtype_index!( | ||
@derives [RustcDecodable, RustcEncodable,] | ||
|
@@ -241,7 +241,7 @@ macro_rules! newtype_index { | |
@pub [$($pub:tt)*] | ||
@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
$name:ident = $constant:expr) => ( | ||
newtype_index!( | ||
@derives [$($derives,)*] | ||
|
@@ -257,7 +257,7 @@ macro_rules! newtype_index { | |
@pub [$($pub:tt)*] | ||
@type [$type:ident] | ||
@max [$_max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
$(#[doc = $doc:expr])* | ||
const $name:ident = $constant:expr) => ( | ||
newtype_index!( | ||
|
@@ -274,7 +274,7 @@ macro_rules! newtype_index { | |
@pub [$($pub:tt)*] | ||
@type [$type:ident] | ||
@max [$_max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
MAX = $max:expr, | ||
$($tokens:tt)*) => ( | ||
newtype_index!( | ||
|
@@ -291,8 +291,8 @@ macro_rules! newtype_index { | |
@pub [$($pub:tt)*] | ||
@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$_debug_format:expr] | ||
DEBUG_FORMAT = $debug_format:expr, | ||
@debug_format [$_debug_format:tt] | ||
DEBUG_FORMAT = $debug_format:tt, | ||
$($tokens:tt)*) => ( | ||
newtype_index!( | ||
@derives [$($derives,)*] | ||
|
@@ -308,7 +308,7 @@ macro_rules! newtype_index { | |
@pub [$($pub:tt)*] | ||
@type [$type:ident] | ||
@max [$max:expr] | ||
@debug_format [$debug_format:expr] | ||
@debug_format [$debug_format:tt] | ||
$(#[doc = $doc:expr])* | ||
const $name:ident = $constant:expr, | ||
$($tokens:tt)*) => ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this one isn't in the macro call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we need
graph::DepNodeIndex::INVALID
and the macro generatesgraph::INVALID