]> git.proxmox.com Git - cargo.git/commitdiff
Reinstate warning regarding 'debug' profile
authorDan Aloni <dan@kernelim.com>
Thu, 12 Sep 2019 05:22:19 +0000 (08:22 +0300)
committerDan Aloni <dan@kernelim.com>
Thu, 12 Sep 2019 05:22:20 +0000 (08:22 +0300)
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.

src/cargo/util/toml/mod.rs
tests/testsuite/bad_config.rs

index 7ece621822f67dca2c75234333badee582c085fa..a824f51ae167195d845e8012c504c600839fb52b 100644 (file)
@@ -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<String>) -> 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(())
index 87fc42bab17886341f4f8b30f68248655cc32541..9c5fb17ff55c3b38eb87e67bca7b419e67b3e167 100644 (file)
@@ -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();