File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -1765,15 +1765,6 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'tcx, '_> {
17651765
17661766pub 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,
Original file line number Diff line number Diff 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 ( ) {
You can’t perform that action at this time.
0 commit comments