mktemp with empty tmpdir parameter will use env::temp_dir to get the default temp directory, which need to be read from environment variables on windows, otherwise it will try to use "C:\Windows\" which is inaccessible to non-SYSTEM processes.
See following links:
rust-doc
winapi