Closed
Description
The following code panics:
unsafe { libc::clearenv(); };
assert_eq!(env::vars().count(), 0);
The problem is that env assumes that environ is not null. See Rust env implementation
The clearenv(3 ) function on linux is often implemented by freeing environ and setting it to null. See uclibc and glibc
In my opinion the stdlib could handle this more gracefully and return an empty iterator instead of panicking