Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont silently ignore rustdoc errors #105427

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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
jyn514 marked this conversation as resolved.
Show resolved Hide resolved
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>() != 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`.