We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
environ
1 parent c2bdd4a commit ea49deeCopy full SHA for ea49dee
tests/compile-fail/environ-gets-deallocated.rs
@@ -0,0 +1,10 @@
1
+extern "C" {
2
+ static environ: *const *const u8;
3
+}
4
+
5
+fn main() {
6
+ let pointer = unsafe { environ };
7
+ let _x = unsafe { *pointer };
8
+ std::env::set_var("FOO", "BAR");
9
+ let _y = unsafe { *pointer }; //~ ERROR dangling pointer was dereferenced
10
0 commit comments