Skip to content
Myr

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

2 files+19 added−19 removed

modified:src/ensure.rs+16 added-16 removed
34 unmodified lines
35 };3637 // low precedence control flow constructs3839 (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 };4243 (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 };4647 (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 };5051 (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 };5455 (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 };5859 // unary operators60
360 unmodified lines
421 };422423 // unrecognized expression424425 ($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}429430#[doc(hidden)]
14 unmodified lines
445446#[doc(hidden)]447#[macro_export]448macro_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 line
modified:tests/ui/empty-ensure.stderr+3 added-3 removed
1error: no rules expected the token `)`1error: unexpected end of macro invocation2 --> tests/ui/empty-ensure.rs:4:53 |44 | 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)