Skip to content

diagnostics: improve E0758 note for backticks in doc comments#157092

Open
fabricnp wants to merge 1 commit into
rust-lang:mainfrom
fabricnp:fix/improve-e0758-backtick-diagnostic
Open

diagnostics: improve E0758 note for backticks in doc comments#157092
fabricnp wants to merge 1 commit into
rust-lang:mainfrom
fabricnp:fix/improve-e0758-backtick-diagnostic

Conversation

@fabricnp
Copy link
Copy Markdown

@fabricnp fabricnp commented May 29, 2026

When a block doc-comment contains /* or */ inside a Markdown backtick span, the lexer's nesting depth becomes skewed. Because the lexer is intentionally blind to Markdown syntax, this behavior is working as designed.

This commit adds a best-effort diagnostic heuristic to report_unterminated_block_comment. It detects comment markers inside backtick spans and emits a note/help message pointing the user toward workarounds.

Fixes #157034

Copilot AI review requested due to automatic review settings May 29, 2026 05:34
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 29, 2026

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 29, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 29, 2026

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, lexer
  • compiler, lexer expanded to 73 candidates
  • Random selection from 18 candidates

@rustbot

This comment has been minimized.

This comment was marked as spam.

@rust-log-analyzer

This comment has been minimized.

When a block doc-comment contains '/*' or '*/' inside a Markdown backtick
span, the lexer's nesting depth becomes skewed. Because the lexer is
intentionally blind to Markdown syntax, this behavior is working as
designed.

This commit adds a best-effort diagnostic heuristic to
'report_unterminated_block_comment'. It detects comment markers inside
backtick spans and emits a note/help message pointing the user toward
workarounds.
@fabricnp fabricnp force-pushed the fix/improve-e0758-backtick-diagnostic branch from ba7f76e to e22494a Compare May 29, 2026 05:50
@apiraino
Copy link
Copy Markdown
Contributor

@fabricnp please do not trigger unprompted reviews from bots in our repository, thanks.

@fabricnp
Copy link
Copy Markdown
Author

@fabricnp please do not trigger unprompted reviews from bots in our repository, thanks.

Sorry, my apologies i am used to leaning on Copilot for automated linting in other ecosystems and didn't mean to introduce noise into the review thread here. this wont happen again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bad parsing in module-level comments when there is /* in a verbatim string

6 participants