rustc: Encode the visibility of foreign items

Closes #16725
auto merge of #16740 : alexcrichton/rust/issue-16725, r=pcwalton

Closes #16725