use precise spans for recursive const evaluation
This commit is contained in:
parent
9ab4f876a1
commit
467e0f4446
8 changed files with 28 additions and 14 deletions
|
@ -926,7 +926,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
self.param_env
|
||||
};
|
||||
let param_env = param_env.with_const();
|
||||
let val = self.tcx.eval_to_allocation_raw(param_env.and(gid))?;
|
||||
// Use a precise span for better cycle errors.
|
||||
let val = self.tcx.at(self.cur_span()).eval_to_allocation_raw(param_env.and(gid))?;
|
||||
self.raw_const_to_mplace(val)
|
||||
}
|
||||
|
||||
|
|
|
@ -504,7 +504,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
throw_unsup!(ReadExternStatic(def_id));
|
||||
}
|
||||
|
||||
(self.tcx.eval_static_initializer(def_id)?, Some(def_id))
|
||||
// Use a precise span for better cycle errors.
|
||||
(self.tcx.at(self.cur_span()).eval_static_initializer(def_id)?, Some(def_id))
|
||||
}
|
||||
};
|
||||
M::before_access_global(*self.tcx, &self.machine, id, alloc, def_id, is_write)?;
|
||||
|
|
|
@ -55,7 +55,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
};
|
||||
let basic_block = &self.body().basic_blocks()[loc.block];
|
||||
|
||||
|
||||
if let Some(stmt) = basic_block.statements.get(loc.statement_index) {
|
||||
let old_frames = self.frame_idx();
|
||||
self.statement(stmt)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue