Skip to content

improve include!() docs #36387

Closed
Closed
@durka

Description

@durka

The docs are:

Parse the current given file as an expression.

This is generally a bad idea, because it's going to behave unhygienically.

  • current given file? wat
  • "as an expression" is incorrect -- it could be an item or statement according to context
  • The second sentence is vague and confusing if you aren't familiar with hygiene.
  • Behavior WRT relative paths is not specified (for include_str! it is).

include!() is widely used for generated code these days, so the doc should be more informative and clearly explain in which situations include!() is a bad idea. Maybe even have an example of including generated code from $OUT_DIR.

Part of #29381.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions