File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 2626#![ feature( rustc_diagnostic_macros) ]
2727#![ feature( slice_sort_by_cached_key) ]
2828#![ feature( str_escape) ]
29+ #![ feature( try_trait) ]
2930#![ feature( unicode_internals) ]
30- #![ feature( catch_expr) ]
3131
3232#![ recursion_limit="256" ]
3333
Original file line number Diff line number Diff line change @@ -1756,9 +1756,17 @@ impl<'a> Parser<'a> {
17561756
17571757 let parser_snapshot_before_pat = self . clone ( ) ;
17581758
1759+ // Once we can use edition 2018 in the compiler,
1760+ // replace this with real try blocks.
1761+ macro_rules! try_block {
1762+ ( $( $inside: tt) * ) => (
1763+ ( ||{ :: std:: ops:: Try :: from_ok( { $( $inside) * } ) } ) ( )
1764+ )
1765+ }
1766+
17591767 // We're going to try parsing the argument as a pattern (even though it's not
17601768 // allowed). This way we can provide better errors to the user.
1761- let pat_arg: PResult < ' a , _ > = do catch {
1769+ let pat_arg: PResult < ' a , _ > = try_block ! {
17621770 let pat = self . parse_pat( ) ?;
17631771 self . expect( & token:: Colon ) ?;
17641772 ( pat, self . parse_ty( ) ?)
You can’t perform that action at this time.
0 commit comments