Skip to content

Repair three mangled rustdoc comments and close the guards that missed them - #50

Merged
MikeGrier merged 3 commits into
mainfrom
mikegrier/rustdoc-fence-repair
Aug 29, 2026
Merged

Repair three mangled rustdoc comments and close the guards that missed them#50
MikeGrier merged 3 commits into
mainfrom
mikegrier/rustdoc-fence-repair

Conversation

@MikeGrier

Copy link
Copy Markdown
Owner

Follow-up to #46, found by its Copilot reviews after the merge. Three doc comments in windows-namespace-request-sys had been mangled by a mis-joined edit, and both guards that should have caught it had a hole.

The damage

Each of three items had a sentence welded onto the closing fence of its example, and was missing that same sentence from where it belonged:

item what was left behind
outcome::perform "Use this" -- no object
outcome::perform_handle an entirely empty # Errors section
path::prepare # Errors ending mid-clause at exceeds `MAX_PATH` before

All three are restored to the sentences the fragments reassemble into, and the fences now close on their own line.

What it actually cost

Worth stating precisely, because the obvious guess is wrong. The doctests were not disabled. cargo test --doc -- --list reports the same three tests before and after, at shifted line numbers, and 36 pass either way.

The damage was to the rendered documentation and to the text itself: rustdoc emitted three invalid_rust_codeblocks warnings, the unterminated blocks swallow the prose that follows them, and an empty # Errors section documents nothing however it renders.

Two guards closed

Both existing guards had a hole this fell straight through.

CI denied only the two link lints, so three rustdoc warnings rendered on every run without failing anything. The docs job now also denies rustdoc::invalid_rust_codeblocks, the lint that fires on exactly this. Verified the workspace passes under the stricter flags.

tools/check-encoding.ps1 already refused a glued doc-comment marker -- that check exists because one lived in a doc example for nine review rounds -- but its pattern was anchored to end of line, and this variant welds /// to a fence mid-line. The anchor is removed so /// after any non-space character is caught. It is zero-hit across the clean repository, and sabotage confirms it fires: re-introducing one glued fence flags the file and exits 1.

Also

A separate review finding on the teardown-drain comment in windows-file-watcher: it described recv returning None only at end-of-stream, but the code calls recv_timeout, which also returns None on a timeout -- which is precisely why the loop is followed by an is_disconnected assertion. The comment described a weaker mechanism than the test relies on, making that assertion read as belt-and-braces rather than the step that tells the two None cases apart.

Verification

cargo fmt, cargo clippy --all-targets, cargo doc --workspace under the stricter RUSTDOCFLAGS, the full windows-namespace-request-sys suite (202 + 20 + 11 unit/integration, 36 + 1 doctests), the touched file-watcher test, and both repo guards -- all clean on top of merged main.

Not touched: a pre-existing redundant explicit link target warning at crates/windows-thread-ambient-sys/src/state.rs:333, from commit e7bdc7c and unrelated to this work.

Michael Grier and others added 2 commits August 29, 2026 14:45
…ined edit

`outcome::perform`, `outcome::perform_handle` and `path::prepare` each had a
sentence welded onto the closing fence of their example, and each was missing
that sentence from where it belonged:

  perform        "Use this" with no object; the tail on the fence
  perform_handle an entirely EMPTY `# Errors` section; its body on the fence
  prepare        `# Errors` ending mid-clause at "exceeds `MAX_PATH` before"

All three are restored to the sentences the fragments reassemble into, and the
fences now close on their own line.

What this cost is worth stating precisely, because the obvious guess is wrong.
The doctests were **not** disabled: `cargo test --doc -- --list` reports the same
three tests before and after, at shifted line numbers, and 36 pass either way.
The damage was to the rendered documentation and to the text itself -- rustdoc
emitted three `invalid_rust_codeblocks` warnings, the unterminated blocks swallow
the prose that follows them, and an empty `# Errors` section documents nothing
whatever it renders like.

