Skip to content

Allow std/fs, std/process and std/time without the standard runtime - #33

Merged
S42yt merged 1 commit into
masterfrom
fix/no-std-modules
Oct 7, 2026
Merged

S42yt merged 1 commit into
masterfrom
fix/no-std-modules

Conversation

@S42yt

@S42yt S42yt commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

Since #32, the functions that work without the standard runtime live in std modules:

  • readFile, writeFile, appendFile, fileExists in std/fs
  • args, env, exit, panic in std/process
  • now, nowMs, millis, clock, sleep in std/time

The no-std check reported any import of those modules as needing the standard runtime, because Files, Process and Time need it. So a std = false program could no longer call readFile or exit.

Fix

  • Tracking imports: the checker records which imports a module actually resolves names through (import_uses, filled by visible()).
  • Modules that also hold such functions: for std/fs, std/process, std/time and the others that have them, an import is reported only when the program uses something from the module that needs the runtime, like Files.list.
  • Runtime-only modules: std/http and std/date hold nothing usable without the runtime, so importing them is still reported as before.
  • Docs: docs/tooling/no-std.mdx says which module each function comes from and which parts need the runtime.

Tests

The no-std project test now also checks two things:

  • A std = false project using readFile, writeFile, args, nowMs and exit through their imports checks, builds, and runs with the expected output and exit code.
  • Using Files.list from std/fs still reports "std/fs needs the standard runtime".

fmt, clippy and the full suite pass.

🤖 Generated with Claude Code


Generated by Claude Code

Since readFile, exit, now and the other functions that work without the
standard runtime moved into these modules, importing them for those functions
must not be an error. An import of such a module is now reported only when the
program uses something from it that needs the runtime, like Files, Process or
Time. Modules with nothing usable without the runtime, like std/http, are
still reported when imported.
@S42yt
S42yt merged commit e9b3208 into master Oct 7, 2026
1 check passed
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