-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
bootstrap: Overhaul and simplify the tool_check_step!
macro
#134950
Conversation
rustbot has assigned @albertlarsan68. Use |
This comment has been minimized.
This comment has been minimized.
e4a3b52
to
330d54c
Compare
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.
It looks like a nice cleanup to me. I'll wait a bit on the removal of support for out-of-tree tools to hear back from other ppl on T-bootstrap in case that somehow turns out to be relied upon.
// Currently, all of the tools that use this macro/function are in-tree. | ||
// If support for out-of-tree tools is re-added in the future, those | ||
// steps should probably be marked non-default so that the default | ||
// checks aren't affected by toolstate being broken. | ||
SourceType::InTree, |
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.
@rust-lang/bootstrap do you know if there's a specific reason we support out-of-tree tools? Does idk distros or some other consumer rely on this support?
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.
It looks like the general concept of SourceType
was introduced in #73297, to control whether warnings are denied by default or not.
At that time, none of the uses of tool_check_step!
specified a source type other than InTree
. So it's plausible that this macro has never actually been used with out-of-tree tools.
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.
Also note that this PR only removes explicit SourceType
support from one particular macro. If an “out of tree” tool hypothetically needed to be added, it shouldn't be much trouble to either adjust this macro, or declare an alternative step or macro.
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.
Yeah, I'm in favor of removing this unused code. If we need support for non-InTree
tools, we can add it back when the need arises.
Aside: I was amused to find that I'm following in the footsteps of #131597. |
That was a quick-and-dirty "fix", lol |
Ordinary code is much easier to work with than macro-generated code.
All of the tools that use this macro are currently in-tree, so support for specifying a `SourceType` was not meaningfully used. It can potentially be re-added in the future if needed.
330d54c
to
90d0ce7
Compare
Removed the stamp-name changes for being too risky for this PR (diff). |
This comment was marked as resolved.
This comment was marked as resolved.
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.
Thanks, you can r=me after PR CI is green.
EDIT: with the stamp comment nit above addressed
This tricks rustfmt into formatting the macro arguments as expressions, instead of giving up and ignoring them.
90d0ce7
to
66fd534
Compare
@bors r=jieyouxu |
Rollup of 6 pull requests Successful merges: - rust-lang#131439 (Remove allowing static_mut_refs lint) - rust-lang#133292 (E0277: suggest dereferencing function arguments in more cases) - rust-lang#134877 (add suggestion for wrongly ordered format parameters) - rust-lang#134945 (Some small nits to the borrowck suggestions for mutating a map through index) - rust-lang#134950 (bootstrap: Overhaul and simplify the `tool_check_step!` macro) - rust-lang#134979 (Provide structured suggestion for `impl Default` of type where all fields have defaults) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134950 - Zalathar:tool-check-step, r=jieyouxu bootstrap: Overhaul and simplify the `tool_check_step!` macro Main changes: - Pull most of `run` out of the macro and into a regular helper function - Reduce the number of redundant/unnecessary macro arguments - Switch to struct-like syntax so that optional arguments are clearer, and so that rustfmt is happy ~~The one “functional” change is that the `-check.stamp` files now get their name from the final path segment, instead of the struct name; in practice this means that they now contain more hyphens in some cases. As far as I'm aware, the exact filename doesn't matter so this should be fine.~~ (that change has been removed from this PR)
bootstrap: Overhaul and simplify the `tool_extended!` macro Similar to rust-lang#134950, but for the macro that declares build steps for some tools. The main changes are: - Removing some functionality that isn't needed by any of the tools currently using the macro - Moving some code out of the macro and into ordinary helper functions - Switching to one macro invocation per tool, and struct-like syntax so that rustfmt will format them There should be no functional change.
bootstrap: Overhaul and simplify the `tool_extended!` macro Similar to rust-lang#134950, but for the macro that declares build steps for some tools. The main changes are: - Removing some functionality that isn't needed by any of the tools currently using the macro - Moving some code out of the macro and into ordinary helper functions - Switching to one macro invocation per tool, and struct-like syntax so that rustfmt will format them There should be no functional change.
Main changes:
run
out of the macro and into a regular helper functionThe one “functional” change is that the(that change has been removed from this PR)-check.stamp
files now get their name from the final path segment, instead of the struct name; in practice this means that they now contain more hyphens in some cases. As far as I'm aware, the exact filename doesn't matter so this should be fine.