]> git.lizzy.rs Git - rust.git/commitdiff
Layout errors can happen because something was too generic
authorOliver Schneider <github35764891676564198441@oli-obk.de>
Thu, 30 Aug 2018 14:30:20 +0000 (16:30 +0200)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Thu, 25 Oct 2018 14:46:19 +0000 (16:46 +0200)
src/librustc/mir/interpret/error.rs

index f7f4c50b96d40bf6acc9d75c777c11a5297e36a9..75ce9b55c503774b8d0cc03a0dbbb813bde85a75 100644 (file)
@@ -12,7 +12,7 @@
 
 use mir;
 use ty::{Ty, layout};
-use ty::layout::{Size, Align};
+use ty::layout::{Size, Align, LayoutError};
 use rustc_target::spec::abi::Abi;
 
 use super::{
@@ -113,9 +113,10 @@ fn struct_generic(
         lint_root: Option<ast::NodeId>,
     ) -> Result<DiagnosticBuilder<'tcx>, ErrorHandled> {
         match self.error.kind {
+            EvalErrorKind::Layout(LayoutError::Unknown(_)) |
             EvalErrorKind::TooGeneric => return Err(ErrorHandled::TooGeneric),
-            EvalErrorKind::TypeckError |
-            EvalErrorKind::Layout(_) => return Err(ErrorHandled::Reported),
+            EvalErrorKind::Layout(LayoutError::SizeOverflow(_)) |
+            EvalErrorKind::TypeckError => return Err(ErrorHandled::Reported),
             _ => {},
         }
         trace!("reporting const eval failure at {:?}", self.span);