Skip to content

Manually test every example in the specification #2987

Closed

Description

@ehartford

Eric (2026-11-02): the spec is human-facing and has no build or test connection; its examples are maintained by hand. This issue is the hand audit: every fenced example in docs/spec/*.md and docs/spec/stdlib/*.md is read and tried with the installed compiler, by a person, and what is wrong is fixed in docs-only PRs. No lane, no tool reading the spec, no marker convention in the text.

Method

For each block: paste it into a file, run with check (and with run where the block is a program), and judge it one of three ways:

  1. Compiles and says what the prose says. Nothing to do.
  2. A fragment by design (let y = x + 1 // if x is u64…, a signature, a desugar). Fine as long as the prose makes clear what it leaves out; otherwise complete it.
  3. Wrong: stale syntax (type Foo = {, |x| body), a name the library no longer has, an example that violates a later ruling. Fix the example under the ruling it illustrates; a spec sentence that is wrong is Spec errata from the 2026-11-02 conformance audit: examples that cannot compile, names that do not exist, and rules that contradict each other #2955's business and gets its own child issue.

Worklist (from a one-off sweep on 2026-11-02 with 018ea96c5; counts are blocks that did not compile as pasted, fragments included)

Chapters: 009_functions 69 of 78 · 004_types 62 of 94 · 016_ffi 40 of 52 · 014_concurrency 40 of 42 · 013_iteration 37 · 018_modules 23 · 011_traits 23 · 017_metaprogramming 17 · 010_errors 17 · 003_borrowing 15 · 007_with-scoped-access 14 · 015_strings 12 · 002_ownership 12 · 029_lexical-and-binding-rules 10 · 019_safety 4 · 012_closures 3 · 008_memory 3 · 005_ephemeral 3.

stdlib: std-math-spec 76 · libstd-spec 44 · regex-spec 32 · perl-compatible-re 10 · collection-operations 6 · regular-expressions 4 · output-functions 4 · channels 4.

The most common diagnostics were undefined variable (fragments), expected expression / expected ':' or '{' to introduce body (stale or pseudo-syntax), drop '=' in struct type declarations (87 blocks of pre-D-era type T = { syntax), use 'enum' for enum declarations, use 'x => body' instead of '|x| body', and unknown type 'User'/'Config'/'IoError' (fragments naming prose types).

Known defects already filed: #2955 and its children (50.millis(), timeout(...), Ok(a + b), String, the §13.6 example under D108).

Done when

Every block in the chapters and stdlib docs has been read and tried by hand, each is (1) or an honest (2), every (3) is fixed or filed, and this issue lists the PRs that did it, chapter by chapter.

Activity

  1. added
    spec-gap
    on Nov 2, 2026
  2. ehartford commented on Nov 2, 2026

    @ehartford
    ContributorAuthor

    Eric (2026-11-02): any problem with an example indicates one or more of three things, and the audit decides which with an open mind:

    1. the example is wrong;
    2. the spec is wrong (the sentence the example illustrates);
    3. the compiler implementation is wrong.

    Never presume it is the example, and never presume it is the compiler, when it may well be the spec itself, or the example, or the compiler. Settle it by running (the code settles facts), then fix the correct problem: an example under its ruling, a spec sentence through a ruling (#2955's class), a compiler defect as a bug with its fixture. The "Method" above is amended by this: a block that does not compile is not filed under "wrong example" until the other two have been ruled out.

  3. added 2 commits that reference this issue on Nov 2, 2026
  4. ehartford commented on Nov 5, 2026

    @ehartford
    ContributorAuthor

    Batch 1 landed in #3043: hand-tested every fenced block across 001_design-goals.md, 002_ownership.md, 003_borrowing.md, 005_ephemeral.md, 006_handles.md, 007_with-scoped-access.md, 008_memory.md, 010_errors.md, 012_closures.md, 014_concurrency.md, 015_strings.md, 017_metaprogramming.md, 019_safety.md, 020_performance.md, 021_borrow-checker-rules.md, 022_ephemeral-rules.md, 023_with-block-semantics.md, 024_async-equivalences.md, 029_lexical-and-binding-rules.md, plus stdlib/channels.md, stdlib/send-sync-scopedsend.md, and stdlib/synchronization-primitives.md. Surfaced and filed compiler/stdlib gaps #3038, #3039, #3041, #3042 and prose errata #3040.

  5. ehartford commented on Nov 5, 2026

    @ehartford
    ContributorAuthor

    Completed the manual example audit across every chapter in docs/spec/*.md and every document in docs/spec/stdlib/*.md:

    Chapter-by-chapter record

    docs/spec/stdlib/ record

    Implementation gaps filed during the audit

  6. added a commit that references this issue on Nov 5, 2026
  7. added a commit that references this issue on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    spec-gap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions