Skip to content

Commit c5b4d12

Browse files
authored
Unrolled build for #153003
Rollup merge of #153003 - notriddle:emit-outdir, r=fmease rustdoc: make `--emit` and `--out-dir` mimic rustc The behavior in the test case matches rustc's: test-dingus % ls main.rs test-dingus % mkdir foobar test-dingus % rustc --emit=dep-info main.rs --out-dir=foobar test-dingus % ls foobar main.rs test-dingus % ls foobar main.d test-dingus % rustc --emit=dep-info=testfile.d main.rs --out-dir=foobar test-dingus % ls foobar main.rs testfile.d test-dingus % ls foobar main.d CC #146220 (comment)
2 parents d3877ec + 22a0e06 commit c5b4d12

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/librustdoc/core.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,11 @@ pub(crate) fn create_config(
285285
crate_check_cfg: check_cfgs,
286286
input,
287287
output_file: None,
288-
output_dir: None,
288+
output_dir: if render_options.output_to_stdout {
289+
None
290+
} else {
291+
Some(render_options.output.clone())
292+
},
289293
file_loader: None,
290294
lint_caps,
291295
psess_created: None,

tests/run-make/rustdoc-dep-info/rmake.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use run_make_support::assertion_helpers::assert_contains;
77
use run_make_support::{path, rfs, rustdoc};
88

99
fn main() {
10+
rfs::create_dir("doc");
11+
1012
// We're only emitting dep info, so we shouldn't be running static analysis to
1113
// figure out that this program is erroneous.
1214
// Ensure that all kinds of input reading flags end up in dep-info.
@@ -20,7 +22,7 @@ fn main() {
2022
.emit("dep-info")
2123
.run();
2224

23-
let content = rfs::read_to_string("foo.d");
25+
let content = rfs::read_to_string("doc/foo.d");
2426
assert_contains(&content, "lib.rs:");
2527
assert_contains(&content, "foo.rs:");
2628
assert_contains(&content, "bar.rs:");

tests/run-make/rustdoc-scrape-examples-dep-info/rmake.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ use run_make_support::{assert_contains, rfs};
55
mod scrape;
66

77
fn main() {
8+
rfs::create_dir("rustdoc");
9+
810
scrape::scrape(
911
&["--scrape-tests", "--emit=dep-info"],
1012
&["--emit=dep-info,invocation-specific"],
1113
);
1214

13-
let content = rfs::read_to_string("foobar.d").replace(r"\", "/");
15+
let content = rfs::read_to_string("rustdoc/foobar.d").replace(r"\", "/");
1416
assert_contains(&content, "lib.rs:");
1517
assert_contains(&content, "rustdoc/ex.calls:");
1618

17-
let content = rfs::read_to_string("ex.d").replace(r"\", "/");
19+
let content = rfs::read_to_string("rustdoc/ex.d").replace(r"\", "/");
1820
assert_contains(&content, "examples/ex.rs:");
1921
}

0 commit comments

Comments
 (0)