File tree 2 files changed +3
-4
lines changed
src/librustc_parse/parser
2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -1055,10 +1055,11 @@ impl<'a> Parser<'a> {
1055
1055
}
1056
1056
1057
1057
pub ( super ) fn try_macro_suggestion ( & mut self ) -> DiagnosticBuilder < ' a > {
1058
+ let is_try = self . token . is_keyword ( kw:: Try ) ;
1058
1059
let is_questionmark = self . look_ahead ( 1 , |t| t == & token:: Not ) ; //check for !
1059
1060
let is_open = self . look_ahead ( 2 , |t| t == & token:: OpenDelim ( token:: Paren ) ) ; //check for (
1060
1061
1061
- if is_questionmark && is_open {
1062
+ if is_try && is_questionmark && is_open {
1062
1063
let lo = self . token . span ;
1063
1064
self . bump ( ) ; //remove try
1064
1065
self . bump ( ) ; //remove !
Original file line number Diff line number Diff line change @@ -1001,14 +1001,12 @@ impl<'a> Parser<'a> {
1001
1001
1002
1002
fn parse_lit_expr ( & mut self , attrs : AttrVec ) -> PResult < ' a , P < Expr > > {
1003
1003
let lo = self . token . span ;
1004
- let is_try = self . token . is_keyword ( kw:: Try ) ;
1005
1004
match self . parse_opt_lit ( ) {
1006
1005
Some ( literal) => {
1007
1006
let expr = self . mk_expr ( lo. to ( self . prev_token . span ) , ExprKind :: Lit ( literal) , attrs) ;
1008
1007
self . maybe_recover_from_bad_qpath ( expr, true )
1009
1008
}
1010
- None if is_try => Err ( self . try_macro_suggestion ( ) ) ,
1011
- None => Err ( self . expected_expression_found ( ) ) ,
1009
+ None => Err ( self . try_macro_suggestion ( ) ) ,
1012
1010
}
1013
1011
}
1014
1012
You can’t perform that action at this time.
0 commit comments