Skip to content

Commit 48e311f

Browse files
committed
WIP
1 parent 3a539c0 commit 48e311f

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

compiler/rustc_privacy/src/lib.rs

-9
Original file line numberDiff line numberDiff line change
@@ -1765,15 +1765,6 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'tcx, '_> {
17651765

17661766
pub fn provide(providers: &mut Providers) {
17671767
*providers = Providers {
1768-
visibility: |tcx, def_id| {
1769-
// Unique types created for closures participate in type privacy checking.
1770-
// They have visibilities inherited from the module they are defined in.
1771-
// FIXME: Consider evaluating visibilities for closures eagerly, like for all
1772-
// other nodes. However, unlike for others, for closures it may cause a perf
1773-
// regression, because closure visibilities are not commonly queried.
1774-
assert_eq!(tcx.def_kind(def_id), DefKind::Closure);
1775-
ty::Visibility::Restricted(tcx.parent_module_from_def_id(def_id).to_def_id())
1776-
},
17771768
effective_visibilities,
17781769
check_private_in_public,
17791770
check_mod_privacy,

compiler/rustc_resolve/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,10 @@ impl<'tcx> Resolver<'_, 'tcx> {
12291229

12301230
let feed = self.tcx.feed_local_def_id(def_id);
12311231
feed.def_kind(def_kind);
1232+
if def_kind == DefKind::Closure {
1233+
let parent_mod = self.tcx.parent_module_from_def_id(def_id).to_def_id();
1234+
feed.visibility(ty::Visibility::Restricted(parent_mod));
1235+
}
12321236

12331237
// Create the definition.
12341238
if expn_id != ExpnId::root() {

0 commit comments

Comments
 (0)