Added rust_unpretty_aspect
and rust_unpretty
rules
#2356
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposal for #1642
Duplicates #1643 (special thanks to @freeformstu)
Summary
Rustc can be used to expand all macros so that you can inspect the generated source files easier.
This feature is enabled via
-Zunpretty={mode}
. The-Z
flag is only available in the nightlyversion of
rustc
(rust-lang/rust#43364).Unprettying
Build and test your targets normally.
Use the aspect to generate the expanded files in as a one-off build.
(
.bazelrc
)Targeting tests is valid as well.
Finally, manually wire up a
rust_unpretty
target explicitly if you want a target to build. This rule is unique compared to the aspect in that it forces a transition to a nightly toolchain so that-Zunpretty
can be used.