rename def_id -> static_def_id
This commit is contained in:
parent
4920a3371f
commit
b5343d6baa
3 changed files with 6 additions and 6 deletions
|
|
@ -350,15 +350,15 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter {
|
|||
memory_extra: &MemoryExtra,
|
||||
alloc_id: AllocId,
|
||||
allocation: &Allocation,
|
||||
def_id: Option<DefId>,
|
||||
static_def_id: Option<DefId>,
|
||||
is_write: bool,
|
||||
) -> InterpResult<'tcx> {
|
||||
if is_write && allocation.mutability == Mutability::Not {
|
||||
Err(err_ub!(WriteToReadOnly(alloc_id)).into())
|
||||
} else if is_write {
|
||||
Err(ConstEvalErrKind::ModifiedGlobal.into())
|
||||
} else if memory_extra.can_access_statics || def_id.is_none() {
|
||||
// `def_id.is_none()` indicates this is not a static, but a const or so.
|
||||
} else if memory_extra.can_access_statics || static_def_id.is_none() {
|
||||
// `static_def_id.is_none()` indicates this is not a static, but a const or so.
|
||||
Ok(())
|
||||
} else {
|
||||
Err(ConstEvalErrKind::ConstAccessesStatic.into())
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ pub trait Machine<'mir, 'tcx>: Sized {
|
|||
_memory_extra: &Self::MemoryExtra,
|
||||
_alloc_id: AllocId,
|
||||
_allocation: &Allocation,
|
||||
_def_id: Option<DefId>,
|
||||
_static_def_id: Option<DefId>,
|
||||
_is_write: bool,
|
||||
) -> InterpResult<'tcx> {
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine {
|
|||
_memory_extra: &(),
|
||||
_alloc_id: AllocId,
|
||||
allocation: &Allocation<Self::PointerTag, Self::AllocExtra>,
|
||||
def_id: Option<DefId>,
|
||||
static_def_id: Option<DefId>,
|
||||
is_write: bool,
|
||||
) -> InterpResult<'tcx> {
|
||||
if is_write {
|
||||
|
|
@ -285,7 +285,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine {
|
|||
if allocation.mutability == Mutability::Mut {
|
||||
throw_machine_stop_str!("can't eval mutable globals in ConstProp");
|
||||
}
|
||||
if def_id.is_some() && allocation.relocations().len() > 0 {
|
||||
if static_def_id.is_some() && allocation.relocations().len() > 0 {
|
||||
throw_machine_stop_str!("can't eval statics with pointers in ConstProp");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue