Skip to content

Compiler panic in codegen: internal error: entered unreachable code on empty-tuple destructure of a void builtin call #1877

@jubnzv

Description

@jubnzv

The compiler panics with internal error: entered unreachable code in src/codegen/expression.rs:3813 (emit_function_call's catch-all arm) when an empty tuple destructure () = builtin(...) is lowered with a void-returning builtin (e.g. print) on the RHS.

MRE:

contract C {
    function f() public {
        () = print("x");
    }
}

Reproduce: save as mre.sol, run solang compile --target polkadot mre.sol.

Output:

thread 'main' panicked at src/codegen/expression.rs:3813:14:
internal error: entered unreachable code
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior: sema rejects the empty-tuple destructure (no values to assign) with a proper diagnostic, instead of letting the malformed assignment reach codegen.

Reproduces on solana, polkadot, evm. The same panic does NOT trigger when the RHS is a user-defined void function (() = g() is rejected cleanly), only when the RHS is a void builtin like print.

Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions