Skip to content

Commit fb91fdb

Browse files
committed
disable the stack overflow handler on miri
1 parent 84bb0f0 commit fb91fdb

File tree

1 file changed

+40
-29
lines changed

1 file changed

+40
-29
lines changed

library/std/src/sys/pal/unix/stack_overflow.rs

+40-29
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,35 @@ impl Drop for Handler {
2525
}
2626
}
2727

28-
#[cfg(any(
29-
target_os = "linux",
30-
target_os = "freebsd",
31-
target_os = "hurd",
32-
target_os = "macos",
33-
target_os = "netbsd",
34-
target_os = "openbsd",
35-
target_os = "solaris",
36-
target_os = "illumos",
28+
#[cfg(all(
29+
not(miri),
30+
any(
31+
target_os = "linux",
32+
target_os = "freebsd",
33+
target_os = "hurd",
34+
target_os = "macos",
35+
target_os = "netbsd",
36+
target_os = "openbsd",
37+
target_os = "solaris",
38+
target_os = "illumos",
39+
),
3740
))]
3841
mod thread_info;
3942

40-
#[cfg(any(
41-
target_os = "linux",
42-
target_os = "freebsd",
43-
target_os = "hurd",
44-
target_os = "macos",
45-
target_os = "netbsd",
46-
target_os = "openbsd",
47-
target_os = "solaris",
48-
target_os = "illumos",
43+
// miri doesn't model signals, and this code has some synchronization properties
44+
// that we don't want to expose to user code.
45+
#[cfg(all(
46+
not(miri),
47+
any(
48+
target_os = "linux",
49+
target_os = "freebsd",
50+
target_os = "hurd",
51+
target_os = "macos",
52+
target_os = "netbsd",
53+
target_os = "openbsd",
54+
target_os = "solaris",
55+
target_os = "illumos",
56+
)
4957
))]
5058
mod imp {
5159
use libc::{
@@ -606,17 +614,20 @@ mod imp {
606614
// usually have fewer qualms about forwards compatibility, since the runtime
607615
// is shipped with the OS):
608616
// <https://github.com/apple/swift/blob/swift-5.10-RELEASE/stdlib/public/runtime/CrashHandlerMacOS.cpp>
609-
#[cfg(not(any(
610-
target_os = "linux",
611-
target_os = "freebsd",
612-
target_os = "hurd",
613-
target_os = "macos",
614-
target_os = "netbsd",
615-
target_os = "openbsd",
616-
target_os = "solaris",
617-
target_os = "illumos",
618-
target_os = "cygwin",
619-
)))]
617+
#[cfg(any(
618+
miri,
619+
not(any(
620+
target_os = "linux",
621+
target_os = "freebsd",
622+
target_os = "hurd",
623+
target_os = "macos",
624+
target_os = "netbsd",
625+
target_os = "openbsd",
626+
target_os = "solaris",
627+
target_os = "illumos",
628+
target_os = "cygwin",
629+
))
630+
))]
620631
mod imp {
621632
pub unsafe fn init() {}
622633

0 commit comments

Comments
 (0)