{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibmhaimtw6yneoxak2uvmucwg2yfoyedd7sojy2okmoikcbp3sfeu",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mi6evpgam3w2"
},
"path": "/t/compiler-should-avoid-generating-very-long-type-name/23543#post_10",
"publishedAt": "2026-03-28T03:20:21.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "Rust's \"legacy\" symbol names already have a hash, and \"v0\" format supports backreferences, which is a form of compression.\n\nBut I'd like the problem to be tackled more at the source. Instead of generating tons of data to process and compress, generate less!\n\n## Debuginfo of zero-cost abstractions isn't zero-cost\n\nIt's preserved in full fidelity, but it's practically useless when the code for it compiles down to a single instruction or nothing. It's supposed to help debugging, but it has a net-negative value for debugging- it's tedious to jump into multiple layers of tiny wrapper functions, like `<` going through `PartialOrd` trait. Sometimes std uses specialization traits, which adds a ton of abstract indirect boilerplate in debug info, only to remove the code behind it.\n\nI wish I could just completely discard debuginfo for all inlineable code. Having that debuginfo is worse than not having it.\n\nThe overly detailed excessively inlined debuginfo also destroys code attribution in godbolt. Almost every line technically is from `core`, and godbolt isn't showing which lines of code _I_ wrote compiled to. I was shocked when I compared that to C++ which doesn't attribute stl templates to its standard library, so godbolt has 1:1 mapping between every C++ source code line and its assembly. Rust has maybe 1 in 10 lines working, and they're usually useless ones like function prolog.\n\n## Automatically de-genericize code\n\nThe most bloated generic code usually has lots of unused parameters. Every method of a type inherits all of its parameters, but not every method uses all of them. When the types are nested (iterators, futures, closures) every needlessly varying generic argument multiplies the cost.\n\nPeople sometimes fix it by hand by wrapping fragments of code in local functions with fewer (or zero) generic type arguments, but I wish the compiler could do that automatically.",
"title": "Compiler should avoid generating very long type name"
}