Open
Description
Provides a native way to easily manage multiple conditional flags without having to rewrite each clause multiple times.
Public API
cfg_match! {
unix => {
fn foo() { /* unix specific functionality */ }
}
target_pointer_width = "32" => {
fn foo() { /* non-unix, 32-bit functionality */ }
}
_ => {
fn foo() { /* fallback implementation */ }
}
}
Steps / History
- Implementation (Add the
cfg_match!
macro #115416) - Final comment period
- Stabilization PR
Unresolved Questions
What should the final syntax be? A match-like syntax feels more natural in the sense that each macro fragment resembles an arm.Should the macro be supported directly by a language feature?What should the feature name be?cfg_match
conflicts with the already existingcfg_match
crate.How can we support usage in both expression-position and item position?- Support trailing commas to have similar grammar as
match
statements.
References
Metadata
Metadata
Assignees
Labels
Category: An issue tracking the progress of sth. like the implementation of an RFCNominated for discussion during a lang team meeting.Nominated for discussion during a libs-api team meeting.Relevant to the library API team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.