param_env: ParamEnv<'tcx>,
}
-impl<'a, 'b, 'tcx> LayoutOf<ty::Ty<'tcx>> for &'a ConstPropagator<'a, 'b, 'tcx> {
+impl<'a, 'b, 'tcx> LayoutOf for &'a ConstPropagator<'a, 'b, 'tcx> {
+ type Ty = ty::Ty<'tcx>;
type TyLayout = Result<TyLayout<'tcx>, LayoutError<'tcx>>;
fn layout_of(self, ty: ty::Ty<'tcx>) -> Self::TyLayout {
} else {
if overflow {
use rustc::mir::interpret::EvalErrorKind;
- let mut err = EvalErrorKind::OverflowingMath.into();
+ let mut err = EvalErrorKind::Overflow(op).into();
ecx.report(&mut err, false, Some(span));
return None;
}
.hir
.as_local_node_id(self.source.def_id)
.expect("some part of a failing const eval must be local");
- use rustc::mir::AssertMessage::*;
+ use rustc::mir::interpret::EvalErrorKind::*;
let msg = match msg {
- // Need proper const propagator for these
- GeneratorResumedAfterReturn |
- GeneratorResumedAfterPanic => return,
- Math(ref err) => err.description().to_owned(),
+ Overflow(_) |
+ OverflowNeg |
+ DivisionByZero |
+ RemainderByZero => msg.description().to_owned(),
BoundsCheck { ref len, ref index } => {
let len = self.eval_operand(len).expect("len must be const");
let len = match len.0 {
index,
)
},
+ // Need proper const propagator for these
+ _ => return,
};
self.tcx.lint_node(
::rustc::lint::builtin::CONST_ERR,