Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -727,3 +727,4 @@ Zack Corr <zack@z0w0.me> <zackcorr95@gmail.com>
Zack Slayton <zack.slayton@gmail.com>
Zbigniew Siciarz <zbigniew@siciarz.net> Zbigniew Siciarz <antyqjon@gmail.com>
y21 <30553356+y21@users.noreply.github.com>
Airsytoteles <193495344+Airyshtoteles@users.noreply.github.com>
7 changes: 6 additions & 1 deletion library/std/src/thread/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"`.
Comment on lines +173 to +175
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, panic hooks will always be executed for both "abort" and "unwind", so panicking will return true inside a panic hook regardless of whether panic="abort" or panic="unwind" is set.

This revision appears to incorrectly imply that panicking returns true within panic hooks only when panic = "abort".

Nonetheless, I'm not a native English speaker, so please feel free to correct me if my understanding is wrong.

///
/// A common use of this feature is to poison shared resources when writing
/// unsafe code, by checking `panicking` when the `drop` is called.
Expand Down Expand Up @@ -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")]
Expand Down
71 changes: 71 additions & 0 deletions tests/ui/asm/arm/exhausted-registers-issue-90815.rs
Original file line number Diff line number Diff line change
@@ -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)]
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This UI test crate has no main function and doesn’t specify a non-binary crate type, so it will also emit E0601 (main function not found) in addition to the intended inline-asm diagnostic. Add #![crate_type = "rlib"] (as other no_core asm UI tests do) or provide a fn main() to keep the stderr focused on the register-exhaustion error; update the .stderr line/column numbers accordingly if needed.

Suggested change
#![feature(no_core)]
#![feature(no_core)]
#![crate_type = "rlib"]

Copilot uses AI. Check for mistakes.
#![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,
);
}
8 changes: 8 additions & 0 deletions tests/ui/asm/arm/exhausted-registers-issue-90815.stderr
Original file line number Diff line number Diff line change
@@ -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

Loading