Deprecate `doc` profile.
authorEric Huss <eric@huss.org>
Sat, 5 May 2018 15:52:19 +0000 (08:52 -0700)
committerEric Huss <eric@huss.org>
Sat, 5 May 2018 15:52:19 +0000 (08:52 -0700)
Fixes #5434

src/cargo/util/toml/mod.rs
src/doc/src/reference/manifest.md
tests/testsuite/profile_targets.rs
tests/testsuite/profiles.rs

index 2d49c1c9150fd1c7b6dfa46560886b01138a129d..667b2ea090224c238e8425b8b028b7be1a5bc76f 100644 (file)
@@ -416,6 +416,9 @@ impl TomlProfile {
         }
 
         match name {
+            "doc" => {
+                warnings.push("profile `doc` is deprecated and has no effect".to_string());
+            }
             "test" | "bench" => {
                 if self.panic.is_some() {
                     warnings.push(format!("`panic` setting is ignored for `{}` profile", name))
index 9ed540ec9afa8f2873312339b20a1ad898d6e606..c96530e8d2124b1b0e8aae67b388adac634b62d9 100644 (file)
@@ -294,7 +294,7 @@ project’s profiles are actually read. All dependencies’ profiles will be
 overridden. This is done so the top-level project has control over how its
 dependencies are compiled.
 
-There are five currently supported profile names, all of which have the same
+There are four currently supported profile names, all of which have the same
 configuration available to them. Listed below is the configuration available,
 along with the defaults for each profile.
 
@@ -357,18 +357,6 @@ codegen-units = 16
 panic = 'unwind'
 incremental = false
 overflow-checks = false
-
-# The documentation profile, used for `cargo doc`.
-[profile.doc]
-opt-level = 0
-debug = 2
-rpath = false
-lto = false
-debug-assertions = true
-codegen-units = 16
-panic = 'unwind'
-incremental = true
-overflow-checks = true
 ```
 
 ### The `[features]` section
index c43ac62e94dafc16193941c024f47a04a04b8a8e..2ede9d16888c98c6d4cfc7591a0f13212b1dea9e 100644 (file)
@@ -32,8 +32,6 @@ fn all_target_project() -> Project {
             codegen-units = 3
             [profile.bench]
             codegen-units = 4
-            [profile.doc]
-            codegen-units = 5
         "#,
         )
         .file("src/lib.rs", "extern crate bar;")
index 8d1478ced245f2afeeac726c0354976a94b81d41..77a7813018c3a84a8c21519bd1935eafc3fc5f7c 100644 (file)
@@ -371,3 +371,28 @@ fn profile_panic_test_bench() {
         ),
     );
 }
+
+#[test]
+fn profile_doc_deprecated() {
+    let p = project("foo")
+        .file(
+            "Cargo.toml",
+            r#"
+            [package]
+            name = "foo"
+            version = "0.0.1"
+
+            [profile.doc]
+            opt-level = 0
+        "#,
+        )
+        .file("src/lib.rs", "")
+        .build();
+
+    assert_that(
+        p.cargo("build"),
+        execs()
+            .with_status(0)
+            .with_stderr_contains("[WARNING] profile `doc` is deprecated and has no effect"),
+    );
+}