@@ -878,8 +878,9 @@ enum RibKind<'a> {
878
878
///
879
879
/// A rib represents a scope names can live in. Note that these appear in many places, not just
880
880
/// around braces. At any place where the list of accessible names (of the given namespace)
881
- /// changes, a new rib is put onto a stack. This may be, for example, a `let` statement (because it
882
- /// introduces variables), a macro, etc.
881
+ /// changes or a new restrictions on the name accessibility are introduced, a new rib is put onto a
882
+ /// stack. This may be, for example, a `let` statement (because it introduces variables), a macro,
883
+ /// etc.
883
884
///
884
885
/// Different [rib kinds](enum.RibKind) are transparent for different names.
885
886
///
@@ -935,11 +936,26 @@ enum PathResult<'a> {
935
936
}
936
937
937
938
enum ModuleKind {
938
- /// Inline `mod something { ... }`.
939
+ /// An anonymous module, eg. just a block.
940
+ ///
941
+ /// ```
942
+ /// fn main() {
943
+ /// fn f() {} // (1)
944
+ /// { // This is an anonymous module
945
+ /// f(); // This resolves to (2) as we are inside the block.
946
+ /// fn f() {} // (2)
947
+ /// }
948
+ /// f(); // Resolves to (1)
949
+ /// }
950
+ /// ```
939
951
Block ( NodeId ) ,
940
- /// Module from another file.
952
+ /// Any module with a name.
953
+ ///
954
+ /// This could be:
941
955
///
942
- /// Also called a normal module in the following code.
956
+ /// * A normal module ‒ either `mod from_file;` or `mod from_block { }`.
957
+ /// * A trait or an enum (it implicitly contains associated types, methods and variant
958
+ /// constructors).
943
959
Def ( Def , Name ) ,
944
960
}
945
961
@@ -1444,8 +1460,8 @@ impl<'a, 'b: 'a> ty::DefIdTree for &'a Resolver<'b> {
1444
1460
}
1445
1461
}
1446
1462
1447
- /// This is the interface through which the rest of the compiler asks about name resolution after
1448
- /// the whole AST has been indexed .
1463
+ /// This interface is used through the AST→HIR step, to embed full paths into the HIR. After that
1464
+ /// the resolver is no longer needed as all the relevant information is inline .
1449
1465
impl < ' a > hir:: lowering:: Resolver for Resolver < ' a > {
1450
1466
fn resolve_hir_path ( & mut self , path : & mut hir:: Path , is_value : bool ) {
1451
1467
self . resolve_hir_path_cb ( path, is_value,
0 commit comments