diff --git a/.mailmap b/.mailmap index 948f1ab14fdea..cbfcf4f100901 100644 --- a/.mailmap +++ b/.mailmap @@ -727,3 +727,4 @@ Zack Corr Zack Slayton Zbigniew Siciarz Zbigniew Siciarz y21 <30553356+y21@users.noreply.github.com> +Airsytoteles <193495344+Airyshtoteles@users.noreply.github.com> diff --git a/library/std/src/thread/functions.rs b/library/std/src/thread/functions.rs index 73d7278785704..1f5e0695668cf 100644 --- a/library/std/src/thread/functions.rs +++ b/library/std/src/thread/functions.rs @@ -168,7 +168,11 @@ pub fn yield_now() { imp::yield_now() } -/// Determines whether the current thread is unwinding because of panic. +/// Determines whether the current thread is unwinding or aborting because of panic. +/// +/// This returns `true` if the current thread is currently panicking. This is +/// true during unwinding (when `panic = "unwind"`) and also during the +/// execution of the [panic hook] when `panic = "abort"`. /// /// A common use of this feature is to poison shared resources when writing /// unsafe code, by checking `panicking` when the `drop` is called. @@ -210,6 +214,7 @@ pub fn yield_now() { /// ``` /// /// [Mutex]: crate::sync::Mutex +/// [panic hook]: crate::panic::set_hook #[inline] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] diff --git a/tests/ui/asm/arm/exhausted-registers-issue-90815.rs b/tests/ui/asm/arm/exhausted-registers-issue-90815.rs new file mode 100644 index 0000000000000..79d9dd50bbdc6 --- /dev/null +++ b/tests/ui/asm/arm/exhausted-registers-issue-90815.rs @@ -0,0 +1,71 @@ +//@ add-minicore +//@ build-fail +//@ compile-flags: --target armv7-unknown-linux-gnueabihf +//@ needs-llvm-components: arm +//@ ignore-backends: gcc + +// Regression test for issue #90815. +// Ensure that we emit a proper error message when inline assembly requests +// more registers than available, instead of crashing with a SIGSEGV. + +#![feature(no_core)] +#![no_core] +#![crate_type = "rlib"] + +extern crate minicore; +use minicore::*; + +#[no_mangle] +pub unsafe fn exhausted_registers() { + let r0: u32; + let r1: u32; + let r2: u32; + let r3: u32; + let r4: u32; + let r5: u32; + let r6: u32; + let r7: u32; + let r8: u32; + let r9: u32; + let r10: u32; + let r11: u32; + let r12: u32; + let r13: u32; + let r14: u32; + let r15: u32; + + asm!( + "mov {0}, r0", + "mov {1}, r1", + "mov {2}, r2", + "mov {3}, r3", + "mov {4}, r4", + "mov {5}, r5", + "mov {6}, r6", + "mov {7}, r7", + "mov {8}, r8", + "mov {9}, r9", + "mov {10}, r10", + "mov {11}, r11", + "mov {12}, r12", + "mov {13}, r13", + "mov {14}, r14", + "mov {15}, r15", + out(reg) r0, + out(reg) r1, + out(reg) r2, + out(reg) r3, + out(reg) r4, + out(reg) r5, + out(reg) r6, + out(reg) r7, + out(reg) r8, + out(reg) r9, + out(reg) r10, + out(reg) r11, + out(reg) r12, + out(reg) r13, + out(reg) r14, + out(reg) r15, + ); +} diff --git a/tests/ui/asm/arm/exhausted-registers-issue-90815.stderr b/tests/ui/asm/arm/exhausted-registers-issue-90815.stderr new file mode 100644 index 0000000000000..e77aec6416fa7 --- /dev/null +++ b/tests/ui/asm/arm/exhausted-registers-issue-90815.stderr @@ -0,0 +1,8 @@ +error: inline assembly requires more registers than available + --> $DIR/exhausted-registers-issue-90815.rs:38:10 + | +LL | "mov {0}, r0", + | ^^^^^^^^^^^ + +error: aborting due to 1 previous error +