Skip to content

Commit

Permalink
Do not lint on SizeOverflow, always error
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Aug 2, 2019
1 parent 83b5eb9 commit 58bd878
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,18 @@ impl<'tcx> ConstEvalErr<'tcx> {
message: &str,
lint_root: Option<hir::HirId>,
) -> Result<DiagnosticBuilder<'tcx>, 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()
Expand Down
5 changes: 2 additions & 3 deletions src/test/ui/consts/issue-55878.stderr
Original file line number Diff line number Diff line change
@@ -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::<T>()
Expand All @@ -8,8 +8,7 @@ LL | intrinsics::size_of::<T>()
|
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`.

0 comments on commit 58bd878

Please sign in to comment.