Debian Codegraph @

gcc/testsuite/rust/compile/unsafe4.rs

raw
1 fn foo() -> i32 {
2 let a = 15;
3 let p_a = &a as *const i32;
4
5 unsafe { *p_a }
6 }
7
8 unsafe fn bar() -> i32 {
9 let a = 15;
10 let p_a = &a as *const i32;
11
12 *p_a
13 }
14
15 fn baz() -> i32 {
16 let a = 15;
17 let p_a = &a as *const i32;
18
19 *p_a // { dg-error "dereference of raw pointer" }
20 }
21
22 unsafe fn qux() -> i32 {
23 let a = 15;
24 let p_a = &a as *const i32;
25
26 unsafe {}
27
28 *p_a
29 }