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`
This commit is contained in:
Matthias Krüger 2022-12-09 07:25:45 +01:00 committed by GitHub
commit 4b09861a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View File

@ -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));

View File

@ -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

View File

@ -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`.