Skip to content

'module' declaration at top of file causes segfault or misleading error #5

Closed

Description

@ehartford

Current behavior

module crux.core

pub fn add(a: i32, b: i32) -> i32:
    a + b

with check produces either:

  • Segfault (exit code 139, no output), or
  • error: expected identifier pointing at a blank line

Both are useless. The user has no way to know that module declarations are not supported (or are buggy).

Expected behavior

Option A (if module is not a supported keyword):

error: unknown declaration kind 'module'
 --> lib/crux/core.w:1:1
1 | module crux.core
  | ^^^^^^
  = help: module identity is determined by file path. Remove this line.

Option B (if module is intended to work): fix the segfault.

A segfault is never an acceptable response to any input.

Repro

mkdir -p /tmp/wbug/lib/demo
printf "module demo.math\n\npub fn add(a: i32, b: i32) -> i32: a + b\n" > /tmp/wbug/lib/demo/math.w
printf "use demo.math\nfn main: let x = add(1, 2)\n" > /tmp/wbug/main.w
cd /tmp/wbug && with check lib/demo/math.w
# exit code 139 (SIGSEGV) or misleading error

Activity

  1. added
    error-messages
    crash
    on Mar 20, 2026
  2. ehartford commented on Mar 20, 2026

    @ehartford
    ContributorAuthor

    Verified on current main: a top-level module demo.math declaration no longer segfaults or emits the misleading blank-line diagnostic. The repro module checks and imports successfully now, so this issue is stale.

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

    crasherror-messages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions