From 9979ab730b8b1a789e9711ec8ffecea3f360c9e5 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Wed, 29 Jan 2020 15:47:22 +0100 Subject: [PATCH] Add test for `await` in `debug_assert!(..)` --- tests/ui/debug_assert_with_mut_call.rs | 8 ++++ tests/ui/debug_assert_with_mut_call.stderr | 56 +++++++++++----------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/tests/ui/debug_assert_with_mut_call.rs b/tests/ui/debug_assert_with_mut_call.rs index a588547b943a..b7941a0b1597 100644 --- a/tests/ui/debug_assert_with_mut_call.rs +++ b/tests/ui/debug_assert_with_mut_call.rs @@ -1,3 +1,4 @@ +// compile-flags: --edition=2018 #![feature(custom_inner_attributes)] #![rustfmt::skip] #![allow(clippy::trivially_copy_pass_by_ref, clippy::cognitive_complexity, clippy::redundant_closure_call)] @@ -114,6 +115,12 @@ fn misc() { })()); } +async fn debug_await() { + debug_assert!(async { + true + }.await); +} + fn main() { func_non_mutable(); func_mutable(); @@ -121,4 +128,5 @@ fn main() { method_mutable(); misc(); + debug_await(); } diff --git a/tests/ui/debug_assert_with_mut_call.stderr b/tests/ui/debug_assert_with_mut_call.stderr index 48c7f4ea85ed..6d280a7eda99 100644 --- a/tests/ui/debug_assert_with_mut_call.stderr +++ b/tests/ui/debug_assert_with_mut_call.stderr @@ -1,5 +1,5 @@ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:40:19 + --> $DIR/debug_assert_with_mut_call.rs:41:19 | LL | debug_assert!(bool_mut(&mut 3)); | ^^^^^^^^^^^^^^^^ @@ -7,163 +7,163 @@ LL | debug_assert!(bool_mut(&mut 3)); = note: `#[deny(clippy::debug_assert_with_mut_call)]` on by default error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:41:20 + --> $DIR/debug_assert_with_mut_call.rs:42:20 | LL | debug_assert!(!bool_mut(&mut 3)); | ^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_eq!` - --> $DIR/debug_assert_with_mut_call.rs:43:25 + --> $DIR/debug_assert_with_mut_call.rs:44:25 | LL | debug_assert_eq!(0, u32_mut(&mut 3)); | ^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_eq!` - --> $DIR/debug_assert_with_mut_call.rs:44:22 + --> $DIR/debug_assert_with_mut_call.rs:45:22 | LL | debug_assert_eq!(u32_mut(&mut 3), 0); | ^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_ne!` - --> $DIR/debug_assert_with_mut_call.rs:46:25 + --> $DIR/debug_assert_with_mut_call.rs:47:25 | LL | debug_assert_ne!(1, u32_mut(&mut 3)); | ^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_ne!` - --> $DIR/debug_assert_with_mut_call.rs:47:22 + --> $DIR/debug_assert_with_mut_call.rs:48:22 | LL | debug_assert_ne!(u32_mut(&mut 3), 1); | ^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:62:19 + --> $DIR/debug_assert_with_mut_call.rs:63:19 | LL | debug_assert!(S.bool_self_mut()); | ^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:63:20 + --> $DIR/debug_assert_with_mut_call.rs:64:20 | LL | debug_assert!(!S.bool_self_mut()); | ^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:64:19 + --> $DIR/debug_assert_with_mut_call.rs:65:19 | LL | debug_assert!(S.bool_self_ref_arg_mut(&mut 3)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:65:19 + --> $DIR/debug_assert_with_mut_call.rs:66:19 | LL | debug_assert!(S.bool_self_mut_arg_ref(&3)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:66:19 + --> $DIR/debug_assert_with_mut_call.rs:67:19 | LL | debug_assert!(S.bool_self_mut_arg_mut(&mut 3)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_eq!` - --> $DIR/debug_assert_with_mut_call.rs:68:22 + --> $DIR/debug_assert_with_mut_call.rs:69:22 | LL | debug_assert_eq!(S.u32_self_mut(), 0); | ^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_eq!` - --> $DIR/debug_assert_with_mut_call.rs:69:22 + --> $DIR/debug_assert_with_mut_call.rs:70:22 | LL | debug_assert_eq!(S.u32_self_mut_arg_ref(&3), 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_eq!` - --> $DIR/debug_assert_with_mut_call.rs:70:22 + --> $DIR/debug_assert_with_mut_call.rs:71:22 | LL | debug_assert_eq!(S.u32_self_ref_arg_mut(&mut 3), 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_eq!` - --> $DIR/debug_assert_with_mut_call.rs:71:22 + --> $DIR/debug_assert_with_mut_call.rs:72:22 | LL | debug_assert_eq!(S.u32_self_mut_arg_mut(&mut 3), 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_ne!` - --> $DIR/debug_assert_with_mut_call.rs:73:22 + --> $DIR/debug_assert_with_mut_call.rs:74:22 | LL | debug_assert_ne!(S.u32_self_mut(), 1); | ^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_ne!` - --> $DIR/debug_assert_with_mut_call.rs:74:22 + --> $DIR/debug_assert_with_mut_call.rs:75:22 | LL | debug_assert_ne!(S.u32_self_mut_arg_ref(&3), 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_ne!` - --> $DIR/debug_assert_with_mut_call.rs:75:22 + --> $DIR/debug_assert_with_mut_call.rs:76:22 | LL | debug_assert_ne!(S.u32_self_ref_arg_mut(&mut 3), 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_ne!` - --> $DIR/debug_assert_with_mut_call.rs:76:22 + --> $DIR/debug_assert_with_mut_call.rs:77:22 | LL | debug_assert_ne!(S.u32_self_mut_arg_mut(&mut 3), 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_eq!` - --> $DIR/debug_assert_with_mut_call.rs:84:22 + --> $DIR/debug_assert_with_mut_call.rs:85:22 | LL | debug_assert_eq!(v.pop(), Some(1)); | ^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_ne!` - --> $DIR/debug_assert_with_mut_call.rs:85:31 + --> $DIR/debug_assert_with_mut_call.rs:86:31 | LL | debug_assert_ne!(Some(3), v.pop()); | ^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:88:19 + --> $DIR/debug_assert_with_mut_call.rs:89:19 | LL | debug_assert!(bool_mut(a)); | ^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:91:31 + --> $DIR/debug_assert_with_mut_call.rs:92:31 | LL | debug_assert!(!(bool_ref(&u32_mut(&mut 3)))); | ^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert_eq!` - --> $DIR/debug_assert_with_mut_call.rs:94:22 + --> $DIR/debug_assert_with_mut_call.rs:95:22 | LL | debug_assert_eq!(v.pop().unwrap(), 3); | ^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:98:19 + --> $DIR/debug_assert_with_mut_call.rs:99:19 | LL | debug_assert!(bool_mut(&mut 3), "w/o format"); | ^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:100:19 + --> $DIR/debug_assert_with_mut_call.rs:101:19 | LL | debug_assert!(bool_mut(&mut 3), "{} format", "w/"); | ^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:105:9 + --> $DIR/debug_assert_with_mut_call.rs:106:9 | LL | bool_mut(&mut x); | ^^^^^^^^^^^^^^^^ error: do not call a function with mutable arguments inside of `debug_assert!` - --> $DIR/debug_assert_with_mut_call.rs:112:9 + --> $DIR/debug_assert_with_mut_call.rs:113:9 | LL | bool_mut(&mut x); | ^^^^^^^^^^^^^^^^