We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e6e8773 commit 77cc0cdCopy full SHA for 77cc0cd
tests/compile-fail/validity/dangling_ref3.rs
@@ -0,0 +1,10 @@
1
+use std::mem;
2
+
3
+fn dangling() -> *const u8 {
4
+ let x = 0u8;
5
+ &x as *const _
6
+}
7
8
+fn main() {
9
+ let _x: &i32 = unsafe { mem::transmute(dangling()) }; //~ ERROR dangling reference (use-after-free)
10
0 commit comments