File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1653,13 +1653,26 @@ impl<T> Result<T, T> {
1653
1653
}
1654
1654
1655
1655
// This is a separate function to reduce the code size of the methods
1656
+ #[ cfg( not( feature = "panic_immediate_abort" ) ) ]
1656
1657
#[ inline( never) ]
1657
1658
#[ cold]
1658
1659
#[ track_caller]
1659
1660
fn unwrap_failed ( msg : & str , error : & dyn fmt:: Debug ) -> ! {
1660
1661
panic ! ( "{}: {:?}" , msg, error)
1661
1662
}
1662
1663
1664
+ // This is a separate function to avoid constructing a `dyn Debug`
1665
+ // that gets immediately thrown away, since vtables don't get cleaned up
1666
+ // by dead code elimination if a trait object is constructed even if it goes
1667
+ // unused
1668
+ #[ cfg( feature = "panic_immediate_abort" ) ]
1669
+ #[ inline]
1670
+ #[ cold]
1671
+ #[ track_caller]
1672
+ fn unwrap_failed < T > ( _msg : & str , _error : & T ) -> ! {
1673
+ panic ! ( )
1674
+ }
1675
+
1663
1676
/////////////////////////////////////////////////////////////////////////////
1664
1677
// Trait implementations
1665
1678
/////////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments