Skip to content

Commit 0669379

Browse files
Don't silently ignore errors that happen during rendering
1 parent e72ea1d commit 0669379

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustdoc/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ type MainResult = Result<(), ErrorGuaranteed>;
674674

675675
fn wrap_return(diag: &rustc_errors::Handler, res: Result<(), String>) -> MainResult {
676676
match res {
677-
Ok(()) => Ok(()),
677+
Ok(()) => diag.has_errors().map_or(Ok(()), Err),
678678
Err(err) => {
679679
let reported = diag.struct_err(&err).emit();
680680
Err(reported)
@@ -689,7 +689,7 @@ fn run_renderer<'tcx, T: formats::FormatRenderer<'tcx>>(
689689
tcx: TyCtxt<'tcx>,
690690
) -> MainResult {
691691
match formats::run_format::<T>(krate, renderopts, cache, tcx) {
692-
Ok(_) => Ok(()),
692+
Ok(_) => tcx.sess.has_errors().map_or(Ok(()), Err),
693693
Err(e) => {
694694
let mut msg =
695695
tcx.sess.struct_err(&format!("couldn't generate documentation: {}", e.error));

0 commit comments

Comments
 (0)