resolve: Add some comments to the main modules

This commit is contained in:
Vadim Petrochenkov 2019-08-13 02:46:42 +03:00
parent 310ee4d98c
commit aca1353240
5 changed files with 26 additions and 3 deletions

View file

@ -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 //! Items from the fragment are placed into modules,
//! any imports resolved. //! 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::macros::{LegacyBinding, LegacyScope};
use crate::resolve_imports::ImportDirective; use crate::resolve_imports::ImportDirective;

View file

@ -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 GenericParameters::*;
use RibKind::*; use RibKind::*;

View file

@ -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/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(crate_visibility_modifier)] #![feature(crate_visibility_modifier)]

View file

@ -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::{AmbiguityError, AmbiguityKind, AmbiguityErrorMisc, Determinacy};
use crate::{CrateLint, Resolver, ResolutionError, Scope, ScopeSet, ParentScope, Weak}; use crate::{CrateLint, Resolver, ResolutionError, Scope, ScopeSet, ParentScope, Weak};
use crate::{ModuleKind, NameBinding, PathResult, Segment, ToNameBinding}; use crate::{ModuleKind, NameBinding, PathResult, Segment, ToNameBinding};

View file

@ -1,3 +1,5 @@
//! A bunch of methods and structures more or less related to resolving imports.
use ImportDirectiveSubclass::*; use ImportDirectiveSubclass::*;
use crate::{AmbiguityError, AmbiguityKind, AmbiguityErrorMisc}; use crate::{AmbiguityError, AmbiguityKind, AmbiguityErrorMisc};