{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreicvgyybrjkffcxeue3ii3uhypyxpee4m5i4rcnjivjtgho6gvuyku",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mjisdhpjj622"
},
"path": "/t/code-bloat-caused-by-lack-of-nounwind-attr-on-drop-in-place/24173#post_1",
"publishedAt": "2026-04-15T01:55:14.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"rust.godbolt.org",
"Compiler Explorer - Rust (rustc nightly)"
],
"textContent": "As far as I can tell, `rustc` doesn't mark functions as `NoUnwind`/`NEVER_UNWIND`, apart from a handful of broad generalizations like `panic=abort` or `extern \"not *-unwind\"`. I saw some scan of function bodies for _coroutines_ , but not for regular functions.\n\nThe problem is that when a `Drop::drop` can't be inlined, it ends up being a potentially-unwinding call, and because unwinding calls can cause more drops, and panics during unwinding are not allowed, every `drop` then also generates an unwinding landing pad with and a call to `panicking::panic_in_cleanup`. This basically doubles the amount of drop-related code, and LLVM won't move nor unify calls to unwinding functions.\n\nThis affects `Arc`. It intentionally has a non-inlined `drop_slow`, which triggers the unwinding bloat:\n\nrust.godbolt.org\n\n### Compiler Explorer - Rust (rustc nightly)\n\nuse std::sync::Arc; struct Foo { next: Option>, } #[no_mangle] pub fn maybe_foo(foo: Arc, x: bool) -> Arc { let a = Arc::new(Foo { next: Some(foo.clone()) }); let a = Arc::new(Foo { next: Some(foo.clone()) }); let a = Arc::new(Foo {...",
"title": "Code bloat caused by lack of nounwind attr on `drop_in_place`"
}