Skip to content

Commit 4b09861

Browse files
authored
Rollup merge of rust-lang#105427 - GuillaumeGomez:dont-silently-ignore-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`
2 parents 5b4723f + b5a9f6a commit 4b09861

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
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));

src/test/rustdoc/const-evalutation-ice.rs renamed to src/test/rustdoc-ui/const-evalutation-ice.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ pub struct S {
77
s: Cell<usize>
88
}
99

10-
pub const N: usize = 0 - (mem::size_of::<S>() != 4) as usize;
10+
pub const N: usize = 0 - (mem::size_of::<S>() != 400) as usize;
11+
//~^ ERROR evaluation of constant value failed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0080]: evaluation of constant value failed
2+
--> $DIR/const-evalutation-ice.rs:10:22
3+
|
4+
LL | pub const N: usize = 0 - (mem::size_of::<S>() != 400) as usize;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)