From f4a03c540408c4180e742ce02d38af8c466c7f80 Mon Sep 17 00:00:00 2001 From: Nils Lehnen <30603423+iderex@users.noreply.github.com> Date: Fri, 18 Sep 2026 02:01:20 +0200 Subject: [PATCH] Stop the crate root counting the types that hold something, and anchor the command that counts the block (#434) The paragraph in `src/lib.rs` about the compile-time thread assertions said "One of them holds something now" and named `measurement::Measurement`. That was a count over the assertion block, and the block held five assertion lines on 2026-08-26 when the sentence landed. It holds 145 at `f38bf7b101550664e06b9b8ee72c4dff5ad8e186`, and nine of the types asserted there are written with a borrowed parameter, so each of them holds a reference in exactly the sense the sentence gives for `Measurement`. The count is deleted rather than corrected, for the reason the next paragraph in the same comment already gives about a count in this file: the next landing moves it again, and nothing here reads a number written into a doc comment. `Measurement` stays as the example and stops being named as the whole set. Nine is recorded as a floor rather than a population, because a type does not need a lifetime to hold a field, and counting the rest needs a reading of every declaration. The command that paragraph hands a reader to derive the list counted the line that hands it over. `git grep -c 'any_thread::<' -- src/lib.rs` matched line 80 of the doc comment as well as the assertions, so it answered 146 against 145, and it answered 15 against 14 on 2026-08-27, the day it arrived. It has been one too many on every reading it has ever had, which is a derivation written to replace a stale count and then never run against the block. It carries `^ ` now: an assertion is indented inside the block and the line quoting the command is not, so the anchor keeps that line out of its own answer. What failure it prevents: a reader sizing what a green build proves about thread safety here. The closing sentence of the paragraph says an assertion over a type holding nothing cannot fail on the bytes in this tree, and it is there so that the day the type holds something is the day the compiler starts judging it. With "one of them" above it, that reads as a block of empty names waiting for a day that has not come. The day has come for at least nine of them, and that half is now stated where the sentence is. What was wrong, and how it was found: two counts in one paragraph, read against the block they are about. Nothing in this tree would have said so - `doc-paths` reads `git ls-files '*.md'` and never opens a Rust file. No assertion, type or field changes. What the compiler judges is what it judged. `cargo build --locked --all-targets` and `cargo test --locked` are green at this commit, and `.github/format/format.sh check`, `.github/lint/lint.sh check`, `.github/doc-paths/doc-paths.sh check` and `.github/invariants/invariants.sh check` each exit 0. `.github/shell-analysis/shell-analysis.sh` was NOT run here: `shellcheck` is not on this machine and the script says so rather than passing. The gate runs that leg. Closes #434 Signed-off-by: Nils Lehnen <30603423+iderex@users.noreply.github.com> --- src/lib.rs | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f93e7ce..f37d37e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,10 +65,24 @@ //! //! What that bound is worth is stated rather than implied, and it has moved. THIS //! PARAGRAPH SAID THE TYPES BELOW HOLD NOTHING, SO NO ASSERTION COULD FAIL ON THE -//! BYTES IN THIS TREE. One of them holds something now: `measurement::Measurement` -//! carries a reference to a client's clock source, a reference to a client's -//! subscriber and a counter, and the assertion on it is what refuses a facility -//! that stopped being safe from any thread. +//! BYTES IN THIS TREE. It stopped being true with `measurement::Measurement`, +//! which carries a reference to a client's clock source, a reference to a +//! client's subscriber and a counter, and the assertion on it is what refuses a +//! facility that stopped being safe from any thread. +//! +//! IT THEN SAID ONE OF THEM HELD SOMETHING AND NAMED THAT ONE, WHICH WAS A COUNT +//! OVER A BLOCK OF FIVE. The block held five assertion lines on 2026-08-26, when +//! that sentence landed, and 145 at +//! `f38bf7b101550664e06b9b8ee72c4dff5ad8e186`. Nine of the types asserted below +//! are written with a borrowed parameter, so each of them holds a reference in +//! exactly the sense this paragraph gives for `Measurement`, and nine is a floor +//! rather than the population, since a type does not need a lifetime to hold a +//! field. The count is deleted rather than corrected, for the reason the +//! paragraph under it already gives about a count here: the next landing moves +//! it again, and nothing in this tree reads a number written into a doc comment. +//! `Measurement` stays as the example it was and is no longer named as the +//! whole set. #434 is where it was found, by reading this paragraph against the +//! block it is about. //! //! THE SENTENCE AFTER IT SAID THE OTHER FOUR STILL HOLD NOTHING, AND IT IS NOT //! REPLACED BY A NEW COUNT. It was written against a list of five and the list @@ -77,13 +91,24 @@ //! same reason this one did, and the list is one command away: //! //! ```text -//! git grep -c 'any_thread::<' -- src/lib.rs +//! git grep -c '^ any_thread::<' -- src/lib.rs //! ``` //! +//! THAT COMMAND CARRIED NO ANCHOR UNTIL THIS EDIT AND COUNTED THE LINE THAT HANDS +//! IT OVER AS ONE OF THE ASSERTIONS. It answered 146 against 145 assertion lines +//! at `f38bf7b101550664e06b9b8ee72c4dff5ad8e186`, and it answered 15 against 14 +//! on 2026-08-27, the day it arrived, so it has been one too many on every +//! reading it has ever had. A derivation written here to replace a count that +//! went stale was itself never run against the block. The anchor is what keeps +//! the line above out of its own answer: an assertion is indented inside the +//! block below and that line is not. +//! //! What the sentence was for is unchanged and does not need the number: an //! assertion over a type holding nothing cannot fail on the bytes in this tree, //! and it is there so that the day the type holds something is the day the -//! compiler starts judging it. +//! compiler starts judging it. THAT DAY HAS COME FOR MORE THAN ONE OF THEM, and +//! it is the half a reader sizing what a green build proves here should not take +//! from the paragraph above: the block is not a list of empty names waiting. #![forbid(unsafe_code)] #![deny(missing_docs)]