about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-03-05 04:46:39 +0100
committerGitHub <noreply@github.com>2022-03-05 04:46:39 +0100
commite558040908815fe9a3855a14101f667ae3e8bb8f (patch)
tree414b16f57c3e3e3aed46c536b6ecc5ff96d836bc /src
parenta3fe63e9fe73bea75c2405dd0928d78b5c83daf8 (diff)
parent050d589991ea2a79b747e1b559ca476f37299441 (diff)
downloadrust-e558040908815fe9a3855a14101f667ae3e8bb8f.tar.gz
rust-e558040908815fe9a3855a14101f667ae3e8bb8f.zip
Rollup merge of #94624 - estebank:regression-94508, r=Dylan-DPC
Downgrade `#[test]` on macro call to warning

Follow up to #92959. Address #94508.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/test-attrs/test-on-not-fn.rs2
-rw-r--r--src/test/ui/test-attrs/test-on-not-fn.stderr40
2 files changed, 15 insertions, 27 deletions
diff --git a/src/test/ui/test-attrs/test-on-not-fn.rs b/src/test/ui/test-attrs/test-on-not-fn.rs
index b2f681c01d1..a460480afb1 100644
--- a/src/test/ui/test-attrs/test-on-not-fn.rs
+++ b/src/test/ui/test-attrs/test-on-not-fn.rs
@@ -58,7 +58,7 @@ macro_rules! foo {
     () => {};
 }
 
-#[test] //~ ERROR: the `#[test]` attribute may only be used on a non-associated function
+#[test] //~ WARN: the `#[test]` attribute may only be used on a non-associated function
 foo!();
 
 // make sure it doesn't erroneously trigger on a real test
diff --git a/src/test/ui/test-attrs/test-on-not-fn.stderr b/src/test/ui/test-attrs/test-on-not-fn.stderr
index dd693cf316d..23efd5bc0d9 100644
--- a/src/test/ui/test-attrs/test-on-not-fn.stderr
+++ b/src/test/ui/test-attrs/test-on-not-fn.stderr
@@ -2,11 +2,10 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:3:1
    |
 LL | #[test]
-   | ^^^^^^^
+   | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | mod test {}
    | ----------- expected a non-associated function, found a module
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
@@ -16,7 +15,7 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:6:1
    |
 LL |   #[test]
-   |   ^^^^^^^
+   |   ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | / mod loooooooooooooong_teeeeeeeeeest {
 LL | |     /*
 LL | |     this is a comment
@@ -26,7 +25,6 @@ LL | |     */
 LL | | }
    | |_- expected a non-associated function, found a module
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
@@ -36,11 +34,10 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:20:1
    |
 LL | #[test]
-   | ^^^^^^^
+   | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | extern "C" {}
    | ------------- expected a non-associated function, found an extern block
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
@@ -50,11 +47,10 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:23:1
    |
 LL | #[test]
-   | ^^^^^^^
+   | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | trait Foo {}
    | ------------ expected a non-associated function, found a trait
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
@@ -64,11 +60,10 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:26:1
    |
 LL | #[test]
-   | ^^^^^^^
+   | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | impl Foo for i32 {}
    | ------------------- expected a non-associated function, found an implementation
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
@@ -78,11 +73,10 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:29:1
    |
 LL | #[test]
-   | ^^^^^^^
+   | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | const FOO: i32 = -1_i32;
    | ------------------------ expected a non-associated function, found a constant item
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
@@ -92,11 +86,10 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:32:1
    |
 LL | #[test]
-   | ^^^^^^^
+   | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | static BAR: u64 = 10_000_u64;
    | ----------------------------- expected a non-associated function, found a static item
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
@@ -106,13 +99,12 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:35:1
    |
 LL |   #[test]
-   |   ^^^^^^^
+   |   ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | / enum MyUnit {
 LL | |     Unit,
 LL | | }
    | |_- expected a non-associated function, found an enum
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
@@ -122,11 +114,10 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:40:1
    |
 LL | #[test]
-   | ^^^^^^^
+   | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | struct NewI32(i32);
    | ------------------- expected a non-associated function, found a struct
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
@@ -136,14 +127,13 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:43:1
    |
 LL |   #[test]
-   |   ^^^^^^^
+   |   ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | / union Spooky {
 LL | |     x: i32,
 LL | |     y: u32,
 LL | | }
    | |_- expected a non-associated function, found a union
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
@@ -153,7 +143,7 @@ error: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:50:1
    |
 LL |   #[test]
-   |   ^^^^^^^
+   |   ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL |   #[derive(Copy, Clone, Debug)]
 LL | / struct MoreAttrs {
 LL | |     a: i32,
@@ -161,25 +151,23 @@ LL | |     b: u64,
 LL | | }
    | |_- expected a non-associated function, found a struct
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
    | ~~~~~~~~~~~~
 
-error: the `#[test]` attribute may only be used on a non-associated function
+warning: the `#[test]` attribute may only be used on a non-associated function
   --> $DIR/test-on-not-fn.rs:61:1
    |
 LL | #[test]
-   | ^^^^^^^
+   | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 LL | foo!();
    | ------- expected a non-associated function, found an item macro invocation
    |
-   = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
 help: replace with conditional compilation to make the item only exist when tests are being run
    |
 LL | #[cfg(test)]
    | ~~~~~~~~~~~~
 
-error: aborting due to 12 previous errors
+error: aborting due to 11 previous errors; 1 warning emitted