about summary refs log tree commit diff
path: root/src/libstd/sys/windows
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-05-18 11:11:19 +0000
committerbors <bors@rust-lang.org>2020-05-18 11:11:19 +0000
commit9e2a6a29ce82e4fc5decad86dab7911a38582438 (patch)
treee6cb48e01bb939c8962a206153f763b960099ad0 /src/libstd/sys/windows
parentd4bf05693c2c16e299f1adc279b54c37a8edef27 (diff)
parent2764673dca6badb2ef89450bbdd84b19c317a9c7 (diff)
downloadrust-9e2a6a29ce82e4fc5decad86dab7911a38582438.tar.gz
rust-9e2a6a29ce82e4fc5decad86dab7911a38582438.zip
Auto merge of #72289 - RalfJung:abort_internal, r=Mark-Simulacrum
abort_internal is safe

`sys::abort_internal` is stably exposed as a safe function. Forward that assumption "inwards" to the `sys` module by making the function itself safe, too.

This corresponds to what https://github.com/rust-lang/rust/pull/72204 did for the intrinsic. We should probably wait until that lands because some of the intrinsic calls in this PR might then need adjustments.
Diffstat (limited to 'src/libstd/sys/windows')
-rw-r--r--src/libstd/sys/windows/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs
index d745e87a072..4098c6b3ee9 100644
--- a/src/libstd/sys/windows/mod.rs
+++ b/src/libstd/sys/windows/mod.rs
@@ -308,11 +308,14 @@ pub fn dur2timeout(dur: Duration) -> c::DWORD {
 //
 // https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail
 #[allow(unreachable_code)]
-pub unsafe fn abort_internal() -> ! {
+pub fn abort_internal() -> ! {
     #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-    {
+    unsafe {
         llvm_asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT
         crate::intrinsics::unreachable();
     }
-    crate::intrinsics::abort();
+    #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // remove `unsafe` on bootstrap bump
+    unsafe {
+        crate::intrinsics::abort();
+    }
 }