- Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-bugCategory: This is a bug.Category: This is a bug.F-frontmatter`#![feature(frontmatter)]``#![feature(frontmatter)]`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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
See also #145520 and #145945.
This is basically (the fixed) #145520 but with TokenStream
replaced with Literal
inside .parse()
.
Reproducer
rustc a.rs --crate-type proc-macro --extern proc_macro
wherea.rs
:#[proc_macro] pub fn ck(x: proc_macro::TokenStream) -> proc_macro::TokenStream { _ = "---".parse::<proc_macro::Literal>(); x }
rustc b.rs --crate-type lib --extern a -L.
whereb.rs
:a::ck!();
In 1.87 and earlier, this used to compile just fine. However, since 1.88 (more precisely since PR #140035) this fails with:
error: invalid infostring for frontmatter --> <proc-macro source code>:1:4 | 1 | --- | ^ | = note: frontmatter infostrings must be a single identifier immediately following the opening error: unclosed frontmatter --> <proc-macro source code>:1:1 | 1 | --- | ^^^ | note: frontmatter opening here was not closed --> <proc-macro source code>:1:1 | 1 | --- | ^^^ error[E0658]: frontmatters are experimental --> <proc-macro source code>:1:1 | 1 | --- | ^^^ | = note: see issue #136889 <https://github.com/rust-lang/rust/issues/136889> for more information = help: add `#![feature(frontmatter)]` to the crate attributes to enable = note: this compiler was built on 2025-09-02; consider upgrading it if it is out of date error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`.
Metadata
Metadata
Assignees
Labels
A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-bugCategory: This is a bug.Category: This is a bug.F-frontmatter`#![feature(frontmatter)]``#![feature(frontmatter)]`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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.