-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Make last structs indexes definitions use newtype_index macro #45770
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
const INVALID: DepNodeIndex = DepNodeIndex { | ||
index: ::std::u32::MAX, | ||
}; | ||
const INVALID: DepNodeIndex = DepNodeIndex(::std::u32::MAX); |
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 generates graph::INVALID
@@ -157,7 +157,7 @@ macro_rules! newtype_index { | |||
(@pub [$($pub: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.
As a side note, this could be using $pub:vis
instead of $($pub: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.
I could add that as a separate commit.
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.
My attempt to make this change https://gist.github.com/spastorino/715079ea4839effe67fd9f0c3bee1c70
And I'm getting a lot of these errors ...
error: no rules expected the token `]`
--> src/librustc/dep_graph/graph.rs:48:1
|
48 | newtype_index!(DepNodeIndex);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate
Ran with trace macros ...
note: trace_macro
--> src/librustc/dep_graph/graph.rs:48:1
|
48 | newtype_index!(DepNodeIndex);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expanding `newtype_index! { DepNodeIndex }`
= note: to `newtype_index ! (
@ type [ DepNodeIndex ] @ max [ :: std :: u32 :: MAX ] @ debug_format [ "{}" ]
) ;`
= note: expanding `newtype_index! { @ type [ DepNodeIndex ] @ max [ :: std :: u32 :: MAX ] @ debug_format [ "{}" ] }`
= note: to `newtype_index ! (
@ vis [ ] @ type [ DepNodeIndex ] @ max [ ::std::u32::MAX ] @ debug_format [
"{}" ] ) ;`
= note: expanding `newtype_index! { @ vis [ ] @ type [ DepNodeIndex ] @ max [ ::std::u32::MAX ] @ debug_format [
"{}" ] }`
error: no rules expected the token `]`
--> src/librustc/dep_graph/serialized.rs:17:1
|
17 | newtype_index!(SerializedDepNodeIndex);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate
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.
This could be #41949. Probably not worth it to fix in this PR :)
@nikomatsakis I'd merge this if you are ok and then this vis thing could be done in a separate PR. |
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.
Nice work!
@bors r+ |
📌 Commit d19faea has been approved by |
Make last structs indexes definitions use newtype_index macro This PR makes the last two index structs not using newtype_index macro to use it and also fixes this #45763 issue.
☀️ Test successful - status-appveyor, status-travis |
This PR makes the last two index structs not using newtype_index macro to use it and also fixes this #45763 issue.