Rustup to rustc 1.27.0-nightly (ff2ac35db 2018-05-12)
This commit is contained in:
parent
6a4c62c167
commit
68378a7b97
2 changed files with 8 additions and 9 deletions
|
|
@ -459,7 +459,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
|
|||
promoted: None,
|
||||
};
|
||||
let const_val = self.const_eval(cid)?;
|
||||
let value = const_val.val.unwrap_u64();
|
||||
let value = const_val.unwrap_usize(self.tcx.tcx);
|
||||
if value == name {
|
||||
result = Some(path_value);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use rustc::infer::InferCtxt;
|
|||
use rustc::middle::region;
|
||||
use rustc::middle::const_val::ConstVal;
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
use rustc_mir::interpret::{HasMemory, eval_body};
|
||||
use rustc_mir::interpret::HasMemory;
|
||||
|
||||
use super::{EvalContext, Place, PlaceExtra, ValTy};
|
||||
use rustc::mir::interpret::{DynamicLifetime, AccessKind, EvalErrorKind, Value, EvalError, EvalResult};
|
||||
|
|
@ -718,18 +718,17 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
|
|||
}
|
||||
}
|
||||
TyArray(elem_ty, len) => {
|
||||
let len_val = match len.val {
|
||||
let len = match len.val {
|
||||
ConstVal::Unevaluated(def_id, substs) => {
|
||||
eval_body(self.tcx.tcx, GlobalId {
|
||||
self.tcx.const_eval(self.tcx.param_env(def_id).and(GlobalId {
|
||||
instance: Instance::new(def_id, substs),
|
||||
promoted: None,
|
||||
}, ty::ParamEnv::reveal_all())
|
||||
.ok_or_else(||EvalErrorKind::MachineError("<already reported>".to_string()))?
|
||||
.0
|
||||
}))
|
||||
.map_err(|_err|EvalErrorKind::MachineError("<already reported>".to_string()))?
|
||||
}
|
||||
ConstVal::Value(val) => val,
|
||||
ConstVal::Value(_) => len,
|
||||
};
|
||||
let len = ConstVal::Value(len_val).unwrap_u64();
|
||||
let len = len.unwrap_usize(self.tcx.tcx);
|
||||
for i in 0..len {
|
||||
let inner_place = self.place_index(query.place.1, query.ty, i as u64)?;
|
||||
self.validate(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue