From f249fdd9621ab1dd65904c46f5db634c2b677da6 Mon Sep 17 00:00:00 2001 From: Urgau Date: Sat, 26 Oct 2024 13:31:24 +0200 Subject: [PATCH] Add AST unpretty test for unsafe attribute --- tests/ui/unpretty/unsafe-attr.rs | 11 +++++++++++ tests/ui/unpretty/unsafe-attr.stdout | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/ui/unpretty/unsafe-attr.rs create mode 100644 tests/ui/unpretty/unsafe-attr.stdout 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() {}