Skip to content

Consider moving out-of-line module loading from parser to expansion #64197

Closed

Description

Due to module loading parser has to do some not very appropriate for a parser things like

  • expanding cfgs on modules (duplicated with expansion)
  • keeping the current filesystem position (duplicated with expansion)

We also don't really need to load those files until we need to incorporate their contents into NodeId-entified AST, which happens during expansion.

The move will also mean never loading files in unconfigured code.
The loading is currently skipped only if cfg is placed directly on the mod m;, but not in other cases like

#[cfg(FALSE)]
mod m {
    mod n; // Still loaded
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-parserArea: The parsing of Rust source code to an ASTT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions