Skip to content

Commit 58bd878

Browse files
committed
Do not lint on SizeOverflow, always error
1 parent 83b5eb9 commit 58bd878

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/librustc/mir/interpret/error.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,18 @@ impl<'tcx> ConstEvalErr<'tcx> {
137137
message: &str,
138138
lint_root: Option<hir::HirId>,
139139
) -> Result<DiagnosticBuilder<'tcx>, ErrorHandled> {
140+
let mut must_error = false;
140141
match self.error {
141142
err_inval!(Layout(LayoutError::Unknown(_))) |
142143
err_inval!(TooGeneric) =>
143144
return Err(ErrorHandled::TooGeneric),
144145
err_inval!(TypeckError) =>
145146
return Err(ErrorHandled::Reported),
147+
err_inval!(LayoutError::SizeOverflow(_)) => must_error = true,
146148
_ => {},
147149
}
148150
trace!("reporting const eval failure at {:?}", self.span);
149-
let mut err = if let Some(lint_root) = lint_root {
151+
let mut err = if let (Some(lint_root), false) = (lint_root, must_error) {
150152
let hir_id = self.stacktrace
151153
.iter()
152154
.rev()

src/test/ui/consts/issue-55878.stderr

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: reaching this expression at runtime will panic or abort
1+
error[E0080]: reaching this expression at runtime will panic or abort
22
--> $SRC_DIR/libcore/mem/mod.rs:LL:COL
33
|
44
LL | intrinsics::size_of::<T>()
@@ -8,8 +8,7 @@ LL | intrinsics::size_of::<T>()
88
|
99
LL | println!("Size: {}", std::mem::size_of::<[u8; std::u64::MAX as usize]>());
1010
| ---------------------------------------------------
11-
|
12-
= note: `#[deny(const_err)]` on by default
1311

1412
error: aborting due to previous error
1513

14+
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)