Skip to content

Commit

Permalink
support rustdoc test from stdin to rustc
Browse files Browse the repository at this point in the history
  • Loading branch information
andjo403 committed Aug 29, 2019
1 parent fbdf1d2 commit 56ab485
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,15 @@ fn make_input(free_matches: &[String]) -> Option<(Input, Option<PathBuf>, Option
} else {
None
};
if let Ok(path) = env::var("UNSTABLE_RUSTDOC_TEST_PATH") {
let line = env::var("UNSTABLE_RUSTDOC_TEST_LINE").
expect("when UNSTABLE_RUSTDOC_TEST_PATH is set \
UNSTABLE_RUSTDOC_TEST_LINE also needs to be set");
let line = isize::from_str_radix(&line, 10).
expect("UNSTABLE_RUSTDOC_TEST_LINE needs to be an number");
let file_name = FileName::doc_test_source_code(PathBuf::from(path), line);
return Some((Input::Str { name: file_name, input: src }, None, err));
}
Some((Input::Str { name: FileName::anon_source_code(&src), input: src },
None, err))
} else {
Expand Down

0 comments on commit 56ab485

Please sign in to comment.