diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-09 15:42:03 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-23 08:35:26 +0000 |
| commit | 0fce74e1c05cf6a70d68880f5efeda9a461a83ae (patch) | |
| tree | 82ca73208d262b4f0214ab7390bd94442d9c7a1f | |
| parent | aec4741d42e10673e7d5fe0f1c96d407801884e8 (diff) | |
| download | rust-0fce74e1c05cf6a70d68880f5efeda9a461a83ae.tar.gz rust-0fce74e1c05cf6a70d68880f5efeda9a461a83ae.zip | |
The mutability was ignored anyway, so just check for staticness
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/eval_queries.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index 6b612c34837..936f3a68264 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -335,13 +335,16 @@ pub fn eval_to_allocation_raw_provider<'tcx>( let mut ref_tracking = RefTracking::new(mplace.clone()); let mut inner = false; while let Some((mplace, path)) = ref_tracking.todo.pop() { - let mode = match tcx.static_mutability(cid.instance.def_id()) { - Some(_) if cid.promoted.is_some() => { + let mode = if is_static { + if cid.promoted.is_some() { // Promoteds in statics are allowed to point to statics. CtfeValidationMode::Const { inner, allow_static_ptrs: true } + } else { + // a `static` + CtfeValidationMode::Regular } - Some(_) => CtfeValidationMode::Regular, // a `static` - None => CtfeValidationMode::Const { inner, allow_static_ptrs: false }, + } else { + CtfeValidationMode::Const { inner, allow_static_ptrs: false } }; ecx.const_validate_operand(&mplace.into(), path, &mut ref_tracking, mode)?; inner = true; |
