Skip to content

#2987: hand-audit spec examples (batch 1: §§1–3, 5–8, 10, 12, 14–15, 17, 19–24, 29, channels) - #3043

Merged
ehartford merged 1 commit into
mainfrom
spec-audit-1
Nov 5, 2026
Merged

ehartford merged 1 commit into
mainfrom
spec-audit-1

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Part of #2987 (docs-only: fenced code examples only, zero normative prose edits).

Every fenced block across 19 chapters and 3 stdlib sections was pasted and checked/run against ~/.local/bin/with (8e7093ad8):

Updated fenced examples (under settled rulings)

  • 002_ownership.md: replace List.new() move examples in §2.2 with open_conn() (under D120 List is a CoW value, as §2.3 states); replace reserved keyword gen in §2.3 (§29.11); update FileWrapper (String → str, move fn drop()); add required : body introducers on defer: / errdefer: (§29.13) and f"..." prefix (§15.4).
  • 003_borrowing.md: replace nonexistent .as_view() / .to_upper_view() / .to_string() and String in §3.4 with &user.name, Option[StrView] propagation (explicit StrView binding under D179), and str materialization; mut fn update() in §3.8.
  • 005_ephemeral.md: replace nonexistent Bytes / .view() in §5.4 with List[u8] slice view &[u8].
  • 007_with-scoped-access.md: add missing f prefix on f"{name} ({user.role})" in §7.3.
  • 010_errors.md: drop trailing Ok(config) ceremony (§4.9), fs.read_to_string → read_file, add f prefix in .with_context(...), update s.parse_int() → s.parse() (D165; closure return demand tracked in Sema (§10.7, D165): List.traverse does not propagate expected Option[List[U]] / Result[List[U], E] return demand into its closure #3042).
  • 012_closures.md: replace nonexistent List.from(...) and CoW List move examples in §12.4 with resource open_conn() (D93, D120).
  • 014_concurrency.md & stdlib/channels.md: add f prefix on f"/users/{id}", drop stale .await on tx.send(...) / rx.recv() (§14.3 Invariant 5, §14.15 D10), cancel(task) → task.cancel(), replace reserved keyword use(value) (§29.11), drop Ok(...) wrapper in §14.8, runtime:: → runtime. (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 item 4), Atomic { val: 0 } (private field under D100) → Atomic.new(0).
  • 017_metaprogramming.md: String → str in §17.3, f"..." in comptime_error in §17.5.
  • 019_safety.md: &raw x → &raw const x and reserved use(p) → inspect(p) in §19.3.
  • 021_borrow-checker-rules.md: String.from / .as_str() → str / &str in Rule 6; use a Drop type Holder in Rule 7 (List[&i32] does not access its &i32 elements on drop; Holder triggers the exact §21.1 Rule 7 error); replace reserved use(...) in Rule 9.

Surfaced compiler/stdlib gaps & prose errata (filed separately per #2987's 3-way rule)

Verification

  • Docs-only (docs/spec/ only): ~/.local/bin/with build :spec-inventory-check --no-deps → survey: all targets green.

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.

1 participant