diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index d8799f8332f..c42a933a954 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -1,7 +1,9 @@ -//! Reduced graph building. +//! After we obtain a fresh AST fragment from a macro, code in this module helps to integrate +//! that fragment into the module structures that are already partially built. //! -//! Here we build the "reduced graph": the graph of the module tree without -//! any imports resolved. +//! Items from the fragment are placed into modules, +//! unexpanded macros in the fragment are visited and registered. +//! Imports are also considered items and placed into modules here, but not resolved yet. use crate::macros::{LegacyBinding, LegacyScope}; use crate::resolve_imports::ImportDirective; diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index fbd9f1d48e5..d97ee61d839 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -1,3 +1,10 @@ +//! "Late resolution" is the pass that resolves most of names in a crate beside imports and macros. +//! It runs when the crate is fully expanded and its module structure is fully built. +//! So it just walks through the crate and resolves all the expressions, types, etc. +//! +//! If you wonder why there's no `early.rs`, that's because it's split into three files - +//! `build_reduced_graph.rs`, `macros.rs` and `resolve_imports.rs`. + use GenericParameters::*; use RibKind::*; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 0cf9aa72d78..2b55f9dc79d 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1,3 +1,12 @@ +//! This crate is responsible for the part of name resolution that doesn't require type checker. +//! +//! Module structure of the crate is built here. +//! Paths in macros, imports, expressions, types, patterns are resolved here. +//! Label names are resolved here as well. +//! +//! Type-relative name resolution (methods, fields, associated items) happens in `librustc_typeck`. +//! Lifetime names are resolved in `librustc/middle/resolve_lifetime.rs`. + #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(crate_visibility_modifier)] diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 0a63dd2558d..2f9bee74908 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -1,3 +1,6 @@ +//! A bunch of methods and structures more or less related to resolving macros and +//! interface provided by `Resolver` to macro expander. + use crate::{AmbiguityError, AmbiguityKind, AmbiguityErrorMisc, Determinacy}; use crate::{CrateLint, Resolver, ResolutionError, Scope, ScopeSet, ParentScope, Weak}; use crate::{ModuleKind, NameBinding, PathResult, Segment, ToNameBinding}; diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 0e3bdc1274a..693893e9ef1 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -1,3 +1,5 @@ +//! A bunch of methods and structures more or less related to resolving imports. + use ImportDirectiveSubclass::*; use crate::{AmbiguityError, AmbiguityKind, AmbiguityErrorMisc};