From 9f06585c0e93f835c9e0ceb199d71b8f5679d9d1 Mon Sep 17 00:00:00 2001 From: Spencer Date: Wed, 12 Mar 2025 22:22:20 -0600 Subject: [PATCH] improves outer mod attribute test --- .../outer-mod-attr-applies-only-to-first.rs | 16 ++++++++++++ tests/ui/dupe-first-attr.rs | 25 ------------------- 2 files changed, 16 insertions(+), 25 deletions(-) create mode 100644 tests/ui/attributes/outer-mod-attr-applies-only-to-first.rs delete mode 100644 tests/ui/dupe-first-attr.rs diff --git a/tests/ui/attributes/outer-mod-attr-applies-only-to-first.rs b/tests/ui/attributes/outer-mod-attr-applies-only-to-first.rs new file mode 100644 index 00000000000..ec521c1afb5 --- /dev/null +++ b/tests/ui/attributes/outer-mod-attr-applies-only-to-first.rs @@ -0,0 +1,16 @@ +//! Regression test to check that outer attributes applied to the first module item is applied to +//! its attached module item only, and not also to other subsequent module items +//! +//! Commit: + +//@ check-pass +//@ compile-flags: --cfg=first +//@ no-auto-check-cfg + +#[cfg(first)] +mod hello {} + +#[cfg(not_set)] +mod hello {} + +fn main() {} diff --git a/tests/ui/dupe-first-attr.rs b/tests/ui/dupe-first-attr.rs deleted file mode 100644 index c254df050c1..00000000000 --- a/tests/ui/dupe-first-attr.rs +++ /dev/null @@ -1,25 +0,0 @@ -//@ run-pass - -// Regression test for a problem with the first mod attribute -// being applied to every mod - - -#[cfg(target_os = "linux")] -mod hello {} - -#[cfg(target_os = "macos")] -mod hello {} - -#[cfg(target_os = "windows")] -mod hello {} - -#[cfg(target_os = "freebsd")] -mod hello {} - -#[cfg(target_os = "dragonfly")] -mod hello {} - -#[cfg(target_os = "android")] -mod hello {} - -fn main() {}