From 58bd8786e891f69fcb7982938a635d4f8b16496b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 31 Jul 2019 14:10:33 -0700 Subject: [PATCH] Do not lint on SizeOverflow, always error --- src/librustc/mir/interpret/error.rs | 4 +++- src/test/ui/consts/issue-55878.stderr | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 7c1941196390a..acdabd1e53d63 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -137,16 +137,18 @@ impl<'tcx> ConstEvalErr<'tcx> { message: &str, lint_root: Option, ) -> Result, ErrorHandled> { + let mut must_error = false; match self.error { err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => return Err(ErrorHandled::TooGeneric), err_inval!(TypeckError) => return Err(ErrorHandled::Reported), + err_inval!(LayoutError::SizeOverflow(_)) => must_error = true, _ => {}, } trace!("reporting const eval failure at {:?}", self.span); - let mut err = if let Some(lint_root) = lint_root { + let mut err = if let (Some(lint_root), false) = (lint_root, must_error) { let hir_id = self.stacktrace .iter() .rev() diff --git a/src/test/ui/consts/issue-55878.stderr b/src/test/ui/consts/issue-55878.stderr index 03537ff20bf5e..7ca7024912fbb 100644 --- a/src/test/ui/consts/issue-55878.stderr +++ b/src/test/ui/consts/issue-55878.stderr @@ -1,4 +1,4 @@ -error: reaching this expression at runtime will panic or abort +error[E0080]: reaching this expression at runtime will panic or abort --> $SRC_DIR/libcore/mem/mod.rs:LL:COL | LL | intrinsics::size_of::() @@ -8,8 +8,7 @@ LL | intrinsics::size_of::() | LL | println!("Size: {}", std::mem::size_of::<[u8; std::u64::MAX as usize]>()); | --------------------------------------------------- - | - = note: `#[deny(const_err)]` on by default error: aborting due to previous error +For more information about this error, try `rustc --explain E0080`.