Skip to content

Access target triplet of artifact from proc macros #10714

@bmcpt

Description

@bmcpt

Problem

I'm writing a proc macro that generates code based on the operating system for which the library/executable is being compiled. This macro generates OS specific code for windows/linux/macos/android. Currently there is no way of finding out which operating system we are compiling for (from a proc macro).

Proposed Solution

Some way of accessing the target triplet from a proc macro.

Notes

cfg(target_os="windows") returns true on windows even if compiling for android.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-proc-macroArea: compiling proc-macrosC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions