Skip to content

Add new invalid_markdown_table rustdoc lint - #159583

Merged
rust-bors[bot] merged 7 commits into
rust-lang:mainfrom
GuillaumeGomez:unescaped_pipe_in_table_cell
Aug 25, 2026
Merged

Add new invalid_markdown_table rustdoc lint#159583
rust-bors[bot] merged 7 commits into
rust-lang:mainfrom
GuillaumeGomez:unescaped_pipe_in_table_cell

Conversation

@GuillaumeGomez

@GuillaumeGomez GuillaumeGomez commented Jul 19, 2026

Copy link
Copy Markdown
Member

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 19, 2026
@rust-log-analyzer

This comment has been minimized.

Comment thread tests/rustdoc-ui/lints/invalid_markdown_table.rs
Comment thread src/librustdoc/passes/lint/invalid_markdown_table.rs Outdated
Comment thread src/librustdoc/passes/lint/table_pipe_escape.rs Outdated
Comment thread src/librustdoc/passes/lint/table_pipe_escape.rs Outdated
Comment thread src/librustdoc/passes/lint/table_pipe_escape.rs Outdated
Comment thread src/librustdoc/passes/lint/table_pipe_escape.rs Outdated
Comment thread src/librustdoc/passes/lint/invalid_markdown_table.rs Outdated
@Urgau Urgau added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 20, 2026
@GuillaumeGomez
GuillaumeGomez force-pushed the unescaped_pipe_in_table_cell branch from 045f5a3 to 6fd9b1b Compare July 21, 2026 12:16
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Applied comments.

@Urgau Urgau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks good to me.

View changes since this review

@Urgau Urgau added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 21, 2026
@Urgau

This comment was marked as outdated.

@rust-rfcbot

This comment was marked as resolved.

@Urgau

Urgau commented Jul 21, 2026

Copy link
Copy Markdown
Member

2nd try. Let's do an FCP.

unescaped_pipe_in_table_cell details

unescaped_pipe_in_table_cell

This lint is warn-by-default. It detects unescaped pipes (|) in table rows which
lead to some row cells being ignored. For example:

//! | col1 |
//! | ---- |
//! | `code_with(|arg| arg)` |

Which will give:

error: table row has too many columns
  --> $DIR/unescaped_pipe_in_table_cell.rs:5:18
   |
5  | //! | `code_with(|arg| arg)` |
   |                  ^ help: any content after this column divider is discarded
   |
   = help: to escape `|` characters in tables, add a `\` before them like `\|`
note: the lint level is defined here
  --> $DIR/unescaped_pipe_in_table_cell.rs:1:9
   |
1  | #![deny(rustdoc::unescaped_pipe_in_table_cell)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@rfcbot merge rustdoc-internals

@rust-rfcbot

rust-rfcbot commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

@Urgau has proposed to merge this. The next step is review by the rest of the tagged team members:

Concerns:

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jul 21, 2026
@Urgau Urgau added S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 21, 2026
```rust
//! | col1 |
//! | ---- |
//! | `code_with(|arg| arg)` |

@camelid camelid Jul 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow TIL that this is how GFM works. Very strange design...

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was super confused as well.

Comment thread src/librustdoc/passes/lint/table_pipe_escape.rs Outdated
Comment thread tests/rustdoc-ui/lints/invalid_markdown_table.rs
Comment thread tests/rustdoc-ui/lints/unescaped_pipe_in_table_cell.rs Outdated
@notriddle

Copy link
Copy Markdown
Contributor

Minor nits about the implementation, but massive approval for the lint in concept!

@camelid

camelid commented Jul 23, 2026

Copy link
Copy Markdown
Member

