Skip to content

Commit 2c2803f

Browse files
authored
Merge pull request #298 from dtolnay/constblock
Support const block syntax in ensure! macro
2 parents 80d4c8d + b249287 commit 2c2803f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/ensure.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ macro_rules! __parse_ensure {
231231
$crate::__parse_ensure!(atom $stack $bail ($($fuel)*) {($($buf)* $unsafe $block) $($parse)*} ($($rest)*) $($rest)*)
232232
};
233233

234+
(0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} ($const:tt $block:tt $($dup:tt)*) const {$($body:tt)*} $($rest:tt)*) => {
235+
// TODO: this is mostly useless due to https://github.com/rust-lang/rust/issues/86730
236+
$crate::__parse_ensure!(atom $stack $bail ($($fuel)*) {($($buf)* $const $block) $($parse)*} ($($rest)*) $($rest)*)
237+
};
238+
234239
(0 $stack:tt $bail:tt (~$($fuel:tt)*) {($($buf:tt)*) $($parse:tt)*} $dup:tt $lit:literal $($rest:tt)*) => {
235240
$crate::__parse_ensure!(atom $stack $bail ($($fuel)*) {($($buf)* $lit) $($parse)*} ($($rest)*) $($rest)*)
236241
};

0 commit comments

Comments
 (0)