ash: Enable mostly-unused
hint to speed up compilation
#1004
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.
Rust recently introduced the
mostly-unused
hint to speed up compilation of large crates where a significant portion of the contents are unlikely to be used concurrently.ash
is such a crate, which takes quite long to compile relative to the amount and kind of abstraction it provides, simply caused by the vastness of the Vulkan API (and possible remaining inefficiencies in our generated code). This hint helps the compiler defer code generation until it knows it is definitely referenced and used, much like generics and#[inline]
(the latter is already used consistently across this crate). All in all this new hint reduces compile time of theash
crate by about 8%.It however requires the use of a
nightly
compiler and passing of the-Zprofile-hint-mostly-unused
flag. The newly introduced[hints]
table is not a syntax or parsing error on older compilers, but does issue a matchingunused manifest key: hints
warning. We should decide whether to merge this flag now and ignore that warning while developing, allowing users to automatically take advantage of this annotation when future Rust versions enable it automatically. Consumer crates can also configure it directly in their[profile]
table however.https://blog.rust-lang.org/inside-rust/2025/07/15/call-for-testing-hint-mostly-unused/