Repository navigation
Description
doc/h2_mux_internals.md quotes field-access syntax that no longer compiles. The H2 sans-io
extraction series made those fields private to their new modules, and this document was not swept.
Confirmed at 595920e91c4528f0554410b904b45d543c88e467:
self.encoder,self.decoder,self.converter_buf,self.lowercase_bufat several sites — all
private tohpack_state.rssince refactor(mux-h2): move the HPACK coders and scratch buffers into hpack_state #1403, reached through accessors. Written as shown, each would
fail withE0609.
Correction: the drain example in the original report was wrong
The first version of this issue also claimed self.drain.draining = true; was broken, with
draining private to h2_drain.rs. That is not true on main, and it was my error. At
595920e9:
pub drain: H2DrainState—lib/src/protocol/mux/h2.rs:1721pub draining: bool—lib/src/protocol/mux/h2.rs:1643- the assignment itself compiles and appears at
h2.rs:4803,h2.rs:4885,h2.rs:6195and
lib/src/protocol/mux/mod.rs:2631 lib/src/protocol/mux/h2_drain.rsdoes not exist onmain
No E0616 is possible there. That example describes the unmerged refactor/h2-goaway-drain branch
(#1425), not main. The HPACK half above is real and is the defect this issue is about.
The correction does not weaken the point — it sharpens it. I wrote a false claim about private
fields in the issue reporting false claims about private fields, and nothing caught it either.
Why this survives every gate
check_doc_citations.py has three rules. Rule 1 proves a cited line is non-blank and in range. The
drift rule compares text at (path, spans) pairs that existed at the base. The third checks cited
test names resolve to a real fn.
None of them inspects the code quoted in the prose. So a document can carry a correct line
number beside a snippet that is two refactors out of date, and every check passes.
This is a distinct failure from a drifted citation, and arguably worse: a wrong line number
eventually lands somewhere obviously irrelevant and gets noticed, while stale syntax next to a
resolving citation reads as authoritative. A reader copying it gets a compile error and assumes
they made the mistake.
Worth distinguishing when fixing
Several passages look identical to the defect and are correct:
- Prose that deliberately shows unreachable syntax to prove a point — "
self.streams.remove(...)
cannot even be written fromh2.rs; it fails withE0609" — is right and must stay. - Code blocks reproducing a method from inside its own module's
impl, whereselfis that type
and the fields are its own, are right. - A field of the same name on a different type —
Context.streamsis aVec<Stream>onContext,
untouched by any extraction — is right.
Only genuine ConnectionH2-side access to a now-private field is wrong.
A durable fix rather than a sweep
Sweeping fixes today's instances and does nothing about the next four extraction steps. The question
is whether the citation checker can close the class.
Measured on this tree: the guarded surface holds 215 fenced blocks, 27 of them Rust. Whole-tree
literal matching locates 7 of the 27 — the other 20 are deliberately abbreviated, composite or
simplified, so a rule comparing all of them fires on 20 of 27 and gets silenced. Only 4 of the 27
carry a file.rs:NNN citation in their prose, and none of those are in this file. rustdoc
doctests cannot substitute: a doctest compiles as a separate crate against the public API, and every
snippet at issue reads a private field of a private type inside impl ConnectionH2.
So the rule that closes it is opt-in: a fenced block names the lines it quotes in its info string,
and the checker compares them. Zero false positives by construction, and the annotation is an
ordinary citation, so a pinned block is range-checked by rule 1 immediately and drift-checked by
rule 2 from the next commit onward.
Two limits, both worth stating up front:
- A pin guards the quote, not the claim beside it. The review of the fix found five wrong
explanations sitting next to blocks the checker was certifying byte-exact. - Opt-in means a quote nobody pins is a quote nobody checks; this rule would not have caught the
four blocks above on its own.
What I verified, and what I did not
Verified by reading at 595920e9: the quoted syntax in doc/h2_mux_internals.md, and the private
declarations of the HPACK coder and scratch fields in hpack_state.rs.
Not verified originally: I did not compile the snippets, nor audit every other document under
doc/ for the same shape — which is exactly how the incorrect drain example above got in.
Activity
docs(mux-h2): sweep stale code quotes and pin them to their source
docs(mux-h2): sweep stale code quotes and pin them to their source
docs(mux-h2): sweep stale code quotes and pin them to their source
docs(mux-h2): sweep stale code quotes and pin them to their source
docs(mux-h2): sweep stale code quotes, pin them to their source, and …