diff options
| author | jumbatm <jumbatm@gmail.com> | 2020-05-01 21:49:42 +1000 |
|---|---|---|
| committer | jumbatm <jumbatm@gmail.com> | 2020-05-01 21:52:43 +1000 |
| commit | bd18ad4fef9ca3d618521b8268183497b6104ff9 (patch) | |
| tree | f63c1410912182548f43a587104b66c870101b12 | |
| parent | 830473959adef21d6d9a9e13faadc0776b64e925 (diff) | |
| download | rust-bd18ad4fef9ca3d618521b8268183497b6104ff9.tar.gz rust-bd18ad4fef9ca3d618521b8268183497b6104ff9.zip | |
Note that try_validation_pat can take a format str directly.
| -rw-r--r-- | src/librustc_mir/interpret/validity.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index 54da0ba9eed..fe584596f01 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -66,6 +66,15 @@ macro_rules! try_validation { /// }); /// ``` /// +/// An additional nicety is that both parameters actually take format args, so you can just write +/// the format string in directly: +/// +/// ``` +/// let v = try_validation_pat!(some_fn(), some_path, { +/// Foo | Bar | Baz => { "{:?}", some_failure } expected { "{}", expected_value }, +/// }); +/// ``` +/// macro_rules! try_validation_pat { ($e:expr, $where:expr, { $( $p:pat )|+ => { $( $what_fmt:expr ),+ } $( expected { $( $expected_fmt:expr ),+ } )? $( , )?}) => {{ |
