Also test destructuring assignment.
This commit is contained in:
parent
e107194b66
commit
a5ef6bac28
@ -15,13 +15,21 @@ LL | let _: u8 = *p;
|
||||
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
|
||||
|
||||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-deref-ptr.rs:7:12
|
||||
--> $DIR/unsafe-fn-deref-ptr.rs:7:9
|
||||
|
|
||||
LL | _ = *p;
|
||||
| ^^ dereference of raw pointer
|
||||
|
|
||||
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
|
||||
|
||||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-deref-ptr.rs:8:12
|
||||
|
|
||||
LL | return *p;
|
||||
| ^^ dereference of raw pointer
|
||||
|
|
||||
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
@ -4,6 +4,7 @@
|
||||
fn f(p: *const u8) -> u8 {
|
||||
let _ = *p; //~ ERROR dereference of raw pointer is unsafe
|
||||
let _: u8 = *p; //~ ERROR dereference of raw pointer is unsafe
|
||||
_ = *p; //~ ERROR dereference of raw pointer is unsafe
|
||||
return *p; //~ ERROR dereference of raw pointer is unsafe
|
||||
}
|
||||
|
||||
|
@ -15,13 +15,21 @@ LL | let _: u8 = *p;
|
||||
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
|
||||
|
||||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-deref-ptr.rs:7:12
|
||||
--> $DIR/unsafe-fn-deref-ptr.rs:7:9
|
||||
|
|
||||
LL | _ = *p;
|
||||
| ^^ dereference of raw pointer
|
||||
|
|
||||
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
|
||||
|
||||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-deref-ptr.rs:8:12
|
||||
|
|
||||
LL | return *p;
|
||||
| ^^ dereference of raw pointer
|
||||
|
|
||||
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user