Skip to content

Commit aca1353

Browse files
committed
resolve: Add some comments to the main modules
1 parent 310ee4d commit aca1353

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

src/librustc_resolve/build_reduced_graph.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
//! Reduced graph building.
1+
//! After we obtain a fresh AST fragment from a macro, code in this module helps to integrate
2+
//! that fragment into the module structures that are already partially built.
23
//!
3-
//! Here we build the "reduced graph": the graph of the module tree without
4-
//! any imports resolved.
4+
//! Items from the fragment are placed into modules,
5+
//! unexpanded macros in the fragment are visited and registered.
6+
//! Imports are also considered items and placed into modules here, but not resolved yet.
57
68
use crate::macros::{LegacyBinding, LegacyScope};
79
use crate::resolve_imports::ImportDirective;

src/librustc_resolve/late.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//! "Late resolution" is the pass that resolves most of names in a crate beside imports and macros.
2+
//! It runs when the crate is fully expanded and its module structure is fully built.
3+
//! So it just walks through the crate and resolves all the expressions, types, etc.
4+
//!
5+
//! If you wonder why there's no `early.rs`, that's because it's split into three files -
6+
//! `build_reduced_graph.rs`, `macros.rs` and `resolve_imports.rs`.
7+
18
use GenericParameters::*;
29
use RibKind::*;
310

src/librustc_resolve/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
//! This crate is responsible for the part of name resolution that doesn't require type checker.
2+
//!
3+
//! Module structure of the crate is built here.
4+
//! Paths in macros, imports, expressions, types, patterns are resolved here.
5+
//! Label names are resolved here as well.
6+
//!
7+
//! Type-relative name resolution (methods, fields, associated items) happens in `librustc_typeck`.
8+
//! Lifetime names are resolved in `librustc/middle/resolve_lifetime.rs`.
9+
110
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
211

312
#![feature(crate_visibility_modifier)]

src/librustc_resolve/macros.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! A bunch of methods and structures more or less related to resolving macros and
2+
//! interface provided by `Resolver` to macro expander.
3+
14
use crate::{AmbiguityError, AmbiguityKind, AmbiguityErrorMisc, Determinacy};
25
use crate::{CrateLint, Resolver, ResolutionError, Scope, ScopeSet, ParentScope, Weak};
36
use crate::{ModuleKind, NameBinding, PathResult, Segment, ToNameBinding};

src/librustc_resolve/resolve_imports.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! A bunch of methods and structures more or less related to resolving imports.
2+
13
use ImportDirectiveSubclass::*;
24

35
use crate::{AmbiguityError, AmbiguityKind, AmbiguityErrorMisc};

0 commit comments

Comments
 (0)