about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src/impls
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-06-08 07:37:30 +0200
committerGitHub <noreply@github.com>2022-06-08 07:37:30 +0200
commitd380b457d86512590bd05d2aabda088d88bb2bf3 (patch)
tree849e8c512a8534bb6cee3353fe43c86be38bd58d /compiler/rustc_mir_dataflow/src/impls
parent148a44a001ccffbcf0baca5ec0a4b160f41ef99d (diff)
parent6277c3a9441a0f2e0c89d479c1f3306567685817 (diff)
downloadrust-d380b457d86512590bd05d2aabda088d88bb2bf3.tar.gz
rust-d380b457d86512590bd05d2aabda088d88bb2bf3.zip
Rollup merge of #97597 - tmiasko:simplify-locals-side-effects, r=RalfJung,JakobDegen
Preserve unused pointer to address casts

Fixes #97421.

cc `@RalfJung`
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/impls')
-rw-r--r--compiler/rustc_mir_dataflow/src/impls/liveness.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_mir_dataflow/src/impls/liveness.rs b/compiler/rustc_mir_dataflow/src/impls/liveness.rs
index 7076fbe1bdb..9b62ee5473c 100644
--- a/compiler/rustc_mir_dataflow/src/impls/liveness.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/liveness.rs
@@ -244,13 +244,10 @@ impl<'a, 'tcx> Analysis<'tcx> for MaybeTransitiveLiveLocals<'a> {
         // Compute the place that we are storing to, if any
         let destination = match &statement.kind {
             StatementKind::Assign(assign) => {
-                if assign.1.is_pointer_int_cast() {
-                    // Pointer to int casts may be side-effects due to exposing the provenance.
-                    // While the model is undecided, we should be conservative. See
-                    // <https://www.ralfj.de/blog/2022/04/11/provenance-exposed.html>
-                    None
-                } else {
+                if assign.1.is_safe_to_remove() {
                     Some(assign.0)
+                } else {
+                    None
                 }
             }
             StatementKind::SetDiscriminant { place, .. } | StatementKind::Deinit(place) => {