diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index b46e914133a..0156872a4da 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -30,7 +30,7 @@ use syntax::ast::Mutability; use super::{ Pointer, AllocId, Allocation, ConstValue, GlobalId, EvalResult, Scalar, EvalErrorKind, AllocType, PointerArithmetic, - Machine, MemoryAccess, AllocMap, MayLeak, ScalarMaybeUndef, + Machine, MemoryAccess, AllocMap, MayLeak, ScalarMaybeUndef, ErrorHandled, }; #[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)] @@ -370,10 +370,13 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { }; // use the raw query here to break validation cycles. Later uses of the static will call the // full query anyway - tcx.const_eval_raw(ty::ParamEnv::reveal_all().and(gid)).map_err(|_| { + tcx.const_eval_raw(ty::ParamEnv::reveal_all().and(gid)).map_err(|err| { // no need to report anything, the const_eval call takes care of that for statics assert!(tcx.is_static(def_id).is_some()); - EvalErrorKind::ReferencedConstant.into() + match err { + ErrorHandled::Reported => EvalErrorKind::ReferencedConstant.into(), + ErrorHandled::TooGeneric => EvalErrorKind::TooGeneric.into(), + } }).map(|const_val| { if let ConstValue::ByRef(_, allocation, _) = const_val.val { // We got tcx memory. Let the machine figure out whether and how to