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

Commit e0a1da3

Browse files
committed
Extend tests for references
1 parent 73ce509 commit e0a1da3

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

tests/ui/mir/null/addrof_null.rs

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

tests/ui/mir/null/place_without_read.rs

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

tests/ui/mir/null/references.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Make sure that we don't insert a check for references instead of pointers.
2+
//@ run-pass
3+
//@ compile-flags: -C debug-assertions
4+
5+
struct Null {
6+
a: u32,
7+
}
8+
9+
fn main() {
10+
let val: u32 = 42;
11+
let val_ref: &u32 = &val;
12+
let _access1: &u32 = &*val_ref;
13+
14+
let val = Null { a: 43 };
15+
let _access2: &u32 = &val.a;
16+
}

tests/ui/mir/null/zero_sized_access.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +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.
1+
// Make sure that we don't insert a check for zero-sized reads or writes to
2+
// null, because they are allowed.
33
//@ run-pass
44
//@ compile-flags: -C debug-assertions
55

0 commit comments

Comments
 (0)