rewrite rustup to support caching nightlies, protects against truncation errors

This closes #19168.

Please be careful reviewing this since this gets used all over the place. I've tested all the options and everything appears to be working though.
I agree with this comment. It is very likely the dates will get out of sync. I'd suggest that if a specific date isn't provided that either a) --save has no effect, b) it is stored directly in the `.rustup` folder and the `.sha256` file (which exists for all tarballs) is d/l'd and used to determine if it is fresh before using.