Rollup merge of #127214 - bjorn3:miri_native_unwind, r=oli-obk · model-checking/verify-rust-std@f8caf5f (original) (raw)

Original file line number Diff line number Diff line change
@@ -36,18 +36,14 @@ use core::panic::PanicPayload;
36 36 cfg_if::cfg_if! {
37 37 if #[cfg(target_os = "emscripten")] {
38 38 #[path = "emcc.rs"]
39 -mod real_imp;
39 +mod imp;
40 40 } else if #[cfg(target_os = "hermit")] {
41 41 #[path = "hermit.rs"]
42 -mod real_imp;
42 +mod imp;
43 43 } else if #[cfg(target_os = "l4re")] {
44 44 // L4Re is unix family but does not yet support unwinding.
45 45 #[path = "dummy.rs"]
46 -mod real_imp;
47 -} else if #[cfg(all(target_env = "msvc", not(target_arch = "arm")))] {
48 -// LLVM does not support unwinding on 32 bit ARM msvc (thumbv7a-pc-windows-msvc)
49 - #[path = "seh.rs"]
50 -mod real_imp;
46 +mod imp;
51 47 } else if #[cfg(any(
52 48 all(target_family = "windows", target_env = "gnu"),
53 49 target_os = "psp",
@@ -58,7 +54,16 @@ cfg_if::cfg_if! {
58 54 target_family = "wasm",
59 55 ))] {
60 56 #[path = "gcc.rs"]
61 -mod real_imp;
57 +mod imp;
58 +} else if #[cfg(miri)] {
59 +// Use the Miri runtime on Windows as miri doesn't support funclet based unwinding,
60 +// only landingpad based unwinding. Also use the Miri runtime on unsupported platforms.
61 + #[path = "miri.rs"]
62 +mod imp;
63 +} else if #[cfg(all(target_env = "msvc", not(target_arch = "arm")))] {
64 +// LLVM does not support unwinding on 32 bit ARM msvc (thumbv7a-pc-windows-msvc)
65 + #[path = "seh.rs"]
66 +mod imp;
62 67 } else {
63 68 // Targets that don't support unwinding.
64 69 // - os=none ("bare metal" targets)
@@ -67,20 +72,7 @@ cfg_if::cfg_if! {
67 72 // - nvptx64-nvidia-cuda
68 73 // - arch=avr
69 74 #[path = "dummy.rs"]
70 -mod real_imp;
71 -}
72 -}
73 -
74 -cfg_if::cfg_if! {
75 -if #[cfg(miri)] {
76 -// Use the Miri runtime.
77 -// We still need to also load the normal runtime above, as rustc expects certain lang
78 -// items from there to be defined.
79 - #[path = "miri.rs"]
80 75 mod imp;
81 -} else {
82 -// Use the real runtime.
83 -use real_imp as imp;
84 76 }
85 77 }
86 78