Repository navigation
Description
Tests: no std coverage (§18)
Summary
§18.7's "what you keep (core)" table promises a large language surface under --no-std/std = false — traits, slices, tuples, ranges, math, bitwise, pointers, comptime, c_import, ownership, unsafe, comptime if — and almost none of it has tests in freestanding mode. The std = false manifest path is parsed but untested entirely. This issue builds the positive core-surface matrix plus the manifest-driven test; the negative gating tests for the known leak paths belong to #458 and are cross-referenced, not duplicated.
Spec
§18.7 (docs/with-specification.md:9978-10123): core-tier table (:9996-10019), tier table (:10094-10100), manifest forms (:9982-9994):
[package]
name = "my-firmware"
std = falseor with build --no-std ....
Requirement IDs: 18.7.1.2 (std = false in with.toml), 18.7.1.7 (traits), 18.7.1.9 (slices), 18.7.1.11 (tuples), 18.7.1.12 (ranges), 18.7.1.13 (math/min/max/abs), 18.7.1.14 (bitwise), 18.7.1.15 (pointers), 18.7.1.16 (comptime), 18.7.1.17 (c_import), 18.7.1.18 (ownership), 18.7.1.21 (unsafe blocks), 18.7.1.22 (comptime if).
Current state
- Existing coverage (all there is):
- test/spec/spec_ss18_7_freestanding_mode.w — check-only smoke: primitives, Option, fixed array,
&strliteral,@[panic_handler]/@[entry]. - test/behavior/behav_no_std_core_prelude.w, behav_no_std_alloc_prelude.w — prelude tiers.
- test/compile_errors/err_no_std_{print_requires_std, vec_requires_alloc, owned_str_requires_alloc, regex_requires_std, missing_panic_handler, missing_entry, alloc_requires_global_allocator}.w — negative gating that exists today.
- test/spec/spec_ss18_7_freestanding_mode.w — check-only smoke: primitives, Option, fixed array,
- Campaign survey (g13): manifest
std=falseparsed (project_config_apply_entry, src/compiler/ProjectConfig.w:120-126) but untested; core traits/slices/tuples/ranges untested under no-std;min/absverified live only. - Gating mechanics for orientation:
Sema.no_std(src/Sema.w:541),core_without_alloc(Sema.w:705-710),symbol_requires_alloc_tier/symbol_requires_std_tier(Sema.w:712-728) enforced at type resolution (SemaCheck.w:265-310); async gate keys onruntime_available(SemaCheck.w:30-33), notno_std; structural requirements invalidate_no_std_requirements(SemaCheck.w:511-549). - Known leaks (verified live during enrichment, with v0.14.0) — these are Bug: no_std gating leaks (builtin Vec/HashMap/async/std.io compile under --no-std) (§18.7) #458's scope, listed here so this issue's tests don't mask them:
var v = Vec.new(); v.push(1)passeswith check --no-std(gating is type-annotation-based; inference/intrinsic construction bypasses it).use std.ioresolves and compiles under--no-std(embedded stdlib resolution has no tier filter: src/Resolve.w:952-971 →embedded_std_resolve_pathunconditionally).- async compiles under
--no-stdwhenruntime_availabledefaults true.
Negative tests asserting these fail must land with Bug: no_std gating leaks (builtin Vec/HashMap/async/std.io compile under --no-std) (§18.7) #458's fix; writing them now would just be red tests. This issue covers the positive matrix + manifest test, and Bug: no_std gating leaks (builtin Vec/HashMap/async/std.io compile under --no-std) (§18.7) #458's test list should be cross-checked against this one when both land.
Implementation plan
- Positive core-surface spec tests, one file per table row,
//! check-only+//! args: --no-std, each with the standard freestanding skeleton (@[panic_handler] fn on_panic -> Never: unreachable()+@[entry] fn start -> i32, pattern: test/spec/spec_ss18_7_freestanding_mode.w):- spec_ss18_7_core_traits.w — derive/impl
Eq,Ord,Hash,Debug,Default,Copy,Cloneon a struct; aDropimpl whose drop is statically injected (18.7.1.7). - spec_ss18_7_core_slices.w —
&[T]views over[T; N], indexing, iteration,.len()(18.7.1.9). - spec_ss18_7_core_tuples.w — construction, destructuring, nested (18.7.1.11).
- spec_ss18_7_core_ranges.w —
0..10,0..=10, for-loop iteration, bounds (18.7.1.12). - spec_ss18_7_core_math.w — int/float arithmetic,
min,max,abs(18.7.1.13). - spec_ss18_7_core_bitwise.w —
band/bor/bxor/shl/shr/bnot(or operator forms) across i8..u64 (18.7.1.14). - spec_ss18_7_core_pointers.w —
*T/*mut T, safe address arithmetic/comparison, unsafe deref/conversion per §16.11 (18.7.1.15, 18.7.1.21 — unsafe block usage here covers both). - spec_ss18_7_core_comptime.w —
comptimeeval,const, andcomptime ifbranch selection (18.7.1.16, 18.7.1.22). - spec_ss18_7_core_ownership.w — moves, borrows, explicit
dropof a Drop type (18.7.1.18). - spec_ss18_7_core_c_import.w —
c_importof a tiny local header (declaration-only use so it stays check-only/hermetic) (18.7.1.17).
Where runtime execution adds value (math, bitwise, ranges), add an//! expect-exit: 0variant if freestanding binaries are runnable on the host with@[entry]; if they are not, keep check-only and note why in the file header.
- spec_ss18_7_core_traits.w — derive/impl
- Manifest test (18.7.1.2) — needs a project dir, so it goes in a build/selfhost.w action (pattern: run_cli_selfhost_one_liner_action, build/selfhost.w:409): write a project with
with.tomlcontainingstd = falseand a source usingprint→with buildfails with the std-tier diagnostic (same one err_no_std_print_requires_std.w asserts under the flag); variant withstd = false+alloc = true+@[global_allocator]→ Vec-typed code builds. This proves manifest keys drive the same gating as--no-std/--allocflags. - Alloc-tier positive: spec_ss18_7_alloc_tier.w (
//! args: --no-std --alloc) —Vec,String,HashMapusable with@[global_allocator]present (extends behav_no_std_alloc_prelude.w to the spec's promised type list). - Update test/coverage_matrix.md / coverage_manifest.txt if those manifests enumerate spec sections.
Test plan
The files above are the deliverable. Directive conventions: //! check-only, //! args: --no-std [--alloc], //! expect-check-fail: for any negative twin, //! expect-exit/expect-stdout for runnable variants. Each file names its requirement ID(s) in the header comment.
Acceptance criteria
- Every requirement ID listed above is exercised by a named test file (or the build/selfhost.w manifest case).
- All new tests pass; none of them encodes leak behavior from Bug: no_std gating leaks (builtin Vec/HashMap/async/std.io compile under --no-std) (§18.7) #458 as expected-pass for gating-relevant negatives.
- Manifest
std = false/alloc = trueproven equivalent to the CLI flags. -
with build && with build :fixpoint && with build :testpass.
Dependencies
#458 (no_std gating leaks) owns the negative tests for Vec-via-inference / use std.* / async under no_std — coordinate so the two test sets compose without overlap. Related: #457 (FixedString core-tier tests), #475 (Box gating), #519 (prelude shadowing tests), #425 (freestanding targets eventually need --target).
Traceability
From the requirements campaign (docs/requirements.md, spec v7.1). Affected requirement IDs: 18.7.1.11, 18.7.1.12, 18.7.1.13, 18.7.1.14, 18.7.1.15, 18.7.1.16, 18.7.1.17, 18.7.1.18, 18.7.1.2, 18.7.1.21, 18.7.1.22, 18.7.1.7, 18.7.1.9.
Activity
ehartford commentedon Jul 3, 2026
Closing the core-language surface: under --no-std, tuples/ranges/bitwise+arithmetic operators/traits/derive (spec_ss18_7_core_language) and raw pointers+slices (spec_ss18_7_core_pointers_slices) pinned (3628d82), freestanding @[panic_handler]+@[entry]. IMPORTANT: fixtures use OPERATORS only — min/max/abs are std.math (not core prelude), so a core fixture using them would encode the #458 tier-leak as expected-pass. Residual: manifest std=false equivalence (18.7.1.2) needs a with.toml project build, not a .w — separate deliverable. §18.7.
test: coverage-sweep batch 5 (#485 #486 #487 #500 #505 #510)