The mutability was ignored anyway, so just check for staticness
This commit is contained in:
parent
aec4741d42
commit
0fce74e1c0
1 changed files with 7 additions and 4 deletions
|
@ -335,13 +335,16 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
|
||||||
let mut ref_tracking = RefTracking::new(mplace.clone());
|
let mut ref_tracking = RefTracking::new(mplace.clone());
|
||||||
let mut inner = false;
|
let mut inner = false;
|
||||||
while let Some((mplace, path)) = ref_tracking.todo.pop() {
|
while let Some((mplace, path)) = ref_tracking.todo.pop() {
|
||||||
let mode = match tcx.static_mutability(cid.instance.def_id()) {
|
let mode = if is_static {
|
||||||
Some(_) if cid.promoted.is_some() => {
|
if cid.promoted.is_some() {
|
||||||
// Promoteds in statics are allowed to point to statics.
|
// Promoteds in statics are allowed to point to statics.
|
||||||
CtfeValidationMode::Const { inner, allow_static_ptrs: true }
|
CtfeValidationMode::Const { inner, allow_static_ptrs: true }
|
||||||
|
} else {
|
||||||
|
// a `static`
|
||||||
|
CtfeValidationMode::Regular
|
||||||
}
|
}
|
||||||
Some(_) => CtfeValidationMode::Regular, // a `static`
|
} else {
|
||||||
None => CtfeValidationMode::Const { inner, allow_static_ptrs: false },
|
CtfeValidationMode::Const { inner, allow_static_ptrs: false }
|
||||||
};
|
};
|
||||||
ecx.const_validate_operand(&mplace.into(), path, &mut ref_tracking, mode)?;
|
ecx.const_validate_operand(&mplace.into(), path, &mut ref_tracking, mode)?;
|
||||||
inner = true;
|
inner = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue