]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/missing_spin_loop_no_std.fixed
Merge commit 'dc5423ad448877e33cca28db2f1445c9c4473c75' into clippyup
[rust.git] / src / tools / clippy / tests / ui / missing_spin_loop_no_std.fixed
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) { core::hint::spin_loop() }
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() {}