Skip to content

rustdoc: provide more context for parse errors in code blocks #67857

Open
@euclio

Description

@euclio

Split from #67563.

Currently, the bad_codeblock_syntax_pass in rustdoc provides error messages like the following:

warning: could not parse code block as Rust code
  --> $DIR/invalid-syntax.rs:3:5
   |
LL |   /// ```
   |  _____^
LL | | /// \__________pkt->size___________/          \_result->size_/ \__pkt->size__/
LL | | /// ```
   | |_______^
   |
   = note: error from rustc: unknown start of token: \
   = note: error from rustc: unknown start of token: \
   = note: error from rustc: unknown start of token: \

Ideally, we could display the error spans inline (but downgrade them to warnings).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions