-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #124611 - Urgau:rustdoc-stdin, r=GuillaumeGomez
Add `-` (stdin) support in rustdoc This PR adds support for the special `-` input which threats the input as coming from *stdin* instead of being a filepath. Doing this also makes `rustdoc` consistent with `rustc` and ~~every~~ other tools. Full [motivation](#124611 (comment)). Fixes #123671 r? `@fmease`
- Loading branch information
Showing
8 changed files
with
86 additions
and
29 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
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,25 @@ | ||
//! This test checks rustdoc `-` (stdin) handling | ||
|
||
use run_make_support::{rustdoc, tmp_dir}; | ||
|
||
static INPUT: &str = r#" | ||
//! ``` | ||
//! dbg!(()); | ||
//! ``` | ||
pub struct F; | ||
"#; | ||
|
||
fn main() { | ||
let tmp_dir = tmp_dir(); | ||
let out_dir = tmp_dir.join("doc"); | ||
|
||
// rustdoc - | ||
rustdoc().arg("-").out_dir(&out_dir).stdin(INPUT).run(); | ||
assert!(out_dir.join("rust_out/struct.F.html").try_exists().unwrap()); | ||
|
||
// rustdoc --test - | ||
rustdoc().arg("--test").arg("-").stdin(INPUT).run(); | ||
|
||
// rustdoc file.rs - | ||
rustdoc().arg("file.rs").arg("-").run_fail(); | ||
} |