Skip to content

Commit 95dafab

Browse files
committed
feat(unstable): add -Zrustdoc-depinfo flag
1 parent 84a38b9 commit 95dafab

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

src/cargo/core/features.rs

+2
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,7 @@ unstable_cli_options!(
790790
public_dependency: bool = ("Respect a dependency's `public` field in Cargo.toml to control public/private dependencies"),
791791
publish_timeout: bool = ("Enable the `publish.timeout` key in .cargo/config.toml file"),
792792
root_dir: Option<PathBuf> = ("Set the root directory relative to which paths are printed (defaults to workspace root)"),
793+
rustdoc_depinfo: bool = ("Use dep-info files in rustdoc rebuild detection"),
793794
rustdoc_map: bool = ("Allow passing external documentation mappings to rustdoc"),
794795
rustdoc_scrape_examples: bool = ("Allows Rustdoc to scrape code examples from reverse-dependencies"),
795796
sbom: bool = ("Enable the `sbom` option in build config in .cargo/config.toml file"),
@@ -1303,6 +1304,7 @@ impl CliUnstable {
13031304
"trim-paths" => self.trim_paths = parse_empty(k, v)?,
13041305
"publish-timeout" => self.publish_timeout = parse_empty(k, v)?,
13051306
"root-dir" => self.root_dir = v.map(|v| v.into()),
1307+
"rustdoc-depinfo" => self.rustdoc_depinfo = parse_empty(k, v)?,
13061308
"rustdoc-map" => self.rustdoc_map = parse_empty(k, v)?,
13071309
"rustdoc-scrape-examples" => self.rustdoc_scrape_examples = parse_empty(k, v)?,
13081310
"sbom" => self.sbom = parse_empty(k, v)?,

tests/testsuite/cargo/z_help/stdout.term.svg

+16-14
Loading

tests/testsuite/doc.rs

+17
Original file line numberDiff line numberDiff line change
@@ -2897,3 +2897,20 @@ Caused by:
28972897
.with_status(101)
28982898
.run();
28992899
}
2900+
2901+
#[cargo_test(nightly, reason = "`rustdoc --emit` is unstable")]
2902+
fn rustdoc_depinfo_gated() {
2903+
let p = project()
2904+
.file("Cargo.toml", &basic_lib_manifest("foo"))
2905+
.file("src/lib.rs", "")
2906+
.build();
2907+
2908+
p.cargo("doc -Zrustdoc-depinfo")
2909+
.with_status(101)
2910+
.with_stderr_data(str![[r#"
2911+
[ERROR] the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel
2912+
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
2913+
2914+
"#]])
2915+
.run();
2916+
}

0 commit comments

Comments
 (0)