Fix stat.rs to not pollute the build directory. Closes #6959.
auto merge of #6960 : msullivan/rust/fix-pollution, r=brson