Fix usage of rustc --ls on invalid files

Closes #11259
auto merge of #11262 : alexcrichton/rust/issue-11259, r=pcwalton

Closes #11259