From 787b70592fc611732c4b27da2c32cf2c4f361832 Mon Sep 17 00:00:00 2001 From: Mark Mansi Date: Fri, 13 Apr 2018 20:05:01 -0500 Subject: [PATCH] Turn some comments into doccomments --- src/librustc_resolve/lib.rs | 107 ++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 01940ee4fd0f6..671856c4e549e 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -962,38 +962,38 @@ enum TypeParameters<'a, 'b> { RibKind<'a>), } -// The rib kind controls the translation of local -// definitions (`Def::Local`) to upvars (`Def::Upvar`). +/// The rib kind controls the translation of local +/// definitions (`Def::Local`) to upvars (`Def::Upvar`). #[derive(Copy, Clone, Debug)] enum RibKind<'a> { - // No translation needs to be applied. + /// No translation needs to be applied. NormalRibKind, - // We passed through a closure scope at the given node ID. - // Translate upvars as appropriate. + /// We passed through a closure scope at the given node ID. + /// Translate upvars as appropriate. ClosureRibKind(NodeId /* func id */), - // We passed through an impl or trait and are now in one of its - // methods or associated types. Allow references to ty params that impl or trait - // binds. Disallow any other upvars (including other ty params that are - // upvars). + /// We passed through an impl or trait and are now in one of its + /// methods or associated types. Allow references to ty params that impl or trait + /// binds. Disallow any other upvars (including other ty params that are + /// upvars). TraitOrImplItemRibKind, - // We passed through an item scope. Disallow upvars. + /// We passed through an item scope. Disallow upvars. ItemRibKind, - // We're in a constant item. Can't refer to dynamic stuff. + /// We're in a constant item. Can't refer to dynamic stuff. ConstantItemRibKind, - // We passed through a module. + /// We passed through a module. ModuleRibKind(Module<'a>), - // We passed through a `macro_rules!` statement + /// We passed through a `macro_rules!` statement MacroDefinition(DefId), - // All bindings in this rib are type parameters that can't be used - // from the default of a type parameter because they're not declared - // before said type parameter. Also see the `visit_generics` override. + /// All bindings in this rib are type parameters that can't be used + /// from the default of a type parameter because they're not declared + /// before said type parameter. Also see the `visit_generics` override. ForwardTyParamBanRibKind, } @@ -1198,7 +1198,7 @@ impl<'a> fmt::Debug for ModuleData<'a> { } } -// Records a possibly-private value, type, or module definition. +/// Records a possibly-private value, type, or module definition. #[derive(Clone, Debug)] pub struct NameBinding<'a> { kind: NameBindingKind<'a>, @@ -1408,36 +1408,36 @@ pub struct Resolver<'a> { prelude: Option>, - // n.b. This is used only for better diagnostics, not name resolution itself. + /// n.b. This is used only for better diagnostics, not name resolution itself. has_self: FxHashSet, - // Names of fields of an item `DefId` accessible with dot syntax. - // Used for hints during error reporting. + /// Names of fields of an item `DefId` accessible with dot syntax. + /// Used for hints during error reporting. field_names: FxHashMap>, - // All imports known to succeed or fail. + /// All imports known to succeed or fail. determined_imports: Vec<&'a ImportDirective<'a>>, - // All non-determined imports. + /// All non-determined imports. indeterminate_imports: Vec<&'a ImportDirective<'a>>, - // The module that represents the current item scope. + /// The module that represents the current item scope. current_module: Module<'a>, - // The current set of local scopes for types and values. - // FIXME #4948: Reuse ribs to avoid allocation. + /// The current set of local scopes for types and values. + /// FIXME #4948: Reuse ribs to avoid allocation. ribs: PerNS>>, - // The current set of local scopes, for labels. + /// The current set of local scopes, for labels. label_ribs: Vec>, - // The trait that the current context can refer to. + /// The trait that the current context can refer to. current_trait_ref: Option<(Module<'a>, TraitRef)>, - // The current self type if inside an impl (used for better errors). + /// The current self type if inside an impl (used for better errors). current_self_type: Option, - // The idents for the primitive types. + /// The idents for the primitive types. primitive_type_table: PrimitiveTypeTable, def_map: DefMap, @@ -1446,20 +1446,20 @@ pub struct Resolver<'a> { pub export_map: ExportMap, pub trait_map: TraitMap, - // A map from nodes to anonymous modules. - // Anonymous modules are pseudo-modules that are implicitly created around items - // contained within blocks. - // - // For example, if we have this: - // - // fn f() { - // fn g() { - // ... - // } - // } - // - // There will be an anonymous module created around `g` with the ID of the - // entry block for `f`. + /// A map from nodes to anonymous modules. + /// Anonymous modules are pseudo-modules that are implicitly created around items + /// contained within blocks. + /// + /// For example, if we have this: + /// + /// fn f() { + /// fn g() { + /// ... + /// } + /// } + /// + /// There will be an anonymous module created around `g` with the ID of the + /// entry block for `f`. block_map: NodeMap>, module_map: FxHashMap>, extern_module_map: FxHashMap<(DefId, bool /* MacrosOnly? */), Module<'a>>, @@ -1487,7 +1487,8 @@ pub struct Resolver<'a> { arenas: &'a ResolverArenas<'a>, dummy_binding: &'a NameBinding<'a>, - use_extern_macros: bool, // true if `#![feature(use_extern_macros)]` + /// true if `#![feature(use_extern_macros)]` + use_extern_macros: bool, crate_loader: &'a mut CrateLoader, macro_names: FxHashSet, @@ -1501,29 +1502,29 @@ pub struct Resolver<'a> { pub whitelisted_legacy_custom_derives: Vec, pub found_unresolved_macro: bool, - // List of crate local macros that we need to warn about as being unused. - // Right now this only includes macro_rules! macros, and macros 2.0. + /// List of crate local macros that we need to warn about as being unused. + /// Right now this only includes macro_rules! macros, and macros 2.0. unused_macros: FxHashSet, - // Maps the `Mark` of an expansion to its containing module or block. + /// Maps the `Mark` of an expansion to its containing module or block. invocations: FxHashMap>, - // Avoid duplicated errors for "name already defined". + /// Avoid duplicated errors for "name already defined". name_already_seen: FxHashMap, - // If `#![feature(proc_macro)]` is set + /// If `#![feature(proc_macro)]` is set proc_macro_enabled: bool, - // A set of procedural macros imported by `#[macro_use]` that have already been warned about + /// A set of procedural macros imported by `#[macro_use]` that have already been warned about warned_proc_macros: FxHashSet, potentially_unused_imports: Vec<&'a ImportDirective<'a>>, - // This table maps struct IDs into struct constructor IDs, - // it's not used during normal resolution, only for better error reporting. + /// This table maps struct IDs into struct constructor IDs, + /// it's not used during normal resolution, only for better error reporting. struct_constructors: DefIdMap<(Def, ty::Visibility)>, - // Only used for better errors on `fn(): fn()` + /// Only used for better errors on `fn(): fn()` current_type_ascription: Vec, injected_crate: Option>,