about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2024-10-26 13:31:24 +0200
committerUrgau <urgau@numericable.fr>2024-10-26 13:31:24 +0200
commitf249fdd9621ab1dd65904c46f5db634c2b677da6 (patch)
tree7b395d37fcf457c824b4ce8c27a510c55ebff1a0
parent80d0d927d5069b67cc08c0c65b48e7b6e0cdeeb5 (diff)
downloadrust-f249fdd9621ab1dd65904c46f5db634c2b677da6.tar.gz
rust-f249fdd9621ab1dd65904c46f5db634c2b677da6.zip
Add AST unpretty test for unsafe attribute
-rw-r--r--tests/ui/unpretty/unsafe-attr.rs11
-rw-r--r--tests/ui/unpretty/unsafe-attr.stdout11
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/unpretty/unsafe-attr.rs b/tests/ui/unpretty/unsafe-attr.rs
new file mode 100644
index 00000000000..8734ea86b6d
--- /dev/null
+++ b/tests/ui/unpretty/unsafe-attr.rs
@@ -0,0 +1,11 @@
+//@ compile-flags: -Zunpretty=normal
+//@ check-pass
+
+#[no_mangle]
+extern "C" fn foo() {}
+
+#[unsafe(no_mangle)]
+extern "C" fn bar() {}
+
+#[cfg_attr(FALSE, unsafe(no_mangle))]
+extern "C" fn zoo() {}
diff --git a/tests/ui/unpretty/unsafe-attr.stdout b/tests/ui/unpretty/unsafe-attr.stdout
new file mode 100644
index 00000000000..5d199337524
--- /dev/null
+++ b/tests/ui/unpretty/unsafe-attr.stdout
@@ -0,0 +1,11 @@
+//@ compile-flags: -Zunpretty=normal
+//@ check-pass
+
+#[no_mangle]
+extern "C" fn foo() {}
+
+#[no_mangle]
+extern "C" fn bar() {}
+
+#[cfg_attr(FALSE, unsafe(no_mangle))]
+extern "C" fn zoo() {}