Fix ensure ui test with empty args
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Tolnay · committed by David Tolnay · parent e666360 · Browse files · 2 files·+19 added−19 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+19 added−19 removed
- tests:+3 added−3 removed
- other:+16 added−16 removed
Provenance
- Commit
74e2693- Tree
0194cde- Author
David Tolnay <dtolnay@gmail.com>- Committer
David Tolnay <dtolnay@gmail.com>- Parent
e666360
2 files changed+19 added−19 removed
modified:src/ensure.rs+16 added-16 removed
34 unmodified lines35 };36 37 // low precedence control flow constructs38 39- (0 $stack:tt $bail:tt $parse:tt return $($rest:tt)*) => {40- $crate::__fallback_ensure!($bail)39+ (0 $stack:tt ($($bail:tt)*) $parse:tt return $($rest:tt)*) => {40+ $crate::__fallback_ensure!($($bail)*)41 };42 43- (0 $stack:tt $bail:tt $parse:tt break $($rest:tt)*) => {44- $crate::__fallback_ensure!($bail)43+ (0 $stack:tt ($($bail:tt)*) $parse:tt break $($rest:tt)*) => {44+ $crate::__fallback_ensure!($($bail)*)45 };46 47- (0 $stack:tt $bail:tt $parse:tt continue $($rest:tt)*) => {48- $crate::__fallback_ensure!($bail)47+ (0 $stack:tt ($($bail:tt)*) $parse:tt continue $($rest:tt)*) => {48+ $crate::__fallback_ensure!($($bail)*)49 };50 51- (0 $stack:tt $bail:tt $parse:tt yield $($rest:tt)*) => {52- $crate::__fallback_ensure!($bail)51+ (0 $stack:tt ($($bail:tt)*) $parse:tt yield $($rest:tt)*) => {52+ $crate::__fallback_ensure!($($bail)*)53 };54 55- (0 $stack:tt $bail:tt $parse:tt move $($rest:tt)*) => {56- $crate::__fallback_ensure!($bail)55+ (0 $stack:tt ($($bail:tt)*) $parse:tt move $($rest:tt)*) => {56+ $crate::__fallback_ensure!($($bail)*)57 };58 59 // unary operators60 360 unmodified lines421 };422 423 // unrecognized expression424 425- ($state:tt $stack:tt $bail:tt $($rest:tt)*) => {426- $crate::__fallback_ensure!($bail)425+ ($state:tt $stack:tt ($($bail:tt)*) $($rest:tt)*) => {426+ $crate::__fallback_ensure!($($bail)*)427 };428 }429 430 #[doc(hidden)]14 unmodified lines445 446 #[doc(hidden)]447 #[macro_export]448 macro_rules! __fallback_ensure {449- (($cond:expr $(,)?)) => {449+ ($cond:expr $(,)?) => {450 if !$cond {451 return $crate::private::Err($crate::Error::msg(452 $crate::private::concat!("Condition failed: `", $crate::private::stringify!($cond), "`")453 ));454 }455 };456- (($cond:expr, $msg:literal $(,)?)) => {456+ ($cond:expr, $msg:literal $(,)?) => {457 if !$cond {458 return $crate::private::Err($crate::anyhow!($msg));459 }460 };461- (($cond:expr, $err:expr $(,)?)) => {461+ ($cond:expr, $err:expr $(,)?) => {462 if !$cond {463 return $crate::private::Err($crate::anyhow!($err));464 }465 };466- (($cond:expr, $fmt:expr, $($arg:tt)*)) => {466+ ($cond:expr, $fmt:expr, $($arg:tt)*) => {467 if !$cond {468 return $crate::private::Err($crate::anyhow!($fmt, $($arg)*));469 }470 };1 unmodified linemodified:tests/ui/empty-ensure.stderr+3 added-3 removed
1-error: no rules expected the token `)`1+error: unexpected end of macro invocation2 --> tests/ui/empty-ensure.rs:4:53 |4 4 | ensure!();5- | ^^^^^^^^^ no rules expected this token in macro call5+ | ^^^^^^^^^ missing tokens in macro arguments6 |7- = note: this error originates in the macro `ensure` (in Nightly builds, run with -Z macro-backtrace for more info)7+ = note: this error originates in the macro `$crate::__parse_ensure` (in Nightly builds, run with -Z macro-backtrace for more info)