Skip to content

Commit a5ef6ba

Browse files
committed
Also test destructuring assignment.
1 parent e107194 commit a5ef6ba

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr

+10-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,21 @@ LL | let _: u8 = *p;
1515
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
1616

1717
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
18-
--> $DIR/unsafe-fn-deref-ptr.rs:7:12
18+
--> $DIR/unsafe-fn-deref-ptr.rs:7:9
19+
|
20+
LL | _ = *p;
21+
| ^^ dereference of raw pointer
22+
|
23+
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
24+
25+
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
26+
--> $DIR/unsafe-fn-deref-ptr.rs:8:12
1927
|
2028
LL | return *p;
2129
| ^^ dereference of raw pointer
2230
|
2331
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
2432

25-
error: aborting due to 3 previous errors
33+
error: aborting due to 4 previous errors
2634

2735
For more information about this error, try `rustc --explain E0133`.

tests/ui/unsafe/unsafe-fn-deref-ptr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
fn f(p: *const u8) -> u8 {
55
let _ = *p; //~ ERROR dereference of raw pointer is unsafe
66
let _: u8 = *p; //~ ERROR dereference of raw pointer is unsafe
7+
_ = *p; //~ ERROR dereference of raw pointer is unsafe
78
return *p; //~ ERROR dereference of raw pointer is unsafe
89
}
910

tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr

+10-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,21 @@ LL | let _: u8 = *p;
1515
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
1616

1717
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
18-
--> $DIR/unsafe-fn-deref-ptr.rs:7:12
18+
--> $DIR/unsafe-fn-deref-ptr.rs:7:9
19+
|
20+
LL | _ = *p;
21+
| ^^ dereference of raw pointer
22+
|
23+
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
24+
25+
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
26+
--> $DIR/unsafe-fn-deref-ptr.rs:8:12
1927
|
2028
LL | return *p;
2129
| ^^ dereference of raw pointer
2230
|
2331
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
2432

25-
error: aborting due to 3 previous errors
33+
error: aborting due to 4 previous errors
2634

2735
For more information about this error, try `rustc --explain E0133`.

0 commit comments

Comments
 (0)