diff --git a/tests/source/macros.rs b/tests/source/macros.rs index 10f6e2d7ea0..616a275876f 100644 --- a/tests/source/macros.rs +++ b/tests/source/macros.rs @@ -189,3 +189,12 @@ fn __bindgen_test_layout_HandleWithDtor_open0_int_close0_instantiation() { ); assert_eq ! ( :: std :: mem :: align_of :: < HandleWithDtor < :: std :: os :: raw :: c_int > > ( ) , 8usize , concat ! ( "Alignment of template specialization: " , stringify ! ( HandleWithDtor < :: std :: os :: raw :: c_int > ) ) ); } + +// #878 +macro_rules! try_opt { + ($expr:expr) => (match $expr { + Some(val) => val, + + None => { return None; } + }) +} diff --git a/tests/target/macros.rs b/tests/target/macros.rs index d47063d255c..394cac3820f 100644 --- a/tests/target/macros.rs +++ b/tests/target/macros.rs @@ -240,3 +240,12 @@ fn __bindgen_test_layout_HandleWithDtor_open0_int_close0_instantiation() { ) ); } + +// #878 +macro_rules! try_opt { + ($expr:expr) => (match $expr { + Some(val) => val, + + None => { return None; } + }) +}