Exclude Rvalue::AddressOf for raw pointer deref alignment checks

This commit is contained in:
Ben Kimock 2023-05-27 14:52:41 -04:00
parent de4dddf155
commit 783b1ce99c

View file

@ -75,6 +75,14 @@ struct PointerFinder<'tcx, 'a> {
}
impl<'tcx, 'a> Visitor<'tcx> for PointerFinder<'tcx, 'a> {
fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
if let Rvalue::AddressOf(..) = rvalue {
// Ignore dereferences inside of an AddressOf
return;
}
self.super_rvalue(rvalue, location);
}
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, _location: Location) {
if let PlaceContext::NonUse(_) = context {
return;