File tree Expand file tree Collapse file tree 3 files changed +92
-1
lines changed
Expand file tree Collapse file tree 3 files changed +92
-1
lines changed Original file line number Diff line number Diff line change @@ -168,7 +168,11 @@ pub fn yield_now() {
168168 imp:: yield_now ( )
169169}
170170
171- /// Determines whether the current thread is unwinding because of panic.
171+ /// Determines whether the current thread is unwinding or aborting because of panic.
172+ ///
173+ /// This returns `true` if the current thread is currently panicking. This is
174+ /// true during unwinding (when `panic = "unwind"`) and also during the
175+ /// execution of the [panic hook] when `panic = "abort"`.
172176///
173177/// A common use of this feature is to poison shared resources when writing
174178/// unsafe code, by checking `panicking` when the `drop` is called.
@@ -210,6 +214,7 @@ pub fn yield_now() {
210214/// ```
211215///
212216/// [Mutex]: crate::sync::Mutex
217+ /// [panic hook]: crate::panic::set_hook
213218#[ inline]
214219#[ must_use]
215220#[ stable( feature = "rust1" , since = "1.0.0" ) ]
Original file line number Diff line number Diff line change 1+ //@ add-minicore
2+ //@ build-fail
3+ //@ compile-flags: --target armv7-unknown-linux-gnueabihf
4+ //@ needs-llvm-components: arm
5+ //@ ignore-backends: gcc
6+
7+ // Regression test for issue #90815.
8+ // Ensure that we emit a proper error message when inline assembly requests
9+ // more registers than available, instead of crashing with a SIGSEGV.
10+
11+ #![ feature( no_core) ]
12+ #![ no_core]
13+ #![ crate_type = "rlib" ]
14+
15+ extern crate minicore;
16+ use minicore:: * ;
17+
18+ #[ no_mangle]
19+ pub unsafe fn exhausted_registers ( ) {
20+ let r0: u32 ;
21+ let r1: u32 ;
22+ let r2: u32 ;
23+ let r3: u32 ;
24+ let r4: u32 ;
25+ let r5: u32 ;
26+ let r6: u32 ;
27+ let r7: u32 ;
28+ let r8: u32 ;
29+ let r9: u32 ;
30+ let r10: u32 ;
31+ let r11: u32 ;
32+ let r12: u32 ;
33+ let r13: u32 ;
34+ let r14: u32 ;
35+ let r15: u32 ;
36+
37+ asm ! (
38+ //~^ ERROR inline assembly requires more registers than available
39+ "mov {0}, r0" ,
40+ "mov {1}, r1" ,
41+ "mov {2}, r2" ,
42+ "mov {3}, r3" ,
43+ "mov {4}, r4" ,
44+ "mov {5}, r5" ,
45+ "mov {6}, r6" ,
46+ "mov {7}, r7" ,
47+ "mov {8}, r8" ,
48+ "mov {9}, r9" ,
49+ "mov {10}, r10" ,
50+ "mov {11}, r11" ,
51+ "mov {12}, r12" ,
52+ "mov {13}, r13" ,
53+ "mov {14}, r14" ,
54+ "mov {15}, r15" ,
55+ out( reg) r0,
56+ out( reg) r1,
57+ out( reg) r2,
58+ out( reg) r3,
59+ out( reg) r4,
60+ out( reg) r5,
61+ out( reg) r6,
62+ out( reg) r7,
63+ out( reg) r8,
64+ out( reg) r9,
65+ out( reg) r10,
66+ out( reg) r11,
67+ out( reg) r12,
68+ out( reg) r13,
69+ out( reg) r14,
70+ out( reg) r15,
71+ ) ;
72+ }
Original file line number Diff line number Diff line change 1+ error: inline assembly requires more registers than available
2+ --> $DIR/exhausted-registers-issue-90815.rs:37:5
3+ |
4+ LL | asm!(
5+ | _____^
6+ LL | | //~^ ERROR inline assembly requires more registers than available
7+ LL | | "mov {0}, r0",
8+ ... |
9+ LL | | out(reg) r15,
10+ LL | | );
11+ | |_____^
12+
13+ error: aborting due to 1 previous error
14+
You can’t perform that action at this time.
0 commit comments