File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -721,7 +721,7 @@ pub(crate) mod parsing {
721721 pub ( crate ) fn parse_meta_after_path ( path : Path , input : ParseStream ) -> Result < Meta > {
722722 if input. peek ( token:: Paren ) || input. peek ( token:: Bracket ) || input. peek ( token:: Brace ) {
723723 parse_meta_list_after_path ( path, input) . map ( Meta :: List )
724- } else if input. peek ( Token ! [ =] ) {
724+ } else if input. peek ( Token ! [ =] ) && !input . peek ( Token ! [ == ] ) && !input . peek ( Token ! [ => ] ) {
725725 parse_meta_name_value_after_path ( path, input) . map ( Meta :: NameValue )
726726 } else {
727727 Ok ( Meta :: Path ( path) )
Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ mod snapshot;
1111
1212mod debug;
1313
14- use syn:: { Meta , MetaList , MetaNameValue } ;
14+ use quote:: quote;
15+ use syn:: parse:: { ParseStream , Parser as _, Result } ;
16+ use syn:: { Meta , MetaList , MetaNameValue , Token } ;
1517
1618#[ test]
1719fn test_parse_meta_item_word ( ) {
@@ -156,3 +158,23 @@ fn test_parse_path() {
156158 }
157159 "# ) ;
158160}
161+
162+ #[ test]
163+ fn test_fat_arrow_after_meta ( ) {
164+ fn parse ( input : ParseStream ) -> Result < ( ) > {
165+ while !input. is_empty ( ) {
166+ let _: Meta = input. parse ( ) ?;
167+ let _: Token ! [ =>] = input. parse ( ) ?;
168+ let brace;
169+ syn:: braced!( brace in input) ;
170+ }
171+ Ok ( ( ) )
172+ }
173+
174+ let input = quote ! {
175+ target_os = "linux" => { }
176+ windows => { }
177+ } ;
178+
179+ parse. parse2 ( input) . unwrap ( ) ;
180+ }
You can’t perform that action at this time.
0 commit comments