)]}'
{
  "commit": "503dce33e2e2a5d2fe978b2723ab2a994cc27472",
  "tree": "72ca3e99701da0f1b1953b9119679a2b00243dce",
  "parents": [
    "01867557cd7dbe256a031a7b8e28d05daecd75ab",
    "cfbdc2c36d002ed80dbc1cd918d84f6c18e901be"
  ],
  "author": {
    "name": "bors",
    "email": "bors@rust-lang.org",
    "time": "Wed Nov 12 23:21:24 2025 +0000"
  },
  "committer": {
    "name": "bors",
    "email": "bors@rust-lang.org",
    "time": "Wed Nov 12 23:21:24 2025 +0000"
  },
  "message": "Auto merge of #148789 - m-ou-se:new-fmt-args-alt, r\u003dwafflelapkin,jdonszelmann\n\nNew format_args!() and fmt::Arguments implementation\n\nPart of https://github.com/rust-lang/rust/issues/99012\n\nThis is a new implementation of `format_args!()` and `fmt::Arguments`. With this implementation, `fmt::Arguments` is only two pointers in size. (Instead of six, before.) This makes it the same size as a `\u0026str` and makes it fit in a register pair.\n\n---\n\nThis `fmt::Arguments` can store a `\u0026\u0027static str` _without any indirection_ or additional storage. This means that simple cases like `print_fmt(format_args!(\"hello\"))` are now just as efficient for the caller as `print_str(\"hello\")`, as shown by this example:\n\n\u003e code:\n\u003e ```rust\n\u003e fn main() {\n\u003e     println!(\"Hello, world!\");\n\u003e }\n\u003e ```\n\u003e\n\u003e before:\n\u003e ```asm\n\u003e main:\n\u003e  sub     rsp, 56\n\u003e  lea     rax, [rip + .Lanon_hello_world]\n\u003e  mov     qword ptr [rsp + 8], rax\n\u003e  mov     qword ptr [rsp + 16], 1\n\u003e  mov     qword ptr [rsp + 24], 8\n\u003e  xorps   xmm0, xmm0\n\u003e  movups  xmmword ptr [rsp + 32], xmm0\n\u003e  lea     rdi, [rsp + 8]\n\u003e  call    qword ptr [rip + std::io::stdio::_print]\n\u003e  add     rsp, 56\n\u003e  ret\n\u003e ```\n\u003e\n\u003e after:\n\u003e ```asm\n\u003e main:\n\u003e  lea     rsi, [rip + .Lanon_hello_world]\n\u003e  mov     edi, 29\n\u003e  jmp     qword ptr [rip + std::io::stdio::_print]\n\u003e ```\n\n(`panic!(\"Hello, world!\");` shows a similar change.)\n\n---\n\nThis implementation stores all static information as just a single (byte) string, without any indirection:\n\n\u003e code:\n\u003e ```rust\n\u003e format_args!(\"Hello, {name:-^20}!\")\n\u003e ```\n\u003e\n\u003e lowering before:\n\u003e ```rust\n\u003e fmt::Arguments::new_v1_formatted(\n\u003e     \u0026[\"Hello, \", \"!\\n\"],\n\u003e     \u0026args,\n\u003e     \u0026[\n\u003e         Placeholder {\n\u003e             position: 0usize,\n\u003e             flags: 3355443245u32,\n\u003e             precision: format_count::Implied,\n\u003e             width: format_count::Is(20u16),\n\u003e         },\n\u003e     ],\n\u003e )\n\u003e ```\n\u003e\n\u003e lowering after:\n\u003e ```rust\n\u003e fmt::Arguments::new(\n\u003e     b\"\\x07Hello, \\xc3-\\x00\\x00\\xc8\\x14\\x00\\x02!\\n\\x00\",\n\u003e     \u0026args,\n\u003e )\n\u003e ```\n\nThis saves a ton of pointers and simplifies the expansion significantly, but does mean that individual pieces (e.g. `\"Hello, \"` and `\"!\\n\"`) cannot be reused. (Those pieces are often smaller than a pointer to them, though, in which case reusing them is useless.)\n\n---\n\nThe details of the new representation are documented in [library/core/src/fmt/mod.rs](https://github.com/m-ou-se/rust/blob/new-fmt-args-alt/library/core/src/fmt/mod.rs#L609-L712).\n",
  "tree_diff": []
}
