-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add [hints]
table in Cargo.toml
, and a hints.mostly-unused
hint
#15673
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
base: master
Are you sure you want to change the base?
Conversation
Sorry if this is the wrong place for this, but I'd love to see how this affects a simple binary using the |
Note: should add a test for |
For a crate depending on aws-sdk-ec2, a release build went from 4m07s to 2m04s, and a non-release build went from 2m26s to 1m28s. |
02f4153
to
9812504
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.
Just waiting on #15643
@rfcbot fcp merge This insta-stabilizes a new While this is blocked on rustc, I figured we could run our FCP in parallel. |
Team member @epage has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
These tests show what prior versions of Cargo will do with hints. The subsequent addition of support for hints will modify these tests to reflect the corresponding changes to Cargo.
…vior) These tests demonstrate the behavior of current Cargo, and will be changed when adding `hints.mostly-unused` to reflect the new behavior.
The `[hints]` table in a `Cargo.toml` manifest provides optional information that Cargo can use for building the package, and will use even when using the package as a dependency. All hints can be safely ignored, and Cargo only warns about unknown hints, but does not error. This allows packages to use hints without depending on new Cargo. Add a `mostly-unused` hint, which allows a package to hint that most users of the package will not use most of its items. This is useful for improving the build performance of crates with large dependencies. Crates can override this hint using `hint-mostly-unused = false` in their profile for a dependency.
Make it only a warning, not an error, to have a hint value of the wrong type.
Another fun benchmark number for this, using I built a crate that depended on the Without hint-mostly-unused, With hint-mostly-unused, |
The
[hints]
table in aCargo.toml
manifest provides optionalinformation that Cargo can use for building the package, and will use
even when using the package as a dependency. All hints can be safely
ignored, and Cargo only warns about unknown hints, but does not error.
This allows packages to use hints without depending on new Cargo.
Add a
mostly-unused
hint, which allows a package to hint that mostusers of the package will not use most of its items. This is useful for
improving the build performance of crates with large dependencies.
Crates can override this hint using
hint-mostly-unused = false
intheir profile for a dependency.
In the future, this same mechanism could be used for other hints, such as
min-opt-level
.How to test and review this PR?
This PR is built atop #15643 . I'd
suggest reviewing that PR separately, then just reviewing the new commits in
this PR.
The new "hints" testsuite module demonstrates the expected behavior of hints.
Like #15643 , the nightly-only tests
will only pass once rust-lang/rust#135656 has been
merged into Rust.