]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.rs
Lint attributes on function arguments
[rust.git] / src / test / ui / rfc-2565-param-attrs / param-attrs-cfg.rs
index 977b5d9ce349580a35167269833b1c787b65bac9..069332ffa255f836216a873ab883659a0fbfb66f 100644 (file)
@@ -1,6 +1,7 @@
 // compile-flags: --cfg something
+// edition:2018
 
-#![feature(param_attrs)]
+#![feature(async_await, async_closure, param_attrs)]
 #![deny(unused_variables)]
 
 extern "C" {
@@ -19,24 +20,35 @@ fn ffi(
     #[cfg_attr(something, cfg(nothing))] d: i32,
 );
 
+async fn foo_async(
+    #[cfg(something)] a: i32,
+    //~^ ERROR unused variable: `a`
+    #[cfg(nothing)] b: i32,
+) {}
 fn foo(
     #[cfg(nothing)] a: i32,
     #[cfg(something)] b: i32,
-    //~^ ERROR unused variable: `b` [unused_variables]
+    //~^ ERROR unused variable: `b`
     #[cfg_attr(nothing, cfg(nothing))] c: i32,
-    //~^ ERROR unused variable: `c` [unused_variables]
+    //~^ ERROR unused variable: `c`
     #[cfg_attr(something, cfg(nothing))] d: i32,
 ) {}
 
 struct RefStruct {}
 impl RefStruct {
+    async fn bar_async(
+        &self,
+        #[cfg(something)] a: i32,
+        //~^ ERROR unused variable: `a`
+        #[cfg(nothing)] b: i32,
+    ) {}
     fn bar(
         &self,
         #[cfg(nothing)] a: i32,
         #[cfg(something)] b: i32,
-        //~^ ERROR unused variable: `b` [unused_variables]
+        //~^ ERROR unused variable: `b`
         #[cfg_attr(nothing, cfg(nothing))] c: i32,
-        //~^ ERROR unused variable: `c` [unused_variables]
+        //~^ ERROR unused variable: `c`
         #[cfg_attr(something, cfg(nothing))] d: i32,
     ) {}
 }
@@ -45,9 +57,9 @@ fn bar(
         &self,
         #[cfg(nothing)] a: i32,
         #[cfg(something)] b: i32,
-        //~^ ERROR unused variable: `b` [unused_variables]
+        //~^ ERROR unused variable: `b`
         #[cfg_attr(nothing, cfg(nothing))] c: i32,
-        //~^ ERROR unused variable: `c` [unused_variables]
+        //~^ ERROR unused variable: `c`
         #[cfg_attr(something, cfg(nothing))] d: i32,
     ) {}
 }
@@ -56,9 +68,9 @@ fn bar(
         &self,
         #[cfg(nothing)] a: i32,
         #[cfg(something)] b: i32,
-        //~^ ERROR unused variable: `b` [unused_variables]
+        //~^ ERROR unused variable: `b`
         #[cfg_attr(nothing, cfg(nothing))] c: i32,
-        //~^ ERROR unused variable: `c` [unused_variables]
+        //~^ ERROR unused variable: `c`
         #[cfg_attr(something, cfg(nothing))] d: i32,
     ) {}
 }
@@ -67,13 +79,19 @@ fn main() {
     let _: unsafe extern "C" fn(_, ...) = ffi;
     let _: fn(_, _) = foo;
     let _: FnType = |_, _| {};
+    let a = async move |
+        #[cfg(something)] a: i32,
+        //~^ ERROR unused variable: `a`
+        #[cfg(nothing)] b: i32,
+    | {};
     let c = |
         #[cfg(nothing)] a: i32,
         #[cfg(something)] b: i32,
-        //~^ ERROR unused variable: `b` [unused_variables]
+        //~^ ERROR unused variable: `b`
         #[cfg_attr(nothing, cfg(nothing))] c: i32,
-        //~^ ERROR unused variable: `c` [unused_variables]
+        //~^ ERROR unused variable: `c`
         #[cfg_attr(something, cfg(nothing))] d: i32,
     | {};
+    let _ = a(1);
     let _ = c(1, 2);
 }