diff options
| author | Jubilee <46493976+workingjubilee@users.noreply.github.com> | 2024-03-11 09:29:34 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-11 09:29:34 -0700 |
| commit | 9300fbbed134bfbe040795262cd3c46b795bef96 (patch) | |
| tree | 45f63b1cda5c911368b8b373316920d74c7512d8 /compiler/rustc_const_eval/src/const_eval | |
| parent | 12798300680b31a61a47c066b6e0d3ba46676fd6 (diff) | |
| parent | fb802f2e6ed7ef10cc429022aca06e85c25159dd (diff) | |
| download | rust-9300fbbed134bfbe040795262cd3c46b795bef96.tar.gz rust-9300fbbed134bfbe040795262cd3c46b795bef96.zip | |
Rollup merge of #121893 - RalfJung:const-interior-mut-tests, r=oli-obk
Add tests (and a bit of cleanup) for interior mut handling in promotion and const-checking Basically these are the parts of https://github.com/rust-lang/rust/pull/121786 that can be salvaged. r? ``@oli-obk``
Diffstat (limited to 'compiler/rustc_const_eval/src/const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/eval_queries.rs | 8 |
1 files changed, 4 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 8ee3a0cc967..5e1f45f1334 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -412,10 +412,10 @@ pub fn const_validate_mplace<'mir, 'tcx>( _ if cid.promoted.is_some() => CtfeValidationMode::Promoted, Some(mutbl) => CtfeValidationMode::Static { mutbl }, // a `static` None => { - // In normal `const` (not promoted), the outermost allocation is always only copied, - // so having `UnsafeCell` in there is okay despite them being in immutable memory. - let allow_immutable_unsafe_cell = cid.promoted.is_none() && !inner; - CtfeValidationMode::Const { allow_immutable_unsafe_cell } + // This is a normal `const` (not promoted). + // The outermost allocation is always only copied, so having `UnsafeCell` in there + // is okay despite them being in immutable memory. + CtfeValidationMode::Const { allow_immutable_unsafe_cell: !inner } } }; ecx.const_validate_operand(&mplace.into(), path, &mut ref_tracking, mode)?; |
