Skip to content

Commit

Permalink
Rollup merge of rust-lang#105427 - GuillaumeGomez:dont-silently-ignor…
Browse files Browse the repository at this point in the history
…e-rustdoc-errors, r=notriddle

Dont silently ignore rustdoc errors

I applied the suggestions from rust-lang#104995 and also checked the rustdoc-ui error but couldn't reproduce it.

r? `@notriddle`
  • Loading branch information
matthiaskrgr committed Dec 8, 2022
2 parents 616a11a + eef61b4 commit b475163
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ pub struct S {
}

pub const N: usize = 0 - (mem::size_of::<S>() != 4) as usize;
//~^ ERROR evaluation of constant value failed
9 changes: 9 additions & 0 deletions src/test/rustdoc-ui/const-evalutation-ice.stderr
Original file line number Diff line number Diff line change
@@ -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>() != 4) 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`.

0 comments on commit b475163

Please sign in to comment.