]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/missing_spin_loop_no_std.rs
New upstream version 1.61.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / missing_spin_loop_no_std.rs
1 // run-rustfix
2 #![warn(clippy::missing_spin_loop)]
3 #![feature(lang_items, start, libc)]
4 #![no_std]
5
6 use core::sync::atomic::{AtomicBool, Ordering};
7
8 #[start]
9 fn main(_argc: isize, _argv: *const *const u8) -> isize {
10 // This should trigger the lint
11 let b = AtomicBool::new(true);
12 // This should lint with `core::hint::spin_loop()`
13 while b.load(Ordering::Acquire) {}
14 0
15 }
16
17 #[panic_handler]
18 fn panic(_info: &core::panic::PanicInfo) -> ! {
19 loop {}
20 }
21
22 #[lang = "eh_personality"]
23 extern "C" fn eh_personality() {}