From: Dan Aloni Date: Thu, 12 Sep 2019 05:22:19 +0000 (+0300) Subject: Reinstate warning regarding 'debug' profile X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=80cc7c8170b92fab7a045ad05bf019642a94a636;p=cargo.git Reinstate warning regarding 'debug' profile The previous warning was detected at the decoding level, with the test removed in an earlier commit. Here it is brought back, in the custom profile processing level. Keeping this warning will serve to prevent confusion, when people expect to affect the 'debug' directory via the 'debug' profile to no effect, where in fact the 'dev' profile is the profile that they opted to change. --- diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 7ece62182..a824f51ae 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -67,7 +67,7 @@ fn do_read_manifest( let add_unused = |warnings: &mut Warnings| { for key in unused { warnings.add_warning(format!("unused manifest key: {}", key)); - if key == "profile.debug" || key == "profiles.debug" { + if key == "profiles.debug" { warnings.add_warning("use `[profile.dev]` to configure debug builds".to_string()); } } @@ -282,6 +282,10 @@ impl TomlProfiles { pub fn validate(&self, features: &Features, warnings: &mut Vec) -> CargoResult<()> { for (name, profile) in &self.0 { + if name == "debug" { + warnings.push("use `[profile.dev]` to configure debug builds".to_string()); + } + profile.validate(&name, features, warnings)?; } Ok(()) diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index 87fc42bab..9c5fb17ff 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -707,6 +707,16 @@ warning: unused manifest key: target.foo.bar .file("src/lib.rs", "") .build(); + p.cargo("build -Z named-profiles") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +warning: use `[profile.dev]` to configure debug builds +[..] +[..]", + ) + .run(); + p.cargo("build -Z named-profiles") .masquerade_as_nightly_cargo() .run();