)]}'
{
  "commit": "04e4f95e7eb94b37ed1f9c25bbd16e504bbcaa83",
  "tree": "97227b21548a362eb84f1dbcccb2583607570709",
  "parents": [
    "7934bbdf84a6b9a30297caf4f4f38286dedf876a",
    "261d7ebdc338e9586b9d8637108493ae230a0881"
  ],
  "author": {
    "name": "Matthias Krüger",
    "email": "476013+matthiaskrgr@users.noreply.github.com",
    "time": "Tue Nov 25 17:51:13 2025 +0100"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Nov 25 17:51:13 2025 +0100"
  },
  "message": "Rollup merge of #147736 - folkertdev:stabilize-asm-cfg, r\u003djdonszelmann\n\nStabilize `asm_cfg`\n\ntracking issue: https://github.com/rust-lang/rust/issues/140364\ncloses https://github.com/rust-lang/rust/issues/140364\n\nReference PR:\n\n- https://github.com/rust-lang/reference/pull/2063\n\n# Request for Stabilization\n\n## Summary\n\nThe `cfg_asm` feature allows `#[cfg(...)]` and `#[cfg_attr(...)]` on  the arguments of the assembly macros, for instance:\n\n```rust\nasm!( // or global_asm! or naked_asm!\n    \"nop\",\n    #[cfg(target_feature \u003d \"sse2\")]\n    \"nop\",\n    // ...\n    #[cfg(target_feature \u003d \"sse2\")]\n    a \u003d const 123, // only used on sse2\n);\n```\n\n## Semantics\n\nTemplates, operands, `options` and `clobber_abi` in the assembly macros (`asm!`, `naked_asm!` and `global_asm!`) can be annotated with `#[cfg(...)]` and `#[cfg_attr(...)]`. When the condition evaluates to true, the annotated argument has no effect, and is completely ignored when expanding the assembly macro.\n## Documentation\n\nreference PR: https://github.com/rust-lang/reference/pull/2063\n\n## Tests\n\n- [tests/ui/asm/cfg.rs](https://github.com/rust-lang/rust/blob/master/tests/ui/asm/cfg.rs) checks that `cfg`\u0027d arguments where the condition evaluates to false have no effect\n- [tests/ui/asm/cfg-parse-error.rs](https://github.com/rust-lang/rust/blob/master/tests/ui/asm/cfg.rs) checks the parsing rules (parsing effectively assumes that the cfg conditions are all true)\n\n## History\n\n- https://github.com/rust-lang/rust/issues/140279\n- https://github.com/rust-lang/rust/pull/140367\n\n# Resolved questions\n\n**how are other attributes handled**\n\nOther attributes are parsed,  but explicitly rejected.\n\n# unresolved questions\n\n**operand before template**\n\nThe current implementation expects at least one template string before any operands. In the example below, if the `cfg` condition evaluates to true, the assembly block is ill-formed. But even when it evaluates to `false` this block is rejected, because the parser still expects just a template (a template is parsed as an expression and then validated to ensure that it is or expands to a string literal).\n\nChanging how this works is difficult.\n```rust\n// This is rejected because `a \u003d out(reg) x` does not parse as an expresion.\nasm!(\n\t#[cfg(false)]\n\ta \u003d out(reg) x, //~ ERROR expected token: `,`\n\t\"\",\n);\n```\n\n**lint on positional arguments?**\n\nAdding a lint to warn on the definition or use of positional arguments being `cfg`\u0027d out was discussed in https://github.com/rust-lang/rust/issues/140279#issuecomment-2832237372 and subsequent comments. Such a lint is not currently implemented, but that may not be a blocker based on the comments there.\n\nr? `@traviscross` (I\u0027m assuming you\u0027ll reassign as needed)\n",
  "tree_diff": []
}
