diff --git a/library/std/src/io/error/repr_bitpacked.rs b/library/std/src/io/error/repr_bitpacked.rs index 716da37168d01..7b2980263d1b1 100644 --- a/library/std/src/io/error/repr_bitpacked.rs +++ b/library/std/src/io/error/repr_bitpacked.rs @@ -235,7 +235,13 @@ impl Repr { } impl Drop for Repr { - #[inline] + // This was #[inline] previously. Inlining the destructor of ErrorData is in + // no way helpful in real programs (as the source of the error will not be + // inlined, so there will not be any match assumptions to gain). The cost, + // meanwhile, is a code size increase by a factor of up to 5.4 in the case + // of dropping multiple io::Results in the same function + // (https://godbolt.org/z/8hfGchjsT). + #[inline(never)] fn drop(&mut self) { // Safety: We're a Repr, decode_repr is fine. The `Box::from_raw` is // safe because we're being dropped.