rustc: Fail immediately if linking returns status code != 0

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