You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plumb rustc -Zhint-mostly-unused flag through as a profile option (#15643)
The rustc `-Zhint-mostly-unused` flag tells rustc that most of a crate
will go unused. This is useful for speeding up compilation of large
dependencies from which you only use a few items. Plumb that option
through as a profile option, to allow specifying it for specific
dependencies:
```toml
[profile.dev.package.huge-mostly-unused-dependency]
hint-mostly-unused = true
```
To enable this feature, pass `-Zprofile-hint-mostly-unused`. However,
since this option is a hint, using it without passing
`-Zprofile-hint-mostly-unused` will only warn and ignore the profile
option. Versions of Cargo prior to the introduction of this feature will
give an "unused manifest key" warning, but will otherwise function
without erroring. This allows using the hint in a crate's `Cargo.toml`
without mandating the use of a newer Cargo to build it.
Add a test verifying that the profile option gets ignored with a warning
without passing `-Zprofile-hint-mostly-unused`, and another test
verifying that it gets handled when passing
`-Zprofile-hint-mostly-unused`.
### How to test and review this PR?
The tests in the testsuite demonstrate both that the option works as
expected and that it gets ignored with a warning if not passing
`-Zprofile-hint-mostly-unused`.
This will remain a draft until
rust-lang/rust#135656 gets merged in rustc; once
that happens, the "nightly" jobs will pass in CI.
Copy file name to clipboardExpand all lines: src/doc/src/reference/unstable.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,6 +101,7 @@ Each new feature described below should explain how to use it.
101
101
*[rustdoc-depinfo](#rustdoc-depinfo) --- Use dep-info files in rustdoc rebuild detection.
102
102
*`Cargo.toml` extensions
103
103
*[Profile `rustflags` option](#profile-rustflags-option) --- Passed directly to rustc.
104
+
*[Profile `hint-mostly-unused` option](#profile-hint-mostly-unused-option) --- Hint that a dependency is mostly unused, to optimize compilation time.
104
105
*[codegen-backend](#codegen-backend) --- Select the codegen backend used by rustc.
105
106
*[per-package-target](#per-package-target) --- Sets the `--target` to use for each individual package.
106
107
*[artifact dependencies](#artifact-dependencies) --- Allow build artifacts to be included into other build artifacts and build them for different targets.
0 commit comments