about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAndreas Jonson <andjo403@users.noreply.github.com>2019-08-27 08:07:56 +0200
committerAndreas Jonson <andjo403@users.noreply.github.com>2019-08-29 22:23:05 +0200
commit56ab485fbe61add87ac8febea421e2a576edca26 (patch)
tree5c026b90c896931c2613e4dbbc4e7c737799f145 /src
parentfbdf1d2a71c89a731ed15d93af7abffa80176834 (diff)
downloadrust-56ab485fbe61add87ac8febea421e2a576edca26.tar.gz
rust-56ab485fbe61add87ac8febea421e2a576edca26.zip
support rustdoc test from stdin to rustc
Diffstat (limited to 'src')
-rw-r--r--src/librustc_driver/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index e7712ae115f..885e2fea26a 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -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 {