@@ -962,38 +962,38 @@ enum TypeParameters<'a, 'b> {
962962 RibKind < ' a > ) ,
963963}
964964
965- // The rib kind controls the translation of local
966- // definitions (`Def::Local`) to upvars (`Def::Upvar`).
965+ /// The rib kind controls the translation of local
966+ /// definitions (`Def::Local`) to upvars (`Def::Upvar`).
967967#[ derive( Copy , Clone , Debug ) ]
968968enum RibKind < ' a > {
969- // No translation needs to be applied.
969+ /// No translation needs to be applied.
970970 NormalRibKind ,
971971
972- // We passed through a closure scope at the given node ID.
973- // Translate upvars as appropriate.
972+ /// We passed through a closure scope at the given node ID.
973+ /// Translate upvars as appropriate.
974974 ClosureRibKind ( NodeId /* func id */ ) ,
975975
976- // We passed through an impl or trait and are now in one of its
977- // methods or associated types. Allow references to ty params that impl or trait
978- // binds. Disallow any other upvars (including other ty params that are
979- // upvars).
976+ /// We passed through an impl or trait and are now in one of its
977+ /// methods or associated types. Allow references to ty params that impl or trait
978+ /// binds. Disallow any other upvars (including other ty params that are
979+ /// upvars).
980980 TraitOrImplItemRibKind ,
981981
982- // We passed through an item scope. Disallow upvars.
982+ /// We passed through an item scope. Disallow upvars.
983983 ItemRibKind ,
984984
985- // We're in a constant item. Can't refer to dynamic stuff.
985+ /// We're in a constant item. Can't refer to dynamic stuff.
986986 ConstantItemRibKind ,
987987
988- // We passed through a module.
988+ /// We passed through a module.
989989 ModuleRibKind ( Module < ' a > ) ,
990990
991- // We passed through a `macro_rules!` statement
991+ /// We passed through a `macro_rules!` statement
992992 MacroDefinition ( DefId ) ,
993993
994- // All bindings in this rib are type parameters that can't be used
995- // from the default of a type parameter because they're not declared
996- // before said type parameter. Also see the `visit_generics` override.
994+ /// All bindings in this rib are type parameters that can't be used
995+ /// from the default of a type parameter because they're not declared
996+ /// before said type parameter. Also see the `visit_generics` override.
997997 ForwardTyParamBanRibKind ,
998998}
999999
@@ -1198,7 +1198,7 @@ impl<'a> fmt::Debug for ModuleData<'a> {
11981198 }
11991199}
12001200
1201- // Records a possibly-private value, type, or module definition.
1201+ /// Records a possibly-private value, type, or module definition.
12021202#[ derive( Clone , Debug ) ]
12031203pub struct NameBinding < ' a > {
12041204 kind : NameBindingKind < ' a > ,
@@ -1408,36 +1408,36 @@ pub struct Resolver<'a> {
14081408
14091409 prelude : Option < Module < ' a > > ,
14101410
1411- // n.b. This is used only for better diagnostics, not name resolution itself.
1411+ /// n.b. This is used only for better diagnostics, not name resolution itself.
14121412 has_self : FxHashSet < DefId > ,
14131413
1414- // Names of fields of an item `DefId` accessible with dot syntax.
1415- // Used for hints during error reporting.
1414+ /// Names of fields of an item `DefId` accessible with dot syntax.
1415+ /// Used for hints during error reporting.
14161416 field_names : FxHashMap < DefId , Vec < Name > > ,
14171417
1418- // All imports known to succeed or fail.
1418+ /// All imports known to succeed or fail.
14191419 determined_imports : Vec < & ' a ImportDirective < ' a > > ,
14201420
1421- // All non-determined imports.
1421+ /// All non-determined imports.
14221422 indeterminate_imports : Vec < & ' a ImportDirective < ' a > > ,
14231423
1424- // The module that represents the current item scope.
1424+ /// The module that represents the current item scope.
14251425 current_module : Module < ' a > ,
14261426
1427- // The current set of local scopes for types and values.
1428- // FIXME #4948: Reuse ribs to avoid allocation.
1427+ /// The current set of local scopes for types and values.
1428+ /// FIXME #4948: Reuse ribs to avoid allocation.
14291429 ribs : PerNS < Vec < Rib < ' a > > > ,
14301430
1431- // The current set of local scopes, for labels.
1431+ /// The current set of local scopes, for labels.
14321432 label_ribs : Vec < Rib < ' a > > ,
14331433
1434- // The trait that the current context can refer to.
1434+ /// The trait that the current context can refer to.
14351435 current_trait_ref : Option < ( Module < ' a > , TraitRef ) > ,
14361436
1437- // The current self type if inside an impl (used for better errors).
1437+ /// The current self type if inside an impl (used for better errors).
14381438 current_self_type : Option < Ty > ,
14391439
1440- // The idents for the primitive types.
1440+ /// The idents for the primitive types.
14411441 primitive_type_table : PrimitiveTypeTable ,
14421442
14431443 def_map : DefMap ,
@@ -1446,20 +1446,20 @@ pub struct Resolver<'a> {
14461446 pub export_map : ExportMap ,
14471447 pub trait_map : TraitMap ,
14481448
1449- // A map from nodes to anonymous modules.
1450- // Anonymous modules are pseudo-modules that are implicitly created around items
1451- // contained within blocks.
1452- //
1453- // For example, if we have this:
1454- //
1455- // fn f() {
1456- // fn g() {
1457- // ...
1458- // }
1459- // }
1460- //
1461- // There will be an anonymous module created around `g` with the ID of the
1462- // entry block for `f`.
1449+ /// A map from nodes to anonymous modules.
1450+ /// Anonymous modules are pseudo-modules that are implicitly created around items
1451+ /// contained within blocks.
1452+ ///
1453+ /// For example, if we have this:
1454+ ///
1455+ /// fn f() {
1456+ /// fn g() {
1457+ /// ...
1458+ /// }
1459+ /// }
1460+ ///
1461+ /// There will be an anonymous module created around `g` with the ID of the
1462+ /// entry block for `f`.
14631463 block_map : NodeMap < Module < ' a > > ,
14641464 module_map : FxHashMap < DefId , Module < ' a > > ,
14651465 extern_module_map : FxHashMap < ( DefId , bool /* MacrosOnly? */ ) , Module < ' a > > ,
@@ -1487,7 +1487,8 @@ pub struct Resolver<'a> {
14871487
14881488 arenas : & ' a ResolverArenas < ' a > ,
14891489 dummy_binding : & ' a NameBinding < ' a > ,
1490- use_extern_macros : bool , // true if `#![feature(use_extern_macros)]`
1490+ /// true if `#![feature(use_extern_macros)]`
1491+ use_extern_macros : bool ,
14911492
14921493 crate_loader : & ' a mut CrateLoader ,
14931494 macro_names : FxHashSet < Ident > ,
@@ -1501,29 +1502,29 @@ pub struct Resolver<'a> {
15011502 pub whitelisted_legacy_custom_derives : Vec < Name > ,
15021503 pub found_unresolved_macro : bool ,
15031504
1504- // List of crate local macros that we need to warn about as being unused.
1505- // Right now this only includes macro_rules! macros, and macros 2.0.
1505+ /// List of crate local macros that we need to warn about as being unused.
1506+ /// Right now this only includes macro_rules! macros, and macros 2.0.
15061507 unused_macros : FxHashSet < DefId > ,
15071508
1508- // Maps the `Mark` of an expansion to its containing module or block.
1509+ /// Maps the `Mark` of an expansion to its containing module or block.
15091510 invocations : FxHashMap < Mark , & ' a InvocationData < ' a > > ,
15101511
1511- // Avoid duplicated errors for "name already defined".
1512+ /// Avoid duplicated errors for "name already defined".
15121513 name_already_seen : FxHashMap < Name , Span > ,
15131514
1514- // If `#![feature(proc_macro)]` is set
1515+ /// If `#![feature(proc_macro)]` is set
15151516 proc_macro_enabled : bool ,
15161517
1517- // A set of procedural macros imported by `#[macro_use]` that have already been warned about
1518+ /// A set of procedural macros imported by `#[macro_use]` that have already been warned about
15181519 warned_proc_macros : FxHashSet < Name > ,
15191520
15201521 potentially_unused_imports : Vec < & ' a ImportDirective < ' a > > ,
15211522
1522- // This table maps struct IDs into struct constructor IDs,
1523- // it's not used during normal resolution, only for better error reporting.
1523+ /// This table maps struct IDs into struct constructor IDs,
1524+ /// it's not used during normal resolution, only for better error reporting.
15241525 struct_constructors : DefIdMap < ( Def , ty:: Visibility ) > ,
15251526
1526- // Only used for better errors on `fn(): fn()`
1527+ /// Only used for better errors on `fn(): fn()`
15271528 current_type_ascription : Vec < Span > ,
15281529
15291530 injected_crate : Option < Module < ' a > > ,
0 commit comments