Skip to content

Commit bd18ad4

Browse files
committed
Note that try_validation_pat can take a format str directly.
1 parent 8304739 commit bd18ad4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/librustc_mir/interpret/validity.rs

+9
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ macro_rules! try_validation {
6666
/// });
6767
/// ```
6868
///
69+
/// An additional nicety is that both parameters actually take format args, so you can just write
70+
/// the format string in directly:
71+
///
72+
/// ```
73+
/// let v = try_validation_pat!(some_fn(), some_path, {
74+
/// Foo | Bar | Baz => { "{:?}", some_failure } expected { "{}", expected_value },
75+
/// });
76+
/// ```
77+
///
6978
macro_rules! try_validation_pat {
7079
($e:expr, $where:expr, { $( $p:pat )|+ =>
7180
{ $( $what_fmt:expr ),+ } $( expected { $( $expected_fmt:expr ),+ } )? $( , )?}) => {{

0 commit comments

Comments
 (0)