@@ -45,7 +45,7 @@ use tracing::debug;
4545rustc_fluent_macro:: fluent_messages! { "../messages.ftl" }
4646
4747////////////////////////////////////////////////////////////////////////////////
48- /// Generic infrastructure used to implement specific visitors below.
48+ // Generic infrastructure used to implement specific visitors below.
4949////////////////////////////////////////////////////////////////////////////////
5050
5151struct LazyDefPathStr < ' tcx > {
@@ -309,10 +309,7 @@ fn min(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'_>) -> ty::Visib
309309 if vis1. is_at_least ( vis2, tcx) { vis2 } else { vis1 }
310310}
311311
312- ////////////////////////////////////////////////////////////////////////////////
313312/// Visitor used to determine impl visibility and reachability.
314- ////////////////////////////////////////////////////////////////////////////////
315-
316313struct FindMin < ' a , ' tcx , VL : VisibilityLike , const SHALLOW : bool > {
317314 tcx : TyCtxt < ' tcx > ,
318315 effective_visibilities : & ' a EffectiveVisibilities ,
@@ -387,10 +384,7 @@ impl VisibilityLike for EffectiveVisibility {
387384 }
388385}
389386
390- ////////////////////////////////////////////////////////////////////////////////
391387/// The embargo visitor, used to determine the exports of the AST.
392- ////////////////////////////////////////////////////////////////////////////////
393-
394388struct EmbargoVisitor < ' tcx > {
395389 tcx : TyCtxt < ' tcx > ,
396390
@@ -849,9 +843,7 @@ impl<'tcx> DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx>
849843 }
850844}
851845
852- ////////////////////////////////////////////////////////////////////////////////
853846/// Visitor, used for EffectiveVisibilities table checking
854- ////////////////////////////////////////////////////////////////////////////////
855847pub struct TestReachabilityVisitor < ' a , ' tcx > {
856848 tcx : TyCtxt < ' tcx > ,
857849 effective_visibilities : & ' a EffectiveVisibilities ,
@@ -909,13 +901,11 @@ impl<'a, 'tcx> TestReachabilityVisitor<'a, 'tcx> {
909901 }
910902}
911903
912- //////////////////////////////////////////////////////////////////////////////////////
913904/// Name privacy visitor, checks privacy and reports violations.
905+ ///
914906/// Most of name privacy checks are performed during the main resolution phase,
915907/// or later in type checking when field accesses and associated items are resolved.
916908/// This pass performs remaining checks for fields in struct expressions and patterns.
917- //////////////////////////////////////////////////////////////////////////////////////
918-
919909struct NamePrivacyVisitor < ' tcx > {
920910 tcx : TyCtxt < ' tcx > ,
921911 maybe_typeck_results : Option < & ' tcx ty:: TypeckResults < ' tcx > > ,
@@ -1120,12 +1110,10 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {
11201110 }
11211111}
11221112
1123- ////////////////////////////////////////////////////////////////////////////////////////////
11241113/// Type privacy visitor, checks types for privacy and reports violations.
1114+ ///
11251115/// Both explicitly written types and inferred types of expressions and patterns are checked.
11261116/// Checks are performed on "semantic" types regardless of names and their hygiene.
1127- ////////////////////////////////////////////////////////////////////////////////////////////
1128-
11291117struct TypePrivacyVisitor < ' tcx > {
11301118 tcx : TyCtxt < ' tcx > ,
11311119 module_def_id : LocalModDefId ,
@@ -1345,13 +1333,11 @@ impl<'tcx> DefIdVisitor<'tcx> for TypePrivacyVisitor<'tcx> {
13451333 }
13461334}
13471335
1348- ///////////////////////////////////////////////////////////////////////////////
13491336/// SearchInterfaceForPrivateItemsVisitor traverses an item's interface and
13501337/// finds any private components in it.
1338+ ///
13511339/// PrivateItemsInPublicInterfacesVisitor ensures there are no private types
13521340/// and traits in public interfaces.
1353- ///////////////////////////////////////////////////////////////////////////////
1354-
13551341struct SearchInterfaceForPrivateItemsVisitor < ' tcx > {
13561342 tcx : TyCtxt < ' tcx > ,
13571343 item_def_id : LocalDefId ,
0 commit comments