From 14345eeda6ac7767bfd9e52d6e15bfdd70b4ee70 Mon Sep 17 00:00:00 2001 From: J-ZhengLi Date: Thu, 14 Mar 2024 17:06:18 +0800 Subject: [PATCH] add test cases for #12435 --- tests/ui/mixed_attributes_style.rs | 15 +++++++++++++++ tests/ui/mixed_attributes_style.stderr | 26 +++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/ui/mixed_attributes_style.rs b/tests/ui/mixed_attributes_style.rs index 4f89aa8a5e55..9f39949110cf 100644 --- a/tests/ui/mixed_attributes_style.rs +++ b/tests/ui/mixed_attributes_style.rs @@ -38,3 +38,18 @@ mod bar { fn main() { // test code goes here } + +// issue #12435 +#[cfg(test)] +mod tests { + //! Module doc, don't lint +} +#[allow(unused)] +mod baz { + //! Module doc, don't lint + const FOO: u8 = 0; +} +/// Module doc, don't lint +mod quz { + #![allow(unused)] +} diff --git a/tests/ui/mixed_attributes_style.stderr b/tests/ui/mixed_attributes_style.stderr index ed798073cb7c..02b19cc98468 100644 --- a/tests/ui/mixed_attributes_style.stderr +++ b/tests/ui/mixed_attributes_style.stderr @@ -26,5 +26,29 @@ LL | | mod bar { LL | | #![allow(unused)] | |_____________________^ -error: aborting due to 3 previous errors +error: item has both inner and outer attributes + --> tests/ui/mixed_attributes_style.rs:43:1 + | +LL | / #[cfg(test)] +LL | | mod tests { +LL | | //! Module doc, don't lint + | |______________________________^ + +error: item has both inner and outer attributes + --> tests/ui/mixed_attributes_style.rs:47:1 + | +LL | / #[allow(unused)] +LL | | mod baz { +LL | | //! Module doc, don't lint + | |______________________________^ + +error: item has both inner and outer attributes + --> tests/ui/mixed_attributes_style.rs:52:1 + | +LL | / /// Module doc, don't lint +LL | | mod quz { +LL | | #![allow(unused)] + | |_____________________^ + +error: aborting due to 6 previous errors