diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-09 07:25:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-09 07:25:45 +0100 |
| commit | 4b09861a68f71539919c6d5c880a1c528b7be8ab (patch) | |
| tree | 5023c9047a40c21a1892010291554d5cb5305437 | |
| parent | 5b4723f154310478206795741e589186cb222e43 (diff) | |
| parent | b5a9f6a5373a6e2f188417ed734b9f94fc16ac51 (diff) | |
| download | rust-4b09861a68f71539919c6d5c880a1c528b7be8ab.tar.gz rust-4b09861a68f71539919c6d5c880a1c528b7be8ab.zip | |
Rollup merge of #105427 - GuillaumeGomez:dont-silently-ignore-rustdoc-errors, r=notriddle
Dont silently ignore rustdoc errors I applied the suggestions from https://github.com/rust-lang/rust/pull/104995 and also checked the rustdoc-ui error but couldn't reproduce it. r? `@notriddle`
| -rw-r--r-- | src/librustdoc/lib.rs | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/const-evalutation-ice.rs (renamed from src/test/rustdoc/const-evalutation-ice.rs) | 3 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/const-evalutation-ice.stderr | 9 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 3f84eb0b4c6..ef1d7da5a34 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -674,7 +674,7 @@ type MainResult = Result<(), ErrorGuaranteed>; fn wrap_return(diag: &rustc_errors::Handler, res: Result<(), String>) -> MainResult { match res { - Ok(()) => Ok(()), + Ok(()) => diag.has_errors().map_or(Ok(()), Err), Err(err) => { let reported = diag.struct_err(&err).emit(); Err(reported) @@ -689,7 +689,7 @@ fn run_renderer<'tcx, T: formats::FormatRenderer<'tcx>>( tcx: TyCtxt<'tcx>, ) -> MainResult { match formats::run_format::<T>(krate, renderopts, cache, tcx) { - Ok(_) => Ok(()), + Ok(_) => tcx.sess.has_errors().map_or(Ok(()), Err), Err(e) => { let mut msg = tcx.sess.struct_err(&format!("couldn't generate documentation: {}", e.error)); diff --git a/src/test/rustdoc/const-evalutation-ice.rs b/src/test/rustdoc-ui/const-evalutation-ice.rs index 68c7f9c5686..0dd3bcaa289 100644 --- a/src/test/rustdoc/const-evalutation-ice.rs +++ b/src/test/rustdoc-ui/const-evalutation-ice.rs @@ -7,4 +7,5 @@ pub struct S { s: Cell<usize> } -pub const N: usize = 0 - (mem::size_of::<S>() != 4) as usize; +pub const N: usize = 0 - (mem::size_of::<S>() != 400) as usize; +//~^ ERROR evaluation of constant value failed diff --git a/src/test/rustdoc-ui/const-evalutation-ice.stderr b/src/test/rustdoc-ui/const-evalutation-ice.stderr new file mode 100644 index 00000000000..5d9c16c0765 --- /dev/null +++ b/src/test/rustdoc-ui/const-evalutation-ice.stderr @@ -0,0 +1,9 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/const-evalutation-ice.rs:10:22 + | +LL | pub const N: usize = 0 - (mem::size_of::<S>() != 400) as usize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. |
