{
  "id": 11814553,
  "title": "Rust's derive often implies inline",
  "url": "https://urgent.news/2026/10/04/rusts-derive-often-implies-inline",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-04T01:41:57.000Z",
  "source": {
    "name": "Lobsters",
    "slug": "lobsters",
    "url": "https://yossarian.net/til/post/rust-s-derive-often-implies-inline/"
  },
  "original_language": "en",
  "account": "In Rust, the #[derive] attribute is frequently used to implement core traits such as Debug, Display, and Clone. However, developers may not be aware that Rust automatically adds #[inline] to these derived implementations. This feature, while often beneficial, can sometimes lead to unintended consequences.\n\nConsider an error hierarchy, where each Error level inherits from a Debug implementation. In this case, the Debug implementation for Errors can be inlined numerous times, potentially causing the binary size to increase significantly. In one instance, preventing Rust from inlining these Debug implementations resulted in a 160KB reduction in binary size. This was surprising, as it showed the extent to which inlining can impact binary size.\n\nThe issue appears to be that Rust doesn't impose any limits on the number or size of inlined Debug implementations, which can be problematic in larger, more complex Rust applications. While it's likely that rustc made the right decision in many cases, developers should be aware of the potential size implications when dealing with deeply nested error hierarchies containing numerous fields.",
  "summary": null,
  "key_points": [
    "Rust #[derive] often adds #[inline] to core traits like Debug",
    "Inlining Debug implementations can significantly increase binary size",
    "Preventing inlining can reduce binary size by 160KB in some cases"
  ],
  "editors_take": "Rust's automatic inlining of derived trait implementations can have significant implications for binary size in complex applications with deeply nested error hierarchies.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}