From e881999fb332289bdd861b72aaed9cad3150c860 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 5 May 2018 08:52:19 -0700 Subject: [PATCH] Deprecate `doc` profile. Fixes #5434 --- src/cargo/util/toml/mod.rs | 3 +++ src/doc/src/reference/manifest.md | 14 +------------- tests/testsuite/profile_targets.rs | 2 -- tests/testsuite/profiles.rs | 25 +++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 2d49c1c91..667b2ea09 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -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)) diff --git a/src/doc/src/reference/manifest.md b/src/doc/src/reference/manifest.md index 9ed540ec9..c96530e8d 100644 --- a/src/doc/src/reference/manifest.md +++ b/src/doc/src/reference/manifest.md @@ -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 diff --git a/tests/testsuite/profile_targets.rs b/tests/testsuite/profile_targets.rs index c43ac62e9..2ede9d168 100644 --- a/tests/testsuite/profile_targets.rs +++ b/tests/testsuite/profile_targets.rs @@ -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;") diff --git a/tests/testsuite/profiles.rs b/tests/testsuite/profiles.rs index 8d1478ced..77a781301 100644 --- a/tests/testsuite/profiles.rs +++ b/tests/testsuite/profiles.rs @@ -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"), + ); +} -- 2.30.2