Fix some filename related ICEs in rustc

See the commits for the affected issues.