Fix Rust build on mingw v4.0

Fix Rust build on mingw v4.0
See #9246 for details.