Skip to content

Commit a24e8c6

Browse files
committed
Auto merge of #5486 - ehuss:deprecate-doc, r=matklad
Deprecate `doc` profile. Fixes #5434
2 parents 556f80f + e881999 commit a24e8c6

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ impl TomlProfile {
416416
}
417417

418418
match name {
419+
"doc" => {
420+
warnings.push("profile `doc` is deprecated and has no effect".to_string());
421+
}
419422
"test" | "bench" => {
420423
if self.panic.is_some() {
421424
warnings.push(format!("`panic` setting is ignored for `{}` profile", name))

src/doc/src/reference/manifest.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ project’s profiles are actually read. All dependencies’ profiles will be
294294
overridden. This is done so the top-level project has control over how its
295295
dependencies are compiled.
296296

297-
There are five currently supported profile names, all of which have the same
297+
There are four currently supported profile names, all of which have the same
298298
configuration available to them. Listed below is the configuration available,
299299
along with the defaults for each profile.
300300

@@ -357,18 +357,6 @@ codegen-units = 16
357357
panic = 'unwind'
358358
incremental = false
359359
overflow-checks = false
360-
361-
# The documentation profile, used for `cargo doc`.
362-
[profile.doc]
363-
opt-level = 0
364-
debug = 2
365-
rpath = false
366-
lto = false
367-
debug-assertions = true
368-
codegen-units = 16
369-
panic = 'unwind'
370-
incremental = true
371-
overflow-checks = true
372360
```
373361

374362
### The `[features]` section

tests/testsuite/profile_targets.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ fn all_target_project() -> Project {
3232
codegen-units = 3
3333
[profile.bench]
3434
codegen-units = 4
35-
[profile.doc]
36-
codegen-units = 5
3735
"#,
3836
)
3937
.file("src/lib.rs", "extern crate bar;")

tests/testsuite/profiles.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,28 @@ fn profile_panic_test_bench() {
371371
),
372372
);
373373
}
374+
375+
#[test]
376+
fn profile_doc_deprecated() {
377+
let p = project("foo")
378+
.file(
379+
"Cargo.toml",
380+
r#"
381+
[package]
382+
name = "foo"
383+
version = "0.0.1"
384+
385+
[profile.doc]
386+
opt-level = 0
387+
"#,
388+
)
389+
.file("src/lib.rs", "")
390+
.build();
391+
392+
assert_that(
393+
p.cargo("build"),
394+
execs()
395+
.with_status(0)
396+
.with_stderr_contains("[WARNING] profile `doc` is deprecated and has no effect"),
397+
);
398+
}

0 commit comments

Comments
 (0)