rustc: Check --dep-info target path

Add sane error messages if the user specifies an invalid path or directory for the `--dep-info` argument.  Fail if writing the dependencies returns an `Err` for any reason.

Fixes #13517