2023-04-23 06:03:09 -05:00
|
|
|
//@compile-flags: -Clink-arg=-nostartfiles
|
2024-09-24 04:58:04 -05:00
|
|
|
//@ignore-target: apple
|
2020-01-24 04:50:03 -06:00
|
|
|
|
|
|
|
#![warn(clippy::empty_loop)]
|
2021-04-03 12:20:18 -05:00
|
|
|
#![feature(lang_items, start, libc)]
|
2020-01-24 04:50:03 -06:00
|
|
|
#![no_std]
|
|
|
|
|
|
|
|
use core::panic::PanicInfo;
|
|
|
|
|
|
|
|
#[start]
|
|
|
|
fn main(argc: isize, argv: *const *const u8) -> isize {
|
2020-11-23 06:51:04 -06:00
|
|
|
// This should trigger the lint
|
2020-01-24 04:50:03 -06:00
|
|
|
loop {}
|
2023-08-24 14:32:12 -05:00
|
|
|
//~^ ERROR: empty `loop {}` wastes CPU cycles
|
2020-01-24 04:50:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[panic_handler]
|
|
|
|
fn panic(_info: &PanicInfo) -> ! {
|
2020-11-23 06:51:04 -06:00
|
|
|
// This should NOT trigger the lint
|
2020-01-24 04:50:03 -06:00
|
|
|
loop {}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[lang = "eh_personality"]
|
2020-11-23 06:51:04 -06:00
|
|
|
extern "C" fn eh_personality() {
|
|
|
|
// This should also trigger the lint
|
|
|
|
loop {}
|
2023-08-24 14:32:12 -05:00
|
|
|
//~^ ERROR: empty `loop {}` wastes CPU cycles
|
2020-11-23 06:51:04 -06:00
|
|
|
}
|