Skip to content

#[track_caller] on fns in extern "Rust" #70830

Closed
@Centril

Description

Context: #69251 (comment)

Suppose we have:

extern "Rust" {
    #[track_caller]
    fn bar();
}

This currently produces an error, but @eddyb suggested that it could be allowed.
Then comes the question of what this would mean. One way to imagine this is that we'd alter the ABI of fn bar, as we usually do for #[track_caller] functions, to accept an additional parameter for the Location. When calling bar() we'd then propagate the location, again as usual.

However, the place which actually defines fn bar() { ... } would not be aware of the #[track_caller] annotation, so it seems to me that we'd have to insert a shim where the extern "Rust" block resides.

I've opened this issue to seek some clarity on what @eddyb meant as neither me nor @anp fully understood.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.F-track_caller`#![feature(track_caller)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language 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