forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#128963 - GuillaumeGomez:output-to-stdout, r…
…=aDotInTheVoid Add possibility to generate rustdoc JSON output to stdout Fixes rust-lang#127165. I think it's likely common to want to get rustdoc json output directly instead of reading it from a file so I added this option to allow it. It's unstable and only works with `--output-format=json`. r? `@aDotInTheVoid`
- Loading branch information
Showing
6 changed files
with
85 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub struct Foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// This test verifies that rustdoc `-o -` prints JSON on stdout and doesn't generate | ||
// a JSON file. | ||
|
||
use std::path::PathBuf; | ||
|
||
use run_make_support::path_helpers::{cwd, has_extension, read_dir_entries_recursive}; | ||
use run_make_support::rustdoc; | ||
|
||
fn main() { | ||
// First we check that we generate the JSON in the stdout. | ||
rustdoc() | ||
.input("foo.rs") | ||
.output("-") | ||
.arg("-Zunstable-options") | ||
.output_format("json") | ||
.run() | ||
.assert_stdout_contains("{\""); | ||
|
||
// Then we check it didn't generate any JSON file. | ||
read_dir_entries_recursive(cwd(), |path| { | ||
if path.is_file() && has_extension(path, "json") { | ||
panic!("Found a JSON file {path:?}"); | ||
} | ||
}); | ||
} |