Rustup
This commit is contained in:
parent
9143a69f4b
commit
e1dbbe538f
@ -24,7 +24,6 @@ use rustc::ty::layout::{TyLayout, LayoutOf, Size};
|
|||||||
use rustc::ty::subst::Subst;
|
use rustc::ty::subst::Subst;
|
||||||
use rustc::hir::def_id::DefId;
|
use rustc::hir::def_id::DefId;
|
||||||
use rustc::mir;
|
use rustc::mir;
|
||||||
use rustc::middle::const_val;
|
|
||||||
|
|
||||||
use syntax::ast::Mutability;
|
use syntax::ast::Mutability;
|
||||||
use syntax::codemap::Span;
|
use syntax::codemap::Span;
|
||||||
@ -270,10 +269,10 @@ pub fn eval_main<'a, 'tcx: 'a>(
|
|||||||
block.terminator().source_info.span
|
block.terminator().source_info.span
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut err = const_val::struct_error(ecx.tcx.tcx.at(span), "constant evaluation error");
|
let mut err = mir::interpret::struct_error(ecx.tcx.tcx.at(span), "constant evaluation error");
|
||||||
let (frames, span) = ecx.generate_stacktrace(None);
|
let (frames, span) = ecx.generate_stacktrace(None);
|
||||||
err.span_label(span, e.to_string());
|
err.span_label(span, e.to_string());
|
||||||
for const_val::FrameInfo { span, location, .. } in frames {
|
for mir::interpret::FrameInfo { span, location, .. } in frames {
|
||||||
err.span_note(span, &format!("inside call to `{}`", location));
|
err.span_note(span, &format!("inside call to `{}`", location));
|
||||||
}
|
}
|
||||||
err.emit();
|
err.emit();
|
||||||
|
@ -8,7 +8,6 @@ use rustc::ty::subst::{Substs, Subst};
|
|||||||
use rustc::traits::{self, TraitEngine};
|
use rustc::traits::{self, TraitEngine};
|
||||||
use rustc::infer::InferCtxt;
|
use rustc::infer::InferCtxt;
|
||||||
use rustc::middle::region;
|
use rustc::middle::region;
|
||||||
use rustc::middle::const_val::ConstVal;
|
|
||||||
use rustc_data_structures::indexed_vec::Idx;
|
use rustc_data_structures::indexed_vec::Idx;
|
||||||
use rustc_mir::interpret::HasMemory;
|
use rustc_mir::interpret::HasMemory;
|
||||||
|
|
||||||
@ -719,14 +718,14 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
|
|||||||
}
|
}
|
||||||
TyArray(elem_ty, len) => {
|
TyArray(elem_ty, len) => {
|
||||||
let len = match len.val {
|
let len = match len.val {
|
||||||
ConstVal::Unevaluated(def_id, substs) => {
|
mir::interpret::ConstValue::Unevaluated(def_id, substs) => {
|
||||||
self.tcx.const_eval(self.tcx.param_env(def_id).and(GlobalId {
|
self.tcx.const_eval(self.tcx.param_env(def_id).and(GlobalId {
|
||||||
instance: Instance::new(def_id, substs),
|
instance: Instance::new(def_id, substs),
|
||||||
promoted: None,
|
promoted: None,
|
||||||
}))
|
}))
|
||||||
.map_err(|_err|EvalErrorKind::MachineError("<already reported>".to_string()))?
|
.map_err(|_err|EvalErrorKind::MachineError("<already reported>".to_string()))?
|
||||||
}
|
}
|
||||||
ConstVal::Value(_) => len,
|
_ => len,
|
||||||
};
|
};
|
||||||
let len = len.unwrap_usize(self.tcx.tcx);
|
let len = len.unwrap_usize(self.tcx.tcx);
|
||||||
for i in 0..len {
|
for i in 0..len {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user