-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Documentation request: include_str and format_args combination #85846
Copy link
Copy link
Open
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I noticed some weird behavior today and couldn't find any documentation on how it works. It seems that
format_args!andinclude_str!can actually work together to do compile-time validation of file inputs. Like so:Both of these are compiler builtins so their sources aren't easily accessible. However, in neither of their documentation did I see any mention of this behavior. Contrast this with a proc/decl macro that tries to parse the inners as a LitStr/literal:
with error:
Is there any documentation for this behavior? Is there any way for macro developers to also leverage this mechanic for parse a str literal returned by
include_str!?