Skip to content

"symbol is already defined" when combining track_caller with no_mangle #143162

Open
@Jules-Bertholet

Description

@Jules-Bertholet

I tried this code:

#[unsafe(no_mangle)]
#[track_caller]
pub fn foo() {}

fn main() {
    let _a = foo as fn();
}

I expected to see this happen: I’m not sure, but not what actually happened

Instead, this happened:

error: symbol `foo` is already defined
 --> src/main.rs:3:1
  |
3 | pub fn foo() {}
  | ^^^^^^^^^^^^

Meta

rustc --version:

1.88.0

@rustbot label A-name-mangling A-linkage

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesA-name-manglingArea: name mangling / decorationA-panicArea: Panicking machineryC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions