Skip to content

Allow overriding lang-items from different crates #7901

Closed
@huonw

Description

@huonw

Building on the new optional lang items, this would, for example, allow someone to substitute a new version of malloc (e.g. because they want to count the number of allocations, or have a specialised, high-performance implementation).

Only allowing it cross crate would mean there wouldn't be any confusion about which takes precedence in:

mod foo { #[lang="exchange_malloc"] fn foo_malloc() { } }
mod bar { #[lang="exchange_malloc"] fn bar_malloc() { } }

This possibly couldn't work at all, because the other crates have had the original lang-item compiled into the appropriate places.

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