]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/empty_loop_no_std.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / empty_loop_no_std.rs
diff --git a/src/tools/clippy/tests/ui/empty_loop_no_std.rs b/src/tools/clippy/tests/ui/empty_loop_no_std.rs
new file mode 100644 (file)
index 0000000..4553d3e
--- /dev/null
@@ -0,0 +1,27 @@
+// ignore-macos
+// ignore-windows
+
+#![warn(clippy::empty_loop)]
+#![feature(lang_items, link_args, start, libc)]
+#![link_args = "-nostartfiles"]
+#![no_std]
+
+use core::panic::PanicInfo;
+
+#[start]
+fn main(argc: isize, argv: *const *const u8) -> isize {
+    // This should trigger the lint
+    loop {}
+}
+
+#[panic_handler]
+fn panic(_info: &PanicInfo) -> ! {
+    // This should NOT trigger the lint
+    loop {}
+}
+
+#[lang = "eh_personality"]
+extern "C" fn eh_personality() {
+    // This should also trigger the lint
+    loop {}
+}