From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/lint/unused/unused-attr-macro-rules.rs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/test/ui/lint/unused/unused-attr-macro-rules.rs (limited to 'src/test/ui/lint/unused/unused-attr-macro-rules.rs') diff --git a/src/test/ui/lint/unused/unused-attr-macro-rules.rs b/src/test/ui/lint/unused/unused-attr-macro-rules.rs new file mode 100644 index 000000000..c0fc280ab --- /dev/null +++ b/src/test/ui/lint/unused/unused-attr-macro-rules.rs @@ -0,0 +1,33 @@ +#![deny(unused_attributes)] +// Unused attributes on macro_rules requires special handling since the +// macro_rules definition does not survive towards HIR. + +// A sample of various built-in attributes. +#[macro_export] +#[macro_use] //~ ERROR `#[macro_use]` only has an effect +#[path="foo"] //~ ERROR #[path]` only has an effect +#[recursion_limit="1"] //~ ERROR crate-level attribute should be an inner attribute +macro_rules! foo { + () => {}; +} + +// The following should not warn about unused attributes. +#[allow(unused)] +macro_rules! foo2 { + () => {}; +} + +#[cfg(FALSE)] +macro_rules! foo { + () => {}; +} + +/// Some docs +#[deprecated] +#[doc = "more docs"] +#[macro_export] +macro_rules! bar { + () => {}; +} + +fn main() {} -- cgit v1.2.3