Skip to content

Commit

Permalink
Make #[rustc_private] override dependency visibility
Browse files Browse the repository at this point in the history
Really this is always-visible override only needs to happen when the
crate is a dependency of itself. However, this is a very internal
feature, so it doesn't seem worth doing any additional filtering here.
  • Loading branch information
tgross35 committed Jan 14, 2025
1 parent 80a076e commit 0b126e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_middle/src/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,11 @@ impl<'tcx> TyCtxt<'tcx> {
/// [public]: TyCtxt::is_private_dep
/// [direct]: rustc_session::cstore::ExternCrate::is_direct
pub fn is_user_visible_dep(self, key: CrateNum) -> bool {
// `#![rustc_private]` overrides defaults to make private dependencies usable.
if self.features().enabled(sym::rustc_private) {
return true;
}

// | Private | Direct | Visible | |
// |---------|--------|---------|--------------------|
// | Yes | Yes | Yes | !true || true |
Expand Down

0 comments on commit 0b126e5

Please sign in to comment.