File tree 2 files changed +25
-6
lines changed
2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,6 @@ cfg_if::cfg_if! {
39
39
if #[ cfg( miri) ] {
40
40
#[ path = "miri.rs" ]
41
41
mod imp;
42
- // On MSVC we need the SEH lang items as well...
43
- // This should match the conditions of the `seh.rs` import below.
44
- #[ cfg( all( target_env = "msvc" , not( target_arch = "aarch64" ) ) ) ]
45
- #[ allow( unused) ]
46
- mod seh;
47
42
} else if #[ cfg( target_os = "emscripten" ) ] {
48
43
#[ path = "emcc.rs" ]
49
44
mod imp;
Original file line number Diff line number Diff line change
1
+ #![ allow( nonstandard_style) ]
2
+
1
3
use core:: any:: Any ;
2
4
use alloc:: boxed:: Box ;
3
5
@@ -13,11 +15,33 @@ pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> {
13
15
Box :: from_raw ( ptr)
14
16
}
15
17
16
-
17
18
// This is required by the compiler to exist (e.g., it's a lang item),
18
19
// but is never used by Miri. Therefore, we just use a stub here
19
20
#[ lang = "eh_personality" ]
20
21
#[ cfg( not( test) ) ]
21
22
fn rust_eh_personality ( ) {
22
23
unsafe { core:: intrinsics:: abort ( ) }
23
24
}
25
+
26
+ // The rest is required on *some* targets to exist (specifically, MSVC targets that use SEH).
27
+ // We just add it on all targets. Copied from `seh.rs`.
28
+ #[ repr( C ) ]
29
+ pub struct _TypeDescriptor {
30
+ pub pVFTable : * const u8 ,
31
+ pub spare : * mut u8 ,
32
+ pub name : [ u8 ; 11 ] ,
33
+ }
34
+
35
+ extern "C" {
36
+ #[ link_name = "\x01 ??_7type_info@@6B@" ]
37
+ static TYPE_INFO_VTABLE : * const u8 ;
38
+ }
39
+
40
+ const TYPE_NAME : [ u8 ; 11 ] = * b"rust_panic\0 " ;
41
+
42
+ #[ cfg_attr( not( test) , lang = "eh_catch_typeinfo" ) ]
43
+ static mut TYPE_DESCRIPTOR : _TypeDescriptor = _TypeDescriptor {
44
+ pVFTable : unsafe { & TYPE_INFO_VTABLE } as * const _ as * const _ ,
45
+ spare : core:: ptr:: null_mut ( ) ,
46
+ name : TYPE_NAME ,
47
+ } ;
You can’t perform that action at this time.
0 commit comments