Skip to content

rustc crash when #[no_mangle] function is declared multiple times with different signatures. #24583

Closed
@pnkfelix

Description

@pnkfelix

(imported from improperly closed bug #18358)

#![allow(dead_code)]

pub mod x {
    #[no_mangle]
    pub fn f() { }
}

pub mod y {
    #[no_mangle]
    pub fn f(_: i32) { }
}

fn main() { }

playpen

This crashes with:

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/include/llvm/Support/Casting.h:237: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::Function; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::Function*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Aborted (core dumped)
playpen: application terminated with error code 134
Program ended.

(I don't know what it does if one compiles about LLVM assertions turned on.)

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