Skip to content

Commit 6569ce2

Browse files
authored
Unrolled build for rust-lang#125071
Rollup merge of rust-lang#125071 - GuillaumeGomez:migrate-rustdoc-target-spec-json-path, r=jieyouxu Migrate rustdoc target spec json path Part of rust-lang#121876. r? `@jieyouxu`
2 parents 030a12c + b515de8 commit 6569ce2

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed

Diff for: src/tools/run-make-support/src/rustdoc.rs

+14
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ impl Rustdoc {
123123
self
124124
}
125125

126+
/// Specify the target triple, or a path to a custom target json spec file.
127+
pub fn target(&mut self, target: &str) -> &mut Self {
128+
self.cmd.arg(format!("--target={target}"));
129+
self
130+
}
131+
126132
/// Specify the crate type.
127133
pub fn crate_type(&mut self, crate_type: &str) -> &mut Self {
128134
self.cmd.arg("--crate-type");
@@ -137,6 +143,14 @@ impl Rustdoc {
137143
self
138144
}
139145

146+
/// Add a directory to the library search path. It corresponds to the `-L`
147+
/// rustdoc option.
148+
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
149+
self.cmd.arg("-L");
150+
self.cmd.arg(path.as_ref());
151+
self
152+
}
153+
140154
#[track_caller]
141155
pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
142156
let caller_location = std::panic::Location::caller();

Diff for: src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ run-make/rustdoc-scrape-examples-multiple/Makefile
248248
run-make/rustdoc-scrape-examples-remap/Makefile
249249
run-make/rustdoc-scrape-examples-test/Makefile
250250
run-make/rustdoc-scrape-examples-whitespace/Makefile
251-
run-make/rustdoc-target-spec-json-path/Makefile
252251
run-make/rustdoc-themes/Makefile
253252
run-make/rustdoc-verify-output-files/Makefile
254253
run-make/rustdoc-with-out-dir-option/Makefile

Diff for: tests/run-make/rustdoc-target-spec-json-path/Makefile

-9
This file was deleted.
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Test that rustdoc will properly canonicalize the target spec json path just like rustc.
2+
3+
use run_make_support::{rustc, rustdoc, tmp_dir};
4+
5+
fn main() {
6+
let out_dir = tmp_dir().join("rustdoc-target-spec-json-path");
7+
rustc().crate_type("lib").input("dummy_core.rs").target("target.json").run();
8+
rustdoc()
9+
.input("my_crate.rs")
10+
.output(out_dir)
11+
.library_search_path(tmp_dir())
12+
.target("target.json")
13+
.run();
14+
}

0 commit comments

Comments
 (0)