Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 73ce509

Browse files
committed
Fix breakage and comment tests as requested
1 parent 68302ec commit 73ce509

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

compiler/rustc_mir_transform/src/check_pointers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl<'a, 'tcx> PointerFinder<'a, 'tcx> {
178178

179179
impl<'a, 'tcx> Visitor<'tcx> for PointerFinder<'a, 'tcx> {
180180
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) {
181-
if !self.should_visit_place(context) && !place.is_indirect() {
181+
if !self.should_visit_place(context) || !place.is_indirect() {
182182
return;
183183
}
184184

tests/ui/mir/null/addrof_null.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Make sure that we don't actually insert a check for `addr_of!`.
12
//@ run-pass
23
//@ compile-flags: -C debug-assertions
34

tests/ui/mir/null/place_without_read.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Make sure that we don't actually insert a check for places that do not read.
12
//@ run-pass
23
//@ compile-flags: -C debug-assertions
34

tests/ui/mir/null/zero_sized_access.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Make sure that we don't actually insert a check for zero-sized reads or writes
2+
// to null, because they are actually allowed.
13
//@ run-pass
24
//@ compile-flags: -C debug-assertions
35

@@ -6,4 +8,8 @@ fn main() {
68
unsafe {
79
*(ptr) = ();
810
}
11+
let ptr1: *const () = std::ptr::null_mut();
12+
unsafe {
13+
let _ptr = *ptr1;
14+
}
915
}

0 commit comments

Comments
 (0)