-
-
Notifications
You must be signed in to change notification settings - Fork 15k
async and other Rust 2018+ keywords not recognized as so in Rustdoc highlighting #80004
Copy link
Copy link
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-rustdoc-uiArea: Rustdoc UI (generated HTML)Area: Rustdoc UI (generated HTML)AsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-rustdoc-uiArea: Rustdoc UI (generated HTML)Area: Rustdoc UI (generated HTML)AsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code:
I expected to see this happen:
asyncand other Rust 2018+ keywords are highlighted as my project is set toedition = "2018"in itsCargo.tomlInstead, this happened: They were not highlighted, but regular keywords (including reserved ones) were.

I believe that the reason why this is happening is this snippet in librustdoc:
rust/src/librustdoc/html/highlight.rs
Lines 292 to 305 in eb4fc71
In this case,
Ident::from_strwill only create a dummy span (which isn't set to 2018 edition), sois_reserveddoes not include 2018+ keywords.I would be willing to try to work on a PR to fix this issue if it is deemed worthy.
Meta
Tested
rustc --version --verbose:stable:
nightly:
Backtrace is not applicable.