)]}'
{
  "commit": "6bcb461903746bb3a3be7af93065ddb1cebdede7",
  "tree": "26190fbb761dd3204e6ebb8ed1c183138c43ed0b",
  "parents": [
    "62bc8727c3adadd5b9310dc1515a9f02a07d162e",
    "14d29f9ae2b814bb547cf2b83b847703d2ac359e"
  ],
  "author": {
    "name": "Stuart Cook",
    "email": "Zalathar@users.noreply.github.com",
    "time": "Mon Feb 23 13:31:59 2026 +1100"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Feb 23 13:31:59 2026 +1100"
  },
  "message": "Rollup merge of #149783 - folkertdev:stabilize-cfg-select, r\u003dJonathanBrouwer\n\nstabilize `cfg_select!`\n\n*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/149783)*\n\ntracking issue: https://github.com/rust-lang/rust/issues/115585\ncloses https://github.com/rust-lang/rust/issues/115585\nreference PR:\n\n- https://github.com/rust-lang/reference/pull/2103\n\n# Request for Stabilization\n\n## Summary\n\nThe `cfg_select!` macro picks the expansion corresponding to the first `cfg` condition that evaluates to `true`. It simplifies complex conditional expressions.\n\n```rust\ncfg_select! {\n    unix \u003d\u003e {\n        fn foo() { /* unix specific functionality */ }\n    }\n    target_pointer_width \u003d \"32\" \u003d\u003e {\n        fn foo() { /* non-unix, 32-bit functionality */ }\n    }\n    _ \u003d\u003e {\n        fn foo() { /* fallback implementation */ }\n    }\n}\n\nlet is_unix_str \u003d cfg_select! {\n    unix \u003d\u003e \"unix\",\n    _ \u003d\u003e \"not unix\",\n};\nprintln!(\"{is_unix_str}\");\n```\n## Semantics\n\nThe expansion of a `cfg_select!` call is the right-hand side of the first `cfg` rule that evaluates to true.\n\nThis can be roughly expressed using this macro:\n```rust\nmacro_rules! cfg_select {\n    ({ $($tt:tt)* }) \u003d\u003e {{\n        $crate::cfg_select! { $($tt)* }\n    }};\n    (_ \u003d\u003e { $($output:tt)* }) \u003d\u003e {\n        $($output)*\n    };\n    (\n        $cfg:meta \u003d\u003e $output:tt\n        $($( $rest:tt )+)?\n    ) \u003d\u003e {\n        #[cfg($cfg)]\n        $crate::cfg_select! { _ \u003d\u003e $output }\n        $(\n            #[cfg(not($cfg))]\n            $crate::cfg_select! { $($rest)+ }\n        )?\n    }\n}\n```\n\nThe actual implementation uses a builtin macro so that `cfg_select!` can be used both in item and expression position.\n\n## Documentation\n\nreference PR:\n\n- https://github.com/rust-lang/reference/pull/2103\n\n## Tests\n\nThe `cfg_select!` macro is already used extensively in the rust compiler codebase. It has several dedicated tests:\n\n- [`tests/ui/check-cfg/cfg-select.rs`](https://github.com/rust-lang/rust/blob/main/tests/ui/check-cfg/cfg-select.rs)tests that warnings are emitted when an unexpected `cfg` condition is used.\n- [`tests/ui/macros/cfg_select.rs`](https://github.com/rust-lang/rust/blob/main/tests/ui/macros/cfg_select.rs) tests that `cfg_select!` has the expected expansion, and tests that the expected syntax is accepted.\n## History\n\n- rust-lang/rust#115416\n- rust-lang/rust#117162\n- rust-lang/rust#133720\n- rust-lang/rust#135625\n- rust-lang/rust#137198\n- rust-lang/rust#138993\n- rust-lang/rust#138996\n- rust-lang/rust#143461\n- rust-lang/rust#143941\n- rust-lang/rust#145233\n- rust-lang/rust#148712\n- rust-lang/rust#149380\n- https://github.com/rust-lang/rust/pull/149925\n\n# Resolved questions\n\n# Unresolved questions\n\nThe style team has decided on how to format `cfg_select!`, but this formatting has not yet been implemented. See https://github.com/rust-lang/rust/pull/144323.\n\nr? @traviscross\n\n\u003c!-- TRIAGEBOT_START --\u003e\n\n\u003c!-- TRIAGEBOT_CONCERN-ISSUE_START --\u003e\n\n\u003e [!NOTE]\n\u003e # Concerns (0 active)\n\u003e\n\u003e - ~~[allowing-comma-after-closing-brace](https://github.com/rust-lang/rust/pull/149783#issuecomment-3808533494)~~ resolved in [this comment](https://github.com/rust-lang/rust/pull/149783#issuecomment-3882251672)\n\u003e\n\u003e *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/concern.html) for details.*\n\n\u003c!-- TRIAGEBOT_CONCERN-ISSUE_END --\u003e\n\u003c!-- TRIAGEBOT_END --\u003e\n",
  "tree_diff": []
}
