@@ -12,12 +12,9 @@ use core::fmt::{self, Debug, Display};
1212use core:: mem:: ManuallyDrop ;
1313#[ cfg( any( feature = "std" , not( anyhow_no_core_error) ) ) ]
1414use core:: ops:: { Deref , DerefMut } ;
15- #[ cfg( not( anyhow_no_core_unwind_safe) ) ]
1615use core:: panic:: { RefUnwindSafe , UnwindSafe } ;
1716use core:: ptr;
1817use core:: ptr:: NonNull ;
19- #[ cfg( all( feature = "std" , anyhow_no_core_unwind_safe) ) ]
20- use std:: panic:: { RefUnwindSafe , UnwindSafe } ;
2118
2219impl Error {
2320 /// Create a new error object from any error type.
@@ -782,7 +779,7 @@ where
782779 // Attach E's native StdError vtable onto a pointer to self._object.
783780 let unerased_ref = e. cast :: < ErrorImpl < E > > ( ) ;
784781 Ref :: from_raw ( unsafe {
785- NonNull :: new_unchecked ( ptr:: addr_of!( ( * unerased_ref. as_ptr( ) ) . _object) as * mut E )
782+ NonNull :: new_unchecked ( ptr:: addr_of!( ( * unerased_ref. as_ptr( ) ) . _object) . cast_mut ( ) )
786783 } )
787784}
788785
@@ -819,7 +816,7 @@ where
819816 let unerased_ref = e. cast :: < ErrorImpl < E > > ( ) ;
820817 Some (
821818 Ref :: from_raw ( unsafe {
822- NonNull :: new_unchecked ( ptr:: addr_of!( ( * unerased_ref. as_ptr( ) ) . _object) as * mut E )
819+ NonNull :: new_unchecked ( ptr:: addr_of!( ( * unerased_ref. as_ptr( ) ) . _object) . cast_mut ( ) )
823820 } )
824821 . cast :: < ( ) > ( ) ,
825822 )
@@ -1085,8 +1082,5 @@ impl AsRef<dyn StdError> for Error {
10851082 }
10861083}
10871084
1088- #[ cfg( any( feature = "std" , not( anyhow_no_core_unwind_safe) ) ) ]
10891085impl UnwindSafe for Error { }
1090-
1091- #[ cfg( any( feature = "std" , not( anyhow_no_core_unwind_safe) ) ) ]
10921086impl RefUnwindSafe for Error { }
0 commit comments