Skip to content

Commit 3280a1f

Browse files
committed
disable the stack overflow handler on miri
1 parent 5d1e6ee commit 3280a1f

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::{
@@ -608,17 +616,20 @@ mod imp {
608616
// usually have fewer qualms about forwards compatibility, since the runtime
609617
// is shipped with the OS):
610618
// <https://github.com/apple/swift/blob/swift-5.10-RELEASE/stdlib/public/runtime/CrashHandlerMacOS.cpp>
611-
#[cfg(not(any(
612-
target_os = "linux",
613-
target_os = "freebsd",
614-
target_os = "hurd",
615-
target_os = "macos",
616-
target_os = "netbsd",
617-
target_os = "openbsd",
618-
target_os = "solaris",
619-
target_os = "illumos",
620-
target_os = "cygwin",
621-
)))]
619+
#[cfg(any(
620+
miri,
621+
not(any(
622+
target_os = "linux",
623+
target_os = "freebsd",
624+
target_os = "hurd",
625+
target_os = "macos",
626+
target_os = "netbsd",
627+
target_os = "openbsd",
628+
target_os = "solaris",
629+
target_os = "illumos",
630+
target_os = "cygwin",
631+
))
632+
))]
622633
mod imp {
623634
pub unsafe fn init() {}
624635

0 commit comments

Comments
 (0)