Skip to content

include! is a smell and should be made obsolete for code-generating cargo packages #21147

Closed
@emberian

Description

@emberian

In particular, we should somehow allow using OUT_DIR in the #[path] of a mod foo, to allow parsing to proceed normally. Since include! doesn't do textual inclusion, but rather AST splicing, and is rather blind, it doesn't pass in the correct context to allow things like outer attributes to work in include!'d code, even if it's mod foo { include!("foo.rs"); }. It's conservatively correct, but conservatively obnoxious.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions