diff options
| author | Will Crichton <wcrichto@cs.stanford.edu> | 2022-07-30 21:12:04 -0700 | 
|---|---|---|
| committer | Will Crichton <wcrichto@cs.stanford.edu> | 2022-08-01 00:23:19 -0700 | 
| commit | a93feaf6e12bf6a14f65c7ab21c6262796315626 (patch) | |
| tree | a906b28a4f0066c29577b0d87b3210df1b12cac3 /src/librustdoc/scrape_examples.rs | |
| parent | a2318651d4d2c6280a5047544cbf4180119ba966 (diff) | |
| download | rust-a93feaf6e12bf6a14f65c7ab21c6262796315626.tar.gz rust-a93feaf6e12bf6a14f65c7ab21c6262796315626.zip | |
Make Rustdoc exit with correct error code when scrape examples from invalid files
Diffstat (limited to 'src/librustdoc/scrape_examples.rs')
| -rw-r--r-- | src/librustdoc/scrape_examples.rs | 6 | 
1 files changed, 6 insertions, 0 deletions
| diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs index fd0b19034a2..0d968402503 100644 --- a/src/librustdoc/scrape_examples.rs +++ b/src/librustdoc/scrape_examples.rs @@ -304,6 +304,12 @@ pub(crate) fn run( let mut finder = FindCalls { calls: &mut calls, tcx, map: tcx.hir(), cx, target_crates }; tcx.hir().visit_all_item_likes_in_crate(&mut finder); + // The visitor might have found a type error, which we need to + // promote to a fatal error + if tcx.sess.diagnostic().has_errors_or_lint_errors().is_some() { + return Err(String::from("Compilation failed, aborting rustdoc")); + } + // Sort call locations within a given file in document order for fn_calls in calls.values_mut() { for file_calls in fn_calls.values_mut() { | 
