Correctly encode item visibility in metadata

This fixes private statics and functions from being usable cross-crates.

This addresses some concerns about statics being public by default by accident from #8122