Skip to content

comptime evaluator: std.string parse/string_to_int reaches extern with_parse_i64_ref and is not comptime-callable #2460

Closed

Description

@ehartford

Found by the SDK rebuild (run 39152082294, windows-x86_64 job 117747635584):

error: action target 'sdk-windows-libc' failed during comptime evaluation: <embedded-std>/std/string.w:6:1: 'with_parse_i64_ref' has no With body to evaluate at compile time (an extern or a runtime intrinsic); reached through run_sdk_windows_libc_action -> sdk_compile_all -> par_run -> parse -> string_to_int

build/par.w:60 calls std.string's parse on WITH_BUILD_JOBSERVER_SLOTS. On hosts where build actions run in the comptime evaluator, any std helper backed by an extern is unreachable. rt_core's with_parse_i64_ref is a pure digit loop (rt/rt_core.w:3131), so parse is comptime-able in principle: either the evaluator should be able to evaluate it (its string/memory model), or std.string's parse should be a With digit loop over the &str view instead of an extern call (parse_u128_magnitude already is one, lib/std/string.w:435).

Near-term workaround landing separately: build/par.w parses digits locally. This issue is the root: a build-layer author cannot tell which std calls are evaluator-safe. Cousin of #2220 (comptime allocator).

Activity

  1. ehartford commented on Oct 19, 2026

    @ehartford
    ContributorAuthor

    Second instance, same path: SDK run 39171886271's Windows jobs got past parse (#2461) and failed at par_slot_acquire -> pid -> with_getpid, same refusal. #2462 fixes the par.w chain at its owners: string_to_int becomes a With body (parse evaluable everywhere, not just tool mode), tool mode's allowed runtime calls gain with_getpid/with_fs_symlink/with_fs_remove_file (the evaluator is the build process; the jobserver slot pair is driver state), and par_lane_critical reads through ToolFs. The general question - a build author cannot tell which std helpers are evaluator-safe - remains this issue's.

  2. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): does not reproduce; f081060 (#2462) gave parse a With body.

    $ cat main.w
    use std.string
    const N: i32 = parse("12")
    fn main: print(N + 1)
    $ with run main.w
    13
    
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions