Skip to content

Commit 6f84d6e

Browse files
committed
Layout errors can happen because something was too generic
1 parent cce53b3 commit 6f84d6e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustc/mir/interpret/error.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::{fmt, env};
1212

1313
use mir;
1414
use ty::{Ty, layout};
15-
use ty::layout::{Size, Align};
15+
use ty::layout::{Size, Align, LayoutError};
1616
use rustc_target::spec::abi::Abi;
1717

1818
use super::{
@@ -113,9 +113,10 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> {
113113
lint_root: Option<ast::NodeId>,
114114
) -> Result<DiagnosticBuilder<'tcx>, ErrorHandled> {
115115
match self.error.kind {
116+
EvalErrorKind::Layout(LayoutError::Unknown(_)) |
116117
EvalErrorKind::TooGeneric => return Err(ErrorHandled::TooGeneric),
117-
EvalErrorKind::TypeckError |
118-
EvalErrorKind::Layout(_) => return Err(ErrorHandled::Reported),
118+
EvalErrorKind::Layout(LayoutError::SizeOverflow(_)) |
119+
EvalErrorKind::TypeckError => return Err(ErrorHandled::Reported),
119120
_ => {},
120121
}
121122
trace!("reporting const eval failure at {:?}", self.span);

0 commit comments

Comments
 (0)