summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/missing_spin_loop_no_std.rs
blob: e532ca62dc533d63161c75662f5b780e72b48d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//@run-rustfix
#![warn(clippy::missing_spin_loop)]
#![feature(lang_items, start, libc)]
#![no_std]

use core::sync::atomic::{AtomicBool, Ordering};

#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
    // This should trigger the lint
    let b = AtomicBool::new(true);
    // This should lint with `core::hint::spin_loop()`
    while b.load(Ordering::Acquire) {}
    0
}

#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
    loop {}
}

#[lang = "eh_personality"]
extern "C" fn eh_personality() {}