rustc: Encode the visibility of foreign items

The privacy pass of the compiler was previously not taking into account the
privacy of foreign items, or bindings to external functions. This commit fixes
this oversight by encoding the visibility of foreign items into the metadata for
each crate.

Any code relying on this will start to fail to  compile and the bindings must be
marked with `pub` to indicate that they can be used externally.

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

Closes #16725
librustc: Use Typer's node_ty method instead of free function in ExprUseVisitor.
Add test.
auto merge of #16753 : luqmana/rust/typer-ty, r=nikomatsakis

We shouldn't be making calls directly to `ty::node_id_to_type` since the typer may be bcx which also has to monomorphize the type.

Fixes #16643.