Parse try as a keyword only in edition 2018 and up

This commit is contained in:
Lukas Wirth 2024-07-19 15:26:50 +02:00
parent 713c47f25b
commit d235d09bf9
8 changed files with 24 additions and 42 deletions

View file

@ -559,11 +559,17 @@ mod ok {
fn try_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/try_expr.rs"); }
#[test]
fn try_macro_fallback() {
run_and_expect_no_errors("test_data/parser/inline/ok/try_macro_fallback.rs");
run_and_expect_no_errors_with_edition(
"test_data/parser/inline/ok/try_macro_fallback.rs",
crate::Edition::Edition2015,
);
}
#[test]
fn try_macro_rules() {
run_and_expect_no_errors("test_data/parser/inline/ok/try_macro_rules.rs");
run_and_expect_no_errors_with_edition(
"test_data/parser/inline/ok/try_macro_rules.rs",
crate::Edition::Edition2015,
);
}
#[test]
fn tuple_attrs() { run_and_expect_no_errors("test_data/parser/inline/ok/tuple_attrs.rs"); }

View file

@ -1,5 +1,7 @@
SOURCE_FILE
FN
COMMENT "// 2015"
WHITESPACE "\n"
FN_KW "fn"
WHITESPACE " "
NAME

View file

@ -1 +1,2 @@
// 2015
fn foo() { try!(Ok(())); }

View file

@ -1,5 +1,7 @@
SOURCE_FILE
MACRO_RULES
COMMENT "// 2015"
WHITESPACE "\n"
MACRO_RULES_KW "macro_rules"
BANG "!"
WHITESPACE " "

View file

@ -1 +1,2 @@
// 2015
macro_rules! try { () => {} }