File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 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> {
16531653}
16541654
16551655// This is a separate function to reduce the code size of the methods
1656+ #[ cfg( not( feature = "panic_immediate_abort" ) ) ]
16561657#[ inline( never) ]
16571658#[ cold]
16581659#[ track_caller]
16591660fn unwrap_failed ( msg : & str , error : & dyn fmt:: Debug ) -> ! {
16601661 panic ! ( "{}: {:?}" , msg, error)
16611662}
16621663
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+
16631676/////////////////////////////////////////////////////////////////////////////
16641677// Trait implementations
16651678/////////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments