mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
test that environ gets deallocated on changes
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
extern "C" {
|
||||
static environ: *const *const u8;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let pointer = unsafe { environ };
|
||||
let _x = unsafe { *pointer };
|
||||
std::env::set_var("FOO", "BAR");
|
||||
let _y = unsafe { *pointer }; //~ ERROR dangling pointer was dereferenced
|
||||
}
|
||||
Reference in New Issue
Block a user