Definitely in favor of the lint itself, but I wonder if we should have a more generic lint name and then we group together this and any related (current or future) lints about Markdown gotchas? E.g. we have rustdoc::invalid_html_tags that groups together anything related to that, including (soon: #158709) issues when HTML is interleaved with Markdown.

For example, it could be rustdoc::invalid_markdown, or rustdoc::markdown_gotchas, or a Better Name (TM). I could even imagine us renaming rustdoc::invalid_html_tags to something more general like rustdoc::invalid_markdown and including this as part of it.

On a related note, my feeling with #158709 is that additions of new cases to an existing warn-by-default lint do not require FCP since they are not part of stability guarantees, but please let me know if you disagree.

@camelid

camelid commented Jul 23, 2026

Copy link
Copy Markdown
Member

@rfcbot reviewed
@rfcbot concern overly specific lint name

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

@camelid: Very fair point. I think having a lint group for all such lints is a good idea. As for the current lint name, I'll rename it as invalid_markdown_table.

@GuillaumeGomez
GuillaumeGomez force-pushed the unescaped_pipe_in_table_cell branch from 6fd9b1b to 52c8615 Compare July 24, 2026 15:59
@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@GuillaumeGomez
GuillaumeGomez force-pushed the unescaped_pipe_in_table_cell branch from 52c8615 to a88e74a Compare July 24, 2026 16:00
@rust-bors rust-bors Bot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 24, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 24, 2026
…able_cell, r=Urgau,notriddle,camelid

Add new `invalid_markdown_table` rustdoc lint

Fixes rust-lang#159186.

r? @Urgau
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 24, 2026
…able_cell, r=Urgau,notriddle,camelid

Add new `invalid_markdown_table` rustdoc lint

Fixes rust-lang#159186.

r? @Urgau
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 24, 2026
…able_cell, r=Urgau,notriddle,camelid

Add new `invalid_markdown_table` rustdoc lint

Fixes rust-lang#159186.

r? @Urgau
rust-bors Bot pushed a commit that referenced this pull request Aug 24, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #155499 (stabilize never type)
 - #161294 (add crashtests [6/N])
 - #161050 (Only use dlltool.exe on MinGW if -Cdlltool is passed)
 - #159583 (Add new `invalid_markdown_table` rustdoc lint)
 - #161098 (PassWrapper: handle LLVM 24 change in function types)
 - #161661 (Don't treat slashes as path seps after drive letters in verbatim paths)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 24, 2026
…able_cell, r=Urgau,notriddle,camelid

Add new `invalid_markdown_table` rustdoc lint

Fixes rust-lang#159186.

r? @Urgau
rust-bors Bot pushed a commit that referenced this pull request Aug 24, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #161294 (add crashtests [6/N])
 - #161050 (Only use dlltool.exe on MinGW if -Cdlltool is passed)
 - #159583 (Add new `invalid_markdown_table` rustdoc lint)
 - #161098 (PassWrapper: handle LLVM 24 change in function types)
 - #161661 (Don't treat slashes as path seps after drive letters in verbatim paths)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 24, 2026
…able_cell, r=Urgau,notriddle,camelid

Add new `invalid_markdown_table` rustdoc lint

Fixes rust-lang#159186.

r? @Urgau
rust-bors Bot pushed a commit that referenced this pull request Aug 24, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #155499 (stabilize never type)
 - #161294 (add crashtests [6/N])
 - #161050 (Only use dlltool.exe on MinGW if -Cdlltool is passed)
 - #159583 (Add new `invalid_markdown_table` rustdoc lint)
 - #161098 (PassWrapper: handle LLVM 24 change in function types)
 - #161661 (Don't treat slashes as path seps after drive letters in verbatim paths)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 24, 2026
…able_cell, r=Urgau,notriddle,camelid

Add new `invalid_markdown_table` rustdoc lint

Fixes rust-lang#159186.

r? @Urgau
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 24, 2026
…able_cell, r=Urgau,notriddle,camelid

Add new `invalid_markdown_table` rustdoc lint

Fixes rust-lang#159186.

r? @Urgau
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 24, 2026
…able_cell, r=Urgau,notriddle,camelid

Add new `invalid_markdown_table` rustdoc lint

Fixes rust-lang#159186.

r? @Urgau
rust-bors Bot pushed a commit that referenced this pull request Aug 24, 2026
Rollup of 9 pull requests

Successful merges:

 - #161689 (bootstrap: don't LTO C dependencies on aarch64)
 - #161553 (rustdoc: fix issue preventing "read more" links from generating.)
 - #161670 (Pass LargeDataThreshold to LLVM module IR)
 - #146529 (rustdoc: Nuke `--passes=list` and defossilize the passes infrastructure)
 - #156009 (Check `redundant_explicit_links` against generated URLs)
 - #159583 (Add new `invalid_markdown_table` rustdoc lint)
 - #161098 (PassWrapper: handle LLVM 24 change in function types)
 - #161641 (Check for missing rustfmt in the stdarch intrinsic test step sooner)
 - #161661 (Don't treat slashes as path seps after drive letters in verbatim paths)

Failed merges:

 - #156749 (remove `box_patterns`)
@rust-bors
rust-bors Bot merged commit 3e5db1a into rust-lang:main Aug 25, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Aug 25, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 25, 2026
Rollup merge of #159583 - GuillaumeGomez:unescaped_pipe_in_table_cell, r=Urgau,notriddle,camelid

Add new `invalid_markdown_table` rustdoc lint

Fixes #159186.

r? @Urgau
@rust-timer

Copy link
Copy Markdown
Collaborator

Note

This PR was benchmarked as part of triage of its containing rollup: triage URL.

Finished benchmarking commit (ff4bc60): comparison URL.

Overall result: ❌ regressions - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.6%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.5%, 0.6%] 2

Max RSS (memory usage)

Results (primary 7.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
7.8% [7.8%, 7.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 7.8% [7.8%, 7.8%] 1

Cycles

Results (primary -2.9%, secondary -2.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.9% [-2.9%, -2.9%] 1
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) -2.9% [-2.9%, -2.9%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 471.419s -> 469.832s (-0.34%)
Artifact size: 400.34 MiB -> 400.27 MiB (-0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Aug 25, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

Caused the perf regression in the rollup.
This does more work because it's a new lint, and the regression is quite minor, so we probably just have to accept this
@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Aug 25, 2026
@GuillaumeGomez
GuillaumeGomez deleted the unescaped_pipe_in_table_cell branch August 25, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown tables can silently discard content containing |

10 participants