Invalid `extended_key_value_attribute` error
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 231
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
Description
The error happens too early in the pipeline, and things like doc_comment! { concat!("...", "...") } trigger the error:
doc_comment! {
concat!("The smallest value that can be represented by this integer type.
Use [`", stringify!($T), "::MIN", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MIN) instead.
# Examples
// unescape this for the testcase, this is just so github doesn't mess up the rendering
\```rust
// deprecated way
let min = std::", stringify!($T), "::MIN;
// intended way
let min = ", stringify!($T), "::MIN;
\```
"),
#[$attr]
pub const MIN: $T = $T::MIN;
}
The error is triggered when parsing, but does not take into account built-in macros that could expand to a string literal (such as concat!()). We need to delay the error emission to after expansion/early nameres
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing parsing of extended_key_value_attribute through expansion and early name resolution, focusing on built-in macros such as concat!. Reproduce the doc_comment! example, then verify that macros expanding to string literals no longer trigger the error prematurely while invalid attributes still produce an error after expansion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100