rustc: Check that renaming the link object succeeds on Windows

If rustc fails to link a library (as described in #17951), it still tries to rename the non-existent file on Windows. I'm not sure how to test this as we'd have to reproduce a linking failure...

Closes #17951