Skip to content

gen-zig: host_open shim parameter shadows a spec function named path #13660

Closed

Description

@gHashTag

A spec that calls host_open and also splices in a module with a top-level function named path does not compile to Zig. Refs #13650.

Measured 2026-11-14 on the lab: a host spec that imported the block census (which pulls in rust_convert, where fn path is declared) and called host_open was BLOCKED with

spec.zig:10348:20: error: function parameter shadows declaration of 'path'

The emitted shim is fn __t27_host_open(path: [*:0]const u8, mode: i32) i32 (bootstrap/src/compiler.rs, line 7435 on master b339f8a). Zig refuses a parameter that shadows a file-level declaration, so the shim's own parameter name collides with user code. t27c typecheck passes. Workaround used: read stdin and write stdout through std.c instead of host_open.

Expected: shim parameters carry a reserved prefix (for example __t27_path), so no user name can collide with them.

Boundary

  • bootstrap/src/compiler.rs :: fn __t27_host_open

User Scenarios

  • Given a spec that declares fn path and calls host_open, when it is generated to Zig and tested, then it compiles and its tests run.

Requirements

  • FR-001: The host shims MUST NOT use a parameter name a spec can declare at top level.
  • FR-002: The fix MUST come with a spec test that declares fn path, fn mode, fn buf and fn fd next to host calls.

Success Criteria

  • 0 errors from zig on the regression spec, and its lab row reports blocked=0.
  • The lab run of the regression spec ends with exit 0.

Activity

  1. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    Spec created: specs/tri/gen_host_open.t27 (typecheck OK, 1 test passes).

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions