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/transform | |
| 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/transform')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/check_consts/check.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index 53308cd7f90..a93e8138aa4 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -30,7 +30,7 @@ type QualifResults<'mir, 'tcx, Q> = rustc_mir_dataflow::ResultsCursor<'mir, 'tcx, FlowSensitiveAnalysis<'mir, 'mir, 'tcx, Q>>; #[derive(Default)] -pub struct Qualifs<'mir, 'tcx> { +pub(crate) struct Qualifs<'mir, 'tcx> { has_mut_interior: Option<QualifResults<'mir, 'tcx, HasMutInterior>>, needs_drop: Option<QualifResults<'mir, 'tcx, NeedsDrop>>, needs_non_const_drop: Option<QualifResults<'mir, 'tcx, NeedsNonConstDrop>>, diff --git a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs index 7eb3c181d69..1847847d9d2 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs @@ -284,6 +284,7 @@ where if Q::in_adt_inherently(cx, def, args) { return true; } + // Don't do any value-based reasoning for unions. if def.is_union() && Q::in_any_value_of_ty(cx, rvalue.ty(cx.body, cx.tcx)) { return true; } |
