Skip to content

An .await inside a std body (std.time.timeout) made every program importing std.time race-checked: stage2 failed with E0921 on the compiler's own globals #2977

Closed

Description

@ehartford

While adding pub async fn timeout(d: Duration): sleep(d).await to lib/std/time.w (D188, PR #2971), stage2 (stage1 compiling the compiler, which imports std.time through src/Uat.w) failed with dozens of E0921: read of global … may race on resolve_compiler_root_memo, g_vis_explain_* and others. Rewriting the body as with_fiber_sleep_until(…) (no .await) made them disappear. Concurrency evidence (record_global_concurrency_evidence) is recorded at async blocks/scopes, async function references, @[c_export] and C callback coercions, not at .await, so the path by which an uncalled std body's await turned on program-wide race checking is not yet located. A std body the program never calls must not change what the program is checked for; find the path (lldb on record_global_concurrency_evidence with the timeout body restored) and pin it with a fixture: a program that imports a module whose unused async fn awaits, and holds a plain global, compiles clean.

Activity

  1. added
    bug
    on Nov 2, 2026
  2. added a commit that references this issue on Nov 7, 2026
  3. ehartford commented on Nov 7, 2026

    @ehartford
    ContributorAuthor

    Fixed in #3064 (merged as 173ef04): concurrency evidence is kept with the function it was found in and counts only where the program reaches it (roots: top level, main, entry/test/bench/panic handlers, @[c_export], trait impl methods; edges: every resolved call and function value). Pinned by test/behavior/behav_2977_unused_async_import_keeps_single_thread_proof.w with lib/lazy_async_sleeper.w.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions