mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Include package ID in warnings to identify affected crate
This commit is contained in:
parent
28b9762466
commit
9949fa8a66
@ -1141,6 +1141,14 @@ fn build_base_args(
|
|||||||
let hints = unit.pkg.hints().cloned().unwrap_or_default();
|
let hints = unit.pkg.hints().cloned().unwrap_or_default();
|
||||||
let test = unit.mode.is_any_test();
|
let test = unit.mode.is_any_test();
|
||||||
|
|
||||||
|
let warn = |msg: &str| {
|
||||||
|
bcx.gctx.shell().warn(format!(
|
||||||
|
"{}@{}: {msg}",
|
||||||
|
unit.pkg.package_id().name(),
|
||||||
|
unit.pkg.package_id().version()
|
||||||
|
))
|
||||||
|
};
|
||||||
|
|
||||||
cmd.arg("--crate-name").arg(&unit.target.crate_name());
|
cmd.arg("--crate-name").arg(&unit.target.crate_name());
|
||||||
|
|
||||||
let edition = unit.target.edition();
|
let edition = unit.target.edition();
|
||||||
@ -1331,7 +1339,7 @@ fn build_base_args(
|
|||||||
None => None,
|
None => None,
|
||||||
Some(toml::Value::Boolean(b)) => Some(b),
|
Some(toml::Value::Boolean(b)) => Some(b),
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
bcx.gctx.shell().warn(format!(
|
warn(&format!(
|
||||||
"ignoring unsupported value type ({}) for 'hints.mostly-unused', which expects a boolean",
|
"ignoring unsupported value type ({}) for 'hints.mostly-unused', which expects a boolean",
|
||||||
v.type_str()
|
v.type_str()
|
||||||
))?;
|
))?;
|
||||||
@ -1346,13 +1354,13 @@ fn build_base_args(
|
|||||||
cmd.arg("-Zhint-mostly-unused");
|
cmd.arg("-Zhint-mostly-unused");
|
||||||
} else {
|
} else {
|
||||||
if profile_hint_mostly_unused.is_some() {
|
if profile_hint_mostly_unused.is_some() {
|
||||||
bcx.gctx
|
warn(
|
||||||
.shell()
|
"ignoring 'hint-mostly-unused' profile option, pass `-Zprofile-hint-mostly-unused` to enable it",
|
||||||
.warn("ignoring 'hint-mostly-unused' profile option, pass `-Zprofile-hint-mostly-unused` to enable it")?;
|
)?;
|
||||||
} else if pkg_hint_mostly_unused.is_some() {
|
} else if pkg_hint_mostly_unused.is_some() {
|
||||||
bcx.gctx
|
warn(
|
||||||
.shell()
|
"ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it",
|
||||||
.warn("ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it")?;
|
)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ fn hint_unknown_type_warn() {
|
|||||||
[LOCKING] 1 package to latest compatible version
|
[LOCKING] 1 package to latest compatible version
|
||||||
[DOWNLOADING] crates ...
|
[DOWNLOADING] crates ...
|
||||||
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
||||||
[WARNING] ignoring unsupported value type (integer) for 'hints.mostly-unused', which expects a boolean
|
[WARNING] bar@1.0.0: ignoring unsupported value type (integer) for 'hints.mostly-unused', which expects a boolean
|
||||||
[CHECKING] bar v1.0.0
|
[CHECKING] bar v1.0.0
|
||||||
[RUNNING] `rustc --crate-name bar [..]`
|
[RUNNING] `rustc --crate-name bar [..]`
|
||||||
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
@ -146,7 +146,7 @@ fn hints_mostly_unused_warn_without_gate() {
|
|||||||
[LOCKING] 1 package to latest compatible version
|
[LOCKING] 1 package to latest compatible version
|
||||||
[DOWNLOADING] crates ...
|
[DOWNLOADING] crates ...
|
||||||
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
||||||
[WARNING] ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it
|
[WARNING] bar@1.0.0: ignoring 'hints.mostly-unused', pass `-Zprofile-hint-mostly-unused` to enable it
|
||||||
[CHECKING] bar v1.0.0
|
[CHECKING] bar v1.0.0
|
||||||
[RUNNING] `rustc --crate-name bar [..]`
|
[RUNNING] `rustc --crate-name bar [..]`
|
||||||
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
|
@ -904,7 +904,7 @@ fn profile_hint_mostly_unused_warn_without_gate() {
|
|||||||
[LOCKING] 1 package to latest compatible version
|
[LOCKING] 1 package to latest compatible version
|
||||||
[DOWNLOADING] crates ...
|
[DOWNLOADING] crates ...
|
||||||
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
||||||
[WARNING] ignoring 'hint-mostly-unused' profile option, pass `-Zprofile-hint-mostly-unused` to enable it
|
[WARNING] bar@1.0.0: ignoring 'hint-mostly-unused' profile option, pass `-Zprofile-hint-mostly-unused` to enable it
|
||||||
[CHECKING] bar v1.0.0
|
[CHECKING] bar v1.0.0
|
||||||
[RUNNING] `rustc --crate-name bar [..]`
|
[RUNNING] `rustc --crate-name bar [..]`
|
||||||
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user