Skip to content

Windows: INIT_MAIN_THREAD_ID uses wrong ABI #4435

@RalfJung

Description

@RalfJung

This static is registered as a global constructor for Windows binaries:

static INIT_MAIN_THREAD_ID: unsafe fn() = {

That means the function will be invoked by the Windows runtime, so it must have the "C" ABI. The code currently uses the "Rust" ABI, which happens to be the same for fn(), but that's not guaranteed.

(Found by Miri)

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDang, that shouldn't have happenedDS - win32Affects the Win32/Windows backend

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions