From fb6ca2063711fee711020b4a9b8ae0f941b782a5 Mon Sep 17 00:00:00 2001 From: VaynNecol Date: Tue, 17 Dec 2024 22:21:33 +0800 Subject: [PATCH] hot fix for rcanary due to place changed --- .../rcanary/ranalyzer/intra_visitor.rs | 24 +++++++++++++++++++ rap/src/analysis/safedrop/graph.rs | 3 +-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/rap/src/analysis/rcanary/ranalyzer/intra_visitor.rs b/rap/src/analysis/rcanary/ranalyzer/intra_visitor.rs index a4d106e..f0f223f 100644 --- a/rap/src/analysis/rcanary/ranalyzer/intra_visitor.rs +++ b/rap/src/analysis/rcanary/ranalyzer/intra_visitor.rs @@ -433,6 +433,30 @@ impl<'tcx, 'ctx, 'a> IntraFlowAnalysis<'tcx, 'ctx, 'a> { } } } + Rvalue::RawPtr(_, ref rplace) => { + let kind = AsgnKind::Reference; + let rvalue_has_projection = has_projection(rplace); + match (lvalue_has_projection, rvalue_has_projection) { + (true, true) => { + self.handle_copy_field_to_field( + ctx, goal, solver, kind, lplace, rplace, disc, bidx, sidx, + ); + } + (true, false) => { + self.handle_copy_to_field( + ctx, goal, solver, kind, lplace, rplace, disc, bidx, sidx, + ); + } + (false, true) => { + self.handle_copy_from_field( + ctx, goal, solver, kind, lplace, rplace, bidx, sidx, + ); + } + (false, false) => { + self.handle_copy(ctx, goal, solver, kind, lplace, rplace, bidx, sidx); + } + } + } Rvalue::Cast(_cast_kind, op, ..) => { let kind = AsgnKind::Cast; match op { diff --git a/rap/src/analysis/safedrop/graph.rs b/rap/src/analysis/safedrop/graph.rs index 7b1e2f8..60809cb 100644 --- a/rap/src/analysis/safedrop/graph.rs +++ b/rap/src/analysis/safedrop/graph.rs @@ -254,8 +254,7 @@ impl<'tcx> SafeDropGraph<'tcx> { } } } - Rvalue::Ref(_, _, ref p) - | Rvalue::RawPtr(_, ref p)=> { + Rvalue::Ref(_, _, ref p) | Rvalue::RawPtr(_, ref p) => { let rv_local = p.local.as_usize(); if values[lv_local].may_drop && values[rv_local].may_drop { let rv = p.clone();