mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Plumb rustc -Zhint-mostly-unused
flag through as a profile option
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`.
This commit is contained in:
parent
8789c2b757
commit
36480ce012
@ -1385,6 +1385,14 @@
|
||||
}
|
||||
],
|
||||
"default": null
|
||||
},
|
||||
"hint-mostly-unused": {
|
||||
"description": "Unstable feature `hint-mostly-unused`",
|
||||
"type": [
|
||||
"boolean",
|
||||
"null"
|
||||
],
|
||||
"default": null
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -907,6 +907,8 @@ pub struct TomlProfile {
|
||||
pub build_override: Option<Box<TomlProfile>>,
|
||||
/// Unstable feature `-Ztrim-paths`.
|
||||
pub trim_paths: Option<TomlTrimPaths>,
|
||||
/// Unstable feature `hint-mostly-unused`
|
||||
pub hint_mostly_unused: Option<bool>,
|
||||
}
|
||||
|
||||
impl TomlProfile {
|
||||
@ -998,6 +1000,10 @@ impl TomlProfile {
|
||||
if let Some(v) = &profile.trim_paths {
|
||||
self.trim_paths = Some(v.clone())
|
||||
}
|
||||
|
||||
if let Some(v) = profile.hint_mostly_unused {
|
||||
self.hint_mostly_unused = Some(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1135,6 +1135,7 @@ fn build_base_args(
|
||||
strip,
|
||||
rustflags: profile_rustflags,
|
||||
trim_paths,
|
||||
hint_mostly_unused,
|
||||
..
|
||||
} = unit.profile.clone();
|
||||
let test = unit.mode.is_any_test();
|
||||
@ -1325,6 +1326,16 @@ fn build_base_args(
|
||||
opt(cmd, "-C", "incremental=", Some(dir));
|
||||
}
|
||||
|
||||
if hint_mostly_unused {
|
||||
if bcx.gctx.cli_unstable().profile_hint_mostly_unused {
|
||||
cmd.arg("-Zhint-mostly-unused");
|
||||
} else {
|
||||
bcx.gctx
|
||||
.shell()
|
||||
.warn("ignoring 'hint-mostly-unused' profile option, pass `-Zprofile-hint-mostly-unused` to enable it")?;
|
||||
}
|
||||
}
|
||||
|
||||
let strip = strip.into_inner();
|
||||
if strip != StripInner::None {
|
||||
cmd.arg("-C").arg(format!("strip={}", strip));
|
||||
|
@ -845,6 +845,7 @@ unstable_cli_options!(
|
||||
no_index_update: bool = ("Do not update the registry index even if the cache is outdated"),
|
||||
package_workspace: bool = ("Handle intra-workspace dependencies when packaging"),
|
||||
panic_abort_tests: bool = ("Enable support to run tests with -Cpanic=abort"),
|
||||
profile_hint_mostly_unused: bool = ("Enable the `hint-mostly-unused` setting in profiles to mark a crate as mostly unused."),
|
||||
profile_rustflags: bool = ("Enable the `rustflags` option in profiles in .cargo/config.toml file"),
|
||||
public_dependency: bool = ("Respect a dependency's `public` field in Cargo.toml to control public/private dependencies"),
|
||||
publish_timeout: bool = ("Enable the `publish.timeout` key in .cargo/config.toml file"),
|
||||
@ -1366,6 +1367,7 @@ impl CliUnstable {
|
||||
"package-workspace" => self.package_workspace = parse_empty(k, v)?,
|
||||
"panic-abort-tests" => self.panic_abort_tests = parse_empty(k, v)?,
|
||||
"public-dependency" => self.public_dependency = parse_empty(k, v)?,
|
||||
"profile-hint-mostly-unused" => self.profile_hint_mostly_unused = parse_empty(k, v)?,
|
||||
"profile-rustflags" => self.profile_rustflags = parse_empty(k, v)?,
|
||||
"trim-paths" => self.trim_paths = parse_empty(k, v)?,
|
||||
"publish-timeout" => self.publish_timeout = parse_empty(k, v)?,
|
||||
|
@ -577,6 +577,9 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) {
|
||||
if let Some(trim_paths) = &toml.trim_paths {
|
||||
profile.trim_paths = Some(trim_paths.clone());
|
||||
}
|
||||
if let Some(hint_mostly_unused) = toml.hint_mostly_unused {
|
||||
profile.hint_mostly_unused = hint_mostly_unused;
|
||||
}
|
||||
profile.strip = match toml.strip {
|
||||
Some(StringOrBool::Bool(true)) => Strip::Resolved(StripInner::Named("symbols".into())),
|
||||
Some(StringOrBool::Bool(false)) => Strip::Resolved(StripInner::None),
|
||||
@ -626,6 +629,8 @@ pub struct Profile {
|
||||
// remove when `-Ztrim-paths` is stablized
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub trim_paths: Option<TomlTrimPaths>,
|
||||
#[serde(skip_serializing_if = "std::ops::Not::not")]
|
||||
pub hint_mostly_unused: bool,
|
||||
}
|
||||
|
||||
impl Default for Profile {
|
||||
@ -647,6 +652,7 @@ impl Default for Profile {
|
||||
strip: Strip::Deferred(StripInner::None),
|
||||
rustflags: vec![],
|
||||
trim_paths: None,
|
||||
hint_mostly_unused: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -676,6 +682,7 @@ compact_debug! {
|
||||
strip
|
||||
rustflags
|
||||
trim_paths
|
||||
hint_mostly_unused
|
||||
)]
|
||||
}
|
||||
}
|
||||
|
@ -924,6 +924,25 @@ profile-rustflags = true
|
||||
rustflags = [ "-C", "..." ]
|
||||
```
|
||||
|
||||
## Profile `hint-mostly-unused` option
|
||||
* Tracking Issue: [#15644](https://github.com/rust-lang/cargo/issues/15644)
|
||||
|
||||
This feature provides a new option in the `[profile]` section to enable the
|
||||
rustc `hint-mostly-unused` option. This is primarily useful to enable 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.
|
||||
|
||||
## rustdoc-map
|
||||
* Tracking Issue: [#8296](https://github.com/rust-lang/cargo/issues/8296)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<svg width="1230px" height="866px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="1255px" height="884px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { background: #000000 }
|
||||
@ -20,95 +20,97 @@
|
||||
</tspan>
|
||||
<tspan x="10px" y="46px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="64px"><tspan> -Z allow-features Allow *only* the listed unstable features</tspan>
|
||||
<tspan x="10px" y="64px"><tspan> -Z allow-features Allow *only* the listed unstable features</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="82px"><tspan> -Z asymmetric-token Allows authenticating with asymmetric tokens</tspan>
|
||||
<tspan x="10px" y="82px"><tspan> -Z asymmetric-token Allows authenticating with asymmetric tokens</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="100px"><tspan> -Z avoid-dev-deps Avoid installing dev-dependencies if possible</tspan>
|
||||
<tspan x="10px" y="100px"><tspan> -Z avoid-dev-deps Avoid installing dev-dependencies if possible</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="118px"><tspan> -Z binary-dep-depinfo Track changes to dependency artifacts</tspan>
|
||||
<tspan x="10px" y="118px"><tspan> -Z binary-dep-depinfo Track changes to dependency artifacts</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="136px"><tspan> -Z bindeps Allow Cargo packages to depend on bin, cdylib, and staticlib crates, and use the artifacts built by those crates</tspan>
|
||||
<tspan x="10px" y="136px"><tspan> -Z bindeps Allow Cargo packages to depend on bin, cdylib, and staticlib crates, and use the artifacts built by those crates</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="154px"><tspan> -Z build-dir Enable the `build.build-dir` option in .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="154px"><tspan> -Z build-dir Enable the `build.build-dir` option in .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="172px"><tspan> -Z build-std Enable Cargo to compile the standard library itself as part of a crate graph compilation</tspan>
|
||||
<tspan x="10px" y="172px"><tspan> -Z build-std Enable Cargo to compile the standard library itself as part of a crate graph compilation</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="190px"><tspan> -Z build-std-features Configure features enabled for the standard library itself when building the standard library</tspan>
|
||||
<tspan x="10px" y="190px"><tspan> -Z build-std-features Configure features enabled for the standard library itself when building the standard library</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="208px"><tspan> -Z cargo-lints Enable the `[lints.cargo]` table</tspan>
|
||||
<tspan x="10px" y="208px"><tspan> -Z cargo-lints Enable the `[lints.cargo]` table</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="226px"><tspan> -Z checksum-freshness Use a checksum to determine if output is fresh rather than filesystem mtime</tspan>
|
||||
<tspan x="10px" y="226px"><tspan> -Z checksum-freshness Use a checksum to determine if output is fresh rather than filesystem mtime</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="244px"><tspan> -Z codegen-backend Enable the `codegen-backend` option in profiles in .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="244px"><tspan> -Z codegen-backend Enable the `codegen-backend` option in profiles in .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="262px"><tspan> -Z config-include Enable the `include` key in config files</tspan>
|
||||
<tspan x="10px" y="262px"><tspan> -Z config-include Enable the `include` key in config files</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="280px"><tspan> -Z direct-minimal-versions Resolve minimal dependency versions instead of maximum (direct dependencies only)</tspan>
|
||||
<tspan x="10px" y="280px"><tspan> -Z direct-minimal-versions Resolve minimal dependency versions instead of maximum (direct dependencies only)</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="298px"><tspan> -Z dual-proc-macros Build proc-macros for both the host and the target</tspan>
|
||||
<tspan x="10px" y="298px"><tspan> -Z dual-proc-macros Build proc-macros for both the host and the target</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="316px"><tspan> -Z feature-unification Enable new feature unification modes in workspaces</tspan>
|
||||
<tspan x="10px" y="316px"><tspan> -Z feature-unification Enable new feature unification modes in workspaces</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="334px"><tspan> -Z fix-edition Permanently unstable edition migration helper</tspan>
|
||||
<tspan x="10px" y="334px"><tspan> -Z fix-edition Permanently unstable edition migration helper</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="352px"><tspan> -Z gc Track cache usage and "garbage collect" unused files</tspan>
|
||||
<tspan x="10px" y="352px"><tspan> -Z gc Track cache usage and "garbage collect" unused files</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="370px"><tspan> -Z git Enable support for shallow git fetch operations</tspan>
|
||||
<tspan x="10px" y="370px"><tspan> -Z git Enable support for shallow git fetch operations</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="388px"><tspan> -Z gitoxide Use gitoxide for the given git interactions, or all of them if no argument is given</tspan>
|
||||
<tspan x="10px" y="388px"><tspan> -Z gitoxide Use gitoxide for the given git interactions, or all of them if no argument is given</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="406px"><tspan> -Z host-config Enable the `[host]` section in the .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="406px"><tspan> -Z host-config Enable the `[host]` section in the .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="424px"><tspan> -Z minimal-versions Resolve minimal dependency versions instead of maximum</tspan>
|
||||
<tspan x="10px" y="424px"><tspan> -Z minimal-versions Resolve minimal dependency versions instead of maximum</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="442px"><tspan> -Z msrv-policy Enable rust-version aware policy within cargo</tspan>
|
||||
<tspan x="10px" y="442px"><tspan> -Z msrv-policy Enable rust-version aware policy within cargo</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="460px"><tspan> -Z mtime-on-use Configure Cargo to update the mtime of used files</tspan>
|
||||
<tspan x="10px" y="460px"><tspan> -Z mtime-on-use Configure Cargo to update the mtime of used files</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="478px"><tspan> -Z no-embed-metadata Avoid embedding metadata in library artifacts</tspan>
|
||||
<tspan x="10px" y="478px"><tspan> -Z no-embed-metadata Avoid embedding metadata in library artifacts</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="496px"><tspan> -Z no-index-update Do not update the registry index even if the cache is outdated</tspan>
|
||||
<tspan x="10px" y="496px"><tspan> -Z no-index-update Do not update the registry index even if the cache is outdated</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="514px"><tspan> -Z package-workspace Handle intra-workspace dependencies when packaging</tspan>
|
||||
<tspan x="10px" y="514px"><tspan> -Z package-workspace Handle intra-workspace dependencies when packaging</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="532px"><tspan> -Z panic-abort-tests Enable support to run tests with -Cpanic=abort</tspan>
|
||||
<tspan x="10px" y="532px"><tspan> -Z panic-abort-tests Enable support to run tests with -Cpanic=abort</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="550px"><tspan> -Z profile-rustflags Enable the `rustflags` option in profiles in .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="550px"><tspan> -Z profile-hint-mostly-unused Enable the `hint-mostly-unused` setting in profiles to mark a crate as mostly unused.</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="568px"><tspan> -Z public-dependency Respect a dependency's `public` field in Cargo.toml to control public/private dependencies</tspan>
|
||||
<tspan x="10px" y="568px"><tspan> -Z profile-rustflags Enable the `rustflags` option in profiles in .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="586px"><tspan> -Z publish-timeout Enable the `publish.timeout` key in .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="586px"><tspan> -Z public-dependency Respect a dependency's `public` field in Cargo.toml to control public/private dependencies</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="604px"><tspan> -Z root-dir Set the root directory relative to which paths are printed (defaults to workspace root)</tspan>
|
||||
<tspan x="10px" y="604px"><tspan> -Z publish-timeout Enable the `publish.timeout` key in .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="622px"><tspan> -Z rustdoc-depinfo Use dep-info files in rustdoc rebuild detection</tspan>
|
||||
<tspan x="10px" y="622px"><tspan> -Z root-dir Set the root directory relative to which paths are printed (defaults to workspace root)</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="640px"><tspan> -Z rustdoc-map Allow passing external documentation mappings to rustdoc</tspan>
|
||||
<tspan x="10px" y="640px"><tspan> -Z rustdoc-depinfo Use dep-info files in rustdoc rebuild detection</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="658px"><tspan> -Z rustdoc-scrape-examples Allows Rustdoc to scrape code examples from reverse-dependencies</tspan>
|
||||
<tspan x="10px" y="658px"><tspan> -Z rustdoc-map Allow passing external documentation mappings to rustdoc</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="676px"><tspan> -Z sbom Enable the `sbom` option in build config in .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="676px"><tspan> -Z rustdoc-scrape-examples Allows Rustdoc to scrape code examples from reverse-dependencies</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="694px"><tspan> -Z script Enable support for single-file, `.rs` packages</tspan>
|
||||
<tspan x="10px" y="694px"><tspan> -Z sbom Enable the `sbom` option in build config in .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="712px"><tspan> -Z target-applies-to-host Enable the `target-applies-to-host` key in the .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="712px"><tspan> -Z script Enable support for single-file, `.rs` packages</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="730px"><tspan> -Z trim-paths Enable the `trim-paths` option in profiles</tspan>
|
||||
<tspan x="10px" y="730px"><tspan> -Z target-applies-to-host Enable the `target-applies-to-host` key in the .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="748px"><tspan> -Z unstable-options Allow the usage of unstable options</tspan>
|
||||
<tspan x="10px" y="748px"><tspan> -Z trim-paths Enable the `trim-paths` option in profiles</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="766px"><tspan> -Z warnings Allow use of the build.warnings config key</tspan>
|
||||
<tspan x="10px" y="766px"><tspan> -Z unstable-options Allow the usage of unstable options</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="784px">
|
||||
<tspan x="10px" y="784px"><tspan> -Z warnings Allow use of the build.warnings config key</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="802px"><tspan>Run with `cargo -Z [FLAG] [COMMAND]`</tspan>
|
||||
<tspan x="10px" y="802px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="820px">
|
||||
<tspan x="10px" y="820px"><tspan>Run with `cargo -Z [FLAG] [COMMAND]`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="838px"><tspan>See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about these flags.</tspan>
|
||||
<tspan x="10px" y="838px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="856px">
|
||||
<tspan x="10px" y="856px"><tspan>See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about these flags.</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="874px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.9 KiB |
@ -1666,6 +1666,7 @@ fn all_profile_options() {
|
||||
build_override: None,
|
||||
rustflags: None,
|
||||
trim_paths: None,
|
||||
hint_mostly_unused: None,
|
||||
};
|
||||
let mut overrides = BTreeMap::new();
|
||||
let key = cargo_toml::ProfilePackageSpec::Spec(PackageIdSpec::parse("foo").unwrap());
|
||||
|
@ -876,3 +876,83 @@ fn debug_options_valid() {
|
||||
.with_stderr_does_not_contain("[..]-C debuginfo[..]")
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn profile_hint_mostly_unused_warn_without_gate() {
|
||||
Package::new("bar", "1.0.0").publish();
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
edition = "2015"
|
||||
|
||||
[dependencies]
|
||||
bar = "1.0"
|
||||
|
||||
[profile.dev.package.bar]
|
||||
hint-mostly-unused = true
|
||||
"#,
|
||||
)
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
p.cargo("build -v")
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] `dummy-registry` index
|
||||
[LOCKING] 1 package to latest compatible version
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
||||
[WARNING] ignoring 'hint-mostly-unused' profile option, pass `-Zprofile-hint-mostly-unused` to enable it
|
||||
[COMPILING] bar v1.0.0
|
||||
[RUNNING] `rustc --crate-name bar [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.with_stderr_does_not_contain("-Zhint-mostly-unused")
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test(nightly, reason = "-Zhint-mostly-unused is unstable")]
|
||||
fn profile_hint_mostly_unused_nightly() {
|
||||
Package::new("bar", "1.0.0").publish();
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
edition = "2015"
|
||||
|
||||
[dependencies]
|
||||
bar = "1.0"
|
||||
|
||||
[profile.dev.package.bar]
|
||||
hint-mostly-unused = true
|
||||
"#,
|
||||
)
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
p.cargo("build -Zprofile-hint-mostly-unused -v")
|
||||
.masquerade_as_nightly_cargo(&["profile-hint-mostly-unused"])
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] `dummy-registry` index
|
||||
[LOCKING] 1 package to latest compatible version
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
||||
[COMPILING] bar v1.0.0
|
||||
[RUNNING] `rustc --crate-name bar [..] -Zhint-mostly-unused [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.with_stderr_does_not_contain(
|
||||
"[RUNNING] `rustc --crate-name foo [..] -Zhint-mostly-unused [..]",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user