Repository navigation
Allow std/fs, std/process and std/time without the standard runtime - #33
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since #32, the functions that work without the standard runtime live in std modules:
readFile,writeFile,appendFile,fileExistsinstd/fsargs,env,exit,panicinstd/processnow,nowMs,millis,clock,sleepinstd/timeThe no-std check reported any import of those modules as needing the standard runtime, because
Files,ProcessandTimeneed it. So astd = falseprogram could no longer callreadFileorexit.Fix
import_uses, filled byvisible()).std/fs,std/process,std/timeand the others that have them, an import is reported only when the program uses something from the module that needs the runtime, likeFiles.list.std/httpandstd/datehold nothing usable without the runtime, so importing them is still reported as before.docs/tooling/no-std.mdxsays which module each function comes from and which parts need the runtime.Tests
The no-std project test now also checks two things:
std = falseproject usingreadFile,writeFile,args,nowMsandexitthrough their imports checks, builds, and runs with the expected output and exit code.Files.listfromstd/fsstill reports "std/fsneeds the standard runtime".fmt, clippy and the full suite pass.
🤖 Generated with Claude Code
Generated by Claude Code