Two guards close the gap, because the existing ones both had a hole this fell
through.

`cargo doc` in CI denied only the two link lints, so three warnings rendered on
every run without failing anything; the docs job now also denies
`rustdoc::invalid_rust_codeblocks`, which is the lint that fires on exactly this.
Verified the workspace passes under the stricter flags.

`tools/check-encoding.ps1` already refused a glued doc-comment marker -- that
check exists because one lived in a doc example for nine review rounds -- but its
pattern was anchored to end of line, and this variant welds `///` to a fence in
the middle of a line. The anchor is removed so `///` after any non-space
character is caught. It is zero-hit across the clean repository, and sabotage
confirms it fires: re-introducing one glued fence flags the file and exits 1.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The comment on the teardown drain said recv reports None only at end of stream.
The code calls recv_timeout, which also reports None on a timeout -- which is
precisely why the loop is followed by an is_disconnected assertion. The comment
described a weaker mechanism than the one the test actually relies on, and read
as though that assertion were belt-and-braces rather than the step that tells the
two None cases apart.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 29, 2026 18:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes are narrowly scoped doc/guard fixes and the updated rustdoc/guard logic is consistent with the intended failure modes described in the PR.

Pull request overview

Repairs three mangled rustdoc comment blocks in windows-namespace-request-sys and tightens two repository guards (CI rustdoc lints + encoding checker) so the same “glued fence / swallowed prose” failure mode is caught automatically in the future.

Changes:

  • Restore the missing prose and re-close the doctest fences for path::prepare, outcome::perform, and outcome::perform_handle.
  • Update CI rustdoc flags to deny rustdoc::invalid_rust_codeblocks (in addition to intra-doc link lints).
  • Expand tools/check-encoding.ps1’s glued-doc-comment detection to catch mid-line welded /// cases; clarify a watcher teardown-drain comment to match recv_timeout behavior.
File summaries
File Description
tools/check-encoding.ps1 Broadens the “glued doc comment” guard to catch welded /// (including on closing fences).
crates/windows-namespace-request-sys/src/path.rs Fixes the prepare rustdoc # Errors text and ensures the code fence closes cleanly.
crates/windows-namespace-request-sys/src/outcome.rs Fixes two rustdoc blocks (restores missing sentences and re-closes the fences).
crates/windows-file-watcher/src/watcher/tests.rs Updates the teardown-drain comment to accurately describe the recv_timeout + is_disconnected logic.
.github/workflows/ci.yml Makes rustdoc warnings for invalid codeblocks fail CI by denying rustdoc::invalid_rust_codeblocks.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tools/check-encoding.ps1 Outdated
…t regex

`\S///` is the whole condition -- a doc marker touching a non-space character.
The surrounding `^.*` and `.*$` were inherited from the pattern's earlier
end-of-line-anchored form and were left in place when that anchor was removed,
where they are not merely redundant but the expensive part: `^.*` matches to the
end of a line and then backtracks hunting for the marker, on every line of every
file.

Measured on 1.47 MB of this repository's own Rust, a no-match scan -- the case CI
runs on every clean build -- went from 872 ms to 288 ms over 20 passes. The whole
check now completes in 0.83 s across 445 files.

Equivalent, not merely faster. Both damage shapes still match (`let x = 1;///`
and a sentence welded to a closing fence) and both clean shapes still do not, and
sabotage confirms each variant is flagged with the right line number: the match
index still identifies the line, because the marker and the character it is glued
to are on it.

Raised in review of #50.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 29, 2026 18:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes correctly repair the rustdoc damage and close the documented guard gaps without introducing functional or API risk.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@MikeGrier
MikeGrier merged commit 6c59ccd into main Aug 29, 2026
19 checks passed
@MikeGrier
MikeGrier deleted the mikegrier/rustdoc-fence-repair branch August 29, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants