Skip to content

#[no_mangle] on associated functions #1837

Closed
@ghost

Description

This program works with rustc, but not in Miri (playground):

struct AssocFn;

impl AssocFn {
    #[no_mangle]
    fn foo() {}
}

fn main() {
    extern "Rust" {
        fn foo();
    }
    AssocFn::foo();
    unsafe { foo() }
}

(And unlike #[no_mangle] on normal functions, if AsocFn::foo is not used directly, it also does not work with rustc: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f1244afcdd26e2a28445f6e82ca46b50.)

cc #1833 (comment)

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