Unnamed repository; edit this file 'description' to name the repository.
4 files changed, 43 insertions, 3 deletions
diff --git a/Cargo.lock b/Cargo.lock index 9ad34f7160..e414d39b8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1761,9 +1761,9 @@ dependencies = [ [[package]] name = "ungrammar" -version = "1.14.5" +version = "1.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395e988af2480b8a8118ad1d5f1f790197d332e3e2585231f742949b63080ef5" +checksum = "fb1cd6666863b2ff36bab1ced85c4b5e651638705f306f3cfad0a367f85ea715" [[package]] name = "unicase" diff --git a/crates/parser/src/grammar/generic_args.rs b/crates/parser/src/grammar/generic_args.rs index b47912d07d..1148c6c35c 100644 --- a/crates/parser/src/grammar/generic_args.rs +++ b/crates/parser/src/grammar/generic_args.rs @@ -32,7 +32,10 @@ fn generic_arg(p: &mut Parser) { k if k.is_literal() => const_arg(p), // test associated_type_bounds // fn print_all<T: Iterator<Item, Item::Item, Item::<true>, Item: Display, Item<'a> = Item>>(printables: T) {} - IDENT if [T![<], T![=], T![:]].contains(&p.nth(1)) => { + + // test macro_inside_generic_arg + // type A = Foo<syn::Token![_]>; + IDENT if [T![<], T![=], T![:]].contains(&p.nth(1)) && !p.nth_at(1, T![::]) => { let m = p.start(); name_ref(p); opt_generic_arg_list(p, false); diff --git a/crates/syntax/test_data/parser/inline/ok/0194_macro_inside_generic_arg.rast b/crates/syntax/test_data/parser/inline/ok/0194_macro_inside_generic_arg.rast new file mode 100644 index 0000000000..37306ba6ac --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0194_macro_inside_generic_arg.rast @@ -0,0 +1,36 @@ + [email protected] "type" + [email protected] " " + [email protected] "A" + [email protected] " " + [email protected] "=" + [email protected] " " + [email protected] "Foo" + [email protected] "<" + [email protected] "syn" + [email protected] "::" + [email protected] "Token" + [email protected] "!" + [email protected] "[" + [email protected] "_" + [email protected] "]" + [email protected] ">" + [email protected] ";" + [email protected] "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0194_macro_inside_generic_arg.rs b/crates/syntax/test_data/parser/inline/ok/0194_macro_inside_generic_arg.rs new file mode 100644 index 0000000000..8d43a53d97 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0194_macro_inside_generic_arg.rs @@ -0,0 +1 @@ +type A = Foo<syn::Token![_]>; |