File tree 2 files changed +4
-9
lines changed
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, '_> {
1765
1765
1766
1766
pub fn provide ( providers : & mut Providers ) {
1767
1767
* 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
- } ,
1777
1768
effective_visibilities,
1778
1769
check_private_in_public,
1779
1770
check_mod_privacy,
Original file line number Diff line number Diff line change @@ -1229,6 +1229,10 @@ impl<'tcx> Resolver<'_, 'tcx> {
1229
1229
1230
1230
let feed = self . tcx . feed_local_def_id ( def_id) ;
1231
1231
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
+ }
1232
1236
1233
1237
// Create the definition.
1234
1238
if expn_id != ExpnId :: root ( ) {
You can’t perform that action at this time.
0 commit comments