-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-frontendArea: Compiler frontend (errors, parsing and HIR)Area: Compiler frontend (errors, parsing and HIR)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Milestone
Description
[cfg_attr] is a theoretical tag for conditional use of an attribute based on target.
For example:
#[cfg_attr(target_os="macos", foo, bar(a, b), ...)]
#[cfg_attr(target_os="linux", baz(c, d), qux, ...)]
On OS X this expands to
#[foo]
#[bar(a,b)]
On Linux is expands to
#[baz(c,d)]
#[bar]
This would probably be eventually replaced by a more powerful meta-item system. I'm thinking along the lines of cmake?
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-frontendArea: Compiler frontend (errors, parsing and HIR)Area: Compiler frontend (errors, parsing and HIR)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.