Skip to content

Sema: importing std.fs into a compiler module makes ComptimeEval's unsafe { strerror(code) } an "unsafe block contains no unsafe operations" error #1695

Closed

Description

@ehartford

Found while adding src/Uat.w (#1659). With use std.fs in the new module, with check src/main.w reports:

error: unsafe block contains no unsafe operations
 --> src/ComptimeEval.w:538:16
538 |     let text = unsafe { strerror(code) }

(and the same at src/compiler/LlvmBridge.w:469). Both lib/std/fs.w:10 and src/ComptimeEval.w:24 declare extern fn strerror(errnum: i32) -> *mut i8 — identical signatures — yet a second module importing the stdlib declaration changes how ComptimeEval's own call is classified (raw → safe), so an unsafe block that was required becomes an error. Extern declarations appear to be unified by name across modules with the first-seen classification winning, or std.fs's import path marks the symbol as covered by a facade. Removing use std.fs (using the with_fs_* seams directly) restores the check. Repro: add use std.fs to any compiler module and with check src/main.w.

Activity

  1. ehartford commented on Sep 26, 2026

    @ehartford
    ContributorAuthor

    Fixed on main by #1705 (db89bc5): an extern call is classified by the calling module's own declaration; pinned in both import orders.

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