aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
diff options
context:
space:
mode:
authorZac Pullar-Strecker <[email protected]>2020-08-24 10:19:53 +0100
committerZac Pullar-Strecker <[email protected]>2020-08-24 10:20:13 +0100
commit7bbca7a1b3f9293d2f5cc5745199bc5f8396f2f0 (patch)
treebdb47765991cb973b2cd5481a088fac636bd326c /crates/syntax
parentca464650eeaca6195891199a93f4f76cf3e7e697 (diff)
parente65d48d1fb3d4d91d9dc1148a7a836ff5c9a3c87 (diff)
Merge remote-tracking branch 'upstream/master' into 503-hover-doc-links
Diffstat (limited to 'crates/syntax')
-rw-r--r--crates/syntax/Cargo.toml35
-rw-r--r--crates/syntax/fuzz/.gitignore4
-rw-r--r--crates/syntax/fuzz/Cargo.toml27
-rw-r--r--crates/syntax/fuzz/fuzz_targets/parser.rs11
-rw-r--r--crates/syntax/fuzz/fuzz_targets/reparse.rs11
-rw-r--r--crates/syntax/src/algo.rs406
-rw-r--r--crates/syntax/src/ast.rs331
-rw-r--r--crates/syntax/src/ast/edit.rs673
-rw-r--r--crates/syntax/src/ast/expr_ext.rs418
-rw-r--r--crates/syntax/src/ast/generated.rs41
-rw-r--r--crates/syntax/src/ast/generated/nodes.rs4068
-rw-r--r--crates/syntax/src/ast/generated/tokens.rs91
-rw-r--r--crates/syntax/src/ast/make.rs402
-rw-r--r--crates/syntax/src/ast/node_ext.rs485
-rw-r--r--crates/syntax/src/ast/token_ext.rs538
-rw-r--r--crates/syntax/src/ast/traits.rs141
-rw-r--r--crates/syntax/src/fuzz.rs73
-rw-r--r--crates/syntax/src/lib.rs388
-rw-r--r--crates/syntax/src/parsing.rs59
-rw-r--r--crates/syntax/src/parsing/lexer.rs244
-rw-r--r--crates/syntax/src/parsing/reparsing.rs455
-rw-r--r--crates/syntax/src/parsing/text_token_source.rs84
-rw-r--r--crates/syntax/src/parsing/text_tree_sink.rs183
-rw-r--r--crates/syntax/src/ptr.rs105
-rw-r--r--crates/syntax/src/syntax_error.rs44
-rw-r--r--crates/syntax/src/syntax_node.rs77
-rw-r--r--crates/syntax/src/tests.rs280
-rw-r--r--crates/syntax/src/validation.rs303
-rw-r--r--crates/syntax/src/validation/block.rs22
-rw-r--r--crates/syntax/test_data/accidentally_quadratic3980
-rw-r--r--crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0017_unclosed_string_at_eof.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0017_unclosed_string_at_eof.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0021_unclosed_string_with_space.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0021_unclosed_string_with_space.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0022_unclosed_string_with_slash.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0022_unclosed_string_with_slash.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt10
-rw-r--r--crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt10
-rw-r--r--crates/syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.rs1
-rw-r--r--crates/syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0055_empty_int.rs17
-rw-r--r--crates/syntax/test_data/lexer/err/0055_empty_int.txt39
-rw-r--r--crates/syntax/test_data/lexer/err/0056_empty_exponent.rs22
-rw-r--r--crates/syntax/test_data/lexer/err/0056_empty_exponent.txt62
-rw-r--r--crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.rs2
-rw-r--r--crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt6
-rw-r--r--crates/syntax/test_data/lexer/ok/0001_hello.rs1
-rw-r--r--crates/syntax/test_data/lexer/ok/0001_hello.txt3
-rw-r--r--crates/syntax/test_data/lexer/ok/0002_whitespace.rs4
-rw-r--r--crates/syntax/test_data/lexer/ok/0002_whitespace.txt12
-rw-r--r--crates/syntax/test_data/lexer/ok/0003_ident.rs1
-rw-r--r--crates/syntax/test_data/lexer/ok/0003_ident.txt14
-rw-r--r--crates/syntax/test_data/lexer/ok/0004_numbers.rs9
-rw-r--r--crates/syntax/test_data/lexer/ok/0004_numbers.txt57
-rw-r--r--crates/syntax/test_data/lexer/ok/0005_symbols.rs6
-rw-r--r--crates/syntax/test_data/lexer/ok/0005_symbols.txt77
-rw-r--r--crates/syntax/test_data/lexer/ok/0006_chars.rs1
-rw-r--r--crates/syntax/test_data/lexer/ok/0006_chars.txt16
-rw-r--r--crates/syntax/test_data/lexer/ok/0007_lifetimes.rs1
-rw-r--r--crates/syntax/test_data/lexer/ok/0007_lifetimes.txt8
-rw-r--r--crates/syntax/test_data/lexer/ok/0008_byte_strings.rs3
-rw-r--r--crates/syntax/test_data/lexer/ok/0008_byte_strings.txt22
-rw-r--r--crates/syntax/test_data/lexer/ok/0009_strings.rs2
-rw-r--r--crates/syntax/test_data/lexer/ok/0009_strings.txt8
-rw-r--r--crates/syntax/test_data/lexer/ok/0010_single_line_comments.rs12
-rw-r--r--crates/syntax/test_data/lexer/ok/0010_single_line_comments.txt22
-rw-r--r--crates/syntax/test_data/lexer/ok/0011_keywords.rs3
-rw-r--r--crates/syntax/test_data/lexer/ok/0011_keywords.txt64
-rw-r--r--crates/syntax/test_data/lexer/ok/0012_block_comment.rs3
-rw-r--r--crates/syntax/test_data/lexer/ok/0012_block_comment.txt6
-rw-r--r--crates/syntax/test_data/lexer/ok/0013_raw_strings.rs1
-rw-r--r--crates/syntax/test_data/lexer/ok/0013_raw_strings.txt2
-rw-r--r--crates/syntax/test_data/lexer/ok/0014_raw_ident.rs1
-rw-r--r--crates/syntax/test_data/lexer/ok/0014_raw_ident.txt2
-rw-r--r--crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rast34
-rw-r--r--crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rs4
-rw-r--r--crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rast18
-rw-r--r--crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rs3
-rw-r--r--crates/syntax/test_data/parser/err/0002_duplicate_shebang.rast39
-rw-r--r--crates/syntax/test_data/parser/err/0002_duplicate_shebang.rs2
-rw-r--r--crates/syntax/test_data/parser/err/0003_C++_semicolon.rast39
-rw-r--r--crates/syntax/test_data/parser/err/0003_C++_semicolon.rs4
-rw-r--r--crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rast15
-rw-r--r--crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rs1
-rw-r--r--crates/syntax/test_data/parser/err/0005_attribute_recover.rast59
-rw-r--r--crates/syntax/test_data/parser/err/0005_attribute_recover.rs8
-rw-r--r--crates/syntax/test_data/parser/err/0006_named_field_recovery.rast74
-rw-r--r--crates/syntax/test_data/parser/err/0006_named_field_recovery.rs7
-rw-r--r--crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rast32
-rw-r--r--crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rs9
-rw-r--r--crates/syntax/test_data/parser/err/0008_item_block_recovery.rast77
-rw-r--r--crates/syntax/test_data/parser/err/0008_item_block_recovery.rs13
-rw-r--r--crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast58
-rw-r--r--crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rs5
-rw-r--r--crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rast44
-rw-r--r--crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rs3
-rw-r--r--crates/syntax/test_data/parser/err/0011_extern_struct.rast13
-rw-r--r--crates/syntax/test_data/parser/err/0011_extern_struct.rs1
-rw-r--r--crates/syntax/test_data/parser/err/0012_broken_lambda.rast387
-rw-r--r--crates/syntax/test_data/parser/err/0013_invalid_type.rast89
-rw-r--r--crates/syntax/test_data/parser/err/0013_invalid_type.rs7
-rw-r--r--crates/syntax/test_data/parser/err/0014_where_no_bounds.rast31
-rw-r--r--crates/syntax/test_data/parser/err/0014_where_no_bounds.rs1
-rw-r--r--crates/syntax/test_data/parser/err/0015_curly_in_params.rast24
-rw-r--r--crates/syntax/test_data/parser/err/0015_curly_in_params.rs2
-rw-r--r--crates/syntax/test_data/parser/err/0016_missing_semi.rast43
-rw-r--r--crates/syntax/test_data/parser/err/0016_missing_semi.rs6
-rw-r--r--crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rast46
-rw-r--r--crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rs4
-rw-r--r--crates/syntax/test_data/parser/err/0018_incomplete_fn.rast131
-rw-r--r--crates/syntax/test_data/parser/err/0018_incomplete_fn.rs8
-rw-r--r--crates/syntax/test_data/parser/err/0019_let_recover.rast103
-rw-r--r--crates/syntax/test_data/parser/err/0019_let_recover.rs12
-rw-r--r--crates/syntax/test_data/parser/err/0020_fn_recover.rast20
-rw-r--r--crates/syntax/test_data/parser/err/0020_fn_recover.rs3
-rw-r--r--crates/syntax/test_data/parser/err/0021_incomplete_param.rast34
-rw-r--r--crates/syntax/test_data/parser/err/0021_incomplete_param.rs2
-rw-r--r--crates/syntax/test_data/parser/err/0022_bad_exprs.rast180
-rw-r--r--crates/syntax/test_data/parser/err/0022_bad_exprs.rs3
-rw-r--r--crates/syntax/test_data/parser/err/0023_mismatched_paren.rast43
-rw-r--r--crates/syntax/test_data/parser/err/0023_mismatched_paren.rs5
-rw-r--r--crates/syntax/test_data/parser/err/0024_many_type_parens.rast319
-rw-r--r--crates/syntax/test_data/parser/err/0024_many_type_parens.rs7
-rw-r--r--crates/syntax/test_data/parser/err/0025_nope.rast202
-rw-r--r--crates/syntax/test_data/parser/err/0025_nope.rs31
-rw-r--r--crates/syntax/test_data/parser/err/0026_imp_recovery.rast49
-rw-r--r--crates/syntax/test_data/parser/err/0026_imp_recovery.rs2
-rw-r--r--crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast27
-rw-r--r--crates/syntax/test_data/parser/err/0027_incomplere_where_for.rs3
-rw-r--r--crates/syntax/test_data/parser/err/0029_field_completion.rast35
-rw-r--r--crates/syntax/test_data/parser/err/0029_field_completion.rs3
-rw-r--r--crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast121
-rw-r--r--crates/syntax/test_data/parser/err/0031_block_inner_attrs.rs15
-rw-r--r--crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast203
-rw-r--r--crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rs20
-rw-r--r--crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast66
-rw-r--r--crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rs7
-rw-r--r--crates/syntax/test_data/parser/err/0034_bad_box_pattern.rast95
-rw-r--r--crates/syntax/test_data/parser/err/0034_bad_box_pattern.rs6
-rw-r--r--crates/syntax/test_data/parser/err/0035_use_recover.rast53
-rw-r--r--crates/syntax/test_data/parser/err/0035_use_recover.rs5
-rw-r--r--crates/syntax/test_data/parser/err/0036_partial_use.rast51
-rw-r--r--crates/syntax/test_data/parser/err/0036_partial_use.rs2
-rw-r--r--crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast97
-rw-r--r--crates/syntax/test_data/parser/err/0037_visibility_in_traits.rs6
-rw-r--r--crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rast29
-rw-r--r--crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rs4
-rw-r--r--crates/syntax/test_data/parser/err/0039_lambda_recovery.rast82
-rw-r--r--crates/syntax/test_data/parser/err/0039_lambda_recovery.rs5
-rw-r--r--crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast91
-rw-r--r--crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs4
-rw-r--r--crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast70
-rw-r--r--crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rs4
-rw-r--r--crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast27
-rw-r--r--crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rs2
-rw-r--r--crates/syntax/test_data/parser/err/0043_weird_blocks.rast71
-rw-r--r--crates/syntax/test_data/parser/err/0043_weird_blocks.rs6
-rw-r--r--crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast240
-rw-r--r--crates/syntax/test_data/parser/err/0044_unexpected_for_type.rs9
-rw-r--r--crates/syntax/test_data/parser/err/0045_item_modifiers.rast45
-rw-r--r--crates/syntax/test_data/parser/err/0045_item_modifiers.rs2
-rw-r--r--crates/syntax/test_data/parser/fragments/expr/err/0000_truncated_add.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/expr/err/0000_truncated_add.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/expr/ok/0000_add.rast8
-rw-r--r--crates/syntax/test_data/parser/fragments/expr/ok/0000_add.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/item/err/0000_extra_keyword.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/item/err/0000_extra_keyword.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/item/ok/0000_fn.rast12
-rw-r--r--crates/syntax/test_data/parser/fragments/item/ok/0000_fn.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/path/err/0000_reserved_word.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/path/err/0000_reserved_word.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/path/err/0001_expression.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/path/err/0001_expression.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/path/ok/0000_single_ident.rast4
-rw-r--r--crates/syntax/test_data/parser/fragments/path/ok/0000_single_ident.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/path/ok/0001_multipart.rast14
-rw-r--r--crates/syntax/test_data/parser/fragments/path/ok/0001_multipart.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/pattern/err/0000_reserved_word.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/pattern/err/0000_reserved_word.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/pattern/err/0001_missing_paren.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/pattern/err/0001_missing_paren.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/pattern/ok/0000_enum.rast10
-rw-r--r--crates/syntax/test_data/parser/fragments/pattern/ok/0000_enum.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/type/err/0000_missing_close.rast1
-rw-r--r--crates/syntax/test_data/parser/fragments/type/err/0000_missing_close.rs1
-rw-r--r--crates/syntax/test_data/parser/fragments/type/ok/0000_result.rast22
-rw-r--r--crates/syntax/test_data/parser/fragments/type/ok/0000_result.rs1
-rw-r--r--crates/syntax/test_data/parser/fuzz-failures/0000.rs199
-rw-r--r--crates/syntax/test_data/parser/fuzz-failures/0001.rs106
-rw-r--r--crates/syntax/test_data/parser/fuzz-failures/0002.rs1
-rw-r--r--crates/syntax/test_data/parser/fuzz-failures/0003.rs1
-rw-r--r--crates/syntax/test_data/parser/fuzz-failures/0004.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast27
-rw-r--r--crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast28
-rw-r--r--crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast17
-rw-r--r--crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/err/0004_impl_type.rast79
-rw-r--r--crates/syntax/test_data/parser/inline/err/0004_impl_type.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast23
-rw-r--r--crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast35
-rw-r--r--crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast31
-rw-r--r--crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/err/0008_pub_expr.rast25
-rw-r--r--crates/syntax/test_data/parser/inline/err/0008_pub_expr.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast58
-rw-r--r--crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast52
-rw-r--r--crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/err/0013_static_underscore.rast21
-rw-r--r--crates/syntax/test_data/parser/inline/err/0013_static_underscore.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast48
-rw-r--r--crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast13
-rw-r--r--crates/syntax/test_data/parser/inline/err/0015_empty_segment.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast136
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast60
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast60
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0005_function_type_params.rast37
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0005_function_type_params.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0006_self_param.rast116
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0006_self_param.rs7
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast40
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0008_path_part.rast96
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0008_path_part.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0009_loop_expr.rast24
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0009_loop_expr.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0010_extern_block.rast9
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0010_extern_block.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0011_field_expr.rast59
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0011_field_expr.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast33
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast35
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0014_never_type.rast13
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0014_never_type.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast35
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0017_array_type.rast21
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0017_array_type.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast72
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0019_unary_expr.rast44
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0019_unary_expr.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0020_use_star.rast59
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0020_use_star.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast78
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast53
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0023_placeholder_type.rast13
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0023_placeholder_type.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0024_slice_pat.rast41
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0024_slice_pat.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0025_slice_type.rast17
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0025_slice_type.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast104
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0027_ref_pat.rast49
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0027_ref_pat.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast43
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0029_cast_expr.rast89
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0029_cast_expr.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0030_cond.rast202
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0030_cond.rs7
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0031_while_expr.rast84
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0031_while_expr.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast98
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast50
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast53
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0034_break_expr.rs8
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0037_qual_paths.rast78
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0037_qual_paths.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0038_full_range_expr.rast28
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0038_full_range_expr.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast55
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast62
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0041_trait_item.rast125
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0041_trait_item.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0042_call_expr.rast147
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0042_call_expr.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0043_use_alias.rast138
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0043_use_alias.rs8
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0044_block_items.rast28
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0044_block_items.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast46
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast20
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast81
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0050_fn_decl.rast22
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0050_fn_decl.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0051_unit_type.rast14
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0051_unit_type.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0052_path_type.rast70
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0052_path_type.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0053_path_expr.rast95
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0053_path_expr.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast44
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rast76
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rs8
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast110
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0056_where_clause.rs7
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0058_range_pat.rast82
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0058_range_pat.rs7
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0059_match_arms_commas.rast58
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0059_match_arms_commas.rs7
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0060_extern_crate.rast10
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0060_extern_crate.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0061_record_lit.rast124
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0061_record_lit.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rast66
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast23
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0063_impl_def_neg.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0064_if_expr.rast121
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0064_if_expr.rs7
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast43
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0066_match_arm.rast151
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0066_match_arm.rs9
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0067_crate_path.rast15
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0067_crate_path.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0068_union_items.rast46
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0068_union_items.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast37
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast50
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0071_match_expr.rast93
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0071_match_expr.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0072_return_expr.rast28
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0072_return_expr.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast20
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0073_type_item_type_params.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast59
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rs7
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0075_block.rast86
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0075_block.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0076_function_where_clause.rast39
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0076_function_where_clause.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0077_try_expr.rast25
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0077_try_expr.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0078_type_item.rast16
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0078_type_item.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0079_impl_def.rast14
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0079_impl_def.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0080_postfix_range.rast95
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0080_postfix_range.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0081_for_type.rast112
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0081_for_type.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0082_ref_expr.rast138
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0082_ref_expr.rs10
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0083_struct_items.rast87
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0083_struct_items.rs8
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0084_paren_type.rast19
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0084_paren_type.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast135
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rs12
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0086_function_ret_type.rast34
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0086_function_ret_type.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0088_break_ambiguity.rast65
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0088_break_ambiguity.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0090_type_param_default.rast22
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0090_type_param_default.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast23
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0093_index_expr.rast33
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0093_index_expr.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast28
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0095_placeholder_pat.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast123
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rs13
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0099_param_list.rast99
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0099_param_list.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0100_for_expr.rast34
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0100_for_expr.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast132
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0103_array_expr.rast54
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0103_array_expr.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast41
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0106_lambda_expr.rast135
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0106_lambda_expr.rs9
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0107_method_call_expr.rast62
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0107_method_call_expr.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0108_tuple_expr.rast38
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0108_tuple_expr.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0109_label.rast64
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0109_label.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0110_use_path.rast38
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0110_use_path.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0111_tuple_pat.rast89
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0111_tuple_pat.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0112_bind_pat.rast127
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0112_bind_pat.rs8
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast55
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0113_nocontentexpr.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast64
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast41
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rast43
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast40
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0118_match_guard.rast47
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0118_match_guard.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast80
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rs8
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast145
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rs12
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast65
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast50
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0123_param_list_vararg.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast31
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast47
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast97
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast57
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0129_marco_pat.rast36
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0129_marco_pat.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rast126
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rs9
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0130_try_block_expr.rast31
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0130_try_block_expr.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0131_existential_type.rast31
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0131_existential_type.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0132_box_expr.rast89
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0132_box_expr.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast62
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rs8
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0137_await_expr.rast69
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0137_await_expr.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast55
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0138_expression_after_block.rast64
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0138_expression_after_block.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast25
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast34
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0142_for_range_from.rast40
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0142_for_range_from.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0143_box_pat.rast110
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0143_box_pat.rs5
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast455
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rs25
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rast75
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rs4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0146_as_precedence.rast42
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0146_as_precedence.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0147_const_param.rast23
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0147_const_param.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0147_macro_def.rast45
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0147_macro_def.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0148_pub_macro_def.rast21
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rast47
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0150_impl_type_params.rast38
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0150_impl_type_params.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0151_fn.rast14
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0151_fn.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0151_trait_alias.rast128
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0151_trait_alias.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast36
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0152_impl.rast22
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0152_impl.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0153_trait.rast11
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0153_trait.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast58
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0155_closure_params.rast69
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0155_closure_params.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0156_fn_def_param.rast43
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0156_fn_def_param.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0156_or_pattern.rast111
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0156_or_pattern.rs8
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast26
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast30
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0157_variant_discriminant.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast36
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast43
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rast34
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0160_try_macro_rules.rast27
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0160_try_macro_rules.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast26
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0162_unsafe_block.rast23
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0162_unsafe_block.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rast44
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rs3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0164_default_item.rast24
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0164_default_item.rs1
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast38
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rs1
-rw-r--r--crates/syntax/test_data/parser/ok/0000_empty.rast1
-rw-r--r--crates/syntax/test_data/parser/ok/0000_empty.rs0
-rw-r--r--crates/syntax/test_data/parser/ok/0001_struct_item.rast39
-rw-r--r--crates/syntax/test_data/parser/ok/0001_struct_item.rs3
-rw-r--r--crates/syntax/test_data/parser/ok/0002_struct_item_field.rast22
-rw-r--r--crates/syntax/test_data/parser/ok/0002_struct_item_field.rs3
-rw-r--r--crates/syntax/test_data/parser/ok/0004_file_shebang.rast2
-rw-r--r--crates/syntax/test_data/parser/ok/0004_file_shebang.rs1
-rw-r--r--crates/syntax/test_data/parser/ok/0005_fn_item.rast15
-rw-r--r--crates/syntax/test_data/parser/ok/0005_fn_item.rs2
-rw-r--r--crates/syntax/test_data/parser/ok/0006_inner_attributes.rast184
-rw-r--r--crates/syntax/test_data/parser/ok/0006_inner_attributes.rs10
-rw-r--r--crates/syntax/test_data/parser/ok/0007_extern_crate.rast39
-rw-r--r--crates/syntax/test_data/parser/ok/0007_extern_crate.rs3
-rw-r--r--crates/syntax/test_data/parser/ok/0008_mod_item.rast92
-rw-r--r--crates/syntax/test_data/parser/ok/0008_mod_item.rs17
-rw-r--r--crates/syntax/test_data/parser/ok/0009_use_item.rast21
-rw-r--r--crates/syntax/test_data/parser/ok/0009_use_item.rs2
-rw-r--r--crates/syntax/test_data/parser/ok/0010_use_path_segments.rast42
-rw-r--r--crates/syntax/test_data/parser/ok/0010_use_path_segments.rs2
-rw-r--r--crates/syntax/test_data/parser/ok/0011_outer_attribute.rast57
-rw-r--r--crates/syntax/test_data/parser/ok/0011_outer_attribute.rs6
-rw-r--r--crates/syntax/test_data/parser/ok/0012_visibility.rast102
-rw-r--r--crates/syntax/test_data/parser/ok/0012_visibility.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0013_use_path_self_super.rast33
-rw-r--r--crates/syntax/test_data/parser/ok/0013_use_path_self_super.rs2
-rw-r--r--crates/syntax/test_data/parser/ok/0014_use_tree.rast95
-rw-r--r--crates/syntax/test_data/parser/ok/0014_use_tree.rs7
-rw-r--r--crates/syntax/test_data/parser/ok/0015_use_tree.rast65
-rw-r--r--crates/syntax/test_data/parser/ok/0015_use_tree.rs2
-rw-r--r--crates/syntax/test_data/parser/ok/0016_struct_flavors.rast93
-rw-r--r--crates/syntax/test_data/parser/ok/0016_struct_flavors.rs10
-rw-r--r--crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rast28
-rw-r--r--crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rs2
-rw-r--r--crates/syntax/test_data/parser/ok/0018_struct_type_params.rast257
-rw-r--r--crates/syntax/test_data/parser/ok/0018_struct_type_params.rs17
-rw-r--r--crates/syntax/test_data/parser/ok/0019_enums.rast155
-rw-r--r--crates/syntax/test_data/parser/ok/0019_enums.rs25
-rw-r--r--crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast268
-rw-r--r--crates/syntax/test_data/parser/ok/0020_type_param_bounds.rs10
-rw-r--r--crates/syntax/test_data/parser/ok/0022_empty_extern_block.rast21
-rw-r--r--crates/syntax/test_data/parser/ok/0022_empty_extern_block.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0023_static_items.rast41
-rw-r--r--crates/syntax/test_data/parser/ok/0023_static_items.rs2
-rw-r--r--crates/syntax/test_data/parser/ok/0024_const_item.rast59
-rw-r--r--crates/syntax/test_data/parser/ok/0024_const_item.rs3
-rw-r--r--crates/syntax/test_data/parser/ok/0025_extern_fn_in_block.rast31
-rw-r--r--crates/syntax/test_data/parser/ok/0025_extern_fn_in_block.rs3
-rw-r--r--crates/syntax/test_data/parser/ok/0026_const_fn_in_block.rast30
-rw-r--r--crates/syntax/test_data/parser/ok/0026_const_fn_in_block.rs3
-rw-r--r--crates/syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rast41
-rw-r--r--crates/syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rs4
-rw-r--r--crates/syntax/test_data/parser/ok/0028_operator_binding_power.rast185
-rw-r--r--crates/syntax/test_data/parser/ok/0028_operator_binding_power.rs14
-rw-r--r--crates/syntax/test_data/parser/ok/0029_range_forms.rast151
-rw-r--r--crates/syntax/test_data/parser/ok/0029_range_forms.rs11
-rw-r--r--crates/syntax/test_data/parser/ok/0030_string_suffixes.rast63
-rw-r--r--crates/syntax/test_data/parser/ok/0030_string_suffixes.rs6
-rw-r--r--crates/syntax/test_data/parser/ok/0030_traits.rast61
-rw-r--r--crates/syntax/test_data/parser/ok/0030_traits.rs7
-rw-r--r--crates/syntax/test_data/parser/ok/0031_extern.rast973
-rw-r--r--crates/syntax/test_data/parser/ok/0031_extern.rs29
-rw-r--r--crates/syntax/test_data/parser/ok/0032_where_for.rast90
-rw-r--r--crates/syntax/test_data/parser/ok/0032_where_for.rs4
-rw-r--r--crates/syntax/test_data/parser/ok/0033_label_break.rast215
-rw-r--r--crates/syntax/test_data/parser/ok/0033_label_break.rs28
-rw-r--r--crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rast41
-rw-r--r--crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rs3
-rw-r--r--crates/syntax/test_data/parser/ok/0035_weird_exprs.rast2291
-rw-r--r--crates/syntax/test_data/parser/ok/0035_weird_exprs.rs154
-rw-r--r--crates/syntax/test_data/parser/ok/0036_fully_qualified.rast92
-rw-r--r--crates/syntax/test_data/parser/ok/0036_fully_qualified.rs8
-rw-r--r--crates/syntax/test_data/parser/ok/0037_mod.rast16
-rw-r--r--crates/syntax/test_data/parser/ok/0037_mod.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0038_where_pred_type.rast42
-rw-r--r--crates/syntax/test_data/parser/ok/0038_where_pred_type.rs1
-rw-r--r--crates/syntax/test_data/parser/ok/0039_raw_fn_item.rast15
-rw-r--r--crates/syntax/test_data/parser/ok/0039_raw_fn_item.rs2
-rw-r--r--crates/syntax/test_data/parser/ok/0040_raw_struct_item_field.rast22
-rw-r--r--crates/syntax/test_data/parser/ok/0040_raw_struct_item_field.rs3
-rw-r--r--crates/syntax/test_data/parser/ok/0041_raw_keywords.rast49
-rw-r--r--crates/syntax/test_data/parser/ok/0041_raw_keywords.rs1
-rw-r--r--crates/syntax/test_data/parser/ok/0042_ufcs_call_list.rast123
-rw-r--r--crates/syntax/test_data/parser/ok/0042_ufcs_call_list.rs15
-rw-r--r--crates/syntax/test_data/parser/ok/0043_complex_assignment.rast109
-rw-r--r--crates/syntax/test_data/parser/ok/0043_complex_assignment.rs8
-rw-r--r--crates/syntax/test_data/parser/ok/0044_let_attrs.rast75
-rw-r--r--crates/syntax/test_data/parser/ok/0044_let_attrs.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast177
-rw-r--r--crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rs20
-rw-r--r--crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rast28
-rw-r--r--crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rs4
-rw-r--r--crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast320
-rw-r--r--crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rs27
-rw-r--r--crates/syntax/test_data/parser/ok/0048_compound_assignment.rast200
-rw-r--r--crates/syntax/test_data/parser/ok/0048_compound_assignment.rs17
-rw-r--r--crates/syntax/test_data/parser/ok/0049_async_block.rast35
-rw-r--r--crates/syntax/test_data/parser/ok/0049_async_block.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0050_async_block_as_argument.rast90
-rw-r--r--crates/syntax/test_data/parser/ok/0050_async_block_as_argument.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast508
-rw-r--r--crates/syntax/test_data/parser/ok/0051_parameter_attrs.rs21
-rw-r--r--crates/syntax/test_data/parser/ok/0052_for_range_block.rast78
-rw-r--r--crates/syntax/test_data/parser/ok/0052_for_range_block.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast39
-rw-r--r--crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast123
-rw-r--r--crates/syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0055_dot_dot_dot.rast49
-rw-r--r--crates/syntax/test_data/parser/ok/0055_dot_dot_dot.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0056_neq_in_type.rast64
-rw-r--r--crates/syntax/test_data/parser/ok/0056_neq_in_type.rs3
-rw-r--r--crates/syntax/test_data/parser/ok/0057_loop_in_call.rast56
-rw-r--r--crates/syntax/test_data/parser/ok/0057_loop_in_call.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0058_unary_expr_precedence.rast96
-rw-r--r--crates/syntax/test_data/parser/ok/0058_unary_expr_precedence.rs7
-rw-r--r--crates/syntax/test_data/parser/ok/0059_loops_in_parens.rast97
-rw-r--r--crates/syntax/test_data/parser/ok/0059_loops_in_parens.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0060_as_range.rast55
-rw-r--r--crates/syntax/test_data/parser/ok/0060_as_range.rs4
-rw-r--r--crates/syntax/test_data/parser/ok/0061_match_full_range.rast26
-rw-r--r--crates/syntax/test_data/parser/ok/0061_match_full_range.rs4
-rw-r--r--crates/syntax/test_data/parser/ok/0062_macro_2.0.rast175
-rw-r--r--crates/syntax/test_data/parser/ok/0062_macro_2.0.rs15
-rw-r--r--crates/syntax/test_data/parser/ok/0063_trait_fn_patterns.rast194
-rw-r--r--crates/syntax/test_data/parser/ok/0063_trait_fn_patterns.rs7
-rw-r--r--crates/syntax/test_data/parser/ok/0063_variadic_fun.rast133
-rw-r--r--crates/syntax/test_data/parser/ok/0063_variadic_fun.rs5
-rw-r--r--crates/syntax/test_data/parser/ok/0064_impl_fn_params.rast162
-rw-r--r--crates/syntax/test_data/parser/ok/0064_impl_fn_params.rs6
-rw-r--r--crates/syntax/test_data/parser/ok/0065_comment_newline.rast16
-rw-r--r--crates/syntax/test_data/parser/ok/0065_comment_newline.rs3
-rw-r--r--crates/syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast60
-rw-r--r--crates/syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rs1
-rw-r--r--crates/syntax/test_data/parser/ok/0066_default_modifier.rast218
-rw-r--r--crates/syntax/test_data/parser/ok/0066_default_modifier.rs16
-rw-r--r--crates/syntax/test_data/parser/ok/0067_where_for_pred.rast392
-rw-r--r--crates/syntax/test_data/parser/ok/0067_where_for_pred.rs30
-rw-r--r--crates/syntax/test_data/parser/ok/0068_item_modifiers.rast218
-rw-r--r--crates/syntax/test_data/parser/ok/0068_item_modifiers.rs16
-rw-r--r--crates/syntax/test_data/reparse/fuzz-failures/0000.rs6
-rw-r--r--crates/syntax/test_data/reparse/fuzz-failures/0001.rs4
-rw-r--r--crates/syntax/test_data/reparse/fuzz-failures/0002.rs4
-rw-r--r--crates/syntax/test_data/reparse/fuzz-failures/0003.rsbin0 -> 8 bytes
-rw-r--r--crates/syntax/test_data/reparse/fuzz-failures/0004.rs4
-rw-r--r--crates/syntax/test_data/reparse/fuzz-failures/0005.rs7
766 files changed, 40177 insertions, 0 deletions
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
new file mode 100644
index 000000000..6818f3ad8
--- /dev/null
+++ b/crates/syntax/Cargo.toml
@@ -0,0 +1,35 @@
1[package]
2name = "syntax"
3version = "0.0.0"
4description = "Comment and whitespace preserving parser for the Rust language"
5license = "MIT OR Apache-2.0"
6repository = "https://github.com/rust-analyzer/rust-analyzer"
7authors = ["rust-analyzer developers"]
8edition = "2018"
9
10[lib]
11doctest = false
12
13[dependencies]
14itertools = "0.9.0"
15rowan = "0.10.0"
16rustc_lexer = { version = "673.0.0", package = "rustc-ap-rustc_lexer" }
17rustc-hash = "1.1.0"
18arrayvec = "0.5.1"
19once_cell = "1.3.1"
20# This crate transitively depends on `smol_str` via `rowan`.
21# ideally, `serde` should be enabled by `rust-analyzer`, but we enable it here
22# to reduce number of compilations
23smol_str = { version = "0.1.15", features = ["serde"] }
24serde = { version = "1.0.106", features = ["derive"] }
25
26stdx = { path = "../stdx" }
27text_edit = { path = "../text_edit" }
28parser = { path = "../parser" }
29
30[dev-dependencies]
31walkdir = "2.3.1"
32rayon = "1"
33expect-test = "0.1"
34
35test_utils = { path = "../test_utils" }
diff --git a/crates/syntax/fuzz/.gitignore b/crates/syntax/fuzz/.gitignore
new file mode 100644
index 000000000..f734abd49
--- /dev/null
+++ b/crates/syntax/fuzz/.gitignore
@@ -0,0 +1,4 @@
1Cargo.lock
2target
3corpus
4artifacts
diff --git a/crates/syntax/fuzz/Cargo.toml b/crates/syntax/fuzz/Cargo.toml
new file mode 100644
index 000000000..32c40d1b9
--- /dev/null
+++ b/crates/syntax/fuzz/Cargo.toml
@@ -0,0 +1,27 @@
1
2[package]
3name = "syntax-fuzz"
4version = "0.0.1"
5authors = ["rust-analyzer developers"]
6publish = false
7edition = "2018"
8
9[package.metadata]
10cargo-fuzz = true
11
12[dependencies]
13syntax = { path = ".." }
14text_edit = { path = "../../text_edit" }
15libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" }
16
17# Prevent this from interfering with workspaces
18[workspace]
19members = ["."]
20
21[[bin]]
22name = "parser"
23path = "fuzz_targets/parser.rs"
24
25[[bin]]
26name = "reparse"
27path = "fuzz_targets/reparse.rs"
diff --git a/crates/syntax/fuzz/fuzz_targets/parser.rs b/crates/syntax/fuzz/fuzz_targets/parser.rs
new file mode 100644
index 000000000..386768343
--- /dev/null
+++ b/crates/syntax/fuzz/fuzz_targets/parser.rs
@@ -0,0 +1,11 @@
1//! FIXME: write short doc here
2
3#![no_main]
4use libfuzzer_sys::fuzz_target;
5use syntax::fuzz::check_parser;
6
7fuzz_target!(|data: &[u8]| {
8 if let Ok(text) = std::str::from_utf8(data) {
9 check_parser(text)
10 }
11});
diff --git a/crates/syntax/fuzz/fuzz_targets/reparse.rs b/crates/syntax/fuzz/fuzz_targets/reparse.rs
new file mode 100644
index 000000000..5ac99fdaf
--- /dev/null
+++ b/crates/syntax/fuzz/fuzz_targets/reparse.rs
@@ -0,0 +1,11 @@
1//! FIXME: write short doc here
2
3#![no_main]
4use libfuzzer_sys::fuzz_target;
5use syntax::fuzz::CheckReparse;
6
7fuzz_target!(|data: &[u8]| {
8 if let Some(check) = CheckReparse::from_data(data) {
9 check.run();
10 }
11});
diff --git a/crates/syntax/src/algo.rs b/crates/syntax/src/algo.rs
new file mode 100644
index 000000000..6254b38ba
--- /dev/null
+++ b/crates/syntax/src/algo.rs
@@ -0,0 +1,406 @@
1//! FIXME: write short doc here
2
3use std::{
4 fmt,
5 ops::{self, RangeInclusive},
6};
7
8use itertools::Itertools;
9use rustc_hash::FxHashMap;
10use text_edit::TextEditBuilder;
11
12use crate::{
13 AstNode, Direction, NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxNodePtr,
14 SyntaxToken, TextRange, TextSize,
15};
16
17/// Returns ancestors of the node at the offset, sorted by length. This should
18/// do the right thing at an edge, e.g. when searching for expressions at `{
19/// <|>foo }` we will get the name reference instead of the whole block, which
20/// we would get if we just did `find_token_at_offset(...).flat_map(|t|
21/// t.parent().ancestors())`.
22pub fn ancestors_at_offset(
23 node: &SyntaxNode,
24 offset: TextSize,
25) -> impl Iterator<Item = SyntaxNode> {
26 node.token_at_offset(offset)
27 .map(|token| token.parent().ancestors())
28 .kmerge_by(|node1, node2| node1.text_range().len() < node2.text_range().len())
29}
30
31/// Finds a node of specific Ast type at offset. Note that this is slightly
32/// imprecise: if the cursor is strictly between two nodes of the desired type,
33/// as in
34///
35/// ```no-run
36/// struct Foo {}|struct Bar;
37/// ```
38///
39/// then the shorter node will be silently preferred.
40pub fn find_node_at_offset<N: AstNode>(syntax: &SyntaxNode, offset: TextSize) -> Option<N> {
41 ancestors_at_offset(syntax, offset).find_map(N::cast)
42}
43
44pub fn find_node_at_range<N: AstNode>(syntax: &SyntaxNode, range: TextRange) -> Option<N> {
45 find_covering_element(syntax, range).ancestors().find_map(N::cast)
46}
47
48/// Skip to next non `trivia` token
49pub fn skip_trivia_token(mut token: SyntaxToken, direction: Direction) -> Option<SyntaxToken> {
50 while token.kind().is_trivia() {
51 token = match direction {
52 Direction::Next => token.next_token()?,
53 Direction::Prev => token.prev_token()?,
54 }
55 }
56 Some(token)
57}
58
59/// Finds the first sibling in the given direction which is not `trivia`
60pub fn non_trivia_sibling(element: SyntaxElement, direction: Direction) -> Option<SyntaxElement> {
61 return match element {
62 NodeOrToken::Node(node) => node.siblings_with_tokens(direction).skip(1).find(not_trivia),
63 NodeOrToken::Token(token) => token.siblings_with_tokens(direction).skip(1).find(not_trivia),
64 };
65
66 fn not_trivia(element: &SyntaxElement) -> bool {
67 match element {
68 NodeOrToken::Node(_) => true,
69 NodeOrToken::Token(token) => !token.kind().is_trivia(),
70 }
71 }
72}
73
74pub fn find_covering_element(root: &SyntaxNode, range: TextRange) -> SyntaxElement {
75 root.covering_element(range)
76}
77
78pub fn least_common_ancestor(u: &SyntaxNode, v: &SyntaxNode) -> Option<SyntaxNode> {
79 if u == v {
80 return Some(u.clone());
81 }
82
83 let u_depth = u.ancestors().count();
84 let v_depth = v.ancestors().count();
85 let keep = u_depth.min(v_depth);
86
87 let u_candidates = u.ancestors().skip(u_depth - keep);
88 let v_canidates = v.ancestors().skip(v_depth - keep);
89 let (res, _) = u_candidates.zip(v_canidates).find(|(x, y)| x == y)?;
90 Some(res)
91}
92
93pub fn neighbor<T: AstNode>(me: &T, direction: Direction) -> Option<T> {
94 me.syntax().siblings(direction).skip(1).find_map(T::cast)
95}
96
97pub fn has_errors(node: &SyntaxNode) -> bool {
98 node.children().any(|it| it.kind() == SyntaxKind::ERROR)
99}
100
101#[derive(Debug, PartialEq, Eq, Clone, Copy)]
102pub enum InsertPosition<T> {
103 First,
104 Last,
105 Before(T),
106 After(T),
107}
108
109pub struct TreeDiff {
110 replacements: FxHashMap<SyntaxElement, SyntaxElement>,
111}
112
113impl TreeDiff {
114 pub fn into_text_edit(&self, builder: &mut TextEditBuilder) {
115 for (from, to) in self.replacements.iter() {
116 builder.replace(from.text_range(), to.to_string())
117 }
118 }
119
120 pub fn is_empty(&self) -> bool {
121 self.replacements.is_empty()
122 }
123}
124
125/// Finds minimal the diff, which, applied to `from`, will result in `to`.
126///
127/// Specifically, returns a map whose keys are descendants of `from` and values
128/// are descendants of `to`, such that `replace_descendants(from, map) == to`.
129///
130/// A trivial solution is a singleton map `{ from: to }`, but this function
131/// tries to find a more fine-grained diff.
132pub fn diff(from: &SyntaxNode, to: &SyntaxNode) -> TreeDiff {
133 let mut buf = FxHashMap::default();
134 // FIXME: this is both horrible inefficient and gives larger than
135 // necessary diff. I bet there's a cool algorithm to diff trees properly.
136 go(&mut buf, from.clone().into(), to.clone().into());
137 return TreeDiff { replacements: buf };
138
139 fn go(
140 buf: &mut FxHashMap<SyntaxElement, SyntaxElement>,
141 lhs: SyntaxElement,
142 rhs: SyntaxElement,
143 ) {
144 if lhs.kind() == rhs.kind()
145 && lhs.text_range().len() == rhs.text_range().len()
146 && match (&lhs, &rhs) {
147 (NodeOrToken::Node(lhs), NodeOrToken::Node(rhs)) => {
148 lhs.green() == rhs.green() || lhs.text() == rhs.text()
149 }
150 (NodeOrToken::Token(lhs), NodeOrToken::Token(rhs)) => lhs.text() == rhs.text(),
151 _ => false,
152 }
153 {
154 return;
155 }
156 if let (Some(lhs), Some(rhs)) = (lhs.as_node(), rhs.as_node()) {
157 if lhs.children_with_tokens().count() == rhs.children_with_tokens().count() {
158 for (lhs, rhs) in lhs.children_with_tokens().zip(rhs.children_with_tokens()) {
159 go(buf, lhs, rhs)
160 }
161 return;
162 }
163 }
164 buf.insert(lhs, rhs);
165 }
166}
167
168/// Adds specified children (tokens or nodes) to the current node at the
169/// specific position.
170///
171/// This is a type-unsafe low-level editing API, if you need to use it,
172/// prefer to create a type-safe abstraction on top of it instead.
173pub fn insert_children(
174 parent: &SyntaxNode,
175 position: InsertPosition<SyntaxElement>,
176 to_insert: impl IntoIterator<Item = SyntaxElement>,
177) -> SyntaxNode {
178 let mut to_insert = to_insert.into_iter();
179 _insert_children(parent, position, &mut to_insert)
180}
181
182fn _insert_children(
183 parent: &SyntaxNode,
184 position: InsertPosition<SyntaxElement>,
185 to_insert: &mut dyn Iterator<Item = SyntaxElement>,
186) -> SyntaxNode {
187 let mut delta = TextSize::default();
188 let to_insert = to_insert.map(|element| {
189 delta += element.text_range().len();
190 to_green_element(element)
191 });
192
193 let mut old_children = parent.green().children().map(|it| match it {
194 NodeOrToken::Token(it) => NodeOrToken::Token(it.clone()),
195 NodeOrToken::Node(it) => NodeOrToken::Node(it.clone()),
196 });
197
198 let new_children = match &position {
199 InsertPosition::First => to_insert.chain(old_children).collect::<Vec<_>>(),
200 InsertPosition::Last => old_children.chain(to_insert).collect::<Vec<_>>(),
201 InsertPosition::Before(anchor) | InsertPosition::After(anchor) => {
202 let take_anchor = if let InsertPosition::After(_) = position { 1 } else { 0 };
203 let split_at = position_of_child(parent, anchor.clone()) + take_anchor;
204 let before = old_children.by_ref().take(split_at).collect::<Vec<_>>();
205 before.into_iter().chain(to_insert).chain(old_children).collect::<Vec<_>>()
206 }
207 };
208
209 with_children(parent, new_children)
210}
211
212/// Replaces all nodes in `to_delete` with nodes from `to_insert`
213///
214/// This is a type-unsafe low-level editing API, if you need to use it,
215/// prefer to create a type-safe abstraction on top of it instead.
216pub fn replace_children(
217 parent: &SyntaxNode,
218 to_delete: RangeInclusive<SyntaxElement>,
219 to_insert: impl IntoIterator<Item = SyntaxElement>,
220) -> SyntaxNode {
221 let mut to_insert = to_insert.into_iter();
222 _replace_children(parent, to_delete, &mut to_insert)
223}
224
225fn _replace_children(
226 parent: &SyntaxNode,
227 to_delete: RangeInclusive<SyntaxElement>,
228 to_insert: &mut dyn Iterator<Item = SyntaxElement>,
229) -> SyntaxNode {
230 let start = position_of_child(parent, to_delete.start().clone());
231 let end = position_of_child(parent, to_delete.end().clone());
232 let mut old_children = parent.green().children().map(|it| match it {
233 NodeOrToken::Token(it) => NodeOrToken::Token(it.clone()),
234 NodeOrToken::Node(it) => NodeOrToken::Node(it.clone()),
235 });
236
237 let before = old_children.by_ref().take(start).collect::<Vec<_>>();
238 let new_children = before
239 .into_iter()
240 .chain(to_insert.map(to_green_element))
241 .chain(old_children.skip(end + 1 - start))
242 .collect::<Vec<_>>();
243 with_children(parent, new_children)
244}
245
246#[derive(Default)]
247pub struct SyntaxRewriter<'a> {
248 f: Option<Box<dyn Fn(&SyntaxElement) -> Option<SyntaxElement> + 'a>>,
249 //FIXME: add debug_assertions that all elements are in fact from the same file.
250 replacements: FxHashMap<SyntaxElement, Replacement>,
251}
252
253impl fmt::Debug for SyntaxRewriter<'_> {
254 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
255 f.debug_struct("SyntaxRewriter").field("replacements", &self.replacements).finish()
256 }
257}
258
259impl<'a> SyntaxRewriter<'a> {
260 pub fn from_fn(f: impl Fn(&SyntaxElement) -> Option<SyntaxElement> + 'a) -> SyntaxRewriter<'a> {
261 SyntaxRewriter { f: Some(Box::new(f)), replacements: FxHashMap::default() }
262 }
263 pub fn delete<T: Clone + Into<SyntaxElement>>(&mut self, what: &T) {
264 let what = what.clone().into();
265 let replacement = Replacement::Delete;
266 self.replacements.insert(what, replacement);
267 }
268 pub fn replace<T: Clone + Into<SyntaxElement>>(&mut self, what: &T, with: &T) {
269 let what = what.clone().into();
270 let replacement = Replacement::Single(with.clone().into());
271 self.replacements.insert(what, replacement);
272 }
273 pub fn replace_with_many<T: Clone + Into<SyntaxElement>>(
274 &mut self,
275 what: &T,
276 with: Vec<SyntaxElement>,
277 ) {
278 let what = what.clone().into();
279 let replacement = Replacement::Many(with);
280 self.replacements.insert(what, replacement);
281 }
282 pub fn replace_ast<T: AstNode>(&mut self, what: &T, with: &T) {
283 self.replace(what.syntax(), with.syntax())
284 }
285
286 pub fn rewrite(&self, node: &SyntaxNode) -> SyntaxNode {
287 if self.f.is_none() && self.replacements.is_empty() {
288 return node.clone();
289 }
290 self.rewrite_children(node)
291 }
292
293 pub fn rewrite_ast<N: AstNode>(self, node: &N) -> N {
294 N::cast(self.rewrite(node.syntax())).unwrap()
295 }
296
297 /// Returns a node that encompasses all replacements to be done by this rewriter.
298 ///
299 /// Passing the returned node to `rewrite` will apply all replacements queued up in `self`.
300 ///
301 /// Returns `None` when there are no replacements.
302 pub fn rewrite_root(&self) -> Option<SyntaxNode> {
303 assert!(self.f.is_none());
304 self.replacements
305 .keys()
306 .map(|element| match element {
307 SyntaxElement::Node(it) => it.clone(),
308 SyntaxElement::Token(it) => it.parent(),
309 })
310 // If we only have one replacement, we must return its parent node, since `rewrite` does
311 // not replace the node passed to it.
312 .map(|it| it.parent().unwrap_or(it))
313 .fold1(|a, b| least_common_ancestor(&a, &b).unwrap())
314 }
315
316 fn replacement(&self, element: &SyntaxElement) -> Option<Replacement> {
317 if let Some(f) = &self.f {
318 assert!(self.replacements.is_empty());
319 return f(element).map(Replacement::Single);
320 }
321 self.replacements.get(element).cloned()
322 }
323
324 fn rewrite_children(&self, node: &SyntaxNode) -> SyntaxNode {
325 // FIXME: this could be made much faster.
326 let mut new_children = Vec::new();
327 for child in node.children_with_tokens() {
328 self.rewrite_self(&mut new_children, &child);
329 }
330 with_children(node, new_children)
331 }
332
333 fn rewrite_self(
334 &self,
335 acc: &mut Vec<NodeOrToken<rowan::GreenNode, rowan::GreenToken>>,
336 element: &SyntaxElement,
337 ) {
338 if let Some(replacement) = self.replacement(&element) {
339 match replacement {
340 Replacement::Single(NodeOrToken::Node(it)) => {
341 acc.push(NodeOrToken::Node(it.green().clone()))
342 }
343 Replacement::Single(NodeOrToken::Token(it)) => {
344 acc.push(NodeOrToken::Token(it.green().clone()))
345 }
346 Replacement::Many(replacements) => {
347 acc.extend(replacements.iter().map(|it| match it {
348 NodeOrToken::Node(it) => NodeOrToken::Node(it.green().clone()),
349 NodeOrToken::Token(it) => NodeOrToken::Token(it.green().clone()),
350 }))
351 }
352 Replacement::Delete => (),
353 };
354 return;
355 }
356 let res = match element {
357 NodeOrToken::Token(it) => NodeOrToken::Token(it.green().clone()),
358 NodeOrToken::Node(it) => NodeOrToken::Node(self.rewrite_children(it).green().clone()),
359 };
360 acc.push(res)
361 }
362}
363
364impl ops::AddAssign for SyntaxRewriter<'_> {
365 fn add_assign(&mut self, rhs: SyntaxRewriter) {
366 assert!(rhs.f.is_none());
367 self.replacements.extend(rhs.replacements)
368 }
369}
370
371#[derive(Clone, Debug)]
372enum Replacement {
373 Delete,
374 Single(SyntaxElement),
375 Many(Vec<SyntaxElement>),
376}
377
378fn with_children(
379 parent: &SyntaxNode,
380 new_children: Vec<NodeOrToken<rowan::GreenNode, rowan::GreenToken>>,
381) -> SyntaxNode {
382 let len = new_children.iter().map(|it| it.text_len()).sum::<TextSize>();
383 let new_node = rowan::GreenNode::new(rowan::SyntaxKind(parent.kind() as u16), new_children);
384 let new_root_node = parent.replace_with(new_node);
385 let new_root_node = SyntaxNode::new_root(new_root_node);
386
387 // FIXME: use a more elegant way to re-fetch the node (#1185), make
388 // `range` private afterwards
389 let mut ptr = SyntaxNodePtr::new(parent);
390 ptr.range = TextRange::at(ptr.range.start(), len);
391 ptr.to_node(&new_root_node)
392}
393
394fn position_of_child(parent: &SyntaxNode, child: SyntaxElement) -> usize {
395 parent
396 .children_with_tokens()
397 .position(|it| it == child)
398 .expect("element is not a child of current element")
399}
400
401fn to_green_element(element: SyntaxElement) -> NodeOrToken<rowan::GreenNode, rowan::GreenToken> {
402 match element {
403 NodeOrToken::Node(it) => it.green().clone().into(),
404 NodeOrToken::Token(it) => it.green().clone().into(),
405 }
406}
diff --git a/crates/syntax/src/ast.rs b/crates/syntax/src/ast.rs
new file mode 100644
index 000000000..d536bb1e7
--- /dev/null
+++ b/crates/syntax/src/ast.rs
@@ -0,0 +1,331 @@
1//! Abstract Syntax Tree, layered on top of untyped `SyntaxNode`s
2
3mod generated;
4mod traits;
5mod token_ext;
6mod node_ext;
7mod expr_ext;
8pub mod edit;
9pub mod make;
10
11use std::marker::PhantomData;
12
13use crate::{
14 syntax_node::{SyntaxNode, SyntaxNodeChildren, SyntaxToken},
15 SmolStr, SyntaxKind,
16};
17
18pub use self::{
19 expr_ext::{ArrayExprKind, BinOp, Effect, ElseBranch, LiteralKind, PrefixOp, RangeOp},
20 generated::*,
21 node_ext::{
22 AttrKind, FieldKind, NameOrNameRef, PathSegmentKind, SelfParamKind, SlicePatComponents,
23 StructKind, TypeBoundKind, VisibilityKind,
24 },
25 token_ext::*,
26 traits::*,
27};
28
29/// The main trait to go from untyped `SyntaxNode` to a typed ast. The
30/// conversion itself has zero runtime cost: ast and syntax nodes have exactly
31/// the same representation: a pointer to the tree root and a pointer to the
32/// node itself.
33pub trait AstNode {
34 fn can_cast(kind: SyntaxKind) -> bool
35 where
36 Self: Sized;
37
38 fn cast(syntax: SyntaxNode) -> Option<Self>
39 where
40 Self: Sized;
41
42 fn syntax(&self) -> &SyntaxNode;
43}
44
45/// Like `AstNode`, but wraps tokens rather than interior nodes.
46pub trait AstToken {
47 fn can_cast(token: SyntaxKind) -> bool
48 where
49 Self: Sized;
50
51 fn cast(syntax: SyntaxToken) -> Option<Self>
52 where
53 Self: Sized;
54
55 fn syntax(&self) -> &SyntaxToken;
56
57 fn text(&self) -> &SmolStr {
58 self.syntax().text()
59 }
60}
61
62/// An iterator over `SyntaxNode` children of a particular AST type.
63#[derive(Debug, Clone)]
64pub struct AstChildren<N> {
65 inner: SyntaxNodeChildren,
66 ph: PhantomData<N>,
67}
68
69impl<N> AstChildren<N> {
70 fn new(parent: &SyntaxNode) -> Self {
71 AstChildren { inner: parent.children(), ph: PhantomData }
72 }
73}
74
75impl<N: AstNode> Iterator for AstChildren<N> {
76 type Item = N;
77 fn next(&mut self) -> Option<N> {
78 self.inner.find_map(N::cast)
79 }
80}
81
82mod support {
83 use super::{AstChildren, AstNode, SyntaxKind, SyntaxNode, SyntaxToken};
84
85 pub(super) fn child<N: AstNode>(parent: &SyntaxNode) -> Option<N> {
86 parent.children().find_map(N::cast)
87 }
88
89 pub(super) fn children<N: AstNode>(parent: &SyntaxNode) -> AstChildren<N> {
90 AstChildren::new(parent)
91 }
92
93 pub(super) fn token(parent: &SyntaxNode, kind: SyntaxKind) -> Option<SyntaxToken> {
94 parent.children_with_tokens().filter_map(|it| it.into_token()).find(|it| it.kind() == kind)
95 }
96}
97
98#[test]
99fn assert_ast_is_object_safe() {
100 fn _f(_: &dyn AstNode, _: &dyn NameOwner) {}
101}
102
103#[test]
104fn test_doc_comment_none() {
105 let file = SourceFile::parse(
106 r#"
107 // non-doc
108 mod foo {}
109 "#,
110 )
111 .ok()
112 .unwrap();
113 let module = file.syntax().descendants().find_map(Module::cast).unwrap();
114 assert!(module.doc_comment_text().is_none());
115}
116
117#[test]
118fn test_doc_comment_of_items() {
119 let file = SourceFile::parse(
120 r#"
121 //! doc
122 // non-doc
123 mod foo {}
124 "#,
125 )
126 .ok()
127 .unwrap();
128 let module = file.syntax().descendants().find_map(Module::cast).unwrap();
129 assert_eq!("doc", module.doc_comment_text().unwrap());
130}
131
132#[test]
133fn test_doc_comment_of_statics() {
134 let file = SourceFile::parse(
135 r#"
136 /// Number of levels
137 static LEVELS: i32 = 0;
138 "#,
139 )
140 .ok()
141 .unwrap();
142 let st = file.syntax().descendants().find_map(Static::cast).unwrap();
143 assert_eq!("Number of levels", st.doc_comment_text().unwrap());
144}
145
146#[test]
147fn test_doc_comment_preserves_indents() {
148 let file = SourceFile::parse(
149 r#"
150 /// doc1
151 /// ```
152 /// fn foo() {
153 /// // ...
154 /// }
155 /// ```
156 mod foo {}
157 "#,
158 )
159 .ok()
160 .unwrap();
161 let module = file.syntax().descendants().find_map(Module::cast).unwrap();
162 assert_eq!("doc1\n```\nfn foo() {\n // ...\n}\n```", module.doc_comment_text().unwrap());
163}
164
165#[test]
166fn test_doc_comment_preserves_newlines() {
167 let file = SourceFile::parse(
168 r#"
169 /// this
170 /// is
171 /// mod
172 /// foo
173 mod foo {}
174 "#,
175 )
176 .ok()
177 .unwrap();
178 let module = file.syntax().descendants().find_map(Module::cast).unwrap();
179 assert_eq!("this\nis\nmod\nfoo", module.doc_comment_text().unwrap());
180}
181
182#[test]
183fn test_doc_comment_single_line_block_strips_suffix() {
184 let file = SourceFile::parse(
185 r#"
186 /** this is mod foo*/
187 mod foo {}
188 "#,
189 )
190 .ok()
191 .unwrap();
192 let module = file.syntax().descendants().find_map(Module::cast).unwrap();
193 assert_eq!("this is mod foo", module.doc_comment_text().unwrap());
194}
195
196#[test]
197fn test_doc_comment_single_line_block_strips_suffix_whitespace() {
198 let file = SourceFile::parse(
199 r#"
200 /** this is mod foo */
201 mod foo {}
202 "#,
203 )
204 .ok()
205 .unwrap();
206 let module = file.syntax().descendants().find_map(Module::cast).unwrap();
207 assert_eq!("this is mod foo ", module.doc_comment_text().unwrap());
208}
209
210#[test]
211fn test_doc_comment_multi_line_block_strips_suffix() {
212 let file = SourceFile::parse(
213 r#"
214 /**
215 this
216 is
217 mod foo
218 */
219 mod foo {}
220 "#,
221 )
222 .ok()
223 .unwrap();
224 let module = file.syntax().descendants().find_map(Module::cast).unwrap();
225 assert_eq!(
226 " this\n is\n mod foo\n ",
227 module.doc_comment_text().unwrap()
228 );
229}
230
231#[test]
232fn test_comments_preserve_trailing_whitespace() {
233 let file = SourceFile::parse(
234 "\n/// Representation of a Realm. \n/// In the specification these are called Realm Records.\nstruct Realm {}",
235 )
236 .ok()
237 .unwrap();
238 let def = file.syntax().descendants().find_map(Struct::cast).unwrap();
239 assert_eq!(
240 "Representation of a Realm. \nIn the specification these are called Realm Records.",
241 def.doc_comment_text().unwrap()
242 );
243}
244
245#[test]
246fn test_four_slash_line_comment() {
247 let file = SourceFile::parse(
248 r#"
249 //// too many slashes to be a doc comment
250 /// doc comment
251 mod foo {}
252 "#,
253 )
254 .ok()
255 .unwrap();
256 let module = file.syntax().descendants().find_map(Module::cast).unwrap();
257 assert_eq!("doc comment", module.doc_comment_text().unwrap());
258}
259
260#[test]
261fn test_where_predicates() {
262 fn assert_bound(text: &str, bound: Option<TypeBound>) {
263 assert_eq!(text, bound.unwrap().syntax().text().to_string());
264 }
265
266 let file = SourceFile::parse(
267 r#"
268fn foo()
269where
270 T: Clone + Copy + Debug + 'static,
271 'a: 'b + 'c,
272 Iterator::Item: 'a + Debug,
273 Iterator::Item: Debug + 'a,
274 <T as Iterator>::Item: Debug + 'a,
275 for<'a> F: Fn(&'a str)
276{}
277 "#,
278 )
279 .ok()
280 .unwrap();
281 let where_clause = file.syntax().descendants().find_map(WhereClause::cast).unwrap();
282
283 let mut predicates = where_clause.predicates();
284
285 let pred = predicates.next().unwrap();
286 let mut bounds = pred.type_bound_list().unwrap().bounds();
287
288 assert!(pred.for_token().is_none());
289 assert!(pred.generic_param_list().is_none());
290 assert_eq!("T", pred.ty().unwrap().syntax().text().to_string());
291 assert_bound("Clone", bounds.next());
292 assert_bound("Copy", bounds.next());
293 assert_bound("Debug", bounds.next());
294 assert_bound("'static", bounds.next());
295
296 let pred = predicates.next().unwrap();
297 let mut bounds = pred.type_bound_list().unwrap().bounds();
298
299 assert_eq!("'a", pred.lifetime_token().unwrap().text());
300
301 assert_bound("'b", bounds.next());
302 assert_bound("'c", bounds.next());
303
304 let pred = predicates.next().unwrap();
305 let mut bounds = pred.type_bound_list().unwrap().bounds();
306
307 assert_eq!("Iterator::Item", pred.ty().unwrap().syntax().text().to_string());
308 assert_bound("'a", bounds.next());
309
310 let pred = predicates.next().unwrap();
311 let mut bounds = pred.type_bound_list().unwrap().bounds();
312
313 assert_eq!("Iterator::Item", pred.ty().unwrap().syntax().text().to_string());
314 assert_bound("Debug", bounds.next());
315 assert_bound("'a", bounds.next());
316
317 let pred = predicates.next().unwrap();
318 let mut bounds = pred.type_bound_list().unwrap().bounds();
319
320 assert_eq!("<T as Iterator>::Item", pred.ty().unwrap().syntax().text().to_string());
321 assert_bound("Debug", bounds.next());
322 assert_bound("'a", bounds.next());
323
324 let pred = predicates.next().unwrap();
325 let mut bounds = pred.type_bound_list().unwrap().bounds();
326
327 assert!(pred.for_token().is_some());
328 assert_eq!("<'a>", pred.generic_param_list().unwrap().syntax().text().to_string());
329 assert_eq!("F", pred.ty().unwrap().syntax().text().to_string());
330 assert_bound("Fn(&'a str)", bounds.next());
331}
diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs
new file mode 100644
index 000000000..060b20966
--- /dev/null
+++ b/crates/syntax/src/ast/edit.rs
@@ -0,0 +1,673 @@
1//! This module contains functions for editing syntax trees. As the trees are
2//! immutable, all function here return a fresh copy of the tree, instead of
3//! doing an in-place modification.
4use std::{
5 fmt, iter,
6 ops::{self, RangeInclusive},
7};
8
9use arrayvec::ArrayVec;
10
11use crate::{
12 algo::{self, neighbor, SyntaxRewriter},
13 ast::{
14 self,
15 make::{self, tokens},
16 AstNode, TypeBoundsOwner,
17 },
18 AstToken, Direction, InsertPosition, SmolStr, SyntaxElement, SyntaxKind,
19 SyntaxKind::{ATTR, COMMENT, WHITESPACE},
20 SyntaxNode, SyntaxToken, T,
21};
22
23impl ast::BinExpr {
24 #[must_use]
25 pub fn replace_op(&self, op: SyntaxKind) -> Option<ast::BinExpr> {
26 let op_node: SyntaxElement = self.op_details()?.0.into();
27 let to_insert: Option<SyntaxElement> = Some(make::token(op).into());
28 Some(self.replace_children(single_node(op_node), to_insert))
29 }
30}
31
32impl ast::Fn {
33 #[must_use]
34 pub fn with_body(&self, body: ast::BlockExpr) -> ast::Fn {
35 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new();
36 let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() {
37 old_body.syntax().clone().into()
38 } else if let Some(semi) = self.semicolon_token() {
39 to_insert.push(make::tokens::single_space().into());
40 semi.into()
41 } else {
42 to_insert.push(make::tokens::single_space().into());
43 to_insert.push(body.syntax().clone().into());
44 return self.insert_children(InsertPosition::Last, to_insert);
45 };
46 to_insert.push(body.syntax().clone().into());
47 self.replace_children(single_node(old_body_or_semi), to_insert)
48 }
49}
50
51fn make_multiline<N>(node: N) -> N
52where
53 N: AstNode + Clone,
54{
55 let l_curly = match node.syntax().children_with_tokens().find(|it| it.kind() == T!['{']) {
56 Some(it) => it,
57 None => return node,
58 };
59 let sibling = match l_curly.next_sibling_or_token() {
60 Some(it) => it,
61 None => return node,
62 };
63 let existing_ws = match sibling.as_token() {
64 None => None,
65 Some(tok) if tok.kind() != WHITESPACE => None,
66 Some(ws) => {
67 if ws.text().contains('\n') {
68 return node;
69 }
70 Some(ws.clone())
71 }
72 };
73
74 let indent = leading_indent(node.syntax()).unwrap_or_default();
75 let ws = tokens::WsBuilder::new(&format!("\n{}", indent));
76 let to_insert = iter::once(ws.ws().into());
77 match existing_ws {
78 None => node.insert_children(InsertPosition::After(l_curly), to_insert),
79 Some(ws) => node.replace_children(single_node(ws), to_insert),
80 }
81}
82
83impl ast::AssocItemList {
84 #[must_use]
85 pub fn append_items(
86 &self,
87 items: impl IntoIterator<Item = ast::AssocItem>,
88 ) -> ast::AssocItemList {
89 let mut res = self.clone();
90 if !self.syntax().text().contains_char('\n') {
91 res = make_multiline(res);
92 }
93 items.into_iter().for_each(|it| res = res.append_item(it));
94 res.fixup_trailing_whitespace().unwrap_or(res)
95 }
96
97 #[must_use]
98 pub fn append_item(&self, item: ast::AssocItem) -> ast::AssocItemList {
99 let (indent, position, whitespace) = match self.assoc_items().last() {
100 Some(it) => (
101 leading_indent(it.syntax()).unwrap_or_default().to_string(),
102 InsertPosition::After(it.syntax().clone().into()),
103 "\n\n",
104 ),
105 None => match self.l_curly_token() {
106 Some(it) => (
107 " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(),
108 InsertPosition::After(it.into()),
109 "\n",
110 ),
111 None => return self.clone(),
112 },
113 };
114 let ws = tokens::WsBuilder::new(&format!("{}{}", whitespace, indent));
115 let to_insert: ArrayVec<[SyntaxElement; 2]> =
116 [ws.ws().into(), item.syntax().clone().into()].into();
117 self.insert_children(position, to_insert)
118 }
119
120 /// Remove extra whitespace between last item and closing curly brace.
121 fn fixup_trailing_whitespace(&self) -> Option<ast::AssocItemList> {
122 let first_token_after_items =
123 self.assoc_items().last()?.syntax().next_sibling_or_token()?;
124 let last_token_before_curly = self.r_curly_token()?.prev_sibling_or_token()?;
125 if last_token_before_curly != first_token_after_items {
126 // there is something more between last item and
127 // right curly than just whitespace - bail out
128 return None;
129 }
130 let whitespace =
131 last_token_before_curly.clone().into_token().and_then(ast::Whitespace::cast)?;
132 let text = whitespace.syntax().text();
133 let newline = text.rfind("\n")?;
134 let keep = tokens::WsBuilder::new(&text[newline..]);
135 Some(self.replace_children(
136 first_token_after_items..=last_token_before_curly,
137 std::iter::once(keep.ws().into()),
138 ))
139 }
140}
141
142impl ast::RecordExprFieldList {
143 #[must_use]
144 pub fn append_field(&self, field: &ast::RecordExprField) -> ast::RecordExprFieldList {
145 self.insert_field(InsertPosition::Last, field)
146 }
147
148 #[must_use]
149 pub fn insert_field(
150 &self,
151 position: InsertPosition<&'_ ast::RecordExprField>,
152 field: &ast::RecordExprField,
153 ) -> ast::RecordExprFieldList {
154 let is_multiline = self.syntax().text().contains_char('\n');
155 let ws;
156 let space = if is_multiline {
157 ws = tokens::WsBuilder::new(&format!(
158 "\n{} ",
159 leading_indent(self.syntax()).unwrap_or_default()
160 ));
161 ws.ws()
162 } else {
163 tokens::single_space()
164 };
165
166 let mut to_insert: ArrayVec<[SyntaxElement; 4]> = ArrayVec::new();
167 to_insert.push(space.into());
168 to_insert.push(field.syntax().clone().into());
169 to_insert.push(make::token(T![,]).into());
170
171 macro_rules! after_l_curly {
172 () => {{
173 let anchor = match self.l_curly_token() {
174 Some(it) => it.into(),
175 None => return self.clone(),
176 };
177 InsertPosition::After(anchor)
178 }};
179 }
180
181 macro_rules! after_field {
182 ($anchor:expr) => {
183 if let Some(comma) = $anchor
184 .syntax()
185 .siblings_with_tokens(Direction::Next)
186 .find(|it| it.kind() == T![,])
187 {
188 InsertPosition::After(comma)
189 } else {
190 to_insert.insert(0, make::token(T![,]).into());
191 InsertPosition::After($anchor.syntax().clone().into())
192 }
193 };
194 };
195
196 let position = match position {
197 InsertPosition::First => after_l_curly!(),
198 InsertPosition::Last => {
199 if !is_multiline {
200 // don't insert comma before curly
201 to_insert.pop();
202 }
203 match self.fields().last() {
204 Some(it) => after_field!(it),
205 None => after_l_curly!(),
206 }
207 }
208 InsertPosition::Before(anchor) => {
209 InsertPosition::Before(anchor.syntax().clone().into())
210 }
211 InsertPosition::After(anchor) => after_field!(anchor),
212 };
213
214 self.insert_children(position, to_insert)
215 }
216}
217
218impl ast::TypeAlias {
219 #[must_use]
220 pub fn remove_bounds(&self) -> ast::TypeAlias {
221 let colon = match self.colon_token() {
222 Some(it) => it,
223 None => return self.clone(),
224 };
225 let end = match self.type_bound_list() {
226 Some(it) => it.syntax().clone().into(),
227 None => colon.clone().into(),
228 };
229 self.replace_children(colon.into()..=end, iter::empty())
230 }
231}
232
233impl ast::TypeParam {
234 #[must_use]
235 pub fn remove_bounds(&self) -> ast::TypeParam {
236 let colon = match self.colon_token() {
237 Some(it) => it,
238 None => return self.clone(),
239 };
240 let end = match self.type_bound_list() {
241 Some(it) => it.syntax().clone().into(),
242 None => colon.clone().into(),
243 };
244 self.replace_children(colon.into()..=end, iter::empty())
245 }
246}
247
248impl ast::Path {
249 #[must_use]
250 pub fn with_segment(&self, segment: ast::PathSegment) -> ast::Path {
251 if let Some(old) = self.segment() {
252 return self.replace_children(
253 single_node(old.syntax().clone()),
254 iter::once(segment.syntax().clone().into()),
255 );
256 }
257 self.clone()
258 }
259}
260
261impl ast::PathSegment {
262 #[must_use]
263 pub fn with_type_args(&self, type_args: ast::GenericArgList) -> ast::PathSegment {
264 self._with_type_args(type_args, false)
265 }
266
267 #[must_use]
268 pub fn with_turbo_fish(&self, type_args: ast::GenericArgList) -> ast::PathSegment {
269 self._with_type_args(type_args, true)
270 }
271
272 fn _with_type_args(&self, type_args: ast::GenericArgList, turbo: bool) -> ast::PathSegment {
273 if let Some(old) = self.generic_arg_list() {
274 return self.replace_children(
275 single_node(old.syntax().clone()),
276 iter::once(type_args.syntax().clone().into()),
277 );
278 }
279 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new();
280 if turbo {
281 to_insert.push(make::token(T![::]).into());
282 }
283 to_insert.push(type_args.syntax().clone().into());
284 self.insert_children(InsertPosition::Last, to_insert)
285 }
286}
287
288impl ast::Use {
289 #[must_use]
290 pub fn with_use_tree(&self, use_tree: ast::UseTree) -> ast::Use {
291 if let Some(old) = self.use_tree() {
292 return self.replace_descendant(old, use_tree);
293 }
294 self.clone()
295 }
296
297 pub fn remove(&self) -> SyntaxRewriter<'static> {
298 let mut res = SyntaxRewriter::default();
299 res.delete(self.syntax());
300 let next_ws = self
301 .syntax()
302 .next_sibling_or_token()
303 .and_then(|it| it.into_token())
304 .and_then(ast::Whitespace::cast);
305 if let Some(next_ws) = next_ws {
306 let ws_text = next_ws.syntax().text();
307 if ws_text.starts_with('\n') {
308 let rest = &ws_text[1..];
309 if rest.is_empty() {
310 res.delete(next_ws.syntax())
311 } else {
312 res.replace(next_ws.syntax(), &make::tokens::whitespace(rest));
313 }
314 }
315 }
316 res
317 }
318}
319
320impl ast::UseTree {
321 #[must_use]
322 pub fn with_path(&self, path: ast::Path) -> ast::UseTree {
323 if let Some(old) = self.path() {
324 return self.replace_descendant(old, path);
325 }
326 self.clone()
327 }
328
329 #[must_use]
330 pub fn with_use_tree_list(&self, use_tree_list: ast::UseTreeList) -> ast::UseTree {
331 if let Some(old) = self.use_tree_list() {
332 return self.replace_descendant(old, use_tree_list);
333 }
334 self.clone()
335 }
336
337 #[must_use]
338 pub fn split_prefix(&self, prefix: &ast::Path) -> ast::UseTree {
339 let suffix = if self.path().as_ref() == Some(prefix) && self.use_tree_list().is_none() {
340 make::path_unqualified(make::path_segment_self())
341 } else {
342 match split_path_prefix(&prefix) {
343 Some(it) => it,
344 None => return self.clone(),
345 }
346 };
347
348 let use_tree = make::use_tree(
349 suffix,
350 self.use_tree_list(),
351 self.rename(),
352 self.star_token().is_some(),
353 );
354 let nested = make::use_tree_list(iter::once(use_tree));
355 return make::use_tree(prefix.clone(), Some(nested), None, false);
356
357 fn split_path_prefix(prefix: &ast::Path) -> Option<ast::Path> {
358 let parent = prefix.parent_path()?;
359 let segment = parent.segment()?;
360 if algo::has_errors(segment.syntax()) {
361 return None;
362 }
363 let mut res = make::path_unqualified(segment);
364 for p in iter::successors(parent.parent_path(), |it| it.parent_path()) {
365 res = make::path_qualified(res, p.segment()?);
366 }
367 Some(res)
368 }
369 }
370
371 pub fn remove(&self) -> SyntaxRewriter<'static> {
372 let mut res = SyntaxRewriter::default();
373 res.delete(self.syntax());
374 for &dir in [Direction::Next, Direction::Prev].iter() {
375 if let Some(nb) = neighbor(self, dir) {
376 self.syntax()
377 .siblings_with_tokens(dir)
378 .skip(1)
379 .take_while(|it| it.as_node() != Some(nb.syntax()))
380 .for_each(|el| res.delete(&el));
381 return res;
382 }
383 }
384 res
385 }
386}
387
388impl ast::MatchArmList {
389 #[must_use]
390 pub fn append_arms(&self, items: impl IntoIterator<Item = ast::MatchArm>) -> ast::MatchArmList {
391 let mut res = self.clone();
392 res = res.strip_if_only_whitespace();
393 if !res.syntax().text().contains_char('\n') {
394 res = make_multiline(res);
395 }
396 items.into_iter().for_each(|it| res = res.append_arm(it));
397 res
398 }
399
400 fn strip_if_only_whitespace(&self) -> ast::MatchArmList {
401 let mut iter = self.syntax().children_with_tokens().skip_while(|it| it.kind() != T!['{']);
402 iter.next(); // Eat the curly
403 let mut inner = iter.take_while(|it| it.kind() != T!['}']);
404 if !inner.clone().all(|it| it.kind() == WHITESPACE) {
405 return self.clone();
406 }
407 let start = match inner.next() {
408 Some(s) => s,
409 None => return self.clone(),
410 };
411 let end = match inner.last() {
412 Some(s) => s,
413 None => start.clone(),
414 };
415 self.replace_children(start..=end, &mut iter::empty())
416 }
417
418 #[must_use]
419 pub fn remove_placeholder(&self) -> ast::MatchArmList {
420 let placeholder =
421 self.arms().find(|arm| matches!(arm.pat(), Some(ast::Pat::WildcardPat(_))));
422 if let Some(placeholder) = placeholder {
423 self.remove_arm(&placeholder)
424 } else {
425 self.clone()
426 }
427 }
428
429 #[must_use]
430 fn remove_arm(&self, arm: &ast::MatchArm) -> ast::MatchArmList {
431 let start = arm.syntax().clone();
432 let end = if let Some(comma) = start
433 .siblings_with_tokens(Direction::Next)
434 .skip(1)
435 .skip_while(|it| it.kind().is_trivia())
436 .next()
437 .filter(|it| it.kind() == T![,])
438 {
439 comma
440 } else {
441 start.clone().into()
442 };
443 self.replace_children(start.into()..=end, None)
444 }
445
446 #[must_use]
447 pub fn append_arm(&self, item: ast::MatchArm) -> ast::MatchArmList {
448 let r_curly = match self.syntax().children_with_tokens().find(|it| it.kind() == T!['}']) {
449 Some(t) => t,
450 None => return self.clone(),
451 };
452 let position = InsertPosition::Before(r_curly.into());
453 let arm_ws = tokens::WsBuilder::new(" ");
454 let match_indent = &leading_indent(self.syntax()).unwrap_or_default();
455 let match_ws = tokens::WsBuilder::new(&format!("\n{}", match_indent));
456 let to_insert: ArrayVec<[SyntaxElement; 3]> =
457 [arm_ws.ws().into(), item.syntax().clone().into(), match_ws.ws().into()].into();
458 self.insert_children(position, to_insert)
459 }
460}
461
462#[must_use]
463pub fn remove_attrs_and_docs<N: ast::AttrsOwner>(node: &N) -> N {
464 N::cast(remove_attrs_and_docs_inner(node.syntax().clone())).unwrap()
465}
466
467fn remove_attrs_and_docs_inner(mut node: SyntaxNode) -> SyntaxNode {
468 while let Some(start) =
469 node.children_with_tokens().find(|it| it.kind() == ATTR || it.kind() == COMMENT)
470 {
471 let end = match &start.next_sibling_or_token() {
472 Some(el) if el.kind() == WHITESPACE => el.clone(),
473 Some(_) | None => start.clone(),
474 };
475 node = algo::replace_children(&node, start..=end, &mut iter::empty());
476 }
477 node
478}
479
480#[derive(Debug, Clone, Copy)]
481pub struct IndentLevel(pub u8);
482
483impl From<u8> for IndentLevel {
484 fn from(level: u8) -> IndentLevel {
485 IndentLevel(level)
486 }
487}
488
489impl fmt::Display for IndentLevel {
490 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
491 let spaces = " ";
492 let buf;
493 let len = self.0 as usize * 4;
494 let indent = if len <= spaces.len() {
495 &spaces[..len]
496 } else {
497 buf = iter::repeat(' ').take(len).collect::<String>();
498 &buf
499 };
500 fmt::Display::fmt(indent, f)
501 }
502}
503
504impl ops::Add<u8> for IndentLevel {
505 type Output = IndentLevel;
506 fn add(self, rhs: u8) -> IndentLevel {
507 IndentLevel(self.0 + rhs)
508 }
509}
510
511impl IndentLevel {
512 pub fn from_node(node: &SyntaxNode) -> IndentLevel {
513 let first_token = match node.first_token() {
514 Some(it) => it,
515 None => return IndentLevel(0),
516 };
517 for ws in prev_tokens(first_token).filter_map(ast::Whitespace::cast) {
518 let text = ws.syntax().text();
519 if let Some(pos) = text.rfind('\n') {
520 let level = text[pos + 1..].chars().count() / 4;
521 return IndentLevel(level as u8);
522 }
523 }
524 IndentLevel(0)
525 }
526
527 /// XXX: this intentionally doesn't change the indent of the very first token.
528 /// Ie, in something like
529 /// ```
530 /// fn foo() {
531 /// 92
532 /// }
533 /// ```
534 /// if you indent the block, the `{` token would stay put.
535 fn increase_indent(self, node: SyntaxNode) -> SyntaxNode {
536 let mut rewriter = SyntaxRewriter::default();
537 node.descendants_with_tokens()
538 .filter_map(|el| el.into_token())
539 .filter_map(ast::Whitespace::cast)
540 .filter(|ws| {
541 let text = ws.syntax().text();
542 text.contains('\n')
543 })
544 .for_each(|ws| {
545 let new_ws = make::tokens::whitespace(&format!("{}{}", ws.syntax(), self,));
546 rewriter.replace(ws.syntax(), &new_ws)
547 });
548 rewriter.rewrite(&node)
549 }
550
551 fn decrease_indent(self, node: SyntaxNode) -> SyntaxNode {
552 let mut rewriter = SyntaxRewriter::default();
553 node.descendants_with_tokens()
554 .filter_map(|el| el.into_token())
555 .filter_map(ast::Whitespace::cast)
556 .filter(|ws| {
557 let text = ws.syntax().text();
558 text.contains('\n')
559 })
560 .for_each(|ws| {
561 let new_ws = make::tokens::whitespace(
562 &ws.syntax().text().replace(&format!("\n{}", self), "\n"),
563 );
564 rewriter.replace(ws.syntax(), &new_ws)
565 });
566 rewriter.rewrite(&node)
567 }
568}
569
570// FIXME: replace usages with IndentLevel above
571fn leading_indent(node: &SyntaxNode) -> Option<SmolStr> {
572 for token in prev_tokens(node.first_token()?) {
573 if let Some(ws) = ast::Whitespace::cast(token.clone()) {
574 let ws_text = ws.text();
575 if let Some(pos) = ws_text.rfind('\n') {
576 return Some(ws_text[pos + 1..].into());
577 }
578 }
579 if token.text().contains('\n') {
580 break;
581 }
582 }
583 None
584}
585
586fn prev_tokens(token: SyntaxToken) -> impl Iterator<Item = SyntaxToken> {
587 iter::successors(Some(token), |token| token.prev_token())
588}
589
590pub trait AstNodeEdit: AstNode + Clone + Sized {
591 #[must_use]
592 fn insert_children(
593 &self,
594 position: InsertPosition<SyntaxElement>,
595 to_insert: impl IntoIterator<Item = SyntaxElement>,
596 ) -> Self {
597 let new_syntax = algo::insert_children(self.syntax(), position, to_insert);
598 Self::cast(new_syntax).unwrap()
599 }
600
601 #[must_use]
602 fn replace_children(
603 &self,
604 to_replace: RangeInclusive<SyntaxElement>,
605 to_insert: impl IntoIterator<Item = SyntaxElement>,
606 ) -> Self {
607 let new_syntax = algo::replace_children(self.syntax(), to_replace, to_insert);
608 Self::cast(new_syntax).unwrap()
609 }
610
611 #[must_use]
612 fn replace_descendant<D: AstNode>(&self, old: D, new: D) -> Self {
613 self.replace_descendants(iter::once((old, new)))
614 }
615
616 #[must_use]
617 fn replace_descendants<D: AstNode>(
618 &self,
619 replacement_map: impl IntoIterator<Item = (D, D)>,
620 ) -> Self {
621 let mut rewriter = SyntaxRewriter::default();
622 for (from, to) in replacement_map {
623 rewriter.replace(from.syntax(), to.syntax())
624 }
625 rewriter.rewrite_ast(self)
626 }
627 fn indent_level(&self) -> IndentLevel {
628 IndentLevel::from_node(self.syntax())
629 }
630 #[must_use]
631 fn indent(&self, level: IndentLevel) -> Self {
632 Self::cast(level.increase_indent(self.syntax().clone())).unwrap()
633 }
634 #[must_use]
635 fn dedent(&self, level: IndentLevel) -> Self {
636 Self::cast(level.decrease_indent(self.syntax().clone())).unwrap()
637 }
638 #[must_use]
639 fn reset_indent(&self) -> Self {
640 let level = IndentLevel::from_node(self.syntax());
641 self.dedent(level)
642 }
643}
644
645impl<N: AstNode + Clone> AstNodeEdit for N {}
646
647fn single_node(element: impl Into<SyntaxElement>) -> RangeInclusive<SyntaxElement> {
648 let element = element.into();
649 element.clone()..=element
650}
651
652#[test]
653fn test_increase_indent() {
654 let arm_list = {
655 let arm = make::match_arm(iter::once(make::wildcard_pat().into()), make::expr_unit());
656 make::match_arm_list(vec![arm.clone(), arm])
657 };
658 assert_eq!(
659 arm_list.syntax().to_string(),
660 "{
661 _ => (),
662 _ => (),
663}"
664 );
665 let indented = arm_list.indent(IndentLevel(2));
666 assert_eq!(
667 indented.syntax().to_string(),
668 "{
669 _ => (),
670 _ => (),
671 }"
672 );
673}
diff --git a/crates/syntax/src/ast/expr_ext.rs b/crates/syntax/src/ast/expr_ext.rs
new file mode 100644
index 000000000..f5ba87223
--- /dev/null
+++ b/crates/syntax/src/ast/expr_ext.rs
@@ -0,0 +1,418 @@
1//! Various extension methods to ast Expr Nodes, which are hard to code-generate.
2
3use crate::{
4 ast::{self, support, AstChildren, AstNode},
5 SmolStr,
6 SyntaxKind::*,
7 SyntaxToken, T,
8};
9
10impl ast::AttrsOwner for ast::Expr {}
11
12impl ast::Expr {
13 pub fn is_block_like(&self) -> bool {
14 match self {
15 ast::Expr::IfExpr(_)
16 | ast::Expr::LoopExpr(_)
17 | ast::Expr::ForExpr(_)
18 | ast::Expr::WhileExpr(_)
19 | ast::Expr::BlockExpr(_)
20 | ast::Expr::MatchExpr(_)
21 | ast::Expr::EffectExpr(_) => true,
22 _ => false,
23 }
24 }
25}
26
27#[derive(Debug, Clone, PartialEq, Eq)]
28pub enum ElseBranch {
29 Block(ast::BlockExpr),
30 IfExpr(ast::IfExpr),
31}
32
33impl ast::IfExpr {
34 pub fn then_branch(&self) -> Option<ast::BlockExpr> {
35 self.blocks().next()
36 }
37 pub fn else_branch(&self) -> Option<ElseBranch> {
38 let res = match self.blocks().nth(1) {
39 Some(block) => ElseBranch::Block(block),
40 None => {
41 let elif: ast::IfExpr = support::child(self.syntax())?;
42 ElseBranch::IfExpr(elif)
43 }
44 };
45 Some(res)
46 }
47
48 pub fn blocks(&self) -> AstChildren<ast::BlockExpr> {
49 support::children(self.syntax())
50 }
51}
52
53#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
54pub enum PrefixOp {
55 /// The `*` operator for dereferencing
56 Deref,
57 /// The `!` operator for logical inversion
58 Not,
59 /// The `-` operator for negation
60 Neg,
61}
62
63impl ast::PrefixExpr {
64 pub fn op_kind(&self) -> Option<PrefixOp> {
65 match self.op_token()?.kind() {
66 T![*] => Some(PrefixOp::Deref),
67 T![!] => Some(PrefixOp::Not),
68 T![-] => Some(PrefixOp::Neg),
69 _ => None,
70 }
71 }
72
73 pub fn op_token(&self) -> Option<SyntaxToken> {
74 self.syntax().first_child_or_token()?.into_token()
75 }
76}
77
78#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
79pub enum BinOp {
80 /// The `||` operator for boolean OR
81 BooleanOr,
82 /// The `&&` operator for boolean AND
83 BooleanAnd,
84 /// The `==` operator for equality testing
85 EqualityTest,
86 /// The `!=` operator for equality testing
87 NegatedEqualityTest,
88 /// The `<=` operator for lesser-equal testing
89 LesserEqualTest,
90 /// The `>=` operator for greater-equal testing
91 GreaterEqualTest,
92 /// The `<` operator for comparison
93 LesserTest,
94 /// The `>` operator for comparison
95 GreaterTest,
96 /// The `+` operator for addition
97 Addition,
98 /// The `*` operator for multiplication
99 Multiplication,
100 /// The `-` operator for subtraction
101 Subtraction,
102 /// The `/` operator for division
103 Division,
104 /// The `%` operator for remainder after division
105 Remainder,
106 /// The `<<` operator for left shift
107 LeftShift,
108 /// The `>>` operator for right shift
109 RightShift,
110 /// The `^` operator for bitwise XOR
111 BitwiseXor,
112 /// The `|` operator for bitwise OR
113 BitwiseOr,
114 /// The `&` operator for bitwise AND
115 BitwiseAnd,
116 /// The `=` operator for assignment
117 Assignment,
118 /// The `+=` operator for assignment after addition
119 AddAssign,
120 /// The `/=` operator for assignment after division
121 DivAssign,
122 /// The `*=` operator for assignment after multiplication
123 MulAssign,
124 /// The `%=` operator for assignment after remainders
125 RemAssign,
126 /// The `>>=` operator for assignment after shifting right
127 ShrAssign,
128 /// The `<<=` operator for assignment after shifting left
129 ShlAssign,
130 /// The `-=` operator for assignment after subtraction
131 SubAssign,
132 /// The `|=` operator for assignment after bitwise OR
133 BitOrAssign,
134 /// The `&=` operator for assignment after bitwise AND
135 BitAndAssign,
136 /// The `^=` operator for assignment after bitwise XOR
137 BitXorAssign,
138}
139
140impl BinOp {
141 pub fn is_assignment(self) -> bool {
142 match self {
143 BinOp::Assignment
144 | BinOp::AddAssign
145 | BinOp::DivAssign
146 | BinOp::MulAssign
147 | BinOp::RemAssign
148 | BinOp::ShrAssign
149 | BinOp::ShlAssign
150 | BinOp::SubAssign
151 | BinOp::BitOrAssign
152 | BinOp::BitAndAssign
153 | BinOp::BitXorAssign => true,
154 _ => false,
155 }
156 }
157}
158
159impl ast::BinExpr {
160 pub fn op_details(&self) -> Option<(SyntaxToken, BinOp)> {
161 self.syntax().children_with_tokens().filter_map(|it| it.into_token()).find_map(|c| {
162 let bin_op = match c.kind() {
163 T![||] => BinOp::BooleanOr,
164 T![&&] => BinOp::BooleanAnd,
165 T![==] => BinOp::EqualityTest,
166 T![!=] => BinOp::NegatedEqualityTest,
167 T![<=] => BinOp::LesserEqualTest,
168 T![>=] => BinOp::GreaterEqualTest,
169 T![<] => BinOp::LesserTest,
170 T![>] => BinOp::GreaterTest,
171 T![+] => BinOp::Addition,
172 T![*] => BinOp::Multiplication,
173 T![-] => BinOp::Subtraction,
174 T![/] => BinOp::Division,
175 T![%] => BinOp::Remainder,
176 T![<<] => BinOp::LeftShift,
177 T![>>] => BinOp::RightShift,
178 T![^] => BinOp::BitwiseXor,
179 T![|] => BinOp::BitwiseOr,
180 T![&] => BinOp::BitwiseAnd,
181 T![=] => BinOp::Assignment,
182 T![+=] => BinOp::AddAssign,
183 T![/=] => BinOp::DivAssign,
184 T![*=] => BinOp::MulAssign,
185 T![%=] => BinOp::RemAssign,
186 T![>>=] => BinOp::ShrAssign,
187 T![<<=] => BinOp::ShlAssign,
188 T![-=] => BinOp::SubAssign,
189 T![|=] => BinOp::BitOrAssign,
190 T![&=] => BinOp::BitAndAssign,
191 T![^=] => BinOp::BitXorAssign,
192 _ => return None,
193 };
194 Some((c, bin_op))
195 })
196 }
197
198 pub fn op_kind(&self) -> Option<BinOp> {
199 self.op_details().map(|t| t.1)
200 }
201
202 pub fn op_token(&self) -> Option<SyntaxToken> {
203 self.op_details().map(|t| t.0)
204 }
205
206 pub fn lhs(&self) -> Option<ast::Expr> {
207 support::children(self.syntax()).next()
208 }
209
210 pub fn rhs(&self) -> Option<ast::Expr> {
211 support::children(self.syntax()).nth(1)
212 }
213
214 pub fn sub_exprs(&self) -> (Option<ast::Expr>, Option<ast::Expr>) {
215 let mut children = support::children(self.syntax());
216 let first = children.next();
217 let second = children.next();
218 (first, second)
219 }
220}
221
222#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
223pub enum RangeOp {
224 /// `..`
225 Exclusive,
226 /// `..=`
227 Inclusive,
228}
229
230impl ast::RangeExpr {
231 fn op_details(&self) -> Option<(usize, SyntaxToken, RangeOp)> {
232 self.syntax().children_with_tokens().enumerate().find_map(|(ix, child)| {
233 let token = child.into_token()?;
234 let bin_op = match token.kind() {
235 T![..] => RangeOp::Exclusive,
236 T![..=] => RangeOp::Inclusive,
237 _ => return None,
238 };
239 Some((ix, token, bin_op))
240 })
241 }
242
243 pub fn op_kind(&self) -> Option<RangeOp> {
244 self.op_details().map(|t| t.2)
245 }
246
247 pub fn op_token(&self) -> Option<SyntaxToken> {
248 self.op_details().map(|t| t.1)
249 }
250
251 pub fn start(&self) -> Option<ast::Expr> {
252 let op_ix = self.op_details()?.0;
253 self.syntax()
254 .children_with_tokens()
255 .take(op_ix)
256 .find_map(|it| ast::Expr::cast(it.into_node()?))
257 }
258
259 pub fn end(&self) -> Option<ast::Expr> {
260 let op_ix = self.op_details()?.0;
261 self.syntax()
262 .children_with_tokens()
263 .skip(op_ix + 1)
264 .find_map(|it| ast::Expr::cast(it.into_node()?))
265 }
266}
267
268impl ast::IndexExpr {
269 pub fn base(&self) -> Option<ast::Expr> {
270 support::children(self.syntax()).next()
271 }
272 pub fn index(&self) -> Option<ast::Expr> {
273 support::children(self.syntax()).nth(1)
274 }
275}
276
277pub enum ArrayExprKind {
278 Repeat { initializer: Option<ast::Expr>, repeat: Option<ast::Expr> },
279 ElementList(AstChildren<ast::Expr>),
280}
281
282impl ast::ArrayExpr {
283 pub fn kind(&self) -> ArrayExprKind {
284 if self.is_repeat() {
285 ArrayExprKind::Repeat {
286 initializer: support::children(self.syntax()).next(),
287 repeat: support::children(self.syntax()).nth(1),
288 }
289 } else {
290 ArrayExprKind::ElementList(support::children(self.syntax()))
291 }
292 }
293
294 fn is_repeat(&self) -> bool {
295 self.syntax().children_with_tokens().any(|it| it.kind() == T![;])
296 }
297}
298
299#[derive(Clone, Debug, PartialEq, Eq, Hash)]
300pub enum LiteralKind {
301 String,
302 ByteString,
303 Char,
304 Byte,
305 IntNumber { suffix: Option<SmolStr> },
306 FloatNumber { suffix: Option<SmolStr> },
307 Bool(bool),
308}
309
310impl ast::Literal {
311 pub fn token(&self) -> SyntaxToken {
312 self.syntax()
313 .children_with_tokens()
314 .find(|e| e.kind() != ATTR && !e.kind().is_trivia())
315 .and_then(|e| e.into_token())
316 .unwrap()
317 }
318
319 fn find_suffix(text: &str, possible_suffixes: &[&str]) -> Option<SmolStr> {
320 possible_suffixes
321 .iter()
322 .find(|&suffix| text.ends_with(suffix))
323 .map(|&suffix| SmolStr::new(suffix))
324 }
325
326 pub fn kind(&self) -> LiteralKind {
327 const INT_SUFFIXES: [&str; 12] = [
328 "u64", "u32", "u16", "u8", "usize", "isize", "i64", "i32", "i16", "i8", "u128", "i128",
329 ];
330 const FLOAT_SUFFIXES: [&str; 2] = ["f32", "f64"];
331
332 let token = self.token();
333
334 match token.kind() {
335 INT_NUMBER => {
336 // FYI: there was a bug here previously, thus the if statement below is necessary.
337 // The lexer treats e.g. `1f64` as an integer literal. See
338 // https://github.com/rust-analyzer/rust-analyzer/issues/1592
339 // and the comments on the linked PR.
340
341 let text = token.text();
342 if let suffix @ Some(_) = Self::find_suffix(&text, &FLOAT_SUFFIXES) {
343 LiteralKind::FloatNumber { suffix }
344 } else {
345 LiteralKind::IntNumber { suffix: Self::find_suffix(&text, &INT_SUFFIXES) }
346 }
347 }
348 FLOAT_NUMBER => {
349 let text = token.text();
350 LiteralKind::FloatNumber { suffix: Self::find_suffix(&text, &FLOAT_SUFFIXES) }
351 }
352 STRING | RAW_STRING => LiteralKind::String,
353 T![true] => LiteralKind::Bool(true),
354 T![false] => LiteralKind::Bool(false),
355 BYTE_STRING | RAW_BYTE_STRING => LiteralKind::ByteString,
356 CHAR => LiteralKind::Char,
357 BYTE => LiteralKind::Byte,
358 _ => unreachable!(),
359 }
360 }
361}
362
363#[derive(Debug, Clone, PartialEq, Eq)]
364pub enum Effect {
365 Async(SyntaxToken),
366 Unsafe(SyntaxToken),
367 Try(SyntaxToken),
368 // Very much not an effect, but we stuff it into this node anyway
369 Label(ast::Label),
370}
371
372impl ast::EffectExpr {
373 pub fn effect(&self) -> Effect {
374 if let Some(token) = self.async_token() {
375 return Effect::Async(token);
376 }
377 if let Some(token) = self.unsafe_token() {
378 return Effect::Unsafe(token);
379 }
380 if let Some(token) = self.try_token() {
381 return Effect::Try(token);
382 }
383 if let Some(label) = self.label() {
384 return Effect::Label(label);
385 }
386 unreachable!("ast::EffectExpr without Effect")
387 }
388}
389
390impl ast::BlockExpr {
391 /// false if the block is an intrinsic part of the syntax and can't be
392 /// replaced with arbitrary expression.
393 ///
394 /// ```not_rust
395 /// fn foo() { not_stand_alone }
396 /// const FOO: () = { stand_alone };
397 /// ```
398 pub fn is_standalone(&self) -> bool {
399 let parent = match self.syntax().parent() {
400 Some(it) => it,
401 None => return true,
402 };
403 !matches!(parent.kind(), FN | IF_EXPR | WHILE_EXPR | LOOP_EXPR | EFFECT_EXPR)
404 }
405}
406
407#[test]
408fn test_literal_with_attr() {
409 let parse = ast::SourceFile::parse(r#"const _: &str = { #[attr] "Hello" };"#);
410 let lit = parse.tree().syntax().descendants().find_map(ast::Literal::cast).unwrap();
411 assert_eq!(lit.token().text(), r#""Hello""#);
412}
413
414impl ast::RecordExprField {
415 pub fn parent_record_lit(&self) -> ast::RecordExpr {
416 self.syntax().ancestors().find_map(ast::RecordExpr::cast).unwrap()
417 }
418}
diff --git a/crates/syntax/src/ast/generated.rs b/crates/syntax/src/ast/generated.rs
new file mode 100644
index 000000000..4a6f41ee7
--- /dev/null
+++ b/crates/syntax/src/ast/generated.rs
@@ -0,0 +1,41 @@
1//! This file is actually hand-written, but the submodules are indeed generated.
2#[rustfmt::skip]
3mod nodes;
4#[rustfmt::skip]
5mod tokens;
6
7use crate::{
8 AstNode,
9 SyntaxKind::{self, *},
10 SyntaxNode,
11};
12
13pub use {nodes::*, tokens::*};
14
15// Stmt is the only nested enum, so it's easier to just hand-write it
16impl AstNode for Stmt {
17 fn can_cast(kind: SyntaxKind) -> bool {
18 match kind {
19 LET_STMT | EXPR_STMT => true,
20 _ => Item::can_cast(kind),
21 }
22 }
23 fn cast(syntax: SyntaxNode) -> Option<Self> {
24 let res = match syntax.kind() {
25 LET_STMT => Stmt::LetStmt(LetStmt { syntax }),
26 EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }),
27 _ => {
28 let item = Item::cast(syntax)?;
29 Stmt::Item(item)
30 }
31 };
32 Some(res)
33 }
34 fn syntax(&self) -> &SyntaxNode {
35 match self {
36 Stmt::LetStmt(it) => &it.syntax,
37 Stmt::ExprStmt(it) => &it.syntax,
38 Stmt::Item(it) => it.syntax(),
39 }
40 }
41}
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs
new file mode 100644
index 000000000..6317407c6
--- /dev/null
+++ b/crates/syntax/src/ast/generated/nodes.rs
@@ -0,0 +1,4068 @@
1//! Generated file, do not edit by hand, see `xtask/src/codegen`
2
3use crate::{
4 ast::{self, support, AstChildren, AstNode},
5 SyntaxKind::{self, *},
6 SyntaxNode, SyntaxToken, T,
7};
8#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9pub struct Name {
10 pub(crate) syntax: SyntaxNode,
11}
12impl Name {
13 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
14}
15#[derive(Debug, Clone, PartialEq, Eq, Hash)]
16pub struct NameRef {
17 pub(crate) syntax: SyntaxNode,
18}
19impl NameRef {
20 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
21}
22#[derive(Debug, Clone, PartialEq, Eq, Hash)]
23pub struct Path {
24 pub(crate) syntax: SyntaxNode,
25}
26impl Path {
27 pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
28 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
29 pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) }
30}
31#[derive(Debug, Clone, PartialEq, Eq, Hash)]
32pub struct PathSegment {
33 pub(crate) syntax: SyntaxNode,
34}
35impl PathSegment {
36 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
37 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
38 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
39 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
40 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
41 pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) }
42 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
43 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
44 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
45 pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) }
46 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
47 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
48}
49#[derive(Debug, Clone, PartialEq, Eq, Hash)]
50pub struct GenericArgList {
51 pub(crate) syntax: SyntaxNode,
52}
53impl GenericArgList {
54 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
55 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
56 pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) }
57 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
58}
59#[derive(Debug, Clone, PartialEq, Eq, Hash)]
60pub struct ParamList {
61 pub(crate) syntax: SyntaxNode,
62}
63impl ParamList {
64 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
65 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
66 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
67 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
68 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
69 pub fn pipe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![|]) }
70}
71#[derive(Debug, Clone, PartialEq, Eq, Hash)]
72pub struct RetType {
73 pub(crate) syntax: SyntaxNode,
74}
75impl RetType {
76 pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) }
77 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
78}
79#[derive(Debug, Clone, PartialEq, Eq, Hash)]
80pub struct PathType {
81 pub(crate) syntax: SyntaxNode,
82}
83impl PathType {
84 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
85}
86#[derive(Debug, Clone, PartialEq, Eq, Hash)]
87pub struct TypeArg {
88 pub(crate) syntax: SyntaxNode,
89}
90impl TypeArg {
91 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
92}
93#[derive(Debug, Clone, PartialEq, Eq, Hash)]
94pub struct AssocTypeArg {
95 pub(crate) syntax: SyntaxNode,
96}
97impl ast::TypeBoundsOwner for AssocTypeArg {}
98impl AssocTypeArg {
99 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
100 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
101 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
102}
103#[derive(Debug, Clone, PartialEq, Eq, Hash)]
104pub struct LifetimeArg {
105 pub(crate) syntax: SyntaxNode,
106}
107impl LifetimeArg {
108 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
109 support::token(&self.syntax, T![lifetime])
110 }
111}
112#[derive(Debug, Clone, PartialEq, Eq, Hash)]
113pub struct ConstArg {
114 pub(crate) syntax: SyntaxNode,
115}
116impl ConstArg {
117 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
118}
119#[derive(Debug, Clone, PartialEq, Eq, Hash)]
120pub struct TypeBoundList {
121 pub(crate) syntax: SyntaxNode,
122}
123impl TypeBoundList {
124 pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
125}
126#[derive(Debug, Clone, PartialEq, Eq, Hash)]
127pub struct MacroCall {
128 pub(crate) syntax: SyntaxNode,
129}
130impl ast::AttrsOwner for MacroCall {}
131impl ast::NameOwner for MacroCall {}
132impl MacroCall {
133 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
134 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
135 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
136 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
137}
138#[derive(Debug, Clone, PartialEq, Eq, Hash)]
139pub struct Attr {
140 pub(crate) syntax: SyntaxNode,
141}
142impl Attr {
143 pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) }
144 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
145 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
146 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
147 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
148 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
149 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
150 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
151}
152#[derive(Debug, Clone, PartialEq, Eq, Hash)]
153pub struct TokenTree {
154 pub(crate) syntax: SyntaxNode,
155}
156impl TokenTree {
157 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
158 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
159 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
160 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
161 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
162 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
163}
164#[derive(Debug, Clone, PartialEq, Eq, Hash)]
165pub struct MacroItems {
166 pub(crate) syntax: SyntaxNode,
167}
168impl ast::ModuleItemOwner for MacroItems {}
169impl MacroItems {}
170#[derive(Debug, Clone, PartialEq, Eq, Hash)]
171pub struct MacroStmts {
172 pub(crate) syntax: SyntaxNode,
173}
174impl MacroStmts {
175 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
176 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
177}
178#[derive(Debug, Clone, PartialEq, Eq, Hash)]
179pub struct SourceFile {
180 pub(crate) syntax: SyntaxNode,
181}
182impl ast::AttrsOwner for SourceFile {}
183impl ast::ModuleItemOwner for SourceFile {}
184impl SourceFile {
185 pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) }
186}
187#[derive(Debug, Clone, PartialEq, Eq, Hash)]
188pub struct Const {
189 pub(crate) syntax: SyntaxNode,
190}
191impl ast::AttrsOwner for Const {}
192impl ast::NameOwner for Const {}
193impl ast::VisibilityOwner for Const {}
194impl Const {
195 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
196 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
197 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
198 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
199 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
200 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
201 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
202 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
203}
204#[derive(Debug, Clone, PartialEq, Eq, Hash)]
205pub struct Enum {
206 pub(crate) syntax: SyntaxNode,
207}
208impl ast::AttrsOwner for Enum {}
209impl ast::NameOwner for Enum {}
210impl ast::VisibilityOwner for Enum {}
211impl ast::GenericParamsOwner for Enum {}
212impl Enum {
213 pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) }
214 pub fn variant_list(&self) -> Option<VariantList> { support::child(&self.syntax) }
215}
216#[derive(Debug, Clone, PartialEq, Eq, Hash)]
217pub struct ExternBlock {
218 pub(crate) syntax: SyntaxNode,
219}
220impl ast::AttrsOwner for ExternBlock {}
221impl ExternBlock {
222 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
223 pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) }
224}
225#[derive(Debug, Clone, PartialEq, Eq, Hash)]
226pub struct ExternCrate {
227 pub(crate) syntax: SyntaxNode,
228}
229impl ast::AttrsOwner for ExternCrate {}
230impl ast::VisibilityOwner for ExternCrate {}
231impl ExternCrate {
232 pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) }
233 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
234 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
235 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
236 pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) }
237 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
238}
239#[derive(Debug, Clone, PartialEq, Eq, Hash)]
240pub struct Fn {
241 pub(crate) syntax: SyntaxNode,
242}
243impl ast::AttrsOwner for Fn {}
244impl ast::NameOwner for Fn {}
245impl ast::VisibilityOwner for Fn {}
246impl ast::GenericParamsOwner for Fn {}
247impl Fn {
248 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
249 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
250 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
251 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
252 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
253 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
254 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
255 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
256 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
257 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
258}
259#[derive(Debug, Clone, PartialEq, Eq, Hash)]
260pub struct Impl {
261 pub(crate) syntax: SyntaxNode,
262}
263impl ast::AttrsOwner for Impl {}
264impl ast::VisibilityOwner for Impl {}
265impl ast::GenericParamsOwner for Impl {}
266impl Impl {
267 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
268 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
269 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
270 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
271 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
272 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
273 pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
274}
275#[derive(Debug, Clone, PartialEq, Eq, Hash)]
276pub struct Module {
277 pub(crate) syntax: SyntaxNode,
278}
279impl ast::AttrsOwner for Module {}
280impl ast::NameOwner for Module {}
281impl ast::VisibilityOwner for Module {}
282impl Module {
283 pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) }
284 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
285 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
286}
287#[derive(Debug, Clone, PartialEq, Eq, Hash)]
288pub struct Static {
289 pub(crate) syntax: SyntaxNode,
290}
291impl ast::AttrsOwner for Static {}
292impl ast::NameOwner for Static {}
293impl ast::VisibilityOwner for Static {}
294impl Static {
295 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
296 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
297 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
298 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
299 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
300 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
301 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
302}
303#[derive(Debug, Clone, PartialEq, Eq, Hash)]
304pub struct Struct {
305 pub(crate) syntax: SyntaxNode,
306}
307impl ast::AttrsOwner for Struct {}
308impl ast::NameOwner for Struct {}
309impl ast::VisibilityOwner for Struct {}
310impl ast::GenericParamsOwner for Struct {}
311impl Struct {
312 pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) }
313 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
314 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
315}
316#[derive(Debug, Clone, PartialEq, Eq, Hash)]
317pub struct Trait {
318 pub(crate) syntax: SyntaxNode,
319}
320impl ast::AttrsOwner for Trait {}
321impl ast::NameOwner for Trait {}
322impl ast::VisibilityOwner for Trait {}
323impl ast::GenericParamsOwner for Trait {}
324impl ast::TypeBoundsOwner for Trait {}
325impl Trait {
326 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
327 pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) }
328 pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) }
329 pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
330}
331#[derive(Debug, Clone, PartialEq, Eq, Hash)]
332pub struct TypeAlias {
333 pub(crate) syntax: SyntaxNode,
334}
335impl ast::AttrsOwner for TypeAlias {}
336impl ast::NameOwner for TypeAlias {}
337impl ast::VisibilityOwner for TypeAlias {}
338impl ast::GenericParamsOwner for TypeAlias {}
339impl ast::TypeBoundsOwner for TypeAlias {}
340impl TypeAlias {
341 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
342 pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) }
343 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
344 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
345 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
346}
347#[derive(Debug, Clone, PartialEq, Eq, Hash)]
348pub struct Union {
349 pub(crate) syntax: SyntaxNode,
350}
351impl ast::AttrsOwner for Union {}
352impl ast::NameOwner for Union {}
353impl ast::VisibilityOwner for Union {}
354impl ast::GenericParamsOwner for Union {}
355impl Union {
356 pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) }
357 pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) }
358}
359#[derive(Debug, Clone, PartialEq, Eq, Hash)]
360pub struct Use {
361 pub(crate) syntax: SyntaxNode,
362}
363impl ast::AttrsOwner for Use {}
364impl ast::VisibilityOwner for Use {}
365impl Use {
366 pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) }
367 pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) }
368 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
369}
370#[derive(Debug, Clone, PartialEq, Eq, Hash)]
371pub struct Visibility {
372 pub(crate) syntax: SyntaxNode,
373}
374impl Visibility {
375 pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) }
376 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
377 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
378 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
379 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
380 pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) }
381 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
382 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
383}
384#[derive(Debug, Clone, PartialEq, Eq, Hash)]
385pub struct ItemList {
386 pub(crate) syntax: SyntaxNode,
387}
388impl ast::AttrsOwner for ItemList {}
389impl ast::ModuleItemOwner for ItemList {}
390impl ItemList {
391 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
392 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
393}
394#[derive(Debug, Clone, PartialEq, Eq, Hash)]
395pub struct Rename {
396 pub(crate) syntax: SyntaxNode,
397}
398impl ast::NameOwner for Rename {}
399impl Rename {
400 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
401 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
402}
403#[derive(Debug, Clone, PartialEq, Eq, Hash)]
404pub struct UseTree {
405 pub(crate) syntax: SyntaxNode,
406}
407impl UseTree {
408 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
409 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
410 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
411 pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) }
412 pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) }
413}
414#[derive(Debug, Clone, PartialEq, Eq, Hash)]
415pub struct UseTreeList {
416 pub(crate) syntax: SyntaxNode,
417}
418impl UseTreeList {
419 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
420 pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) }
421 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
422}
423#[derive(Debug, Clone, PartialEq, Eq, Hash)]
424pub struct Abi {
425 pub(crate) syntax: SyntaxNode,
426}
427impl Abi {
428 pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) }
429}
430#[derive(Debug, Clone, PartialEq, Eq, Hash)]
431pub struct GenericParamList {
432 pub(crate) syntax: SyntaxNode,
433}
434impl GenericParamList {
435 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
436 pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) }
437 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
438}
439#[derive(Debug, Clone, PartialEq, Eq, Hash)]
440pub struct WhereClause {
441 pub(crate) syntax: SyntaxNode,
442}
443impl WhereClause {
444 pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) }
445 pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) }
446}
447#[derive(Debug, Clone, PartialEq, Eq, Hash)]
448pub struct BlockExpr {
449 pub(crate) syntax: SyntaxNode,
450}
451impl ast::AttrsOwner for BlockExpr {}
452impl BlockExpr {
453 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
454 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
455 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
456 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
457}
458#[derive(Debug, Clone, PartialEq, Eq, Hash)]
459pub struct SelfParam {
460 pub(crate) syntax: SyntaxNode,
461}
462impl ast::AttrsOwner for SelfParam {}
463impl SelfParam {
464 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
465 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
466 support::token(&self.syntax, T![lifetime])
467 }
468 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
469 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
470 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
471 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
472}
473#[derive(Debug, Clone, PartialEq, Eq, Hash)]
474pub struct Param {
475 pub(crate) syntax: SyntaxNode,
476}
477impl ast::AttrsOwner for Param {}
478impl Param {
479 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
480 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
481 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
482 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
483}
484#[derive(Debug, Clone, PartialEq, Eq, Hash)]
485pub struct RecordFieldList {
486 pub(crate) syntax: SyntaxNode,
487}
488impl RecordFieldList {
489 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
490 pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) }
491 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
492}
493#[derive(Debug, Clone, PartialEq, Eq, Hash)]
494pub struct TupleFieldList {
495 pub(crate) syntax: SyntaxNode,
496}
497impl TupleFieldList {
498 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
499 pub fn fields(&self) -> AstChildren<TupleField> { support::children(&self.syntax) }
500 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
501}
502#[derive(Debug, Clone, PartialEq, Eq, Hash)]
503pub struct RecordField {
504 pub(crate) syntax: SyntaxNode,
505}
506impl ast::AttrsOwner for RecordField {}
507impl ast::NameOwner for RecordField {}
508impl ast::VisibilityOwner for RecordField {}
509impl RecordField {
510 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
511 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
512}
513#[derive(Debug, Clone, PartialEq, Eq, Hash)]
514pub struct TupleField {
515 pub(crate) syntax: SyntaxNode,
516}
517impl ast::AttrsOwner for TupleField {}
518impl ast::VisibilityOwner for TupleField {}
519impl TupleField {
520 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
521}
522#[derive(Debug, Clone, PartialEq, Eq, Hash)]
523pub struct VariantList {
524 pub(crate) syntax: SyntaxNode,
525}
526impl VariantList {
527 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
528 pub fn variants(&self) -> AstChildren<Variant> { support::children(&self.syntax) }
529 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
530}
531#[derive(Debug, Clone, PartialEq, Eq, Hash)]
532pub struct Variant {
533 pub(crate) syntax: SyntaxNode,
534}
535impl ast::AttrsOwner for Variant {}
536impl ast::NameOwner for Variant {}
537impl ast::VisibilityOwner for Variant {}
538impl Variant {
539 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
540 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
541 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
542}
543#[derive(Debug, Clone, PartialEq, Eq, Hash)]
544pub struct AssocItemList {
545 pub(crate) syntax: SyntaxNode,
546}
547impl ast::AttrsOwner for AssocItemList {}
548impl AssocItemList {
549 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
550 pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) }
551 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
552}
553#[derive(Debug, Clone, PartialEq, Eq, Hash)]
554pub struct ExternItemList {
555 pub(crate) syntax: SyntaxNode,
556}
557impl ast::AttrsOwner for ExternItemList {}
558impl ExternItemList {
559 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
560 pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) }
561 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
562}
563#[derive(Debug, Clone, PartialEq, Eq, Hash)]
564pub struct ConstParam {
565 pub(crate) syntax: SyntaxNode,
566}
567impl ast::AttrsOwner for ConstParam {}
568impl ast::NameOwner for ConstParam {}
569impl ConstParam {
570 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
571 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
572 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
573 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
574 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
575}
576#[derive(Debug, Clone, PartialEq, Eq, Hash)]
577pub struct LifetimeParam {
578 pub(crate) syntax: SyntaxNode,
579}
580impl ast::AttrsOwner for LifetimeParam {}
581impl ast::TypeBoundsOwner for LifetimeParam {}
582impl LifetimeParam {
583 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
584 support::token(&self.syntax, T![lifetime])
585 }
586}
587#[derive(Debug, Clone, PartialEq, Eq, Hash)]
588pub struct TypeParam {
589 pub(crate) syntax: SyntaxNode,
590}
591impl ast::AttrsOwner for TypeParam {}
592impl ast::NameOwner for TypeParam {}
593impl ast::TypeBoundsOwner for TypeParam {}
594impl TypeParam {
595 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
596 pub fn default_type(&self) -> Option<Type> { support::child(&self.syntax) }
597}
598#[derive(Debug, Clone, PartialEq, Eq, Hash)]
599pub struct WherePred {
600 pub(crate) syntax: SyntaxNode,
601}
602impl ast::TypeBoundsOwner for WherePred {}
603impl WherePred {
604 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
605 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
606 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
607 support::token(&self.syntax, T![lifetime])
608 }
609 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
610}
611#[derive(Debug, Clone, PartialEq, Eq, Hash)]
612pub struct Literal {
613 pub(crate) syntax: SyntaxNode,
614}
615impl ast::AttrsOwner for Literal {}
616impl Literal {}
617#[derive(Debug, Clone, PartialEq, Eq, Hash)]
618pub struct ExprStmt {
619 pub(crate) syntax: SyntaxNode,
620}
621impl ast::AttrsOwner for ExprStmt {}
622impl ExprStmt {
623 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
624 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
625}
626#[derive(Debug, Clone, PartialEq, Eq, Hash)]
627pub struct LetStmt {
628 pub(crate) syntax: SyntaxNode,
629}
630impl ast::AttrsOwner for LetStmt {}
631impl LetStmt {
632 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
633 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
634 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
635 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
636 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
637 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
638 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
639}
640#[derive(Debug, Clone, PartialEq, Eq, Hash)]
641pub struct ArrayExpr {
642 pub(crate) syntax: SyntaxNode,
643}
644impl ast::AttrsOwner for ArrayExpr {}
645impl ArrayExpr {
646 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
647 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
648 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
649 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
650 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
651}
652#[derive(Debug, Clone, PartialEq, Eq, Hash)]
653pub struct AwaitExpr {
654 pub(crate) syntax: SyntaxNode,
655}
656impl ast::AttrsOwner for AwaitExpr {}
657impl AwaitExpr {
658 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
659 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
660 pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) }
661}
662#[derive(Debug, Clone, PartialEq, Eq, Hash)]
663pub struct BinExpr {
664 pub(crate) syntax: SyntaxNode,
665}
666impl ast::AttrsOwner for BinExpr {}
667impl BinExpr {}
668#[derive(Debug, Clone, PartialEq, Eq, Hash)]
669pub struct BoxExpr {
670 pub(crate) syntax: SyntaxNode,
671}
672impl ast::AttrsOwner for BoxExpr {}
673impl BoxExpr {
674 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
675 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
676}
677#[derive(Debug, Clone, PartialEq, Eq, Hash)]
678pub struct BreakExpr {
679 pub(crate) syntax: SyntaxNode,
680}
681impl ast::AttrsOwner for BreakExpr {}
682impl BreakExpr {
683 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) }
684 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
685 support::token(&self.syntax, T![lifetime])
686 }
687 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
688}
689#[derive(Debug, Clone, PartialEq, Eq, Hash)]
690pub struct CallExpr {
691 pub(crate) syntax: SyntaxNode,
692}
693impl ast::AttrsOwner for CallExpr {}
694impl ast::ArgListOwner for CallExpr {}
695impl CallExpr {
696 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
697}
698#[derive(Debug, Clone, PartialEq, Eq, Hash)]
699pub struct CastExpr {
700 pub(crate) syntax: SyntaxNode,
701}
702impl ast::AttrsOwner for CastExpr {}
703impl CastExpr {
704 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
705 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
706 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
707}
708#[derive(Debug, Clone, PartialEq, Eq, Hash)]
709pub struct ClosureExpr {
710 pub(crate) syntax: SyntaxNode,
711}
712impl ast::AttrsOwner for ClosureExpr {}
713impl ClosureExpr {
714 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
715 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
716 pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) }
717 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
718 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
719 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
720}
721#[derive(Debug, Clone, PartialEq, Eq, Hash)]
722pub struct ContinueExpr {
723 pub(crate) syntax: SyntaxNode,
724}
725impl ast::AttrsOwner for ContinueExpr {}
726impl ContinueExpr {
727 pub fn continue_token(&self) -> Option<SyntaxToken> {
728 support::token(&self.syntax, T![continue])
729 }
730 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
731 support::token(&self.syntax, T![lifetime])
732 }
733}
734#[derive(Debug, Clone, PartialEq, Eq, Hash)]
735pub struct EffectExpr {
736 pub(crate) syntax: SyntaxNode,
737}
738impl ast::AttrsOwner for EffectExpr {}
739impl EffectExpr {
740 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
741 pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) }
742 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
743 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
744 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
745}
746#[derive(Debug, Clone, PartialEq, Eq, Hash)]
747pub struct FieldExpr {
748 pub(crate) syntax: SyntaxNode,
749}
750impl ast::AttrsOwner for FieldExpr {}
751impl FieldExpr {
752 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
753 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
754 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
755}
756#[derive(Debug, Clone, PartialEq, Eq, Hash)]
757pub struct ForExpr {
758 pub(crate) syntax: SyntaxNode,
759}
760impl ast::AttrsOwner for ForExpr {}
761impl ast::LoopBodyOwner for ForExpr {}
762impl ForExpr {
763 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
764 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
765 pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) }
766 pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) }
767}
768#[derive(Debug, Clone, PartialEq, Eq, Hash)]
769pub struct IfExpr {
770 pub(crate) syntax: SyntaxNode,
771}
772impl ast::AttrsOwner for IfExpr {}
773impl IfExpr {
774 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
775 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
776 pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) }
777}
778#[derive(Debug, Clone, PartialEq, Eq, Hash)]
779pub struct IndexExpr {
780 pub(crate) syntax: SyntaxNode,
781}
782impl ast::AttrsOwner for IndexExpr {}
783impl IndexExpr {
784 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
785 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
786}
787#[derive(Debug, Clone, PartialEq, Eq, Hash)]
788pub struct LoopExpr {
789 pub(crate) syntax: SyntaxNode,
790}
791impl ast::AttrsOwner for LoopExpr {}
792impl ast::LoopBodyOwner for LoopExpr {}
793impl LoopExpr {
794 pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) }
795}
796#[derive(Debug, Clone, PartialEq, Eq, Hash)]
797pub struct MatchExpr {
798 pub(crate) syntax: SyntaxNode,
799}
800impl ast::AttrsOwner for MatchExpr {}
801impl MatchExpr {
802 pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) }
803 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
804 pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) }
805}
806#[derive(Debug, Clone, PartialEq, Eq, Hash)]
807pub struct MethodCallExpr {
808 pub(crate) syntax: SyntaxNode,
809}
810impl ast::AttrsOwner for MethodCallExpr {}
811impl ast::ArgListOwner for MethodCallExpr {}
812impl MethodCallExpr {
813 pub fn receiver(&self) -> Option<Expr> { support::child(&self.syntax) }
814 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
815 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
816 pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) }
817}
818#[derive(Debug, Clone, PartialEq, Eq, Hash)]
819pub struct ParenExpr {
820 pub(crate) syntax: SyntaxNode,
821}
822impl ast::AttrsOwner for ParenExpr {}
823impl ParenExpr {
824 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
825 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
826 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
827}
828#[derive(Debug, Clone, PartialEq, Eq, Hash)]
829pub struct PathExpr {
830 pub(crate) syntax: SyntaxNode,
831}
832impl ast::AttrsOwner for PathExpr {}
833impl PathExpr {
834 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
835}
836#[derive(Debug, Clone, PartialEq, Eq, Hash)]
837pub struct PrefixExpr {
838 pub(crate) syntax: SyntaxNode,
839}
840impl ast::AttrsOwner for PrefixExpr {}
841impl PrefixExpr {
842 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
843}
844#[derive(Debug, Clone, PartialEq, Eq, Hash)]
845pub struct RangeExpr {
846 pub(crate) syntax: SyntaxNode,
847}
848impl ast::AttrsOwner for RangeExpr {}
849impl RangeExpr {}
850#[derive(Debug, Clone, PartialEq, Eq, Hash)]
851pub struct RecordExpr {
852 pub(crate) syntax: SyntaxNode,
853}
854impl RecordExpr {
855 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
856 pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> {
857 support::child(&self.syntax)
858 }
859}
860#[derive(Debug, Clone, PartialEq, Eq, Hash)]
861pub struct RefExpr {
862 pub(crate) syntax: SyntaxNode,
863}
864impl ast::AttrsOwner for RefExpr {}
865impl RefExpr {
866 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
867 pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) }
868 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
869 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
870 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
871}
872#[derive(Debug, Clone, PartialEq, Eq, Hash)]
873pub struct ReturnExpr {
874 pub(crate) syntax: SyntaxNode,
875}
876impl ast::AttrsOwner for ReturnExpr {}
877impl ReturnExpr {
878 pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) }
879 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
880}
881#[derive(Debug, Clone, PartialEq, Eq, Hash)]
882pub struct TryExpr {
883 pub(crate) syntax: SyntaxNode,
884}
885impl ast::AttrsOwner for TryExpr {}
886impl TryExpr {
887 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
888 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
889}
890#[derive(Debug, Clone, PartialEq, Eq, Hash)]
891pub struct TupleExpr {
892 pub(crate) syntax: SyntaxNode,
893}
894impl ast::AttrsOwner for TupleExpr {}
895impl TupleExpr {
896 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
897 pub fn fields(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
898 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
899}
900#[derive(Debug, Clone, PartialEq, Eq, Hash)]
901pub struct WhileExpr {
902 pub(crate) syntax: SyntaxNode,
903}
904impl ast::AttrsOwner for WhileExpr {}
905impl ast::LoopBodyOwner for WhileExpr {}
906impl WhileExpr {
907 pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) }
908 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
909}
910#[derive(Debug, Clone, PartialEq, Eq, Hash)]
911pub struct Label {
912 pub(crate) syntax: SyntaxNode,
913}
914impl Label {
915 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
916 support::token(&self.syntax, T![lifetime])
917 }
918}
919#[derive(Debug, Clone, PartialEq, Eq, Hash)]
920pub struct RecordExprFieldList {
921 pub(crate) syntax: SyntaxNode,
922}
923impl ast::AttrsOwner for RecordExprFieldList {}
924impl RecordExprFieldList {
925 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
926 pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) }
927 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
928 pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) }
929 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
930}
931#[derive(Debug, Clone, PartialEq, Eq, Hash)]
932pub struct RecordExprField {
933 pub(crate) syntax: SyntaxNode,
934}
935impl ast::AttrsOwner for RecordExprField {}
936impl RecordExprField {
937 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
938 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
939 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
940}
941#[derive(Debug, Clone, PartialEq, Eq, Hash)]
942pub struct ArgList {
943 pub(crate) syntax: SyntaxNode,
944}
945impl ArgList {
946 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
947 pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
948 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
949}
950#[derive(Debug, Clone, PartialEq, Eq, Hash)]
951pub struct Condition {
952 pub(crate) syntax: SyntaxNode,
953}
954impl Condition {
955 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
956 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
957 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
958 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
959}
960#[derive(Debug, Clone, PartialEq, Eq, Hash)]
961pub struct MatchArmList {
962 pub(crate) syntax: SyntaxNode,
963}
964impl ast::AttrsOwner for MatchArmList {}
965impl MatchArmList {
966 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
967 pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) }
968 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
969}
970#[derive(Debug, Clone, PartialEq, Eq, Hash)]
971pub struct MatchArm {
972 pub(crate) syntax: SyntaxNode,
973}
974impl ast::AttrsOwner for MatchArm {}
975impl MatchArm {
976 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
977 pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) }
978 pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) }
979 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
980 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
981}
982#[derive(Debug, Clone, PartialEq, Eq, Hash)]
983pub struct MatchGuard {
984 pub(crate) syntax: SyntaxNode,
985}
986impl MatchGuard {
987 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
988 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
989}
990#[derive(Debug, Clone, PartialEq, Eq, Hash)]
991pub struct ArrayType {
992 pub(crate) syntax: SyntaxNode,
993}
994impl ArrayType {
995 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
996 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
997 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
998 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
999 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1000}
1001#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1002pub struct DynTraitType {
1003 pub(crate) syntax: SyntaxNode,
1004}
1005impl DynTraitType {
1006 pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) }
1007 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) }
1008}
1009#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1010pub struct FnPtrType {
1011 pub(crate) syntax: SyntaxNode,
1012}
1013impl FnPtrType {
1014 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
1015 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
1016 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
1017 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
1018 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
1019 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
1020 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
1021}
1022#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1023pub struct ForType {
1024 pub(crate) syntax: SyntaxNode,
1025}
1026impl ForType {
1027 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
1028 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
1029 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1030}
1031#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1032pub struct ImplTraitType {
1033 pub(crate) syntax: SyntaxNode,
1034}
1035impl ImplTraitType {
1036 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
1037 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) }
1038}
1039#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1040pub struct InferType {
1041 pub(crate) syntax: SyntaxNode,
1042}
1043impl InferType {
1044 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
1045}
1046#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1047pub struct NeverType {
1048 pub(crate) syntax: SyntaxNode,
1049}
1050impl NeverType {
1051 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
1052}
1053#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1054pub struct ParenType {
1055 pub(crate) syntax: SyntaxNode,
1056}
1057impl ParenType {
1058 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1059 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1060 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1061}
1062#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1063pub struct PtrType {
1064 pub(crate) syntax: SyntaxNode,
1065}
1066impl PtrType {
1067 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
1068 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
1069 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1070 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1071}
1072#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1073pub struct RefType {
1074 pub(crate) syntax: SyntaxNode,
1075}
1076impl RefType {
1077 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1078 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1079 support::token(&self.syntax, T![lifetime])
1080 }
1081 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1082 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1083}
1084#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1085pub struct SliceType {
1086 pub(crate) syntax: SyntaxNode,
1087}
1088impl SliceType {
1089 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1090 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1091 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1092}
1093#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1094pub struct TupleType {
1095 pub(crate) syntax: SyntaxNode,
1096}
1097impl TupleType {
1098 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1099 pub fn fields(&self) -> AstChildren<Type> { support::children(&self.syntax) }
1100 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1101}
1102#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1103pub struct TypeBound {
1104 pub(crate) syntax: SyntaxNode,
1105}
1106impl TypeBound {
1107 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1108 support::token(&self.syntax, T![lifetime])
1109 }
1110 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
1111 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1112}
1113#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1114pub struct IdentPat {
1115 pub(crate) syntax: SyntaxNode,
1116}
1117impl ast::AttrsOwner for IdentPat {}
1118impl ast::NameOwner for IdentPat {}
1119impl IdentPat {
1120 pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) }
1121 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1122 pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) }
1123 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1124}
1125#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1126pub struct BoxPat {
1127 pub(crate) syntax: SyntaxNode,
1128}
1129impl BoxPat {
1130 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
1131 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1132}
1133#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1134pub struct RestPat {
1135 pub(crate) syntax: SyntaxNode,
1136}
1137impl RestPat {
1138 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1139}
1140#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1141pub struct LiteralPat {
1142 pub(crate) syntax: SyntaxNode,
1143}
1144impl LiteralPat {
1145 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
1146}
1147#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1148pub struct MacroPat {
1149 pub(crate) syntax: SyntaxNode,
1150}
1151impl MacroPat {
1152 pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) }
1153}
1154#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1155pub struct OrPat {
1156 pub(crate) syntax: SyntaxNode,
1157}
1158impl OrPat {
1159 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1160}
1161#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1162pub struct ParenPat {
1163 pub(crate) syntax: SyntaxNode,
1164}
1165impl ParenPat {
1166 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1167 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1168 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1169}
1170#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1171pub struct PathPat {
1172 pub(crate) syntax: SyntaxNode,
1173}
1174impl PathPat {
1175 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1176}
1177#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1178pub struct WildcardPat {
1179 pub(crate) syntax: SyntaxNode,
1180}
1181impl WildcardPat {
1182 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
1183}
1184#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1185pub struct RangePat {
1186 pub(crate) syntax: SyntaxNode,
1187}
1188impl RangePat {}
1189#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1190pub struct RecordPat {
1191 pub(crate) syntax: SyntaxNode,
1192}
1193impl RecordPat {
1194 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1195 pub fn record_pat_field_list(&self) -> Option<RecordPatFieldList> {
1196 support::child(&self.syntax)
1197 }
1198}
1199#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1200pub struct RefPat {
1201 pub(crate) syntax: SyntaxNode,
1202}
1203impl RefPat {
1204 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1205 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1206 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1207}
1208#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1209pub struct SlicePat {
1210 pub(crate) syntax: SyntaxNode,
1211}
1212impl SlicePat {
1213 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1214 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1215 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1216}
1217#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1218pub struct TuplePat {
1219 pub(crate) syntax: SyntaxNode,
1220}
1221impl TuplePat {
1222 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1223 pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1224 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1225}
1226#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1227pub struct TupleStructPat {
1228 pub(crate) syntax: SyntaxNode,
1229}
1230impl TupleStructPat {
1231 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1232 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1233 pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1234 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1235}
1236#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1237pub struct RecordPatFieldList {
1238 pub(crate) syntax: SyntaxNode,
1239}
1240impl RecordPatFieldList {
1241 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1242 pub fn fields(&self) -> AstChildren<RecordPatField> { support::children(&self.syntax) }
1243 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1244 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1245}
1246#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1247pub struct RecordPatField {
1248 pub(crate) syntax: SyntaxNode,
1249}
1250impl ast::AttrsOwner for RecordPatField {}
1251impl RecordPatField {
1252 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1253 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1254 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1255}
1256#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1257pub enum GenericArg {
1258 TypeArg(TypeArg),
1259 AssocTypeArg(AssocTypeArg),
1260 LifetimeArg(LifetimeArg),
1261 ConstArg(ConstArg),
1262}
1263#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1264pub enum Type {
1265 ArrayType(ArrayType),
1266 DynTraitType(DynTraitType),
1267 FnPtrType(FnPtrType),
1268 ForType(ForType),
1269 ImplTraitType(ImplTraitType),
1270 InferType(InferType),
1271 NeverType(NeverType),
1272 ParenType(ParenType),
1273 PathType(PathType),
1274 PtrType(PtrType),
1275 RefType(RefType),
1276 SliceType(SliceType),
1277 TupleType(TupleType),
1278}
1279#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1280pub enum Expr {
1281 ArrayExpr(ArrayExpr),
1282 AwaitExpr(AwaitExpr),
1283 BinExpr(BinExpr),
1284 BlockExpr(BlockExpr),
1285 BoxExpr(BoxExpr),
1286 BreakExpr(BreakExpr),
1287 CallExpr(CallExpr),
1288 CastExpr(CastExpr),
1289 ClosureExpr(ClosureExpr),
1290 ContinueExpr(ContinueExpr),
1291 EffectExpr(EffectExpr),
1292 FieldExpr(FieldExpr),
1293 ForExpr(ForExpr),
1294 IfExpr(IfExpr),
1295 IndexExpr(IndexExpr),
1296 Literal(Literal),
1297 LoopExpr(LoopExpr),
1298 MacroCall(MacroCall),
1299 MatchExpr(MatchExpr),
1300 MethodCallExpr(MethodCallExpr),
1301 ParenExpr(ParenExpr),
1302 PathExpr(PathExpr),
1303 PrefixExpr(PrefixExpr),
1304 RangeExpr(RangeExpr),
1305 RecordExpr(RecordExpr),
1306 RefExpr(RefExpr),
1307 ReturnExpr(ReturnExpr),
1308 TryExpr(TryExpr),
1309 TupleExpr(TupleExpr),
1310 WhileExpr(WhileExpr),
1311}
1312#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1313pub enum Item {
1314 Const(Const),
1315 Enum(Enum),
1316 ExternBlock(ExternBlock),
1317 ExternCrate(ExternCrate),
1318 Fn(Fn),
1319 Impl(Impl),
1320 MacroCall(MacroCall),
1321 Module(Module),
1322 Static(Static),
1323 Struct(Struct),
1324 Trait(Trait),
1325 TypeAlias(TypeAlias),
1326 Union(Union),
1327 Use(Use),
1328}
1329impl ast::AttrsOwner for Item {}
1330#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1331pub enum Stmt {
1332 ExprStmt(ExprStmt),
1333 Item(Item),
1334 LetStmt(LetStmt),
1335}
1336#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1337pub enum Pat {
1338 IdentPat(IdentPat),
1339 BoxPat(BoxPat),
1340 RestPat(RestPat),
1341 LiteralPat(LiteralPat),
1342 MacroPat(MacroPat),
1343 OrPat(OrPat),
1344 ParenPat(ParenPat),
1345 PathPat(PathPat),
1346 WildcardPat(WildcardPat),
1347 RangePat(RangePat),
1348 RecordPat(RecordPat),
1349 RefPat(RefPat),
1350 SlicePat(SlicePat),
1351 TuplePat(TuplePat),
1352 TupleStructPat(TupleStructPat),
1353}
1354#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1355pub enum FieldList {
1356 RecordFieldList(RecordFieldList),
1357 TupleFieldList(TupleFieldList),
1358}
1359#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1360pub enum AdtDef {
1361 Enum(Enum),
1362 Struct(Struct),
1363 Union(Union),
1364}
1365impl ast::AttrsOwner for AdtDef {}
1366impl ast::GenericParamsOwner for AdtDef {}
1367impl ast::NameOwner for AdtDef {}
1368impl ast::VisibilityOwner for AdtDef {}
1369#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1370pub enum AssocItem {
1371 Const(Const),
1372 Fn(Fn),
1373 MacroCall(MacroCall),
1374 TypeAlias(TypeAlias),
1375}
1376impl ast::AttrsOwner for AssocItem {}
1377impl ast::NameOwner for AssocItem {}
1378#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1379pub enum ExternItem {
1380 Fn(Fn),
1381 MacroCall(MacroCall),
1382 Static(Static),
1383}
1384impl ast::AttrsOwner for ExternItem {}
1385impl ast::NameOwner for ExternItem {}
1386#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1387pub enum GenericParam {
1388 ConstParam(ConstParam),
1389 LifetimeParam(LifetimeParam),
1390 TypeParam(TypeParam),
1391}
1392impl ast::AttrsOwner for GenericParam {}
1393impl AstNode for Name {
1394 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME }
1395 fn cast(syntax: SyntaxNode) -> Option<Self> {
1396 if Self::can_cast(syntax.kind()) {
1397 Some(Self { syntax })
1398 } else {
1399 None
1400 }
1401 }
1402 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1403}
1404impl AstNode for NameRef {
1405 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF }
1406 fn cast(syntax: SyntaxNode) -> Option<Self> {
1407 if Self::can_cast(syntax.kind()) {
1408 Some(Self { syntax })
1409 } else {
1410 None
1411 }
1412 }
1413 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1414}
1415impl AstNode for Path {
1416 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH }
1417 fn cast(syntax: SyntaxNode) -> Option<Self> {
1418 if Self::can_cast(syntax.kind()) {
1419 Some(Self { syntax })
1420 } else {
1421 None
1422 }
1423 }
1424 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1425}
1426impl AstNode for PathSegment {
1427 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT }
1428 fn cast(syntax: SyntaxNode) -> Option<Self> {
1429 if Self::can_cast(syntax.kind()) {
1430 Some(Self { syntax })
1431 } else {
1432 None
1433 }
1434 }
1435 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1436}
1437impl AstNode for GenericArgList {
1438 fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_ARG_LIST }
1439 fn cast(syntax: SyntaxNode) -> Option<Self> {
1440 if Self::can_cast(syntax.kind()) {
1441 Some(Self { syntax })
1442 } else {
1443 None
1444 }
1445 }
1446 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1447}
1448impl AstNode for ParamList {
1449 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST }
1450 fn cast(syntax: SyntaxNode) -> Option<Self> {
1451 if Self::can_cast(syntax.kind()) {
1452 Some(Self { syntax })
1453 } else {
1454 None
1455 }
1456 }
1457 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1458}
1459impl AstNode for RetType {
1460 fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE }
1461 fn cast(syntax: SyntaxNode) -> Option<Self> {
1462 if Self::can_cast(syntax.kind()) {
1463 Some(Self { syntax })
1464 } else {
1465 None
1466 }
1467 }
1468 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1469}
1470impl AstNode for PathType {
1471 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE }
1472 fn cast(syntax: SyntaxNode) -> Option<Self> {
1473 if Self::can_cast(syntax.kind()) {
1474 Some(Self { syntax })
1475 } else {
1476 None
1477 }
1478 }
1479 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1480}
1481impl AstNode for TypeArg {
1482 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG }
1483 fn cast(syntax: SyntaxNode) -> Option<Self> {
1484 if Self::can_cast(syntax.kind()) {
1485 Some(Self { syntax })
1486 } else {
1487 None
1488 }
1489 }
1490 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1491}
1492impl AstNode for AssocTypeArg {
1493 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG }
1494 fn cast(syntax: SyntaxNode) -> Option<Self> {
1495 if Self::can_cast(syntax.kind()) {
1496 Some(Self { syntax })
1497 } else {
1498 None
1499 }
1500 }
1501 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1502}
1503impl AstNode for LifetimeArg {
1504 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG }
1505 fn cast(syntax: SyntaxNode) -> Option<Self> {
1506 if Self::can_cast(syntax.kind()) {
1507 Some(Self { syntax })
1508 } else {
1509 None
1510 }
1511 }
1512 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1513}
1514impl AstNode for ConstArg {
1515 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG }
1516 fn cast(syntax: SyntaxNode) -> Option<Self> {
1517 if Self::can_cast(syntax.kind()) {
1518 Some(Self { syntax })
1519 } else {
1520 None
1521 }
1522 }
1523 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1524}
1525impl AstNode for TypeBoundList {
1526 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
1527 fn cast(syntax: SyntaxNode) -> Option<Self> {
1528 if Self::can_cast(syntax.kind()) {
1529 Some(Self { syntax })
1530 } else {
1531 None
1532 }
1533 }
1534 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1535}
1536impl AstNode for MacroCall {
1537 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL }
1538 fn cast(syntax: SyntaxNode) -> Option<Self> {
1539 if Self::can_cast(syntax.kind()) {
1540 Some(Self { syntax })
1541 } else {
1542 None
1543 }
1544 }
1545 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1546}
1547impl AstNode for Attr {
1548 fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR }
1549 fn cast(syntax: SyntaxNode) -> Option<Self> {
1550 if Self::can_cast(syntax.kind()) {
1551 Some(Self { syntax })
1552 } else {
1553 None
1554 }
1555 }
1556 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1557}
1558impl AstNode for TokenTree {
1559 fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE }
1560 fn cast(syntax: SyntaxNode) -> Option<Self> {
1561 if Self::can_cast(syntax.kind()) {
1562 Some(Self { syntax })
1563 } else {
1564 None
1565 }
1566 }
1567 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1568}
1569impl AstNode for MacroItems {
1570 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS }
1571 fn cast(syntax: SyntaxNode) -> Option<Self> {
1572 if Self::can_cast(syntax.kind()) {
1573 Some(Self { syntax })
1574 } else {
1575 None
1576 }
1577 }
1578 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1579}
1580impl AstNode for MacroStmts {
1581 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS }
1582 fn cast(syntax: SyntaxNode) -> Option<Self> {
1583 if Self::can_cast(syntax.kind()) {
1584 Some(Self { syntax })
1585 } else {
1586 None
1587 }
1588 }
1589 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1590}
1591impl AstNode for SourceFile {
1592 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE }
1593 fn cast(syntax: SyntaxNode) -> Option<Self> {
1594 if Self::can_cast(syntax.kind()) {
1595 Some(Self { syntax })
1596 } else {
1597 None
1598 }
1599 }
1600 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1601}
1602impl AstNode for Const {
1603 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST }
1604 fn cast(syntax: SyntaxNode) -> Option<Self> {
1605 if Self::can_cast(syntax.kind()) {
1606 Some(Self { syntax })
1607 } else {
1608 None
1609 }
1610 }
1611 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1612}
1613impl AstNode for Enum {
1614 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM }
1615 fn cast(syntax: SyntaxNode) -> Option<Self> {
1616 if Self::can_cast(syntax.kind()) {
1617 Some(Self { syntax })
1618 } else {
1619 None
1620 }
1621 }
1622 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1623}
1624impl AstNode for ExternBlock {
1625 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK }
1626 fn cast(syntax: SyntaxNode) -> Option<Self> {
1627 if Self::can_cast(syntax.kind()) {
1628 Some(Self { syntax })
1629 } else {
1630 None
1631 }
1632 }
1633 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1634}
1635impl AstNode for ExternCrate {
1636 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE }
1637 fn cast(syntax: SyntaxNode) -> Option<Self> {
1638 if Self::can_cast(syntax.kind()) {
1639 Some(Self { syntax })
1640 } else {
1641 None
1642 }
1643 }
1644 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1645}
1646impl AstNode for Fn {
1647 fn can_cast(kind: SyntaxKind) -> bool { kind == FN }
1648 fn cast(syntax: SyntaxNode) -> Option<Self> {
1649 if Self::can_cast(syntax.kind()) {
1650 Some(Self { syntax })
1651 } else {
1652 None
1653 }
1654 }
1655 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1656}
1657impl AstNode for Impl {
1658 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL }
1659 fn cast(syntax: SyntaxNode) -> Option<Self> {
1660 if Self::can_cast(syntax.kind()) {
1661 Some(Self { syntax })
1662 } else {
1663 None
1664 }
1665 }
1666 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1667}
1668impl AstNode for Module {
1669 fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE }
1670 fn cast(syntax: SyntaxNode) -> Option<Self> {
1671 if Self::can_cast(syntax.kind()) {
1672 Some(Self { syntax })
1673 } else {
1674 None
1675 }
1676 }
1677 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1678}
1679impl AstNode for Static {
1680 fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC }
1681 fn cast(syntax: SyntaxNode) -> Option<Self> {
1682 if Self::can_cast(syntax.kind()) {
1683 Some(Self { syntax })
1684 } else {
1685 None
1686 }
1687 }
1688 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1689}
1690impl AstNode for Struct {
1691 fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT }
1692 fn cast(syntax: SyntaxNode) -> Option<Self> {
1693 if Self::can_cast(syntax.kind()) {
1694 Some(Self { syntax })
1695 } else {
1696 None
1697 }
1698 }
1699 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1700}
1701impl AstNode for Trait {
1702 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT }
1703 fn cast(syntax: SyntaxNode) -> Option<Self> {
1704 if Self::can_cast(syntax.kind()) {
1705 Some(Self { syntax })
1706 } else {
1707 None
1708 }
1709 }
1710 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1711}
1712impl AstNode for TypeAlias {
1713 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS }
1714 fn cast(syntax: SyntaxNode) -> Option<Self> {
1715 if Self::can_cast(syntax.kind()) {
1716 Some(Self { syntax })
1717 } else {
1718 None
1719 }
1720 }
1721 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1722}
1723impl AstNode for Union {
1724 fn can_cast(kind: SyntaxKind) -> bool { kind == UNION }
1725 fn cast(syntax: SyntaxNode) -> Option<Self> {
1726 if Self::can_cast(syntax.kind()) {
1727 Some(Self { syntax })
1728 } else {
1729 None
1730 }
1731 }
1732 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1733}
1734impl AstNode for Use {
1735 fn can_cast(kind: SyntaxKind) -> bool { kind == USE }
1736 fn cast(syntax: SyntaxNode) -> Option<Self> {
1737 if Self::can_cast(syntax.kind()) {
1738 Some(Self { syntax })
1739 } else {
1740 None
1741 }
1742 }
1743 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1744}
1745impl AstNode for Visibility {
1746 fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY }
1747 fn cast(syntax: SyntaxNode) -> Option<Self> {
1748 if Self::can_cast(syntax.kind()) {
1749 Some(Self { syntax })
1750 } else {
1751 None
1752 }
1753 }
1754 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1755}
1756impl AstNode for ItemList {
1757 fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST }
1758 fn cast(syntax: SyntaxNode) -> Option<Self> {
1759 if Self::can_cast(syntax.kind()) {
1760 Some(Self { syntax })
1761 } else {
1762 None
1763 }
1764 }
1765 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1766}
1767impl AstNode for Rename {
1768 fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME }
1769 fn cast(syntax: SyntaxNode) -> Option<Self> {
1770 if Self::can_cast(syntax.kind()) {
1771 Some(Self { syntax })
1772 } else {
1773 None
1774 }
1775 }
1776 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1777}
1778impl AstNode for UseTree {
1779 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE }
1780 fn cast(syntax: SyntaxNode) -> Option<Self> {
1781 if Self::can_cast(syntax.kind()) {
1782 Some(Self { syntax })
1783 } else {
1784 None
1785 }
1786 }
1787 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1788}
1789impl AstNode for UseTreeList {
1790 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST }
1791 fn cast(syntax: SyntaxNode) -> Option<Self> {
1792 if Self::can_cast(syntax.kind()) {
1793 Some(Self { syntax })
1794 } else {
1795 None
1796 }
1797 }
1798 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1799}
1800impl AstNode for Abi {
1801 fn can_cast(kind: SyntaxKind) -> bool { kind == ABI }
1802 fn cast(syntax: SyntaxNode) -> Option<Self> {
1803 if Self::can_cast(syntax.kind()) {
1804 Some(Self { syntax })
1805 } else {
1806 None
1807 }
1808 }
1809 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1810}
1811impl AstNode for GenericParamList {
1812 fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST }
1813 fn cast(syntax: SyntaxNode) -> Option<Self> {
1814 if Self::can_cast(syntax.kind()) {
1815 Some(Self { syntax })
1816 } else {
1817 None
1818 }
1819 }
1820 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1821}
1822impl AstNode for WhereClause {
1823 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE }
1824 fn cast(syntax: SyntaxNode) -> Option<Self> {
1825 if Self::can_cast(syntax.kind()) {
1826 Some(Self { syntax })
1827 } else {
1828 None
1829 }
1830 }
1831 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1832}
1833impl AstNode for BlockExpr {
1834 fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR }
1835 fn cast(syntax: SyntaxNode) -> Option<Self> {
1836 if Self::can_cast(syntax.kind()) {
1837 Some(Self { syntax })
1838 } else {
1839 None
1840 }
1841 }
1842 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1843}
1844impl AstNode for SelfParam {
1845 fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM }
1846 fn cast(syntax: SyntaxNode) -> Option<Self> {
1847 if Self::can_cast(syntax.kind()) {
1848 Some(Self { syntax })
1849 } else {
1850 None
1851 }
1852 }
1853 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1854}
1855impl AstNode for Param {
1856 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM }
1857 fn cast(syntax: SyntaxNode) -> Option<Self> {
1858 if Self::can_cast(syntax.kind()) {
1859 Some(Self { syntax })
1860 } else {
1861 None
1862 }
1863 }
1864 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1865}
1866impl AstNode for RecordFieldList {
1867 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST }
1868 fn cast(syntax: SyntaxNode) -> Option<Self> {
1869 if Self::can_cast(syntax.kind()) {
1870 Some(Self { syntax })
1871 } else {
1872 None
1873 }
1874 }
1875 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1876}
1877impl AstNode for TupleFieldList {
1878 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST }
1879 fn cast(syntax: SyntaxNode) -> Option<Self> {
1880 if Self::can_cast(syntax.kind()) {
1881 Some(Self { syntax })
1882 } else {
1883 None
1884 }
1885 }
1886 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1887}
1888impl AstNode for RecordField {
1889 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD }
1890 fn cast(syntax: SyntaxNode) -> Option<Self> {
1891 if Self::can_cast(syntax.kind()) {
1892 Some(Self { syntax })
1893 } else {
1894 None
1895 }
1896 }
1897 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1898}
1899impl AstNode for TupleField {
1900 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD }
1901 fn cast(syntax: SyntaxNode) -> Option<Self> {
1902 if Self::can_cast(syntax.kind()) {
1903 Some(Self { syntax })
1904 } else {
1905 None
1906 }
1907 }
1908 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1909}
1910impl AstNode for VariantList {
1911 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST }
1912 fn cast(syntax: SyntaxNode) -> Option<Self> {
1913 if Self::can_cast(syntax.kind()) {
1914 Some(Self { syntax })
1915 } else {
1916 None
1917 }
1918 }
1919 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1920}
1921impl AstNode for Variant {
1922 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT }
1923 fn cast(syntax: SyntaxNode) -> Option<Self> {
1924 if Self::can_cast(syntax.kind()) {
1925 Some(Self { syntax })
1926 } else {
1927 None
1928 }
1929 }
1930 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1931}
1932impl AstNode for AssocItemList {
1933 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST }
1934 fn cast(syntax: SyntaxNode) -> Option<Self> {
1935 if Self::can_cast(syntax.kind()) {
1936 Some(Self { syntax })
1937 } else {
1938 None
1939 }
1940 }
1941 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1942}
1943impl AstNode for ExternItemList {
1944 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST }
1945 fn cast(syntax: SyntaxNode) -> Option<Self> {
1946 if Self::can_cast(syntax.kind()) {
1947 Some(Self { syntax })
1948 } else {
1949 None
1950 }
1951 }
1952 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1953}
1954impl AstNode for ConstParam {
1955 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM }
1956 fn cast(syntax: SyntaxNode) -> Option<Self> {
1957 if Self::can_cast(syntax.kind()) {
1958 Some(Self { syntax })
1959 } else {
1960 None
1961 }
1962 }
1963 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1964}
1965impl AstNode for LifetimeParam {
1966 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM }
1967 fn cast(syntax: SyntaxNode) -> Option<Self> {
1968 if Self::can_cast(syntax.kind()) {
1969 Some(Self { syntax })
1970 } else {
1971 None
1972 }
1973 }
1974 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1975}
1976impl AstNode for TypeParam {
1977 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM }
1978 fn cast(syntax: SyntaxNode) -> Option<Self> {
1979 if Self::can_cast(syntax.kind()) {
1980 Some(Self { syntax })
1981 } else {
1982 None
1983 }
1984 }
1985 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1986}
1987impl AstNode for WherePred {
1988 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED }
1989 fn cast(syntax: SyntaxNode) -> Option<Self> {
1990 if Self::can_cast(syntax.kind()) {
1991 Some(Self { syntax })
1992 } else {
1993 None
1994 }
1995 }
1996 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1997}
1998impl AstNode for Literal {
1999 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL }
2000 fn cast(syntax: SyntaxNode) -> Option<Self> {
2001 if Self::can_cast(syntax.kind()) {
2002 Some(Self { syntax })
2003 } else {
2004 None
2005 }
2006 }
2007 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2008}
2009impl AstNode for ExprStmt {
2010 fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT }
2011 fn cast(syntax: SyntaxNode) -> Option<Self> {
2012 if Self::can_cast(syntax.kind()) {
2013 Some(Self { syntax })
2014 } else {
2015 None
2016 }
2017 }
2018 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2019}
2020impl AstNode for LetStmt {
2021 fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT }
2022 fn cast(syntax: SyntaxNode) -> Option<Self> {
2023 if Self::can_cast(syntax.kind()) {
2024 Some(Self { syntax })
2025 } else {
2026 None
2027 }
2028 }
2029 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2030}
2031impl AstNode for ArrayExpr {
2032 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR }
2033 fn cast(syntax: SyntaxNode) -> Option<Self> {
2034 if Self::can_cast(syntax.kind()) {
2035 Some(Self { syntax })
2036 } else {
2037 None
2038 }
2039 }
2040 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2041}
2042impl AstNode for AwaitExpr {
2043 fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR }
2044 fn cast(syntax: SyntaxNode) -> Option<Self> {
2045 if Self::can_cast(syntax.kind()) {
2046 Some(Self { syntax })
2047 } else {
2048 None
2049 }
2050 }
2051 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2052}
2053impl AstNode for BinExpr {
2054 fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR }
2055 fn cast(syntax: SyntaxNode) -> Option<Self> {
2056 if Self::can_cast(syntax.kind()) {
2057 Some(Self { syntax })
2058 } else {
2059 None
2060 }
2061 }
2062 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2063}
2064impl AstNode for BoxExpr {
2065 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR }
2066 fn cast(syntax: SyntaxNode) -> Option<Self> {
2067 if Self::can_cast(syntax.kind()) {
2068 Some(Self { syntax })
2069 } else {
2070 None
2071 }
2072 }
2073 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2074}
2075impl AstNode for BreakExpr {
2076 fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR }
2077 fn cast(syntax: SyntaxNode) -> Option<Self> {
2078 if Self::can_cast(syntax.kind()) {
2079 Some(Self { syntax })
2080 } else {
2081 None
2082 }
2083 }
2084 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2085}
2086impl AstNode for CallExpr {
2087 fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR }
2088 fn cast(syntax: SyntaxNode) -> Option<Self> {
2089 if Self::can_cast(syntax.kind()) {
2090 Some(Self { syntax })
2091 } else {
2092 None
2093 }
2094 }
2095 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2096}
2097impl AstNode for CastExpr {
2098 fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR }
2099 fn cast(syntax: SyntaxNode) -> Option<Self> {
2100 if Self::can_cast(syntax.kind()) {
2101 Some(Self { syntax })
2102 } else {
2103 None
2104 }
2105 }
2106 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2107}
2108impl AstNode for ClosureExpr {
2109 fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR }
2110 fn cast(syntax: SyntaxNode) -> Option<Self> {
2111 if Self::can_cast(syntax.kind()) {
2112 Some(Self { syntax })
2113 } else {
2114 None
2115 }
2116 }
2117 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2118}
2119impl AstNode for ContinueExpr {
2120 fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR }
2121 fn cast(syntax: SyntaxNode) -> Option<Self> {
2122 if Self::can_cast(syntax.kind()) {
2123 Some(Self { syntax })
2124 } else {
2125 None
2126 }
2127 }
2128 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2129}
2130impl AstNode for EffectExpr {
2131 fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR }
2132 fn cast(syntax: SyntaxNode) -> Option<Self> {
2133 if Self::can_cast(syntax.kind()) {
2134 Some(Self { syntax })
2135 } else {
2136 None
2137 }
2138 }
2139 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2140}
2141impl AstNode for FieldExpr {
2142 fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR }
2143 fn cast(syntax: SyntaxNode) -> Option<Self> {
2144 if Self::can_cast(syntax.kind()) {
2145 Some(Self { syntax })
2146 } else {
2147 None
2148 }
2149 }
2150 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2151}
2152impl AstNode for ForExpr {
2153 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR }
2154 fn cast(syntax: SyntaxNode) -> Option<Self> {
2155 if Self::can_cast(syntax.kind()) {
2156 Some(Self { syntax })
2157 } else {
2158 None
2159 }
2160 }
2161 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2162}
2163impl AstNode for IfExpr {
2164 fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR }
2165 fn cast(syntax: SyntaxNode) -> Option<Self> {
2166 if Self::can_cast(syntax.kind()) {
2167 Some(Self { syntax })
2168 } else {
2169 None
2170 }
2171 }
2172 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2173}
2174impl AstNode for IndexExpr {
2175 fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR }
2176 fn cast(syntax: SyntaxNode) -> Option<Self> {
2177 if Self::can_cast(syntax.kind()) {
2178 Some(Self { syntax })
2179 } else {
2180 None
2181 }
2182 }
2183 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2184}
2185impl AstNode for LoopExpr {
2186 fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR }
2187 fn cast(syntax: SyntaxNode) -> Option<Self> {
2188 if Self::can_cast(syntax.kind()) {
2189 Some(Self { syntax })
2190 } else {
2191 None
2192 }
2193 }
2194 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2195}
2196impl AstNode for MatchExpr {
2197 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR }
2198 fn cast(syntax: SyntaxNode) -> Option<Self> {
2199 if Self::can_cast(syntax.kind()) {
2200 Some(Self { syntax })
2201 } else {
2202 None
2203 }
2204 }
2205 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2206}
2207impl AstNode for MethodCallExpr {
2208 fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR }
2209 fn cast(syntax: SyntaxNode) -> Option<Self> {
2210 if Self::can_cast(syntax.kind()) {
2211 Some(Self { syntax })
2212 } else {
2213 None
2214 }
2215 }
2216 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2217}
2218impl AstNode for ParenExpr {
2219 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR }
2220 fn cast(syntax: SyntaxNode) -> Option<Self> {
2221 if Self::can_cast(syntax.kind()) {
2222 Some(Self { syntax })
2223 } else {
2224 None
2225 }
2226 }
2227 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2228}
2229impl AstNode for PathExpr {
2230 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR }
2231 fn cast(syntax: SyntaxNode) -> Option<Self> {
2232 if Self::can_cast(syntax.kind()) {
2233 Some(Self { syntax })
2234 } else {
2235 None
2236 }
2237 }
2238 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2239}
2240impl AstNode for PrefixExpr {
2241 fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR }
2242 fn cast(syntax: SyntaxNode) -> Option<Self> {
2243 if Self::can_cast(syntax.kind()) {
2244 Some(Self { syntax })
2245 } else {
2246 None
2247 }
2248 }
2249 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2250}
2251impl AstNode for RangeExpr {
2252 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR }
2253 fn cast(syntax: SyntaxNode) -> Option<Self> {
2254 if Self::can_cast(syntax.kind()) {
2255 Some(Self { syntax })
2256 } else {
2257 None
2258 }
2259 }
2260 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2261}
2262impl AstNode for RecordExpr {
2263 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR }
2264 fn cast(syntax: SyntaxNode) -> Option<Self> {
2265 if Self::can_cast(syntax.kind()) {
2266 Some(Self { syntax })
2267 } else {
2268 None
2269 }
2270 }
2271 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2272}
2273impl AstNode for RefExpr {
2274 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR }
2275 fn cast(syntax: SyntaxNode) -> Option<Self> {
2276 if Self::can_cast(syntax.kind()) {
2277 Some(Self { syntax })
2278 } else {
2279 None
2280 }
2281 }
2282 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2283}
2284impl AstNode for ReturnExpr {
2285 fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR }
2286 fn cast(syntax: SyntaxNode) -> Option<Self> {
2287 if Self::can_cast(syntax.kind()) {
2288 Some(Self { syntax })
2289 } else {
2290 None
2291 }
2292 }
2293 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2294}
2295impl AstNode for TryExpr {
2296 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR }
2297 fn cast(syntax: SyntaxNode) -> Option<Self> {
2298 if Self::can_cast(syntax.kind()) {
2299 Some(Self { syntax })
2300 } else {
2301 None
2302 }
2303 }
2304 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2305}
2306impl AstNode for TupleExpr {
2307 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR }
2308 fn cast(syntax: SyntaxNode) -> Option<Self> {
2309 if Self::can_cast(syntax.kind()) {
2310 Some(Self { syntax })
2311 } else {
2312 None
2313 }
2314 }
2315 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2316}
2317impl AstNode for WhileExpr {
2318 fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR }
2319 fn cast(syntax: SyntaxNode) -> Option<Self> {
2320 if Self::can_cast(syntax.kind()) {
2321 Some(Self { syntax })
2322 } else {
2323 None
2324 }
2325 }
2326 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2327}
2328impl AstNode for Label {
2329 fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL }
2330 fn cast(syntax: SyntaxNode) -> Option<Self> {
2331 if Self::can_cast(syntax.kind()) {
2332 Some(Self { syntax })
2333 } else {
2334 None
2335 }
2336 }
2337 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2338}
2339impl AstNode for RecordExprFieldList {
2340 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST }
2341 fn cast(syntax: SyntaxNode) -> Option<Self> {
2342 if Self::can_cast(syntax.kind()) {
2343 Some(Self { syntax })
2344 } else {
2345 None
2346 }
2347 }
2348 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2349}
2350impl AstNode for RecordExprField {
2351 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD }
2352 fn cast(syntax: SyntaxNode) -> Option<Self> {
2353 if Self::can_cast(syntax.kind()) {
2354 Some(Self { syntax })
2355 } else {
2356 None
2357 }
2358 }
2359 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2360}
2361impl AstNode for ArgList {
2362 fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST }
2363 fn cast(syntax: SyntaxNode) -> Option<Self> {
2364 if Self::can_cast(syntax.kind()) {
2365 Some(Self { syntax })
2366 } else {
2367 None
2368 }
2369 }
2370 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2371}
2372impl AstNode for Condition {
2373 fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION }
2374 fn cast(syntax: SyntaxNode) -> Option<Self> {
2375 if Self::can_cast(syntax.kind()) {
2376 Some(Self { syntax })
2377 } else {
2378 None
2379 }
2380 }
2381 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2382}
2383impl AstNode for MatchArmList {
2384 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST }
2385 fn cast(syntax: SyntaxNode) -> Option<Self> {
2386 if Self::can_cast(syntax.kind()) {
2387 Some(Self { syntax })
2388 } else {
2389 None
2390 }
2391 }
2392 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2393}
2394impl AstNode for MatchArm {
2395 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM }
2396 fn cast(syntax: SyntaxNode) -> Option<Self> {
2397 if Self::can_cast(syntax.kind()) {
2398 Some(Self { syntax })
2399 } else {
2400 None
2401 }
2402 }
2403 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2404}
2405impl AstNode for MatchGuard {
2406 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD }
2407 fn cast(syntax: SyntaxNode) -> Option<Self> {
2408 if Self::can_cast(syntax.kind()) {
2409 Some(Self { syntax })
2410 } else {
2411 None
2412 }
2413 }
2414 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2415}
2416impl AstNode for ArrayType {
2417 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE }
2418 fn cast(syntax: SyntaxNode) -> Option<Self> {
2419 if Self::can_cast(syntax.kind()) {
2420 Some(Self { syntax })
2421 } else {
2422 None
2423 }
2424 }
2425 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2426}
2427impl AstNode for DynTraitType {
2428 fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE }
2429 fn cast(syntax: SyntaxNode) -> Option<Self> {
2430 if Self::can_cast(syntax.kind()) {
2431 Some(Self { syntax })
2432 } else {
2433 None
2434 }
2435 }
2436 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2437}
2438impl AstNode for FnPtrType {
2439 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_PTR_TYPE }
2440 fn cast(syntax: SyntaxNode) -> Option<Self> {
2441 if Self::can_cast(syntax.kind()) {
2442 Some(Self { syntax })
2443 } else {
2444 None
2445 }
2446 }
2447 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2448}
2449impl AstNode for ForType {
2450 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE }
2451 fn cast(syntax: SyntaxNode) -> Option<Self> {
2452 if Self::can_cast(syntax.kind()) {
2453 Some(Self { syntax })
2454 } else {
2455 None
2456 }
2457 }
2458 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2459}
2460impl AstNode for ImplTraitType {
2461 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE }
2462 fn cast(syntax: SyntaxNode) -> Option<Self> {
2463 if Self::can_cast(syntax.kind()) {
2464 Some(Self { syntax })
2465 } else {
2466 None
2467 }
2468 }
2469 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2470}
2471impl AstNode for InferType {
2472 fn can_cast(kind: SyntaxKind) -> bool { kind == INFER_TYPE }
2473 fn cast(syntax: SyntaxNode) -> Option<Self> {
2474 if Self::can_cast(syntax.kind()) {
2475 Some(Self { syntax })
2476 } else {
2477 None
2478 }
2479 }
2480 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2481}
2482impl AstNode for NeverType {
2483 fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE }
2484 fn cast(syntax: SyntaxNode) -> Option<Self> {
2485 if Self::can_cast(syntax.kind()) {
2486 Some(Self { syntax })
2487 } else {
2488 None
2489 }
2490 }
2491 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2492}
2493impl AstNode for ParenType {
2494 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE }
2495 fn cast(syntax: SyntaxNode) -> Option<Self> {
2496 if Self::can_cast(syntax.kind()) {
2497 Some(Self { syntax })
2498 } else {
2499 None
2500 }
2501 }
2502 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2503}
2504impl AstNode for PtrType {
2505 fn can_cast(kind: SyntaxKind) -> bool { kind == PTR_TYPE }
2506 fn cast(syntax: SyntaxNode) -> Option<Self> {
2507 if Self::can_cast(syntax.kind()) {
2508 Some(Self { syntax })
2509 } else {
2510 None
2511 }
2512 }
2513 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2514}
2515impl AstNode for RefType {
2516 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_TYPE }
2517 fn cast(syntax: SyntaxNode) -> Option<Self> {
2518 if Self::can_cast(syntax.kind()) {
2519 Some(Self { syntax })
2520 } else {
2521 None
2522 }
2523 }
2524 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2525}
2526impl AstNode for SliceType {
2527 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE }
2528 fn cast(syntax: SyntaxNode) -> Option<Self> {
2529 if Self::can_cast(syntax.kind()) {
2530 Some(Self { syntax })
2531 } else {
2532 None
2533 }
2534 }
2535 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2536}
2537impl AstNode for TupleType {
2538 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE }
2539 fn cast(syntax: SyntaxNode) -> Option<Self> {
2540 if Self::can_cast(syntax.kind()) {
2541 Some(Self { syntax })
2542 } else {
2543 None
2544 }
2545 }
2546 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2547}
2548impl AstNode for TypeBound {
2549 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND }
2550 fn cast(syntax: SyntaxNode) -> Option<Self> {
2551 if Self::can_cast(syntax.kind()) {
2552 Some(Self { syntax })
2553 } else {
2554 None
2555 }
2556 }
2557 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2558}
2559impl AstNode for IdentPat {
2560 fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT_PAT }
2561 fn cast(syntax: SyntaxNode) -> Option<Self> {
2562 if Self::can_cast(syntax.kind()) {
2563 Some(Self { syntax })
2564 } else {
2565 None
2566 }
2567 }
2568 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2569}
2570impl AstNode for BoxPat {
2571 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT }
2572 fn cast(syntax: SyntaxNode) -> Option<Self> {
2573 if Self::can_cast(syntax.kind()) {
2574 Some(Self { syntax })
2575 } else {
2576 None
2577 }
2578 }
2579 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2580}
2581impl AstNode for RestPat {
2582 fn can_cast(kind: SyntaxKind) -> bool { kind == REST_PAT }
2583 fn cast(syntax: SyntaxNode) -> Option<Self> {
2584 if Self::can_cast(syntax.kind()) {
2585 Some(Self { syntax })
2586 } else {
2587 None
2588 }
2589 }
2590 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2591}
2592impl AstNode for LiteralPat {
2593 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT }
2594 fn cast(syntax: SyntaxNode) -> Option<Self> {
2595 if Self::can_cast(syntax.kind()) {
2596 Some(Self { syntax })
2597 } else {
2598 None
2599 }
2600 }
2601 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2602}
2603impl AstNode for MacroPat {
2604 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT }
2605 fn cast(syntax: SyntaxNode) -> Option<Self> {
2606 if Self::can_cast(syntax.kind()) {
2607 Some(Self { syntax })
2608 } else {
2609 None
2610 }
2611 }
2612 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2613}
2614impl AstNode for OrPat {
2615 fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT }
2616 fn cast(syntax: SyntaxNode) -> Option<Self> {
2617 if Self::can_cast(syntax.kind()) {
2618 Some(Self { syntax })
2619 } else {
2620 None
2621 }
2622 }
2623 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2624}
2625impl AstNode for ParenPat {
2626 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT }
2627 fn cast(syntax: SyntaxNode) -> Option<Self> {
2628 if Self::can_cast(syntax.kind()) {
2629 Some(Self { syntax })
2630 } else {
2631 None
2632 }
2633 }
2634 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2635}
2636impl AstNode for PathPat {
2637 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT }
2638 fn cast(syntax: SyntaxNode) -> Option<Self> {
2639 if Self::can_cast(syntax.kind()) {
2640 Some(Self { syntax })
2641 } else {
2642 None
2643 }
2644 }
2645 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2646}
2647impl AstNode for WildcardPat {
2648 fn can_cast(kind: SyntaxKind) -> bool { kind == WILDCARD_PAT }
2649 fn cast(syntax: SyntaxNode) -> Option<Self> {
2650 if Self::can_cast(syntax.kind()) {
2651 Some(Self { syntax })
2652 } else {
2653 None
2654 }
2655 }
2656 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2657}
2658impl AstNode for RangePat {
2659 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT }
2660 fn cast(syntax: SyntaxNode) -> Option<Self> {
2661 if Self::can_cast(syntax.kind()) {
2662 Some(Self { syntax })
2663 } else {
2664 None
2665 }
2666 }
2667 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2668}
2669impl AstNode for RecordPat {
2670 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT }
2671 fn cast(syntax: SyntaxNode) -> Option<Self> {
2672 if Self::can_cast(syntax.kind()) {
2673 Some(Self { syntax })
2674 } else {
2675 None
2676 }
2677 }
2678 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2679}
2680impl AstNode for RefPat {
2681 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT }
2682 fn cast(syntax: SyntaxNode) -> Option<Self> {
2683 if Self::can_cast(syntax.kind()) {
2684 Some(Self { syntax })
2685 } else {
2686 None
2687 }
2688 }
2689 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2690}
2691impl AstNode for SlicePat {
2692 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT }
2693 fn cast(syntax: SyntaxNode) -> Option<Self> {
2694 if Self::can_cast(syntax.kind()) {
2695 Some(Self { syntax })
2696 } else {
2697 None
2698 }
2699 }
2700 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2701}
2702impl AstNode for TuplePat {
2703 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT }
2704 fn cast(syntax: SyntaxNode) -> Option<Self> {
2705 if Self::can_cast(syntax.kind()) {
2706 Some(Self { syntax })
2707 } else {
2708 None
2709 }
2710 }
2711 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2712}
2713impl AstNode for TupleStructPat {
2714 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT }
2715 fn cast(syntax: SyntaxNode) -> Option<Self> {
2716 if Self::can_cast(syntax.kind()) {
2717 Some(Self { syntax })
2718 } else {
2719 None
2720 }
2721 }
2722 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2723}
2724impl AstNode for RecordPatFieldList {
2725 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD_LIST }
2726 fn cast(syntax: SyntaxNode) -> Option<Self> {
2727 if Self::can_cast(syntax.kind()) {
2728 Some(Self { syntax })
2729 } else {
2730 None
2731 }
2732 }
2733 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2734}
2735impl AstNode for RecordPatField {
2736 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD }
2737 fn cast(syntax: SyntaxNode) -> Option<Self> {
2738 if Self::can_cast(syntax.kind()) {
2739 Some(Self { syntax })
2740 } else {
2741 None
2742 }
2743 }
2744 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2745}
2746impl From<TypeArg> for GenericArg {
2747 fn from(node: TypeArg) -> GenericArg { GenericArg::TypeArg(node) }
2748}
2749impl From<AssocTypeArg> for GenericArg {
2750 fn from(node: AssocTypeArg) -> GenericArg { GenericArg::AssocTypeArg(node) }
2751}
2752impl From<LifetimeArg> for GenericArg {
2753 fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) }
2754}
2755impl From<ConstArg> for GenericArg {
2756 fn from(node: ConstArg) -> GenericArg { GenericArg::ConstArg(node) }
2757}
2758impl AstNode for GenericArg {
2759 fn can_cast(kind: SyntaxKind) -> bool {
2760 match kind {
2761 TYPE_ARG | ASSOC_TYPE_ARG | LIFETIME_ARG | CONST_ARG => true,
2762 _ => false,
2763 }
2764 }
2765 fn cast(syntax: SyntaxNode) -> Option<Self> {
2766 let res = match syntax.kind() {
2767 TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }),
2768 ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }),
2769 LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }),
2770 CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }),
2771 _ => return None,
2772 };
2773 Some(res)
2774 }
2775 fn syntax(&self) -> &SyntaxNode {
2776 match self {
2777 GenericArg::TypeArg(it) => &it.syntax,
2778 GenericArg::AssocTypeArg(it) => &it.syntax,
2779 GenericArg::LifetimeArg(it) => &it.syntax,
2780 GenericArg::ConstArg(it) => &it.syntax,
2781 }
2782 }
2783}
2784impl From<ArrayType> for Type {
2785 fn from(node: ArrayType) -> Type { Type::ArrayType(node) }
2786}
2787impl From<DynTraitType> for Type {
2788 fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) }
2789}
2790impl From<FnPtrType> for Type {
2791 fn from(node: FnPtrType) -> Type { Type::FnPtrType(node) }
2792}
2793impl From<ForType> for Type {
2794 fn from(node: ForType) -> Type { Type::ForType(node) }
2795}
2796impl From<ImplTraitType> for Type {
2797 fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) }
2798}
2799impl From<InferType> for Type {
2800 fn from(node: InferType) -> Type { Type::InferType(node) }
2801}
2802impl From<NeverType> for Type {
2803 fn from(node: NeverType) -> Type { Type::NeverType(node) }
2804}
2805impl From<ParenType> for Type {
2806 fn from(node: ParenType) -> Type { Type::ParenType(node) }
2807}
2808impl From<PathType> for Type {
2809 fn from(node: PathType) -> Type { Type::PathType(node) }
2810}
2811impl From<PtrType> for Type {
2812 fn from(node: PtrType) -> Type { Type::PtrType(node) }
2813}
2814impl From<RefType> for Type {
2815 fn from(node: RefType) -> Type { Type::RefType(node) }
2816}
2817impl From<SliceType> for Type {
2818 fn from(node: SliceType) -> Type { Type::SliceType(node) }
2819}
2820impl From<TupleType> for Type {
2821 fn from(node: TupleType) -> Type { Type::TupleType(node) }
2822}
2823impl AstNode for Type {
2824 fn can_cast(kind: SyntaxKind) -> bool {
2825 match kind {
2826 ARRAY_TYPE | DYN_TRAIT_TYPE | FN_PTR_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE | INFER_TYPE
2827 | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | PTR_TYPE | REF_TYPE | SLICE_TYPE
2828 | TUPLE_TYPE => true,
2829 _ => false,
2830 }
2831 }
2832 fn cast(syntax: SyntaxNode) -> Option<Self> {
2833 let res = match syntax.kind() {
2834 ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }),
2835 DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }),
2836 FN_PTR_TYPE => Type::FnPtrType(FnPtrType { syntax }),
2837 FOR_TYPE => Type::ForType(ForType { syntax }),
2838 IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }),
2839 INFER_TYPE => Type::InferType(InferType { syntax }),
2840 NEVER_TYPE => Type::NeverType(NeverType { syntax }),
2841 PAREN_TYPE => Type::ParenType(ParenType { syntax }),
2842 PATH_TYPE => Type::PathType(PathType { syntax }),
2843 PTR_TYPE => Type::PtrType(PtrType { syntax }),
2844 REF_TYPE => Type::RefType(RefType { syntax }),
2845 SLICE_TYPE => Type::SliceType(SliceType { syntax }),
2846 TUPLE_TYPE => Type::TupleType(TupleType { syntax }),
2847 _ => return None,
2848 };
2849 Some(res)
2850 }
2851 fn syntax(&self) -> &SyntaxNode {
2852 match self {
2853 Type::ArrayType(it) => &it.syntax,
2854 Type::DynTraitType(it) => &it.syntax,
2855 Type::FnPtrType(it) => &it.syntax,
2856 Type::ForType(it) => &it.syntax,
2857 Type::ImplTraitType(it) => &it.syntax,
2858 Type::InferType(it) => &it.syntax,
2859 Type::NeverType(it) => &it.syntax,
2860 Type::ParenType(it) => &it.syntax,
2861 Type::PathType(it) => &it.syntax,
2862 Type::PtrType(it) => &it.syntax,
2863 Type::RefType(it) => &it.syntax,
2864 Type::SliceType(it) => &it.syntax,
2865 Type::TupleType(it) => &it.syntax,
2866 }
2867 }
2868}
2869impl From<ArrayExpr> for Expr {
2870 fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) }
2871}
2872impl From<AwaitExpr> for Expr {
2873 fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) }
2874}
2875impl From<BinExpr> for Expr {
2876 fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) }
2877}
2878impl From<BlockExpr> for Expr {
2879 fn from(node: BlockExpr) -> Expr { Expr::BlockExpr(node) }
2880}
2881impl From<BoxExpr> for Expr {
2882 fn from(node: BoxExpr) -> Expr { Expr::BoxExpr(node) }
2883}
2884impl From<BreakExpr> for Expr {
2885 fn from(node: BreakExpr) -> Expr { Expr::BreakExpr(node) }
2886}
2887impl From<CallExpr> for Expr {
2888 fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) }
2889}
2890impl From<CastExpr> for Expr {
2891 fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) }
2892}
2893impl From<ClosureExpr> for Expr {
2894 fn from(node: ClosureExpr) -> Expr { Expr::ClosureExpr(node) }
2895}
2896impl From<ContinueExpr> for Expr {
2897 fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) }
2898}
2899impl From<EffectExpr> for Expr {
2900 fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) }
2901}
2902impl From<FieldExpr> for Expr {
2903 fn from(node: FieldExpr) -> Expr { Expr::FieldExpr(node) }
2904}
2905impl From<ForExpr> for Expr {
2906 fn from(node: ForExpr) -> Expr { Expr::ForExpr(node) }
2907}
2908impl From<IfExpr> for Expr {
2909 fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) }
2910}
2911impl From<IndexExpr> for Expr {
2912 fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) }
2913}
2914impl From<Literal> for Expr {
2915 fn from(node: Literal) -> Expr { Expr::Literal(node) }
2916}
2917impl From<LoopExpr> for Expr {
2918 fn from(node: LoopExpr) -> Expr { Expr::LoopExpr(node) }
2919}
2920impl From<MacroCall> for Expr {
2921 fn from(node: MacroCall) -> Expr { Expr::MacroCall(node) }
2922}
2923impl From<MatchExpr> for Expr {
2924 fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) }
2925}
2926impl From<MethodCallExpr> for Expr {
2927 fn from(node: MethodCallExpr) -> Expr { Expr::MethodCallExpr(node) }
2928}
2929impl From<ParenExpr> for Expr {
2930 fn from(node: ParenExpr) -> Expr { Expr::ParenExpr(node) }
2931}
2932impl From<PathExpr> for Expr {
2933 fn from(node: PathExpr) -> Expr { Expr::PathExpr(node) }
2934}
2935impl From<PrefixExpr> for Expr {
2936 fn from(node: PrefixExpr) -> Expr { Expr::PrefixExpr(node) }
2937}
2938impl From<RangeExpr> for Expr {
2939 fn from(node: RangeExpr) -> Expr { Expr::RangeExpr(node) }
2940}
2941impl From<RecordExpr> for Expr {
2942 fn from(node: RecordExpr) -> Expr { Expr::RecordExpr(node) }
2943}
2944impl From<RefExpr> for Expr {
2945 fn from(node: RefExpr) -> Expr { Expr::RefExpr(node) }
2946}
2947impl From<ReturnExpr> for Expr {
2948 fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) }
2949}
2950impl From<TryExpr> for Expr {
2951 fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) }
2952}
2953impl From<TupleExpr> for Expr {
2954 fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) }
2955}
2956impl From<WhileExpr> for Expr {
2957 fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) }
2958}
2959impl AstNode for Expr {
2960 fn can_cast(kind: SyntaxKind) -> bool {
2961 match kind {
2962 ARRAY_EXPR | AWAIT_EXPR | BIN_EXPR | BLOCK_EXPR | BOX_EXPR | BREAK_EXPR | CALL_EXPR
2963 | CAST_EXPR | CLOSURE_EXPR | CONTINUE_EXPR | EFFECT_EXPR | FIELD_EXPR | FOR_EXPR
2964 | IF_EXPR | INDEX_EXPR | LITERAL | LOOP_EXPR | MACRO_CALL | MATCH_EXPR
2965 | METHOD_CALL_EXPR | PAREN_EXPR | PATH_EXPR | PREFIX_EXPR | RANGE_EXPR
2966 | RECORD_EXPR | REF_EXPR | RETURN_EXPR | TRY_EXPR | TUPLE_EXPR | WHILE_EXPR => true,
2967 _ => false,
2968 }
2969 }
2970 fn cast(syntax: SyntaxNode) -> Option<Self> {
2971 let res = match syntax.kind() {
2972 ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }),
2973 AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }),
2974 BIN_EXPR => Expr::BinExpr(BinExpr { syntax }),
2975 BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }),
2976 BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }),
2977 BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }),
2978 CALL_EXPR => Expr::CallExpr(CallExpr { syntax }),
2979 CAST_EXPR => Expr::CastExpr(CastExpr { syntax }),
2980 CLOSURE_EXPR => Expr::ClosureExpr(ClosureExpr { syntax }),
2981 CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }),
2982 EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }),
2983 FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }),
2984 FOR_EXPR => Expr::ForExpr(ForExpr { syntax }),
2985 IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
2986 INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }),
2987 LITERAL => Expr::Literal(Literal { syntax }),
2988 LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }),
2989 MACRO_CALL => Expr::MacroCall(MacroCall { syntax }),
2990 MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }),
2991 METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }),
2992 PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }),
2993 PATH_EXPR => Expr::PathExpr(PathExpr { syntax }),
2994 PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }),
2995 RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }),
2996 RECORD_EXPR => Expr::RecordExpr(RecordExpr { syntax }),
2997 REF_EXPR => Expr::RefExpr(RefExpr { syntax }),
2998 RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }),
2999 TRY_EXPR => Expr::TryExpr(TryExpr { syntax }),
3000 TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }),
3001 WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }),
3002 _ => return None,
3003 };
3004 Some(res)
3005 }
3006 fn syntax(&self) -> &SyntaxNode {
3007 match self {
3008 Expr::ArrayExpr(it) => &it.syntax,
3009 Expr::AwaitExpr(it) => &it.syntax,
3010 Expr::BinExpr(it) => &it.syntax,
3011 Expr::BlockExpr(it) => &it.syntax,
3012 Expr::BoxExpr(it) => &it.syntax,
3013 Expr::BreakExpr(it) => &it.syntax,
3014 Expr::CallExpr(it) => &it.syntax,
3015 Expr::CastExpr(it) => &it.syntax,
3016 Expr::ClosureExpr(it) => &it.syntax,
3017 Expr::ContinueExpr(it) => &it.syntax,
3018 Expr::EffectExpr(it) => &it.syntax,
3019 Expr::FieldExpr(it) => &it.syntax,
3020 Expr::ForExpr(it) => &it.syntax,
3021 Expr::IfExpr(it) => &it.syntax,
3022 Expr::IndexExpr(it) => &it.syntax,
3023 Expr::Literal(it) => &it.syntax,
3024 Expr::LoopExpr(it) => &it.syntax,
3025 Expr::MacroCall(it) => &it.syntax,
3026 Expr::MatchExpr(it) => &it.syntax,
3027 Expr::MethodCallExpr(it) => &it.syntax,
3028 Expr::ParenExpr(it) => &it.syntax,
3029 Expr::PathExpr(it) => &it.syntax,
3030 Expr::PrefixExpr(it) => &it.syntax,
3031 Expr::RangeExpr(it) => &it.syntax,
3032 Expr::RecordExpr(it) => &it.syntax,
3033 Expr::RefExpr(it) => &it.syntax,
3034 Expr::ReturnExpr(it) => &it.syntax,
3035 Expr::TryExpr(it) => &it.syntax,
3036 Expr::TupleExpr(it) => &it.syntax,
3037 Expr::WhileExpr(it) => &it.syntax,
3038 }
3039 }
3040}
3041impl From<Const> for Item {
3042 fn from(node: Const) -> Item { Item::Const(node) }
3043}
3044impl From<Enum> for Item {
3045 fn from(node: Enum) -> Item { Item::Enum(node) }
3046}
3047impl From<ExternBlock> for Item {
3048 fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) }
3049}
3050impl From<ExternCrate> for Item {
3051 fn from(node: ExternCrate) -> Item { Item::ExternCrate(node) }
3052}
3053impl From<Fn> for Item {
3054 fn from(node: Fn) -> Item { Item::Fn(node) }
3055}
3056impl From<Impl> for Item {
3057 fn from(node: Impl) -> Item { Item::Impl(node) }
3058}
3059impl From<MacroCall> for Item {
3060 fn from(node: MacroCall) -> Item { Item::MacroCall(node) }
3061}
3062impl From<Module> for Item {
3063 fn from(node: Module) -> Item { Item::Module(node) }
3064}
3065impl From<Static> for Item {
3066 fn from(node: Static) -> Item { Item::Static(node) }
3067}
3068impl From<Struct> for Item {
3069 fn from(node: Struct) -> Item { Item::Struct(node) }
3070}
3071impl From<Trait> for Item {
3072 fn from(node: Trait) -> Item { Item::Trait(node) }
3073}
3074impl From<TypeAlias> for Item {
3075 fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) }
3076}
3077impl From<Union> for Item {
3078 fn from(node: Union) -> Item { Item::Union(node) }
3079}
3080impl From<Use> for Item {
3081 fn from(node: Use) -> Item { Item::Use(node) }
3082}
3083impl AstNode for Item {
3084 fn can_cast(kind: SyntaxKind) -> bool {
3085 match kind {
3086 CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL | MACRO_CALL | MODULE
3087 | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true,
3088 _ => false,
3089 }
3090 }
3091 fn cast(syntax: SyntaxNode) -> Option<Self> {
3092 let res = match syntax.kind() {
3093 CONST => Item::Const(Const { syntax }),
3094 ENUM => Item::Enum(Enum { syntax }),
3095 EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }),
3096 EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }),
3097 FN => Item::Fn(Fn { syntax }),
3098 IMPL => Item::Impl(Impl { syntax }),
3099 MACRO_CALL => Item::MacroCall(MacroCall { syntax }),
3100 MODULE => Item::Module(Module { syntax }),
3101 STATIC => Item::Static(Static { syntax }),
3102 STRUCT => Item::Struct(Struct { syntax }),
3103 TRAIT => Item::Trait(Trait { syntax }),
3104 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
3105 UNION => Item::Union(Union { syntax }),
3106 USE => Item::Use(Use { syntax }),
3107 _ => return None,
3108 };
3109 Some(res)
3110 }
3111 fn syntax(&self) -> &SyntaxNode {
3112 match self {
3113 Item::Const(it) => &it.syntax,
3114 Item::Enum(it) => &it.syntax,
3115 Item::ExternBlock(it) => &it.syntax,
3116 Item::ExternCrate(it) => &it.syntax,
3117 Item::Fn(it) => &it.syntax,
3118 Item::Impl(it) => &it.syntax,
3119 Item::MacroCall(it) => &it.syntax,
3120 Item::Module(it) => &it.syntax,
3121 Item::Static(it) => &it.syntax,
3122 Item::Struct(it) => &it.syntax,
3123 Item::Trait(it) => &it.syntax,
3124 Item::TypeAlias(it) => &it.syntax,
3125 Item::Union(it) => &it.syntax,
3126 Item::Use(it) => &it.syntax,
3127 }
3128 }
3129}
3130impl From<ExprStmt> for Stmt {
3131 fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) }
3132}
3133impl From<Item> for Stmt {
3134 fn from(node: Item) -> Stmt { Stmt::Item(node) }
3135}
3136impl From<LetStmt> for Stmt {
3137 fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) }
3138}
3139impl From<IdentPat> for Pat {
3140 fn from(node: IdentPat) -> Pat { Pat::IdentPat(node) }
3141}
3142impl From<BoxPat> for Pat {
3143 fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) }
3144}
3145impl From<RestPat> for Pat {
3146 fn from(node: RestPat) -> Pat { Pat::RestPat(node) }
3147}
3148impl From<LiteralPat> for Pat {
3149 fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) }
3150}
3151impl From<MacroPat> for Pat {
3152 fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) }
3153}
3154impl From<OrPat> for Pat {
3155 fn from(node: OrPat) -> Pat { Pat::OrPat(node) }
3156}
3157impl From<ParenPat> for Pat {
3158 fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) }
3159}
3160impl From<PathPat> for Pat {
3161 fn from(node: PathPat) -> Pat { Pat::PathPat(node) }
3162}
3163impl From<WildcardPat> for Pat {
3164 fn from(node: WildcardPat) -> Pat { Pat::WildcardPat(node) }
3165}
3166impl From<RangePat> for Pat {
3167 fn from(node: RangePat) -> Pat { Pat::RangePat(node) }
3168}
3169impl From<RecordPat> for Pat {
3170 fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) }
3171}
3172impl From<RefPat> for Pat {
3173 fn from(node: RefPat) -> Pat { Pat::RefPat(node) }
3174}
3175impl From<SlicePat> for Pat {
3176 fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) }
3177}
3178impl From<TuplePat> for Pat {
3179 fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) }
3180}
3181impl From<TupleStructPat> for Pat {
3182 fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) }
3183}
3184impl AstNode for Pat {
3185 fn can_cast(kind: SyntaxKind) -> bool {
3186 match kind {
3187 IDENT_PAT | BOX_PAT | REST_PAT | LITERAL_PAT | MACRO_PAT | OR_PAT | PAREN_PAT
3188 | PATH_PAT | WILDCARD_PAT | RANGE_PAT | RECORD_PAT | REF_PAT | SLICE_PAT
3189 | TUPLE_PAT | TUPLE_STRUCT_PAT => true,
3190 _ => false,
3191 }
3192 }
3193 fn cast(syntax: SyntaxNode) -> Option<Self> {
3194 let res = match syntax.kind() {
3195 IDENT_PAT => Pat::IdentPat(IdentPat { syntax }),
3196 BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
3197 REST_PAT => Pat::RestPat(RestPat { syntax }),
3198 LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
3199 MACRO_PAT => Pat::MacroPat(MacroPat { syntax }),
3200 OR_PAT => Pat::OrPat(OrPat { syntax }),
3201 PAREN_PAT => Pat::ParenPat(ParenPat { syntax }),
3202 PATH_PAT => Pat::PathPat(PathPat { syntax }),
3203 WILDCARD_PAT => Pat::WildcardPat(WildcardPat { syntax }),
3204 RANGE_PAT => Pat::RangePat(RangePat { syntax }),
3205 RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
3206 REF_PAT => Pat::RefPat(RefPat { syntax }),
3207 SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
3208 TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
3209 TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
3210 _ => return None,
3211 };
3212 Some(res)
3213 }
3214 fn syntax(&self) -> &SyntaxNode {
3215 match self {
3216 Pat::IdentPat(it) => &it.syntax,
3217 Pat::BoxPat(it) => &it.syntax,
3218 Pat::RestPat(it) => &it.syntax,
3219 Pat::LiteralPat(it) => &it.syntax,
3220 Pat::MacroPat(it) => &it.syntax,
3221 Pat::OrPat(it) => &it.syntax,
3222 Pat::ParenPat(it) => &it.syntax,
3223 Pat::PathPat(it) => &it.syntax,
3224 Pat::WildcardPat(it) => &it.syntax,
3225 Pat::RangePat(it) => &it.syntax,
3226 Pat::RecordPat(it) => &it.syntax,
3227 Pat::RefPat(it) => &it.syntax,
3228 Pat::SlicePat(it) => &it.syntax,
3229 Pat::TuplePat(it) => &it.syntax,
3230 Pat::TupleStructPat(it) => &it.syntax,
3231 }
3232 }
3233}
3234impl From<RecordFieldList> for FieldList {
3235 fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) }
3236}
3237impl From<TupleFieldList> for FieldList {
3238 fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) }
3239}
3240impl AstNode for FieldList {
3241 fn can_cast(kind: SyntaxKind) -> bool {
3242 match kind {
3243 RECORD_FIELD_LIST | TUPLE_FIELD_LIST => true,
3244 _ => false,
3245 }
3246 }
3247 fn cast(syntax: SyntaxNode) -> Option<Self> {
3248 let res = match syntax.kind() {
3249 RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }),
3250 TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }),
3251 _ => return None,
3252 };
3253 Some(res)
3254 }
3255 fn syntax(&self) -> &SyntaxNode {
3256 match self {
3257 FieldList::RecordFieldList(it) => &it.syntax,
3258 FieldList::TupleFieldList(it) => &it.syntax,
3259 }
3260 }
3261}
3262impl From<Enum> for AdtDef {
3263 fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) }
3264}
3265impl From<Struct> for AdtDef {
3266 fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) }
3267}
3268impl From<Union> for AdtDef {
3269 fn from(node: Union) -> AdtDef { AdtDef::Union(node) }
3270}
3271impl AstNode for AdtDef {
3272 fn can_cast(kind: SyntaxKind) -> bool {
3273 match kind {
3274 ENUM | STRUCT | UNION => true,
3275 _ => false,
3276 }
3277 }
3278 fn cast(syntax: SyntaxNode) -> Option<Self> {
3279 let res = match syntax.kind() {
3280 ENUM => AdtDef::Enum(Enum { syntax }),
3281 STRUCT => AdtDef::Struct(Struct { syntax }),
3282 UNION => AdtDef::Union(Union { syntax }),
3283 _ => return None,
3284 };
3285 Some(res)
3286 }
3287 fn syntax(&self) -> &SyntaxNode {
3288 match self {
3289 AdtDef::Enum(it) => &it.syntax,
3290 AdtDef::Struct(it) => &it.syntax,
3291 AdtDef::Union(it) => &it.syntax,
3292 }
3293 }
3294}
3295impl From<Const> for AssocItem {
3296 fn from(node: Const) -> AssocItem { AssocItem::Const(node) }
3297}
3298impl From<Fn> for AssocItem {
3299 fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) }
3300}
3301impl From<MacroCall> for AssocItem {
3302 fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) }
3303}
3304impl From<TypeAlias> for AssocItem {
3305 fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) }
3306}
3307impl AstNode for AssocItem {
3308 fn can_cast(kind: SyntaxKind) -> bool {
3309 match kind {
3310 CONST | FN | MACRO_CALL | TYPE_ALIAS => true,
3311 _ => false,
3312 }
3313 }
3314 fn cast(syntax: SyntaxNode) -> Option<Self> {
3315 let res = match syntax.kind() {
3316 CONST => AssocItem::Const(Const { syntax }),
3317 FN => AssocItem::Fn(Fn { syntax }),
3318 MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }),
3319 TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }),
3320 _ => return None,
3321 };
3322 Some(res)
3323 }
3324 fn syntax(&self) -> &SyntaxNode {
3325 match self {
3326 AssocItem::Const(it) => &it.syntax,
3327 AssocItem::Fn(it) => &it.syntax,
3328 AssocItem::MacroCall(it) => &it.syntax,
3329 AssocItem::TypeAlias(it) => &it.syntax,
3330 }
3331 }
3332}
3333impl From<Fn> for ExternItem {
3334 fn from(node: Fn) -> ExternItem { ExternItem::Fn(node) }
3335}
3336impl From<MacroCall> for ExternItem {
3337 fn from(node: MacroCall) -> ExternItem { ExternItem::MacroCall(node) }
3338}
3339impl From<Static> for ExternItem {
3340 fn from(node: Static) -> ExternItem { ExternItem::Static(node) }
3341}
3342impl AstNode for ExternItem {
3343 fn can_cast(kind: SyntaxKind) -> bool {
3344 match kind {
3345 FN | MACRO_CALL | STATIC => true,
3346 _ => false,
3347 }
3348 }
3349 fn cast(syntax: SyntaxNode) -> Option<Self> {
3350 let res = match syntax.kind() {
3351 FN => ExternItem::Fn(Fn { syntax }),
3352 MACRO_CALL => ExternItem::MacroCall(MacroCall { syntax }),
3353 STATIC => ExternItem::Static(Static { syntax }),
3354 _ => return None,
3355 };
3356 Some(res)
3357 }
3358 fn syntax(&self) -> &SyntaxNode {
3359 match self {
3360 ExternItem::Fn(it) => &it.syntax,
3361 ExternItem::MacroCall(it) => &it.syntax,
3362 ExternItem::Static(it) => &it.syntax,
3363 }
3364 }
3365}
3366impl From<ConstParam> for GenericParam {
3367 fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) }
3368}
3369impl From<LifetimeParam> for GenericParam {
3370 fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) }
3371}
3372impl From<TypeParam> for GenericParam {
3373 fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) }
3374}
3375impl AstNode for GenericParam {
3376 fn can_cast(kind: SyntaxKind) -> bool {
3377 match kind {
3378 CONST_PARAM | LIFETIME_PARAM | TYPE_PARAM => true,
3379 _ => false,
3380 }
3381 }
3382 fn cast(syntax: SyntaxNode) -> Option<Self> {
3383 let res = match syntax.kind() {
3384 CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }),
3385 LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }),
3386 TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }),
3387 _ => return None,
3388 };
3389 Some(res)
3390 }
3391 fn syntax(&self) -> &SyntaxNode {
3392 match self {
3393 GenericParam::ConstParam(it) => &it.syntax,
3394 GenericParam::LifetimeParam(it) => &it.syntax,
3395 GenericParam::TypeParam(it) => &it.syntax,
3396 }
3397 }
3398}
3399impl std::fmt::Display for GenericArg {
3400 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3401 std::fmt::Display::fmt(self.syntax(), f)
3402 }
3403}
3404impl std::fmt::Display for Type {
3405 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3406 std::fmt::Display::fmt(self.syntax(), f)
3407 }
3408}
3409impl std::fmt::Display for Expr {
3410 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3411 std::fmt::Display::fmt(self.syntax(), f)
3412 }
3413}
3414impl std::fmt::Display for Item {
3415 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3416 std::fmt::Display::fmt(self.syntax(), f)
3417 }
3418}
3419impl std::fmt::Display for Stmt {
3420 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3421 std::fmt::Display::fmt(self.syntax(), f)
3422 }
3423}
3424impl std::fmt::Display for Pat {
3425 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3426 std::fmt::Display::fmt(self.syntax(), f)
3427 }
3428}
3429impl std::fmt::Display for FieldList {
3430 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3431 std::fmt::Display::fmt(self.syntax(), f)
3432 }
3433}
3434impl std::fmt::Display for AdtDef {
3435 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3436 std::fmt::Display::fmt(self.syntax(), f)
3437 }
3438}
3439impl std::fmt::Display for AssocItem {
3440 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3441 std::fmt::Display::fmt(self.syntax(), f)
3442 }
3443}
3444impl std::fmt::Display for ExternItem {
3445 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3446 std::fmt::Display::fmt(self.syntax(), f)
3447 }
3448}
3449impl std::fmt::Display for GenericParam {
3450 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3451 std::fmt::Display::fmt(self.syntax(), f)
3452 }
3453}
3454impl std::fmt::Display for Name {
3455 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3456 std::fmt::Display::fmt(self.syntax(), f)
3457 }
3458}
3459impl std::fmt::Display for NameRef {
3460 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3461 std::fmt::Display::fmt(self.syntax(), f)
3462 }
3463}
3464impl std::fmt::Display for Path {
3465 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3466 std::fmt::Display::fmt(self.syntax(), f)
3467 }
3468}
3469impl std::fmt::Display for PathSegment {
3470 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3471 std::fmt::Display::fmt(self.syntax(), f)
3472 }
3473}
3474impl std::fmt::Display for GenericArgList {
3475 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3476 std::fmt::Display::fmt(self.syntax(), f)
3477 }
3478}
3479impl std::fmt::Display for ParamList {
3480 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3481 std::fmt::Display::fmt(self.syntax(), f)
3482 }
3483}
3484impl std::fmt::Display for RetType {
3485 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3486 std::fmt::Display::fmt(self.syntax(), f)
3487 }
3488}
3489impl std::fmt::Display for PathType {
3490 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3491 std::fmt::Display::fmt(self.syntax(), f)
3492 }
3493}
3494impl std::fmt::Display for TypeArg {
3495 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3496 std::fmt::Display::fmt(self.syntax(), f)
3497 }
3498}
3499impl std::fmt::Display for AssocTypeArg {
3500 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3501 std::fmt::Display::fmt(self.syntax(), f)
3502 }
3503}
3504impl std::fmt::Display for LifetimeArg {
3505 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3506 std::fmt::Display::fmt(self.syntax(), f)
3507 }
3508}
3509impl std::fmt::Display for ConstArg {
3510 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3511 std::fmt::Display::fmt(self.syntax(), f)
3512 }
3513}
3514impl std::fmt::Display for TypeBoundList {
3515 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3516 std::fmt::Display::fmt(self.syntax(), f)
3517 }
3518}
3519impl std::fmt::Display for MacroCall {
3520 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3521 std::fmt::Display::fmt(self.syntax(), f)
3522 }
3523}
3524impl std::fmt::Display for Attr {
3525 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3526 std::fmt::Display::fmt(self.syntax(), f)
3527 }
3528}
3529impl std::fmt::Display for TokenTree {
3530 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3531 std::fmt::Display::fmt(self.syntax(), f)
3532 }
3533}
3534impl std::fmt::Display for MacroItems {
3535 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3536 std::fmt::Display::fmt(self.syntax(), f)
3537 }
3538}
3539impl std::fmt::Display for MacroStmts {
3540 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3541 std::fmt::Display::fmt(self.syntax(), f)
3542 }
3543}
3544impl std::fmt::Display for SourceFile {
3545 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3546 std::fmt::Display::fmt(self.syntax(), f)
3547 }
3548}
3549impl std::fmt::Display for Const {
3550 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3551 std::fmt::Display::fmt(self.syntax(), f)
3552 }
3553}
3554impl std::fmt::Display for Enum {
3555 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3556 std::fmt::Display::fmt(self.syntax(), f)
3557 }
3558}
3559impl std::fmt::Display for ExternBlock {
3560 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3561 std::fmt::Display::fmt(self.syntax(), f)
3562 }
3563}
3564impl std::fmt::Display for ExternCrate {
3565 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3566 std::fmt::Display::fmt(self.syntax(), f)
3567 }
3568}
3569impl std::fmt::Display for Fn {
3570 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3571 std::fmt::Display::fmt(self.syntax(), f)
3572 }
3573}
3574impl std::fmt::Display for Impl {
3575 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3576 std::fmt::Display::fmt(self.syntax(), f)
3577 }
3578}
3579impl std::fmt::Display for Module {
3580 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3581 std::fmt::Display::fmt(self.syntax(), f)
3582 }
3583}
3584impl std::fmt::Display for Static {
3585 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3586 std::fmt::Display::fmt(self.syntax(), f)
3587 }
3588}
3589impl std::fmt::Display for Struct {
3590 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3591 std::fmt::Display::fmt(self.syntax(), f)
3592 }
3593}
3594impl std::fmt::Display for Trait {
3595 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3596 std::fmt::Display::fmt(self.syntax(), f)
3597 }
3598}
3599impl std::fmt::Display for TypeAlias {
3600 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3601 std::fmt::Display::fmt(self.syntax(), f)
3602 }
3603}
3604impl std::fmt::Display for Union {
3605 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3606 std::fmt::Display::fmt(self.syntax(), f)
3607 }
3608}
3609impl std::fmt::Display for Use {
3610 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3611 std::fmt::Display::fmt(self.syntax(), f)
3612 }
3613}
3614impl std::fmt::Display for Visibility {
3615 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3616 std::fmt::Display::fmt(self.syntax(), f)
3617 }
3618}
3619impl std::fmt::Display for ItemList {
3620 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3621 std::fmt::Display::fmt(self.syntax(), f)
3622 }
3623}
3624impl std::fmt::Display for Rename {
3625 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3626 std::fmt::Display::fmt(self.syntax(), f)
3627 }
3628}
3629impl std::fmt::Display for UseTree {
3630 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3631 std::fmt::Display::fmt(self.syntax(), f)
3632 }
3633}
3634impl std::fmt::Display for UseTreeList {
3635 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3636 std::fmt::Display::fmt(self.syntax(), f)
3637 }
3638}
3639impl std::fmt::Display for Abi {
3640 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3641 std::fmt::Display::fmt(self.syntax(), f)
3642 }
3643}
3644impl std::fmt::Display for GenericParamList {
3645 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3646 std::fmt::Display::fmt(self.syntax(), f)
3647 }
3648}
3649impl std::fmt::Display for WhereClause {
3650 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3651 std::fmt::Display::fmt(self.syntax(), f)
3652 }
3653}
3654impl std::fmt::Display for BlockExpr {
3655 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3656 std::fmt::Display::fmt(self.syntax(), f)
3657 }
3658}
3659impl std::fmt::Display for SelfParam {
3660 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3661 std::fmt::Display::fmt(self.syntax(), f)
3662 }
3663}
3664impl std::fmt::Display for Param {
3665 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3666 std::fmt::Display::fmt(self.syntax(), f)
3667 }
3668}
3669impl std::fmt::Display for RecordFieldList {
3670 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3671 std::fmt::Display::fmt(self.syntax(), f)
3672 }
3673}
3674impl std::fmt::Display for TupleFieldList {
3675 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3676 std::fmt::Display::fmt(self.syntax(), f)
3677 }
3678}
3679impl std::fmt::Display for RecordField {
3680 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3681 std::fmt::Display::fmt(self.syntax(), f)
3682 }
3683}
3684impl std::fmt::Display for TupleField {
3685 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3686 std::fmt::Display::fmt(self.syntax(), f)
3687 }
3688}
3689impl std::fmt::Display for VariantList {
3690 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3691 std::fmt::Display::fmt(self.syntax(), f)
3692 }
3693}
3694impl std::fmt::Display for Variant {
3695 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3696 std::fmt::Display::fmt(self.syntax(), f)
3697 }
3698}
3699impl std::fmt::Display for AssocItemList {
3700 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3701 std::fmt::Display::fmt(self.syntax(), f)
3702 }
3703}
3704impl std::fmt::Display for ExternItemList {
3705 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3706 std::fmt::Display::fmt(self.syntax(), f)
3707 }
3708}
3709impl std::fmt::Display for ConstParam {
3710 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3711 std::fmt::Display::fmt(self.syntax(), f)
3712 }
3713}
3714impl std::fmt::Display for LifetimeParam {
3715 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3716 std::fmt::Display::fmt(self.syntax(), f)
3717 }
3718}
3719impl std::fmt::Display for TypeParam {
3720 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3721 std::fmt::Display::fmt(self.syntax(), f)
3722 }
3723}
3724impl std::fmt::Display for WherePred {
3725 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3726 std::fmt::Display::fmt(self.syntax(), f)
3727 }
3728}
3729impl std::fmt::Display for Literal {
3730 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3731 std::fmt::Display::fmt(self.syntax(), f)
3732 }
3733}
3734impl std::fmt::Display for ExprStmt {
3735 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3736 std::fmt::Display::fmt(self.syntax(), f)
3737 }
3738}
3739impl std::fmt::Display for LetStmt {
3740 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3741 std::fmt::Display::fmt(self.syntax(), f)
3742 }
3743}
3744impl std::fmt::Display for ArrayExpr {
3745 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3746 std::fmt::Display::fmt(self.syntax(), f)
3747 }
3748}
3749impl std::fmt::Display for AwaitExpr {
3750 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3751 std::fmt::Display::fmt(self.syntax(), f)
3752 }
3753}
3754impl std::fmt::Display for BinExpr {
3755 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3756 std::fmt::Display::fmt(self.syntax(), f)
3757 }
3758}
3759impl std::fmt::Display for BoxExpr {
3760 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3761 std::fmt::Display::fmt(self.syntax(), f)
3762 }
3763}
3764impl std::fmt::Display for BreakExpr {
3765 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3766 std::fmt::Display::fmt(self.syntax(), f)
3767 }
3768}
3769impl std::fmt::Display for CallExpr {
3770 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3771 std::fmt::Display::fmt(self.syntax(), f)
3772 }
3773}
3774impl std::fmt::Display for CastExpr {
3775 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3776 std::fmt::Display::fmt(self.syntax(), f)
3777 }
3778}
3779impl std::fmt::Display for ClosureExpr {
3780 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3781 std::fmt::Display::fmt(self.syntax(), f)
3782 }
3783}
3784impl std::fmt::Display for ContinueExpr {
3785 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3786 std::fmt::Display::fmt(self.syntax(), f)
3787 }
3788}
3789impl std::fmt::Display for EffectExpr {
3790 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3791 std::fmt::Display::fmt(self.syntax(), f)
3792 }
3793}
3794impl std::fmt::Display for FieldExpr {
3795 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3796 std::fmt::Display::fmt(self.syntax(), f)
3797 }
3798}
3799impl std::fmt::Display for ForExpr {
3800 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3801 std::fmt::Display::fmt(self.syntax(), f)
3802 }
3803}
3804impl std::fmt::Display for IfExpr {
3805 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3806 std::fmt::Display::fmt(self.syntax(), f)
3807 }
3808}
3809impl std::fmt::Display for IndexExpr {
3810 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3811 std::fmt::Display::fmt(self.syntax(), f)
3812 }
3813}
3814impl std::fmt::Display for LoopExpr {
3815 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3816 std::fmt::Display::fmt(self.syntax(), f)
3817 }
3818}
3819impl std::fmt::Display for MatchExpr {
3820 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3821 std::fmt::Display::fmt(self.syntax(), f)
3822 }
3823}
3824impl std::fmt::Display for MethodCallExpr {
3825 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3826 std::fmt::Display::fmt(self.syntax(), f)
3827 }
3828}
3829impl std::fmt::Display for ParenExpr {
3830 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3831 std::fmt::Display::fmt(self.syntax(), f)
3832 }
3833}
3834impl std::fmt::Display for PathExpr {
3835 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3836 std::fmt::Display::fmt(self.syntax(), f)
3837 }
3838}
3839impl std::fmt::Display for PrefixExpr {
3840 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3841 std::fmt::Display::fmt(self.syntax(), f)
3842 }
3843}
3844impl std::fmt::Display for RangeExpr {
3845 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3846 std::fmt::Display::fmt(self.syntax(), f)
3847 }
3848}
3849impl std::fmt::Display for RecordExpr {
3850 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3851 std::fmt::Display::fmt(self.syntax(), f)
3852 }
3853}
3854impl std::fmt::Display for RefExpr {
3855 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3856 std::fmt::Display::fmt(self.syntax(), f)
3857 }
3858}
3859impl std::fmt::Display for ReturnExpr {
3860 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3861 std::fmt::Display::fmt(self.syntax(), f)
3862 }
3863}
3864impl std::fmt::Display for TryExpr {
3865 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3866 std::fmt::Display::fmt(self.syntax(), f)
3867 }
3868}
3869impl std::fmt::Display for TupleExpr {
3870 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3871 std::fmt::Display::fmt(self.syntax(), f)
3872 }
3873}
3874impl std::fmt::Display for WhileExpr {
3875 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3876 std::fmt::Display::fmt(self.syntax(), f)
3877 }
3878}
3879impl std::fmt::Display for Label {
3880 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3881 std::fmt::Display::fmt(self.syntax(), f)
3882 }
3883}
3884impl std::fmt::Display for RecordExprFieldList {
3885 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3886 std::fmt::Display::fmt(self.syntax(), f)
3887 }
3888}
3889impl std::fmt::Display for RecordExprField {
3890 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3891 std::fmt::Display::fmt(self.syntax(), f)
3892 }
3893}
3894impl std::fmt::Display for ArgList {
3895 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3896 std::fmt::Display::fmt(self.syntax(), f)
3897 }
3898}
3899impl std::fmt::Display for Condition {
3900 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3901 std::fmt::Display::fmt(self.syntax(), f)
3902 }
3903}
3904impl std::fmt::Display for MatchArmList {
3905 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3906 std::fmt::Display::fmt(self.syntax(), f)
3907 }
3908}
3909impl std::fmt::Display for MatchArm {
3910 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3911 std::fmt::Display::fmt(self.syntax(), f)
3912 }
3913}
3914impl std::fmt::Display for MatchGuard {
3915 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3916 std::fmt::Display::fmt(self.syntax(), f)
3917 }
3918}
3919impl std::fmt::Display for ArrayType {
3920 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3921 std::fmt::Display::fmt(self.syntax(), f)
3922 }
3923}
3924impl std::fmt::Display for DynTraitType {
3925 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3926 std::fmt::Display::fmt(self.syntax(), f)
3927 }
3928}
3929impl std::fmt::Display for FnPtrType {
3930 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3931 std::fmt::Display::fmt(self.syntax(), f)
3932 }
3933}
3934impl std::fmt::Display for ForType {
3935 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3936 std::fmt::Display::fmt(self.syntax(), f)
3937 }
3938}
3939impl std::fmt::Display for ImplTraitType {
3940 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3941 std::fmt::Display::fmt(self.syntax(), f)
3942 }
3943}
3944impl std::fmt::Display for InferType {
3945 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3946 std::fmt::Display::fmt(self.syntax(), f)
3947 }
3948}
3949impl std::fmt::Display for NeverType {
3950 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3951 std::fmt::Display::fmt(self.syntax(), f)
3952 }
3953}
3954impl std::fmt::Display for ParenType {
3955 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3956 std::fmt::Display::fmt(self.syntax(), f)
3957 }
3958}
3959impl std::fmt::Display for PtrType {
3960 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3961 std::fmt::Display::fmt(self.syntax(), f)
3962 }
3963}
3964impl std::fmt::Display for RefType {
3965 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3966 std::fmt::Display::fmt(self.syntax(), f)
3967 }
3968}
3969impl std::fmt::Display for SliceType {
3970 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3971 std::fmt::Display::fmt(self.syntax(), f)
3972 }
3973}
3974impl std::fmt::Display for TupleType {
3975 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3976 std::fmt::Display::fmt(self.syntax(), f)
3977 }
3978}
3979impl std::fmt::Display for TypeBound {
3980 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3981 std::fmt::Display::fmt(self.syntax(), f)
3982 }
3983}
3984impl std::fmt::Display for IdentPat {
3985 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3986 std::fmt::Display::fmt(self.syntax(), f)
3987 }
3988}
3989impl std::fmt::Display for BoxPat {
3990 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3991 std::fmt::Display::fmt(self.syntax(), f)
3992 }
3993}
3994impl std::fmt::Display for RestPat {
3995 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3996 std::fmt::Display::fmt(self.syntax(), f)
3997 }
3998}
3999impl std::fmt::Display for LiteralPat {
4000 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4001 std::fmt::Display::fmt(self.syntax(), f)
4002 }
4003}
4004impl std::fmt::Display for MacroPat {
4005 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4006 std::fmt::Display::fmt(self.syntax(), f)
4007 }
4008}
4009impl std::fmt::Display for OrPat {
4010 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4011 std::fmt::Display::fmt(self.syntax(), f)
4012 }
4013}
4014impl std::fmt::Display for ParenPat {
4015 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4016 std::fmt::Display::fmt(self.syntax(), f)
4017 }
4018}
4019impl std::fmt::Display for PathPat {
4020 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4021 std::fmt::Display::fmt(self.syntax(), f)
4022 }
4023}
4024impl std::fmt::Display for WildcardPat {
4025 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4026 std::fmt::Display::fmt(self.syntax(), f)
4027 }
4028}
4029impl std::fmt::Display for RangePat {
4030 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4031 std::fmt::Display::fmt(self.syntax(), f)
4032 }
4033}
4034impl std::fmt::Display for RecordPat {
4035 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4036 std::fmt::Display::fmt(self.syntax(), f)
4037 }
4038}
4039impl std::fmt::Display for RefPat {
4040 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4041 std::fmt::Display::fmt(self.syntax(), f)
4042 }
4043}
4044impl std::fmt::Display for SlicePat {
4045 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4046 std::fmt::Display::fmt(self.syntax(), f)
4047 }
4048}
4049impl std::fmt::Display for TuplePat {
4050 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4051 std::fmt::Display::fmt(self.syntax(), f)
4052 }
4053}
4054impl std::fmt::Display for TupleStructPat {
4055 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4056 std::fmt::Display::fmt(self.syntax(), f)
4057 }
4058}
4059impl std::fmt::Display for RecordPatFieldList {
4060 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4061 std::fmt::Display::fmt(self.syntax(), f)
4062 }
4063}
4064impl std::fmt::Display for RecordPatField {
4065 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4066 std::fmt::Display::fmt(self.syntax(), f)
4067 }
4068}
diff --git a/crates/syntax/src/ast/generated/tokens.rs b/crates/syntax/src/ast/generated/tokens.rs
new file mode 100644
index 000000000..abadd0b61
--- /dev/null
+++ b/crates/syntax/src/ast/generated/tokens.rs
@@ -0,0 +1,91 @@
1//! Generated file, do not edit by hand, see `xtask/src/codegen`
2
3use crate::{
4 ast::AstToken,
5 SyntaxKind::{self, *},
6 SyntaxToken,
7};
8
9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
10pub struct Whitespace {
11 pub(crate) syntax: SyntaxToken,
12}
13impl std::fmt::Display for Whitespace {
14 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15 std::fmt::Display::fmt(&self.syntax, f)
16 }
17}
18impl AstToken for Whitespace {
19 fn can_cast(kind: SyntaxKind) -> bool { kind == WHITESPACE }
20 fn cast(syntax: SyntaxToken) -> Option<Self> {
21 if Self::can_cast(syntax.kind()) {
22 Some(Self { syntax })
23 } else {
24 None
25 }
26 }
27 fn syntax(&self) -> &SyntaxToken { &self.syntax }
28}
29
30#[derive(Debug, Clone, PartialEq, Eq, Hash)]
31pub struct Comment {
32 pub(crate) syntax: SyntaxToken,
33}
34impl std::fmt::Display for Comment {
35 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36 std::fmt::Display::fmt(&self.syntax, f)
37 }
38}
39impl AstToken for Comment {
40 fn can_cast(kind: SyntaxKind) -> bool { kind == COMMENT }
41 fn cast(syntax: SyntaxToken) -> Option<Self> {
42 if Self::can_cast(syntax.kind()) {
43 Some(Self { syntax })
44 } else {
45 None
46 }
47 }
48 fn syntax(&self) -> &SyntaxToken { &self.syntax }
49}
50
51#[derive(Debug, Clone, PartialEq, Eq, Hash)]
52pub struct String {
53 pub(crate) syntax: SyntaxToken,
54}
55impl std::fmt::Display for String {
56 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
57 std::fmt::Display::fmt(&self.syntax, f)
58 }
59}
60impl AstToken for String {
61 fn can_cast(kind: SyntaxKind) -> bool { kind == STRING }
62 fn cast(syntax: SyntaxToken) -> Option<Self> {
63 if Self::can_cast(syntax.kind()) {
64 Some(Self { syntax })
65 } else {
66 None
67 }
68 }
69 fn syntax(&self) -> &SyntaxToken { &self.syntax }
70}
71
72#[derive(Debug, Clone, PartialEq, Eq, Hash)]
73pub struct RawString {
74 pub(crate) syntax: SyntaxToken,
75}
76impl std::fmt::Display for RawString {
77 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
78 std::fmt::Display::fmt(&self.syntax, f)
79 }
80}
81impl AstToken for RawString {
82 fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING }
83 fn cast(syntax: SyntaxToken) -> Option<Self> {
84 if Self::can_cast(syntax.kind()) {
85 Some(Self { syntax })
86 } else {
87 None
88 }
89 }
90 fn syntax(&self) -> &SyntaxToken { &self.syntax }
91}
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs
new file mode 100644
index 000000000..d20c085aa
--- /dev/null
+++ b/crates/syntax/src/ast/make.rs
@@ -0,0 +1,402 @@
1//! This module contains free-standing functions for creating AST fragments out
2//! of smaller pieces.
3//!
4//! Note that all functions here intended to be stupid constructors, which just
5//! assemble a finish node from immediate children. If you want to do something
6//! smarter than that, it probably doesn't belong in this module.
7use itertools::Itertools;
8use stdx::format_to;
9
10use crate::{ast, AstNode, SourceFile, SyntaxKind, SyntaxNode, SyntaxToken};
11
12pub fn name(text: &str) -> ast::Name {
13 ast_from_text(&format!("mod {};", text))
14}
15
16pub fn name_ref(text: &str) -> ast::NameRef {
17 ast_from_text(&format!("fn f() {{ {}; }}", text))
18}
19
20pub fn ty(text: &str) -> ast::Type {
21 ast_from_text(&format!("impl {} for D {{}};", text))
22}
23
24pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment {
25 ast_from_text(&format!("use {};", name_ref))
26}
27pub fn path_segment_self() -> ast::PathSegment {
28 ast_from_text("use self;")
29}
30pub fn path_unqualified(segment: ast::PathSegment) -> ast::Path {
31 path_from_text(&format!("use {}", segment))
32}
33pub fn path_qualified(qual: ast::Path, segment: ast::PathSegment) -> ast::Path {
34 path_from_text(&format!("{}::{}", qual, segment))
35}
36pub fn path_from_text(text: &str) -> ast::Path {
37 ast_from_text(text)
38}
39
40pub fn use_tree(
41 path: ast::Path,
42 use_tree_list: Option<ast::UseTreeList>,
43 alias: Option<ast::Rename>,
44 add_star: bool,
45) -> ast::UseTree {
46 let mut buf = "use ".to_string();
47 buf += &path.syntax().to_string();
48 if let Some(use_tree_list) = use_tree_list {
49 format_to!(buf, "::{}", use_tree_list);
50 }
51 if add_star {
52 buf += "::*";
53 }
54
55 if let Some(alias) = alias {
56 format_to!(buf, " {}", alias);
57 }
58 ast_from_text(&buf)
59}
60
61pub fn use_tree_list(use_trees: impl IntoIterator<Item = ast::UseTree>) -> ast::UseTreeList {
62 let use_trees = use_trees.into_iter().map(|it| it.syntax().clone()).join(", ");
63 ast_from_text(&format!("use {{{}}};", use_trees))
64}
65
66pub fn use_(use_tree: ast::UseTree) -> ast::Use {
67 ast_from_text(&format!("use {};", use_tree))
68}
69
70pub fn record_expr_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordExprField {
71 return match expr {
72 Some(expr) => from_text(&format!("{}: {}", name, expr)),
73 None => from_text(&name.to_string()),
74 };
75
76 fn from_text(text: &str) -> ast::RecordExprField {
77 ast_from_text(&format!("fn f() {{ S {{ {}, }} }}", text))
78 }
79}
80
81pub fn record_field(name: ast::NameRef, ty: ast::Type) -> ast::RecordField {
82 ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty))
83}
84
85pub fn block_expr(
86 stmts: impl IntoIterator<Item = ast::Stmt>,
87 tail_expr: Option<ast::Expr>,
88) -> ast::BlockExpr {
89 let mut buf = "{\n".to_string();
90 for stmt in stmts.into_iter() {
91 format_to!(buf, " {}\n", stmt);
92 }
93 if let Some(tail_expr) = tail_expr {
94 format_to!(buf, " {}\n", tail_expr)
95 }
96 buf += "}";
97 ast_from_text(&format!("fn f() {}", buf))
98}
99
100pub fn expr_unit() -> ast::Expr {
101 expr_from_text("()")
102}
103pub fn expr_empty_block() -> ast::Expr {
104 expr_from_text("{}")
105}
106pub fn expr_unimplemented() -> ast::Expr {
107 expr_from_text("unimplemented!()")
108}
109pub fn expr_unreachable() -> ast::Expr {
110 expr_from_text("unreachable!()")
111}
112pub fn expr_todo() -> ast::Expr {
113 expr_from_text("todo!()")
114}
115pub fn expr_path(path: ast::Path) -> ast::Expr {
116 expr_from_text(&path.to_string())
117}
118pub fn expr_continue() -> ast::Expr {
119 expr_from_text("continue")
120}
121pub fn expr_break() -> ast::Expr {
122 expr_from_text("break")
123}
124pub fn expr_return() -> ast::Expr {
125 expr_from_text("return")
126}
127pub fn expr_match(expr: ast::Expr, match_arm_list: ast::MatchArmList) -> ast::Expr {
128 expr_from_text(&format!("match {} {}", expr, match_arm_list))
129}
130pub fn expr_if(condition: ast::Condition, then_branch: ast::BlockExpr) -> ast::Expr {
131 expr_from_text(&format!("if {} {}", condition, then_branch))
132}
133pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr {
134 let token = token(op);
135 expr_from_text(&format!("{}{}", token, expr))
136}
137pub fn expr_call(f: ast::Expr, arg_list: ast::ArgList) -> ast::Expr {
138 expr_from_text(&format!("{}{}", f, arg_list))
139}
140fn expr_from_text(text: &str) -> ast::Expr {
141 ast_from_text(&format!("const C: () = {};", text))
142}
143
144pub fn try_expr_from_text(text: &str) -> Option<ast::Expr> {
145 try_ast_from_text(&format!("const C: () = {};", text))
146}
147
148pub fn condition(expr: ast::Expr, pattern: Option<ast::Pat>) -> ast::Condition {
149 match pattern {
150 None => ast_from_text(&format!("const _: () = while {} {{}};", expr)),
151 Some(pattern) => {
152 ast_from_text(&format!("const _: () = while let {} = {} {{}};", pattern, expr))
153 }
154 }
155}
156
157pub fn arg_list(args: impl IntoIterator<Item = ast::Expr>) -> ast::ArgList {
158 ast_from_text(&format!("fn main() {{ ()({}) }}", args.into_iter().format(", ")))
159}
160
161pub fn ident_pat(name: ast::Name) -> ast::IdentPat {
162 return from_text(name.text());
163
164 fn from_text(text: &str) -> ast::IdentPat {
165 ast_from_text(&format!("fn f({}: ())", text))
166 }
167}
168
169pub fn wildcard_pat() -> ast::WildcardPat {
170 return from_text("_");
171
172 fn from_text(text: &str) -> ast::WildcardPat {
173 ast_from_text(&format!("fn f({}: ())", text))
174 }
175}
176
177/// Creates a tuple of patterns from an interator of patterns.
178///
179/// Invariant: `pats` must be length > 1
180///
181/// FIXME handle `pats` length == 1
182pub fn tuple_pat(pats: impl IntoIterator<Item = ast::Pat>) -> ast::TuplePat {
183 let pats_str = pats.into_iter().map(|p| p.to_string()).join(", ");
184 return from_text(&format!("({})", pats_str));
185
186 fn from_text(text: &str) -> ast::TuplePat {
187 ast_from_text(&format!("fn f({}: ())", text))
188 }
189}
190
191pub fn tuple_struct_pat(
192 path: ast::Path,
193 pats: impl IntoIterator<Item = ast::Pat>,
194) -> ast::TupleStructPat {
195 let pats_str = pats.into_iter().join(", ");
196 return from_text(&format!("{}({})", path, pats_str));
197
198 fn from_text(text: &str) -> ast::TupleStructPat {
199 ast_from_text(&format!("fn f({}: ())", text))
200 }
201}
202
203pub fn record_pat(path: ast::Path, pats: impl IntoIterator<Item = ast::Pat>) -> ast::RecordPat {
204 let pats_str = pats.into_iter().join(", ");
205 return from_text(&format!("{} {{ {} }}", path, pats_str));
206
207 fn from_text(text: &str) -> ast::RecordPat {
208 ast_from_text(&format!("fn f({}: ())", text))
209 }
210}
211
212/// Returns a `BindPat` if the path has just one segment, a `PathPat` otherwise.
213pub fn path_pat(path: ast::Path) -> ast::Pat {
214 return from_text(&path.to_string());
215 fn from_text(text: &str) -> ast::Pat {
216 ast_from_text(&format!("fn f({}: ())", text))
217 }
218}
219
220pub fn match_arm(pats: impl IntoIterator<Item = ast::Pat>, expr: ast::Expr) -> ast::MatchArm {
221 let pats_str = pats.into_iter().join(" | ");
222 return from_text(&format!("{} => {}", pats_str, expr));
223
224 fn from_text(text: &str) -> ast::MatchArm {
225 ast_from_text(&format!("fn f() {{ match () {{{}}} }}", text))
226 }
227}
228
229pub fn match_arm_list(arms: impl IntoIterator<Item = ast::MatchArm>) -> ast::MatchArmList {
230 let arms_str = arms
231 .into_iter()
232 .map(|arm| {
233 let needs_comma = arm.expr().map_or(true, |it| !it.is_block_like());
234 let comma = if needs_comma { "," } else { "" };
235 format!(" {}{}\n", arm.syntax(), comma)
236 })
237 .collect::<String>();
238 return from_text(&arms_str);
239
240 fn from_text(text: &str) -> ast::MatchArmList {
241 ast_from_text(&format!("fn f() {{ match () {{\n{}}} }}", text))
242 }
243}
244
245pub fn where_pred(
246 path: ast::Path,
247 bounds: impl IntoIterator<Item = ast::TypeBound>,
248) -> ast::WherePred {
249 let bounds = bounds.into_iter().join(" + ");
250 return from_text(&format!("{}: {}", path, bounds));
251
252 fn from_text(text: &str) -> ast::WherePred {
253 ast_from_text(&format!("fn f() where {} {{ }}", text))
254 }
255}
256
257pub fn where_clause(preds: impl IntoIterator<Item = ast::WherePred>) -> ast::WhereClause {
258 let preds = preds.into_iter().join(", ");
259 return from_text(preds.as_str());
260
261 fn from_text(text: &str) -> ast::WhereClause {
262 ast_from_text(&format!("fn f() where {} {{ }}", text))
263 }
264}
265
266pub fn let_stmt(pattern: ast::Pat, initializer: Option<ast::Expr>) -> ast::LetStmt {
267 let text = match initializer {
268 Some(it) => format!("let {} = {};", pattern, it),
269 None => format!("let {};", pattern),
270 };
271 ast_from_text(&format!("fn f() {{ {} }}", text))
272}
273pub fn expr_stmt(expr: ast::Expr) -> ast::ExprStmt {
274 let semi = if expr.is_block_like() { "" } else { ";" };
275 ast_from_text(&format!("fn f() {{ {}{} (); }}", expr, semi))
276}
277
278pub fn token(kind: SyntaxKind) -> SyntaxToken {
279 tokens::SOURCE_FILE
280 .tree()
281 .syntax()
282 .descendants_with_tokens()
283 .filter_map(|it| it.into_token())
284 .find(|it| it.kind() == kind)
285 .unwrap_or_else(|| panic!("unhandled token: {:?}", kind))
286}
287
288pub fn param(name: String, ty: String) -> ast::Param {
289 ast_from_text(&format!("fn f({}: {}) {{ }}", name, ty))
290}
291
292pub fn param_list(pats: impl IntoIterator<Item = ast::Param>) -> ast::ParamList {
293 let args = pats.into_iter().join(", ");
294 ast_from_text(&format!("fn f({}) {{ }}", args))
295}
296
297pub fn visibility_pub_crate() -> ast::Visibility {
298 ast_from_text("pub(crate) struct S")
299}
300
301pub fn fn_(
302 visibility: Option<ast::Visibility>,
303 fn_name: ast::Name,
304 type_params: Option<ast::GenericParamList>,
305 params: ast::ParamList,
306 body: ast::BlockExpr,
307) -> ast::Fn {
308 let type_params =
309 if let Some(type_params) = type_params { format!("<{}>", type_params) } else { "".into() };
310 let visibility = match visibility {
311 None => String::new(),
312 Some(it) => format!("{} ", it),
313 };
314 ast_from_text(&format!("{}fn {}{}{} {}", visibility, fn_name, type_params, params, body))
315}
316
317fn ast_from_text<N: AstNode>(text: &str) -> N {
318 let parse = SourceFile::parse(text);
319 let node = match parse.tree().syntax().descendants().find_map(N::cast) {
320 Some(it) => it,
321 None => {
322 panic!("Failed to make ast node `{}` from text {}", std::any::type_name::<N>(), text)
323 }
324 };
325 let node = node.syntax().clone();
326 let node = unroot(node);
327 let node = N::cast(node).unwrap();
328 assert_eq!(node.syntax().text_range().start(), 0.into());
329 node
330}
331
332fn try_ast_from_text<N: AstNode>(text: &str) -> Option<N> {
333 let parse = SourceFile::parse(text);
334 let node = parse.tree().syntax().descendants().find_map(N::cast)?;
335 let node = node.syntax().clone();
336 let node = unroot(node);
337 let node = N::cast(node).unwrap();
338 assert_eq!(node.syntax().text_range().start(), 0.into());
339 Some(node)
340}
341
342fn unroot(n: SyntaxNode) -> SyntaxNode {
343 SyntaxNode::new_root(n.green().clone())
344}
345
346pub mod tokens {
347 use once_cell::sync::Lazy;
348
349 use crate::{ast, AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken};
350
351 pub(super) static SOURCE_FILE: Lazy<Parse<SourceFile>> =
352 Lazy::new(|| SourceFile::parse("const C: <()>::Item = (1 != 1, 2 == 2, !true)\n;"));
353
354 pub fn single_space() -> SyntaxToken {
355 SOURCE_FILE
356 .tree()
357 .syntax()
358 .descendants_with_tokens()
359 .filter_map(|it| it.into_token())
360 .find(|it| it.kind() == WHITESPACE && it.text().as_str() == " ")
361 .unwrap()
362 }
363
364 pub fn whitespace(text: &str) -> SyntaxToken {
365 assert!(text.trim().is_empty());
366 let sf = SourceFile::parse(text).ok().unwrap();
367 sf.syntax().first_child_or_token().unwrap().into_token().unwrap()
368 }
369
370 pub fn doc_comment(text: &str) -> SyntaxToken {
371 assert!(!text.trim().is_empty());
372 let sf = SourceFile::parse(text).ok().unwrap();
373 sf.syntax().first_child_or_token().unwrap().into_token().unwrap()
374 }
375
376 pub fn literal(text: &str) -> SyntaxToken {
377 assert_eq!(text.trim(), text);
378 let lit: ast::Literal = super::ast_from_text(&format!("fn f() {{ let _ = {}; }}", text));
379 lit.syntax().first_child_or_token().unwrap().into_token().unwrap()
380 }
381
382 pub fn single_newline() -> SyntaxToken {
383 SOURCE_FILE
384 .tree()
385 .syntax()
386 .descendants_with_tokens()
387 .filter_map(|it| it.into_token())
388 .find(|it| it.kind() == WHITESPACE && it.text().as_str() == "\n")
389 .unwrap()
390 }
391
392 pub struct WsBuilder(SourceFile);
393
394 impl WsBuilder {
395 pub fn new(text: &str) -> WsBuilder {
396 WsBuilder(SourceFile::parse(text).ok().unwrap())
397 }
398 pub fn ws(&self) -> SyntaxToken {
399 self.0.syntax().first_child_or_token().unwrap().into_token().unwrap()
400 }
401 }
402}
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs
new file mode 100644
index 000000000..50c1c157d
--- /dev/null
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -0,0 +1,485 @@
1//! Various extension methods to ast Nodes, which are hard to code-generate.
2//! Extensions for various expressions live in a sibling `expr_extensions` module.
3
4use std::fmt;
5
6use itertools::Itertools;
7use parser::SyntaxKind;
8
9use crate::{
10 ast::{self, support, AstNode, NameOwner, SyntaxNode},
11 SmolStr, SyntaxElement, SyntaxToken, T,
12};
13
14impl ast::Name {
15 pub fn text(&self) -> &SmolStr {
16 text_of_first_token(self.syntax())
17 }
18}
19
20impl ast::NameRef {
21 pub fn text(&self) -> &SmolStr {
22 text_of_first_token(self.syntax())
23 }
24
25 pub fn as_tuple_field(&self) -> Option<usize> {
26 self.text().parse().ok()
27 }
28}
29
30fn text_of_first_token(node: &SyntaxNode) -> &SmolStr {
31 node.green().children().next().and_then(|it| it.into_token()).unwrap().text()
32}
33
34#[derive(Debug, Clone, PartialEq, Eq)]
35pub enum AttrKind {
36 Inner,
37 Outer,
38}
39
40impl ast::Attr {
41 pub fn as_simple_atom(&self) -> Option<SmolStr> {
42 if self.eq_token().is_some() || self.token_tree().is_some() {
43 return None;
44 }
45 self.simple_name()
46 }
47
48 pub fn as_simple_call(&self) -> Option<(SmolStr, ast::TokenTree)> {
49 let tt = self.token_tree()?;
50 Some((self.simple_name()?, tt))
51 }
52
53 pub fn as_simple_key_value(&self) -> Option<(SmolStr, SmolStr)> {
54 let lit = self.literal()?;
55 let key = self.simple_name()?;
56 // FIXME: escape? raw string?
57 let value = lit.syntax().first_token()?.text().trim_matches('"').into();
58 Some((key, value))
59 }
60
61 pub fn simple_name(&self) -> Option<SmolStr> {
62 let path = self.path()?;
63 match (path.segment(), path.qualifier()) {
64 (Some(segment), None) => Some(segment.syntax().first_token()?.text().clone()),
65 _ => None,
66 }
67 }
68
69 pub fn kind(&self) -> AttrKind {
70 let first_token = self.syntax().first_token();
71 let first_token_kind = first_token.as_ref().map(SyntaxToken::kind);
72 let second_token_kind =
73 first_token.and_then(|token| token.next_token()).as_ref().map(SyntaxToken::kind);
74
75 match (first_token_kind, second_token_kind) {
76 (Some(SyntaxKind::POUND), Some(T![!])) => AttrKind::Inner,
77 _ => AttrKind::Outer,
78 }
79 }
80}
81
82#[derive(Debug, Clone, PartialEq, Eq)]
83pub enum PathSegmentKind {
84 Name(ast::NameRef),
85 Type { type_ref: Option<ast::Type>, trait_ref: Option<ast::PathType> },
86 SelfKw,
87 SuperKw,
88 CrateKw,
89}
90
91impl ast::PathSegment {
92 pub fn parent_path(&self) -> ast::Path {
93 self.syntax()
94 .parent()
95 .and_then(ast::Path::cast)
96 .expect("segments are always nested in paths")
97 }
98
99 pub fn kind(&self) -> Option<PathSegmentKind> {
100 let res = if let Some(name_ref) = self.name_ref() {
101 PathSegmentKind::Name(name_ref)
102 } else {
103 match self.syntax().first_child_or_token()?.kind() {
104 T![self] => PathSegmentKind::SelfKw,
105 T![super] => PathSegmentKind::SuperKw,
106 T![crate] => PathSegmentKind::CrateKw,
107 T![<] => {
108 // <T> or <T as Trait>
109 // T is any TypeRef, Trait has to be a PathType
110 let mut type_refs =
111 self.syntax().children().filter(|node| ast::Type::can_cast(node.kind()));
112 let type_ref = type_refs.next().and_then(ast::Type::cast);
113 let trait_ref = type_refs.next().and_then(ast::PathType::cast);
114 PathSegmentKind::Type { type_ref, trait_ref }
115 }
116 _ => return None,
117 }
118 };
119 Some(res)
120 }
121}
122
123impl ast::Path {
124 pub fn parent_path(&self) -> Option<ast::Path> {
125 self.syntax().parent().and_then(ast::Path::cast)
126 }
127}
128
129impl ast::UseTreeList {
130 pub fn parent_use_tree(&self) -> ast::UseTree {
131 self.syntax()
132 .parent()
133 .and_then(ast::UseTree::cast)
134 .expect("UseTreeLists are always nested in UseTrees")
135 }
136}
137
138impl ast::Impl {
139 pub fn self_ty(&self) -> Option<ast::Type> {
140 match self.target() {
141 (Some(t), None) | (_, Some(t)) => Some(t),
142 _ => None,
143 }
144 }
145
146 pub fn trait_(&self) -> Option<ast::Type> {
147 match self.target() {
148 (Some(t), Some(_)) => Some(t),
149 _ => None,
150 }
151 }
152
153 fn target(&self) -> (Option<ast::Type>, Option<ast::Type>) {
154 let mut types = support::children(self.syntax());
155 let first = types.next();
156 let second = types.next();
157 (first, second)
158 }
159}
160
161#[derive(Debug, Clone, PartialEq, Eq)]
162pub enum StructKind {
163 Record(ast::RecordFieldList),
164 Tuple(ast::TupleFieldList),
165 Unit,
166}
167
168impl StructKind {
169 fn from_node<N: AstNode>(node: &N) -> StructKind {
170 if let Some(nfdl) = support::child::<ast::RecordFieldList>(node.syntax()) {
171 StructKind::Record(nfdl)
172 } else if let Some(pfl) = support::child::<ast::TupleFieldList>(node.syntax()) {
173 StructKind::Tuple(pfl)
174 } else {
175 StructKind::Unit
176 }
177 }
178}
179
180impl ast::Struct {
181 pub fn kind(&self) -> StructKind {
182 StructKind::from_node(self)
183 }
184}
185
186impl ast::RecordExprField {
187 pub fn for_field_name(field_name: &ast::NameRef) -> Option<ast::RecordExprField> {
188 let candidate =
189 field_name.syntax().parent().and_then(ast::RecordExprField::cast).or_else(|| {
190 field_name.syntax().ancestors().nth(4).and_then(ast::RecordExprField::cast)
191 })?;
192 if candidate.field_name().as_ref() == Some(field_name) {
193 Some(candidate)
194 } else {
195 None
196 }
197 }
198
199 /// Deals with field init shorthand
200 pub fn field_name(&self) -> Option<ast::NameRef> {
201 if let Some(name_ref) = self.name_ref() {
202 return Some(name_ref);
203 }
204 if let Some(ast::Expr::PathExpr(expr)) = self.expr() {
205 let path = expr.path()?;
206 let segment = path.segment()?;
207 let name_ref = segment.name_ref()?;
208 if path.qualifier().is_none() {
209 return Some(name_ref);
210 }
211 }
212 None
213 }
214}
215
216pub enum NameOrNameRef {
217 Name(ast::Name),
218 NameRef(ast::NameRef),
219}
220
221impl fmt::Display for NameOrNameRef {
222 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
223 match self {
224 NameOrNameRef::Name(it) => fmt::Display::fmt(it, f),
225 NameOrNameRef::NameRef(it) => fmt::Display::fmt(it, f),
226 }
227 }
228}
229
230impl ast::RecordPatField {
231 /// Deals with field init shorthand
232 pub fn field_name(&self) -> Option<NameOrNameRef> {
233 if let Some(name_ref) = self.name_ref() {
234 return Some(NameOrNameRef::NameRef(name_ref));
235 }
236 if let Some(ast::Pat::IdentPat(pat)) = self.pat() {
237 let name = pat.name()?;
238 return Some(NameOrNameRef::Name(name));
239 }
240 None
241 }
242}
243
244impl ast::Variant {
245 pub fn parent_enum(&self) -> ast::Enum {
246 self.syntax()
247 .parent()
248 .and_then(|it| it.parent())
249 .and_then(ast::Enum::cast)
250 .expect("EnumVariants are always nested in Enums")
251 }
252 pub fn kind(&self) -> StructKind {
253 StructKind::from_node(self)
254 }
255}
256
257#[derive(Debug, Clone, PartialEq, Eq)]
258pub enum FieldKind {
259 Name(ast::NameRef),
260 Index(SyntaxToken),
261}
262
263impl ast::FieldExpr {
264 pub fn index_token(&self) -> Option<SyntaxToken> {
265 self.syntax
266 .children_with_tokens()
267 // FIXME: Accepting floats here to reject them in validation later
268 .find(|c| c.kind() == SyntaxKind::INT_NUMBER || c.kind() == SyntaxKind::FLOAT_NUMBER)
269 .as_ref()
270 .and_then(SyntaxElement::as_token)
271 .cloned()
272 }
273
274 pub fn field_access(&self) -> Option<FieldKind> {
275 if let Some(nr) = self.name_ref() {
276 Some(FieldKind::Name(nr))
277 } else if let Some(tok) = self.index_token() {
278 Some(FieldKind::Index(tok))
279 } else {
280 None
281 }
282 }
283}
284
285pub struct SlicePatComponents {
286 pub prefix: Vec<ast::Pat>,
287 pub slice: Option<ast::Pat>,
288 pub suffix: Vec<ast::Pat>,
289}
290
291impl ast::SlicePat {
292 pub fn components(&self) -> SlicePatComponents {
293 let mut args = self.pats().peekable();
294 let prefix = args
295 .peeking_take_while(|p| match p {
296 ast::Pat::RestPat(_) => false,
297 ast::Pat::IdentPat(bp) => match bp.pat() {
298 Some(ast::Pat::RestPat(_)) => false,
299 _ => true,
300 },
301 ast::Pat::RefPat(rp) => match rp.pat() {
302 Some(ast::Pat::RestPat(_)) => false,
303 Some(ast::Pat::IdentPat(bp)) => match bp.pat() {
304 Some(ast::Pat::RestPat(_)) => false,
305 _ => true,
306 },
307 _ => true,
308 },
309 _ => true,
310 })
311 .collect();
312 let slice = args.next();
313 let suffix = args.collect();
314
315 SlicePatComponents { prefix, slice, suffix }
316 }
317}
318
319#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
320pub enum SelfParamKind {
321 /// self
322 Owned,
323 /// &self
324 Ref,
325 /// &mut self
326 MutRef,
327}
328
329impl ast::SelfParam {
330 pub fn kind(&self) -> SelfParamKind {
331 if self.amp_token().is_some() {
332 if self.mut_token().is_some() {
333 SelfParamKind::MutRef
334 } else {
335 SelfParamKind::Ref
336 }
337 } else {
338 SelfParamKind::Owned
339 }
340 }
341}
342
343#[derive(Clone, Debug, PartialEq, Eq, Hash)]
344pub enum TypeBoundKind {
345 /// Trait
346 PathType(ast::PathType),
347 /// for<'a> ...
348 ForType(ast::ForType),
349 /// 'a
350 Lifetime(SyntaxToken),
351}
352
353impl ast::TypeBound {
354 pub fn kind(&self) -> TypeBoundKind {
355 if let Some(path_type) = support::children(self.syntax()).next() {
356 TypeBoundKind::PathType(path_type)
357 } else if let Some(for_type) = support::children(self.syntax()).next() {
358 TypeBoundKind::ForType(for_type)
359 } else if let Some(lifetime) = self.lifetime_token() {
360 TypeBoundKind::Lifetime(lifetime)
361 } else {
362 unreachable!()
363 }
364 }
365}
366
367pub enum VisibilityKind {
368 In(ast::Path),
369 PubCrate,
370 PubSuper,
371 PubSelf,
372 Pub,
373}
374
375impl ast::Visibility {
376 pub fn kind(&self) -> VisibilityKind {
377 if let Some(path) = support::children(self.syntax()).next() {
378 VisibilityKind::In(path)
379 } else if self.crate_token().is_some() {
380 VisibilityKind::PubCrate
381 } else if self.super_token().is_some() {
382 VisibilityKind::PubSuper
383 } else if self.self_token().is_some() {
384 VisibilityKind::PubSelf
385 } else {
386 VisibilityKind::Pub
387 }
388 }
389}
390
391impl ast::MacroCall {
392 pub fn is_macro_rules(&self) -> Option<ast::Name> {
393 let name_ref = self.path()?.segment()?.name_ref()?;
394 if name_ref.text() == "macro_rules" {
395 self.name()
396 } else {
397 None
398 }
399 }
400
401 pub fn is_bang(&self) -> bool {
402 self.is_macro_rules().is_none()
403 }
404}
405
406impl ast::LifetimeParam {
407 pub fn lifetime_bounds(&self) -> impl Iterator<Item = SyntaxToken> {
408 self.syntax()
409 .children_with_tokens()
410 .filter_map(|it| it.into_token())
411 .skip_while(|x| x.kind() != T![:])
412 .filter(|it| it.kind() == T![lifetime])
413 }
414}
415
416impl ast::RangePat {
417 pub fn start(&self) -> Option<ast::Pat> {
418 self.syntax()
419 .children_with_tokens()
420 .take_while(|it| !(it.kind() == T![..] || it.kind() == T![..=]))
421 .filter_map(|it| it.into_node())
422 .find_map(ast::Pat::cast)
423 }
424
425 pub fn end(&self) -> Option<ast::Pat> {
426 self.syntax()
427 .children_with_tokens()
428 .skip_while(|it| !(it.kind() == T![..] || it.kind() == T![..=]))
429 .filter_map(|it| it.into_node())
430 .find_map(ast::Pat::cast)
431 }
432}
433
434impl ast::TokenTree {
435 pub fn left_delimiter_token(&self) -> Option<SyntaxToken> {
436 self.syntax()
437 .first_child_or_token()?
438 .into_token()
439 .filter(|it| matches!(it.kind(), T!['{'] | T!['('] | T!['[']))
440 }
441
442 pub fn right_delimiter_token(&self) -> Option<SyntaxToken> {
443 self.syntax()
444 .last_child_or_token()?
445 .into_token()
446 .filter(|it| matches!(it.kind(), T!['}'] | T![')'] | T![']']))
447 }
448}
449
450impl ast::GenericParamList {
451 pub fn lifetime_params(&self) -> impl Iterator<Item = ast::LifetimeParam> {
452 self.generic_params().filter_map(|param| match param {
453 ast::GenericParam::LifetimeParam(it) => Some(it),
454 ast::GenericParam::TypeParam(_) | ast::GenericParam::ConstParam(_) => None,
455 })
456 }
457 pub fn type_params(&self) -> impl Iterator<Item = ast::TypeParam> {
458 self.generic_params().filter_map(|param| match param {
459 ast::GenericParam::TypeParam(it) => Some(it),
460 ast::GenericParam::LifetimeParam(_) | ast::GenericParam::ConstParam(_) => None,
461 })
462 }
463 pub fn const_params(&self) -> impl Iterator<Item = ast::ConstParam> {
464 self.generic_params().filter_map(|param| match param {
465 ast::GenericParam::ConstParam(it) => Some(it),
466 ast::GenericParam::TypeParam(_) | ast::GenericParam::LifetimeParam(_) => None,
467 })
468 }
469}
470
471impl ast::DocCommentsOwner for ast::SourceFile {}
472impl ast::DocCommentsOwner for ast::Fn {}
473impl ast::DocCommentsOwner for ast::Struct {}
474impl ast::DocCommentsOwner for ast::Union {}
475impl ast::DocCommentsOwner for ast::RecordField {}
476impl ast::DocCommentsOwner for ast::TupleField {}
477impl ast::DocCommentsOwner for ast::Enum {}
478impl ast::DocCommentsOwner for ast::Variant {}
479impl ast::DocCommentsOwner for ast::Trait {}
480impl ast::DocCommentsOwner for ast::Module {}
481impl ast::DocCommentsOwner for ast::Static {}
482impl ast::DocCommentsOwner for ast::Const {}
483impl ast::DocCommentsOwner for ast::TypeAlias {}
484impl ast::DocCommentsOwner for ast::Impl {}
485impl ast::DocCommentsOwner for ast::MacroCall {}
diff --git a/crates/syntax/src/ast/token_ext.rs b/crates/syntax/src/ast/token_ext.rs
new file mode 100644
index 000000000..c5ef92733
--- /dev/null
+++ b/crates/syntax/src/ast/token_ext.rs
@@ -0,0 +1,538 @@
1//! There are many AstNodes, but only a few tokens, so we hand-write them here.
2
3use std::{
4 borrow::Cow,
5 convert::{TryFrom, TryInto},
6};
7
8use rustc_lexer::unescape::{unescape_literal, Mode};
9
10use crate::{
11 ast::{AstToken, Comment, RawString, String, Whitespace},
12 TextRange, TextSize,
13};
14
15impl Comment {
16 pub fn kind(&self) -> CommentKind {
17 kind_by_prefix(self.text())
18 }
19
20 pub fn prefix(&self) -> &'static str {
21 for (prefix, k) in COMMENT_PREFIX_TO_KIND.iter() {
22 if *k == self.kind() && self.text().starts_with(prefix) {
23 return prefix;
24 }
25 }
26 unreachable!()
27 }
28}
29
30#[derive(Debug, PartialEq, Eq, Clone, Copy)]
31pub struct CommentKind {
32 pub shape: CommentShape,
33 pub doc: Option<CommentPlacement>,
34}
35
36#[derive(Debug, PartialEq, Eq, Clone, Copy)]
37pub enum CommentShape {
38 Line,
39 Block,
40}
41
42impl CommentShape {
43 pub fn is_line(self) -> bool {
44 self == CommentShape::Line
45 }
46
47 pub fn is_block(self) -> bool {
48 self == CommentShape::Block
49 }
50}
51
52#[derive(Debug, PartialEq, Eq, Clone, Copy)]
53pub enum CommentPlacement {
54 Inner,
55 Outer,
56}
57
58const COMMENT_PREFIX_TO_KIND: &[(&str, CommentKind)] = {
59 use {CommentPlacement::*, CommentShape::*};
60 &[
61 ("////", CommentKind { shape: Line, doc: None }),
62 ("///", CommentKind { shape: Line, doc: Some(Outer) }),
63 ("//!", CommentKind { shape: Line, doc: Some(Inner) }),
64 ("/**", CommentKind { shape: Block, doc: Some(Outer) }),
65 ("/*!", CommentKind { shape: Block, doc: Some(Inner) }),
66 ("//", CommentKind { shape: Line, doc: None }),
67 ("/*", CommentKind { shape: Block, doc: None }),
68 ]
69};
70
71fn kind_by_prefix(text: &str) -> CommentKind {
72 if text == "/**/" {
73 return CommentKind { shape: CommentShape::Block, doc: None };
74 }
75 for (prefix, kind) in COMMENT_PREFIX_TO_KIND.iter() {
76 if text.starts_with(prefix) {
77 return *kind;
78 }
79 }
80 panic!("bad comment text: {:?}", text)
81}
82
83impl Whitespace {
84 pub fn spans_multiple_lines(&self) -> bool {
85 let text = self.text();
86 text.find('\n').map_or(false, |idx| text[idx + 1..].contains('\n'))
87 }
88}
89
90pub struct QuoteOffsets {
91 pub quotes: (TextRange, TextRange),
92 pub contents: TextRange,
93}
94
95impl QuoteOffsets {
96 fn new(literal: &str) -> Option<QuoteOffsets> {
97 let left_quote = literal.find('"')?;
98 let right_quote = literal.rfind('"')?;
99 if left_quote == right_quote {
100 // `literal` only contains one quote
101 return None;
102 }
103
104 let start = TextSize::from(0);
105 let left_quote = TextSize::try_from(left_quote).unwrap() + TextSize::of('"');
106 let right_quote = TextSize::try_from(right_quote).unwrap();
107 let end = TextSize::of(literal);
108
109 let res = QuoteOffsets {
110 quotes: (TextRange::new(start, left_quote), TextRange::new(right_quote, end)),
111 contents: TextRange::new(left_quote, right_quote),
112 };
113 Some(res)
114 }
115}
116
117pub trait HasQuotes: AstToken {
118 fn quote_offsets(&self) -> Option<QuoteOffsets> {
119 let text = self.text().as_str();
120 let offsets = QuoteOffsets::new(text)?;
121 let o = self.syntax().text_range().start();
122 let offsets = QuoteOffsets {
123 quotes: (offsets.quotes.0 + o, offsets.quotes.1 + o),
124 contents: offsets.contents + o,
125 };
126 Some(offsets)
127 }
128 fn open_quote_text_range(&self) -> Option<TextRange> {
129 self.quote_offsets().map(|it| it.quotes.0)
130 }
131
132 fn close_quote_text_range(&self) -> Option<TextRange> {
133 self.quote_offsets().map(|it| it.quotes.1)
134 }
135
136 fn text_range_between_quotes(&self) -> Option<TextRange> {
137 self.quote_offsets().map(|it| it.contents)
138 }
139}
140
141impl HasQuotes for String {}
142impl HasQuotes for RawString {}
143
144pub trait HasStringValue: HasQuotes {
145 fn value(&self) -> Option<Cow<'_, str>>;
146}
147
148impl HasStringValue for String {
149 fn value(&self) -> Option<Cow<'_, str>> {
150 let text = self.text().as_str();
151 let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()];
152
153 let mut buf = std::string::String::with_capacity(text.len());
154 let mut has_error = false;
155 unescape_literal(text, Mode::Str, &mut |_, unescaped_char| match unescaped_char {
156 Ok(c) => buf.push(c),
157 Err(_) => has_error = true,
158 });
159
160 if has_error {
161 return None;
162 }
163 // FIXME: don't actually allocate for borrowed case
164 let res = if buf == text { Cow::Borrowed(text) } else { Cow::Owned(buf) };
165 Some(res)
166 }
167}
168
169impl HasStringValue for RawString {
170 fn value(&self) -> Option<Cow<'_, str>> {
171 let text = self.text().as_str();
172 let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()];
173 Some(Cow::Borrowed(text))
174 }
175}
176
177impl RawString {
178 pub fn map_range_up(&self, range: TextRange) -> Option<TextRange> {
179 let contents_range = self.text_range_between_quotes()?;
180 assert!(TextRange::up_to(contents_range.len()).contains_range(range));
181 Some(range + contents_range.start())
182 }
183}
184
185#[derive(Debug)]
186pub enum FormatSpecifier {
187 Open,
188 Close,
189 Integer,
190 Identifier,
191 Colon,
192 Fill,
193 Align,
194 Sign,
195 NumberSign,
196 Zero,
197 DollarSign,
198 Dot,
199 Asterisk,
200 QuestionMark,
201}
202
203pub trait HasFormatSpecifier: AstToken {
204 fn char_ranges(
205 &self,
206 ) -> Option<Vec<(TextRange, Result<char, rustc_lexer::unescape::EscapeError>)>>;
207
208 fn lex_format_specifier<F>(&self, mut callback: F)
209 where
210 F: FnMut(TextRange, FormatSpecifier),
211 {
212 let char_ranges = if let Some(char_ranges) = self.char_ranges() {
213 char_ranges
214 } else {
215 return;
216 };
217 let mut chars = char_ranges.iter().peekable();
218
219 while let Some((range, first_char)) = chars.next() {
220 match first_char {
221 Ok('{') => {
222 // Format specifier, see syntax at https://doc.rust-lang.org/std/fmt/index.html#syntax
223 if let Some((_, Ok('{'))) = chars.peek() {
224 // Escaped format specifier, `{{`
225 chars.next();
226 continue;
227 }
228
229 callback(*range, FormatSpecifier::Open);
230
231 // check for integer/identifier
232 match chars
233 .peek()
234 .and_then(|next| next.1.as_ref().ok())
235 .copied()
236 .unwrap_or_default()
237 {
238 '0'..='9' => {
239 // integer
240 read_integer(&mut chars, &mut callback);
241 }
242 c if c == '_' || c.is_alphabetic() => {
243 // identifier
244 read_identifier(&mut chars, &mut callback);
245 }
246 _ => {}
247 }
248
249 if let Some((_, Ok(':'))) = chars.peek() {
250 skip_char_and_emit(&mut chars, FormatSpecifier::Colon, &mut callback);
251
252 // check for fill/align
253 let mut cloned = chars.clone().take(2);
254 let first = cloned
255 .next()
256 .and_then(|next| next.1.as_ref().ok())
257 .copied()
258 .unwrap_or_default();
259 let second = cloned
260 .next()
261 .and_then(|next| next.1.as_ref().ok())
262 .copied()
263 .unwrap_or_default();
264 match second {
265 '<' | '^' | '>' => {
266 // alignment specifier, first char specifies fillment
267 skip_char_and_emit(
268 &mut chars,
269 FormatSpecifier::Fill,
270 &mut callback,
271 );
272 skip_char_and_emit(
273 &mut chars,
274 FormatSpecifier::Align,
275 &mut callback,
276 );
277 }
278 _ => match first {
279 '<' | '^' | '>' => {
280 skip_char_and_emit(
281 &mut chars,
282 FormatSpecifier::Align,
283 &mut callback,
284 );
285 }
286 _ => {}
287 },
288 }
289
290 // check for sign
291 match chars
292 .peek()
293 .and_then(|next| next.1.as_ref().ok())
294 .copied()
295 .unwrap_or_default()
296 {
297 '+' | '-' => {
298 skip_char_and_emit(
299 &mut chars,
300 FormatSpecifier::Sign,
301 &mut callback,
302 );
303 }
304 _ => {}
305 }
306
307 // check for `#`
308 if let Some((_, Ok('#'))) = chars.peek() {
309 skip_char_and_emit(
310 &mut chars,
311 FormatSpecifier::NumberSign,
312 &mut callback,
313 );
314 }
315
316 // check for `0`
317 let mut cloned = chars.clone().take(2);
318 let first = cloned.next().and_then(|next| next.1.as_ref().ok()).copied();
319 let second = cloned.next().and_then(|next| next.1.as_ref().ok()).copied();
320
321 if first == Some('0') && second != Some('$') {
322 skip_char_and_emit(&mut chars, FormatSpecifier::Zero, &mut callback);
323 }
324
325 // width
326 match chars
327 .peek()
328 .and_then(|next| next.1.as_ref().ok())
329 .copied()
330 .unwrap_or_default()
331 {
332 '0'..='9' => {
333 read_integer(&mut chars, &mut callback);
334 if let Some((_, Ok('$'))) = chars.peek() {
335 skip_char_and_emit(
336 &mut chars,
337 FormatSpecifier::DollarSign,
338 &mut callback,
339 );
340 }
341 }
342 c if c == '_' || c.is_alphabetic() => {
343 read_identifier(&mut chars, &mut callback);
344 // can be either width (indicated by dollar sign, or type in which case
345 // the next sign has to be `}`)
346 let next =
347 chars.peek().and_then(|next| next.1.as_ref().ok()).copied();
348 match next {
349 Some('$') => skip_char_and_emit(
350 &mut chars,
351 FormatSpecifier::DollarSign,
352 &mut callback,
353 ),
354 Some('}') => {
355 skip_char_and_emit(
356 &mut chars,
357 FormatSpecifier::Close,
358 &mut callback,
359 );
360 continue;
361 }
362 _ => continue,
363 };
364 }
365 _ => {}
366 }
367
368 // precision
369 if let Some((_, Ok('.'))) = chars.peek() {
370 skip_char_and_emit(&mut chars, FormatSpecifier::Dot, &mut callback);
371
372 match chars
373 .peek()
374 .and_then(|next| next.1.as_ref().ok())
375 .copied()
376 .unwrap_or_default()
377 {
378 '*' => {
379 skip_char_and_emit(
380 &mut chars,
381 FormatSpecifier::Asterisk,
382 &mut callback,
383 );
384 }
385 '0'..='9' => {
386 read_integer(&mut chars, &mut callback);
387 if let Some((_, Ok('$'))) = chars.peek() {
388 skip_char_and_emit(
389 &mut chars,
390 FormatSpecifier::DollarSign,
391 &mut callback,
392 );
393 }
394 }
395 c if c == '_' || c.is_alphabetic() => {
396 read_identifier(&mut chars, &mut callback);
397 if chars.peek().and_then(|next| next.1.as_ref().ok()).copied()
398 != Some('$')
399 {
400 continue;
401 }
402 skip_char_and_emit(
403 &mut chars,
404 FormatSpecifier::DollarSign,
405 &mut callback,
406 );
407 }
408 _ => {
409 continue;
410 }
411 }
412 }
413
414 // type
415 match chars
416 .peek()
417 .and_then(|next| next.1.as_ref().ok())
418 .copied()
419 .unwrap_or_default()
420 {
421 '?' => {
422 skip_char_and_emit(
423 &mut chars,
424 FormatSpecifier::QuestionMark,
425 &mut callback,
426 );
427 }
428 c if c == '_' || c.is_alphabetic() => {
429 read_identifier(&mut chars, &mut callback);
430 }
431 _ => {}
432 }
433 }
434
435 if let Some((_, Ok('}'))) = chars.peek() {
436 skip_char_and_emit(&mut chars, FormatSpecifier::Close, &mut callback);
437 } else {
438 continue;
439 }
440 }
441 _ => {
442 while let Some((_, Ok(next_char))) = chars.peek() {
443 match next_char {
444 '{' => break,
445 _ => {}
446 }
447 chars.next();
448 }
449 }
450 };
451 }
452
453 fn skip_char_and_emit<'a, I, F>(
454 chars: &mut std::iter::Peekable<I>,
455 emit: FormatSpecifier,
456 callback: &mut F,
457 ) where
458 I: Iterator<Item = &'a (TextRange, Result<char, rustc_lexer::unescape::EscapeError>)>,
459 F: FnMut(TextRange, FormatSpecifier),
460 {
461 let (range, _) = chars.next().unwrap();
462 callback(*range, emit);
463 }
464
465 fn read_integer<'a, I, F>(chars: &mut std::iter::Peekable<I>, callback: &mut F)
466 where
467 I: Iterator<Item = &'a (TextRange, Result<char, rustc_lexer::unescape::EscapeError>)>,
468 F: FnMut(TextRange, FormatSpecifier),
469 {
470 let (mut range, c) = chars.next().unwrap();
471 assert!(c.as_ref().unwrap().is_ascii_digit());
472 while let Some((r, Ok(next_char))) = chars.peek() {
473 if next_char.is_ascii_digit() {
474 chars.next();
475 range = range.cover(*r);
476 } else {
477 break;
478 }
479 }
480 callback(range, FormatSpecifier::Integer);
481 }
482
483 fn read_identifier<'a, I, F>(chars: &mut std::iter::Peekable<I>, callback: &mut F)
484 where
485 I: Iterator<Item = &'a (TextRange, Result<char, rustc_lexer::unescape::EscapeError>)>,
486 F: FnMut(TextRange, FormatSpecifier),
487 {
488 let (mut range, c) = chars.next().unwrap();
489 assert!(c.as_ref().unwrap().is_alphabetic() || *c.as_ref().unwrap() == '_');
490 while let Some((r, Ok(next_char))) = chars.peek() {
491 if *next_char == '_' || next_char.is_ascii_digit() || next_char.is_alphabetic() {
492 chars.next();
493 range = range.cover(*r);
494 } else {
495 break;
496 }
497 }
498 callback(range, FormatSpecifier::Identifier);
499 }
500 }
501}
502
503impl HasFormatSpecifier for String {
504 fn char_ranges(
505 &self,
506 ) -> Option<Vec<(TextRange, Result<char, rustc_lexer::unescape::EscapeError>)>> {
507 let text = self.text().as_str();
508 let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()];
509 let offset = self.text_range_between_quotes()?.start() - self.syntax().text_range().start();
510
511 let mut res = Vec::with_capacity(text.len());
512 unescape_literal(text, Mode::Str, &mut |range, unescaped_char| {
513 res.push((
514 TextRange::new(range.start.try_into().unwrap(), range.end.try_into().unwrap())
515 + offset,
516 unescaped_char,
517 ))
518 });
519
520 Some(res)
521 }
522}
523
524impl HasFormatSpecifier for RawString {
525 fn char_ranges(
526 &self,
527 ) -> Option<Vec<(TextRange, Result<char, rustc_lexer::unescape::EscapeError>)>> {
528 let text = self.text().as_str();
529 let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()];
530 let offset = self.text_range_between_quotes()?.start() - self.syntax().text_range().start();
531
532 let mut res = Vec::with_capacity(text.len());
533 for (idx, c) in text.char_indices() {
534 res.push((TextRange::at(idx.try_into().unwrap(), TextSize::of(c)) + offset, Ok(c)));
535 }
536 Some(res)
537 }
538}
diff --git a/crates/syntax/src/ast/traits.rs b/crates/syntax/src/ast/traits.rs
new file mode 100644
index 000000000..0bdc22d95
--- /dev/null
+++ b/crates/syntax/src/ast/traits.rs
@@ -0,0 +1,141 @@
1//! Various traits that are implemented by ast nodes.
2//!
3//! The implementations are usually trivial, and live in generated.rs
4use itertools::Itertools;
5
6use crate::{
7 ast::{self, support, AstChildren, AstNode, AstToken},
8 syntax_node::SyntaxElementChildren,
9 SyntaxToken, T,
10};
11
12pub trait NameOwner: AstNode {
13 fn name(&self) -> Option<ast::Name> {
14 support::child(self.syntax())
15 }
16}
17
18pub trait VisibilityOwner: AstNode {
19 fn visibility(&self) -> Option<ast::Visibility> {
20 support::child(self.syntax())
21 }
22}
23
24pub trait LoopBodyOwner: AstNode {
25 fn loop_body(&self) -> Option<ast::BlockExpr> {
26 support::child(self.syntax())
27 }
28
29 fn label(&self) -> Option<ast::Label> {
30 support::child(self.syntax())
31 }
32}
33
34pub trait ArgListOwner: AstNode {
35 fn arg_list(&self) -> Option<ast::ArgList> {
36 support::child(self.syntax())
37 }
38}
39
40pub trait ModuleItemOwner: AstNode {
41 fn items(&self) -> AstChildren<ast::Item> {
42 support::children(self.syntax())
43 }
44}
45
46pub trait GenericParamsOwner: AstNode {
47 fn generic_param_list(&self) -> Option<ast::GenericParamList> {
48 support::child(self.syntax())
49 }
50
51 fn where_clause(&self) -> Option<ast::WhereClause> {
52 support::child(self.syntax())
53 }
54}
55
56pub trait TypeBoundsOwner: AstNode {
57 fn type_bound_list(&self) -> Option<ast::TypeBoundList> {
58 support::child(self.syntax())
59 }
60
61 fn colon_token(&self) -> Option<SyntaxToken> {
62 support::token(self.syntax(), T![:])
63 }
64}
65
66pub trait AttrsOwner: AstNode {
67 fn attrs(&self) -> AstChildren<ast::Attr> {
68 support::children(self.syntax())
69 }
70 fn has_atom_attr(&self, atom: &str) -> bool {
71 self.attrs().filter_map(|x| x.as_simple_atom()).any(|x| x == atom)
72 }
73}
74
75pub trait DocCommentsOwner: AstNode {
76 fn doc_comments(&self) -> CommentIter {
77 CommentIter { iter: self.syntax().children_with_tokens() }
78 }
79
80 fn doc_comment_text(&self) -> Option<String> {
81 self.doc_comments().doc_comment_text()
82 }
83}
84
85impl CommentIter {
86 pub fn from_syntax_node(syntax_node: &ast::SyntaxNode) -> CommentIter {
87 CommentIter { iter: syntax_node.children_with_tokens() }
88 }
89
90 /// Returns the textual content of a doc comment block as a single string.
91 /// That is, strips leading `///` (+ optional 1 character of whitespace),
92 /// trailing `*/`, trailing whitespace and then joins the lines.
93 pub fn doc_comment_text(self) -> Option<String> {
94 let mut has_comments = false;
95 let docs = self
96 .filter(|comment| comment.kind().doc.is_some())
97 .map(|comment| {
98 has_comments = true;
99 let prefix_len = comment.prefix().len();
100
101 let line: &str = comment.text().as_str();
102
103 // Determine if the prefix or prefix + 1 char is stripped
104 let pos =
105 if let Some(ws) = line.chars().nth(prefix_len).filter(|c| c.is_whitespace()) {
106 prefix_len + ws.len_utf8()
107 } else {
108 prefix_len
109 };
110
111 let end = if comment.kind().shape.is_block() && line.ends_with("*/") {
112 line.len() - 2
113 } else {
114 line.len()
115 };
116
117 // Note that we do not trim the end of the line here
118 // since whitespace can have special meaning at the end
119 // of a line in markdown.
120 line[pos..end].to_owned()
121 })
122 .join("\n");
123
124 if has_comments {
125 Some(docs)
126 } else {
127 None
128 }
129 }
130}
131
132pub struct CommentIter {
133 iter: SyntaxElementChildren,
134}
135
136impl Iterator for CommentIter {
137 type Item = ast::Comment;
138 fn next(&mut self) -> Option<ast::Comment> {
139 self.iter.by_ref().find_map(|el| el.into_token().and_then(ast::Comment::cast))
140 }
141}
diff --git a/crates/syntax/src/fuzz.rs b/crates/syntax/src/fuzz.rs
new file mode 100644
index 000000000..fbb97aa27
--- /dev/null
+++ b/crates/syntax/src/fuzz.rs
@@ -0,0 +1,73 @@
1//! FIXME: write short doc here
2
3use std::{
4 convert::TryInto,
5 str::{self, FromStr},
6};
7
8use text_edit::Indel;
9
10use crate::{validation, AstNode, SourceFile, TextRange};
11
12fn check_file_invariants(file: &SourceFile) {
13 let root = file.syntax();
14 validation::validate_block_structure(root);
15}
16
17pub fn check_parser(text: &str) {
18 let file = SourceFile::parse(text);
19 check_file_invariants(&file.tree());
20}
21
22#[derive(Debug, Clone)]
23pub struct CheckReparse {
24 text: String,
25 edit: Indel,
26 edited_text: String,
27}
28
29impl CheckReparse {
30 pub fn from_data(data: &[u8]) -> Option<Self> {
31 const PREFIX: &str = "fn main(){\n\t";
32 const SUFFIX: &str = "\n}";
33
34 let data = str::from_utf8(data).ok()?;
35 let mut lines = data.lines();
36 let delete_start = usize::from_str(lines.next()?).ok()? + PREFIX.len();
37 let delete_len = usize::from_str(lines.next()?).ok()?;
38 let insert = lines.next()?.to_string();
39 let text = lines.collect::<Vec<_>>().join("\n");
40 let text = format!("{}{}{}", PREFIX, text, SUFFIX);
41 text.get(delete_start..delete_start.checked_add(delete_len)?)?; // make sure delete is a valid range
42 let delete =
43 TextRange::at(delete_start.try_into().unwrap(), delete_len.try_into().unwrap());
44 let edited_text =
45 format!("{}{}{}", &text[..delete_start], &insert, &text[delete_start + delete_len..]);
46 let edit = Indel { delete, insert };
47 Some(CheckReparse { text, edit, edited_text })
48 }
49
50 pub fn run(&self) {
51 let parse = SourceFile::parse(&self.text);
52 let new_parse = parse.reparse(&self.edit);
53 check_file_invariants(&new_parse.tree());
54 assert_eq!(&new_parse.tree().syntax().text().to_string(), &self.edited_text);
55 let full_reparse = SourceFile::parse(&self.edited_text);
56 for (a, b) in
57 new_parse.tree().syntax().descendants().zip(full_reparse.tree().syntax().descendants())
58 {
59 if (a.kind(), a.text_range()) != (b.kind(), b.text_range()) {
60 eprint!("original:\n{:#?}", parse.tree().syntax());
61 eprint!("reparsed:\n{:#?}", new_parse.tree().syntax());
62 eprint!("full reparse:\n{:#?}", full_reparse.tree().syntax());
63 assert_eq!(
64 format!("{:?}", a),
65 format!("{:?}", b),
66 "different syntax tree produced by the full reparse"
67 );
68 }
69 }
70 // FIXME
71 // assert_eq!(new_file.errors(), full_reparse.errors());
72 }
73}
diff --git a/crates/syntax/src/lib.rs b/crates/syntax/src/lib.rs
new file mode 100644
index 000000000..7f8da66af
--- /dev/null
+++ b/crates/syntax/src/lib.rs
@@ -0,0 +1,388 @@
1//! Syntax Tree library used throughout the rust analyzer.
2//!
3//! Properties:
4//! - easy and fast incremental re-parsing
5//! - graceful handling of errors
6//! - full-fidelity representation (*any* text can be precisely represented as
7//! a syntax tree)
8//!
9//! For more information, see the [RFC]. Current implementation is inspired by
10//! the [Swift] one.
11//!
12//! The most interesting modules here are `syntax_node` (which defines concrete
13//! syntax tree) and `ast` (which defines abstract syntax tree on top of the
14//! CST). The actual parser live in a separate `parser` crate, though the
15//! lexer lives in this crate.
16//!
17//! See `api_walkthrough` test in this file for a quick API tour!
18//!
19//! [RFC]: <https://github.com/rust-lang/rfcs/pull/2256>
20//! [Swift]: <https://github.com/apple/swift/blob/13d593df6f359d0cb2fc81cfaac273297c539455/lib/Syntax/README.md>
21
22#[allow(unused)]
23macro_rules! eprintln {
24 ($($tt:tt)*) => { stdx::eprintln!($($tt)*) };
25}
26
27mod syntax_node;
28mod syntax_error;
29mod parsing;
30mod validation;
31mod ptr;
32#[cfg(test)]
33mod tests;
34
35pub mod algo;
36pub mod ast;
37#[doc(hidden)]
38pub mod fuzz;
39
40use std::{marker::PhantomData, sync::Arc};
41
42use stdx::format_to;
43use text_edit::Indel;
44
45pub use crate::{
46 algo::InsertPosition,
47 ast::{AstNode, AstToken},
48 parsing::{lex_single_syntax_kind, lex_single_valid_syntax_kind, tokenize, Token},
49 ptr::{AstPtr, SyntaxNodePtr},
50 syntax_error::SyntaxError,
51 syntax_node::{
52 Direction, GreenNode, NodeOrToken, SyntaxElement, SyntaxElementChildren, SyntaxNode,
53 SyntaxNodeChildren, SyntaxToken, SyntaxTreeBuilder,
54 },
55};
56pub use parser::{SyntaxKind, T};
57pub use rowan::{SmolStr, SyntaxText, TextRange, TextSize, TokenAtOffset, WalkEvent};
58
59/// `Parse` is the result of the parsing: a syntax tree and a collection of
60/// errors.
61///
62/// Note that we always produce a syntax tree, even for completely invalid
63/// files.
64#[derive(Debug, PartialEq, Eq)]
65pub struct Parse<T> {
66 green: GreenNode,
67 errors: Arc<Vec<SyntaxError>>,
68 _ty: PhantomData<fn() -> T>,
69}
70
71impl<T> Clone for Parse<T> {
72 fn clone(&self) -> Parse<T> {
73 Parse { green: self.green.clone(), errors: self.errors.clone(), _ty: PhantomData }
74 }
75}
76
77impl<T> Parse<T> {
78 fn new(green: GreenNode, errors: Vec<SyntaxError>) -> Parse<T> {
79 Parse { green, errors: Arc::new(errors), _ty: PhantomData }
80 }
81
82 pub fn syntax_node(&self) -> SyntaxNode {
83 SyntaxNode::new_root(self.green.clone())
84 }
85}
86
87impl<T: AstNode> Parse<T> {
88 pub fn to_syntax(self) -> Parse<SyntaxNode> {
89 Parse { green: self.green, errors: self.errors, _ty: PhantomData }
90 }
91
92 pub fn tree(&self) -> T {
93 T::cast(self.syntax_node()).unwrap()
94 }
95
96 pub fn errors(&self) -> &[SyntaxError] {
97 &*self.errors
98 }
99
100 pub fn ok(self) -> Result<T, Arc<Vec<SyntaxError>>> {
101 if self.errors.is_empty() {
102 Ok(self.tree())
103 } else {
104 Err(self.errors)
105 }
106 }
107}
108
109impl Parse<SyntaxNode> {
110 pub fn cast<N: AstNode>(self) -> Option<Parse<N>> {
111 if N::cast(self.syntax_node()).is_some() {
112 Some(Parse { green: self.green, errors: self.errors, _ty: PhantomData })
113 } else {
114 None
115 }
116 }
117}
118
119impl Parse<SourceFile> {
120 pub fn debug_dump(&self) -> String {
121 let mut buf = format!("{:#?}", self.tree().syntax());
122 for err in self.errors.iter() {
123 format_to!(buf, "error {:?}: {}\n", err.range(), err);
124 }
125 buf
126 }
127
128 pub fn reparse(&self, indel: &Indel) -> Parse<SourceFile> {
129 self.incremental_reparse(indel).unwrap_or_else(|| self.full_reparse(indel))
130 }
131
132 fn incremental_reparse(&self, indel: &Indel) -> Option<Parse<SourceFile>> {
133 // FIXME: validation errors are not handled here
134 parsing::incremental_reparse(self.tree().syntax(), indel, self.errors.to_vec()).map(
135 |(green_node, errors, _reparsed_range)| Parse {
136 green: green_node,
137 errors: Arc::new(errors),
138 _ty: PhantomData,
139 },
140 )
141 }
142
143 fn full_reparse(&self, indel: &Indel) -> Parse<SourceFile> {
144 let mut text = self.tree().syntax().text().to_string();
145 indel.apply(&mut text);
146 SourceFile::parse(&text)
147 }
148}
149
150/// `SourceFile` represents a parse tree for a single Rust file.
151pub use crate::ast::SourceFile;
152
153impl SourceFile {
154 pub fn parse(text: &str) -> Parse<SourceFile> {
155 let (green, mut errors) = parsing::parse_text(text);
156 let root = SyntaxNode::new_root(green.clone());
157
158 if cfg!(debug_assertions) {
159 validation::validate_block_structure(&root);
160 }
161
162 errors.extend(validation::validate(&root));
163
164 assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
165 Parse { green, errors: Arc::new(errors), _ty: PhantomData }
166 }
167}
168
169impl ast::Path {
170 /// Returns `text`, parsed as a path, but only if it has no errors.
171 pub fn parse(text: &str) -> Result<Self, ()> {
172 parsing::parse_text_fragment(text, parser::FragmentKind::Path)
173 }
174}
175
176impl ast::Pat {
177 /// Returns `text`, parsed as a pattern, but only if it has no errors.
178 pub fn parse(text: &str) -> Result<Self, ()> {
179 parsing::parse_text_fragment(text, parser::FragmentKind::Pattern)
180 }
181}
182
183impl ast::Expr {
184 /// Returns `text`, parsed as an expression, but only if it has no errors.
185 pub fn parse(text: &str) -> Result<Self, ()> {
186 parsing::parse_text_fragment(text, parser::FragmentKind::Expr)
187 }
188}
189
190impl ast::Item {
191 /// Returns `text`, parsed as an item, but only if it has no errors.
192 pub fn parse(text: &str) -> Result<Self, ()> {
193 parsing::parse_text_fragment(text, parser::FragmentKind::Item)
194 }
195}
196
197impl ast::Type {
198 /// Returns `text`, parsed as an type reference, but only if it has no errors.
199 pub fn parse(text: &str) -> Result<Self, ()> {
200 parsing::parse_text_fragment(text, parser::FragmentKind::Type)
201 }
202}
203
204/// Matches a `SyntaxNode` against an `ast` type.
205///
206/// # Example:
207///
208/// ```ignore
209/// match_ast! {
210/// match node {
211/// ast::CallExpr(it) => { ... },
212/// ast::MethodCallExpr(it) => { ... },
213/// ast::MacroCall(it) => { ... },
214/// _ => None,
215/// }
216/// }
217/// ```
218#[macro_export]
219macro_rules! match_ast {
220 (match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) };
221
222 (match ($node:expr) {
223 $( ast::$ast:ident($it:ident) => $res:expr, )*
224 _ => $catch_all:expr $(,)?
225 }) => {{
226 $( if let Some($it) = ast::$ast::cast($node.clone()) { $res } else )*
227 { $catch_all }
228 }};
229}
230
231/// This test does not assert anything and instead just shows off the crate's
232/// API.
233#[test]
234fn api_walkthrough() {
235 use ast::{ModuleItemOwner, NameOwner};
236
237 let source_code = "
238 fn foo() {
239 1 + 1
240 }
241 ";
242 // `SourceFile` is the main entry point.
243 //
244 // The `parse` method returns a `Parse` -- a pair of syntax tree and a list
245 // of errors. That is, syntax tree is constructed even in presence of errors.
246 let parse = SourceFile::parse(source_code);
247 assert!(parse.errors().is_empty());
248
249 // The `tree` method returns an owned syntax node of type `SourceFile`.
250 // Owned nodes are cheap: inside, they are `Rc` handles to the underling data.
251 let file: SourceFile = parse.tree();
252
253 // `SourceFile` is the root of the syntax tree. We can iterate file's items.
254 // Let's fetch the `foo` function.
255 let mut func = None;
256 for item in file.items() {
257 match item {
258 ast::Item::Fn(f) => func = Some(f),
259 _ => unreachable!(),
260 }
261 }
262 let func: ast::Fn = func.unwrap();
263
264 // Each AST node has a bunch of getters for children. All getters return
265 // `Option`s though, to account for incomplete code. Some getters are common
266 // for several kinds of node. In this case, a trait like `ast::NameOwner`
267 // usually exists. By convention, all ast types should be used with `ast::`
268 // qualifier.
269 let name: Option<ast::Name> = func.name();
270 let name = name.unwrap();
271 assert_eq!(name.text(), "foo");
272
273 // Let's get the `1 + 1` expression!
274 let body: ast::BlockExpr = func.body().unwrap();
275 let expr: ast::Expr = body.expr().unwrap();
276
277 // Enums are used to group related ast nodes together, and can be used for
278 // matching. However, because there are no public fields, it's possible to
279 // match only the top level enum: that is the price we pay for increased API
280 // flexibility
281 let bin_expr: &ast::BinExpr = match &expr {
282 ast::Expr::BinExpr(e) => e,
283 _ => unreachable!(),
284 };
285
286 // Besides the "typed" AST API, there's an untyped CST one as well.
287 // To switch from AST to CST, call `.syntax()` method:
288 let expr_syntax: &SyntaxNode = expr.syntax();
289
290 // Note how `expr` and `bin_expr` are in fact the same node underneath:
291 assert!(expr_syntax == bin_expr.syntax());
292
293 // To go from CST to AST, `AstNode::cast` function is used:
294 let _expr: ast::Expr = match ast::Expr::cast(expr_syntax.clone()) {
295 Some(e) => e,
296 None => unreachable!(),
297 };
298
299 // The two properties each syntax node has is a `SyntaxKind`:
300 assert_eq!(expr_syntax.kind(), SyntaxKind::BIN_EXPR);
301
302 // And text range:
303 assert_eq!(expr_syntax.text_range(), TextRange::new(32.into(), 37.into()));
304
305 // You can get node's text as a `SyntaxText` object, which will traverse the
306 // tree collecting token's text:
307 let text: SyntaxText = expr_syntax.text();
308 assert_eq!(text.to_string(), "1 + 1");
309
310 // There's a bunch of traversal methods on `SyntaxNode`:
311 assert_eq!(expr_syntax.parent().as_ref(), Some(body.syntax()));
312 assert_eq!(body.syntax().first_child_or_token().map(|it| it.kind()), Some(T!['{']));
313 assert_eq!(
314 expr_syntax.next_sibling_or_token().map(|it| it.kind()),
315 Some(SyntaxKind::WHITESPACE)
316 );
317
318 // As well as some iterator helpers:
319 let f = expr_syntax.ancestors().find_map(ast::Fn::cast);
320 assert_eq!(f, Some(func));
321 assert!(expr_syntax.siblings_with_tokens(Direction::Next).any(|it| it.kind() == T!['}']));
322 assert_eq!(
323 expr_syntax.descendants_with_tokens().count(),
324 8, // 5 tokens `1`, ` `, `+`, ` `, `!`
325 // 2 child literal expressions: `1`, `1`
326 // 1 the node itself: `1 + 1`
327 );
328
329 // There's also a `preorder` method with a more fine-grained iteration control:
330 let mut buf = String::new();
331 let mut indent = 0;
332 for event in expr_syntax.preorder_with_tokens() {
333 match event {
334 WalkEvent::Enter(node) => {
335 let text = match &node {
336 NodeOrToken::Node(it) => it.text().to_string(),
337 NodeOrToken::Token(it) => it.text().to_string(),
338 };
339 format_to!(buf, "{:indent$}{:?} {:?}\n", " ", text, node.kind(), indent = indent);
340 indent += 2;
341 }
342 WalkEvent::Leave(_) => indent -= 2,
343 }
344 }
345 assert_eq!(indent, 0);
346 assert_eq!(
347 buf.trim(),
348 r#"
349"1 + 1" BIN_EXPR
350 "1" LITERAL
351 "1" INT_NUMBER
352 " " WHITESPACE
353 "+" PLUS
354 " " WHITESPACE
355 "1" LITERAL
356 "1" INT_NUMBER
357"#
358 .trim()
359 );
360
361 // To recursively process the tree, there are three approaches:
362 // 1. explicitly call getter methods on AST nodes.
363 // 2. use descendants and `AstNode::cast`.
364 // 3. use descendants and `match_ast!`.
365 //
366 // Here's how the first one looks like:
367 let exprs_cast: Vec<String> = file
368 .syntax()
369 .descendants()
370 .filter_map(ast::Expr::cast)
371 .map(|expr| expr.syntax().text().to_string())
372 .collect();
373
374 // An alternative is to use a macro.
375 let mut exprs_visit = Vec::new();
376 for node in file.syntax().descendants() {
377 match_ast! {
378 match node {
379 ast::Expr(it) => {
380 let res = it.syntax().text().to_string();
381 exprs_visit.push(res);
382 },
383 _ => (),
384 }
385 }
386 }
387 assert_eq!(exprs_cast, exprs_visit);
388}
diff --git a/crates/syntax/src/parsing.rs b/crates/syntax/src/parsing.rs
new file mode 100644
index 000000000..68a39eb21
--- /dev/null
+++ b/crates/syntax/src/parsing.rs
@@ -0,0 +1,59 @@
1//! Lexing, bridging to parser (which does the actual parsing) and
2//! incremental reparsing.
3
4mod lexer;
5mod text_token_source;
6mod text_tree_sink;
7mod reparsing;
8
9use crate::{syntax_node::GreenNode, AstNode, SyntaxError, SyntaxNode};
10use text_token_source::TextTokenSource;
11use text_tree_sink::TextTreeSink;
12
13pub use lexer::*;
14
15pub(crate) use self::reparsing::incremental_reparse;
16use parser::SyntaxKind;
17
18pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) {
19 let (tokens, lexer_errors) = tokenize(&text);
20
21 let mut token_source = TextTokenSource::new(text, &tokens);
22 let mut tree_sink = TextTreeSink::new(text, &tokens);
23
24 parser::parse(&mut token_source, &mut tree_sink);
25
26 let (tree, mut parser_errors) = tree_sink.finish();
27 parser_errors.extend(lexer_errors);
28
29 (tree, parser_errors)
30}
31
32/// Returns `text` parsed as a `T` provided there are no parse errors.
33pub(crate) fn parse_text_fragment<T: AstNode>(
34 text: &str,
35 fragment_kind: parser::FragmentKind,
36) -> Result<T, ()> {
37 let (tokens, lexer_errors) = tokenize(&text);
38 if !lexer_errors.is_empty() {
39 return Err(());
40 }
41
42 let mut token_source = TextTokenSource::new(text, &tokens);
43 let mut tree_sink = TextTreeSink::new(text, &tokens);
44
45 // TextTreeSink assumes that there's at least some root node to which it can attach errors and
46 // tokens. We arbitrarily give it a SourceFile.
47 use parser::TreeSink;
48 tree_sink.start_node(SyntaxKind::SOURCE_FILE);
49 parser::parse_fragment(&mut token_source, &mut tree_sink, fragment_kind);
50 tree_sink.finish_node();
51
52 let (tree, parser_errors) = tree_sink.finish();
53 use parser::TokenSource;
54 if !parser_errors.is_empty() || token_source.current().kind != SyntaxKind::EOF {
55 return Err(());
56 }
57
58 SyntaxNode::new_root(tree).first_child().and_then(T::cast).ok_or(())
59}
diff --git a/crates/syntax/src/parsing/lexer.rs b/crates/syntax/src/parsing/lexer.rs
new file mode 100644
index 000000000..fa3be1016
--- /dev/null
+++ b/crates/syntax/src/parsing/lexer.rs
@@ -0,0 +1,244 @@
1//! Lexer analyzes raw input string and produces lexemes (tokens).
2//! It is just a bridge to `rustc_lexer`.
3
4use rustc_lexer::{LiteralKind as LK, RawStrError};
5
6use std::convert::TryInto;
7
8use crate::{
9 SyntaxError,
10 SyntaxKind::{self, *},
11 TextRange, TextSize, T,
12};
13
14/// A token of Rust source.
15#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
16pub struct Token {
17 /// The kind of token.
18 pub kind: SyntaxKind,
19 /// The length of the token.
20 pub len: TextSize,
21}
22
23/// Break a string up into its component tokens.
24/// Beware that it checks for shebang first and its length contributes to resulting
25/// tokens offsets.
26pub fn tokenize(text: &str) -> (Vec<Token>, Vec<SyntaxError>) {
27 // non-empty string is a precondtion of `rustc_lexer::strip_shebang()`.
28 if text.is_empty() {
29 return Default::default();
30 }
31
32 let mut tokens = Vec::new();
33 let mut errors = Vec::new();
34
35 let mut offset = match rustc_lexer::strip_shebang(text) {
36 Some(shebang_len) => {
37 tokens.push(Token { kind: SHEBANG, len: shebang_len.try_into().unwrap() });
38 shebang_len
39 }
40 None => 0,
41 };
42
43 let text_without_shebang = &text[offset..];
44
45 for rustc_token in rustc_lexer::tokenize(text_without_shebang) {
46 let token_len: TextSize = rustc_token.len.try_into().unwrap();
47 let token_range = TextRange::at(offset.try_into().unwrap(), token_len);
48
49 let (syntax_kind, err_message) =
50 rustc_token_kind_to_syntax_kind(&rustc_token.kind, &text[token_range]);
51
52 tokens.push(Token { kind: syntax_kind, len: token_len });
53
54 if let Some(err_message) = err_message {
55 errors.push(SyntaxError::new(err_message, token_range));
56 }
57
58 offset += rustc_token.len;
59 }
60
61 (tokens, errors)
62}
63
64/// Returns `SyntaxKind` and `Option<SyntaxError>` of the first token
65/// encountered at the beginning of the string.
66///
67/// Returns `None` if the string contains zero *or two or more* tokens.
68/// The token is malformed if the returned error is not `None`.
69///
70/// Beware that unescape errors are not checked at tokenization time.
71pub fn lex_single_syntax_kind(text: &str) -> Option<(SyntaxKind, Option<SyntaxError>)> {
72 lex_first_token(text)
73 .filter(|(token, _)| token.len == TextSize::of(text))
74 .map(|(token, error)| (token.kind, error))
75}
76
77/// The same as `lex_single_syntax_kind()` but returns only `SyntaxKind` and
78/// returns `None` if any tokenization error occured.
79///
80/// Beware that unescape errors are not checked at tokenization time.
81pub fn lex_single_valid_syntax_kind(text: &str) -> Option<SyntaxKind> {
82 lex_first_token(text)
83 .filter(|(token, error)| !error.is_some() && token.len == TextSize::of(text))
84 .map(|(token, _error)| token.kind)
85}
86
87/// Returns `SyntaxKind` and `Option<SyntaxError>` of the first token
88/// encountered at the beginning of the string.
89///
90/// Returns `None` if the string contains zero tokens or if the token was parsed
91/// with an error.
92/// The token is malformed if the returned error is not `None`.
93///
94/// Beware that unescape errors are not checked at tokenization time.
95fn lex_first_token(text: &str) -> Option<(Token, Option<SyntaxError>)> {
96 // non-empty string is a precondtion of `rustc_lexer::first_token()`.
97 if text.is_empty() {
98 return None;
99 }
100
101 let rustc_token = rustc_lexer::first_token(text);
102 let (syntax_kind, err_message) = rustc_token_kind_to_syntax_kind(&rustc_token.kind, text);
103
104 let token = Token { kind: syntax_kind, len: rustc_token.len.try_into().unwrap() };
105 let optional_error = err_message
106 .map(|err_message| SyntaxError::new(err_message, TextRange::up_to(TextSize::of(text))));
107
108 Some((token, optional_error))
109}
110
111/// Returns `SyntaxKind` and an optional tokenize error message.
112fn rustc_token_kind_to_syntax_kind(
113 rustc_token_kind: &rustc_lexer::TokenKind,
114 token_text: &str,
115) -> (SyntaxKind, Option<&'static str>) {
116 // A note on an intended tradeoff:
117 // We drop some useful infromation here (see patterns with double dots `..`)
118 // Storing that info in `SyntaxKind` is not possible due to its layout requirements of
119 // being `u16` that come from `rowan::SyntaxKind`.
120
121 let syntax_kind = {
122 match rustc_token_kind {
123 rustc_lexer::TokenKind::LineComment => COMMENT,
124
125 rustc_lexer::TokenKind::BlockComment { terminated: true } => COMMENT,
126 rustc_lexer::TokenKind::BlockComment { terminated: false } => {
127 return (
128 COMMENT,
129 Some("Missing trailing `*/` symbols to terminate the block comment"),
130 );
131 }
132
133 rustc_lexer::TokenKind::Whitespace => WHITESPACE,
134
135 rustc_lexer::TokenKind::Ident => {
136 if token_text == "_" {
137 UNDERSCORE
138 } else {
139 SyntaxKind::from_keyword(token_text).unwrap_or(IDENT)
140 }
141 }
142
143 rustc_lexer::TokenKind::RawIdent => IDENT,
144 rustc_lexer::TokenKind::Literal { kind, .. } => return match_literal_kind(&kind),
145
146 rustc_lexer::TokenKind::Lifetime { starts_with_number: false } => LIFETIME,
147 rustc_lexer::TokenKind::Lifetime { starts_with_number: true } => {
148 return (LIFETIME, Some("Lifetime name cannot start with a number"))
149 }
150
151 rustc_lexer::TokenKind::Semi => T![;],
152 rustc_lexer::TokenKind::Comma => T![,],
153 rustc_lexer::TokenKind::Dot => T![.],
154 rustc_lexer::TokenKind::OpenParen => T!['('],
155 rustc_lexer::TokenKind::CloseParen => T![')'],
156 rustc_lexer::TokenKind::OpenBrace => T!['{'],
157 rustc_lexer::TokenKind::CloseBrace => T!['}'],
158 rustc_lexer::TokenKind::OpenBracket => T!['['],
159 rustc_lexer::TokenKind::CloseBracket => T![']'],
160 rustc_lexer::TokenKind::At => T![@],
161 rustc_lexer::TokenKind::Pound => T![#],
162 rustc_lexer::TokenKind::Tilde => T![~],
163 rustc_lexer::TokenKind::Question => T![?],
164 rustc_lexer::TokenKind::Colon => T![:],
165 rustc_lexer::TokenKind::Dollar => T![$],
166 rustc_lexer::TokenKind::Eq => T![=],
167 rustc_lexer::TokenKind::Not => T![!],
168 rustc_lexer::TokenKind::Lt => T![<],
169 rustc_lexer::TokenKind::Gt => T![>],
170 rustc_lexer::TokenKind::Minus => T![-],
171 rustc_lexer::TokenKind::And => T![&],
172 rustc_lexer::TokenKind::Or => T![|],
173 rustc_lexer::TokenKind::Plus => T![+],
174 rustc_lexer::TokenKind::Star => T![*],
175 rustc_lexer::TokenKind::Slash => T![/],
176 rustc_lexer::TokenKind::Caret => T![^],
177 rustc_lexer::TokenKind::Percent => T![%],
178 rustc_lexer::TokenKind::Unknown => ERROR,
179 }
180 };
181
182 return (syntax_kind, None);
183
184 fn match_literal_kind(kind: &rustc_lexer::LiteralKind) -> (SyntaxKind, Option<&'static str>) {
185 #[rustfmt::skip]
186 let syntax_kind = match *kind {
187 LK::Int { empty_int: false, .. } => INT_NUMBER,
188 LK::Int { empty_int: true, .. } => {
189 return (INT_NUMBER, Some("Missing digits after the integer base prefix"))
190 }
191
192 LK::Float { empty_exponent: false, .. } => FLOAT_NUMBER,
193 LK::Float { empty_exponent: true, .. } => {
194 return (FLOAT_NUMBER, Some("Missing digits after the exponent symbol"))
195 }
196
197 LK::Char { terminated: true } => CHAR,
198 LK::Char { terminated: false } => {
199 return (CHAR, Some("Missing trailing `'` symbol to terminate the character literal"))
200 }
201
202 LK::Byte { terminated: true } => BYTE,
203 LK::Byte { terminated: false } => {
204 return (BYTE, Some("Missing trailing `'` symbol to terminate the byte literal"))
205 }
206
207 LK::Str { terminated: true } => STRING,
208 LK::Str { terminated: false } => {
209 return (STRING, Some("Missing trailing `\"` symbol to terminate the string literal"))
210 }
211
212
213 LK::ByteStr { terminated: true } => BYTE_STRING,
214 LK::ByteStr { terminated: false } => {
215 return (BYTE_STRING, Some("Missing trailing `\"` symbol to terminate the byte string literal"))
216 }
217
218 LK::RawStr { err, .. } => match err {
219 None => RAW_STRING,
220 Some(RawStrError::InvalidStarter { .. }) => return (RAW_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw string literal")),
221 Some(RawStrError::NoTerminator { expected, found, .. }) => if expected == found {
222 return (RAW_STRING, Some("Missing trailing `\"` to terminate the raw string literal"))
223 } else {
224 return (RAW_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw string literal"))
225
226 },
227 Some(RawStrError::TooManyDelimiters { .. }) => return (RAW_STRING, Some("Too many `#` symbols: raw strings may be delimited by up to 65535 `#` symbols")),
228 },
229 LK::RawByteStr { err, .. } => match err {
230 None => RAW_BYTE_STRING,
231 Some(RawStrError::InvalidStarter { .. }) => return (RAW_BYTE_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw byte string literal")),
232 Some(RawStrError::NoTerminator { expected, found, .. }) => if expected == found {
233 return (RAW_BYTE_STRING, Some("Missing trailing `\"` to terminate the raw byte string literal"))
234 } else {
235 return (RAW_BYTE_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw byte string literal"))
236
237 },
238 Some(RawStrError::TooManyDelimiters { .. }) => return (RAW_BYTE_STRING, Some("Too many `#` symbols: raw byte strings may be delimited by up to 65535 `#` symbols")),
239 },
240 };
241
242 (syntax_kind, None)
243 }
244}
diff --git a/crates/syntax/src/parsing/reparsing.rs b/crates/syntax/src/parsing/reparsing.rs
new file mode 100644
index 000000000..4149f856a
--- /dev/null
+++ b/crates/syntax/src/parsing/reparsing.rs
@@ -0,0 +1,455 @@
1//! Implementation of incremental re-parsing.
2//!
3//! We use two simple strategies for this:
4//! - if the edit modifies only a single token (like changing an identifier's
5//! letter), we replace only this token.
6//! - otherwise, we search for the nearest `{}` block which contains the edit
7//! and try to parse only this block.
8
9use parser::Reparser;
10use text_edit::Indel;
11
12use crate::{
13 algo,
14 parsing::{
15 lexer::{lex_single_syntax_kind, tokenize, Token},
16 text_token_source::TextTokenSource,
17 text_tree_sink::TextTreeSink,
18 },
19 syntax_node::{GreenNode, GreenToken, NodeOrToken, SyntaxElement, SyntaxNode},
20 SyntaxError,
21 SyntaxKind::*,
22 TextRange, TextSize, T,
23};
24
25pub(crate) fn incremental_reparse(
26 node: &SyntaxNode,
27 edit: &Indel,
28 errors: Vec<SyntaxError>,
29) -> Option<(GreenNode, Vec<SyntaxError>, TextRange)> {
30 if let Some((green, new_errors, old_range)) = reparse_token(node, &edit) {
31 return Some((green, merge_errors(errors, new_errors, old_range, edit), old_range));
32 }
33
34 if let Some((green, new_errors, old_range)) = reparse_block(node, &edit) {
35 return Some((green, merge_errors(errors, new_errors, old_range, edit), old_range));
36 }
37 None
38}
39
40fn reparse_token<'node>(
41 root: &'node SyntaxNode,
42 edit: &Indel,
43) -> Option<(GreenNode, Vec<SyntaxError>, TextRange)> {
44 let prev_token = algo::find_covering_element(root, edit.delete).as_token()?.clone();
45 let prev_token_kind = prev_token.kind();
46 match prev_token_kind {
47 WHITESPACE | COMMENT | IDENT | STRING | RAW_STRING => {
48 if prev_token_kind == WHITESPACE || prev_token_kind == COMMENT {
49 // removing a new line may extends previous token
50 let deleted_range = edit.delete - prev_token.text_range().start();
51 if prev_token.text()[deleted_range].contains('\n') {
52 return None;
53 }
54 }
55
56 let mut new_text = get_text_after_edit(prev_token.clone().into(), &edit);
57 let (new_token_kind, new_err) = lex_single_syntax_kind(&new_text)?;
58
59 if new_token_kind != prev_token_kind
60 || (new_token_kind == IDENT && is_contextual_kw(&new_text))
61 {
62 return None;
63 }
64
65 // Check that edited token is not a part of the bigger token.
66 // E.g. if for source code `bruh"str"` the user removed `ruh`, then
67 // `b` no longer remains an identifier, but becomes a part of byte string literal
68 if let Some(next_char) = root.text().char_at(prev_token.text_range().end()) {
69 new_text.push(next_char);
70 let token_with_next_char = lex_single_syntax_kind(&new_text);
71 if let Some((_kind, _error)) = token_with_next_char {
72 return None;
73 }
74 new_text.pop();
75 }
76
77 let new_token =
78 GreenToken::new(rowan::SyntaxKind(prev_token_kind.into()), new_text.into());
79 Some((
80 prev_token.replace_with(new_token),
81 new_err.into_iter().collect(),
82 prev_token.text_range(),
83 ))
84 }
85 _ => None,
86 }
87}
88
89fn reparse_block<'node>(
90 root: &'node SyntaxNode,
91 edit: &Indel,
92) -> Option<(GreenNode, Vec<SyntaxError>, TextRange)> {
93 let (node, reparser) = find_reparsable_node(root, edit.delete)?;
94 let text = get_text_after_edit(node.clone().into(), edit);
95
96 let (tokens, new_lexer_errors) = tokenize(&text);
97 if !is_balanced(&tokens) {
98 return None;
99 }
100
101 let mut token_source = TextTokenSource::new(&text, &tokens);
102 let mut tree_sink = TextTreeSink::new(&text, &tokens);
103 reparser.parse(&mut token_source, &mut tree_sink);
104
105 let (green, mut new_parser_errors) = tree_sink.finish();
106 new_parser_errors.extend(new_lexer_errors);
107
108 Some((node.replace_with(green), new_parser_errors, node.text_range()))
109}
110
111fn get_text_after_edit(element: SyntaxElement, edit: &Indel) -> String {
112 let edit = Indel::replace(edit.delete - element.text_range().start(), edit.insert.clone());
113
114 let mut text = match element {
115 NodeOrToken::Token(token) => token.text().to_string(),
116 NodeOrToken::Node(node) => node.text().to_string(),
117 };
118 edit.apply(&mut text);
119 text
120}
121
122fn is_contextual_kw(text: &str) -> bool {
123 matches!(text, "auto" | "default" | "union")
124}
125
126fn find_reparsable_node(node: &SyntaxNode, range: TextRange) -> Option<(SyntaxNode, Reparser)> {
127 let node = algo::find_covering_element(node, range);
128
129 let mut ancestors = match node {
130 NodeOrToken::Token(it) => it.parent().ancestors(),
131 NodeOrToken::Node(it) => it.ancestors(),
132 };
133 ancestors.find_map(|node| {
134 let first_child = node.first_child_or_token().map(|it| it.kind());
135 let parent = node.parent().map(|it| it.kind());
136 Reparser::for_node(node.kind(), first_child, parent).map(|r| (node, r))
137 })
138}
139
140fn is_balanced(tokens: &[Token]) -> bool {
141 if tokens.is_empty()
142 || tokens.first().unwrap().kind != T!['{']
143 || tokens.last().unwrap().kind != T!['}']
144 {
145 return false;
146 }
147 let mut balance = 0usize;
148 for t in &tokens[1..tokens.len() - 1] {
149 match t.kind {
150 T!['{'] => balance += 1,
151 T!['}'] => {
152 balance = match balance.checked_sub(1) {
153 Some(b) => b,
154 None => return false,
155 }
156 }
157 _ => (),
158 }
159 }
160 balance == 0
161}
162
163fn merge_errors(
164 old_errors: Vec<SyntaxError>,
165 new_errors: Vec<SyntaxError>,
166 range_before_reparse: TextRange,
167 edit: &Indel,
168) -> Vec<SyntaxError> {
169 let mut res = Vec::new();
170
171 for old_err in old_errors {
172 let old_err_range = old_err.range();
173 if old_err_range.end() <= range_before_reparse.start() {
174 res.push(old_err);
175 } else if old_err_range.start() >= range_before_reparse.end() {
176 let inserted_len = TextSize::of(&edit.insert);
177 res.push(old_err.with_range((old_err_range + inserted_len) - edit.delete.len()));
178 // Note: extra parens are intentional to prevent uint underflow, HWAB (here was a bug)
179 }
180 }
181 res.extend(new_errors.into_iter().map(|new_err| {
182 // fighting borrow checker with a variable ;)
183 let offseted_range = new_err.range() + range_before_reparse.start();
184 new_err.with_range(offseted_range)
185 }));
186 res
187}
188
189#[cfg(test)]
190mod tests {
191 use test_utils::{assert_eq_text, extract_range};
192
193 use super::*;
194 use crate::{AstNode, Parse, SourceFile};
195
196 fn do_check(before: &str, replace_with: &str, reparsed_len: u32) {
197 let (range, before) = extract_range(before);
198 let edit = Indel::replace(range, replace_with.to_owned());
199 let after = {
200 let mut after = before.clone();
201 edit.apply(&mut after);
202 after
203 };
204
205 let fully_reparsed = SourceFile::parse(&after);
206 let incrementally_reparsed: Parse<SourceFile> = {
207 let before = SourceFile::parse(&before);
208 let (green, new_errors, range) =
209 incremental_reparse(before.tree().syntax(), &edit, before.errors.to_vec()).unwrap();
210 assert_eq!(range.len(), reparsed_len.into(), "reparsed fragment has wrong length");
211 Parse::new(green, new_errors)
212 };
213
214 assert_eq_text!(
215 &format!("{:#?}", fully_reparsed.tree().syntax()),
216 &format!("{:#?}", incrementally_reparsed.tree().syntax()),
217 );
218 assert_eq!(fully_reparsed.errors(), incrementally_reparsed.errors());
219 }
220
221 #[test] // FIXME: some test here actually test token reparsing
222 fn reparse_block_tests() {
223 do_check(
224 r"
225fn foo() {
226 let x = foo + <|>bar<|>
227}
228",
229 "baz",
230 3,
231 );
232 do_check(
233 r"
234fn foo() {
235 let x = foo<|> + bar<|>
236}
237",
238 "baz",
239 25,
240 );
241 do_check(
242 r"
243struct Foo {
244 f: foo<|><|>
245}
246",
247 ",\n g: (),",
248 14,
249 );
250 do_check(
251 r"
252fn foo {
253 let;
254 1 + 1;
255 <|>92<|>;
256}
257",
258 "62",
259 31, // FIXME: reparse only int literal here
260 );
261 do_check(
262 r"
263mod foo {
264 fn <|><|>
265}
266",
267 "bar",
268 11,
269 );
270
271 do_check(
272 r"
273trait Foo {
274 type <|>Foo<|>;
275}
276",
277 "Output",
278 3,
279 );
280 do_check(
281 r"
282impl IntoIterator<Item=i32> for Foo {
283 f<|><|>
284}
285",
286 "n next(",
287 9,
288 );
289 do_check(r"use a::b::{foo,<|>,bar<|>};", "baz", 10);
290 do_check(
291 r"
292pub enum A {
293 Foo<|><|>
294}
295",
296 "\nBar;\n",
297 11,
298 );
299 do_check(
300 r"
301foo!{a, b<|><|> d}
302",
303 ", c[3]",
304 8,
305 );
306 do_check(
307 r"
308fn foo() {
309 vec![<|><|>]
310}
311",
312 "123",
313 14,
314 );
315 do_check(
316 r"
317extern {
318 fn<|>;<|>
319}
320",
321 " exit(code: c_int)",
322 11,
323 );
324 }
325
326 #[test]
327 fn reparse_token_tests() {
328 do_check(
329 r"<|><|>
330fn foo() -> i32 { 1 }
331",
332 "\n\n\n \n",
333 1,
334 );
335 do_check(
336 r"
337fn foo() -> <|><|> {}
338",
339 " \n",
340 2,
341 );
342 do_check(
343 r"
344fn <|>foo<|>() -> i32 { 1 }
345",
346 "bar",
347 3,
348 );
349 do_check(
350 r"
351fn foo<|><|>foo() { }
352",
353 "bar",
354 6,
355 );
356 do_check(
357 r"
358fn foo /* <|><|> */ () {}
359",
360 "some comment",
361 6,
362 );
363 do_check(
364 r"
365fn baz <|><|> () {}
366",
367 " \t\t\n\n",
368 2,
369 );
370 do_check(
371 r"
372fn baz <|><|> () {}
373",
374 " \t\t\n\n",
375 2,
376 );
377 do_check(
378 r"
379/// foo <|><|>omment
380mod { }
381",
382 "c",
383 14,
384 );
385 do_check(
386 r#"
387fn -> &str { "Hello<|><|>" }
388"#,
389 ", world",
390 7,
391 );
392 do_check(
393 r#"
394fn -> &str { // "Hello<|><|>"
395"#,
396 ", world",
397 10,
398 );
399 do_check(
400 r##"
401fn -> &str { r#"Hello<|><|>"#
402"##,
403 ", world",
404 10,
405 );
406 do_check(
407 r"
408#[derive(<|>Copy<|>)]
409enum Foo {
410
411}
412",
413 "Clone",
414 4,
415 );
416 }
417
418 #[test]
419 fn reparse_str_token_with_error_unchanged() {
420 do_check(r#""<|>Unclosed<|> string literal"#, "Still unclosed", 24);
421 }
422
423 #[test]
424 fn reparse_str_token_with_error_fixed() {
425 do_check(r#""unterinated<|><|>"#, "\"", 12);
426 }
427
428 #[test]
429 fn reparse_block_with_error_in_middle_unchanged() {
430 do_check(
431 r#"fn main() {
432 if {}
433 32 + 4<|><|>
434 return
435 if {}
436 }"#,
437 "23",
438 105,
439 )
440 }
441
442 #[test]
443 fn reparse_block_with_error_in_middle_fixed() {
444 do_check(
445 r#"fn main() {
446 if {}
447 32 + 4<|><|>
448 return
449 if {}
450 }"#,
451 ";",
452 105,
453 )
454 }
455}
diff --git a/crates/syntax/src/parsing/text_token_source.rs b/crates/syntax/src/parsing/text_token_source.rs
new file mode 100644
index 000000000..df866dc2b
--- /dev/null
+++ b/crates/syntax/src/parsing/text_token_source.rs
@@ -0,0 +1,84 @@
1//! See `TextTokenSource` docs.
2
3use parser::TokenSource;
4
5use crate::{parsing::lexer::Token, SyntaxKind::EOF, TextRange, TextSize};
6
7/// Implementation of `parser::TokenSource` that takes tokens from source code text.
8pub(crate) struct TextTokenSource<'t> {
9 text: &'t str,
10 /// token and its start position (non-whitespace/comment tokens)
11 /// ```non-rust
12 /// struct Foo;
13 /// ^------^--^-
14 /// | | \________
15 /// | \____ \
16 /// | \ |
17 /// (struct, 0) (Foo, 7) (;, 10)
18 /// ```
19 /// `[(struct, 0), (Foo, 7), (;, 10)]`
20 token_offset_pairs: Vec<(Token, TextSize)>,
21
22 /// Current token and position
23 curr: (parser::Token, usize),
24}
25
26impl<'t> TokenSource for TextTokenSource<'t> {
27 fn current(&self) -> parser::Token {
28 self.curr.0
29 }
30
31 fn lookahead_nth(&self, n: usize) -> parser::Token {
32 mk_token(self.curr.1 + n, &self.token_offset_pairs)
33 }
34
35 fn bump(&mut self) {
36 if self.curr.0.kind == EOF {
37 return;
38 }
39
40 let pos = self.curr.1 + 1;
41 self.curr = (mk_token(pos, &self.token_offset_pairs), pos);
42 }
43
44 fn is_keyword(&self, kw: &str) -> bool {
45 self.token_offset_pairs
46 .get(self.curr.1)
47 .map(|(token, offset)| &self.text[TextRange::at(*offset, token.len)] == kw)
48 .unwrap_or(false)
49 }
50}
51
52fn mk_token(pos: usize, token_offset_pairs: &[(Token, TextSize)]) -> parser::Token {
53 let (kind, is_jointed_to_next) = match token_offset_pairs.get(pos) {
54 Some((token, offset)) => (
55 token.kind,
56 token_offset_pairs
57 .get(pos + 1)
58 .map(|(_, next_offset)| offset + token.len == *next_offset)
59 .unwrap_or(false),
60 ),
61 None => (EOF, false),
62 };
63 parser::Token { kind, is_jointed_to_next }
64}
65
66impl<'t> TextTokenSource<'t> {
67 /// Generate input from tokens(expect comment and whitespace).
68 pub fn new(text: &'t str, raw_tokens: &'t [Token]) -> TextTokenSource<'t> {
69 let token_offset_pairs: Vec<_> = raw_tokens
70 .iter()
71 .filter_map({
72 let mut len = 0.into();
73 move |token| {
74 let pair = if token.kind.is_trivia() { None } else { Some((*token, len)) };
75 len += token.len;
76 pair
77 }
78 })
79 .collect();
80
81 let first = mk_token(0, &token_offset_pairs);
82 TextTokenSource { text, token_offset_pairs, curr: (first, 0) }
83 }
84}
diff --git a/crates/syntax/src/parsing/text_tree_sink.rs b/crates/syntax/src/parsing/text_tree_sink.rs
new file mode 100644
index 000000000..c1b5f246d
--- /dev/null
+++ b/crates/syntax/src/parsing/text_tree_sink.rs
@@ -0,0 +1,183 @@
1//! FIXME: write short doc here
2
3use std::mem;
4
5use parser::{ParseError, TreeSink};
6
7use crate::{
8 parsing::Token,
9 syntax_node::GreenNode,
10 SmolStr, SyntaxError,
11 SyntaxKind::{self, *},
12 SyntaxTreeBuilder, TextRange, TextSize,
13};
14
15/// Bridges the parser with our specific syntax tree representation.
16///
17/// `TextTreeSink` also handles attachment of trivia (whitespace) to nodes.
18pub(crate) struct TextTreeSink<'a> {
19 text: &'a str,
20 tokens: &'a [Token],
21 text_pos: TextSize,
22 token_pos: usize,
23 state: State,
24 inner: SyntaxTreeBuilder,
25}
26
27enum State {
28 PendingStart,
29 Normal,
30 PendingFinish,
31}
32
33impl<'a> TreeSink for TextTreeSink<'a> {
34 fn token(&mut self, kind: SyntaxKind, n_tokens: u8) {
35 match mem::replace(&mut self.state, State::Normal) {
36 State::PendingStart => unreachable!(),
37 State::PendingFinish => self.inner.finish_node(),
38 State::Normal => (),
39 }
40 self.eat_trivias();
41 let n_tokens = n_tokens as usize;
42 let len = self.tokens[self.token_pos..self.token_pos + n_tokens]
43 .iter()
44 .map(|it| it.len)
45 .sum::<TextSize>();
46 self.do_token(kind, len, n_tokens);
47 }
48
49 fn start_node(&mut self, kind: SyntaxKind) {
50 match mem::replace(&mut self.state, State::Normal) {
51 State::PendingStart => {
52 self.inner.start_node(kind);
53 // No need to attach trivias to previous node: there is no
54 // previous node.
55 return;
56 }
57 State::PendingFinish => self.inner.finish_node(),
58 State::Normal => (),
59 }
60
61 let n_trivias =
62 self.tokens[self.token_pos..].iter().take_while(|it| it.kind.is_trivia()).count();
63 let leading_trivias = &self.tokens[self.token_pos..self.token_pos + n_trivias];
64 let mut trivia_end =
65 self.text_pos + leading_trivias.iter().map(|it| it.len).sum::<TextSize>();
66
67 let n_attached_trivias = {
68 let leading_trivias = leading_trivias.iter().rev().map(|it| {
69 let next_end = trivia_end - it.len;
70 let range = TextRange::new(next_end, trivia_end);
71 trivia_end = next_end;
72 (it.kind, &self.text[range])
73 });
74 n_attached_trivias(kind, leading_trivias)
75 };
76 self.eat_n_trivias(n_trivias - n_attached_trivias);
77 self.inner.start_node(kind);
78 self.eat_n_trivias(n_attached_trivias);
79 }
80
81 fn finish_node(&mut self) {
82 match mem::replace(&mut self.state, State::PendingFinish) {
83 State::PendingStart => unreachable!(),
84 State::PendingFinish => self.inner.finish_node(),
85 State::Normal => (),
86 }
87 }
88
89 fn error(&mut self, error: ParseError) {
90 self.inner.error(error, self.text_pos)
91 }
92}
93
94impl<'a> TextTreeSink<'a> {
95 pub(super) fn new(text: &'a str, tokens: &'a [Token]) -> Self {
96 Self {
97 text,
98 tokens,
99 text_pos: 0.into(),
100 token_pos: 0,
101 state: State::PendingStart,
102 inner: SyntaxTreeBuilder::default(),
103 }
104 }
105
106 pub(super) fn finish(mut self) -> (GreenNode, Vec<SyntaxError>) {
107 match mem::replace(&mut self.state, State::Normal) {
108 State::PendingFinish => {
109 self.eat_trivias();
110 self.inner.finish_node()
111 }
112 State::PendingStart | State::Normal => unreachable!(),
113 }
114
115 self.inner.finish_raw()
116 }
117
118 fn eat_trivias(&mut self) {
119 while let Some(&token) = self.tokens.get(self.token_pos) {
120 if !token.kind.is_trivia() {
121 break;
122 }
123 self.do_token(token.kind, token.len, 1);
124 }
125 }
126
127 fn eat_n_trivias(&mut self, n: usize) {
128 for _ in 0..n {
129 let token = self.tokens[self.token_pos];
130 assert!(token.kind.is_trivia());
131 self.do_token(token.kind, token.len, 1);
132 }
133 }
134
135 fn do_token(&mut self, kind: SyntaxKind, len: TextSize, n_tokens: usize) {
136 let range = TextRange::at(self.text_pos, len);
137 let text: SmolStr = self.text[range].into();
138 self.text_pos += len;
139 self.token_pos += n_tokens;
140 self.inner.token(kind, text);
141 }
142}
143
144fn n_attached_trivias<'a>(
145 kind: SyntaxKind,
146 trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
147) -> usize {
148 match kind {
149 MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT | MODULE
150 | RECORD_FIELD | STATIC => {
151 let mut res = 0;
152 let mut trivias = trivias.enumerate().peekable();
153
154 while let Some((i, (kind, text))) = trivias.next() {
155 match kind {
156 WHITESPACE => {
157 if text.contains("\n\n") {
158 // we check whether the next token is a doc-comment
159 // and skip the whitespace in this case
160 if let Some((peek_kind, peek_text)) =
161 trivias.peek().map(|(_, pair)| pair)
162 {
163 if *peek_kind == COMMENT
164 && peek_text.starts_with("///")
165 && !peek_text.starts_with("////")
166 {
167 continue;
168 }
169 }
170 break;
171 }
172 }
173 COMMENT => {
174 res = i + 1;
175 }
176 _ => (),
177 }
178 }
179 res
180 }
181 _ => 0,
182 }
183}
diff --git a/crates/syntax/src/ptr.rs b/crates/syntax/src/ptr.rs
new file mode 100644
index 000000000..ca7957747
--- /dev/null
+++ b/crates/syntax/src/ptr.rs
@@ -0,0 +1,105 @@
1//! FIXME: write short doc here
2
3use std::{
4 hash::{Hash, Hasher},
5 iter::successors,
6 marker::PhantomData,
7};
8
9use crate::{AstNode, SyntaxKind, SyntaxNode, TextRange};
10
11/// A pointer to a syntax node inside a file. It can be used to remember a
12/// specific node across reparses of the same file.
13#[derive(Debug, Clone, PartialEq, Eq, Hash)]
14pub struct SyntaxNodePtr {
15 pub(crate) range: TextRange,
16 kind: SyntaxKind,
17}
18
19impl SyntaxNodePtr {
20 pub fn new(node: &SyntaxNode) -> SyntaxNodePtr {
21 SyntaxNodePtr { range: node.text_range(), kind: node.kind() }
22 }
23
24 pub fn to_node(&self, root: &SyntaxNode) -> SyntaxNode {
25 assert!(root.parent().is_none());
26 successors(Some(root.clone()), |node| {
27 node.children().find(|it| it.text_range().contains_range(self.range))
28 })
29 .find(|it| it.text_range() == self.range && it.kind() == self.kind)
30 .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self))
31 }
32
33 pub fn cast<N: AstNode>(self) -> Option<AstPtr<N>> {
34 if !N::can_cast(self.kind) {
35 return None;
36 }
37 Some(AstPtr { raw: self, _ty: PhantomData })
38 }
39}
40
41/// Like `SyntaxNodePtr`, but remembers the type of node
42#[derive(Debug)]
43pub struct AstPtr<N: AstNode> {
44 raw: SyntaxNodePtr,
45 _ty: PhantomData<fn() -> N>,
46}
47
48impl<N: AstNode> Clone for AstPtr<N> {
49 fn clone(&self) -> AstPtr<N> {
50 AstPtr { raw: self.raw.clone(), _ty: PhantomData }
51 }
52}
53
54impl<N: AstNode> Eq for AstPtr<N> {}
55
56impl<N: AstNode> PartialEq for AstPtr<N> {
57 fn eq(&self, other: &AstPtr<N>) -> bool {
58 self.raw == other.raw
59 }
60}
61
62impl<N: AstNode> Hash for AstPtr<N> {
63 fn hash<H: Hasher>(&self, state: &mut H) {
64 self.raw.hash(state)
65 }
66}
67
68impl<N: AstNode> AstPtr<N> {
69 pub fn new(node: &N) -> AstPtr<N> {
70 AstPtr { raw: SyntaxNodePtr::new(node.syntax()), _ty: PhantomData }
71 }
72
73 pub fn to_node(&self, root: &SyntaxNode) -> N {
74 let syntax_node = self.raw.to_node(root);
75 N::cast(syntax_node).unwrap()
76 }
77
78 pub fn syntax_node_ptr(&self) -> SyntaxNodePtr {
79 self.raw.clone()
80 }
81
82 pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>> {
83 if !U::can_cast(self.raw.kind) {
84 return None;
85 }
86 Some(AstPtr { raw: self.raw, _ty: PhantomData })
87 }
88}
89
90impl<N: AstNode> From<AstPtr<N>> for SyntaxNodePtr {
91 fn from(ptr: AstPtr<N>) -> SyntaxNodePtr {
92 ptr.raw
93 }
94}
95
96#[test]
97fn test_local_syntax_ptr() {
98 use crate::{ast, AstNode, SourceFile};
99
100 let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap();
101 let field = file.syntax().descendants().find_map(ast::RecordField::cast).unwrap();
102 let ptr = SyntaxNodePtr::new(field.syntax());
103 let field_syntax = ptr.to_node(file.syntax());
104 assert_eq!(field.syntax(), &field_syntax);
105}
diff --git a/crates/syntax/src/syntax_error.rs b/crates/syntax/src/syntax_error.rs
new file mode 100644
index 000000000..7c4511fec
--- /dev/null
+++ b/crates/syntax/src/syntax_error.rs
@@ -0,0 +1,44 @@
1//! See docs for `SyntaxError`.
2
3use std::fmt;
4
5use crate::{TextRange, TextSize};
6
7/// Represents the result of unsuccessful tokenization, parsing
8/// or tree validation.
9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
10pub struct SyntaxError(String, TextRange);
11
12// FIXME: there was an unused SyntaxErrorKind previously (before this enum was removed)
13// It was introduced in this PR: https://github.com/rust-analyzer/rust-analyzer/pull/846/files#diff-827da9b03b8f9faa1bade5cdd44d5dafR95
14// but it was not removed by a mistake.
15//
16// So, we need to find a place where to stick validation for attributes in match clauses.
17// Code before refactor:
18// InvalidMatchInnerAttr => {
19// write!(f, "Inner attributes are only allowed directly after the opening brace of the match expression")
20// }
21
22impl SyntaxError {
23 pub fn new(message: impl Into<String>, range: TextRange) -> Self {
24 Self(message.into(), range)
25 }
26 pub fn new_at_offset(message: impl Into<String>, offset: TextSize) -> Self {
27 Self(message.into(), TextRange::empty(offset))
28 }
29
30 pub fn range(&self) -> TextRange {
31 self.1
32 }
33
34 pub fn with_range(mut self, range: TextRange) -> Self {
35 self.1 = range;
36 self
37 }
38}
39
40impl fmt::Display for SyntaxError {
41 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
42 self.0.fmt(f)
43 }
44}
diff --git a/crates/syntax/src/syntax_node.rs b/crates/syntax/src/syntax_node.rs
new file mode 100644
index 000000000..b2abcbfbb
--- /dev/null
+++ b/crates/syntax/src/syntax_node.rs
@@ -0,0 +1,77 @@
1//! This module defines Concrete Syntax Tree (CST), used by rust-analyzer.
2//!
3//! The CST includes comments and whitespace, provides a single node type,
4//! `SyntaxNode`, and a basic traversal API (parent, children, siblings).
5//!
6//! The *real* implementation is in the (language-agnostic) `rowan` crate, this
7//! module just wraps its API.
8
9use rowan::{GreenNodeBuilder, Language};
10
11use crate::{Parse, SmolStr, SyntaxError, SyntaxKind, TextSize};
12
13pub use rowan::GreenNode;
14
15pub(crate) use rowan::GreenToken;
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
18pub enum RustLanguage {}
19impl Language for RustLanguage {
20 type Kind = SyntaxKind;
21
22 fn kind_from_raw(raw: rowan::SyntaxKind) -> SyntaxKind {
23 SyntaxKind::from(raw.0)
24 }
25
26 fn kind_to_raw(kind: SyntaxKind) -> rowan::SyntaxKind {
27 rowan::SyntaxKind(kind.into())
28 }
29}
30
31pub type SyntaxNode = rowan::SyntaxNode<RustLanguage>;
32pub type SyntaxToken = rowan::SyntaxToken<RustLanguage>;
33pub type SyntaxElement = rowan::SyntaxElement<RustLanguage>;
34pub type SyntaxNodeChildren = rowan::SyntaxNodeChildren<RustLanguage>;
35pub type SyntaxElementChildren = rowan::SyntaxElementChildren<RustLanguage>;
36
37pub use rowan::{Direction, NodeOrToken};
38
39#[derive(Default)]
40pub struct SyntaxTreeBuilder {
41 errors: Vec<SyntaxError>,
42 inner: GreenNodeBuilder<'static>,
43}
44
45impl SyntaxTreeBuilder {
46 pub(crate) fn finish_raw(self) -> (GreenNode, Vec<SyntaxError>) {
47 let green = self.inner.finish();
48 (green, self.errors)
49 }
50
51 pub fn finish(self) -> Parse<SyntaxNode> {
52 let (green, errors) = self.finish_raw();
53 if cfg!(debug_assertions) {
54 let node = SyntaxNode::new_root(green.clone());
55 crate::validation::validate_block_structure(&node);
56 }
57 Parse::new(green, errors)
58 }
59
60 pub fn token(&mut self, kind: SyntaxKind, text: SmolStr) {
61 let kind = RustLanguage::kind_to_raw(kind);
62 self.inner.token(kind, text)
63 }
64
65 pub fn start_node(&mut self, kind: SyntaxKind) {
66 let kind = RustLanguage::kind_to_raw(kind);
67 self.inner.start_node(kind)
68 }
69
70 pub fn finish_node(&mut self) {
71 self.inner.finish_node()
72 }
73
74 pub fn error(&mut self, error: parser::ParseError, text_pos: TextSize) {
75 self.errors.push(SyntaxError::new_at_offset(*error.0, text_pos))
76 }
77}
diff --git a/crates/syntax/src/tests.rs b/crates/syntax/src/tests.rs
new file mode 100644
index 000000000..8c217dfe0
--- /dev/null
+++ b/crates/syntax/src/tests.rs
@@ -0,0 +1,280 @@
1use std::{
2 fmt::Write,
3 fs,
4 path::{Path, PathBuf},
5};
6
7use expect_test::expect_file;
8use rayon::prelude::*;
9use test_utils::project_dir;
10
11use crate::{fuzz, tokenize, SourceFile, SyntaxError, TextRange, TextSize, Token};
12
13#[test]
14fn lexer_tests() {
15 // FIXME:
16 // * Add tests for unicode escapes in byte-character and [raw]-byte-string literals
17 // * Add tests for unescape errors
18
19 dir_tests(&test_data_dir(), &["lexer/ok"], "txt", |text, path| {
20 let (tokens, errors) = tokenize(text);
21 assert_errors_are_absent(&errors, path);
22 dump_tokens_and_errors(&tokens, &errors, text)
23 });
24 dir_tests(&test_data_dir(), &["lexer/err"], "txt", |text, path| {
25 let (tokens, errors) = tokenize(text);
26 assert_errors_are_present(&errors, path);
27 dump_tokens_and_errors(&tokens, &errors, text)
28 });
29}
30
31#[test]
32fn parse_smoke_test() {
33 let code = r##"
34fn main() {
35 println!("Hello, world!")
36}
37 "##;
38
39 let parse = SourceFile::parse(code);
40 // eprintln!("{:#?}", parse.syntax_node());
41 assert!(parse.ok().is_ok());
42}
43
44#[test]
45fn parser_tests() {
46 dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], "rast", |text, path| {
47 let parse = SourceFile::parse(text);
48 let errors = parse.errors();
49 assert_errors_are_absent(&errors, path);
50 parse.debug_dump()
51 });
52 dir_tests(&test_data_dir(), &["parser/err", "parser/inline/err"], "rast", |text, path| {
53 let parse = SourceFile::parse(text);
54 let errors = parse.errors();
55 assert_errors_are_present(&errors, path);
56 parse.debug_dump()
57 });
58}
59
60#[test]
61fn expr_parser_tests() {
62 fragment_parser_dir_test(
63 &["parser/fragments/expr/ok"],
64 &["parser/fragments/expr/err"],
65 crate::ast::Expr::parse,
66 );
67}
68
69#[test]
70fn path_parser_tests() {
71 fragment_parser_dir_test(
72 &["parser/fragments/path/ok"],
73 &["parser/fragments/path/err"],
74 crate::ast::Path::parse,
75 );
76}
77
78#[test]
79fn pattern_parser_tests() {
80 fragment_parser_dir_test(
81 &["parser/fragments/pattern/ok"],
82 &["parser/fragments/pattern/err"],
83 crate::ast::Pat::parse,
84 );
85}
86
87#[test]
88fn item_parser_tests() {
89 fragment_parser_dir_test(
90 &["parser/fragments/item/ok"],
91 &["parser/fragments/item/err"],
92 crate::ast::Item::parse,
93 );
94}
95
96#[test]
97fn type_parser_tests() {
98 fragment_parser_dir_test(
99 &["parser/fragments/type/ok"],
100 &["parser/fragments/type/err"],
101 crate::ast::Type::parse,
102 );
103}
104
105#[test]
106fn parser_fuzz_tests() {
107 for (_, text) in collect_rust_files(&test_data_dir(), &["parser/fuzz-failures"]) {
108 fuzz::check_parser(&text)
109 }
110}
111
112#[test]
113fn reparse_fuzz_tests() {
114 for (_, text) in collect_rust_files(&test_data_dir(), &["reparse/fuzz-failures"]) {
115 let check = fuzz::CheckReparse::from_data(text.as_bytes()).unwrap();
116 println!("{:?}", check);
117 check.run();
118 }
119}
120
121/// Test that Rust-analyzer can parse and validate the rust-analyzer
122/// FIXME: Use this as a benchmark
123#[test]
124fn self_hosting_parsing() {
125 let dir = project_dir().join("crates");
126 let files = walkdir::WalkDir::new(dir)
127 .into_iter()
128 .filter_entry(|entry| {
129 // Get all files which are not in the crates/syntax/test_data folder
130 !entry.path().components().any(|component| component.as_os_str() == "test_data")
131 })
132 .map(|e| e.unwrap())
133 .filter(|entry| {
134 // Get all `.rs ` files
135 !entry.path().is_dir() && (entry.path().extension().unwrap_or_default() == "rs")
136 })
137 .map(|entry| entry.into_path())
138 .collect::<Vec<_>>();
139 assert!(
140 files.len() > 100,
141 "self_hosting_parsing found too few files - is it running in the right directory?"
142 );
143
144 let errors = files
145 .into_par_iter()
146 .filter_map(|file| {
147 let text = read_text(&file);
148 match SourceFile::parse(&text).ok() {
149 Ok(_) => None,
150 Err(err) => Some((file, err)),
151 }
152 })
153 .collect::<Vec<_>>();
154
155 if !errors.is_empty() {
156 let errors = errors
157 .into_iter()
158 .map(|(path, err)| format!("{}: {:?}\n", path.display(), err))
159 .collect::<String>();
160 panic!("Parsing errors:\n{}\n", errors);
161 }
162}
163
164fn test_data_dir() -> PathBuf {
165 project_dir().join("crates/syntax/test_data")
166}
167
168fn assert_errors_are_present(errors: &[SyntaxError], path: &Path) {
169 assert!(!errors.is_empty(), "There should be errors in the file {:?}", path.display());
170}
171fn assert_errors_are_absent(errors: &[SyntaxError], path: &Path) {
172 assert_eq!(
173 errors,
174 &[] as &[SyntaxError],
175 "There should be no errors in the file {:?}",
176 path.display(),
177 );
178}
179
180fn dump_tokens_and_errors(tokens: &[Token], errors: &[SyntaxError], text: &str) -> String {
181 let mut acc = String::new();
182 let mut offset: TextSize = 0.into();
183 for token in tokens {
184 let token_len = token.len;
185 let token_text = &text[TextRange::at(offset, token.len)];
186 offset += token.len;
187 writeln!(acc, "{:?} {:?} {:?}", token.kind, token_len, token_text).unwrap();
188 }
189 for err in errors {
190 writeln!(acc, "> error{:?} token({:?}) msg({})", err.range(), &text[err.range()], err)
191 .unwrap();
192 }
193 acc
194}
195
196fn fragment_parser_dir_test<T, F>(ok_paths: &[&str], err_paths: &[&str], f: F)
197where
198 T: crate::AstNode,
199 F: Fn(&str) -> Result<T, ()>,
200{
201 dir_tests(&test_data_dir(), ok_paths, "rast", |text, path| {
202 if let Ok(node) = f(text) {
203 format!("{:#?}", crate::ast::AstNode::syntax(&node))
204 } else {
205 panic!("Failed to parse '{:?}'", path);
206 }
207 });
208 dir_tests(&test_data_dir(), err_paths, "rast", |text, path| {
209 if let Ok(_) = f(text) {
210 panic!("'{:?}' successfully parsed when it should have errored", path);
211 } else {
212 "ERROR\n".to_owned()
213 }
214 });
215}
216
217/// Calls callback `f` with input code and file paths for each `.rs` file in `test_data_dir`
218/// subdirectories defined by `paths`.
219///
220/// If the content of the matching output file differs from the output of `f()`
221/// the test will fail.
222///
223/// If there is no matching output file it will be created and filled with the
224/// output of `f()`, but the test will fail.
225fn dir_tests<F>(test_data_dir: &Path, paths: &[&str], outfile_extension: &str, f: F)
226where
227 F: Fn(&str, &Path) -> String,
228{
229 for (path, input_code) in collect_rust_files(test_data_dir, paths) {
230 let actual = f(&input_code, &path);
231 let path = path.with_extension(outfile_extension);
232 expect_file![path].assert_eq(&actual)
233 }
234}
235
236/// Collects all `.rs` files from `dir` subdirectories defined by `paths`.
237fn collect_rust_files(root_dir: &Path, paths: &[&str]) -> Vec<(PathBuf, String)> {
238 paths
239 .iter()
240 .flat_map(|path| {
241 let path = root_dir.to_owned().join(path);
242 rust_files_in_dir(&path).into_iter()
243 })
244 .map(|path| {
245 let text = read_text(&path);
246 (path, text)
247 })
248 .collect()
249}
250
251/// Collects paths to all `.rs` files from `dir` in a sorted `Vec<PathBuf>`.
252fn rust_files_in_dir(dir: &Path) -> Vec<PathBuf> {
253 let mut acc = Vec::new();
254 for file in fs::read_dir(&dir).unwrap() {
255 let file = file.unwrap();
256 let path = file.path();
257 if path.extension().unwrap_or_default() == "rs" {
258 acc.push(path);
259 }
260 }
261 acc.sort();
262 acc
263}
264
265/// Read file and normalize newlines.
266///
267/// `rustc` seems to always normalize `\r\n` newlines to `\n`:
268///
269/// ```
270/// let s = "
271/// ";
272/// assert_eq!(s.as_bytes(), &[10]);
273/// ```
274///
275/// so this should always be correct.
276fn read_text(path: &Path) -> String {
277 fs::read_to_string(path)
278 .unwrap_or_else(|_| panic!("File at {:?} should be valid", path))
279 .replace("\r\n", "\n")
280}
diff --git a/crates/syntax/src/validation.rs b/crates/syntax/src/validation.rs
new file mode 100644
index 000000000..2dddaf09a
--- /dev/null
+++ b/crates/syntax/src/validation.rs
@@ -0,0 +1,303 @@
1//! FIXME: write short doc here
2
3mod block;
4
5use crate::{
6 ast, match_ast, AstNode, SyntaxError,
7 SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST, FN, INT_NUMBER, STRING, TYPE_ALIAS},
8 SyntaxNode, SyntaxToken, TextSize, T,
9};
10use rustc_lexer::unescape::{
11 self, unescape_byte, unescape_byte_literal, unescape_char, unescape_literal, Mode,
12};
13use std::convert::TryFrom;
14
15fn rustc_unescape_error_to_string(err: unescape::EscapeError) -> &'static str {
16 use unescape::EscapeError as EE;
17
18 #[rustfmt::skip]
19 let err_message = match err {
20 EE::ZeroChars => {
21 "Literal must not be empty"
22 }
23 EE::MoreThanOneChar => {
24 "Literal must be one character long"
25 }
26 EE::LoneSlash => {
27 "Character must be escaped: `\\`"
28 }
29 EE::InvalidEscape => {
30 "Invalid escape"
31 }
32 EE::BareCarriageReturn | EE::BareCarriageReturnInRawString => {
33 "Character must be escaped: `\r`"
34 }
35 EE::EscapeOnlyChar => {
36 "Escape character `\\` must be escaped itself"
37 }
38 EE::TooShortHexEscape => {
39 "ASCII hex escape code must have exactly two digits"
40 }
41 EE::InvalidCharInHexEscape => {
42 "ASCII hex escape code must contain only hex characters"
43 }
44 EE::OutOfRangeHexEscape => {
45 "ASCII hex escape code must be at most 0x7F"
46 }
47 EE::NoBraceInUnicodeEscape => {
48 "Missing `{` to begin the unicode escape"
49 }
50 EE::InvalidCharInUnicodeEscape => {
51 "Unicode escape must contain only hex characters and underscores"
52 }
53 EE::EmptyUnicodeEscape => {
54 "Unicode escape must not be empty"
55 }
56 EE::UnclosedUnicodeEscape => {
57 "Missing `}` to terminate the unicode escape"
58 }
59 EE::LeadingUnderscoreUnicodeEscape => {
60 "Unicode escape code must not begin with an underscore"
61 }
62 EE::OverlongUnicodeEscape => {
63 "Unicode escape code must have at most 6 digits"
64 }
65 EE::LoneSurrogateUnicodeEscape => {
66 "Unicode escape code must not be a surrogate"
67 }
68 EE::OutOfRangeUnicodeEscape => {
69 "Unicode escape code must be at most 0x10FFFF"
70 }
71 EE::UnicodeEscapeInByte => {
72 "Byte literals must not contain unicode escapes"
73 }
74 EE::NonAsciiCharInByte | EE::NonAsciiCharInByteString => {
75 "Byte literals must not contain non-ASCII characters"
76 }
77 };
78
79 err_message
80}
81
82pub(crate) fn validate(root: &SyntaxNode) -> Vec<SyntaxError> {
83 // FIXME:
84 // * Add unescape validation of raw string literals and raw byte string literals
85 // * Add validation of doc comments are being attached to nodes
86
87 let mut errors = Vec::new();
88 for node in root.descendants() {
89 match_ast! {
90 match node {
91 ast::Literal(it) => validate_literal(it, &mut errors),
92 ast::BlockExpr(it) => block::validate_block_expr(it, &mut errors),
93 ast::FieldExpr(it) => validate_numeric_name(it.name_ref(), &mut errors),
94 ast::RecordExprField(it) => validate_numeric_name(it.name_ref(), &mut errors),
95 ast::Visibility(it) => validate_visibility(it, &mut errors),
96 ast::RangeExpr(it) => validate_range_expr(it, &mut errors),
97 ast::PathSegment(it) => validate_path_keywords(it, &mut errors),
98 _ => (),
99 }
100 }
101 }
102 errors
103}
104
105fn validate_literal(literal: ast::Literal, acc: &mut Vec<SyntaxError>) {
106 // FIXME: move this function to outer scope (https://github.com/rust-analyzer/rust-analyzer/pull/2834#discussion_r366196658)
107 fn unquote(text: &str, prefix_len: usize, end_delimiter: char) -> Option<&str> {
108 text.rfind(end_delimiter).and_then(|end| text.get(prefix_len..end))
109 }
110
111 let token = literal.token();
112 let text = token.text().as_str();
113
114 // FIXME: lift this lambda refactor to `fn` (https://github.com/rust-analyzer/rust-analyzer/pull/2834#discussion_r366199205)
115 let mut push_err = |prefix_len, (off, err): (usize, unescape::EscapeError)| {
116 let off = token.text_range().start() + TextSize::try_from(off + prefix_len).unwrap();
117 acc.push(SyntaxError::new_at_offset(rustc_unescape_error_to_string(err), off));
118 };
119
120 match token.kind() {
121 BYTE => {
122 if let Some(Err(e)) = unquote(text, 2, '\'').map(unescape_byte) {
123 push_err(2, e);
124 }
125 }
126 CHAR => {
127 if let Some(Err(e)) = unquote(text, 1, '\'').map(unescape_char) {
128 push_err(1, e);
129 }
130 }
131 BYTE_STRING => {
132 if let Some(without_quotes) = unquote(text, 2, '"') {
133 unescape_byte_literal(without_quotes, Mode::ByteStr, &mut |range, char| {
134 if let Err(err) = char {
135 push_err(2, (range.start, err));
136 }
137 })
138 }
139 }
140 STRING => {
141 if let Some(without_quotes) = unquote(text, 1, '"') {
142 unescape_literal(without_quotes, Mode::Str, &mut |range, char| {
143 if let Err(err) = char {
144 push_err(1, (range.start, err));
145 }
146 })
147 }
148 }
149 _ => (),
150 }
151}
152
153pub(crate) fn validate_block_structure(root: &SyntaxNode) {
154 let mut stack = Vec::new();
155 for node in root.descendants() {
156 match node.kind() {
157 T!['{'] => stack.push(node),
158 T!['}'] => {
159 if let Some(pair) = stack.pop() {
160 assert_eq!(
161 node.parent(),
162 pair.parent(),
163 "\nunpaired curleys:\n{}\n{:#?}\n",
164 root.text(),
165 root,
166 );
167 assert!(
168 node.next_sibling().is_none() && pair.prev_sibling().is_none(),
169 "\nfloating curlys at {:?}\nfile:\n{}\nerror:\n{}\n",
170 node,
171 root.text(),
172 node.text(),
173 );
174 }
175 }
176 _ => (),
177 }
178 }
179}
180
181fn validate_numeric_name(name_ref: Option<ast::NameRef>, errors: &mut Vec<SyntaxError>) {
182 if let Some(int_token) = int_token(name_ref) {
183 if int_token.text().chars().any(|c| !c.is_digit(10)) {
184 errors.push(SyntaxError::new(
185 "Tuple (struct) field access is only allowed through \
186 decimal integers with no underscores or suffix",
187 int_token.text_range(),
188 ));
189 }
190 }
191
192 fn int_token(name_ref: Option<ast::NameRef>) -> Option<SyntaxToken> {
193 name_ref?.syntax().first_child_or_token()?.into_token().filter(|it| it.kind() == INT_NUMBER)
194 }
195}
196
197fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) {
198 let parent = match vis.syntax().parent() {
199 Some(it) => it,
200 None => return,
201 };
202 match parent.kind() {
203 FN | CONST | TYPE_ALIAS => (),
204 _ => return,
205 }
206
207 let impl_def = match parent.parent().and_then(|it| it.parent()).and_then(ast::Impl::cast) {
208 Some(it) => it,
209 None => return,
210 };
211 if impl_def.trait_().is_some() {
212 errors.push(SyntaxError::new("Unnecessary visibility qualifier", vis.syntax.text_range()));
213 }
214}
215
216fn validate_range_expr(expr: ast::RangeExpr, errors: &mut Vec<SyntaxError>) {
217 if expr.op_kind() == Some(ast::RangeOp::Inclusive) && expr.end().is_none() {
218 errors.push(SyntaxError::new(
219 "An inclusive range must have an end expression",
220 expr.syntax().text_range(),
221 ));
222 }
223}
224
225fn validate_path_keywords(segment: ast::PathSegment, errors: &mut Vec<SyntaxError>) {
226 use ast::PathSegmentKind;
227
228 let path = segment.parent_path();
229 let is_path_start = segment.coloncolon_token().is_none() && path.qualifier().is_none();
230
231 if let Some(token) = segment.self_token() {
232 if !is_path_start {
233 errors.push(SyntaxError::new(
234 "The `self` keyword is only allowed as the first segment of a path",
235 token.text_range(),
236 ));
237 }
238 } else if let Some(token) = segment.crate_token() {
239 if !is_path_start || use_prefix(path).is_some() {
240 errors.push(SyntaxError::new(
241 "The `crate` keyword is only allowed as the first segment of a path",
242 token.text_range(),
243 ));
244 }
245 } else if let Some(token) = segment.super_token() {
246 if !all_supers(&path) {
247 errors.push(SyntaxError::new(
248 "The `super` keyword may only be preceded by other `super`s",
249 token.text_range(),
250 ));
251 return;
252 }
253
254 let mut curr_path = path;
255 while let Some(prefix) = use_prefix(curr_path) {
256 if !all_supers(&prefix) {
257 errors.push(SyntaxError::new(
258 "The `super` keyword may only be preceded by other `super`s",
259 token.text_range(),
260 ));
261 return;
262 }
263 curr_path = prefix;
264 }
265 }
266
267 fn use_prefix(mut path: ast::Path) -> Option<ast::Path> {
268 for node in path.syntax().ancestors().skip(1) {
269 match_ast! {
270 match node {
271 ast::UseTree(it) => if let Some(tree_path) = it.path() {
272 // Even a top-level path exists within a `UseTree` so we must explicitly
273 // allow our path but disallow anything else
274 if tree_path != path {
275 return Some(tree_path);
276 }
277 },
278 ast::UseTreeList(_it) => continue,
279 ast::Path(parent) => path = parent,
280 _ => return None,
281 }
282 };
283 }
284 return None;
285 }
286
287 fn all_supers(path: &ast::Path) -> bool {
288 let segment = match path.segment() {
289 Some(it) => it,
290 None => return false,
291 };
292
293 if segment.kind() != Some(PathSegmentKind::SuperKw) {
294 return false;
295 }
296
297 if let Some(ref subpath) = path.qualifier() {
298 return all_supers(subpath);
299 }
300
301 return true;
302 }
303}
diff --git a/crates/syntax/src/validation/block.rs b/crates/syntax/src/validation/block.rs
new file mode 100644
index 000000000..ad9901468
--- /dev/null
+++ b/crates/syntax/src/validation/block.rs
@@ -0,0 +1,22 @@
1//! Logic for validating block expressions i.e. `ast::BlockExpr`.
2
3use crate::{
4 ast::{self, AstNode, AttrsOwner},
5 SyntaxError,
6 SyntaxKind::*,
7};
8
9pub(crate) fn validate_block_expr(block: ast::BlockExpr, errors: &mut Vec<SyntaxError>) {
10 if let Some(parent) = block.syntax().parent() {
11 match parent.kind() {
12 FN | EXPR_STMT | BLOCK_EXPR => return,
13 _ => {}
14 }
15 }
16 errors.extend(block.attrs().map(|attr| {
17 SyntaxError::new(
18 "A block in this position cannot accept inner attributes",
19 attr.syntax().text_range(),
20 )
21 }))
22}
diff --git a/crates/syntax/test_data/accidentally_quadratic b/crates/syntax/test_data/accidentally_quadratic
new file mode 100644
index 000000000..428f83a62
--- /dev/null
+++ b/crates/syntax/test_data/accidentally_quadratic
@@ -0,0 +1,3980 @@
1#[doc = r" Register block"]
2#[repr(C)]
3pub struct RegisterBlock {
4 #[doc = "0x00 - Control Register"]
5 pub cr: CR,
6 #[doc = "0x04 - Error Status Register"]
7 pub es: ES,
8 _reserved0: [u8; 4usize],
9 #[doc = "0x0c - Enable Request Register"]
10 pub erq: ERQ,
11 _reserved1: [u8; 4usize],
12 #[doc = "0x14 - Enable Error Interrupt Register"]
13 pub eei: EEI,
14 #[doc = "0x18 - Clear Enable Error Interrupt Register"]
15 pub ceei: CEEI,
16 #[doc = "0x19 - Set Enable Error Interrupt Register"]
17 pub seei: SEEI,
18 #[doc = "0x1a - Clear Enable Request Register"]
19 pub cerq: CERQ,
20 #[doc = "0x1b - Set Enable Request Register"]
21 pub serq: SERQ,
22 #[doc = "0x1c - Clear DONE Status Bit Register"]
23 pub cdne: CDNE,
24 #[doc = "0x1d - Set START Bit Register"]
25 pub ssrt: SSRT,
26 #[doc = "0x1e - Clear Error Register"]
27 pub cerr: CERR,
28 #[doc = "0x1f - Clear Interrupt Request Register"]
29 pub cint: CINT,
30 _reserved2: [u8; 4usize],
31 #[doc = "0x24 - Interrupt Request Register"]
32 pub int: INT,
33 _reserved3: [u8; 4usize],
34 #[doc = "0x2c - Error Register"]
35 pub err: ERR,
36 _reserved4: [u8; 4usize],
37 #[doc = "0x34 - Hardware Request Status Register"]
38 pub hrs: HRS,
39 _reserved5: [u8; 12usize],
40 #[doc = "0x44 - Enable Asynchronous Request in Stop Register"]
41 pub ears: EARS,
42 _reserved6: [u8; 184usize],
43 #[doc = "0x100 - Channel n Priority Register"]
44 pub dchpri3: DCHPRI3,
45 #[doc = "0x101 - Channel n Priority Register"]
46 pub dchpri2: DCHPRI2,
47 #[doc = "0x102 - Channel n Priority Register"]
48 pub dchpri1: DCHPRI1,
49 #[doc = "0x103 - Channel n Priority Register"]
50 pub dchpri0: DCHPRI0,
51 #[doc = "0x104 - Channel n Priority Register"]
52 pub dchpri7: DCHPRI7,
53 #[doc = "0x105 - Channel n Priority Register"]
54 pub dchpri6: DCHPRI6,
55 #[doc = "0x106 - Channel n Priority Register"]
56 pub dchpri5: DCHPRI5,
57 #[doc = "0x107 - Channel n Priority Register"]
58 pub dchpri4: DCHPRI4,
59 #[doc = "0x108 - Channel n Priority Register"]
60 pub dchpri11: DCHPRI11,
61 #[doc = "0x109 - Channel n Priority Register"]
62 pub dchpri10: DCHPRI10,
63 #[doc = "0x10a - Channel n Priority Register"]
64 pub dchpri9: DCHPRI9,
65 #[doc = "0x10b - Channel n Priority Register"]
66 pub dchpri8: DCHPRI8,
67 #[doc = "0x10c - Channel n Priority Register"]
68 pub dchpri15: DCHPRI15,
69 #[doc = "0x10d - Channel n Priority Register"]
70 pub dchpri14: DCHPRI14,
71 #[doc = "0x10e - Channel n Priority Register"]
72 pub dchpri13: DCHPRI13,
73 #[doc = "0x10f - Channel n Priority Register"]
74 pub dchpri12: DCHPRI12,
75 #[doc = "0x110 - Channel n Priority Register"]
76 pub dchpri19: DCHPRI19,
77 #[doc = "0x111 - Channel n Priority Register"]
78 pub dchpri18: DCHPRI18,
79 #[doc = "0x112 - Channel n Priority Register"]
80 pub dchpri17: DCHPRI17,
81 #[doc = "0x113 - Channel n Priority Register"]
82 pub dchpri16: DCHPRI16,
83 #[doc = "0x114 - Channel n Priority Register"]
84 pub dchpri23: DCHPRI23,
85 #[doc = "0x115 - Channel n Priority Register"]
86 pub dchpri22: DCHPRI22,
87 #[doc = "0x116 - Channel n Priority Register"]
88 pub dchpri21: DCHPRI21,
89 #[doc = "0x117 - Channel n Priority Register"]
90 pub dchpri20: DCHPRI20,
91 #[doc = "0x118 - Channel n Priority Register"]
92 pub dchpri27: DCHPRI27,
93 #[doc = "0x119 - Channel n Priority Register"]
94 pub dchpri26: DCHPRI26,
95 #[doc = "0x11a - Channel n Priority Register"]
96 pub dchpri25: DCHPRI25,
97 #[doc = "0x11b - Channel n Priority Register"]
98 pub dchpri24: DCHPRI24,
99 #[doc = "0x11c - Channel n Priority Register"]
100 pub dchpri31: DCHPRI31,
101 #[doc = "0x11d - Channel n Priority Register"]
102 pub dchpri30: DCHPRI30,
103 #[doc = "0x11e - Channel n Priority Register"]
104 pub dchpri29: DCHPRI29,
105 #[doc = "0x11f - Channel n Priority Register"]
106 pub dchpri28: DCHPRI28,
107 _reserved7: [u8; 3808usize],
108 #[doc = "0x1000 - TCD Source Address"]
109 pub tcd0_saddr: TCD0_SADDR,
110 #[doc = "0x1004 - TCD Signed Source Address Offset"]
111 pub tcd0_soff: TCD0_SOFF,
112 #[doc = "0x1006 - TCD Transfer Attributes"]
113 pub tcd0_attr: TCD0_ATTR,
114 #[doc = "0x1008 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
115 pub tcd0_nbytes_mlno: TCD0_NBYTES_MLNO,
116 #[doc = "0x100c - TCD Last Source Address Adjustment"]
117 pub tcd0_slast: TCD0_SLAST,
118 #[doc = "0x1010 - TCD Destination Address"]
119 pub tcd0_daddr: TCD0_DADDR,
120 #[doc = "0x1014 - TCD Signed Destination Address Offset"]
121 pub tcd0_doff: TCD0_DOFF,
122 #[doc = "0x1016 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
123 pub tcd0_citer_elinkno: TCD0_CITER_ELINKNO,
124 #[doc = "0x1018 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
125 pub tcd0_dlastsga: TCD0_DLASTSGA,
126 #[doc = "0x101c - TCD Control and Status"]
127 pub tcd0_csr: TCD0_CSR,
128 #[doc = "0x101e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
129 pub tcd0_biter_elinkno: TCD0_BITER_ELINKNO,
130 #[doc = "0x1020 - TCD Source Address"]
131 pub tcd1_saddr: TCD1_SADDR,
132 #[doc = "0x1024 - TCD Signed Source Address Offset"]
133 pub tcd1_soff: TCD1_SOFF,
134 #[doc = "0x1026 - TCD Transfer Attributes"]
135 pub tcd1_attr: TCD1_ATTR,
136 #[doc = "0x1028 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
137 pub tcd1_nbytes_mlno: TCD1_NBYTES_MLNO,
138 #[doc = "0x102c - TCD Last Source Address Adjustment"]
139 pub tcd1_slast: TCD1_SLAST,
140 #[doc = "0x1030 - TCD Destination Address"]
141 pub tcd1_daddr: TCD1_DADDR,
142 #[doc = "0x1034 - TCD Signed Destination Address Offset"]
143 pub tcd1_doff: TCD1_DOFF,
144 #[doc = "0x1036 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
145 pub tcd1_citer_elinkno: TCD1_CITER_ELINKNO,
146 #[doc = "0x1038 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
147 pub tcd1_dlastsga: TCD1_DLASTSGA,
148 #[doc = "0x103c - TCD Control and Status"]
149 pub tcd1_csr: TCD1_CSR,
150 #[doc = "0x103e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
151 pub tcd1_biter_elinkno: TCD1_BITER_ELINKNO,
152 #[doc = "0x1040 - TCD Source Address"]
153 pub tcd2_saddr: TCD2_SADDR,
154 #[doc = "0x1044 - TCD Signed Source Address Offset"]
155 pub tcd2_soff: TCD2_SOFF,
156 #[doc = "0x1046 - TCD Transfer Attributes"]
157 pub tcd2_attr: TCD2_ATTR,
158 #[doc = "0x1048 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
159 pub tcd2_nbytes_mlno: TCD2_NBYTES_MLNO,
160 #[doc = "0x104c - TCD Last Source Address Adjustment"]
161 pub tcd2_slast: TCD2_SLAST,
162 #[doc = "0x1050 - TCD Destination Address"]
163 pub tcd2_daddr: TCD2_DADDR,
164 #[doc = "0x1054 - TCD Signed Destination Address Offset"]
165 pub tcd2_doff: TCD2_DOFF,
166 #[doc = "0x1056 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
167 pub tcd2_citer_elinkno: TCD2_CITER_ELINKNO,
168 #[doc = "0x1058 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
169 pub tcd2_dlastsga: TCD2_DLASTSGA,
170 #[doc = "0x105c - TCD Control and Status"]
171 pub tcd2_csr: TCD2_CSR,
172 #[doc = "0x105e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
173 pub tcd2_biter_elinkno: TCD2_BITER_ELINKNO,
174 #[doc = "0x1060 - TCD Source Address"]
175 pub tcd3_saddr: TCD3_SADDR,
176 #[doc = "0x1064 - TCD Signed Source Address Offset"]
177 pub tcd3_soff: TCD3_SOFF,
178 #[doc = "0x1066 - TCD Transfer Attributes"]
179 pub tcd3_attr: TCD3_ATTR,
180 #[doc = "0x1068 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
181 pub tcd3_nbytes_mlno: TCD3_NBYTES_MLNO,
182 #[doc = "0x106c - TCD Last Source Address Adjustment"]
183 pub tcd3_slast: TCD3_SLAST,
184 #[doc = "0x1070 - TCD Destination Address"]
185 pub tcd3_daddr: TCD3_DADDR,
186 #[doc = "0x1074 - TCD Signed Destination Address Offset"]
187 pub tcd3_doff: TCD3_DOFF,
188 #[doc = "0x1076 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
189 pub tcd3_citer_elinkno: TCD3_CITER_ELINKNO,
190 #[doc = "0x1078 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
191 pub tcd3_dlastsga: TCD3_DLASTSGA,
192 #[doc = "0x107c - TCD Control and Status"]
193 pub tcd3_csr: TCD3_CSR,
194 #[doc = "0x107e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
195 pub tcd3_biter_elinkno: TCD3_BITER_ELINKNO,
196 #[doc = "0x1080 - TCD Source Address"]
197 pub tcd4_saddr: TCD4_SADDR,
198 #[doc = "0x1084 - TCD Signed Source Address Offset"]
199 pub tcd4_soff: TCD4_SOFF,
200 #[doc = "0x1086 - TCD Transfer Attributes"]
201 pub tcd4_attr: TCD4_ATTR,
202 #[doc = "0x1088 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
203 pub tcd4_nbytes_mlno: TCD4_NBYTES_MLNO,
204 #[doc = "0x108c - TCD Last Source Address Adjustment"]
205 pub tcd4_slast: TCD4_SLAST,
206 #[doc = "0x1090 - TCD Destination Address"]
207 pub tcd4_daddr: TCD4_DADDR,
208 #[doc = "0x1094 - TCD Signed Destination Address Offset"]
209 pub tcd4_doff: TCD4_DOFF,
210 #[doc = "0x1096 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
211 pub tcd4_citer_elinkno: TCD4_CITER_ELINKNO,
212 #[doc = "0x1098 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
213 pub tcd4_dlastsga: TCD4_DLASTSGA,
214 #[doc = "0x109c - TCD Control and Status"]
215 pub tcd4_csr: TCD4_CSR,
216 #[doc = "0x109e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
217 pub tcd4_biter_elinkno: TCD4_BITER_ELINKNO,
218 #[doc = "0x10a0 - TCD Source Address"]
219 pub tcd5_saddr: TCD5_SADDR,
220 #[doc = "0x10a4 - TCD Signed Source Address Offset"]
221 pub tcd5_soff: TCD5_SOFF,
222 #[doc = "0x10a6 - TCD Transfer Attributes"]
223 pub tcd5_attr: TCD5_ATTR,
224 #[doc = "0x10a8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
225 pub tcd5_nbytes_mlno: TCD5_NBYTES_MLNO,
226 #[doc = "0x10ac - TCD Last Source Address Adjustment"]
227 pub tcd5_slast: TCD5_SLAST,
228 #[doc = "0x10b0 - TCD Destination Address"]
229 pub tcd5_daddr: TCD5_DADDR,
230 #[doc = "0x10b4 - TCD Signed Destination Address Offset"]
231 pub tcd5_doff: TCD5_DOFF,
232 #[doc = "0x10b6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
233 pub tcd5_citer_elinkno: TCD5_CITER_ELINKNO,
234 #[doc = "0x10b8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
235 pub tcd5_dlastsga: TCD5_DLASTSGA,
236 #[doc = "0x10bc - TCD Control and Status"]
237 pub tcd5_csr: TCD5_CSR,
238 #[doc = "0x10be - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
239 pub tcd5_biter_elinkno: TCD5_BITER_ELINKNO,
240 #[doc = "0x10c0 - TCD Source Address"]
241 pub tcd6_saddr: TCD6_SADDR,
242 #[doc = "0x10c4 - TCD Signed Source Address Offset"]
243 pub tcd6_soff: TCD6_SOFF,
244 #[doc = "0x10c6 - TCD Transfer Attributes"]
245 pub tcd6_attr: TCD6_ATTR,
246 #[doc = "0x10c8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
247 pub tcd6_nbytes_mlno: TCD6_NBYTES_MLNO,
248 #[doc = "0x10cc - TCD Last Source Address Adjustment"]
249 pub tcd6_slast: TCD6_SLAST,
250 #[doc = "0x10d0 - TCD Destination Address"]
251 pub tcd6_daddr: TCD6_DADDR,
252 #[doc = "0x10d4 - TCD Signed Destination Address Offset"]
253 pub tcd6_doff: TCD6_DOFF,
254 #[doc = "0x10d6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
255 pub tcd6_citer_elinkno: TCD6_CITER_ELINKNO,
256 #[doc = "0x10d8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
257 pub tcd6_dlastsga: TCD6_DLASTSGA,
258 #[doc = "0x10dc - TCD Control and Status"]
259 pub tcd6_csr: TCD6_CSR,
260 #[doc = "0x10de - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
261 pub tcd6_biter_elinkno: TCD6_BITER_ELINKNO,
262 #[doc = "0x10e0 - TCD Source Address"]
263 pub tcd7_saddr: TCD7_SADDR,
264 #[doc = "0x10e4 - TCD Signed Source Address Offset"]
265 pub tcd7_soff: TCD7_SOFF,
266 #[doc = "0x10e6 - TCD Transfer Attributes"]
267 pub tcd7_attr: TCD7_ATTR,
268 #[doc = "0x10e8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
269 pub tcd7_nbytes_mlno: TCD7_NBYTES_MLNO,
270 #[doc = "0x10ec - TCD Last Source Address Adjustment"]
271 pub tcd7_slast: TCD7_SLAST,
272 #[doc = "0x10f0 - TCD Destination Address"]
273 pub tcd7_daddr: TCD7_DADDR,
274 #[doc = "0x10f4 - TCD Signed Destination Address Offset"]
275 pub tcd7_doff: TCD7_DOFF,
276 #[doc = "0x10f6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
277 pub tcd7_citer_elinkno: TCD7_CITER_ELINKNO,
278 #[doc = "0x10f8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
279 pub tcd7_dlastsga: TCD7_DLASTSGA,
280 #[doc = "0x10fc - TCD Control and Status"]
281 pub tcd7_csr: TCD7_CSR,
282 #[doc = "0x10fe - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
283 pub tcd7_biter_elinkno: TCD7_BITER_ELINKNO,
284 #[doc = "0x1100 - TCD Source Address"]
285 pub tcd8_saddr: TCD8_SADDR,
286 #[doc = "0x1104 - TCD Signed Source Address Offset"]
287 pub tcd8_soff: TCD8_SOFF,
288 #[doc = "0x1106 - TCD Transfer Attributes"]
289 pub tcd8_attr: TCD8_ATTR,
290 #[doc = "0x1108 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
291 pub tcd8_nbytes_mlno: TCD8_NBYTES_MLNO,
292 #[doc = "0x110c - TCD Last Source Address Adjustment"]
293 pub tcd8_slast: TCD8_SLAST,
294 #[doc = "0x1110 - TCD Destination Address"]
295 pub tcd8_daddr: TCD8_DADDR,
296 #[doc = "0x1114 - TCD Signed Destination Address Offset"]
297 pub tcd8_doff: TCD8_DOFF,
298 #[doc = "0x1116 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
299 pub tcd8_citer_elinkno: TCD8_CITER_ELINKNO,
300 #[doc = "0x1118 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
301 pub tcd8_dlastsga: TCD8_DLASTSGA,
302 #[doc = "0x111c - TCD Control and Status"]
303 pub tcd8_csr: TCD8_CSR,
304 #[doc = "0x111e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
305 pub tcd8_biter_elinkno: TCD8_BITER_ELINKNO,
306 #[doc = "0x1120 - TCD Source Address"]
307 pub tcd9_saddr: TCD9_SADDR,
308 #[doc = "0x1124 - TCD Signed Source Address Offset"]
309 pub tcd9_soff: TCD9_SOFF,
310 #[doc = "0x1126 - TCD Transfer Attributes"]
311 pub tcd9_attr: TCD9_ATTR,
312 #[doc = "0x1128 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
313 pub tcd9_nbytes_mlno: TCD9_NBYTES_MLNO,
314 #[doc = "0x112c - TCD Last Source Address Adjustment"]
315 pub tcd9_slast: TCD9_SLAST,
316 #[doc = "0x1130 - TCD Destination Address"]
317 pub tcd9_daddr: TCD9_DADDR,
318 #[doc = "0x1134 - TCD Signed Destination Address Offset"]
319 pub tcd9_doff: TCD9_DOFF,
320 #[doc = "0x1136 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
321 pub tcd9_citer_elinkno: TCD9_CITER_ELINKNO,
322 #[doc = "0x1138 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
323 pub tcd9_dlastsga: TCD9_DLASTSGA,
324 #[doc = "0x113c - TCD Control and Status"]
325 pub tcd9_csr: TCD9_CSR,
326 #[doc = "0x113e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
327 pub tcd9_biter_elinkno: TCD9_BITER_ELINKNO,
328 #[doc = "0x1140 - TCD Source Address"]
329 pub tcd10_saddr: TCD10_SADDR,
330 #[doc = "0x1144 - TCD Signed Source Address Offset"]
331 pub tcd10_soff: TCD10_SOFF,
332 #[doc = "0x1146 - TCD Transfer Attributes"]
333 pub tcd10_attr: TCD10_ATTR,
334 #[doc = "0x1148 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
335 pub tcd10_nbytes_mlno: TCD10_NBYTES_MLNO,
336 #[doc = "0x114c - TCD Last Source Address Adjustment"]
337 pub tcd10_slast: TCD10_SLAST,
338 #[doc = "0x1150 - TCD Destination Address"]
339 pub tcd10_daddr: TCD10_DADDR,
340 #[doc = "0x1154 - TCD Signed Destination Address Offset"]
341 pub tcd10_doff: TCD10_DOFF,
342 #[doc = "0x1156 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
343 pub tcd10_citer_elinkno: TCD10_CITER_ELINKNO,
344 #[doc = "0x1158 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
345 pub tcd10_dlastsga: TCD10_DLASTSGA,
346 #[doc = "0x115c - TCD Control and Status"]
347 pub tcd10_csr: TCD10_CSR,
348 #[doc = "0x115e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
349 pub tcd10_biter_elinkno: TCD10_BITER_ELINKNO,
350 #[doc = "0x1160 - TCD Source Address"]
351 pub tcd11_saddr: TCD11_SADDR,
352 #[doc = "0x1164 - TCD Signed Source Address Offset"]
353 pub tcd11_soff: TCD11_SOFF,
354 #[doc = "0x1166 - TCD Transfer Attributes"]
355 pub tcd11_attr: TCD11_ATTR,
356 #[doc = "0x1168 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
357 pub tcd11_nbytes_mlno: TCD11_NBYTES_MLNO,
358 #[doc = "0x116c - TCD Last Source Address Adjustment"]
359 pub tcd11_slast: TCD11_SLAST,
360 #[doc = "0x1170 - TCD Destination Address"]
361 pub tcd11_daddr: TCD11_DADDR,
362 #[doc = "0x1174 - TCD Signed Destination Address Offset"]
363 pub tcd11_doff: TCD11_DOFF,
364 #[doc = "0x1176 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
365 pub tcd11_citer_elinkno: TCD11_CITER_ELINKNO,
366 #[doc = "0x1178 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
367 pub tcd11_dlastsga: TCD11_DLASTSGA,
368 #[doc = "0x117c - TCD Control and Status"]
369 pub tcd11_csr: TCD11_CSR,
370 #[doc = "0x117e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
371 pub tcd11_biter_elinkno: TCD11_BITER_ELINKNO,
372 #[doc = "0x1180 - TCD Source Address"]
373 pub tcd12_saddr: TCD12_SADDR,
374 #[doc = "0x1184 - TCD Signed Source Address Offset"]
375 pub tcd12_soff: TCD12_SOFF,
376 #[doc = "0x1186 - TCD Transfer Attributes"]
377 pub tcd12_attr: TCD12_ATTR,
378 #[doc = "0x1188 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
379 pub tcd12_nbytes_mlno: TCD12_NBYTES_MLNO,
380 #[doc = "0x118c - TCD Last Source Address Adjustment"]
381 pub tcd12_slast: TCD12_SLAST,
382 #[doc = "0x1190 - TCD Destination Address"]
383 pub tcd12_daddr: TCD12_DADDR,
384 #[doc = "0x1194 - TCD Signed Destination Address Offset"]
385 pub tcd12_doff: TCD12_DOFF,
386 #[doc = "0x1196 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
387 pub tcd12_citer_elinkno: TCD12_CITER_ELINKNO,
388 #[doc = "0x1198 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
389 pub tcd12_dlastsga: TCD12_DLASTSGA,
390 #[doc = "0x119c - TCD Control and Status"]
391 pub tcd12_csr: TCD12_CSR,
392 #[doc = "0x119e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
393 pub tcd12_biter_elinkno: TCD12_BITER_ELINKNO,
394 #[doc = "0x11a0 - TCD Source Address"]
395 pub tcd13_saddr: TCD13_SADDR,
396 #[doc = "0x11a4 - TCD Signed Source Address Offset"]
397 pub tcd13_soff: TCD13_SOFF,
398 #[doc = "0x11a6 - TCD Transfer Attributes"]
399 pub tcd13_attr: TCD13_ATTR,
400 #[doc = "0x11a8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
401 pub tcd13_nbytes_mlno: TCD13_NBYTES_MLNO,
402 #[doc = "0x11ac - TCD Last Source Address Adjustment"]
403 pub tcd13_slast: TCD13_SLAST,
404 #[doc = "0x11b0 - TCD Destination Address"]
405 pub tcd13_daddr: TCD13_DADDR,
406 #[doc = "0x11b4 - TCD Signed Destination Address Offset"]
407 pub tcd13_doff: TCD13_DOFF,
408 #[doc = "0x11b6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
409 pub tcd13_citer_elinkno: TCD13_CITER_ELINKNO,
410 #[doc = "0x11b8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
411 pub tcd13_dlastsga: TCD13_DLASTSGA,
412 #[doc = "0x11bc - TCD Control and Status"]
413 pub tcd13_csr: TCD13_CSR,
414 #[doc = "0x11be - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
415 pub tcd13_biter_elinkno: TCD13_BITER_ELINKNO,
416 #[doc = "0x11c0 - TCD Source Address"]
417 pub tcd14_saddr: TCD14_SADDR,
418 #[doc = "0x11c4 - TCD Signed Source Address Offset"]
419 pub tcd14_soff: TCD14_SOFF,
420 #[doc = "0x11c6 - TCD Transfer Attributes"]
421 pub tcd14_attr: TCD14_ATTR,
422 #[doc = "0x11c8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
423 pub tcd14_nbytes_mlno: TCD14_NBYTES_MLNO,
424 #[doc = "0x11cc - TCD Last Source Address Adjustment"]
425 pub tcd14_slast: TCD14_SLAST,
426 #[doc = "0x11d0 - TCD Destination Address"]
427 pub tcd14_daddr: TCD14_DADDR,
428 #[doc = "0x11d4 - TCD Signed Destination Address Offset"]
429 pub tcd14_doff: TCD14_DOFF,
430 #[doc = "0x11d6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
431 pub tcd14_citer_elinkno: TCD14_CITER_ELINKNO,
432 #[doc = "0x11d8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
433 pub tcd14_dlastsga: TCD14_DLASTSGA,
434 #[doc = "0x11dc - TCD Control and Status"]
435 pub tcd14_csr: TCD14_CSR,
436 #[doc = "0x11de - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
437 pub tcd14_biter_elinkno: TCD14_BITER_ELINKNO,
438 #[doc = "0x11e0 - TCD Source Address"]
439 pub tcd15_saddr: TCD15_SADDR,
440 #[doc = "0x11e4 - TCD Signed Source Address Offset"]
441 pub tcd15_soff: TCD15_SOFF,
442 #[doc = "0x11e6 - TCD Transfer Attributes"]
443 pub tcd15_attr: TCD15_ATTR,
444 #[doc = "0x11e8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
445 pub tcd15_nbytes_mlno: TCD15_NBYTES_MLNO,
446 #[doc = "0x11ec - TCD Last Source Address Adjustment"]
447 pub tcd15_slast: TCD15_SLAST,
448 #[doc = "0x11f0 - TCD Destination Address"]
449 pub tcd15_daddr: TCD15_DADDR,
450 #[doc = "0x11f4 - TCD Signed Destination Address Offset"]
451 pub tcd15_doff: TCD15_DOFF,
452 #[doc = "0x11f6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
453 pub tcd15_citer_elinkno: TCD15_CITER_ELINKNO,
454 #[doc = "0x11f8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
455 pub tcd15_dlastsga: TCD15_DLASTSGA,
456 #[doc = "0x11fc - TCD Control and Status"]
457 pub tcd15_csr: TCD15_CSR,
458 #[doc = "0x11fe - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
459 pub tcd15_biter_elinkno: TCD15_BITER_ELINKNO,
460 #[doc = "0x1200 - TCD Source Address"]
461 pub tcd16_saddr: TCD16_SADDR,
462 #[doc = "0x1204 - TCD Signed Source Address Offset"]
463 pub tcd16_soff: TCD16_SOFF,
464 #[doc = "0x1206 - TCD Transfer Attributes"]
465 pub tcd16_attr: TCD16_ATTR,
466 #[doc = "0x1208 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
467 pub tcd16_nbytes_mlno: TCD16_NBYTES_MLNO,
468 #[doc = "0x120c - TCD Last Source Address Adjustment"]
469 pub tcd16_slast: TCD16_SLAST,
470 #[doc = "0x1210 - TCD Destination Address"]
471 pub tcd16_daddr: TCD16_DADDR,
472 #[doc = "0x1214 - TCD Signed Destination Address Offset"]
473 pub tcd16_doff: TCD16_DOFF,
474 #[doc = "0x1216 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
475 pub tcd16_citer_elinkno: TCD16_CITER_ELINKNO,
476 #[doc = "0x1218 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
477 pub tcd16_dlastsga: TCD16_DLASTSGA,
478 #[doc = "0x121c - TCD Control and Status"]
479 pub tcd16_csr: TCD16_CSR,
480 #[doc = "0x121e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
481 pub tcd16_biter_elinkno: TCD16_BITER_ELINKNO,
482 #[doc = "0x1220 - TCD Source Address"]
483 pub tcd17_saddr: TCD17_SADDR,
484 #[doc = "0x1224 - TCD Signed Source Address Offset"]
485 pub tcd17_soff: TCD17_SOFF,
486 #[doc = "0x1226 - TCD Transfer Attributes"]
487 pub tcd17_attr: TCD17_ATTR,
488 #[doc = "0x1228 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
489 pub tcd17_nbytes_mlno: TCD17_NBYTES_MLNO,
490 #[doc = "0x122c - TCD Last Source Address Adjustment"]
491 pub tcd17_slast: TCD17_SLAST,
492 #[doc = "0x1230 - TCD Destination Address"]
493 pub tcd17_daddr: TCD17_DADDR,
494 #[doc = "0x1234 - TCD Signed Destination Address Offset"]
495 pub tcd17_doff: TCD17_DOFF,
496 #[doc = "0x1236 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
497 pub tcd17_citer_elinkno: TCD17_CITER_ELINKNO,
498 #[doc = "0x1238 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
499 pub tcd17_dlastsga: TCD17_DLASTSGA,
500 #[doc = "0x123c - TCD Control and Status"]
501 pub tcd17_csr: TCD17_CSR,
502 #[doc = "0x123e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
503 pub tcd17_biter_elinkno: TCD17_BITER_ELINKNO,
504 #[doc = "0x1240 - TCD Source Address"]
505 pub tcd18_saddr: TCD18_SADDR,
506 #[doc = "0x1244 - TCD Signed Source Address Offset"]
507 pub tcd18_soff: TCD18_SOFF,
508 #[doc = "0x1246 - TCD Transfer Attributes"]
509 pub tcd18_attr: TCD18_ATTR,
510 #[doc = "0x1248 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
511 pub tcd18_nbytes_mlno: TCD18_NBYTES_MLNO,
512 #[doc = "0x124c - TCD Last Source Address Adjustment"]
513 pub tcd18_slast: TCD18_SLAST,
514 #[doc = "0x1250 - TCD Destination Address"]
515 pub tcd18_daddr: TCD18_DADDR,
516 #[doc = "0x1254 - TCD Signed Destination Address Offset"]
517 pub tcd18_doff: TCD18_DOFF,
518 #[doc = "0x1256 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
519 pub tcd18_citer_elinkno: TCD18_CITER_ELINKNO,
520 #[doc = "0x1258 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
521 pub tcd18_dlastsga: TCD18_DLASTSGA,
522 #[doc = "0x125c - TCD Control and Status"]
523 pub tcd18_csr: TCD18_CSR,
524 #[doc = "0x125e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
525 pub tcd18_biter_elinkno: TCD18_BITER_ELINKNO,
526 #[doc = "0x1260 - TCD Source Address"]
527 pub tcd19_saddr: TCD19_SADDR,
528 #[doc = "0x1264 - TCD Signed Source Address Offset"]
529 pub tcd19_soff: TCD19_SOFF,
530 #[doc = "0x1266 - TCD Transfer Attributes"]
531 pub tcd19_attr: TCD19_ATTR,
532 #[doc = "0x1268 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
533 pub tcd19_nbytes_mlno: TCD19_NBYTES_MLNO,
534 #[doc = "0x126c - TCD Last Source Address Adjustment"]
535 pub tcd19_slast: TCD19_SLAST,
536 #[doc = "0x1270 - TCD Destination Address"]
537 pub tcd19_daddr: TCD19_DADDR,
538 #[doc = "0x1274 - TCD Signed Destination Address Offset"]
539 pub tcd19_doff: TCD19_DOFF,
540 #[doc = "0x1276 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
541 pub tcd19_citer_elinkno: TCD19_CITER_ELINKNO,
542 #[doc = "0x1278 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
543 pub tcd19_dlastsga: TCD19_DLASTSGA,
544 #[doc = "0x127c - TCD Control and Status"]
545 pub tcd19_csr: TCD19_CSR,
546 #[doc = "0x127e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
547 pub tcd19_biter_elinkno: TCD19_BITER_ELINKNO,
548 #[doc = "0x1280 - TCD Source Address"]
549 pub tcd20_saddr: TCD20_SADDR,
550 #[doc = "0x1284 - TCD Signed Source Address Offset"]
551 pub tcd20_soff: TCD20_SOFF,
552 #[doc = "0x1286 - TCD Transfer Attributes"]
553 pub tcd20_attr: TCD20_ATTR,
554 #[doc = "0x1288 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
555 pub tcd20_nbytes_mlno: TCD20_NBYTES_MLNO,
556 #[doc = "0x128c - TCD Last Source Address Adjustment"]
557 pub tcd20_slast: TCD20_SLAST,
558 #[doc = "0x1290 - TCD Destination Address"]
559 pub tcd20_daddr: TCD20_DADDR,
560 #[doc = "0x1294 - TCD Signed Destination Address Offset"]
561 pub tcd20_doff: TCD20_DOFF,
562 #[doc = "0x1296 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
563 pub tcd20_citer_elinkno: TCD20_CITER_ELINKNO,
564 #[doc = "0x1298 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
565 pub tcd20_dlastsga: TCD20_DLASTSGA,
566 #[doc = "0x129c - TCD Control and Status"]
567 pub tcd20_csr: TCD20_CSR,
568 #[doc = "0x129e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
569 pub tcd20_biter_elinkno: TCD20_BITER_ELINKNO,
570 #[doc = "0x12a0 - TCD Source Address"]
571 pub tcd21_saddr: TCD21_SADDR,
572 #[doc = "0x12a4 - TCD Signed Source Address Offset"]
573 pub tcd21_soff: TCD21_SOFF,
574 #[doc = "0x12a6 - TCD Transfer Attributes"]
575 pub tcd21_attr: TCD21_ATTR,
576 #[doc = "0x12a8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
577 pub tcd21_nbytes_mlno: TCD21_NBYTES_MLNO,
578 #[doc = "0x12ac - TCD Last Source Address Adjustment"]
579 pub tcd21_slast: TCD21_SLAST,
580 #[doc = "0x12b0 - TCD Destination Address"]
581 pub tcd21_daddr: TCD21_DADDR,
582 #[doc = "0x12b4 - TCD Signed Destination Address Offset"]
583 pub tcd21_doff: TCD21_DOFF,
584 #[doc = "0x12b6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
585 pub tcd21_citer_elinkno: TCD21_CITER_ELINKNO,
586 #[doc = "0x12b8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
587 pub tcd21_dlastsga: TCD21_DLASTSGA,
588 #[doc = "0x12bc - TCD Control and Status"]
589 pub tcd21_csr: TCD21_CSR,
590 #[doc = "0x12be - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
591 pub tcd21_biter_elinkno: TCD21_BITER_ELINKNO,
592 #[doc = "0x12c0 - TCD Source Address"]
593 pub tcd22_saddr: TCD22_SADDR,
594 #[doc = "0x12c4 - TCD Signed Source Address Offset"]
595 pub tcd22_soff: TCD22_SOFF,
596 #[doc = "0x12c6 - TCD Transfer Attributes"]
597 pub tcd22_attr: TCD22_ATTR,
598 #[doc = "0x12c8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
599 pub tcd22_nbytes_mlno: TCD22_NBYTES_MLNO,
600 #[doc = "0x12cc - TCD Last Source Address Adjustment"]
601 pub tcd22_slast: TCD22_SLAST,
602 #[doc = "0x12d0 - TCD Destination Address"]
603 pub tcd22_daddr: TCD22_DADDR,
604 #[doc = "0x12d4 - TCD Signed Destination Address Offset"]
605 pub tcd22_doff: TCD22_DOFF,
606 #[doc = "0x12d6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
607 pub tcd22_citer_elinkno: TCD22_CITER_ELINKNO,
608 #[doc = "0x12d8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
609 pub tcd22_dlastsga: TCD22_DLASTSGA,
610 #[doc = "0x12dc - TCD Control and Status"]
611 pub tcd22_csr: TCD22_CSR,
612 #[doc = "0x12de - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
613 pub tcd22_biter_elinkno: TCD22_BITER_ELINKNO,
614 #[doc = "0x12e0 - TCD Source Address"]
615 pub tcd23_saddr: TCD23_SADDR,
616 #[doc = "0x12e4 - TCD Signed Source Address Offset"]
617 pub tcd23_soff: TCD23_SOFF,
618 #[doc = "0x12e6 - TCD Transfer Attributes"]
619 pub tcd23_attr: TCD23_ATTR,
620 #[doc = "0x12e8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
621 pub tcd23_nbytes_mlno: TCD23_NBYTES_MLNO,
622 #[doc = "0x12ec - TCD Last Source Address Adjustment"]
623 pub tcd23_slast: TCD23_SLAST,
624 #[doc = "0x12f0 - TCD Destination Address"]
625 pub tcd23_daddr: TCD23_DADDR,
626 #[doc = "0x12f4 - TCD Signed Destination Address Offset"]
627 pub tcd23_doff: TCD23_DOFF,
628 #[doc = "0x12f6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
629 pub tcd23_citer_elinkno: TCD23_CITER_ELINKNO,
630 #[doc = "0x12f8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
631 pub tcd23_dlastsga: TCD23_DLASTSGA,
632 #[doc = "0x12fc - TCD Control and Status"]
633 pub tcd23_csr: TCD23_CSR,
634 #[doc = "0x12fe - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
635 pub tcd23_biter_elinkno: TCD23_BITER_ELINKNO,
636 #[doc = "0x1300 - TCD Source Address"]
637 pub tcd24_saddr: TCD24_SADDR,
638 #[doc = "0x1304 - TCD Signed Source Address Offset"]
639 pub tcd24_soff: TCD24_SOFF,
640 #[doc = "0x1306 - TCD Transfer Attributes"]
641 pub tcd24_attr: TCD24_ATTR,
642 #[doc = "0x1308 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
643 pub tcd24_nbytes_mlno: TCD24_NBYTES_MLNO,
644 #[doc = "0x130c - TCD Last Source Address Adjustment"]
645 pub tcd24_slast: TCD24_SLAST,
646 #[doc = "0x1310 - TCD Destination Address"]
647 pub tcd24_daddr: TCD24_DADDR,
648 #[doc = "0x1314 - TCD Signed Destination Address Offset"]
649 pub tcd24_doff: TCD24_DOFF,
650 #[doc = "0x1316 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
651 pub tcd24_citer_elinkno: TCD24_CITER_ELINKNO,
652 #[doc = "0x1318 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
653 pub tcd24_dlastsga: TCD24_DLASTSGA,
654 #[doc = "0x131c - TCD Control and Status"]
655 pub tcd24_csr: TCD24_CSR,
656 #[doc = "0x131e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
657 pub tcd24_biter_elinkno: TCD24_BITER_ELINKNO,
658 #[doc = "0x1320 - TCD Source Address"]
659 pub tcd25_saddr: TCD25_SADDR,
660 #[doc = "0x1324 - TCD Signed Source Address Offset"]
661 pub tcd25_soff: TCD25_SOFF,
662 #[doc = "0x1326 - TCD Transfer Attributes"]
663 pub tcd25_attr: TCD25_ATTR,
664 #[doc = "0x1328 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
665 pub tcd25_nbytes_mlno: TCD25_NBYTES_MLNO,
666 #[doc = "0x132c - TCD Last Source Address Adjustment"]
667 pub tcd25_slast: TCD25_SLAST,
668 #[doc = "0x1330 - TCD Destination Address"]
669 pub tcd25_daddr: TCD25_DADDR,
670 #[doc = "0x1334 - TCD Signed Destination Address Offset"]
671 pub tcd25_doff: TCD25_DOFF,
672 #[doc = "0x1336 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
673 pub tcd25_citer_elinkno: TCD25_CITER_ELINKNO,
674 #[doc = "0x1338 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
675 pub tcd25_dlastsga: TCD25_DLASTSGA,
676 #[doc = "0x133c - TCD Control and Status"]
677 pub tcd25_csr: TCD25_CSR,
678 #[doc = "0x133e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
679 pub tcd25_biter_elinkno: TCD25_BITER_ELINKNO,
680 #[doc = "0x1340 - TCD Source Address"]
681 pub tcd26_saddr: TCD26_SADDR,
682 #[doc = "0x1344 - TCD Signed Source Address Offset"]
683 pub tcd26_soff: TCD26_SOFF,
684 #[doc = "0x1346 - TCD Transfer Attributes"]
685 pub tcd26_attr: TCD26_ATTR,
686 #[doc = "0x1348 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
687 pub tcd26_nbytes_mlno: TCD26_NBYTES_MLNO,
688 #[doc = "0x134c - TCD Last Source Address Adjustment"]
689 pub tcd26_slast: TCD26_SLAST,
690 #[doc = "0x1350 - TCD Destination Address"]
691 pub tcd26_daddr: TCD26_DADDR,
692 #[doc = "0x1354 - TCD Signed Destination Address Offset"]
693 pub tcd26_doff: TCD26_DOFF,
694 #[doc = "0x1356 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
695 pub tcd26_citer_elinkno: TCD26_CITER_ELINKNO,
696 #[doc = "0x1358 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
697 pub tcd26_dlastsga: TCD26_DLASTSGA,
698 #[doc = "0x135c - TCD Control and Status"]
699 pub tcd26_csr: TCD26_CSR,
700 #[doc = "0x135e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
701 pub tcd26_biter_elinkno: TCD26_BITER_ELINKNO,
702 #[doc = "0x1360 - TCD Source Address"]
703 pub tcd27_saddr: TCD27_SADDR,
704 #[doc = "0x1364 - TCD Signed Source Address Offset"]
705 pub tcd27_soff: TCD27_SOFF,
706 #[doc = "0x1366 - TCD Transfer Attributes"]
707 pub tcd27_attr: TCD27_ATTR,
708 #[doc = "0x1368 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
709 pub tcd27_nbytes_mlno: TCD27_NBYTES_MLNO,
710 #[doc = "0x136c - TCD Last Source Address Adjustment"]
711 pub tcd27_slast: TCD27_SLAST,
712 #[doc = "0x1370 - TCD Destination Address"]
713 pub tcd27_daddr: TCD27_DADDR,
714 #[doc = "0x1374 - TCD Signed Destination Address Offset"]
715 pub tcd27_doff: TCD27_DOFF,
716 #[doc = "0x1376 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
717 pub tcd27_citer_elinkno: TCD27_CITER_ELINKNO,
718 #[doc = "0x1378 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
719 pub tcd27_dlastsga: TCD27_DLASTSGA,
720 #[doc = "0x137c - TCD Control and Status"]
721 pub tcd27_csr: TCD27_CSR,
722 #[doc = "0x137e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
723 pub tcd27_biter_elinkno: TCD27_BITER_ELINKNO,
724 #[doc = "0x1380 - TCD Source Address"]
725 pub tcd28_saddr: TCD28_SADDR,
726 #[doc = "0x1384 - TCD Signed Source Address Offset"]
727 pub tcd28_soff: TCD28_SOFF,
728 #[doc = "0x1386 - TCD Transfer Attributes"]
729 pub tcd28_attr: TCD28_ATTR,
730 #[doc = "0x1388 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
731 pub tcd28_nbytes_mlno: TCD28_NBYTES_MLNO,
732 #[doc = "0x138c - TCD Last Source Address Adjustment"]
733 pub tcd28_slast: TCD28_SLAST,
734 #[doc = "0x1390 - TCD Destination Address"]
735 pub tcd28_daddr: TCD28_DADDR,
736 #[doc = "0x1394 - TCD Signed Destination Address Offset"]
737 pub tcd28_doff: TCD28_DOFF,
738 #[doc = "0x1396 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
739 pub tcd28_citer_elinkno: TCD28_CITER_ELINKNO,
740 #[doc = "0x1398 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
741 pub tcd28_dlastsga: TCD28_DLASTSGA,
742 #[doc = "0x139c - TCD Control and Status"]
743 pub tcd28_csr: TCD28_CSR,
744 #[doc = "0x139e - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
745 pub tcd28_biter_elinkno: TCD28_BITER_ELINKNO,
746 #[doc = "0x13a0 - TCD Source Address"]
747 pub tcd29_saddr: TCD29_SADDR,
748 #[doc = "0x13a4 - TCD Signed Source Address Offset"]
749 pub tcd29_soff: TCD29_SOFF,
750 #[doc = "0x13a6 - TCD Transfer Attributes"]
751 pub tcd29_attr: TCD29_ATTR,
752 #[doc = "0x13a8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
753 pub tcd29_nbytes_mlno: TCD29_NBYTES_MLNO,
754 #[doc = "0x13ac - TCD Last Source Address Adjustment"]
755 pub tcd29_slast: TCD29_SLAST,
756 #[doc = "0x13b0 - TCD Destination Address"]
757 pub tcd29_daddr: TCD29_DADDR,
758 #[doc = "0x13b4 - TCD Signed Destination Address Offset"]
759 pub tcd29_doff: TCD29_DOFF,
760 #[doc = "0x13b6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
761 pub tcd29_citer_elinkno: TCD29_CITER_ELINKNO,
762 #[doc = "0x13b8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
763 pub tcd29_dlastsga: TCD29_DLASTSGA,
764 #[doc = "0x13bc - TCD Control and Status"]
765 pub tcd29_csr: TCD29_CSR,
766 #[doc = "0x13be - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
767 pub tcd29_biter_elinkno: TCD29_BITER_ELINKNO,
768 #[doc = "0x13c0 - TCD Source Address"]
769 pub tcd30_saddr: TCD30_SADDR,
770 #[doc = "0x13c4 - TCD Signed Source Address Offset"]
771 pub tcd30_soff: TCD30_SOFF,
772 #[doc = "0x13c6 - TCD Transfer Attributes"]
773 pub tcd30_attr: TCD30_ATTR,
774 #[doc = "0x13c8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
775 pub tcd30_nbytes_mlno: TCD30_NBYTES_MLNO,
776 #[doc = "0x13cc - TCD Last Source Address Adjustment"]
777 pub tcd30_slast: TCD30_SLAST,
778 #[doc = "0x13d0 - TCD Destination Address"]
779 pub tcd30_daddr: TCD30_DADDR,
780 #[doc = "0x13d4 - TCD Signed Destination Address Offset"]
781 pub tcd30_doff: TCD30_DOFF,
782 #[doc = "0x13d6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
783 pub tcd30_citer_elinkno: TCD30_CITER_ELINKNO,
784 #[doc = "0x13d8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
785 pub tcd30_dlastsga: TCD30_DLASTSGA,
786 #[doc = "0x13dc - TCD Control and Status"]
787 pub tcd30_csr: TCD30_CSR,
788 #[doc = "0x13de - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
789 pub tcd30_biter_elinkno: TCD30_BITER_ELINKNO,
790 #[doc = "0x13e0 - TCD Source Address"]
791 pub tcd31_saddr: TCD31_SADDR,
792 #[doc = "0x13e4 - TCD Signed Source Address Offset"]
793 pub tcd31_soff: TCD31_SOFF,
794 #[doc = "0x13e6 - TCD Transfer Attributes"]
795 pub tcd31_attr: TCD31_ATTR,
796 #[doc = "0x13e8 - TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
797 pub tcd31_nbytes_mlno: TCD31_NBYTES_MLNO,
798 #[doc = "0x13ec - TCD Last Source Address Adjustment"]
799 pub tcd31_slast: TCD31_SLAST,
800 #[doc = "0x13f0 - TCD Destination Address"]
801 pub tcd31_daddr: TCD31_DADDR,
802 #[doc = "0x13f4 - TCD Signed Destination Address Offset"]
803 pub tcd31_doff: TCD31_DOFF,
804 #[doc = "0x13f6 - TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
805 pub tcd31_citer_elinkno: TCD31_CITER_ELINKNO,
806 #[doc = "0x13f8 - TCD Last Destination Address Adjustment/Scatter Gather Address"]
807 pub tcd31_dlastsga: TCD31_DLASTSGA,
808 #[doc = "0x13fc - TCD Control and Status"]
809 pub tcd31_csr: TCD31_CSR,
810 #[doc = "0x13fe - TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
811 pub tcd31_biter_elinkno: TCD31_BITER_ELINKNO,
812}
813#[doc = "Control Register"]
814pub struct CR {
815 register: VolatileCell<u32>,
816}
817#[doc = "Control Register"]
818pub mod cr;
819#[doc = "Error Status Register"]
820pub struct ES {
821 register: VolatileCell<u32>,
822}
823#[doc = "Error Status Register"]
824pub mod es;
825#[doc = "Enable Request Register"]
826pub struct ERQ {
827 register: VolatileCell<u32>,
828}
829#[doc = "Enable Request Register"]
830pub mod erq;
831#[doc = "Enable Error Interrupt Register"]
832pub struct EEI {
833 register: VolatileCell<u32>,
834}
835#[doc = "Enable Error Interrupt Register"]
836pub mod eei;
837#[doc = "Clear Enable Error Interrupt Register"]
838pub struct CEEI {
839 register: VolatileCell<u8>,
840}
841#[doc = "Clear Enable Error Interrupt Register"]
842pub mod ceei;
843#[doc = "Set Enable Error Interrupt Register"]
844pub struct SEEI {
845 register: VolatileCell<u8>,
846}
847#[doc = "Set Enable Error Interrupt Register"]
848pub mod seei;
849#[doc = "Clear Enable Request Register"]
850pub struct CERQ {
851 register: VolatileCell<u8>,
852}
853#[doc = "Clear Enable Request Register"]
854pub mod cerq;
855#[doc = "Set Enable Request Register"]
856pub struct SERQ {
857 register: VolatileCell<u8>,
858}
859#[doc = "Set Enable Request Register"]
860pub mod serq;
861#[doc = "Clear DONE Status Bit Register"]
862pub struct CDNE {
863 register: VolatileCell<u8>,
864}
865#[doc = "Clear DONE Status Bit Register"]
866pub mod cdne;
867#[doc = "Set START Bit Register"]
868pub struct SSRT {
869 register: VolatileCell<u8>,
870}
871#[doc = "Set START Bit Register"]
872pub mod ssrt;
873#[doc = "Clear Error Register"]
874pub struct CERR {
875 register: VolatileCell<u8>,
876}
877#[doc = "Clear Error Register"]
878pub mod cerr;
879#[doc = "Clear Interrupt Request Register"]
880pub struct CINT {
881 register: VolatileCell<u8>,
882}
883#[doc = "Clear Interrupt Request Register"]
884pub mod cint;
885#[doc = "Interrupt Request Register"]
886pub struct INT {
887 register: VolatileCell<u32>,
888}
889#[doc = "Interrupt Request Register"]
890pub mod int;
891#[doc = "Error Register"]
892pub struct ERR {
893 register: VolatileCell<u32>,
894}
895#[doc = "Error Register"]
896pub mod err;
897#[doc = "Hardware Request Status Register"]
898pub struct HRS {
899 register: VolatileCell<u32>,
900}
901#[doc = "Hardware Request Status Register"]
902pub mod hrs;
903#[doc = "Enable Asynchronous Request in Stop Register"]
904pub struct EARS {
905 register: VolatileCell<u32>,
906}
907#[doc = "Enable Asynchronous Request in Stop Register"]
908pub mod ears;
909#[doc = "Channel n Priority Register"]
910pub struct DCHPRI3 {
911 register: VolatileCell<u8>,
912}
913#[doc = "Channel n Priority Register"]
914pub mod dchpri3;
915#[doc = "Channel n Priority Register"]
916pub struct DCHPRI2 {
917 register: VolatileCell<u8>,
918}
919#[doc = "Channel n Priority Register"]
920pub mod dchpri2;
921#[doc = "Channel n Priority Register"]
922pub struct DCHPRI1 {
923 register: VolatileCell<u8>,
924}
925#[doc = "Channel n Priority Register"]
926pub mod dchpri1;
927#[doc = "Channel n Priority Register"]
928pub struct DCHPRI0 {
929 register: VolatileCell<u8>,
930}
931#[doc = "Channel n Priority Register"]
932pub mod dchpri0;
933#[doc = "Channel n Priority Register"]
934pub struct DCHPRI7 {
935 register: VolatileCell<u8>,
936}
937#[doc = "Channel n Priority Register"]
938pub mod dchpri7;
939#[doc = "Channel n Priority Register"]
940pub struct DCHPRI6 {
941 register: VolatileCell<u8>,
942}
943#[doc = "Channel n Priority Register"]
944pub mod dchpri6;
945#[doc = "Channel n Priority Register"]
946pub struct DCHPRI5 {
947 register: VolatileCell<u8>,
948}
949#[doc = "Channel n Priority Register"]
950pub mod dchpri5;
951#[doc = "Channel n Priority Register"]
952pub struct DCHPRI4 {
953 register: VolatileCell<u8>,
954}
955#[doc = "Channel n Priority Register"]
956pub mod dchpri4;
957#[doc = "Channel n Priority Register"]
958pub struct DCHPRI11 {
959 register: VolatileCell<u8>,
960}
961#[doc = "Channel n Priority Register"]
962pub mod dchpri11;
963#[doc = "Channel n Priority Register"]
964pub struct DCHPRI10 {
965 register: VolatileCell<u8>,
966}
967#[doc = "Channel n Priority Register"]
968pub mod dchpri10;
969#[doc = "Channel n Priority Register"]
970pub struct DCHPRI9 {
971 register: VolatileCell<u8>,
972}
973#[doc = "Channel n Priority Register"]
974pub mod dchpri9;
975#[doc = "Channel n Priority Register"]
976pub struct DCHPRI8 {
977 register: VolatileCell<u8>,
978}
979#[doc = "Channel n Priority Register"]
980pub mod dchpri8;
981#[doc = "Channel n Priority Register"]
982pub struct DCHPRI15 {
983 register: VolatileCell<u8>,
984}
985#[doc = "Channel n Priority Register"]
986pub mod dchpri15;
987#[doc = "Channel n Priority Register"]
988pub struct DCHPRI14 {
989 register: VolatileCell<u8>,
990}
991#[doc = "Channel n Priority Register"]
992pub mod dchpri14;
993#[doc = "Channel n Priority Register"]
994pub struct DCHPRI13 {
995 register: VolatileCell<u8>,
996}
997#[doc = "Channel n Priority Register"]
998pub mod dchpri13;
999#[doc = "Channel n Priority Register"]
1000pub struct DCHPRI12 {
1001 register: VolatileCell<u8>,
1002}
1003#[doc = "Channel n Priority Register"]
1004pub mod dchpri12;
1005#[doc = "Channel n Priority Register"]
1006pub struct DCHPRI19 {
1007 register: VolatileCell<u8>,
1008}
1009#[doc = "Channel n Priority Register"]
1010pub mod dchpri19;
1011#[doc = "Channel n Priority Register"]
1012pub struct DCHPRI18 {
1013 register: VolatileCell<u8>,
1014}
1015#[doc = "Channel n Priority Register"]
1016pub mod dchpri18;
1017#[doc = "Channel n Priority Register"]
1018pub struct DCHPRI17 {
1019 register: VolatileCell<u8>,
1020}
1021#[doc = "Channel n Priority Register"]
1022pub mod dchpri17;
1023#[doc = "Channel n Priority Register"]
1024pub struct DCHPRI16 {
1025 register: VolatileCell<u8>,
1026}
1027#[doc = "Channel n Priority Register"]
1028pub mod dchpri16;
1029#[doc = "Channel n Priority Register"]
1030pub struct DCHPRI23 {
1031 register: VolatileCell<u8>,
1032}
1033#[doc = "Channel n Priority Register"]
1034pub mod dchpri23;
1035#[doc = "Channel n Priority Register"]
1036pub struct DCHPRI22 {
1037 register: VolatileCell<u8>,
1038}
1039#[doc = "Channel n Priority Register"]
1040pub mod dchpri22;
1041#[doc = "Channel n Priority Register"]
1042pub struct DCHPRI21 {
1043 register: VolatileCell<u8>,
1044}
1045#[doc = "Channel n Priority Register"]
1046pub mod dchpri21;
1047#[doc = "Channel n Priority Register"]
1048pub struct DCHPRI20 {
1049 register: VolatileCell<u8>,
1050}
1051#[doc = "Channel n Priority Register"]
1052pub mod dchpri20;
1053#[doc = "Channel n Priority Register"]
1054pub struct DCHPRI27 {
1055 register: VolatileCell<u8>,
1056}
1057#[doc = "Channel n Priority Register"]
1058pub mod dchpri27;
1059#[doc = "Channel n Priority Register"]
1060pub struct DCHPRI26 {
1061 register: VolatileCell<u8>,
1062}
1063#[doc = "Channel n Priority Register"]
1064pub mod dchpri26;
1065#[doc = "Channel n Priority Register"]
1066pub struct DCHPRI25 {
1067 register: VolatileCell<u8>,
1068}
1069#[doc = "Channel n Priority Register"]
1070pub mod dchpri25;
1071#[doc = "Channel n Priority Register"]
1072pub struct DCHPRI24 {
1073 register: VolatileCell<u8>,
1074}
1075#[doc = "Channel n Priority Register"]
1076pub mod dchpri24;
1077#[doc = "Channel n Priority Register"]
1078pub struct DCHPRI31 {
1079 register: VolatileCell<u8>,
1080}
1081#[doc = "Channel n Priority Register"]
1082pub mod dchpri31;
1083#[doc = "Channel n Priority Register"]
1084pub struct DCHPRI30 {
1085 register: VolatileCell<u8>,
1086}
1087#[doc = "Channel n Priority Register"]
1088pub mod dchpri30;
1089#[doc = "Channel n Priority Register"]
1090pub struct DCHPRI29 {
1091 register: VolatileCell<u8>,
1092}
1093#[doc = "Channel n Priority Register"]
1094pub mod dchpri29;
1095#[doc = "Channel n Priority Register"]
1096pub struct DCHPRI28 {
1097 register: VolatileCell<u8>,
1098}
1099#[doc = "Channel n Priority Register"]
1100pub mod dchpri28;
1101#[doc = "TCD Source Address"]
1102pub struct TCD0_SADDR {
1103 register: VolatileCell<u32>,
1104}
1105#[doc = "TCD Source Address"]
1106pub mod tcd0_saddr;
1107#[doc = "TCD Signed Source Address Offset"]
1108pub struct TCD0_SOFF {
1109 register: VolatileCell<u16>,
1110}
1111#[doc = "TCD Signed Source Address Offset"]
1112pub mod tcd0_soff;
1113#[doc = "TCD Transfer Attributes"]
1114pub struct TCD0_ATTR {
1115 register: VolatileCell<u16>,
1116}
1117#[doc = "TCD Transfer Attributes"]
1118pub mod tcd0_attr;
1119#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1120pub struct TCD0_NBYTES_MLNO {
1121 register: VolatileCell<u32>,
1122}
1123#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1124pub mod tcd0_nbytes_mlno;
1125#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1126pub struct TCD0_NBYTES_MLOFFNO {
1127 register: VolatileCell<u32>,
1128}
1129#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1130pub mod tcd0_nbytes_mloffno;
1131#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1132pub struct TCD0_NBYTES_MLOFFYES {
1133 register: VolatileCell<u32>,
1134}
1135#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1136pub mod tcd0_nbytes_mloffyes;
1137#[doc = "TCD Last Source Address Adjustment"]
1138pub struct TCD0_SLAST {
1139 register: VolatileCell<u32>,
1140}
1141#[doc = "TCD Last Source Address Adjustment"]
1142pub mod tcd0_slast;
1143#[doc = "TCD Destination Address"]
1144pub struct TCD0_DADDR {
1145 register: VolatileCell<u32>,
1146}
1147#[doc = "TCD Destination Address"]
1148pub mod tcd0_daddr;
1149#[doc = "TCD Signed Destination Address Offset"]
1150pub struct TCD0_DOFF {
1151 register: VolatileCell<u16>,
1152}
1153#[doc = "TCD Signed Destination Address Offset"]
1154pub mod tcd0_doff;
1155#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1156pub struct TCD0_CITER_ELINKNO {
1157 register: VolatileCell<u16>,
1158}
1159#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1160pub mod tcd0_citer_elinkno;
1161#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1162pub struct TCD0_CITER_ELINKYES {
1163 register: VolatileCell<u16>,
1164}
1165#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1166pub mod tcd0_citer_elinkyes;
1167#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1168pub struct TCD0_DLASTSGA {
1169 register: VolatileCell<u32>,
1170}
1171#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1172pub mod tcd0_dlastsga;
1173#[doc = "TCD Control and Status"]
1174pub struct TCD0_CSR {
1175 register: VolatileCell<u16>,
1176}
1177#[doc = "TCD Control and Status"]
1178pub mod tcd0_csr;
1179#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1180pub struct TCD0_BITER_ELINKNO {
1181 register: VolatileCell<u16>,
1182}
1183#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1184pub mod tcd0_biter_elinkno;
1185#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1186pub struct TCD0_BITER_ELINKYES {
1187 register: VolatileCell<u16>,
1188}
1189#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1190pub mod tcd0_biter_elinkyes;
1191#[doc = "TCD Source Address"]
1192pub struct TCD1_SADDR {
1193 register: VolatileCell<u32>,
1194}
1195#[doc = "TCD Source Address"]
1196pub mod tcd1_saddr;
1197#[doc = "TCD Signed Source Address Offset"]
1198pub struct TCD1_SOFF {
1199 register: VolatileCell<u16>,
1200}
1201#[doc = "TCD Signed Source Address Offset"]
1202pub mod tcd1_soff;
1203#[doc = "TCD Transfer Attributes"]
1204pub struct TCD1_ATTR {
1205 register: VolatileCell<u16>,
1206}
1207#[doc = "TCD Transfer Attributes"]
1208pub mod tcd1_attr;
1209#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1210pub struct TCD1_NBYTES_MLNO {
1211 register: VolatileCell<u32>,
1212}
1213#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1214pub mod tcd1_nbytes_mlno;
1215#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1216pub struct TCD1_NBYTES_MLOFFNO {
1217 register: VolatileCell<u32>,
1218}
1219#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1220pub mod tcd1_nbytes_mloffno;
1221#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1222pub struct TCD1_NBYTES_MLOFFYES {
1223 register: VolatileCell<u32>,
1224}
1225#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1226pub mod tcd1_nbytes_mloffyes;
1227#[doc = "TCD Last Source Address Adjustment"]
1228pub struct TCD1_SLAST {
1229 register: VolatileCell<u32>,
1230}
1231#[doc = "TCD Last Source Address Adjustment"]
1232pub mod tcd1_slast;
1233#[doc = "TCD Destination Address"]
1234pub struct TCD1_DADDR {
1235 register: VolatileCell<u32>,
1236}
1237#[doc = "TCD Destination Address"]
1238pub mod tcd1_daddr;
1239#[doc = "TCD Signed Destination Address Offset"]
1240pub struct TCD1_DOFF {
1241 register: VolatileCell<u16>,
1242}
1243#[doc = "TCD Signed Destination Address Offset"]
1244pub mod tcd1_doff;
1245#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1246pub struct TCD1_CITER_ELINKNO {
1247 register: VolatileCell<u16>,
1248}
1249#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1250pub mod tcd1_citer_elinkno;
1251#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1252pub struct TCD1_CITER_ELINKYES {
1253 register: VolatileCell<u16>,
1254}
1255#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1256pub mod tcd1_citer_elinkyes;
1257#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1258pub struct TCD1_DLASTSGA {
1259 register: VolatileCell<u32>,
1260}
1261#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1262pub mod tcd1_dlastsga;
1263#[doc = "TCD Control and Status"]
1264pub struct TCD1_CSR {
1265 register: VolatileCell<u16>,
1266}
1267#[doc = "TCD Control and Status"]
1268pub mod tcd1_csr;
1269#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1270pub struct TCD1_BITER_ELINKNO {
1271 register: VolatileCell<u16>,
1272}
1273#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1274pub mod tcd1_biter_elinkno;
1275#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1276pub struct TCD1_BITER_ELINKYES {
1277 register: VolatileCell<u16>,
1278}
1279#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1280pub mod tcd1_biter_elinkyes;
1281#[doc = "TCD Source Address"]
1282pub struct TCD2_SADDR {
1283 register: VolatileCell<u32>,
1284}
1285#[doc = "TCD Source Address"]
1286pub mod tcd2_saddr;
1287#[doc = "TCD Signed Source Address Offset"]
1288pub struct TCD2_SOFF {
1289 register: VolatileCell<u16>,
1290}
1291#[doc = "TCD Signed Source Address Offset"]
1292pub mod tcd2_soff;
1293#[doc = "TCD Transfer Attributes"]
1294pub struct TCD2_ATTR {
1295 register: VolatileCell<u16>,
1296}
1297#[doc = "TCD Transfer Attributes"]
1298pub mod tcd2_attr;
1299#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1300pub struct TCD2_NBYTES_MLNO {
1301 register: VolatileCell<u32>,
1302}
1303#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1304pub mod tcd2_nbytes_mlno;
1305#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1306pub struct TCD2_NBYTES_MLOFFNO {
1307 register: VolatileCell<u32>,
1308}
1309#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1310pub mod tcd2_nbytes_mloffno;
1311#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1312pub struct TCD2_NBYTES_MLOFFYES {
1313 register: VolatileCell<u32>,
1314}
1315#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1316pub mod tcd2_nbytes_mloffyes;
1317#[doc = "TCD Last Source Address Adjustment"]
1318pub struct TCD2_SLAST {
1319 register: VolatileCell<u32>,
1320}
1321#[doc = "TCD Last Source Address Adjustment"]
1322pub mod tcd2_slast;
1323#[doc = "TCD Destination Address"]
1324pub struct TCD2_DADDR {
1325 register: VolatileCell<u32>,
1326}
1327#[doc = "TCD Destination Address"]
1328pub mod tcd2_daddr;
1329#[doc = "TCD Signed Destination Address Offset"]
1330pub struct TCD2_DOFF {
1331 register: VolatileCell<u16>,
1332}
1333#[doc = "TCD Signed Destination Address Offset"]
1334pub mod tcd2_doff;
1335#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1336pub struct TCD2_CITER_ELINKNO {
1337 register: VolatileCell<u16>,
1338}
1339#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1340pub mod tcd2_citer_elinkno;
1341#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1342pub struct TCD2_CITER_ELINKYES {
1343 register: VolatileCell<u16>,
1344}
1345#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1346pub mod tcd2_citer_elinkyes;
1347#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1348pub struct TCD2_DLASTSGA {
1349 register: VolatileCell<u32>,
1350}
1351#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1352pub mod tcd2_dlastsga;
1353#[doc = "TCD Control and Status"]
1354pub struct TCD2_CSR {
1355 register: VolatileCell<u16>,
1356}
1357#[doc = "TCD Control and Status"]
1358pub mod tcd2_csr;
1359#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1360pub struct TCD2_BITER_ELINKNO {
1361 register: VolatileCell<u16>,
1362}
1363#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1364pub mod tcd2_biter_elinkno;
1365#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1366pub struct TCD2_BITER_ELINKYES {
1367 register: VolatileCell<u16>,
1368}
1369#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1370pub mod tcd2_biter_elinkyes;
1371#[doc = "TCD Source Address"]
1372pub struct TCD3_SADDR {
1373 register: VolatileCell<u32>,
1374}
1375#[doc = "TCD Source Address"]
1376pub mod tcd3_saddr;
1377#[doc = "TCD Signed Source Address Offset"]
1378pub struct TCD3_SOFF {
1379 register: VolatileCell<u16>,
1380}
1381#[doc = "TCD Signed Source Address Offset"]
1382pub mod tcd3_soff;
1383#[doc = "TCD Transfer Attributes"]
1384pub struct TCD3_ATTR {
1385 register: VolatileCell<u16>,
1386}
1387#[doc = "TCD Transfer Attributes"]
1388pub mod tcd3_attr;
1389#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1390pub struct TCD3_NBYTES_MLNO {
1391 register: VolatileCell<u32>,
1392}
1393#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1394pub mod tcd3_nbytes_mlno;
1395#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1396pub struct TCD3_NBYTES_MLOFFNO {
1397 register: VolatileCell<u32>,
1398}
1399#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1400pub mod tcd3_nbytes_mloffno;
1401#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1402pub struct TCD3_NBYTES_MLOFFYES {
1403 register: VolatileCell<u32>,
1404}
1405#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1406pub mod tcd3_nbytes_mloffyes;
1407#[doc = "TCD Last Source Address Adjustment"]
1408pub struct TCD3_SLAST {
1409 register: VolatileCell<u32>,
1410}
1411#[doc = "TCD Last Source Address Adjustment"]
1412pub mod tcd3_slast;
1413#[doc = "TCD Destination Address"]
1414pub struct TCD3_DADDR {
1415 register: VolatileCell<u32>,
1416}
1417#[doc = "TCD Destination Address"]
1418pub mod tcd3_daddr;
1419#[doc = "TCD Signed Destination Address Offset"]
1420pub struct TCD3_DOFF {
1421 register: VolatileCell<u16>,
1422}
1423#[doc = "TCD Signed Destination Address Offset"]
1424pub mod tcd3_doff;
1425#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1426pub struct TCD3_CITER_ELINKNO {
1427 register: VolatileCell<u16>,
1428}
1429#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1430pub mod tcd3_citer_elinkno;
1431#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1432pub struct TCD3_CITER_ELINKYES {
1433 register: VolatileCell<u16>,
1434}
1435#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1436pub mod tcd3_citer_elinkyes;
1437#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1438pub struct TCD3_DLASTSGA {
1439 register: VolatileCell<u32>,
1440}
1441#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1442pub mod tcd3_dlastsga;
1443#[doc = "TCD Control and Status"]
1444pub struct TCD3_CSR {
1445 register: VolatileCell<u16>,
1446}
1447#[doc = "TCD Control and Status"]
1448pub mod tcd3_csr;
1449#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1450pub struct TCD3_BITER_ELINKNO {
1451 register: VolatileCell<u16>,
1452}
1453#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1454pub mod tcd3_biter_elinkno;
1455#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1456pub struct TCD3_BITER_ELINKYES {
1457 register: VolatileCell<u16>,
1458}
1459#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1460pub mod tcd3_biter_elinkyes;
1461#[doc = "TCD Source Address"]
1462pub struct TCD4_SADDR {
1463 register: VolatileCell<u32>,
1464}
1465#[doc = "TCD Source Address"]
1466pub mod tcd4_saddr;
1467#[doc = "TCD Signed Source Address Offset"]
1468pub struct TCD4_SOFF {
1469 register: VolatileCell<u16>,
1470}
1471#[doc = "TCD Signed Source Address Offset"]
1472pub mod tcd4_soff;
1473#[doc = "TCD Transfer Attributes"]
1474pub struct TCD4_ATTR {
1475 register: VolatileCell<u16>,
1476}
1477#[doc = "TCD Transfer Attributes"]
1478pub mod tcd4_attr;
1479#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1480pub struct TCD4_NBYTES_MLNO {
1481 register: VolatileCell<u32>,
1482}
1483#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1484pub mod tcd4_nbytes_mlno;
1485#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1486pub struct TCD4_NBYTES_MLOFFNO {
1487 register: VolatileCell<u32>,
1488}
1489#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1490pub mod tcd4_nbytes_mloffno;
1491#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1492pub struct TCD4_NBYTES_MLOFFYES {
1493 register: VolatileCell<u32>,
1494}
1495#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1496pub mod tcd4_nbytes_mloffyes;
1497#[doc = "TCD Last Source Address Adjustment"]
1498pub struct TCD4_SLAST {
1499 register: VolatileCell<u32>,
1500}
1501#[doc = "TCD Last Source Address Adjustment"]
1502pub mod tcd4_slast;
1503#[doc = "TCD Destination Address"]
1504pub struct TCD4_DADDR {
1505 register: VolatileCell<u32>,
1506}
1507#[doc = "TCD Destination Address"]
1508pub mod tcd4_daddr;
1509#[doc = "TCD Signed Destination Address Offset"]
1510pub struct TCD4_DOFF {
1511 register: VolatileCell<u16>,
1512}
1513#[doc = "TCD Signed Destination Address Offset"]
1514pub mod tcd4_doff;
1515#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1516pub struct TCD4_CITER_ELINKNO {
1517 register: VolatileCell<u16>,
1518}
1519#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1520pub mod tcd4_citer_elinkno;
1521#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1522pub struct TCD4_CITER_ELINKYES {
1523 register: VolatileCell<u16>,
1524}
1525#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1526pub mod tcd4_citer_elinkyes;
1527#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1528pub struct TCD4_DLASTSGA {
1529 register: VolatileCell<u32>,
1530}
1531#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1532pub mod tcd4_dlastsga;
1533#[doc = "TCD Control and Status"]
1534pub struct TCD4_CSR {
1535 register: VolatileCell<u16>,
1536}
1537#[doc = "TCD Control and Status"]
1538pub mod tcd4_csr;
1539#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1540pub struct TCD4_BITER_ELINKNO {
1541 register: VolatileCell<u16>,
1542}
1543#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1544pub mod tcd4_biter_elinkno;
1545#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1546pub struct TCD4_BITER_ELINKYES {
1547 register: VolatileCell<u16>,
1548}
1549#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1550pub mod tcd4_biter_elinkyes;
1551#[doc = "TCD Source Address"]
1552pub struct TCD5_SADDR {
1553 register: VolatileCell<u32>,
1554}
1555#[doc = "TCD Source Address"]
1556pub mod tcd5_saddr;
1557#[doc = "TCD Signed Source Address Offset"]
1558pub struct TCD5_SOFF {
1559 register: VolatileCell<u16>,
1560}
1561#[doc = "TCD Signed Source Address Offset"]
1562pub mod tcd5_soff;
1563#[doc = "TCD Transfer Attributes"]
1564pub struct TCD5_ATTR {
1565 register: VolatileCell<u16>,
1566}
1567#[doc = "TCD Transfer Attributes"]
1568pub mod tcd5_attr;
1569#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1570pub struct TCD5_NBYTES_MLNO {
1571 register: VolatileCell<u32>,
1572}
1573#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1574pub mod tcd5_nbytes_mlno;
1575#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1576pub struct TCD5_NBYTES_MLOFFNO {
1577 register: VolatileCell<u32>,
1578}
1579#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1580pub mod tcd5_nbytes_mloffno;
1581#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1582pub struct TCD5_NBYTES_MLOFFYES {
1583 register: VolatileCell<u32>,
1584}
1585#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1586pub mod tcd5_nbytes_mloffyes;
1587#[doc = "TCD Last Source Address Adjustment"]
1588pub struct TCD5_SLAST {
1589 register: VolatileCell<u32>,
1590}
1591#[doc = "TCD Last Source Address Adjustment"]
1592pub mod tcd5_slast;
1593#[doc = "TCD Destination Address"]
1594pub struct TCD5_DADDR {
1595 register: VolatileCell<u32>,
1596}
1597#[doc = "TCD Destination Address"]
1598pub mod tcd5_daddr;
1599#[doc = "TCD Signed Destination Address Offset"]
1600pub struct TCD5_DOFF {
1601 register: VolatileCell<u16>,
1602}
1603#[doc = "TCD Signed Destination Address Offset"]
1604pub mod tcd5_doff;
1605#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1606pub struct TCD5_CITER_ELINKNO {
1607 register: VolatileCell<u16>,
1608}
1609#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1610pub mod tcd5_citer_elinkno;
1611#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1612pub struct TCD5_CITER_ELINKYES {
1613 register: VolatileCell<u16>,
1614}
1615#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1616pub mod tcd5_citer_elinkyes;
1617#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1618pub struct TCD5_DLASTSGA {
1619 register: VolatileCell<u32>,
1620}
1621#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1622pub mod tcd5_dlastsga;
1623#[doc = "TCD Control and Status"]
1624pub struct TCD5_CSR {
1625 register: VolatileCell<u16>,
1626}
1627#[doc = "TCD Control and Status"]
1628pub mod tcd5_csr;
1629#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1630pub struct TCD5_BITER_ELINKNO {
1631 register: VolatileCell<u16>,
1632}
1633#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1634pub mod tcd5_biter_elinkno;
1635#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1636pub struct TCD5_BITER_ELINKYES {
1637 register: VolatileCell<u16>,
1638}
1639#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1640pub mod tcd5_biter_elinkyes;
1641#[doc = "TCD Source Address"]
1642pub struct TCD6_SADDR {
1643 register: VolatileCell<u32>,
1644}
1645#[doc = "TCD Source Address"]
1646pub mod tcd6_saddr;
1647#[doc = "TCD Signed Source Address Offset"]
1648pub struct TCD6_SOFF {
1649 register: VolatileCell<u16>,
1650}
1651#[doc = "TCD Signed Source Address Offset"]
1652pub mod tcd6_soff;
1653#[doc = "TCD Transfer Attributes"]
1654pub struct TCD6_ATTR {
1655 register: VolatileCell<u16>,
1656}
1657#[doc = "TCD Transfer Attributes"]
1658pub mod tcd6_attr;
1659#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1660pub struct TCD6_NBYTES_MLNO {
1661 register: VolatileCell<u32>,
1662}
1663#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1664pub mod tcd6_nbytes_mlno;
1665#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1666pub struct TCD6_NBYTES_MLOFFNO {
1667 register: VolatileCell<u32>,
1668}
1669#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1670pub mod tcd6_nbytes_mloffno;
1671#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1672pub struct TCD6_NBYTES_MLOFFYES {
1673 register: VolatileCell<u32>,
1674}
1675#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1676pub mod tcd6_nbytes_mloffyes;
1677#[doc = "TCD Last Source Address Adjustment"]
1678pub struct TCD6_SLAST {
1679 register: VolatileCell<u32>,
1680}
1681#[doc = "TCD Last Source Address Adjustment"]
1682pub mod tcd6_slast;
1683#[doc = "TCD Destination Address"]
1684pub struct TCD6_DADDR {
1685 register: VolatileCell<u32>,
1686}
1687#[doc = "TCD Destination Address"]
1688pub mod tcd6_daddr;
1689#[doc = "TCD Signed Destination Address Offset"]
1690pub struct TCD6_DOFF {
1691 register: VolatileCell<u16>,
1692}
1693#[doc = "TCD Signed Destination Address Offset"]
1694pub mod tcd6_doff;
1695#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1696pub struct TCD6_CITER_ELINKNO {
1697 register: VolatileCell<u16>,
1698}
1699#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1700pub mod tcd6_citer_elinkno;
1701#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1702pub struct TCD6_CITER_ELINKYES {
1703 register: VolatileCell<u16>,
1704}
1705#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1706pub mod tcd6_citer_elinkyes;
1707#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1708pub struct TCD6_DLASTSGA {
1709 register: VolatileCell<u32>,
1710}
1711#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1712pub mod tcd6_dlastsga;
1713#[doc = "TCD Control and Status"]
1714pub struct TCD6_CSR {
1715 register: VolatileCell<u16>,
1716}
1717#[doc = "TCD Control and Status"]
1718pub mod tcd6_csr;
1719#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1720pub struct TCD6_BITER_ELINKNO {
1721 register: VolatileCell<u16>,
1722}
1723#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1724pub mod tcd6_biter_elinkno;
1725#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1726pub struct TCD6_BITER_ELINKYES {
1727 register: VolatileCell<u16>,
1728}
1729#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1730pub mod tcd6_biter_elinkyes;
1731#[doc = "TCD Source Address"]
1732pub struct TCD7_SADDR {
1733 register: VolatileCell<u32>,
1734}
1735#[doc = "TCD Source Address"]
1736pub mod tcd7_saddr;
1737#[doc = "TCD Signed Source Address Offset"]
1738pub struct TCD7_SOFF {
1739 register: VolatileCell<u16>,
1740}
1741#[doc = "TCD Signed Source Address Offset"]
1742pub mod tcd7_soff;
1743#[doc = "TCD Transfer Attributes"]
1744pub struct TCD7_ATTR {
1745 register: VolatileCell<u16>,
1746}
1747#[doc = "TCD Transfer Attributes"]
1748pub mod tcd7_attr;
1749#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1750pub struct TCD7_NBYTES_MLNO {
1751 register: VolatileCell<u32>,
1752}
1753#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1754pub mod tcd7_nbytes_mlno;
1755#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1756pub struct TCD7_NBYTES_MLOFFNO {
1757 register: VolatileCell<u32>,
1758}
1759#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1760pub mod tcd7_nbytes_mloffno;
1761#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1762pub struct TCD7_NBYTES_MLOFFYES {
1763 register: VolatileCell<u32>,
1764}
1765#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1766pub mod tcd7_nbytes_mloffyes;
1767#[doc = "TCD Last Source Address Adjustment"]
1768pub struct TCD7_SLAST {
1769 register: VolatileCell<u32>,
1770}
1771#[doc = "TCD Last Source Address Adjustment"]
1772pub mod tcd7_slast;
1773#[doc = "TCD Destination Address"]
1774pub struct TCD7_DADDR {
1775 register: VolatileCell<u32>,
1776}
1777#[doc = "TCD Destination Address"]
1778pub mod tcd7_daddr;
1779#[doc = "TCD Signed Destination Address Offset"]
1780pub struct TCD7_DOFF {
1781 register: VolatileCell<u16>,
1782}
1783#[doc = "TCD Signed Destination Address Offset"]
1784pub mod tcd7_doff;
1785#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1786pub struct TCD7_CITER_ELINKNO {
1787 register: VolatileCell<u16>,
1788}
1789#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1790pub mod tcd7_citer_elinkno;
1791#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1792pub struct TCD7_CITER_ELINKYES {
1793 register: VolatileCell<u16>,
1794}
1795#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1796pub mod tcd7_citer_elinkyes;
1797#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1798pub struct TCD7_DLASTSGA {
1799 register: VolatileCell<u32>,
1800}
1801#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1802pub mod tcd7_dlastsga;
1803#[doc = "TCD Control and Status"]
1804pub struct TCD7_CSR {
1805 register: VolatileCell<u16>,
1806}
1807#[doc = "TCD Control and Status"]
1808pub mod tcd7_csr;
1809#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1810pub struct TCD7_BITER_ELINKNO {
1811 register: VolatileCell<u16>,
1812}
1813#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1814pub mod tcd7_biter_elinkno;
1815#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1816pub struct TCD7_BITER_ELINKYES {
1817 register: VolatileCell<u16>,
1818}
1819#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1820pub mod tcd7_biter_elinkyes;
1821#[doc = "TCD Source Address"]
1822pub struct TCD8_SADDR {
1823 register: VolatileCell<u32>,
1824}
1825#[doc = "TCD Source Address"]
1826pub mod tcd8_saddr;
1827#[doc = "TCD Signed Source Address Offset"]
1828pub struct TCD8_SOFF {
1829 register: VolatileCell<u16>,
1830}
1831#[doc = "TCD Signed Source Address Offset"]
1832pub mod tcd8_soff;
1833#[doc = "TCD Transfer Attributes"]
1834pub struct TCD8_ATTR {
1835 register: VolatileCell<u16>,
1836}
1837#[doc = "TCD Transfer Attributes"]
1838pub mod tcd8_attr;
1839#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1840pub struct TCD8_NBYTES_MLNO {
1841 register: VolatileCell<u32>,
1842}
1843#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1844pub mod tcd8_nbytes_mlno;
1845#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1846pub struct TCD8_NBYTES_MLOFFNO {
1847 register: VolatileCell<u32>,
1848}
1849#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1850pub mod tcd8_nbytes_mloffno;
1851#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1852pub struct TCD8_NBYTES_MLOFFYES {
1853 register: VolatileCell<u32>,
1854}
1855#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1856pub mod tcd8_nbytes_mloffyes;
1857#[doc = "TCD Last Source Address Adjustment"]
1858pub struct TCD8_SLAST {
1859 register: VolatileCell<u32>,
1860}
1861#[doc = "TCD Last Source Address Adjustment"]
1862pub mod tcd8_slast;
1863#[doc = "TCD Destination Address"]
1864pub struct TCD8_DADDR {
1865 register: VolatileCell<u32>,
1866}
1867#[doc = "TCD Destination Address"]
1868pub mod tcd8_daddr;
1869#[doc = "TCD Signed Destination Address Offset"]
1870pub struct TCD8_DOFF {
1871 register: VolatileCell<u16>,
1872}
1873#[doc = "TCD Signed Destination Address Offset"]
1874pub mod tcd8_doff;
1875#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1876pub struct TCD8_CITER_ELINKNO {
1877 register: VolatileCell<u16>,
1878}
1879#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1880pub mod tcd8_citer_elinkno;
1881#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1882pub struct TCD8_CITER_ELINKYES {
1883 register: VolatileCell<u16>,
1884}
1885#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1886pub mod tcd8_citer_elinkyes;
1887#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1888pub struct TCD8_DLASTSGA {
1889 register: VolatileCell<u32>,
1890}
1891#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1892pub mod tcd8_dlastsga;
1893#[doc = "TCD Control and Status"]
1894pub struct TCD8_CSR {
1895 register: VolatileCell<u16>,
1896}
1897#[doc = "TCD Control and Status"]
1898pub mod tcd8_csr;
1899#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1900pub struct TCD8_BITER_ELINKNO {
1901 register: VolatileCell<u16>,
1902}
1903#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1904pub mod tcd8_biter_elinkno;
1905#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1906pub struct TCD8_BITER_ELINKYES {
1907 register: VolatileCell<u16>,
1908}
1909#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1910pub mod tcd8_biter_elinkyes;
1911#[doc = "TCD Source Address"]
1912pub struct TCD9_SADDR {
1913 register: VolatileCell<u32>,
1914}
1915#[doc = "TCD Source Address"]
1916pub mod tcd9_saddr;
1917#[doc = "TCD Signed Source Address Offset"]
1918pub struct TCD9_SOFF {
1919 register: VolatileCell<u16>,
1920}
1921#[doc = "TCD Signed Source Address Offset"]
1922pub mod tcd9_soff;
1923#[doc = "TCD Transfer Attributes"]
1924pub struct TCD9_ATTR {
1925 register: VolatileCell<u16>,
1926}
1927#[doc = "TCD Transfer Attributes"]
1928pub mod tcd9_attr;
1929#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1930pub struct TCD9_NBYTES_MLNO {
1931 register: VolatileCell<u32>,
1932}
1933#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
1934pub mod tcd9_nbytes_mlno;
1935#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1936pub struct TCD9_NBYTES_MLOFFNO {
1937 register: VolatileCell<u32>,
1938}
1939#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
1940pub mod tcd9_nbytes_mloffno;
1941#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1942pub struct TCD9_NBYTES_MLOFFYES {
1943 register: VolatileCell<u32>,
1944}
1945#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
1946pub mod tcd9_nbytes_mloffyes;
1947#[doc = "TCD Last Source Address Adjustment"]
1948pub struct TCD9_SLAST {
1949 register: VolatileCell<u32>,
1950}
1951#[doc = "TCD Last Source Address Adjustment"]
1952pub mod tcd9_slast;
1953#[doc = "TCD Destination Address"]
1954pub struct TCD9_DADDR {
1955 register: VolatileCell<u32>,
1956}
1957#[doc = "TCD Destination Address"]
1958pub mod tcd9_daddr;
1959#[doc = "TCD Signed Destination Address Offset"]
1960pub struct TCD9_DOFF {
1961 register: VolatileCell<u16>,
1962}
1963#[doc = "TCD Signed Destination Address Offset"]
1964pub mod tcd9_doff;
1965#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1966pub struct TCD9_CITER_ELINKNO {
1967 register: VolatileCell<u16>,
1968}
1969#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1970pub mod tcd9_citer_elinkno;
1971#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1972pub struct TCD9_CITER_ELINKYES {
1973 register: VolatileCell<u16>,
1974}
1975#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1976pub mod tcd9_citer_elinkyes;
1977#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1978pub struct TCD9_DLASTSGA {
1979 register: VolatileCell<u32>,
1980}
1981#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
1982pub mod tcd9_dlastsga;
1983#[doc = "TCD Control and Status"]
1984pub struct TCD9_CSR {
1985 register: VolatileCell<u16>,
1986}
1987#[doc = "TCD Control and Status"]
1988pub mod tcd9_csr;
1989#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1990pub struct TCD9_BITER_ELINKNO {
1991 register: VolatileCell<u16>,
1992}
1993#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
1994pub mod tcd9_biter_elinkno;
1995#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
1996pub struct TCD9_BITER_ELINKYES {
1997 register: VolatileCell<u16>,
1998}
1999#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2000pub mod tcd9_biter_elinkyes;
2001#[doc = "TCD Source Address"]
2002pub struct TCD10_SADDR {
2003 register: VolatileCell<u32>,
2004}
2005#[doc = "TCD Source Address"]
2006pub mod tcd10_saddr;
2007#[doc = "TCD Signed Source Address Offset"]
2008pub struct TCD10_SOFF {
2009 register: VolatileCell<u16>,
2010}
2011#[doc = "TCD Signed Source Address Offset"]
2012pub mod tcd10_soff;
2013#[doc = "TCD Transfer Attributes"]
2014pub struct TCD10_ATTR {
2015 register: VolatileCell<u16>,
2016}
2017#[doc = "TCD Transfer Attributes"]
2018pub mod tcd10_attr;
2019#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2020pub struct TCD10_NBYTES_MLNO {
2021 register: VolatileCell<u32>,
2022}
2023#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2024pub mod tcd10_nbytes_mlno;
2025#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2026pub struct TCD10_NBYTES_MLOFFNO {
2027 register: VolatileCell<u32>,
2028}
2029#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2030pub mod tcd10_nbytes_mloffno;
2031#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2032pub struct TCD10_NBYTES_MLOFFYES {
2033 register: VolatileCell<u32>,
2034}
2035#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2036pub mod tcd10_nbytes_mloffyes;
2037#[doc = "TCD Last Source Address Adjustment"]
2038pub struct TCD10_SLAST {
2039 register: VolatileCell<u32>,
2040}
2041#[doc = "TCD Last Source Address Adjustment"]
2042pub mod tcd10_slast;
2043#[doc = "TCD Destination Address"]
2044pub struct TCD10_DADDR {
2045 register: VolatileCell<u32>,
2046}
2047#[doc = "TCD Destination Address"]
2048pub mod tcd10_daddr;
2049#[doc = "TCD Signed Destination Address Offset"]
2050pub struct TCD10_DOFF {
2051 register: VolatileCell<u16>,
2052}
2053#[doc = "TCD Signed Destination Address Offset"]
2054pub mod tcd10_doff;
2055#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2056pub struct TCD10_CITER_ELINKNO {
2057 register: VolatileCell<u16>,
2058}
2059#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2060pub mod tcd10_citer_elinkno;
2061#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2062pub struct TCD10_CITER_ELINKYES {
2063 register: VolatileCell<u16>,
2064}
2065#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2066pub mod tcd10_citer_elinkyes;
2067#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2068pub struct TCD10_DLASTSGA {
2069 register: VolatileCell<u32>,
2070}
2071#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2072pub mod tcd10_dlastsga;
2073#[doc = "TCD Control and Status"]
2074pub struct TCD10_CSR {
2075 register: VolatileCell<u16>,
2076}
2077#[doc = "TCD Control and Status"]
2078pub mod tcd10_csr;
2079#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2080pub struct TCD10_BITER_ELINKNO {
2081 register: VolatileCell<u16>,
2082}
2083#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2084pub mod tcd10_biter_elinkno;
2085#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2086pub struct TCD10_BITER_ELINKYES {
2087 register: VolatileCell<u16>,
2088}
2089#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2090pub mod tcd10_biter_elinkyes;
2091#[doc = "TCD Source Address"]
2092pub struct TCD11_SADDR {
2093 register: VolatileCell<u32>,
2094}
2095#[doc = "TCD Source Address"]
2096pub mod tcd11_saddr;
2097#[doc = "TCD Signed Source Address Offset"]
2098pub struct TCD11_SOFF {
2099 register: VolatileCell<u16>,
2100}
2101#[doc = "TCD Signed Source Address Offset"]
2102pub mod tcd11_soff;
2103#[doc = "TCD Transfer Attributes"]
2104pub struct TCD11_ATTR {
2105 register: VolatileCell<u16>,
2106}
2107#[doc = "TCD Transfer Attributes"]
2108pub mod tcd11_attr;
2109#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2110pub struct TCD11_NBYTES_MLNO {
2111 register: VolatileCell<u32>,
2112}
2113#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2114pub mod tcd11_nbytes_mlno;
2115#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2116pub struct TCD11_NBYTES_MLOFFNO {
2117 register: VolatileCell<u32>,
2118}
2119#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2120pub mod tcd11_nbytes_mloffno;
2121#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2122pub struct TCD11_NBYTES_MLOFFYES {
2123 register: VolatileCell<u32>,
2124}
2125#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2126pub mod tcd11_nbytes_mloffyes;
2127#[doc = "TCD Last Source Address Adjustment"]
2128pub struct TCD11_SLAST {
2129 register: VolatileCell<u32>,
2130}
2131#[doc = "TCD Last Source Address Adjustment"]
2132pub mod tcd11_slast;
2133#[doc = "TCD Destination Address"]
2134pub struct TCD11_DADDR {
2135 register: VolatileCell<u32>,
2136}
2137#[doc = "TCD Destination Address"]
2138pub mod tcd11_daddr;
2139#[doc = "TCD Signed Destination Address Offset"]
2140pub struct TCD11_DOFF {
2141 register: VolatileCell<u16>,
2142}
2143#[doc = "TCD Signed Destination Address Offset"]
2144pub mod tcd11_doff;
2145#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2146pub struct TCD11_CITER_ELINKNO {
2147 register: VolatileCell<u16>,
2148}
2149#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2150pub mod tcd11_citer_elinkno;
2151#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2152pub struct TCD11_CITER_ELINKYES {
2153 register: VolatileCell<u16>,
2154}
2155#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2156pub mod tcd11_citer_elinkyes;
2157#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2158pub struct TCD11_DLASTSGA {
2159 register: VolatileCell<u32>,
2160}
2161#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2162pub mod tcd11_dlastsga;
2163#[doc = "TCD Control and Status"]
2164pub struct TCD11_CSR {
2165 register: VolatileCell<u16>,
2166}
2167#[doc = "TCD Control and Status"]
2168pub mod tcd11_csr;
2169#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2170pub struct TCD11_BITER_ELINKNO {
2171 register: VolatileCell<u16>,
2172}
2173#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2174pub mod tcd11_biter_elinkno;
2175#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2176pub struct TCD11_BITER_ELINKYES {
2177 register: VolatileCell<u16>,
2178}
2179#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2180pub mod tcd11_biter_elinkyes;
2181#[doc = "TCD Source Address"]
2182pub struct TCD12_SADDR {
2183 register: VolatileCell<u32>,
2184}
2185#[doc = "TCD Source Address"]
2186pub mod tcd12_saddr;
2187#[doc = "TCD Signed Source Address Offset"]
2188pub struct TCD12_SOFF {
2189 register: VolatileCell<u16>,
2190}
2191#[doc = "TCD Signed Source Address Offset"]
2192pub mod tcd12_soff;
2193#[doc = "TCD Transfer Attributes"]
2194pub struct TCD12_ATTR {
2195 register: VolatileCell<u16>,
2196}
2197#[doc = "TCD Transfer Attributes"]
2198pub mod tcd12_attr;
2199#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2200pub struct TCD12_NBYTES_MLNO {
2201 register: VolatileCell<u32>,
2202}
2203#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2204pub mod tcd12_nbytes_mlno;
2205#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2206pub struct TCD12_NBYTES_MLOFFNO {
2207 register: VolatileCell<u32>,
2208}
2209#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2210pub mod tcd12_nbytes_mloffno;
2211#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2212pub struct TCD12_NBYTES_MLOFFYES {
2213 register: VolatileCell<u32>,
2214}
2215#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2216pub mod tcd12_nbytes_mloffyes;
2217#[doc = "TCD Last Source Address Adjustment"]
2218pub struct TCD12_SLAST {
2219 register: VolatileCell<u32>,
2220}
2221#[doc = "TCD Last Source Address Adjustment"]
2222pub mod tcd12_slast;
2223#[doc = "TCD Destination Address"]
2224pub struct TCD12_DADDR {
2225 register: VolatileCell<u32>,
2226}
2227#[doc = "TCD Destination Address"]
2228pub mod tcd12_daddr;
2229#[doc = "TCD Signed Destination Address Offset"]
2230pub struct TCD12_DOFF {
2231 register: VolatileCell<u16>,
2232}
2233#[doc = "TCD Signed Destination Address Offset"]
2234pub mod tcd12_doff;
2235#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2236pub struct TCD12_CITER_ELINKNO {
2237 register: VolatileCell<u16>,
2238}
2239#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2240pub mod tcd12_citer_elinkno;
2241#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2242pub struct TCD12_CITER_ELINKYES {
2243 register: VolatileCell<u16>,
2244}
2245#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2246pub mod tcd12_citer_elinkyes;
2247#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2248pub struct TCD12_DLASTSGA {
2249 register: VolatileCell<u32>,
2250}
2251#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2252pub mod tcd12_dlastsga;
2253#[doc = "TCD Control and Status"]
2254pub struct TCD12_CSR {
2255 register: VolatileCell<u16>,
2256}
2257#[doc = "TCD Control and Status"]
2258pub mod tcd12_csr;
2259#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2260pub struct TCD12_BITER_ELINKNO {
2261 register: VolatileCell<u16>,
2262}
2263#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2264pub mod tcd12_biter_elinkno;
2265#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2266pub struct TCD12_BITER_ELINKYES {
2267 register: VolatileCell<u16>,
2268}
2269#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2270pub mod tcd12_biter_elinkyes;
2271#[doc = "TCD Source Address"]
2272pub struct TCD13_SADDR {
2273 register: VolatileCell<u32>,
2274}
2275#[doc = "TCD Source Address"]
2276pub mod tcd13_saddr;
2277#[doc = "TCD Signed Source Address Offset"]
2278pub struct TCD13_SOFF {
2279 register: VolatileCell<u16>,
2280}
2281#[doc = "TCD Signed Source Address Offset"]
2282pub mod tcd13_soff;
2283#[doc = "TCD Transfer Attributes"]
2284pub struct TCD13_ATTR {
2285 register: VolatileCell<u16>,
2286}
2287#[doc = "TCD Transfer Attributes"]
2288pub mod tcd13_attr;
2289#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2290pub struct TCD13_NBYTES_MLNO {
2291 register: VolatileCell<u32>,
2292}
2293#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2294pub mod tcd13_nbytes_mlno;
2295#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2296pub struct TCD13_NBYTES_MLOFFNO {
2297 register: VolatileCell<u32>,
2298}
2299#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2300pub mod tcd13_nbytes_mloffno;
2301#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2302pub struct TCD13_NBYTES_MLOFFYES {
2303 register: VolatileCell<u32>,
2304}
2305#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2306pub mod tcd13_nbytes_mloffyes;
2307#[doc = "TCD Last Source Address Adjustment"]
2308pub struct TCD13_SLAST {
2309 register: VolatileCell<u32>,
2310}
2311#[doc = "TCD Last Source Address Adjustment"]
2312pub mod tcd13_slast;
2313#[doc = "TCD Destination Address"]
2314pub struct TCD13_DADDR {
2315 register: VolatileCell<u32>,
2316}
2317#[doc = "TCD Destination Address"]
2318pub mod tcd13_daddr;
2319#[doc = "TCD Signed Destination Address Offset"]
2320pub struct TCD13_DOFF {
2321 register: VolatileCell<u16>,
2322}
2323#[doc = "TCD Signed Destination Address Offset"]
2324pub mod tcd13_doff;
2325#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2326pub struct TCD13_CITER_ELINKNO {
2327 register: VolatileCell<u16>,
2328}
2329#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2330pub mod tcd13_citer_elinkno;
2331#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2332pub struct TCD13_CITER_ELINKYES {
2333 register: VolatileCell<u16>,
2334}
2335#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2336pub mod tcd13_citer_elinkyes;
2337#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2338pub struct TCD13_DLASTSGA {
2339 register: VolatileCell<u32>,
2340}
2341#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2342pub mod tcd13_dlastsga;
2343#[doc = "TCD Control and Status"]
2344pub struct TCD13_CSR {
2345 register: VolatileCell<u16>,
2346}
2347#[doc = "TCD Control and Status"]
2348pub mod tcd13_csr;
2349#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2350pub struct TCD13_BITER_ELINKNO {
2351 register: VolatileCell<u16>,
2352}
2353#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2354pub mod tcd13_biter_elinkno;
2355#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2356pub struct TCD13_BITER_ELINKYES {
2357 register: VolatileCell<u16>,
2358}
2359#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2360pub mod tcd13_biter_elinkyes;
2361#[doc = "TCD Source Address"]
2362pub struct TCD14_SADDR {
2363 register: VolatileCell<u32>,
2364}
2365#[doc = "TCD Source Address"]
2366pub mod tcd14_saddr;
2367#[doc = "TCD Signed Source Address Offset"]
2368pub struct TCD14_SOFF {
2369 register: VolatileCell<u16>,
2370}
2371#[doc = "TCD Signed Source Address Offset"]
2372pub mod tcd14_soff;
2373#[doc = "TCD Transfer Attributes"]
2374pub struct TCD14_ATTR {
2375 register: VolatileCell<u16>,
2376}
2377#[doc = "TCD Transfer Attributes"]
2378pub mod tcd14_attr;
2379#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2380pub struct TCD14_NBYTES_MLNO {
2381 register: VolatileCell<u32>,
2382}
2383#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2384pub mod tcd14_nbytes_mlno;
2385#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2386pub struct TCD14_NBYTES_MLOFFNO {
2387 register: VolatileCell<u32>,
2388}
2389#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2390pub mod tcd14_nbytes_mloffno;
2391#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2392pub struct TCD14_NBYTES_MLOFFYES {
2393 register: VolatileCell<u32>,
2394}
2395#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2396pub mod tcd14_nbytes_mloffyes;
2397#[doc = "TCD Last Source Address Adjustment"]
2398pub struct TCD14_SLAST {
2399 register: VolatileCell<u32>,
2400}
2401#[doc = "TCD Last Source Address Adjustment"]
2402pub mod tcd14_slast;
2403#[doc = "TCD Destination Address"]
2404pub struct TCD14_DADDR {
2405 register: VolatileCell<u32>,
2406}
2407#[doc = "TCD Destination Address"]
2408pub mod tcd14_daddr;
2409#[doc = "TCD Signed Destination Address Offset"]
2410pub struct TCD14_DOFF {
2411 register: VolatileCell<u16>,
2412}
2413#[doc = "TCD Signed Destination Address Offset"]
2414pub mod tcd14_doff;
2415#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2416pub struct TCD14_CITER_ELINKNO {
2417 register: VolatileCell<u16>,
2418}
2419#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2420pub mod tcd14_citer_elinkno;
2421#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2422pub struct TCD14_CITER_ELINKYES {
2423 register: VolatileCell<u16>,
2424}
2425#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2426pub mod tcd14_citer_elinkyes;
2427#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2428pub struct TCD14_DLASTSGA {
2429 register: VolatileCell<u32>,
2430}
2431#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2432pub mod tcd14_dlastsga;
2433#[doc = "TCD Control and Status"]
2434pub struct TCD14_CSR {
2435 register: VolatileCell<u16>,
2436}
2437#[doc = "TCD Control and Status"]
2438pub mod tcd14_csr;
2439#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2440pub struct TCD14_BITER_ELINKNO {
2441 register: VolatileCell<u16>,
2442}
2443#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2444pub mod tcd14_biter_elinkno;
2445#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2446pub struct TCD14_BITER_ELINKYES {
2447 register: VolatileCell<u16>,
2448}
2449#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2450pub mod tcd14_biter_elinkyes;
2451#[doc = "TCD Source Address"]
2452pub struct TCD15_SADDR {
2453 register: VolatileCell<u32>,
2454}
2455#[doc = "TCD Source Address"]
2456pub mod tcd15_saddr;
2457#[doc = "TCD Signed Source Address Offset"]
2458pub struct TCD15_SOFF {
2459 register: VolatileCell<u16>,
2460}
2461#[doc = "TCD Signed Source Address Offset"]
2462pub mod tcd15_soff;
2463#[doc = "TCD Transfer Attributes"]
2464pub struct TCD15_ATTR {
2465 register: VolatileCell<u16>,
2466}
2467#[doc = "TCD Transfer Attributes"]
2468pub mod tcd15_attr;
2469#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2470pub struct TCD15_NBYTES_MLNO {
2471 register: VolatileCell<u32>,
2472}
2473#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2474pub mod tcd15_nbytes_mlno;
2475#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2476pub struct TCD15_NBYTES_MLOFFNO {
2477 register: VolatileCell<u32>,
2478}
2479#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2480pub mod tcd15_nbytes_mloffno;
2481#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2482pub struct TCD15_NBYTES_MLOFFYES {
2483 register: VolatileCell<u32>,
2484}
2485#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2486pub mod tcd15_nbytes_mloffyes;
2487#[doc = "TCD Last Source Address Adjustment"]
2488pub struct TCD15_SLAST {
2489 register: VolatileCell<u32>,
2490}
2491#[doc = "TCD Last Source Address Adjustment"]
2492pub mod tcd15_slast;
2493#[doc = "TCD Destination Address"]
2494pub struct TCD15_DADDR {
2495 register: VolatileCell<u32>,
2496}
2497#[doc = "TCD Destination Address"]
2498pub mod tcd15_daddr;
2499#[doc = "TCD Signed Destination Address Offset"]
2500pub struct TCD15_DOFF {
2501 register: VolatileCell<u16>,
2502}
2503#[doc = "TCD Signed Destination Address Offset"]
2504pub mod tcd15_doff;
2505#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2506pub struct TCD15_CITER_ELINKNO {
2507 register: VolatileCell<u16>,
2508}
2509#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2510pub mod tcd15_citer_elinkno;
2511#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2512pub struct TCD15_CITER_ELINKYES {
2513 register: VolatileCell<u16>,
2514}
2515#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2516pub mod tcd15_citer_elinkyes;
2517#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2518pub struct TCD15_DLASTSGA {
2519 register: VolatileCell<u32>,
2520}
2521#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2522pub mod tcd15_dlastsga;
2523#[doc = "TCD Control and Status"]
2524pub struct TCD15_CSR {
2525 register: VolatileCell<u16>,
2526}
2527#[doc = "TCD Control and Status"]
2528pub mod tcd15_csr;
2529#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2530pub struct TCD15_BITER_ELINKNO {
2531 register: VolatileCell<u16>,
2532}
2533#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2534pub mod tcd15_biter_elinkno;
2535#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2536pub struct TCD15_BITER_ELINKYES {
2537 register: VolatileCell<u16>,
2538}
2539#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2540pub mod tcd15_biter_elinkyes;
2541#[doc = "TCD Source Address"]
2542pub struct TCD16_SADDR {
2543 register: VolatileCell<u32>,
2544}
2545#[doc = "TCD Source Address"]
2546pub mod tcd16_saddr;
2547#[doc = "TCD Signed Source Address Offset"]
2548pub struct TCD16_SOFF {
2549 register: VolatileCell<u16>,
2550}
2551#[doc = "TCD Signed Source Address Offset"]
2552pub mod tcd16_soff;
2553#[doc = "TCD Transfer Attributes"]
2554pub struct TCD16_ATTR {
2555 register: VolatileCell<u16>,
2556}
2557#[doc = "TCD Transfer Attributes"]
2558pub mod tcd16_attr;
2559#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2560pub struct TCD16_NBYTES_MLNO {
2561 register: VolatileCell<u32>,
2562}
2563#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2564pub mod tcd16_nbytes_mlno;
2565#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2566pub struct TCD16_NBYTES_MLOFFNO {
2567 register: VolatileCell<u32>,
2568}
2569#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2570pub mod tcd16_nbytes_mloffno;
2571#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2572pub struct TCD16_NBYTES_MLOFFYES {
2573 register: VolatileCell<u32>,
2574}
2575#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2576pub mod tcd16_nbytes_mloffyes;
2577#[doc = "TCD Last Source Address Adjustment"]
2578pub struct TCD16_SLAST {
2579 register: VolatileCell<u32>,
2580}
2581#[doc = "TCD Last Source Address Adjustment"]
2582pub mod tcd16_slast;
2583#[doc = "TCD Destination Address"]
2584pub struct TCD16_DADDR {
2585 register: VolatileCell<u32>,
2586}
2587#[doc = "TCD Destination Address"]
2588pub mod tcd16_daddr;
2589#[doc = "TCD Signed Destination Address Offset"]
2590pub struct TCD16_DOFF {
2591 register: VolatileCell<u16>,
2592}
2593#[doc = "TCD Signed Destination Address Offset"]
2594pub mod tcd16_doff;
2595#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2596pub struct TCD16_CITER_ELINKNO {
2597 register: VolatileCell<u16>,
2598}
2599#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2600pub mod tcd16_citer_elinkno;
2601#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2602pub struct TCD16_CITER_ELINKYES {
2603 register: VolatileCell<u16>,
2604}
2605#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2606pub mod tcd16_citer_elinkyes;
2607#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2608pub struct TCD16_DLASTSGA {
2609 register: VolatileCell<u32>,
2610}
2611#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2612pub mod tcd16_dlastsga;
2613#[doc = "TCD Control and Status"]
2614pub struct TCD16_CSR {
2615 register: VolatileCell<u16>,
2616}
2617#[doc = "TCD Control and Status"]
2618pub mod tcd16_csr;
2619#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2620pub struct TCD16_BITER_ELINKNO {
2621 register: VolatileCell<u16>,
2622}
2623#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2624pub mod tcd16_biter_elinkno;
2625#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2626pub struct TCD16_BITER_ELINKYES {
2627 register: VolatileCell<u16>,
2628}
2629#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2630pub mod tcd16_biter_elinkyes;
2631#[doc = "TCD Source Address"]
2632pub struct TCD17_SADDR {
2633 register: VolatileCell<u32>,
2634}
2635#[doc = "TCD Source Address"]
2636pub mod tcd17_saddr;
2637#[doc = "TCD Signed Source Address Offset"]
2638pub struct TCD17_SOFF {
2639 register: VolatileCell<u16>,
2640}
2641#[doc = "TCD Signed Source Address Offset"]
2642pub mod tcd17_soff;
2643#[doc = "TCD Transfer Attributes"]
2644pub struct TCD17_ATTR {
2645 register: VolatileCell<u16>,
2646}
2647#[doc = "TCD Transfer Attributes"]
2648pub mod tcd17_attr;
2649#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2650pub struct TCD17_NBYTES_MLNO {
2651 register: VolatileCell<u32>,
2652}
2653#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2654pub mod tcd17_nbytes_mlno;
2655#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2656pub struct TCD17_NBYTES_MLOFFNO {
2657 register: VolatileCell<u32>,
2658}
2659#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2660pub mod tcd17_nbytes_mloffno;
2661#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2662pub struct TCD17_NBYTES_MLOFFYES {
2663 register: VolatileCell<u32>,
2664}
2665#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2666pub mod tcd17_nbytes_mloffyes;
2667#[doc = "TCD Last Source Address Adjustment"]
2668pub struct TCD17_SLAST {
2669 register: VolatileCell<u32>,
2670}
2671#[doc = "TCD Last Source Address Adjustment"]
2672pub mod tcd17_slast;
2673#[doc = "TCD Destination Address"]
2674pub struct TCD17_DADDR {
2675 register: VolatileCell<u32>,
2676}
2677#[doc = "TCD Destination Address"]
2678pub mod tcd17_daddr;
2679#[doc = "TCD Signed Destination Address Offset"]
2680pub struct TCD17_DOFF {
2681 register: VolatileCell<u16>,
2682}
2683#[doc = "TCD Signed Destination Address Offset"]
2684pub mod tcd17_doff;
2685#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2686pub struct TCD17_CITER_ELINKNO {
2687 register: VolatileCell<u16>,
2688}
2689#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2690pub mod tcd17_citer_elinkno;
2691#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2692pub struct TCD17_CITER_ELINKYES {
2693 register: VolatileCell<u16>,
2694}
2695#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2696pub mod tcd17_citer_elinkyes;
2697#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2698pub struct TCD17_DLASTSGA {
2699 register: VolatileCell<u32>,
2700}
2701#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2702pub mod tcd17_dlastsga;
2703#[doc = "TCD Control and Status"]
2704pub struct TCD17_CSR {
2705 register: VolatileCell<u16>,
2706}
2707#[doc = "TCD Control and Status"]
2708pub mod tcd17_csr;
2709#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2710pub struct TCD17_BITER_ELINKNO {
2711 register: VolatileCell<u16>,
2712}
2713#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2714pub mod tcd17_biter_elinkno;
2715#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2716pub struct TCD17_BITER_ELINKYES {
2717 register: VolatileCell<u16>,
2718}
2719#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2720pub mod tcd17_biter_elinkyes;
2721#[doc = "TCD Source Address"]
2722pub struct TCD18_SADDR {
2723 register: VolatileCell<u32>,
2724}
2725#[doc = "TCD Source Address"]
2726pub mod tcd18_saddr;
2727#[doc = "TCD Signed Source Address Offset"]
2728pub struct TCD18_SOFF {
2729 register: VolatileCell<u16>,
2730}
2731#[doc = "TCD Signed Source Address Offset"]
2732pub mod tcd18_soff;
2733#[doc = "TCD Transfer Attributes"]
2734pub struct TCD18_ATTR {
2735 register: VolatileCell<u16>,
2736}
2737#[doc = "TCD Transfer Attributes"]
2738pub mod tcd18_attr;
2739#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2740pub struct TCD18_NBYTES_MLNO {
2741 register: VolatileCell<u32>,
2742}
2743#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2744pub mod tcd18_nbytes_mlno;
2745#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2746pub struct TCD18_NBYTES_MLOFFNO {
2747 register: VolatileCell<u32>,
2748}
2749#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2750pub mod tcd18_nbytes_mloffno;
2751#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2752pub struct TCD18_NBYTES_MLOFFYES {
2753 register: VolatileCell<u32>,
2754}
2755#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2756pub mod tcd18_nbytes_mloffyes;
2757#[doc = "TCD Last Source Address Adjustment"]
2758pub struct TCD18_SLAST {
2759 register: VolatileCell<u32>,
2760}
2761#[doc = "TCD Last Source Address Adjustment"]
2762pub mod tcd18_slast;
2763#[doc = "TCD Destination Address"]
2764pub struct TCD18_DADDR {
2765 register: VolatileCell<u32>,
2766}
2767#[doc = "TCD Destination Address"]
2768pub mod tcd18_daddr;
2769#[doc = "TCD Signed Destination Address Offset"]
2770pub struct TCD18_DOFF {
2771 register: VolatileCell<u16>,
2772}
2773#[doc = "TCD Signed Destination Address Offset"]
2774pub mod tcd18_doff;
2775#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2776pub struct TCD18_CITER_ELINKNO {
2777 register: VolatileCell<u16>,
2778}
2779#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2780pub mod tcd18_citer_elinkno;
2781#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2782pub struct TCD18_CITER_ELINKYES {
2783 register: VolatileCell<u16>,
2784}
2785#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2786pub mod tcd18_citer_elinkyes;
2787#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2788pub struct TCD18_DLASTSGA {
2789 register: VolatileCell<u32>,
2790}
2791#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2792pub mod tcd18_dlastsga;
2793#[doc = "TCD Control and Status"]
2794pub struct TCD18_CSR {
2795 register: VolatileCell<u16>,
2796}
2797#[doc = "TCD Control and Status"]
2798pub mod tcd18_csr;
2799#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2800pub struct TCD18_BITER_ELINKNO {
2801 register: VolatileCell<u16>,
2802}
2803#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2804pub mod tcd18_biter_elinkno;
2805#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2806pub struct TCD18_BITER_ELINKYES {
2807 register: VolatileCell<u16>,
2808}
2809#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2810pub mod tcd18_biter_elinkyes;
2811#[doc = "TCD Source Address"]
2812pub struct TCD19_SADDR {
2813 register: VolatileCell<u32>,
2814}
2815#[doc = "TCD Source Address"]
2816pub mod tcd19_saddr;
2817#[doc = "TCD Signed Source Address Offset"]
2818pub struct TCD19_SOFF {
2819 register: VolatileCell<u16>,
2820}
2821#[doc = "TCD Signed Source Address Offset"]
2822pub mod tcd19_soff;
2823#[doc = "TCD Transfer Attributes"]
2824pub struct TCD19_ATTR {
2825 register: VolatileCell<u16>,
2826}
2827#[doc = "TCD Transfer Attributes"]
2828pub mod tcd19_attr;
2829#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2830pub struct TCD19_NBYTES_MLNO {
2831 register: VolatileCell<u32>,
2832}
2833#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2834pub mod tcd19_nbytes_mlno;
2835#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2836pub struct TCD19_NBYTES_MLOFFNO {
2837 register: VolatileCell<u32>,
2838}
2839#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2840pub mod tcd19_nbytes_mloffno;
2841#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2842pub struct TCD19_NBYTES_MLOFFYES {
2843 register: VolatileCell<u32>,
2844}
2845#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2846pub mod tcd19_nbytes_mloffyes;
2847#[doc = "TCD Last Source Address Adjustment"]
2848pub struct TCD19_SLAST {
2849 register: VolatileCell<u32>,
2850}
2851#[doc = "TCD Last Source Address Adjustment"]
2852pub mod tcd19_slast;
2853#[doc = "TCD Destination Address"]
2854pub struct TCD19_DADDR {
2855 register: VolatileCell<u32>,
2856}
2857#[doc = "TCD Destination Address"]
2858pub mod tcd19_daddr;
2859#[doc = "TCD Signed Destination Address Offset"]
2860pub struct TCD19_DOFF {
2861 register: VolatileCell<u16>,
2862}
2863#[doc = "TCD Signed Destination Address Offset"]
2864pub mod tcd19_doff;
2865#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2866pub struct TCD19_CITER_ELINKNO {
2867 register: VolatileCell<u16>,
2868}
2869#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2870pub mod tcd19_citer_elinkno;
2871#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2872pub struct TCD19_CITER_ELINKYES {
2873 register: VolatileCell<u16>,
2874}
2875#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2876pub mod tcd19_citer_elinkyes;
2877#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2878pub struct TCD19_DLASTSGA {
2879 register: VolatileCell<u32>,
2880}
2881#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2882pub mod tcd19_dlastsga;
2883#[doc = "TCD Control and Status"]
2884pub struct TCD19_CSR {
2885 register: VolatileCell<u16>,
2886}
2887#[doc = "TCD Control and Status"]
2888pub mod tcd19_csr;
2889#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2890pub struct TCD19_BITER_ELINKNO {
2891 register: VolatileCell<u16>,
2892}
2893#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2894pub mod tcd19_biter_elinkno;
2895#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2896pub struct TCD19_BITER_ELINKYES {
2897 register: VolatileCell<u16>,
2898}
2899#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2900pub mod tcd19_biter_elinkyes;
2901#[doc = "TCD Source Address"]
2902pub struct TCD20_SADDR {
2903 register: VolatileCell<u32>,
2904}
2905#[doc = "TCD Source Address"]
2906pub mod tcd20_saddr;
2907#[doc = "TCD Signed Source Address Offset"]
2908pub struct TCD20_SOFF {
2909 register: VolatileCell<u16>,
2910}
2911#[doc = "TCD Signed Source Address Offset"]
2912pub mod tcd20_soff;
2913#[doc = "TCD Transfer Attributes"]
2914pub struct TCD20_ATTR {
2915 register: VolatileCell<u16>,
2916}
2917#[doc = "TCD Transfer Attributes"]
2918pub mod tcd20_attr;
2919#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2920pub struct TCD20_NBYTES_MLNO {
2921 register: VolatileCell<u32>,
2922}
2923#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
2924pub mod tcd20_nbytes_mlno;
2925#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2926pub struct TCD20_NBYTES_MLOFFNO {
2927 register: VolatileCell<u32>,
2928}
2929#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
2930pub mod tcd20_nbytes_mloffno;
2931#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2932pub struct TCD20_NBYTES_MLOFFYES {
2933 register: VolatileCell<u32>,
2934}
2935#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
2936pub mod tcd20_nbytes_mloffyes;
2937#[doc = "TCD Last Source Address Adjustment"]
2938pub struct TCD20_SLAST {
2939 register: VolatileCell<u32>,
2940}
2941#[doc = "TCD Last Source Address Adjustment"]
2942pub mod tcd20_slast;
2943#[doc = "TCD Destination Address"]
2944pub struct TCD20_DADDR {
2945 register: VolatileCell<u32>,
2946}
2947#[doc = "TCD Destination Address"]
2948pub mod tcd20_daddr;
2949#[doc = "TCD Signed Destination Address Offset"]
2950pub struct TCD20_DOFF {
2951 register: VolatileCell<u16>,
2952}
2953#[doc = "TCD Signed Destination Address Offset"]
2954pub mod tcd20_doff;
2955#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2956pub struct TCD20_CITER_ELINKNO {
2957 register: VolatileCell<u16>,
2958}
2959#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2960pub mod tcd20_citer_elinkno;
2961#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2962pub struct TCD20_CITER_ELINKYES {
2963 register: VolatileCell<u16>,
2964}
2965#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2966pub mod tcd20_citer_elinkyes;
2967#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2968pub struct TCD20_DLASTSGA {
2969 register: VolatileCell<u32>,
2970}
2971#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
2972pub mod tcd20_dlastsga;
2973#[doc = "TCD Control and Status"]
2974pub struct TCD20_CSR {
2975 register: VolatileCell<u16>,
2976}
2977#[doc = "TCD Control and Status"]
2978pub mod tcd20_csr;
2979#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2980pub struct TCD20_BITER_ELINKNO {
2981 register: VolatileCell<u16>,
2982}
2983#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
2984pub mod tcd20_biter_elinkno;
2985#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2986pub struct TCD20_BITER_ELINKYES {
2987 register: VolatileCell<u16>,
2988}
2989#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
2990pub mod tcd20_biter_elinkyes;
2991#[doc = "TCD Source Address"]
2992pub struct TCD21_SADDR {
2993 register: VolatileCell<u32>,
2994}
2995#[doc = "TCD Source Address"]
2996pub mod tcd21_saddr;
2997#[doc = "TCD Signed Source Address Offset"]
2998pub struct TCD21_SOFF {
2999 register: VolatileCell<u16>,
3000}
3001#[doc = "TCD Signed Source Address Offset"]
3002pub mod tcd21_soff;
3003#[doc = "TCD Transfer Attributes"]
3004pub struct TCD21_ATTR {
3005 register: VolatileCell<u16>,
3006}
3007#[doc = "TCD Transfer Attributes"]
3008pub mod tcd21_attr;
3009#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3010pub struct TCD21_NBYTES_MLNO {
3011 register: VolatileCell<u32>,
3012}
3013#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3014pub mod tcd21_nbytes_mlno;
3015#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3016pub struct TCD21_NBYTES_MLOFFNO {
3017 register: VolatileCell<u32>,
3018}
3019#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3020pub mod tcd21_nbytes_mloffno;
3021#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3022pub struct TCD21_NBYTES_MLOFFYES {
3023 register: VolatileCell<u32>,
3024}
3025#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3026pub mod tcd21_nbytes_mloffyes;
3027#[doc = "TCD Last Source Address Adjustment"]
3028pub struct TCD21_SLAST {
3029 register: VolatileCell<u32>,
3030}
3031#[doc = "TCD Last Source Address Adjustment"]
3032pub mod tcd21_slast;
3033#[doc = "TCD Destination Address"]
3034pub struct TCD21_DADDR {
3035 register: VolatileCell<u32>,
3036}
3037#[doc = "TCD Destination Address"]
3038pub mod tcd21_daddr;
3039#[doc = "TCD Signed Destination Address Offset"]
3040pub struct TCD21_DOFF {
3041 register: VolatileCell<u16>,
3042}
3043#[doc = "TCD Signed Destination Address Offset"]
3044pub mod tcd21_doff;
3045#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3046pub struct TCD21_CITER_ELINKNO {
3047 register: VolatileCell<u16>,
3048}
3049#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3050pub mod tcd21_citer_elinkno;
3051#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3052pub struct TCD21_CITER_ELINKYES {
3053 register: VolatileCell<u16>,
3054}
3055#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3056pub mod tcd21_citer_elinkyes;
3057#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3058pub struct TCD21_DLASTSGA {
3059 register: VolatileCell<u32>,
3060}
3061#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3062pub mod tcd21_dlastsga;
3063#[doc = "TCD Control and Status"]
3064pub struct TCD21_CSR {
3065 register: VolatileCell<u16>,
3066}
3067#[doc = "TCD Control and Status"]
3068pub mod tcd21_csr;
3069#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3070pub struct TCD21_BITER_ELINKNO {
3071 register: VolatileCell<u16>,
3072}
3073#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3074pub mod tcd21_biter_elinkno;
3075#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3076pub struct TCD21_BITER_ELINKYES {
3077 register: VolatileCell<u16>,
3078}
3079#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3080pub mod tcd21_biter_elinkyes;
3081#[doc = "TCD Source Address"]
3082pub struct TCD22_SADDR {
3083 register: VolatileCell<u32>,
3084}
3085#[doc = "TCD Source Address"]
3086pub mod tcd22_saddr;
3087#[doc = "TCD Signed Source Address Offset"]
3088pub struct TCD22_SOFF {
3089 register: VolatileCell<u16>,
3090}
3091#[doc = "TCD Signed Source Address Offset"]
3092pub mod tcd22_soff;
3093#[doc = "TCD Transfer Attributes"]
3094pub struct TCD22_ATTR {
3095 register: VolatileCell<u16>,
3096}
3097#[doc = "TCD Transfer Attributes"]
3098pub mod tcd22_attr;
3099#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3100pub struct TCD22_NBYTES_MLNO {
3101 register: VolatileCell<u32>,
3102}
3103#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3104pub mod tcd22_nbytes_mlno;
3105#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3106pub struct TCD22_NBYTES_MLOFFNO {
3107 register: VolatileCell<u32>,
3108}
3109#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3110pub mod tcd22_nbytes_mloffno;
3111#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3112pub struct TCD22_NBYTES_MLOFFYES {
3113 register: VolatileCell<u32>,
3114}
3115#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3116pub mod tcd22_nbytes_mloffyes;
3117#[doc = "TCD Last Source Address Adjustment"]
3118pub struct TCD22_SLAST {
3119 register: VolatileCell<u32>,
3120}
3121#[doc = "TCD Last Source Address Adjustment"]
3122pub mod tcd22_slast;
3123#[doc = "TCD Destination Address"]
3124pub struct TCD22_DADDR {
3125 register: VolatileCell<u32>,
3126}
3127#[doc = "TCD Destination Address"]
3128pub mod tcd22_daddr;
3129#[doc = "TCD Signed Destination Address Offset"]
3130pub struct TCD22_DOFF {
3131 register: VolatileCell<u16>,
3132}
3133#[doc = "TCD Signed Destination Address Offset"]
3134pub mod tcd22_doff;
3135#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3136pub struct TCD22_CITER_ELINKNO {
3137 register: VolatileCell<u16>,
3138}
3139#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3140pub mod tcd22_citer_elinkno;
3141#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3142pub struct TCD22_CITER_ELINKYES {
3143 register: VolatileCell<u16>,
3144}
3145#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3146pub mod tcd22_citer_elinkyes;
3147#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3148pub struct TCD22_DLASTSGA {
3149 register: VolatileCell<u32>,
3150}
3151#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3152pub mod tcd22_dlastsga;
3153#[doc = "TCD Control and Status"]
3154pub struct TCD22_CSR {
3155 register: VolatileCell<u16>,
3156}
3157#[doc = "TCD Control and Status"]
3158pub mod tcd22_csr;
3159#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3160pub struct TCD22_BITER_ELINKNO {
3161 register: VolatileCell<u16>,
3162}
3163#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3164pub mod tcd22_biter_elinkno;
3165#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3166pub struct TCD22_BITER_ELINKYES {
3167 register: VolatileCell<u16>,
3168}
3169#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3170pub mod tcd22_biter_elinkyes;
3171#[doc = "TCD Source Address"]
3172pub struct TCD23_SADDR {
3173 register: VolatileCell<u32>,
3174}
3175#[doc = "TCD Source Address"]
3176pub mod tcd23_saddr;
3177#[doc = "TCD Signed Source Address Offset"]
3178pub struct TCD23_SOFF {
3179 register: VolatileCell<u16>,
3180}
3181#[doc = "TCD Signed Source Address Offset"]
3182pub mod tcd23_soff;
3183#[doc = "TCD Transfer Attributes"]
3184pub struct TCD23_ATTR {
3185 register: VolatileCell<u16>,
3186}
3187#[doc = "TCD Transfer Attributes"]
3188pub mod tcd23_attr;
3189#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3190pub struct TCD23_NBYTES_MLNO {
3191 register: VolatileCell<u32>,
3192}
3193#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3194pub mod tcd23_nbytes_mlno;
3195#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3196pub struct TCD23_NBYTES_MLOFFNO {
3197 register: VolatileCell<u32>,
3198}
3199#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3200pub mod tcd23_nbytes_mloffno;
3201#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3202pub struct TCD23_NBYTES_MLOFFYES {
3203 register: VolatileCell<u32>,
3204}
3205#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3206pub mod tcd23_nbytes_mloffyes;
3207#[doc = "TCD Last Source Address Adjustment"]
3208pub struct TCD23_SLAST {
3209 register: VolatileCell<u32>,
3210}
3211#[doc = "TCD Last Source Address Adjustment"]
3212pub mod tcd23_slast;
3213#[doc = "TCD Destination Address"]
3214pub struct TCD23_DADDR {
3215 register: VolatileCell<u32>,
3216}
3217#[doc = "TCD Destination Address"]
3218pub mod tcd23_daddr;
3219#[doc = "TCD Signed Destination Address Offset"]
3220pub struct TCD23_DOFF {
3221 register: VolatileCell<u16>,
3222}
3223#[doc = "TCD Signed Destination Address Offset"]
3224pub mod tcd23_doff;
3225#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3226pub struct TCD23_CITER_ELINKNO {
3227 register: VolatileCell<u16>,
3228}
3229#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3230pub mod tcd23_citer_elinkno;
3231#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3232pub struct TCD23_CITER_ELINKYES {
3233 register: VolatileCell<u16>,
3234}
3235#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3236pub mod tcd23_citer_elinkyes;
3237#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3238pub struct TCD23_DLASTSGA {
3239 register: VolatileCell<u32>,
3240}
3241#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3242pub mod tcd23_dlastsga;
3243#[doc = "TCD Control and Status"]
3244pub struct TCD23_CSR {
3245 register: VolatileCell<u16>,
3246}
3247#[doc = "TCD Control and Status"]
3248pub mod tcd23_csr;
3249#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3250pub struct TCD23_BITER_ELINKNO {
3251 register: VolatileCell<u16>,
3252}
3253#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3254pub mod tcd23_biter_elinkno;
3255#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3256pub struct TCD23_BITER_ELINKYES {
3257 register: VolatileCell<u16>,
3258}
3259#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3260pub mod tcd23_biter_elinkyes;
3261#[doc = "TCD Source Address"]
3262pub struct TCD24_SADDR {
3263 register: VolatileCell<u32>,
3264}
3265#[doc = "TCD Source Address"]
3266pub mod tcd24_saddr;
3267#[doc = "TCD Signed Source Address Offset"]
3268pub struct TCD24_SOFF {
3269 register: VolatileCell<u16>,
3270}
3271#[doc = "TCD Signed Source Address Offset"]
3272pub mod tcd24_soff;
3273#[doc = "TCD Transfer Attributes"]
3274pub struct TCD24_ATTR {
3275 register: VolatileCell<u16>,
3276}
3277#[doc = "TCD Transfer Attributes"]
3278pub mod tcd24_attr;
3279#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3280pub struct TCD24_NBYTES_MLNO {
3281 register: VolatileCell<u32>,
3282}
3283#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3284pub mod tcd24_nbytes_mlno;
3285#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3286pub struct TCD24_NBYTES_MLOFFNO {
3287 register: VolatileCell<u32>,
3288}
3289#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3290pub mod tcd24_nbytes_mloffno;
3291#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3292pub struct TCD24_NBYTES_MLOFFYES {
3293 register: VolatileCell<u32>,
3294}
3295#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3296pub mod tcd24_nbytes_mloffyes;
3297#[doc = "TCD Last Source Address Adjustment"]
3298pub struct TCD24_SLAST {
3299 register: VolatileCell<u32>,
3300}
3301#[doc = "TCD Last Source Address Adjustment"]
3302pub mod tcd24_slast;
3303#[doc = "TCD Destination Address"]
3304pub struct TCD24_DADDR {
3305 register: VolatileCell<u32>,
3306}
3307#[doc = "TCD Destination Address"]
3308pub mod tcd24_daddr;
3309#[doc = "TCD Signed Destination Address Offset"]
3310pub struct TCD24_DOFF {
3311 register: VolatileCell<u16>,
3312}
3313#[doc = "TCD Signed Destination Address Offset"]
3314pub mod tcd24_doff;
3315#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3316pub struct TCD24_CITER_ELINKNO {
3317 register: VolatileCell<u16>,
3318}
3319#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3320pub mod tcd24_citer_elinkno;
3321#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3322pub struct TCD24_CITER_ELINKYES {
3323 register: VolatileCell<u16>,
3324}
3325#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3326pub mod tcd24_citer_elinkyes;
3327#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3328pub struct TCD24_DLASTSGA {
3329 register: VolatileCell<u32>,
3330}
3331#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3332pub mod tcd24_dlastsga;
3333#[doc = "TCD Control and Status"]
3334pub struct TCD24_CSR {
3335 register: VolatileCell<u16>,
3336}
3337#[doc = "TCD Control and Status"]
3338pub mod tcd24_csr;
3339#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3340pub struct TCD24_BITER_ELINKNO {
3341 register: VolatileCell<u16>,
3342}
3343#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3344pub mod tcd24_biter_elinkno;
3345#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3346pub struct TCD24_BITER_ELINKYES {
3347 register: VolatileCell<u16>,
3348}
3349#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3350pub mod tcd24_biter_elinkyes;
3351#[doc = "TCD Source Address"]
3352pub struct TCD25_SADDR {
3353 register: VolatileCell<u32>,
3354}
3355#[doc = "TCD Source Address"]
3356pub mod tcd25_saddr;
3357#[doc = "TCD Signed Source Address Offset"]
3358pub struct TCD25_SOFF {
3359 register: VolatileCell<u16>,
3360}
3361#[doc = "TCD Signed Source Address Offset"]
3362pub mod tcd25_soff;
3363#[doc = "TCD Transfer Attributes"]
3364pub struct TCD25_ATTR {
3365 register: VolatileCell<u16>,
3366}
3367#[doc = "TCD Transfer Attributes"]
3368pub mod tcd25_attr;
3369#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3370pub struct TCD25_NBYTES_MLNO {
3371 register: VolatileCell<u32>,
3372}
3373#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3374pub mod tcd25_nbytes_mlno;
3375#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3376pub struct TCD25_NBYTES_MLOFFNO {
3377 register: VolatileCell<u32>,
3378}
3379#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3380pub mod tcd25_nbytes_mloffno;
3381#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3382pub struct TCD25_NBYTES_MLOFFYES {
3383 register: VolatileCell<u32>,
3384}
3385#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3386pub mod tcd25_nbytes_mloffyes;
3387#[doc = "TCD Last Source Address Adjustment"]
3388pub struct TCD25_SLAST {
3389 register: VolatileCell<u32>,
3390}
3391#[doc = "TCD Last Source Address Adjustment"]
3392pub mod tcd25_slast;
3393#[doc = "TCD Destination Address"]
3394pub struct TCD25_DADDR {
3395 register: VolatileCell<u32>,
3396}
3397#[doc = "TCD Destination Address"]
3398pub mod tcd25_daddr;
3399#[doc = "TCD Signed Destination Address Offset"]
3400pub struct TCD25_DOFF {
3401 register: VolatileCell<u16>,
3402}
3403#[doc = "TCD Signed Destination Address Offset"]
3404pub mod tcd25_doff;
3405#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3406pub struct TCD25_CITER_ELINKNO {
3407 register: VolatileCell<u16>,
3408}
3409#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3410pub mod tcd25_citer_elinkno;
3411#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3412pub struct TCD25_CITER_ELINKYES {
3413 register: VolatileCell<u16>,
3414}
3415#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3416pub mod tcd25_citer_elinkyes;
3417#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3418pub struct TCD25_DLASTSGA {
3419 register: VolatileCell<u32>,
3420}
3421#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3422pub mod tcd25_dlastsga;
3423#[doc = "TCD Control and Status"]
3424pub struct TCD25_CSR {
3425 register: VolatileCell<u16>,
3426}
3427#[doc = "TCD Control and Status"]
3428pub mod tcd25_csr;
3429#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3430pub struct TCD25_BITER_ELINKNO {
3431 register: VolatileCell<u16>,
3432}
3433#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3434pub mod tcd25_biter_elinkno;
3435#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3436pub struct TCD25_BITER_ELINKYES {
3437 register: VolatileCell<u16>,
3438}
3439#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3440pub mod tcd25_biter_elinkyes;
3441#[doc = "TCD Source Address"]
3442pub struct TCD26_SADDR {
3443 register: VolatileCell<u32>,
3444}
3445#[doc = "TCD Source Address"]
3446pub mod tcd26_saddr;
3447#[doc = "TCD Signed Source Address Offset"]
3448pub struct TCD26_SOFF {
3449 register: VolatileCell<u16>,
3450}
3451#[doc = "TCD Signed Source Address Offset"]
3452pub mod tcd26_soff;
3453#[doc = "TCD Transfer Attributes"]
3454pub struct TCD26_ATTR {
3455 register: VolatileCell<u16>,
3456}
3457#[doc = "TCD Transfer Attributes"]
3458pub mod tcd26_attr;
3459#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3460pub struct TCD26_NBYTES_MLNO {
3461 register: VolatileCell<u32>,
3462}
3463#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3464pub mod tcd26_nbytes_mlno;
3465#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3466pub struct TCD26_NBYTES_MLOFFNO {
3467 register: VolatileCell<u32>,
3468}
3469#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3470pub mod tcd26_nbytes_mloffno;
3471#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3472pub struct TCD26_NBYTES_MLOFFYES {
3473 register: VolatileCell<u32>,
3474}
3475#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3476pub mod tcd26_nbytes_mloffyes;
3477#[doc = "TCD Last Source Address Adjustment"]
3478pub struct TCD26_SLAST {
3479 register: VolatileCell<u32>,
3480}
3481#[doc = "TCD Last Source Address Adjustment"]
3482pub mod tcd26_slast;
3483#[doc = "TCD Destination Address"]
3484pub struct TCD26_DADDR {
3485 register: VolatileCell<u32>,
3486}
3487#[doc = "TCD Destination Address"]
3488pub mod tcd26_daddr;
3489#[doc = "TCD Signed Destination Address Offset"]
3490pub struct TCD26_DOFF {
3491 register: VolatileCell<u16>,
3492}
3493#[doc = "TCD Signed Destination Address Offset"]
3494pub mod tcd26_doff;
3495#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3496pub struct TCD26_CITER_ELINKNO {
3497 register: VolatileCell<u16>,
3498}
3499#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3500pub mod tcd26_citer_elinkno;
3501#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3502pub struct TCD26_CITER_ELINKYES {
3503 register: VolatileCell<u16>,
3504}
3505#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3506pub mod tcd26_citer_elinkyes;
3507#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3508pub struct TCD26_DLASTSGA {
3509 register: VolatileCell<u32>,
3510}
3511#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3512pub mod tcd26_dlastsga;
3513#[doc = "TCD Control and Status"]
3514pub struct TCD26_CSR {
3515 register: VolatileCell<u16>,
3516}
3517#[doc = "TCD Control and Status"]
3518pub mod tcd26_csr;
3519#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3520pub struct TCD26_BITER_ELINKNO {
3521 register: VolatileCell<u16>,
3522}
3523#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3524pub mod tcd26_biter_elinkno;
3525#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3526pub struct TCD26_BITER_ELINKYES {
3527 register: VolatileCell<u16>,
3528}
3529#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3530pub mod tcd26_biter_elinkyes;
3531#[doc = "TCD Source Address"]
3532pub struct TCD27_SADDR {
3533 register: VolatileCell<u32>,
3534}
3535#[doc = "TCD Source Address"]
3536pub mod tcd27_saddr;
3537#[doc = "TCD Signed Source Address Offset"]
3538pub struct TCD27_SOFF {
3539 register: VolatileCell<u16>,
3540}
3541#[doc = "TCD Signed Source Address Offset"]
3542pub mod tcd27_soff;
3543#[doc = "TCD Transfer Attributes"]
3544pub struct TCD27_ATTR {
3545 register: VolatileCell<u16>,
3546}
3547#[doc = "TCD Transfer Attributes"]
3548pub mod tcd27_attr;
3549#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3550pub struct TCD27_NBYTES_MLNO {
3551 register: VolatileCell<u32>,
3552}
3553#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3554pub mod tcd27_nbytes_mlno;
3555#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3556pub struct TCD27_NBYTES_MLOFFNO {
3557 register: VolatileCell<u32>,
3558}
3559#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3560pub mod tcd27_nbytes_mloffno;
3561#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3562pub struct TCD27_NBYTES_MLOFFYES {
3563 register: VolatileCell<u32>,
3564}
3565#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3566pub mod tcd27_nbytes_mloffyes;
3567#[doc = "TCD Last Source Address Adjustment"]
3568pub struct TCD27_SLAST {
3569 register: VolatileCell<u32>,
3570}
3571#[doc = "TCD Last Source Address Adjustment"]
3572pub mod tcd27_slast;
3573#[doc = "TCD Destination Address"]
3574pub struct TCD27_DADDR {
3575 register: VolatileCell<u32>,
3576}
3577#[doc = "TCD Destination Address"]
3578pub mod tcd27_daddr;
3579#[doc = "TCD Signed Destination Address Offset"]
3580pub struct TCD27_DOFF {
3581 register: VolatileCell<u16>,
3582}
3583#[doc = "TCD Signed Destination Address Offset"]
3584pub mod tcd27_doff;
3585#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3586pub struct TCD27_CITER_ELINKNO {
3587 register: VolatileCell<u16>,
3588}
3589#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3590pub mod tcd27_citer_elinkno;
3591#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3592pub struct TCD27_CITER_ELINKYES {
3593 register: VolatileCell<u16>,
3594}
3595#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3596pub mod tcd27_citer_elinkyes;
3597#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3598pub struct TCD27_DLASTSGA {
3599 register: VolatileCell<u32>,
3600}
3601#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3602pub mod tcd27_dlastsga;
3603#[doc = "TCD Control and Status"]
3604pub struct TCD27_CSR {
3605 register: VolatileCell<u16>,
3606}
3607#[doc = "TCD Control and Status"]
3608pub mod tcd27_csr;
3609#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3610pub struct TCD27_BITER_ELINKNO {
3611 register: VolatileCell<u16>,
3612}
3613#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3614pub mod tcd27_biter_elinkno;
3615#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3616pub struct TCD27_BITER_ELINKYES {
3617 register: VolatileCell<u16>,
3618}
3619#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3620pub mod tcd27_biter_elinkyes;
3621#[doc = "TCD Source Address"]
3622pub struct TCD28_SADDR {
3623 register: VolatileCell<u32>,
3624}
3625#[doc = "TCD Source Address"]
3626pub mod tcd28_saddr;
3627#[doc = "TCD Signed Source Address Offset"]
3628pub struct TCD28_SOFF {
3629 register: VolatileCell<u16>,
3630}
3631#[doc = "TCD Signed Source Address Offset"]
3632pub mod tcd28_soff;
3633#[doc = "TCD Transfer Attributes"]
3634pub struct TCD28_ATTR {
3635 register: VolatileCell<u16>,
3636}
3637#[doc = "TCD Transfer Attributes"]
3638pub mod tcd28_attr;
3639#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3640pub struct TCD28_NBYTES_MLNO {
3641 register: VolatileCell<u32>,
3642}
3643#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3644pub mod tcd28_nbytes_mlno;
3645#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3646pub struct TCD28_NBYTES_MLOFFNO {
3647 register: VolatileCell<u32>,
3648}
3649#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3650pub mod tcd28_nbytes_mloffno;
3651#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3652pub struct TCD28_NBYTES_MLOFFYES {
3653 register: VolatileCell<u32>,
3654}
3655#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3656pub mod tcd28_nbytes_mloffyes;
3657#[doc = "TCD Last Source Address Adjustment"]
3658pub struct TCD28_SLAST {
3659 register: VolatileCell<u32>,
3660}
3661#[doc = "TCD Last Source Address Adjustment"]
3662pub mod tcd28_slast;
3663#[doc = "TCD Destination Address"]
3664pub struct TCD28_DADDR {
3665 register: VolatileCell<u32>,
3666}
3667#[doc = "TCD Destination Address"]
3668pub mod tcd28_daddr;
3669#[doc = "TCD Signed Destination Address Offset"]
3670pub struct TCD28_DOFF {
3671 register: VolatileCell<u16>,
3672}
3673#[doc = "TCD Signed Destination Address Offset"]
3674pub mod tcd28_doff;
3675#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3676pub struct TCD28_CITER_ELINKNO {
3677 register: VolatileCell<u16>,
3678}
3679#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3680pub mod tcd28_citer_elinkno;
3681#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3682pub struct TCD28_CITER_ELINKYES {
3683 register: VolatileCell<u16>,
3684}
3685#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3686pub mod tcd28_citer_elinkyes;
3687#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3688pub struct TCD28_DLASTSGA {
3689 register: VolatileCell<u32>,
3690}
3691#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3692pub mod tcd28_dlastsga;
3693#[doc = "TCD Control and Status"]
3694pub struct TCD28_CSR {
3695 register: VolatileCell<u16>,
3696}
3697#[doc = "TCD Control and Status"]
3698pub mod tcd28_csr;
3699#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3700pub struct TCD28_BITER_ELINKNO {
3701 register: VolatileCell<u16>,
3702}
3703#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3704pub mod tcd28_biter_elinkno;
3705#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3706pub struct TCD28_BITER_ELINKYES {
3707 register: VolatileCell<u16>,
3708}
3709#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3710pub mod tcd28_biter_elinkyes;
3711#[doc = "TCD Source Address"]
3712pub struct TCD29_SADDR {
3713 register: VolatileCell<u32>,
3714}
3715#[doc = "TCD Source Address"]
3716pub mod tcd29_saddr;
3717#[doc = "TCD Signed Source Address Offset"]
3718pub struct TCD29_SOFF {
3719 register: VolatileCell<u16>,
3720}
3721#[doc = "TCD Signed Source Address Offset"]
3722pub mod tcd29_soff;
3723#[doc = "TCD Transfer Attributes"]
3724pub struct TCD29_ATTR {
3725 register: VolatileCell<u16>,
3726}
3727#[doc = "TCD Transfer Attributes"]
3728pub mod tcd29_attr;
3729#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3730pub struct TCD29_NBYTES_MLNO {
3731 register: VolatileCell<u32>,
3732}
3733#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3734pub mod tcd29_nbytes_mlno;
3735#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3736pub struct TCD29_NBYTES_MLOFFNO {
3737 register: VolatileCell<u32>,
3738}
3739#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3740pub mod tcd29_nbytes_mloffno;
3741#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3742pub struct TCD29_NBYTES_MLOFFYES {
3743 register: VolatileCell<u32>,
3744}
3745#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3746pub mod tcd29_nbytes_mloffyes;
3747#[doc = "TCD Last Source Address Adjustment"]
3748pub struct TCD29_SLAST {
3749 register: VolatileCell<u32>,
3750}
3751#[doc = "TCD Last Source Address Adjustment"]
3752pub mod tcd29_slast;
3753#[doc = "TCD Destination Address"]
3754pub struct TCD29_DADDR {
3755 register: VolatileCell<u32>,
3756}
3757#[doc = "TCD Destination Address"]
3758pub mod tcd29_daddr;
3759#[doc = "TCD Signed Destination Address Offset"]
3760pub struct TCD29_DOFF {
3761 register: VolatileCell<u16>,
3762}
3763#[doc = "TCD Signed Destination Address Offset"]
3764pub mod tcd29_doff;
3765#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3766pub struct TCD29_CITER_ELINKNO {
3767 register: VolatileCell<u16>,
3768}
3769#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3770pub mod tcd29_citer_elinkno;
3771#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3772pub struct TCD29_CITER_ELINKYES {
3773 register: VolatileCell<u16>,
3774}
3775#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3776pub mod tcd29_citer_elinkyes;
3777#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3778pub struct TCD29_DLASTSGA {
3779 register: VolatileCell<u32>,
3780}
3781#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3782pub mod tcd29_dlastsga;
3783#[doc = "TCD Control and Status"]
3784pub struct TCD29_CSR {
3785 register: VolatileCell<u16>,
3786}
3787#[doc = "TCD Control and Status"]
3788pub mod tcd29_csr;
3789#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3790pub struct TCD29_BITER_ELINKNO {
3791 register: VolatileCell<u16>,
3792}
3793#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3794pub mod tcd29_biter_elinkno;
3795#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3796pub struct TCD29_BITER_ELINKYES {
3797 register: VolatileCell<u16>,
3798}
3799#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3800pub mod tcd29_biter_elinkyes;
3801#[doc = "TCD Source Address"]
3802pub struct TCD30_SADDR {
3803 register: VolatileCell<u32>,
3804}
3805#[doc = "TCD Source Address"]
3806pub mod tcd30_saddr;
3807#[doc = "TCD Signed Source Address Offset"]
3808pub struct TCD30_SOFF {
3809 register: VolatileCell<u16>,
3810}
3811#[doc = "TCD Signed Source Address Offset"]
3812pub mod tcd30_soff;
3813#[doc = "TCD Transfer Attributes"]
3814pub struct TCD30_ATTR {
3815 register: VolatileCell<u16>,
3816}
3817#[doc = "TCD Transfer Attributes"]
3818pub mod tcd30_attr;
3819#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3820pub struct TCD30_NBYTES_MLNO {
3821 register: VolatileCell<u32>,
3822}
3823#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3824pub mod tcd30_nbytes_mlno;
3825#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3826pub struct TCD30_NBYTES_MLOFFNO {
3827 register: VolatileCell<u32>,
3828}
3829#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3830pub mod tcd30_nbytes_mloffno;
3831#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3832pub struct TCD30_NBYTES_MLOFFYES {
3833 register: VolatileCell<u32>,
3834}
3835#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3836pub mod tcd30_nbytes_mloffyes;
3837#[doc = "TCD Last Source Address Adjustment"]
3838pub struct TCD30_SLAST {
3839 register: VolatileCell<u32>,
3840}
3841#[doc = "TCD Last Source Address Adjustment"]
3842pub mod tcd30_slast;
3843#[doc = "TCD Destination Address"]
3844pub struct TCD30_DADDR {
3845 register: VolatileCellz<u32>,
3846}
3847#[doc = "TCD Destination Address"]
3848pub mod tcd30_daddr;
3849#[doc = "TCD Signed Destination Address Offset"]
3850pub struct TCD30_DOFF {
3851 register: VolatileCell<u16>,
3852}
3853#[doc = "TCD Signed Destination Address Offset"]
3854pub mod tcd30_doff;
3855#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3856pub struct TCD30_CITER_ELINKNO {
3857 register: VolatileCell<u16>,
3858}
3859#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3860pub mod tcd30_citer_elinkno;
3861#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3862pub struct TCD30_CITER_ELINKYES {
3863 register: VolatileCell<u16>,
3864}
3865#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3866pub mod tcd30_citer_elinkyes;
3867#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3868pub struct TCD30_DLASTSGA {
3869 register: VolatileCell<u32>,
3870}
3871#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3872pub mod tcd30_dlastsga;
3873#[doc = "TCD Control and Status"]
3874pub struct TCD30_CSR {
3875 register: VolatileCell<u16>,
3876}
3877#[doc = "TCD Control and Status"]
3878pub mod tcd30_csr;
3879#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3880pub struct TCD30_BITER_ELINKNO {
3881 register: VolatileCell<u16>,
3882}
3883#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3884pub mod tcd30_biter_elinkno;
3885#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3886pub struct TCD30_BITER_ELINKYES {
3887 register: VolatileCell<u16>,
3888}
3889#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3890pub mod tcd30_biter_elinkyes;
3891#[doc = "TCD Source Address"]
3892pub struct TCD31_SADDR {
3893 register: VolatileCell<u32>,
3894}
3895#[doc = "TCD Source Address"]
3896pub mod tcd31_saddr;
3897#[doc = "TCD Signed Source Address Offset"]
3898pub struct TCD31_SOFF {
3899 register: VolatileCell<u16>,
3900}
3901#[doc = "TCD Signed Source Address Offset"]
3902pub mod tcd31_soff;
3903#[doc = "TCD Transfer Attributes"]
3904pub struct TCD31_ATTR {
3905 register: VolatileCell<u16>,
3906}
3907#[doc = "TCD Transfer Attributes"]
3908pub mod tcd31_attr;
3909#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3910pub struct TCD31_NBYTES_MLNO {
3911 register: VolatileCell<u32>,
3912}
3913#[doc = "TCD Minor Byte Count (Minor Loop Mapping Disabled)"]
3914pub mod tcd31_nbytes_mlno;
3915#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3916pub struct TCD31_NBYTES_MLOFFNO {
3917 register: VolatileCell<u32>,
3918}
3919#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping Enabled and Offset Disabled)"]
3920pub mod tcd31_nbytes_mloffno;
3921#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3922pub struct TCD31_NBYTES_MLOFFYES {
3923 register: VolatileCell<u32>,
3924}
3925#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)"]
3926pub mod tcd31_nbytes_mloffyes;
3927#[doc = "TCD Last Source Address Adjustment"]
3928pub struct TCD31_SLAST {
3929 register: VolatileCell<u32>,
3930}
3931#[doc = "TCD Last Source Address Adjustment"]
3932pub mod tcd31_slast;
3933#[doc = "TCD Destination Address"]
3934pub struct TCD31_DADDR {
3935 register: VolatileCell<u32>,
3936}
3937#[doc = "TCD Destination Address"]
3938pub mod tcd31_daddr;
3939#[doc = "TCD Signed Destination Address Offset"]
3940pub struct TCD31_DOFF {
3941 register: VolatileCell<u16>,
3942}
3943#[doc = "TCD Signed Destination Address Offset"]
3944pub mod tcd31_doff;
3945#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3946pub struct TCD31_CITER_ELINKNO {
3947 register: VolatileCell<u16>,
3948}
3949#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3950pub mod tcd31_citer_elinkno;
3951#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3952pub struct TCD31_CITER_ELINKYES {
3953 register: VolatileCell<u16>,
3954}
3955#[doc = "TCD Current Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3956pub mod tcd31_citer_elinkyes;
3957#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3958pub struct TCD31_DLASTSGA {
3959 register: VolatileCell<u32>,
3960}
3961#[doc = "TCD Last Destination Address Adjustment/Scatter Gather Address"]
3962pub mod tcd31_dlastsga;
3963#[doc = "TCD Control and Status"]
3964pub struct TCD31_CSR {
3965 register: VolatileCell<u32>,
3966}
3967#[doc = "TCD Control and Status"]
3968pub mod tcd31_csr;
3969#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3970pub struct TCD31_BITER_ELINKNO {
3971 register: VolatileCell<u16>,
3972}
3973#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Disabled)"]
3974pub mod tcd31_biter_elinkno;
3975#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3976pub struct TCD31_BITER_ELINKYES {
3977 register: VolatileCell<u16>,
3978}
3979#[doc = "TCD Beginning Minor Loop Link, Major Loop Count (Channel Linking Enabled)"]
3980pub mod tcd31_biter_elinkyes;
diff --git a/crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.rs b/crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.rs
new file mode 100644
index 000000000..ad2823b48
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.rs
@@ -0,0 +1 @@
' \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt b/crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt
new file mode 100644
index 000000000..4d5ad74df
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt
@@ -0,0 +1,2 @@
1CHAR 1 "\'"
2> error0..1 token("\'") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.rs b/crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.rs
new file mode 100644
index 000000000..e264a4152
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.rs
@@ -0,0 +1 @@
'🦀 \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt b/crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt
new file mode 100644
index 000000000..eafdb3c7c
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt
@@ -0,0 +1,2 @@
1CHAR 5 "\'🦀"
2> error0..5 token("\'🦀") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.rs b/crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.rs
new file mode 100644
index 000000000..cf74b4dad
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.rs
@@ -0,0 +1 @@
'\x7f \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt b/crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt
new file mode 100644
index 000000000..cc2b4866a
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt
@@ -0,0 +1,2 @@
1CHAR 5 "\'\\x7f"
2> error0..5 token("\'\\x7f") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.rs b/crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.rs
new file mode 100644
index 000000000..50be91f68
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.rs
@@ -0,0 +1 @@
'\u{20AA} \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt b/crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt
new file mode 100644
index 000000000..a6d422cb3
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt
@@ -0,0 +1,2 @@
1CHAR 9 "\'\\u{20AA}"
2> error0..9 token("\'\\u{20AA}") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.rs b/crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.rs
new file mode 100644
index 000000000..309ecfe47
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.rs
@@ -0,0 +1 @@
' \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt b/crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt
new file mode 100644
index 000000000..47e7baa70
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt
@@ -0,0 +1,2 @@
1CHAR 2 "\' "
2> error0..2 token("\' ") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.rs b/crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.rs
new file mode 100644
index 000000000..6ba258b10
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.rs
@@ -0,0 +1 @@
'\ \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt b/crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt
new file mode 100644
index 000000000..511029d80
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt
@@ -0,0 +1,2 @@
1CHAR 2 "\'\\"
2> error0..2 token("\'\\") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.rs b/crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.rs
new file mode 100644
index 000000000..78bef7e3e
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.rs
@@ -0,0 +1 @@
'\n \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt b/crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt
new file mode 100644
index 000000000..d2ba5742c
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt
@@ -0,0 +1,2 @@
1CHAR 3 "\'\\n"
2> error0..3 token("\'\\n") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.rs b/crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.rs
new file mode 100644
index 000000000..a0e722065
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.rs
@@ -0,0 +1 @@
'\' \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt b/crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt
new file mode 100644
index 000000000..ae9a7f0e2
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt
@@ -0,0 +1,2 @@
1CHAR 3 "\'\\\'"
2> error0..3 token("\'\\\'") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.rs b/crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.rs
new file mode 100644
index 000000000..795dc7e25
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.rs
@@ -0,0 +1 @@
b' \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt b/crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt
new file mode 100644
index 000000000..ff1504592
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt
@@ -0,0 +1,2 @@
1BYTE 2 "b\'"
2> error0..2 token("b\'") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.rs b/crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.rs
new file mode 100644
index 000000000..c9230dc24
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.rs
@@ -0,0 +1 @@
b'🦀 \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt b/crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt
new file mode 100644
index 000000000..34f7bd6d4
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt
@@ -0,0 +1,2 @@
1BYTE 6 "b\'🦀"
2> error0..6 token("b\'🦀") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.rs b/crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.rs
new file mode 100644
index 000000000..d146a8090
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.rs
@@ -0,0 +1 @@
b'\x7f \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt b/crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt
new file mode 100644
index 000000000..c964d0f00
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt
@@ -0,0 +1,2 @@
1BYTE 6 "b\'\\x7f"
2> error0..6 token("b\'\\x7f") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.rs b/crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.rs
new file mode 100644
index 000000000..a3dec7c25
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.rs
@@ -0,0 +1 @@
b'\u{20AA} \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt b/crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt
new file mode 100644
index 000000000..cc65fb86f
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt
@@ -0,0 +1,2 @@
1BYTE 10 "b\'\\u{20AA}"
2> error0..10 token("b\'\\u{20AA}") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.rs b/crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.rs
new file mode 100644
index 000000000..93b7f9c87
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.rs
@@ -0,0 +1 @@
b' \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt b/crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt
new file mode 100644
index 000000000..800834a14
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt
@@ -0,0 +1,2 @@
1BYTE 3 "b\' "
2> error0..3 token("b\' ") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.rs b/crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.rs
new file mode 100644
index 000000000..abffa5037
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.rs
@@ -0,0 +1 @@
b'\ \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt b/crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt
new file mode 100644
index 000000000..7b85ee646
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt
@@ -0,0 +1,2 @@
1BYTE 3 "b\'\\"
2> error0..3 token("b\'\\") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.rs b/crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.rs
new file mode 100644
index 000000000..4f46836a9
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.rs
@@ -0,0 +1 @@
b'\n \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt b/crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt
new file mode 100644
index 000000000..4b9a63117
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt
@@ -0,0 +1,2 @@
1BYTE 4 "b\'\\n"
2> error0..4 token("b\'\\n") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.rs b/crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.rs
new file mode 100644
index 000000000..645b641ee
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.rs
@@ -0,0 +1 @@
b'\' \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt b/crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt
new file mode 100644
index 000000000..fe337f8d3
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt
@@ -0,0 +1,2 @@
1BYTE 4 "b\'\\\'"
2> error0..4 token("b\'\\\'") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0017_unclosed_string_at_eof.rs b/crates/syntax/test_data/lexer/err/0017_unclosed_string_at_eof.rs
new file mode 100644
index 000000000..9d68933c4
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0017_unclosed_string_at_eof.rs
@@ -0,0 +1 @@
" \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0017_unclosed_string_at_eof.txt b/crates/syntax/test_data/lexer/err/0017_unclosed_string_at_eof.txt
new file mode 100644
index 000000000..d11a8d880
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0017_unclosed_string_at_eof.txt
@@ -0,0 +1,2 @@
1STRING 1 "\""
2> error0..1 token("\"") msg(Missing trailing `"` symbol to terminate the string literal)
diff --git a/crates/syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.rs b/crates/syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.rs
new file mode 100644
index 000000000..d439b8d2a
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.rs
@@ -0,0 +1 @@
"🦀 \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.txt b/crates/syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.txt
new file mode 100644
index 000000000..167f942d1
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.txt
@@ -0,0 +1,2 @@
1STRING 5 "\"🦀"
2> error0..5 token("\"🦀") msg(Missing trailing `"` symbol to terminate the string literal)
diff --git a/crates/syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.rs b/crates/syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.rs
new file mode 100644
index 000000000..56186a344
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.rs
@@ -0,0 +1 @@
"\x7f \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.txt b/crates/syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.txt
new file mode 100644
index 000000000..224c653d2
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.txt
@@ -0,0 +1,2 @@
1STRING 5 "\"\\x7f"
2> error0..5 token("\"\\x7f") msg(Missing trailing `"` symbol to terminate the string literal)
diff --git a/crates/syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.rs b/crates/syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.rs
new file mode 100644
index 000000000..ed24095c3
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.rs
@@ -0,0 +1 @@
"\u{20AA} \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.txt b/crates/syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.txt
new file mode 100644
index 000000000..48975bbcb
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.txt
@@ -0,0 +1,2 @@
1STRING 9 "\"\\u{20AA}"
2> error0..9 token("\"\\u{20AA}") msg(Missing trailing `"` symbol to terminate the string literal)
diff --git a/crates/syntax/test_data/lexer/err/0021_unclosed_string_with_space.rs b/crates/syntax/test_data/lexer/err/0021_unclosed_string_with_space.rs
new file mode 100644
index 000000000..72cdc841f
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0021_unclosed_string_with_space.rs
@@ -0,0 +1 @@
" \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0021_unclosed_string_with_space.txt b/crates/syntax/test_data/lexer/err/0021_unclosed_string_with_space.txt
new file mode 100644
index 000000000..a823cca7a
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0021_unclosed_string_with_space.txt
@@ -0,0 +1,2 @@
1STRING 2 "\" "
2> error0..2 token("\" ") msg(Missing trailing `"` symbol to terminate the string literal)
diff --git a/crates/syntax/test_data/lexer/err/0022_unclosed_string_with_slash.rs b/crates/syntax/test_data/lexer/err/0022_unclosed_string_with_slash.rs
new file mode 100644
index 000000000..00a258400
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0022_unclosed_string_with_slash.rs
@@ -0,0 +1 @@
"\ \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0022_unclosed_string_with_slash.txt b/crates/syntax/test_data/lexer/err/0022_unclosed_string_with_slash.txt
new file mode 100644
index 000000000..0914f001f
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0022_unclosed_string_with_slash.txt
@@ -0,0 +1,2 @@
1STRING 2 "\"\\"
2> error0..2 token("\"\\") msg(Missing trailing `"` symbol to terminate the string literal)
diff --git a/crates/syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.rs b/crates/syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.rs
new file mode 100644
index 000000000..a0c29b8cf
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.rs
@@ -0,0 +1 @@
"\n \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.txt b/crates/syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.txt
new file mode 100644
index 000000000..5674b55fd
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.txt
@@ -0,0 +1,2 @@
1STRING 3 "\"\\n"
2> error0..3 token("\"\\n") msg(Missing trailing `"` symbol to terminate the string literal)
diff --git a/crates/syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.rs b/crates/syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.rs
new file mode 100644
index 000000000..403c2d6dd
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.rs
@@ -0,0 +1 @@
"\" \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.txt b/crates/syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.txt
new file mode 100644
index 000000000..4c9a774e4
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.txt
@@ -0,0 +1,2 @@
1STRING 3 "\"\\\""
2> error0..3 token("\"\\\"") msg(Missing trailing `"` symbol to terminate the string literal)
diff --git a/crates/syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.rs b/crates/syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.rs
new file mode 100644
index 000000000..36f4f4321
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.rs
@@ -0,0 +1 @@
b" \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.txt b/crates/syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.txt
new file mode 100644
index 000000000..04e6b0aa4
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.txt
@@ -0,0 +1,2 @@
1BYTE_STRING 2 "b\""
2> error0..2 token("b\"") msg(Missing trailing `"` symbol to terminate the byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.rs b/crates/syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.rs
new file mode 100644
index 000000000..3c23a0372
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.rs
@@ -0,0 +1 @@
b"🦀 \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.txt b/crates/syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.txt
new file mode 100644
index 000000000..0576a0609
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.txt
@@ -0,0 +1,2 @@
1BYTE_STRING 6 "b\"🦀"
2> error0..6 token("b\"🦀") msg(Missing trailing `"` symbol to terminate the byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.rs b/crates/syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.rs
new file mode 100644
index 000000000..836c112c1
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.rs
@@ -0,0 +1 @@
b"\x7f \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.txt b/crates/syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.txt
new file mode 100644
index 000000000..541a013d8
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.txt
@@ -0,0 +1,2 @@
1BYTE_STRING 6 "b\"\\x7f"
2> error0..6 token("b\"\\x7f") msg(Missing trailing `"` symbol to terminate the byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.rs b/crates/syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.rs
new file mode 100644
index 000000000..1c6df1d00
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.rs
@@ -0,0 +1 @@
b"\u{20AA} \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.txt b/crates/syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.txt
new file mode 100644
index 000000000..71b0fb211
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.txt
@@ -0,0 +1,2 @@
1BYTE_STRING 10 "b\"\\u{20AA}"
2> error0..10 token("b\"\\u{20AA}") msg(Missing trailing `"` symbol to terminate the byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.rs b/crates/syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.rs
new file mode 100644
index 000000000..d6898541e
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.rs
@@ -0,0 +1 @@
b" \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.txt b/crates/syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.txt
new file mode 100644
index 000000000..bd5058bc1
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.txt
@@ -0,0 +1,2 @@
1BYTE_STRING 3 "b\" "
2> error0..3 token("b\" ") msg(Missing trailing `"` symbol to terminate the byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.rs b/crates/syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.rs
new file mode 100644
index 000000000..cce661538
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.rs
@@ -0,0 +1 @@
b"\ \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.txt b/crates/syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.txt
new file mode 100644
index 000000000..7f94f10ba
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.txt
@@ -0,0 +1,2 @@
1BYTE_STRING 3 "b\"\\"
2> error0..3 token("b\"\\") msg(Missing trailing `"` symbol to terminate the byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.rs b/crates/syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.rs
new file mode 100644
index 000000000..5e680aabb
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.rs
@@ -0,0 +1 @@
b"\n \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.txt b/crates/syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.txt
new file mode 100644
index 000000000..9c3c089d7
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.txt
@@ -0,0 +1,2 @@
1BYTE_STRING 4 "b\"\\n"
2> error0..4 token("b\"\\n") msg(Missing trailing `"` symbol to terminate the byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.rs b/crates/syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.rs
new file mode 100644
index 000000000..f2ff58ba9
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.rs
@@ -0,0 +1 @@
b"\" \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.txt b/crates/syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.txt
new file mode 100644
index 000000000..884b12c8e
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.txt
@@ -0,0 +1,2 @@
1BYTE_STRING 4 "b\"\\\""
2> error0..4 token("b\"\\\"") msg(Missing trailing `"` symbol to terminate the byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.rs b/crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.rs
new file mode 100644
index 000000000..557c59b62
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.rs
@@ -0,0 +1 @@
r##" \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt b/crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt
new file mode 100644
index 000000000..6fd59ccc0
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt
@@ -0,0 +1,2 @@
1RAW_STRING 4 "r##\""
2> error0..4 token("r##\"") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal)
diff --git a/crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.rs b/crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.rs
new file mode 100644
index 000000000..bd046e4bb
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.rs
@@ -0,0 +1 @@
r##"🦀 \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt b/crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt
new file mode 100644
index 000000000..8d9ca0e8f
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt
@@ -0,0 +1,2 @@
1RAW_STRING 8 "r##\"🦀"
2> error0..8 token("r##\"🦀") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal)
diff --git a/crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.rs b/crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.rs
new file mode 100644
index 000000000..5bec883dc
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.rs
@@ -0,0 +1 @@
r##"\x7f \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt b/crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt
new file mode 100644
index 000000000..a906380c7
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt
@@ -0,0 +1,2 @@
1RAW_STRING 8 "r##\"\\x7f"
2> error0..8 token("r##\"\\x7f") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal)
diff --git a/crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.rs b/crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.rs
new file mode 100644
index 000000000..bf05c3913
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.rs
@@ -0,0 +1 @@
r##"\u{20AA} \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt b/crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt
new file mode 100644
index 000000000..5667c6149
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt
@@ -0,0 +1,2 @@
1RAW_STRING 12 "r##\"\\u{20AA}"
2> error0..12 token("r##\"\\u{20AA}") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal)
diff --git a/crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.rs b/crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.rs
new file mode 100644
index 000000000..f104bae4f
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.rs
@@ -0,0 +1 @@
r##" \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt b/crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt
new file mode 100644
index 000000000..141c8268e
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt
@@ -0,0 +1,2 @@
1RAW_STRING 5 "r##\" "
2> error0..5 token("r##\" ") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal)
diff --git a/crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.rs b/crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.rs
new file mode 100644
index 000000000..9242077b8
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.rs
@@ -0,0 +1 @@
r##"\ \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt b/crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt
new file mode 100644
index 000000000..f61d4cc91
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt
@@ -0,0 +1,2 @@
1RAW_STRING 5 "r##\"\\"
2> error0..5 token("r##\"\\") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal)
diff --git a/crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.rs b/crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.rs
new file mode 100644
index 000000000..db1c16f2b
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.rs
@@ -0,0 +1 @@
r##"\n \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt b/crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt
new file mode 100644
index 000000000..12e2c0fc0
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt
@@ -0,0 +1,2 @@
1RAW_STRING 6 "r##\"\\n"
2> error0..6 token("r##\"\\n") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal)
diff --git a/crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.rs b/crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.rs
new file mode 100644
index 000000000..ae5bae622
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.rs
@@ -0,0 +1 @@
br##" \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt b/crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt
new file mode 100644
index 000000000..fe12cb5fc
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt
@@ -0,0 +1,2 @@
1RAW_BYTE_STRING 5 "br##\""
2> error0..5 token("br##\"") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.rs b/crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.rs
new file mode 100644
index 000000000..9ef01207a
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.rs
@@ -0,0 +1 @@
br##"🦀 \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt b/crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt
new file mode 100644
index 000000000..5be2a7861
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt
@@ -0,0 +1,2 @@
1RAW_BYTE_STRING 9 "br##\"🦀"
2> error0..9 token("br##\"🦀") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.rs b/crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.rs
new file mode 100644
index 000000000..d50270afe
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.rs
@@ -0,0 +1 @@
br##"\x7f \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt b/crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt
new file mode 100644
index 000000000..6cbe08d07
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt
@@ -0,0 +1,2 @@
1RAW_BYTE_STRING 9 "br##\"\\x7f"
2> error0..9 token("br##\"\\x7f") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.rs b/crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.rs
new file mode 100644
index 000000000..90e299a1a
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.rs
@@ -0,0 +1 @@
br##"\u{20AA} \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt b/crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt
new file mode 100644
index 000000000..f56a4f984
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt
@@ -0,0 +1,2 @@
1RAW_BYTE_STRING 13 "br##\"\\u{20AA}"
2> error0..13 token("br##\"\\u{20AA}") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.rs b/crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.rs
new file mode 100644
index 000000000..14c602fd2
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.rs
@@ -0,0 +1 @@
br##" \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt b/crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt
new file mode 100644
index 000000000..3d32ce34e
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt
@@ -0,0 +1,2 @@
1RAW_BYTE_STRING 6 "br##\" "
2> error0..6 token("br##\" ") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.rs b/crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.rs
new file mode 100644
index 000000000..0b3c015d7
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.rs
@@ -0,0 +1 @@
br##"\ \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt b/crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt
new file mode 100644
index 000000000..320fea177
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt
@@ -0,0 +1,2 @@
1RAW_BYTE_STRING 6 "br##\"\\"
2> error0..6 token("br##\"\\") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.rs b/crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.rs
new file mode 100644
index 000000000..0d8b0e7ab
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.rs
@@ -0,0 +1 @@
br##"\n \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt b/crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt
new file mode 100644
index 000000000..b3a56380c
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt
@@ -0,0 +1,2 @@
1RAW_BYTE_STRING 7 "br##\"\\n"
2> error0..7 token("br##\"\\n") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.rs b/crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.rs
new file mode 100644
index 000000000..eddf8d080
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.rs
@@ -0,0 +1 @@
r## \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt b/crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt
new file mode 100644
index 000000000..5af1e2d97
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt
@@ -0,0 +1,2 @@
1RAW_STRING 3 "r##"
2> error0..3 token("r##") msg(Missing `"` symbol after `#` symbols to begin the raw string literal)
diff --git a/crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.rs b/crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.rs
new file mode 100644
index 000000000..7e8cadf4f
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.rs
@@ -0,0 +1 @@
br## \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt b/crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt
new file mode 100644
index 000000000..aec7afd92
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt
@@ -0,0 +1,2 @@
1RAW_BYTE_STRING 4 "br##"
2> error0..4 token("br##") msg(Missing `"` symbol after `#` symbols to begin the raw byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.rs b/crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.rs
new file mode 100644
index 000000000..534668a9b
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.rs
@@ -0,0 +1 @@
r## I lack a quote! \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt b/crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt
new file mode 100644
index 000000000..e22fe5374
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt
@@ -0,0 +1,10 @@
1RAW_STRING 4 "r## "
2IDENT 1 "I"
3WHITESPACE 1 " "
4IDENT 4 "lack"
5WHITESPACE 1 " "
6IDENT 1 "a"
7WHITESPACE 1 " "
8IDENT 5 "quote"
9BANG 1 "!"
10> error0..4 token("r## ") msg(Missing `"` symbol after `#` symbols to begin the raw string literal)
diff --git a/crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.rs b/crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.rs
new file mode 100644
index 000000000..d9b55455a
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.rs
@@ -0,0 +1 @@
br## I lack a quote! \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt b/crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt
new file mode 100644
index 000000000..d74ea4c27
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt
@@ -0,0 +1,10 @@
1RAW_BYTE_STRING 5 "br## "
2IDENT 1 "I"
3WHITESPACE 1 " "
4IDENT 4 "lack"
5WHITESPACE 1 " "
6IDENT 1 "a"
7WHITESPACE 1 " "
8IDENT 5 "quote"
9BANG 1 "!"
10> error0..5 token("br## ") msg(Missing `"` symbol after `#` symbols to begin the raw byte string literal)
diff --git a/crates/syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.rs b/crates/syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.rs
new file mode 100644
index 000000000..22e83649f
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.rs
@@ -0,0 +1 @@
/* \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.txt b/crates/syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.txt
new file mode 100644
index 000000000..2a256e9df
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.txt
@@ -0,0 +1,2 @@
1COMMENT 2 "/*"
2> error0..2 token("/*") msg(Missing trailing `*/` symbols to terminate the block comment)
diff --git a/crates/syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.rs b/crates/syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.rs
new file mode 100644
index 000000000..c45c2844d
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.rs
@@ -0,0 +1 @@
/* comment
diff --git a/crates/syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.txt b/crates/syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.txt
new file mode 100644
index 000000000..8e8490302
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.txt
@@ -0,0 +1,2 @@
1COMMENT 11 "/* comment\n"
2> error0..11 token("/* comment\n") msg(Missing trailing `*/` symbols to terminate the block comment)
diff --git a/crates/syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.rs b/crates/syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.rs
new file mode 100644
index 000000000..3fcfc9660
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.rs
@@ -0,0 +1 @@
/* /* /*
diff --git a/crates/syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.txt b/crates/syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.txt
new file mode 100644
index 000000000..b7d28fc05
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.txt
@@ -0,0 +1,2 @@
1COMMENT 9 "/* /* /*\n"
2> error0..9 token("/* /* /*\n") msg(Missing trailing `*/` symbols to terminate the block comment)
diff --git a/crates/syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.rs b/crates/syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.rs
new file mode 100644
index 000000000..26c898f01
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.rs
@@ -0,0 +1 @@
/** /*! /* comment */ */
diff --git a/crates/syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.txt b/crates/syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.txt
new file mode 100644
index 000000000..4742d2c12
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.txt
@@ -0,0 +1,2 @@
1COMMENT 25 "/** /*! /* comment */ */\n"
2> error0..25 token("/** /*! /* comment */ */\n") msg(Missing trailing `*/` symbols to terminate the block comment)
diff --git a/crates/syntax/test_data/lexer/err/0055_empty_int.rs b/crates/syntax/test_data/lexer/err/0055_empty_int.rs
new file mode 100644
index 000000000..aa2a9fdca
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0055_empty_int.rs
@@ -0,0 +1,17 @@
10b
20o
30x
4
50b_
60o_
70x_
8
90bnoDigit
100onoDigit
110xnoDigit
12
130xG
140xg
15
160x_g
170x_G
diff --git a/crates/syntax/test_data/lexer/err/0055_empty_int.txt b/crates/syntax/test_data/lexer/err/0055_empty_int.txt
new file mode 100644
index 000000000..bcd094b6e
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0055_empty_int.txt
@@ -0,0 +1,39 @@
1INT_NUMBER 2 "0b"
2WHITESPACE 1 "\n"
3INT_NUMBER 2 "0o"
4WHITESPACE 1 "\n"
5INT_NUMBER 2 "0x"
6WHITESPACE 2 "\n\n"
7INT_NUMBER 3 "0b_"
8WHITESPACE 1 "\n"
9INT_NUMBER 3 "0o_"
10WHITESPACE 1 "\n"
11INT_NUMBER 3 "0x_"
12WHITESPACE 2 "\n\n"
13INT_NUMBER 9 "0bnoDigit"
14WHITESPACE 1 "\n"
15INT_NUMBER 9 "0onoDigit"
16WHITESPACE 1 "\n"
17INT_NUMBER 9 "0xnoDigit"
18WHITESPACE 2 "\n\n"
19INT_NUMBER 3 "0xG"
20WHITESPACE 1 "\n"
21INT_NUMBER 3 "0xg"
22WHITESPACE 2 "\n\n"
23INT_NUMBER 4 "0x_g"
24WHITESPACE 1 "\n"
25INT_NUMBER 4 "0x_G"
26WHITESPACE 1 "\n"
27> error0..2 token("0b") msg(Missing digits after the integer base prefix)
28> error3..5 token("0o") msg(Missing digits after the integer base prefix)
29> error6..8 token("0x") msg(Missing digits after the integer base prefix)
30> error10..13 token("0b_") msg(Missing digits after the integer base prefix)
31> error14..17 token("0o_") msg(Missing digits after the integer base prefix)
32> error18..21 token("0x_") msg(Missing digits after the integer base prefix)
33> error23..32 token("0bnoDigit") msg(Missing digits after the integer base prefix)
34> error33..42 token("0onoDigit") msg(Missing digits after the integer base prefix)
35> error43..52 token("0xnoDigit") msg(Missing digits after the integer base prefix)
36> error54..57 token("0xG") msg(Missing digits after the integer base prefix)
37> error58..61 token("0xg") msg(Missing digits after the integer base prefix)
38> error63..67 token("0x_g") msg(Missing digits after the integer base prefix)
39> error68..72 token("0x_G") msg(Missing digits after the integer base prefix)
diff --git a/crates/syntax/test_data/lexer/err/0056_empty_exponent.rs b/crates/syntax/test_data/lexer/err/0056_empty_exponent.rs
new file mode 100644
index 000000000..286584c88
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0056_empty_exponent.rs
@@ -0,0 +1,22 @@
10e
20E
3
442e+
542e-
642E+
742E-
8
942.e+
1042.e-
1142.E+
1242.E-
13
1442.2e+
1542.2e-
1642.2E+
1742.2E-
18
1942.2e+f32
2042.2e-f32
2142.2E+f32
2242.2E-f32
diff --git a/crates/syntax/test_data/lexer/err/0056_empty_exponent.txt b/crates/syntax/test_data/lexer/err/0056_empty_exponent.txt
new file mode 100644
index 000000000..6a645a6a4
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0056_empty_exponent.txt
@@ -0,0 +1,62 @@
1FLOAT_NUMBER 2 "0e"
2WHITESPACE 1 "\n"
3FLOAT_NUMBER 2 "0E"
4WHITESPACE 2 "\n\n"
5FLOAT_NUMBER 4 "42e+"
6WHITESPACE 1 "\n"
7FLOAT_NUMBER 4 "42e-"
8WHITESPACE 1 "\n"
9FLOAT_NUMBER 4 "42E+"
10WHITESPACE 1 "\n"
11FLOAT_NUMBER 4 "42E-"
12WHITESPACE 2 "\n\n"
13INT_NUMBER 2 "42"
14DOT 1 "."
15IDENT 1 "e"
16PLUS 1 "+"
17WHITESPACE 1 "\n"
18INT_NUMBER 2 "42"
19DOT 1 "."
20IDENT 1 "e"
21MINUS 1 "-"
22WHITESPACE 1 "\n"
23INT_NUMBER 2 "42"
24DOT 1 "."
25IDENT 1 "E"
26PLUS 1 "+"
27WHITESPACE 1 "\n"
28INT_NUMBER 2 "42"
29DOT 1 "."
30IDENT 1 "E"
31MINUS 1 "-"
32WHITESPACE 2 "\n\n"
33FLOAT_NUMBER 6 "42.2e+"
34WHITESPACE 1 "\n"
35FLOAT_NUMBER 6 "42.2e-"
36WHITESPACE 1 "\n"
37FLOAT_NUMBER 6 "42.2E+"
38WHITESPACE 1 "\n"
39FLOAT_NUMBER 6 "42.2E-"
40WHITESPACE 2 "\n\n"
41FLOAT_NUMBER 9 "42.2e+f32"
42WHITESPACE 1 "\n"
43FLOAT_NUMBER 9 "42.2e-f32"
44WHITESPACE 1 "\n"
45FLOAT_NUMBER 9 "42.2E+f32"
46WHITESPACE 1 "\n"
47FLOAT_NUMBER 9 "42.2E-f32"
48WHITESPACE 1 "\n"
49> error0..2 token("0e") msg(Missing digits after the exponent symbol)
50> error3..5 token("0E") msg(Missing digits after the exponent symbol)
51> error7..11 token("42e+") msg(Missing digits after the exponent symbol)
52> error12..16 token("42e-") msg(Missing digits after the exponent symbol)
53> error17..21 token("42E+") msg(Missing digits after the exponent symbol)
54> error22..26 token("42E-") msg(Missing digits after the exponent symbol)
55> error53..59 token("42.2e+") msg(Missing digits after the exponent symbol)
56> error60..66 token("42.2e-") msg(Missing digits after the exponent symbol)
57> error67..73 token("42.2E+") msg(Missing digits after the exponent symbol)
58> error74..80 token("42.2E-") msg(Missing digits after the exponent symbol)
59> error82..91 token("42.2e+f32") msg(Missing digits after the exponent symbol)
60> error92..101 token("42.2e-f32") msg(Missing digits after the exponent symbol)
61> error102..111 token("42.2E+f32") msg(Missing digits after the exponent symbol)
62> error112..121 token("42.2E-f32") msg(Missing digits after the exponent symbol)
diff --git a/crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.rs b/crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.rs
new file mode 100644
index 000000000..a7698a404
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.rs
@@ -0,0 +1,2 @@
1'1
2'1lifetime
diff --git a/crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt b/crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt
new file mode 100644
index 000000000..e138bcebc
--- /dev/null
+++ b/crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt
@@ -0,0 +1,6 @@
1LIFETIME 2 "\'1"
2WHITESPACE 1 "\n"
3LIFETIME 10 "\'1lifetime"
4WHITESPACE 1 "\n"
5> error0..2 token("\'1") msg(Lifetime name cannot start with a number)
6> error3..13 token("\'1lifetime") msg(Lifetime name cannot start with a number)
diff --git a/crates/syntax/test_data/lexer/ok/0001_hello.rs b/crates/syntax/test_data/lexer/ok/0001_hello.rs
new file mode 100644
index 000000000..95d09f2b1
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0001_hello.rs
@@ -0,0 +1 @@
hello world \ No newline at end of file
diff --git a/crates/syntax/test_data/lexer/ok/0001_hello.txt b/crates/syntax/test_data/lexer/ok/0001_hello.txt
new file mode 100644
index 000000000..27a5940a9
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0001_hello.txt
@@ -0,0 +1,3 @@
1IDENT 5 "hello"
2WHITESPACE 1 " "
3IDENT 5 "world"
diff --git a/crates/syntax/test_data/lexer/ok/0002_whitespace.rs b/crates/syntax/test_data/lexer/ok/0002_whitespace.rs
new file mode 100644
index 000000000..08fce1418
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0002_whitespace.rs
@@ -0,0 +1,4 @@
1a b c
2d
3
4e f
diff --git a/crates/syntax/test_data/lexer/ok/0002_whitespace.txt b/crates/syntax/test_data/lexer/ok/0002_whitespace.txt
new file mode 100644
index 000000000..01d260918
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0002_whitespace.txt
@@ -0,0 +1,12 @@
1IDENT 1 "a"
2WHITESPACE 1 " "
3IDENT 1 "b"
4WHITESPACE 2 " "
5IDENT 1 "c"
6WHITESPACE 1 "\n"
7IDENT 1 "d"
8WHITESPACE 2 "\n\n"
9IDENT 1 "e"
10WHITESPACE 1 "\t"
11IDENT 1 "f"
12WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0003_ident.rs b/crates/syntax/test_data/lexer/ok/0003_ident.rs
new file mode 100644
index 000000000..c05c9c009
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0003_ident.rs
@@ -0,0 +1 @@
foo foo_ _foo _ __ x привет
diff --git a/crates/syntax/test_data/lexer/ok/0003_ident.txt b/crates/syntax/test_data/lexer/ok/0003_ident.txt
new file mode 100644
index 000000000..4a0d5c053
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0003_ident.txt
@@ -0,0 +1,14 @@
1IDENT 3 "foo"
2WHITESPACE 1 " "
3IDENT 4 "foo_"
4WHITESPACE 1 " "
5IDENT 4 "_foo"
6WHITESPACE 1 " "
7UNDERSCORE 1 "_"
8WHITESPACE 1 " "
9IDENT 2 "__"
10WHITESPACE 1 " "
11IDENT 1 "x"
12WHITESPACE 1 " "
13IDENT 12 "привет"
14WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0004_numbers.rs b/crates/syntax/test_data/lexer/ok/0004_numbers.rs
new file mode 100644
index 000000000..bc761c235
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0004_numbers.rs
@@ -0,0 +1,9 @@
10 00 0_ 0. 0z
201790 0b1790 0o1790 0x1790aAbBcCdDeEfF 001279 0_1279 0.1279 0e1279 0E1279
30..2
40.foo()
50e+1
60.e+1
70.0E-2
80___0.10000____0000e+111__
91i64 92.0f32 11__s
diff --git a/crates/syntax/test_data/lexer/ok/0004_numbers.txt b/crates/syntax/test_data/lexer/ok/0004_numbers.txt
new file mode 100644
index 000000000..e19fc5789
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0004_numbers.txt
@@ -0,0 +1,57 @@
1INT_NUMBER 1 "0"
2WHITESPACE 1 " "
3INT_NUMBER 2 "00"
4WHITESPACE 1 " "
5INT_NUMBER 2 "0_"
6WHITESPACE 1 " "
7FLOAT_NUMBER 2 "0."
8WHITESPACE 1 " "
9INT_NUMBER 2 "0z"
10WHITESPACE 1 "\n"
11INT_NUMBER 5 "01790"
12WHITESPACE 1 " "
13INT_NUMBER 6 "0b1790"
14WHITESPACE 1 " "
15INT_NUMBER 6 "0o1790"
16WHITESPACE 1 " "
17INT_NUMBER 18 "0x1790aAbBcCdDeEfF"
18WHITESPACE 1 " "
19INT_NUMBER 6 "001279"
20WHITESPACE 1 " "
21INT_NUMBER 6 "0_1279"
22WHITESPACE 1 " "
23FLOAT_NUMBER 6 "0.1279"
24WHITESPACE 1 " "
25FLOAT_NUMBER 6 "0e1279"
26WHITESPACE 1 " "
27FLOAT_NUMBER 6 "0E1279"
28WHITESPACE 1 "\n"
29INT_NUMBER 1 "0"
30DOT 1 "."
31DOT 1 "."
32INT_NUMBER 1 "2"
33WHITESPACE 1 "\n"
34INT_NUMBER 1 "0"
35DOT 1 "."
36IDENT 3 "foo"
37L_PAREN 1 "("
38R_PAREN 1 ")"
39WHITESPACE 1 "\n"
40FLOAT_NUMBER 4 "0e+1"
41WHITESPACE 1 "\n"
42INT_NUMBER 1 "0"
43DOT 1 "."
44IDENT 1 "e"
45PLUS 1 "+"
46INT_NUMBER 1 "1"
47WHITESPACE 1 "\n"
48FLOAT_NUMBER 6 "0.0E-2"
49WHITESPACE 1 "\n"
50FLOAT_NUMBER 26 "0___0.10000____0000e+111__"
51WHITESPACE 1 "\n"
52INT_NUMBER 4 "1i64"
53WHITESPACE 1 " "
54FLOAT_NUMBER 7 "92.0f32"
55WHITESPACE 1 " "
56INT_NUMBER 5 "11__s"
57WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0005_symbols.rs b/crates/syntax/test_data/lexer/ok/0005_symbols.rs
new file mode 100644
index 000000000..487569b5a
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0005_symbols.rs
@@ -0,0 +1,6 @@
1; , ( ) { } [ ] < > @ # ~ ? $ & | + * / ^ %
2. .. ... ..=
3: ::
4= =>
5! !=
6- ->
diff --git a/crates/syntax/test_data/lexer/ok/0005_symbols.txt b/crates/syntax/test_data/lexer/ok/0005_symbols.txt
new file mode 100644
index 000000000..2049c2f1d
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0005_symbols.txt
@@ -0,0 +1,77 @@
1SEMICOLON 1 ";"
2WHITESPACE 1 " "
3COMMA 1 ","
4WHITESPACE 1 " "
5L_PAREN 1 "("
6WHITESPACE 1 " "
7R_PAREN 1 ")"
8WHITESPACE 1 " "
9L_CURLY 1 "{"
10WHITESPACE 1 " "
11R_CURLY 1 "}"
12WHITESPACE 1 " "
13L_BRACK 1 "["
14WHITESPACE 1 " "
15R_BRACK 1 "]"
16WHITESPACE 1 " "
17L_ANGLE 1 "<"
18WHITESPACE 1 " "
19R_ANGLE 1 ">"
20WHITESPACE 1 " "
21AT 1 "@"
22WHITESPACE 1 " "
23POUND 1 "#"
24WHITESPACE 1 " "
25TILDE 1 "~"
26WHITESPACE 1 " "
27QUESTION 1 "?"
28WHITESPACE 1 " "
29DOLLAR 1 "$"
30WHITESPACE 1 " "
31AMP 1 "&"
32WHITESPACE 1 " "
33PIPE 1 "|"
34WHITESPACE 1 " "
35PLUS 1 "+"
36WHITESPACE 1 " "
37STAR 1 "*"
38WHITESPACE 1 " "
39SLASH 1 "/"
40WHITESPACE 1 " "
41CARET 1 "^"
42WHITESPACE 1 " "
43PERCENT 1 "%"
44WHITESPACE 1 "\n"
45DOT 1 "."
46WHITESPACE 1 " "
47DOT 1 "."
48DOT 1 "."
49WHITESPACE 1 " "
50DOT 1 "."
51DOT 1 "."
52DOT 1 "."
53WHITESPACE 1 " "
54DOT 1 "."
55DOT 1 "."
56EQ 1 "="
57WHITESPACE 1 "\n"
58COLON 1 ":"
59WHITESPACE 1 " "
60COLON 1 ":"
61COLON 1 ":"
62WHITESPACE 1 "\n"
63EQ 1 "="
64WHITESPACE 1 " "
65EQ 1 "="
66R_ANGLE 1 ">"
67WHITESPACE 1 "\n"
68BANG 1 "!"
69WHITESPACE 1 " "
70BANG 1 "!"
71EQ 1 "="
72WHITESPACE 1 "\n"
73MINUS 1 "-"
74WHITESPACE 1 " "
75MINUS 1 "-"
76R_ANGLE 1 ">"
77WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0006_chars.rs b/crates/syntax/test_data/lexer/ok/0006_chars.rs
new file mode 100644
index 000000000..454ee0a5f
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0006_chars.rs
@@ -0,0 +1 @@
'x' ' ' '0' 'hello' '\x7f' '\n' '\\' '\''
diff --git a/crates/syntax/test_data/lexer/ok/0006_chars.txt b/crates/syntax/test_data/lexer/ok/0006_chars.txt
new file mode 100644
index 000000000..950954fbc
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0006_chars.txt
@@ -0,0 +1,16 @@
1CHAR 3 "\'x\'"
2WHITESPACE 1 " "
3CHAR 3 "\' \'"
4WHITESPACE 1 " "
5CHAR 3 "\'0\'"
6WHITESPACE 1 " "
7CHAR 7 "\'hello\'"
8WHITESPACE 1 " "
9CHAR 6 "\'\\x7f\'"
10WHITESPACE 1 " "
11CHAR 4 "\'\\n\'"
12WHITESPACE 1 " "
13CHAR 4 "\'\\\\\'"
14WHITESPACE 1 " "
15CHAR 4 "\'\\\'\'"
16WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0007_lifetimes.rs b/crates/syntax/test_data/lexer/ok/0007_lifetimes.rs
new file mode 100644
index 000000000..b764f1dce
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0007_lifetimes.rs
@@ -0,0 +1 @@
'a 'foo 'foo_bar_baz '_
diff --git a/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt b/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt
new file mode 100644
index 000000000..005c29100
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt
@@ -0,0 +1,8 @@
1LIFETIME 2 "\'a"
2WHITESPACE 1 " "
3LIFETIME 4 "\'foo"
4WHITESPACE 1 " "
5LIFETIME 12 "\'foo_bar_baz"
6WHITESPACE 1 " "
7LIFETIME 2 "\'_"
8WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0008_byte_strings.rs b/crates/syntax/test_data/lexer/ok/0008_byte_strings.rs
new file mode 100644
index 000000000..b54930f5e
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0008_byte_strings.rs
@@ -0,0 +1,3 @@
1b'' b'x' b"foo" br""
2b''suf b""ix br""br
3b'\n' b'\\' b'\'' b'hello'
diff --git a/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt b/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt
new file mode 100644
index 000000000..bc03b51a8
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt
@@ -0,0 +1,22 @@
1BYTE 3 "b\'\'"
2WHITESPACE 1 " "
3BYTE 4 "b\'x\'"
4WHITESPACE 1 " "
5BYTE_STRING 6 "b\"foo\""
6WHITESPACE 1 " "
7RAW_BYTE_STRING 4 "br\"\""
8WHITESPACE 1 "\n"
9BYTE 6 "b\'\'suf"
10WHITESPACE 1 " "
11BYTE_STRING 5 "b\"\"ix"
12WHITESPACE 1 " "
13RAW_BYTE_STRING 6 "br\"\"br"
14WHITESPACE 1 "\n"
15BYTE 5 "b\'\\n\'"
16WHITESPACE 1 " "
17BYTE 5 "b\'\\\\\'"
18WHITESPACE 1 " "
19BYTE 5 "b\'\\\'\'"
20WHITESPACE 1 " "
21BYTE 8 "b\'hello\'"
22WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0009_strings.rs b/crates/syntax/test_data/lexer/ok/0009_strings.rs
new file mode 100644
index 000000000..4ddb5bffc
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0009_strings.rs
@@ -0,0 +1,2 @@
1"hello" r"world" "\n\"\\no escape" "multi
2line"
diff --git a/crates/syntax/test_data/lexer/ok/0009_strings.txt b/crates/syntax/test_data/lexer/ok/0009_strings.txt
new file mode 100644
index 000000000..4cb4d711d
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0009_strings.txt
@@ -0,0 +1,8 @@
1STRING 7 "\"hello\""
2WHITESPACE 1 " "
3RAW_STRING 8 "r\"world\""
4WHITESPACE 1 " "
5STRING 17 "\"\\n\\\"\\\\no escape\""
6WHITESPACE 1 " "
7STRING 12 "\"multi\nline\""
8WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0010_single_line_comments.rs b/crates/syntax/test_data/lexer/ok/0010_single_line_comments.rs
new file mode 100644
index 000000000..4b6653f9c
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0010_single_line_comments.rs
@@ -0,0 +1,12 @@
1#!/usr/bin/env bash
2// hello
3//! World
4//!! Inner line doc
5/// Outer line doc
6//// Just a comment
7
8//
9//!
10//!!
11///
12////
diff --git a/crates/syntax/test_data/lexer/ok/0010_single_line_comments.txt b/crates/syntax/test_data/lexer/ok/0010_single_line_comments.txt
new file mode 100644
index 000000000..98a3818c0
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0010_single_line_comments.txt
@@ -0,0 +1,22 @@
1SHEBANG 19 "#!/usr/bin/env bash"
2WHITESPACE 1 "\n"
3COMMENT 8 "// hello"
4WHITESPACE 1 "\n"
5COMMENT 9 "//! World"
6WHITESPACE 1 "\n"
7COMMENT 19 "//!! Inner line doc"
8WHITESPACE 1 "\n"
9COMMENT 18 "/// Outer line doc"
10WHITESPACE 1 "\n"
11COMMENT 19 "//// Just a comment"
12WHITESPACE 2 "\n\n"
13COMMENT 2 "//"
14WHITESPACE 1 "\n"
15COMMENT 3 "//!"
16WHITESPACE 1 "\n"
17COMMENT 4 "//!!"
18WHITESPACE 1 "\n"
19COMMENT 3 "///"
20WHITESPACE 1 "\n"
21COMMENT 4 "////"
22WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0011_keywords.rs b/crates/syntax/test_data/lexer/ok/0011_keywords.rs
new file mode 100644
index 000000000..1e91bff4e
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0011_keywords.rs
@@ -0,0 +1,3 @@
1async fn use struct trait enum impl true false as extern crate
2mod pub self super in where for loop while if match const
3static mut type ref let else move return
diff --git a/crates/syntax/test_data/lexer/ok/0011_keywords.txt b/crates/syntax/test_data/lexer/ok/0011_keywords.txt
new file mode 100644
index 000000000..22c00eefb
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0011_keywords.txt
@@ -0,0 +1,64 @@
1ASYNC_KW 5 "async"
2WHITESPACE 1 " "
3FN_KW 2 "fn"
4WHITESPACE 1 " "
5USE_KW 3 "use"
6WHITESPACE 1 " "
7STRUCT_KW 6 "struct"
8WHITESPACE 1 " "
9TRAIT_KW 5 "trait"
10WHITESPACE 1 " "
11ENUM_KW 4 "enum"
12WHITESPACE 1 " "
13IMPL_KW 4 "impl"
14WHITESPACE 1 " "
15TRUE_KW 4 "true"
16WHITESPACE 1 " "
17FALSE_KW 5 "false"
18WHITESPACE 1 " "
19AS_KW 2 "as"
20WHITESPACE 1 " "
21EXTERN_KW 6 "extern"
22WHITESPACE 1 " "
23CRATE_KW 5 "crate"
24WHITESPACE 1 "\n"
25MOD_KW 3 "mod"
26WHITESPACE 1 " "
27PUB_KW 3 "pub"
28WHITESPACE 1 " "
29SELF_KW 4 "self"
30WHITESPACE 1 " "
31SUPER_KW 5 "super"
32WHITESPACE 1 " "
33IN_KW 2 "in"
34WHITESPACE 1 " "
35WHERE_KW 5 "where"
36WHITESPACE 1 " "
37FOR_KW 3 "for"
38WHITESPACE 1 " "
39LOOP_KW 4 "loop"
40WHITESPACE 1 " "
41WHILE_KW 5 "while"
42WHITESPACE 1 " "
43IF_KW 2 "if"
44WHITESPACE 1 " "
45MATCH_KW 5 "match"
46WHITESPACE 1 " "
47CONST_KW 5 "const"
48WHITESPACE 1 "\n"
49STATIC_KW 6 "static"
50WHITESPACE 1 " "
51MUT_KW 3 "mut"
52WHITESPACE 1 " "
53TYPE_KW 4 "type"
54WHITESPACE 1 " "
55REF_KW 3 "ref"
56WHITESPACE 1 " "
57LET_KW 3 "let"
58WHITESPACE 1 " "
59ELSE_KW 4 "else"
60WHITESPACE 1 " "
61MOVE_KW 4 "move"
62WHITESPACE 1 " "
63RETURN_KW 6 "return"
64WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0012_block_comment.rs b/crates/syntax/test_data/lexer/ok/0012_block_comment.rs
new file mode 100644
index 000000000..b880a59d9
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0012_block_comment.rs
@@ -0,0 +1,3 @@
1/* */
2/**/
3/* /* */ */
diff --git a/crates/syntax/test_data/lexer/ok/0012_block_comment.txt b/crates/syntax/test_data/lexer/ok/0012_block_comment.txt
new file mode 100644
index 000000000..2618e287e
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0012_block_comment.txt
@@ -0,0 +1,6 @@
1COMMENT 5 "/* */"
2WHITESPACE 1 "\n"
3COMMENT 4 "/**/"
4WHITESPACE 1 "\n"
5COMMENT 11 "/* /* */ */"
6WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0013_raw_strings.rs b/crates/syntax/test_data/lexer/ok/0013_raw_strings.rs
new file mode 100644
index 000000000..e5ed0b693
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0013_raw_strings.rs
@@ -0,0 +1 @@
r###"this is a r##"raw"## string"###
diff --git a/crates/syntax/test_data/lexer/ok/0013_raw_strings.txt b/crates/syntax/test_data/lexer/ok/0013_raw_strings.txt
new file mode 100644
index 000000000..9cf0957d1
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0013_raw_strings.txt
@@ -0,0 +1,2 @@
1RAW_STRING 36 "r###\"this is a r##\"raw\"## string\"###"
2WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0014_raw_ident.rs b/crates/syntax/test_data/lexer/ok/0014_raw_ident.rs
new file mode 100644
index 000000000..b40a1b6a2
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0014_raw_ident.rs
@@ -0,0 +1 @@
r#raw_ident
diff --git a/crates/syntax/test_data/lexer/ok/0014_raw_ident.txt b/crates/syntax/test_data/lexer/ok/0014_raw_ident.txt
new file mode 100644
index 000000000..484689693
--- /dev/null
+++ b/crates/syntax/test_data/lexer/ok/0014_raw_ident.txt
@@ -0,0 +1,2 @@
1IDENT 11 "r#raw_ident"
2WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rast b/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rast
new file mode 100644
index 000000000..bbbf496c8
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rast
@@ -0,0 +1,34 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected]
12 [email protected]
13 [email protected] "a"
14 [email protected] ":"
15 [email protected] " "
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "u32"
21 [email protected] "\n "
22 [email protected]
23 [email protected]
24 [email protected] "b"
25 [email protected] ":"
26 [email protected] " "
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "u32"
32 [email protected] "\n"
33 [email protected] "}"
34error 21..21: expected COMMA
diff --git a/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rs b/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rs
new file mode 100644
index 000000000..fe5030d89
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rs
@@ -0,0 +1,4 @@
1struct S {
2 a: u32
3 b: u32
4} \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rast b/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rast
new file mode 100644
index 000000000..6dc73bfdb
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rast
@@ -0,0 +1,18 @@
1[email protected]
2 [email protected]
3 [email protected] "if"
4 [email protected] " "
5 [email protected]
6 [email protected] "match"
7 [email protected] "\n\n"
8 [email protected]
9 [email protected] "struct"
10 [email protected] " "
11 [email protected]
12 [email protected] "S"
13 [email protected] " "
14 [email protected]
15 [email protected] "{"
16 [email protected] "}"
17error 0..0: expected an item
18error 3..3: expected an item
diff --git a/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rs b/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rs
new file mode 100644
index 000000000..98f23de1f
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rs
@@ -0,0 +1,3 @@
1if match
2
3struct S {} \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rast b/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rast
new file mode 100644
index 000000000..4cfd1bce4
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rast
@@ -0,0 +1,39 @@
1[email protected]
2 [email protected] "#!/use/bin/env rusti"
3 [email protected] "\n"
4 [email protected]
5 [email protected] "#"
6 [email protected] "!"
7 [email protected]
8 [email protected] "/"
9 [email protected]
10 [email protected] "use"
11 [email protected]
12 [email protected] "/"
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "bin"
18 [email protected]
19 [email protected] "/"
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected] "env"
25 [email protected] " "
26 [email protected]
27 [email protected] "rusti"
28 [email protected] "\n"
29error 23..23: expected `[`
30error 23..23: expected an item
31error 27..27: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
32error 28..28: expected SEMICOLON
33error 31..31: expected BANG
34error 31..31: expected `{`, `[`, `(`
35error 31..31: expected SEMICOLON
36error 31..31: expected an item
37error 35..35: expected BANG
38error 41..41: expected `{`, `[`, `(`
39error 41..41: expected SEMICOLON
diff --git a/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rs b/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rs
new file mode 100644
index 000000000..48a3a3980
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rs
@@ -0,0 +1,2 @@
1#!/use/bin/env rusti
2#!/use/bin/env rusti
diff --git a/crates/syntax/test_data/parser/err/0003_C++_semicolon.rast b/crates/syntax/test_data/parser/err/0003_C++_semicolon.rast
new file mode 100644
index 000000000..7763fad84
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0003_C++_semicolon.rast
@@ -0,0 +1,39 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected]
12 [email protected]
13 [email protected] "a"
14 [email protected] ":"
15 [email protected] " "
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "i32"
21 [email protected] ","
22 [email protected] "\n "
23 [email protected]
24 [email protected]
25 [email protected] "b"
26 [email protected] ":"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "String"
33 [email protected] ","
34 [email protected] "\n"
35 [email protected] "}"
36 [email protected]
37 [email protected] ";"
38error 39..39: expected item, found `;`
39consider removing this semicolon
diff --git a/crates/syntax/test_data/parser/err/0003_C++_semicolon.rs b/crates/syntax/test_data/parser/err/0003_C++_semicolon.rs
new file mode 100644
index 000000000..009312270
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0003_C++_semicolon.rs
@@ -0,0 +1,4 @@
1struct S {
2 a: i32,
3 b: String,
4}; \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rast b/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rast
new file mode 100644
index 000000000..9a0f4665e
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rast
@@ -0,0 +1,15 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected]
10 [email protected] "foo"
11 [email protected] "::"
12 [email protected]
13 [email protected] "92"
14 [email protected] ";"
15error 9..9: expected identifier
diff --git a/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rs b/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rs
new file mode 100644
index 000000000..060e65d06
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rs
@@ -0,0 +1 @@
use foo::92; \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/err/0005_attribute_recover.rast b/crates/syntax/test_data/parser/err/0005_attribute_recover.rast
new file mode 100644
index 000000000..4845a6563
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0005_attribute_recover.rast
@@ -0,0 +1,59 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "#"
5 [email protected] "["
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "foo"
10 [email protected]
11 [email protected] "("
12 [email protected] "foo"
13 [email protected] ","
14 [email protected] " "
15 [email protected] "+"
16 [email protected] ","
17 [email protected] " "
18 [email protected] "92"
19 [email protected] ")"
20 [email protected] "]"
21 [email protected] "\n"
22 [email protected] "fn"
23 [email protected] " "
24 [email protected]
25 [email protected] "foo"
26 [email protected]
27 [email protected] "("
28 [email protected] ")"
29 [email protected] " "
30 [email protected]
31 [email protected] "{"
32 [email protected] "\n"
33 [email protected] "}"
34 [email protected] "\n\n\n"
35 [email protected]
36 [email protected] "#"
37 [email protected] "["
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "foo"
42 [email protected]
43 [email protected] "("
44 [email protected] "\n"
45 [email protected] "fn"
46 [email protected] " "
47 [email protected] "foo"
48 [email protected]
49 [email protected] "("
50 [email protected] ")"
51 [email protected] " "
52 [email protected]
53 [email protected] "{"
54 [email protected] "\n"
55 [email protected] "}"
56 [email protected] "\n"
57error 53..53: expected R_PAREN
58error 53..53: expected `]`
59error 53..53: expected an item
diff --git a/crates/syntax/test_data/parser/err/0005_attribute_recover.rs b/crates/syntax/test_data/parser/err/0005_attribute_recover.rs
new file mode 100644
index 000000000..de7f81628
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0005_attribute_recover.rs
@@ -0,0 +1,8 @@
1#[foo(foo, +, 92)]
2fn foo() {
3}
4
5
6#[foo(
7fn foo() {
8}
diff --git a/crates/syntax/test_data/parser/err/0006_named_field_recovery.rast b/crates/syntax/test_data/parser/err/0006_named_field_recovery.rast
new file mode 100644
index 000000000..5f85c3943
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0006_named_field_recovery.rast
@@ -0,0 +1,74 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected]
12 [email protected]
13 [email protected] "f"
14 [email protected] ":"
15 [email protected] " "
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "u32"
21 [email protected] ","
22 [email protected] "\n "
23 [email protected]
24 [email protected] "pub"
25 [email protected] " "
26 [email protected]
27 [email protected] "92"
28 [email protected] "\n "
29 [email protected]
30 [email protected] "+"
31 [email protected] " "
32 [email protected]
33 [email protected] "-"
34 [email protected] " "
35 [email protected]
36 [email protected] "*"
37 [email protected] "\n "
38 [email protected]
39 [email protected]
40 [email protected] "pub"
41 [email protected] " "
42 [email protected]
43 [email protected] "x"
44 [email protected] ":"
45 [email protected] " "
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected] "u32"
51 [email protected] ","
52 [email protected] "\n "
53 [email protected]
54 [email protected]
55 [email protected] "z"
56 [email protected] ":"
57 [email protected] " "
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected] "f64"
63 [email protected] ","
64 [email protected] "\n"
65 [email protected] "}"
66 [email protected] "\n"
67error 31..31: expected field declaration
68error 33..33: expected COMMA
69error 38..38: expected field declaration
70error 39..39: expected COMMA
71error 40..40: expected field declaration
72error 41..41: expected COMMA
73error 42..42: expected field declaration
74error 43..43: expected COMMA
diff --git a/crates/syntax/test_data/parser/err/0006_named_field_recovery.rs b/crates/syntax/test_data/parser/err/0006_named_field_recovery.rs
new file mode 100644
index 000000000..8069c111b
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0006_named_field_recovery.rs
@@ -0,0 +1,7 @@
1struct S {
2 f: u32,
3 pub 92
4 + - *
5 pub x: u32,
6 z: f64,
7}
diff --git a/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rast b/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rast
new file mode 100644
index 000000000..560bfd751
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rast
@@ -0,0 +1,32 @@
1[email protected]
2 [email protected]
3 [email protected] "}"
4 [email protected] "\n\n"
5 [email protected]
6 [email protected] "struct"
7 [email protected] " "
8 [email protected]
9 [email protected] "S"
10 [email protected] ";"
11 [email protected] "\n\n"
12 [email protected]
13 [email protected] "}"
14 [email protected] "\n\n"
15 [email protected]
16 [email protected] "fn"
17 [email protected] " "
18 [email protected]
19 [email protected] "foo"
20 [email protected]
21 [email protected] "("
22 [email protected] ")"
23 [email protected]
24 [email protected] "{"
25 [email protected] "}"
26 [email protected] "\n\n"
27 [email protected]
28 [email protected] "}"
29 [email protected] "\n"
30error 0..0: unmatched `}`
31error 14..14: unmatched `}`
32error 29..29: unmatched `}`
diff --git a/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rs b/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rs
new file mode 100644
index 000000000..dc869fb78
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rs
@@ -0,0 +1,9 @@
1}
2
3struct S;
4
5}
6
7fn foo(){}
8
9}
diff --git a/crates/syntax/test_data/parser/err/0008_item_block_recovery.rast b/crates/syntax/test_data/parser/err/0008_item_block_recovery.rast
new file mode 100644
index 000000000..1e9637c26
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0008_item_block_recovery.rast
@@ -0,0 +1,77 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n"
14 [email protected] "}"
15 [email protected] "\n\n"
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "bar"
21 [email protected]
22 [email protected] "("
23 [email protected] ")"
24 [email protected] " "
25 [email protected]
26 [email protected] "{"
27 [email protected] "\n "
28 [email protected]
29 [email protected] "if"
30 [email protected] " "
31 [email protected]
32 [email protected]
33 [email protected] "true"
34 [email protected] " "
35 [email protected]
36 [email protected] "{"
37 [email protected] "\n "
38 [email protected]
39 [email protected] "1"
40 [email protected] "\n "
41 [email protected] "}"
42 [email protected] " "
43 [email protected] "else"
44 [email protected] " "
45 [email protected]
46 [email protected] "{"
47 [email protected] "\n "
48 [email protected]
49 [email protected]
50 [email protected] "2"
51 [email protected] " "
52 [email protected] "+"
53 [email protected] " "
54 [email protected]
55 [email protected] "3"
56 [email protected] "\n "
57 [email protected] "}"
58 [email protected] "\n"
59 [email protected] "}"
60 [email protected] "\n\n"
61 [email protected]
62 [email protected] "fn"
63 [email protected] " "
64 [email protected]
65 [email protected] "baz"
66 [email protected]
67 [email protected] "("
68 [email protected] ")"
69 [email protected] " "
70 [email protected]
71 [email protected] "{"
72 [email protected] "\n"
73 [email protected] "}"
74 [email protected] "\n"
75error 17..17: expected BANG
76error 19..19: expected SEMICOLON
77error 20..20: expected an item
diff --git a/crates/syntax/test_data/parser/err/0008_item_block_recovery.rs b/crates/syntax/test_data/parser/err/0008_item_block_recovery.rs
new file mode 100644
index 000000000..9fcac19b5
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0008_item_block_recovery.rs
@@ -0,0 +1,13 @@
1fn foo() {
2}
3
4bar() {
5 if true {
6 1
7 } else {
8 2 + 3
9 }
10}
11
12fn baz() {
13}
diff --git a/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast b/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast
new file mode 100644
index 000000000..dacf71aa1
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast
@@ -0,0 +1,58 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected] "90"
11 [email protected] " "
12 [email protected]
13 [email protected] "+"
14 [email protected] " "
15 [email protected]
16 [email protected] "2"
17 [email protected]
18 [email protected] ">"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] "\n "
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected] "f"
29 [email protected]
30 [email protected]
31 [email protected] ":"
32 [email protected] " "
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected] "u32"
38 [email protected] "\n"
39 [email protected] "}"
40 [email protected] "\n\n"
41 [email protected]
42 [email protected] "struct"
43 [email protected] " "
44 [email protected]
45 [email protected] "T"
46 [email protected] ";"
47 [email protected] "\n"
48error 9..9: expected type parameter
49error 11..11: expected COMMA
50error 11..11: expected R_ANGLE
51error 11..11: expected `;`, `{`, or `(`
52error 12..12: expected an item
53error 14..14: expected an item
54error 15..15: expected an item
55error 17..17: expected an item
56error 24..24: expected SEMICOLON
57error 24..24: expected expression
58error 25..25: expected SEMICOLON
diff --git a/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rs b/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rs
new file mode 100644
index 000000000..0dd30d0bd
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rs
@@ -0,0 +1,5 @@
1struct S<90 + 2> {
2 f: u32
3}
4
5struct T;
diff --git a/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rast b/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
new file mode 100644
index 000000000..e0f1d0c27
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
@@ -0,0 +1,44 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "|"
18 [email protected] "|"
19 [email protected] " "
20 [email protected]
21 [email protected] "->"
22 [email protected] " "
23 [email protected]
24 [email protected] "("
25 [email protected] ")"
26 [email protected] " "
27 [email protected]
28 [email protected]
29 [email protected] "unsafe"
30 [email protected] " "
31 [email protected]
32 [email protected] "{"
33 [email protected] " "
34 [email protected]
35 [email protected] "("
36 [email protected] ")"
37 [email protected] " "
38 [email protected] "}"
39 [email protected] ";"
40 [email protected] "\n"
41 [email protected] "}"
42 [email protected] "\n"
43error 24..24: expected a block
44error 24..24: expected SEMICOLON
diff --git a/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rs b/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rs
new file mode 100644
index 000000000..985775282
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rs
@@ -0,0 +1,3 @@
1fn main() {
2 || -> () unsafe { () };
3}
diff --git a/crates/syntax/test_data/parser/err/0011_extern_struct.rast b/crates/syntax/test_data/parser/err/0011_extern_struct.rast
new file mode 100644
index 000000000..b02d390af
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0011_extern_struct.rast
@@ -0,0 +1,13 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "extern"
5 [email protected] " "
6 [email protected]
7 [email protected] "struct"
8 [email protected] " "
9 [email protected]
10 [email protected] "Foo"
11 [email protected] ";"
12 [email protected] "\n"
13error 6..6: expected existential, fn, trait or impl
diff --git a/crates/syntax/test_data/parser/err/0011_extern_struct.rs b/crates/syntax/test_data/parser/err/0011_extern_struct.rs
new file mode 100644
index 000000000..c1bd0a2d1
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0011_extern_struct.rs
@@ -0,0 +1 @@
extern struct Foo;
diff --git a/crates/syntax/test_data/parser/err/0012_broken_lambda.rast b/crates/syntax/test_data/parser/err/0012_broken_lambda.rast
new file mode 100644
index 000000000..f31c27633
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0012_broken_lambda.rast
@@ -0,0 +1,387 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected]
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected] "process"
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected] "'a"
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "S"
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected] "Sink"
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "'a"
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected] "builder"
40 [email protected]
41 [email protected]
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected] "S"
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected] "tokens"
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected]
64 [email protected]
65 [email protected]
66 [email protected]
67 [email protected] "Token"
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected]
72 [email protected]
73 [email protected]
74 [email protected] "events"
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected] "Vec"
82 [email protected]
83 [email protected]
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected]
88 [email protected]
89 [email protected] "Event"
90 [email protected]
91 [email protected]
92 [email protected]
93 [email protected]
94 [email protected]
95 [email protected]
96 [email protected]
97 [email protected]
98 [email protected]
99 [email protected]
100 [email protected]
101 [email protected]
102 [email protected]
103 [email protected] "next_tok_idx"
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected]
108 [email protected] "0"
109 [email protected]
110 [email protected]
111 [email protected]
112 [email protected]
113 [email protected]
114 [email protected]
115 [email protected]
116 [email protected] "eat_ws"
117 [email protected]
118 [email protected]
119 [email protected]
120 [email protected]
121 [email protected]
122 [email protected]
123 [email protected]
124 [email protected]
125 [email protected]
126 [email protected] "idx"
127 [email protected]
128 [email protected]
129 [email protected]
130 [email protected]
131 [email protected]
132 [email protected]
133 [email protected]
134 [email protected]
135 [email protected]
136 [email protected]
137 [email protected] "usize"
138 [email protected]
139 [email protected]
140 [email protected]
141 [email protected]
142 [email protected]
143 [email protected]
144 [email protected]
145 err: `expected pattern`
146 [email protected]
147 [email protected]
148 err: `expected COMMA`
149 [email protected]
150 err: `expected pattern`
151 [email protected]
152 [email protected]
153 [email protected]
154 err: `expected COMMA`
155 [email protected]
156 err: `expected pattern`
157 [email protected]
158 [email protected]
159 [email protected]
160 err: `expected COMMA`
161 [email protected]
162 err: `expected pattern`
163 [email protected]
164 [email protected]
165 [email protected]
166 err: `expected COMMA`
167 [email protected]
168 [email protected]
169 [email protected]
170 [email protected]
171 [email protected]
172 [email protected]
173 [email protected] "Some"
174 [email protected]
175 [email protected]
176 [email protected]
177 [email protected] "token"
178 [email protected]
179 err: `expected COMMA`
180 [email protected]
181 err: `expected pattern`
182 [email protected]
183 [email protected]
184 [email protected]
185 err: `expected COMMA`
186 [email protected]
187 [email protected]
188 [email protected]
189 [email protected]
190 [email protected] "tokens"
191 err: `expected COMMA`
192 err: `expected pattern`
193 [email protected]
194 [email protected]
195 [email protected]
196 err: `expected COMMA`
197 [email protected]
198 [email protected]
199 [email protected]
200 [email protected]
201 [email protected]
202 [email protected] "get"
203 [email protected]
204 err: `expected pattern`
205 [email protected]
206 [email protected]
207 err: `expected COMMA`
208 [email protected]
209 [email protected]
210 [email protected] "idx"
211 [email protected]
212 err: `expected COMMA`
213 [email protected]
214 err: `expected pattern`
215 [email protected]
216 [email protected]
217 [email protected]
218 err: `expected COMMA`
219 [email protected]
220 err: `expected pattern`
221 [email protected]
222 [email protected]
223 [email protected]
224 err: `expected COMMA`
225 [email protected]
226 err: `expected pattern`
227 [email protected]
228 [email protected]
229 [email protected]
230 err: `expected COMMA`
231 [email protected]
232 [email protected]
233 [email protected]
234 [email protected] "token"
235 err: `expected COMMA`
236 err: `expected pattern`
237 [email protected]
238 [email protected]
239 [email protected]
240 err: `expected COMMA`
241 [email protected]
242 [email protected]
243 [email protected]
244 [email protected] "kind"
245 err: `expected COMMA`
246 err: `expected pattern`
247 [email protected]
248 [email protected]
249 [email protected]
250 err: `expected COMMA`
251 [email protected]
252 [email protected]
253 [email protected]
254 [email protected]
255 [email protected]
256 [email protected] "is_trivia"
257 [email protected]
258 [email protected]
259 err: `expected COMMA`
260 [email protected]
261 err: `expected pattern`
262 [email protected]
263 [email protected]
264 [email protected]
265 err: `expected COMMA`
266 [email protected]
267 [email protected]
268 [email protected]
269 [email protected]
270 [email protected] "break"
271 err: `expected COMMA`
272 err: `expected pattern`
273 [email protected]
274 [email protected]
275 [email protected]
276 err: `expected COMMA`
277 [email protected]
278 err: `expected pattern`
279 [email protected]
280 [email protected]
281 [email protected]
282 err: `expected COMMA`
283 [email protected]
284 [email protected]
285 [email protected]
286 [email protected]
287 [email protected] "builder"
288 err: `expected COMMA`
289 err: `expected pattern`
290 [email protected]
291 [email protected]
292 [email protected]
293 err: `expected COMMA`
294 [email protected]
295 [email protected]
296 [email protected]
297 [email protected]
298 [email protected]
299 [email protected] "leaf"
300 [email protected]
301 [email protected]
302 [email protected]
303 [email protected] "token"
304 err: `expected COMMA`
305 err: `expected pattern`
306 [email protected]
307 [email protected]
308 err: `expected COMMA`
309 [email protected]
310 [email protected]
311 [email protected] "kind"
312 [email protected]
313 [email protected]
314 [email protected]
315 [email protected]
316 [email protected] "token"
317 err: `expected COMMA`
318 err: `expected pattern`
319 [email protected]
320 [email protected]
321 err: `expected COMMA`
322 [email protected]
323 [email protected]
324 [email protected] "len"
325 [email protected]
326 err: `expected COMMA`
327 err: `expected pattern`
328 [email protected]
329 [email protected]
330 [email protected]
331 err: `expected COMMA`
332 [email protected]
333 err: `expected pattern`
334 [email protected]
335 [email protected]
336 [email protected]
337 err: `expected COMMA`
338 [email protected]
339 [email protected]
340 [email protected]
341 [email protected] "idx"
342 err: `expected COMMA`
343 [email protected]
344 err: `expected pattern`
345 [email protected]
346 [email protected]
347 [email protected]
348 err: `expected COMMA`
349 err: `expected pattern`
350 [email protected]
351 [email protected]
352 [email protected]
353 err: `expected COMMA`
354 [email protected]
355 [email protected]
356 [email protected]
357 [email protected] "1"
358 err: `expected COMMA`
359 [email protected]
360 err: `expected pattern`
361 [email protected]
362 [email protected]
363 [email protected]
364 err: `expected COMMA`
365 [email protected]
366 err: `expected pattern`
367 [email protected]
368 [email protected]
369 [email protected]
370 err: `expected COMMA`
371 err: `expected pattern`
372 [email protected]
373 [email protected]
374 [email protected]
375 err: `expected COMMA`
376 [email protected]
377 err: `expected pattern`
378 [email protected]
379 [email protected]
380 [email protected]
381 err: `expected COMMA`
382 err: `expected PIPE`
383 [email protected]
384 err: `expected expression`
385 err: `expected SEMI`
386 err: `expected R_CURLY`
387 [email protected]
diff --git a/crates/syntax/test_data/parser/err/0013_invalid_type.rast b/crates/syntax/test_data/parser/err/0013_invalid_type.rast
new file mode 100644
index 000000000..f48ab6e71
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0013_invalid_type.rast
@@ -0,0 +1,89 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "pub"
5 [email protected] " "
6 [email protected] "struct"
7 [email protected] " "
8 [email protected]
9 [email protected] "Cache"
10 [email protected]
11 [email protected] "("
12 [email protected] "\n "
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "RefCell"
19 [email protected]
20 [email protected] "<"
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected] "HashMap"
27 [email protected]
28 [email protected] "<"
29 [email protected] "\n "
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected] "TypeId"
36 [email protected] ","
37 [email protected] "\n "
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected]
43 [email protected] "Box"
44 [email protected]
45 [email protected] "<"
46 [email protected]
47 [email protected]
48 [email protected] "@"
49 [email protected] " "
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected] "Any"
56 [email protected]
57 [email protected]
58 [email protected] ">"
59 [email protected]
60 [email protected] ","
61 [email protected] "\n "
62 [email protected]
63 [email protected] ">"
64 [email protected]
65 [email protected] ">"
66 [email protected] "\n"
67 [email protected]
68 [email protected] ")"
69 [email protected]
70 [email protected] ";"
71 [email protected] "\n\n"
72error 67..67: expected type
73error 68..68: expected COMMA
74error 68..68: expected R_ANGLE
75error 68..68: expected COMMA
76error 68..68: expected R_ANGLE
77error 68..68: expected COMMA
78error 68..68: expected R_ANGLE
79error 68..68: expected COMMA
80error 72..72: expected COMMA
81error 72..72: expected a type
82error 72..72: expected R_PAREN
83error 72..72: expected SEMICOLON
84error 72..72: expected an item
85error 73..73: expected an item
86error 79..79: expected an item
87error 80..80: expected an item
88error 82..82: expected an item
89error 83..83: expected an item
diff --git a/crates/syntax/test_data/parser/err/0013_invalid_type.rs b/crates/syntax/test_data/parser/err/0013_invalid_type.rs
new file mode 100644
index 000000000..20dde3bc3
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0013_invalid_type.rs
@@ -0,0 +1,7 @@
1pub struct Cache(
2 RefCell<HashMap<
3 TypeId,
4 Box<@ Any>,
5 >>
6);
7
diff --git a/crates/syntax/test_data/parser/err/0014_where_no_bounds.rast b/crates/syntax/test_data/parser/err/0014_where_no_bounds.rast
new file mode 100644
index 000000000..a1f39b22a
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0014_where_no_bounds.rast
@@ -0,0 +1,31 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ">"
13 [email protected]
14 [email protected] "("
15 [email protected] ")"
16 [email protected] " "
17 [email protected]
18 [email protected] "where"
19 [email protected] " "
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "T"
26 [email protected] " "
27 [email protected]
28 [email protected] "{"
29 [email protected] "}"
30 [email protected] "\n"
31error 19..19: expected colon
diff --git a/crates/syntax/test_data/parser/err/0014_where_no_bounds.rs b/crates/syntax/test_data/parser/err/0014_where_no_bounds.rs
new file mode 100644
index 000000000..75c1d2f98
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0014_where_no_bounds.rs
@@ -0,0 +1 @@
fn foo<T>() where T {}
diff --git a/crates/syntax/test_data/parser/err/0015_curly_in_params.rast b/crates/syntax/test_data/parser/err/0015_curly_in_params.rast
new file mode 100644
index 000000000..a3c25b450
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0015_curly_in_params.rast
@@ -0,0 +1,24 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected] "}"
11 [email protected]
12 [email protected] ")"
13 [email protected] " "
14 [email protected]
15 [email protected] "{"
16 [email protected] "\n"
17 [email protected] "}"
18 [email protected] "\n"
19error 7..7: expected value parameter
20error 7..7: expected R_PAREN
21error 7..7: expected a block
22error 7..7: unmatched `}`
23error 8..8: expected an item
24error 10..10: expected an item
diff --git a/crates/syntax/test_data/parser/err/0015_curly_in_params.rs b/crates/syntax/test_data/parser/err/0015_curly_in_params.rs
new file mode 100644
index 000000000..156e70251
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0015_curly_in_params.rs
@@ -0,0 +1,2 @@
1fn foo(}) {
2}
diff --git a/crates/syntax/test_data/parser/err/0016_missing_semi.rast b/crates/syntax/test_data/parser/err/0016_missing_semi.rast
new file mode 100644
index 000000000..66157c3dc
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0016_missing_semi.rast
@@ -0,0 +1,43 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "foo"
21 [email protected]
22 [email protected] "("
23 [email protected] "\n "
24 [email protected]
25 [email protected] "1"
26 [email protected] ","
27 [email protected] " "
28 [email protected]
29 [email protected] "2"
30 [email protected] "\n "
31 [email protected] ")"
32 [email protected] "\n "
33 [email protected]
34 [email protected]
35 [email protected] "return"
36 [email protected] " "
37 [email protected]
38 [email protected] "92"
39 [email protected] ";"
40 [email protected] "\n"
41 [email protected] "}"
42 [email protected] "\n"
43error 38..38: expected SEMICOLON
diff --git a/crates/syntax/test_data/parser/err/0016_missing_semi.rs b/crates/syntax/test_data/parser/err/0016_missing_semi.rs
new file mode 100644
index 000000000..9ae857686
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0016_missing_semi.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 foo(
3 1, 2
4 )
5 return 92;
6}
diff --git a/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rast b/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rast
new file mode 100644
index 000000000..fe094f61c
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rast
@@ -0,0 +1,46 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected] "foo"
13 [email protected] ":"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "i32"
20 [email protected] ")"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "\n "
25 [email protected]
26 [email protected] "let"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected] "bar"
31 [email protected] " "
32 [email protected] "="
33 [email protected] " "
34 [email protected]
35 [email protected] "92"
36 [email protected] ";"
37 [email protected] "\n "
38 [email protected]
39 [email protected]
40 [email protected] "1"
41 [email protected] " "
42 [email protected] "+"
43 [email protected] "\n"
44 [email protected] "}"
45 [email protected] "\n"
46error 44..44: expected expression
diff --git a/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rs b/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rs
new file mode 100644
index 000000000..17bd49777
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rs
@@ -0,0 +1,4 @@
1fn foo(foo: i32) {
2 let bar = 92;
3 1 +
4}
diff --git a/crates/syntax/test_data/parser/err/0018_incomplete_fn.rast b/crates/syntax/test_data/parser/err/0018_incomplete_fn.rast
new file mode 100644
index 000000000..72939fc98
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0018_incomplete_fn.rast
@@ -0,0 +1,131 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "FnScopes"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "fn"
16 [email protected] " "
17 [email protected]
18 [email protected] "new_scope"
19 [email protected]
20 [email protected] "("
21 [email protected]
22 [email protected]
23 [email protected] "&"
24 [email protected] ")"
25 [email protected] " "
26 [email protected]
27 [email protected] "->"
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "ScopeId"
34 [email protected] " "
35 [email protected]
36 [email protected] "{"
37 [email protected] "\n "
38 [email protected]
39 [email protected] "let"
40 [email protected] " "
41 [email protected]
42 [email protected]
43 [email protected] "res"
44 [email protected] " "
45 [email protected] "="
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected] "self"
53 [email protected] "."
54 [email protected]
55 [email protected] "scopes"
56 [email protected] "."
57 [email protected]
58 [email protected] "len"
59 [email protected]
60 [email protected] "("
61 [email protected] ")"
62 [email protected] ";"
63 [email protected] "\n "
64 [email protected]
65 [email protected]
66 [email protected]
67 [email protected]
68 [email protected]
69 [email protected] "self"
70 [email protected] "."
71 [email protected]
72 [email protected] "scopes"
73 [email protected] "."
74 [email protected]
75 [email protected] "push"
76 [email protected]
77 [email protected] "("
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected] "ScopeData"
83 [email protected] " "
84 [email protected]
85 [email protected] "{"
86 [email protected] " "
87 [email protected]
88 [email protected]
89 [email protected] "parent"
90 [email protected] ":"
91 [email protected] " "
92 [email protected]
93 [email protected]
94 [email protected]
95 [email protected]
96 [email protected] "None"
97 [email protected] ","
98 [email protected] " "
99 [email protected]
100 [email protected]
101 [email protected] "entries"
102 [email protected] ":"
103 [email protected] " "
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected]
108 [email protected] "vec"
109 [email protected] "!"
110 [email protected]
111 [email protected] "["
112 [email protected] "]"
113 [email protected] " "
114 [email protected] "}"
115 [email protected] ")"
116 [email protected] "\n "
117 [email protected] "}"
118 [email protected] "\n\n "
119 [email protected]
120 [email protected] "fn"
121 [email protected] " "
122 [email protected]
123 [email protected] "set_parent"
124 [email protected] "\n"
125 [email protected] "}"
126 [email protected] "\n"
127error 34..34: expected pattern
128error 34..34: expected COLON
129error 34..34: expected type
130error 180..180: expected function arguments
131error 180..180: expected a block
diff --git a/crates/syntax/test_data/parser/err/0018_incomplete_fn.rs b/crates/syntax/test_data/parser/err/0018_incomplete_fn.rs
new file mode 100644
index 000000000..fe604006c
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0018_incomplete_fn.rs
@@ -0,0 +1,8 @@
1impl FnScopes {
2 fn new_scope(&) -> ScopeId {
3 let res = self.scopes.len();
4 self.scopes.push(ScopeData { parent: None, entries: vec![] })
5 }
6
7 fn set_parent
8}
diff --git a/crates/syntax/test_data/parser/err/0019_let_recover.rast b/crates/syntax/test_data/parser/err/0019_let_recover.rast
new file mode 100644
index 000000000..72c05bd96
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0019_let_recover.rast
@@ -0,0 +1,103 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "foo"
20 [email protected] " "
21 [email protected] "="
22 [email protected] "\n "
23 [email protected]
24 [email protected] "let"
25 [email protected] " "
26 [email protected]
27 [email protected]
28 [email protected] "bar"
29 [email protected] " "
30 [email protected] "="
31 [email protected] " "
32 [email protected]
33 [email protected] "1"
34 [email protected] ";"
35 [email protected] "\n "
36 [email protected]
37 [email protected] "let"
38 [email protected] "\n "
39 [email protected]
40 [email protected] "let"
41 [email protected] " "
42 [email protected]
43 [email protected]
44 [email protected] "baz"
45 [email protected] " "
46 [email protected] "="
47 [email protected] " "
48 [email protected]
49 [email protected] "92"
50 [email protected] ";"
51 [email protected] "\n "
52 [email protected]
53 [email protected] "let"
54 [email protected] "\n "
55 [email protected]
56 [email protected]
57 [email protected] "if"
58 [email protected] " "
59 [email protected]
60 [email protected]
61 [email protected] "true"
62 [email protected] " "
63 [email protected]
64 [email protected] "{"
65 [email protected] "}"
66 [email protected] "\n "
67 [email protected]
68 [email protected] "let"
69 [email protected] "\n "
70 [email protected]
71 [email protected]
72 [email protected] "while"
73 [email protected] " "
74 [email protected]
75 [email protected]
76 [email protected] "true"
77 [email protected] " "
78 [email protected]
79 [email protected] "{"
80 [email protected] "}"
81 [email protected] "\n "
82 [email protected]
83 [email protected] "let"
84 [email protected] "\n "
85 [email protected]
86 [email protected] "loop"
87 [email protected] " "
88 [email protected]
89 [email protected] "{"
90 [email protected] "}"
91 [email protected] "\n"
92 [email protected] "}"
93 [email protected] "\n"
94error 24..24: expected expression
95error 24..24: expected SEMICOLON
96error 49..49: expected pattern
97error 49..49: expected SEMICOLON
98error 75..75: expected pattern
99error 75..75: expected SEMICOLON
100error 98..98: expected pattern
101error 98..98: expected SEMICOLON
102error 124..124: expected pattern
103error 124..124: expected SEMICOLON
diff --git a/crates/syntax/test_data/parser/err/0019_let_recover.rs b/crates/syntax/test_data/parser/err/0019_let_recover.rs
new file mode 100644
index 000000000..48bf3d68b
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0019_let_recover.rs
@@ -0,0 +1,12 @@
1fn foo() {
2 let foo =
3 let bar = 1;
4 let
5 let baz = 92;
6 let
7 if true {}
8 let
9 while true {}
10 let
11 loop {}
12}
diff --git a/crates/syntax/test_data/parser/err/0020_fn_recover.rast b/crates/syntax/test_data/parser/err/0020_fn_recover.rast
new file mode 100644
index 000000000..6f6feba5a
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0020_fn_recover.rast
@@ -0,0 +1,20 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] "\n\n"
5 [email protected]
6 [email protected] "fn"
7 [email protected] " "
8 [email protected]
9 [email protected] "foo"
10 [email protected]
11 [email protected] "("
12 [email protected] ")"
13 [email protected] " "
14 [email protected]
15 [email protected] "{"
16 [email protected] "}"
17 [email protected] "\n"
18error 2..2: expected a name
19error 2..2: expected function arguments
20error 2..2: expected a block
diff --git a/crates/syntax/test_data/parser/err/0020_fn_recover.rs b/crates/syntax/test_data/parser/err/0020_fn_recover.rs
new file mode 100644
index 000000000..3393b668b
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0020_fn_recover.rs
@@ -0,0 +1,3 @@
1fn
2
3fn foo() {}
diff --git a/crates/syntax/test_data/parser/err/0021_incomplete_param.rast b/crates/syntax/test_data/parser/err/0021_incomplete_param.rast
new file mode 100644
index 000000000..b32845537
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0021_incomplete_param.rast
@@ -0,0 +1,34 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected] "x"
13 [email protected] ":"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "i32"
20 [email protected] ","
21 [email protected] " "
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "y"
26 [email protected] ")"
27 [email protected] " "
28 [email protected]
29 [email protected] "{"
30 [email protected] "\n"
31 [email protected] "}"
32 [email protected] "\n"
33error 16..16: expected COLON
34error 16..16: expected type
diff --git a/crates/syntax/test_data/parser/err/0021_incomplete_param.rs b/crates/syntax/test_data/parser/err/0021_incomplete_param.rs
new file mode 100644
index 000000000..7a6c264f6
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0021_incomplete_param.rs
@@ -0,0 +1,2 @@
1fn foo(x: i32, y) {
2}
diff --git a/crates/syntax/test_data/parser/err/0022_bad_exprs.rast b/crates/syntax/test_data/parser/err/0022_bad_exprs.rast
new file mode 100644
index 000000000..71fb19783
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0022_bad_exprs.rast
@@ -0,0 +1,180 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "a"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected] "["
17 [email protected]
18 [email protected] "1"
19 [email protected] ","
20 [email protected] " "
21 [email protected]
22 [email protected] "2"
23 [email protected] ","
24 [email protected] " "
25 [email protected]
26 [email protected] "@"
27 [email protected]
28 [email protected]
29 [email protected] ","
30 [email protected] " "
31 [email protected]
32 [email protected] "struct"
33 [email protected]
34 [email protected] ","
35 [email protected] " "
36 [email protected]
37 [email protected] "let"
38 [email protected]
39 [email protected] "]"
40 [email protected] " "
41 [email protected] "}"
42 [email protected] "\n"
43 [email protected]
44 [email protected] "fn"
45 [email protected] " "
46 [email protected]
47 [email protected] "b"
48 [email protected]
49 [email protected] "("
50 [email protected] ")"
51 [email protected] " "
52 [email protected]
53 [email protected] "{"
54 [email protected] " "
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected] "foo"
62 [email protected]
63 [email protected] "("
64 [email protected]
65 [email protected] "1"
66 [email protected] ","
67 [email protected] " "
68 [email protected]
69 [email protected] "2"
70 [email protected] ","
71 [email protected] " "
72 [email protected]
73 [email protected] "@"
74 [email protected]
75 [email protected]
76 [email protected] ","
77 [email protected] " "
78 [email protected]
79 [email protected] "impl"
80 [email protected]
81 [email protected]
82 [email protected] ","
83 [email protected] " "
84 [email protected]
85 [email protected] "let"
86 [email protected]
87 [email protected] ")"
88 [email protected] " "
89 [email protected] "}"
90 [email protected] "\n"
91 [email protected]
92 [email protected] "fn"
93 [email protected] " "
94 [email protected]
95 [email protected] "c"
96 [email protected]
97 [email protected] "("
98 [email protected] ")"
99 [email protected] " "
100 [email protected]
101 [email protected] "{"
102 [email protected] " "
103 [email protected]
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected]
108 [email protected]
109 [email protected] "foo"
110 [email protected] "."
111 [email protected]
112 [email protected] "bar"
113 [email protected]
114 [email protected] "("
115 [email protected]
116 [email protected] "1"
117 [email protected] ","
118 [email protected] " "
119 [email protected]
120 [email protected] "2"
121 [email protected] ","
122 [email protected] " "
123 [email protected]
124 [email protected] "@"
125 [email protected]
126 [email protected]
127 [email protected] ","
128 [email protected] " "
129 [email protected]
130 [email protected]
131 [email protected] "]"
132 [email protected]
133 [email protected]
134 [email protected] ","
135 [email protected] " "
136 [email protected]
137 [email protected] "trait"
138 [email protected]
139 [email protected] ","
140 [email protected] " "
141 [email protected]
142 [email protected] "let"
143 [email protected]
144 [email protected] ")"
145 [email protected] " "
146 [email protected] "}"
147 [email protected] "\n"
148error 16..16: expected expression
149error 17..17: expected R_BRACK
150error 17..17: expected SEMICOLON
151error 17..17: expected expression
152error 18..18: expected SEMICOLON
153error 25..25: expected a name
154error 26..26: expected `;`, `{`, or `(`
155error 30..30: expected pattern
156error 31..31: expected SEMICOLON
157error 53..53: expected expression
158error 54..54: expected SEMICOLON
159error 54..54: expected expression
160error 55..55: expected SEMICOLON
161error 60..60: expected type
162error 60..60: expected `{`
163error 60..60: expected expression
164error 61..61: expected SEMICOLON
165error 65..65: expected pattern
166error 65..65: expected SEMICOLON
167error 65..65: expected expression
168error 92..92: expected expression
169error 93..93: expected SEMICOLON
170error 93..93: expected expression
171error 94..94: expected SEMICOLON
172error 95..95: expected expression
173error 96..96: expected SEMICOLON
174error 96..96: expected expression
175error 97..97: expected SEMICOLON
176error 103..103: expected a name
177error 104..104: expected `{`
178error 108..108: expected pattern
179error 108..108: expected SEMICOLON
180error 108..108: expected expression
diff --git a/crates/syntax/test_data/parser/err/0022_bad_exprs.rs b/crates/syntax/test_data/parser/err/0022_bad_exprs.rs
new file mode 100644
index 000000000..cd2d493a1
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0022_bad_exprs.rs
@@ -0,0 +1,3 @@
1fn a() { [1, 2, @, struct, let] }
2fn b() { foo(1, 2, @, impl, let) }
3fn c() { foo.bar(1, 2, @, ], trait, let) }
diff --git a/crates/syntax/test_data/parser/err/0023_mismatched_paren.rast b/crates/syntax/test_data/parser/err/0023_mismatched_paren.rast
new file mode 100644
index 000000000..5ffefd742
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0023_mismatched_paren.rast
@@ -0,0 +1,43 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "foo"
19 [email protected] "!"
20 [email protected] " "
21 [email protected]
22 [email protected] "("
23 [email protected] "\n "
24 [email protected] "bar"
25 [email protected] ","
26 [email protected] " "
27 [email protected] "\"baz\""
28 [email protected] ","
29 [email protected] " "
30 [email protected] "1"
31 [email protected] ","
32 [email protected] " "
33 [email protected] "2.0"
34 [email protected] "\n "
35 [email protected] "}"
36 [email protected] " "
37 [email protected] "//~ ERROR incorrect c ..."
38 [email protected] "\n"
39 [email protected]
40 [email protected] "}"
41 [email protected] "\n"
42error 49..49: unmatched `}`
43error 92..92: unmatched `}`
diff --git a/crates/syntax/test_data/parser/err/0023_mismatched_paren.rs b/crates/syntax/test_data/parser/err/0023_mismatched_paren.rs
new file mode 100644
index 000000000..0206d563e
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0023_mismatched_paren.rs
@@ -0,0 +1,5 @@
1fn main() {
2 foo! (
3 bar, "baz", 1, 2.0
4 } //~ ERROR incorrect close delimiter
5}
diff --git a/crates/syntax/test_data/parser/err/0024_many_type_parens.rast b/crates/syntax/test_data/parser/err/0024_many_type_parens.rast
new file mode 100644
index 000000000..e3be6b22e
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0024_many_type_parens.rast
@@ -0,0 +1,319 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "f"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ":"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected] "("
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "Copy"
22 [email protected] ")"
23 [email protected] " "
24 [email protected] "+"
25 [email protected] " "
26 [email protected]
27 [email protected] "("
28 [email protected] "?"
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "Sized"
34 [email protected] ")"
35 [email protected] " "
36 [email protected] "+"
37 [email protected] " "
38 [email protected]
39 [email protected] "("
40 [email protected]
41 [email protected] "for"
42 [email protected]
43 [email protected] "<"
44 [email protected]
45 [email protected] "\'a"
46 [email protected] ">"
47 [email protected] " "
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected] "Trait"
53 [email protected]
54 [email protected] "<"
55 [email protected]
56 [email protected] "\'a"
57 [email protected] ">"
58 [email protected] ")"
59 [email protected] ">"
60 [email protected]
61 [email protected] "("
62 [email protected] ")"
63 [email protected] " "
64 [email protected]
65 [email protected] "{"
66 [email protected] "}"
67 [email protected] "\n\n"
68 [email protected]
69 [email protected] "fn"
70 [email protected] " "
71 [email protected]
72 [email protected] "main"
73 [email protected]
74 [email protected] "("
75 [email protected] ")"
76 [email protected] " "
77 [email protected]
78 [email protected] "{"
79 [email protected] "\n "
80 [email protected]
81 [email protected] "let"
82 [email protected] " "
83 [email protected]
84 [email protected] "_"
85 [email protected] ":"
86 [email protected] " "
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected]
92 [email protected]
93 [email protected]
94 [email protected] "Box"
95 [email protected]
96 [email protected] "<"
97 [email protected]
98 [email protected]
99 [email protected] "("
100 [email protected]
101 [email protected]
102 [email protected]
103 [email protected]
104 [email protected] "Copy"
105 [email protected] ")"
106 [email protected] " "
107 [email protected] "+"
108 [email protected] " "
109 [email protected]
110 [email protected] "("
111 [email protected] "?"
112 [email protected]
113 [email protected]
114 [email protected]
115 [email protected]
116 [email protected] "Sized"
117 [email protected] ")"
118 [email protected] " "
119 [email protected] "+"
120 [email protected] " "
121 [email protected]
122 [email protected] "("
123 [email protected]
124 [email protected] "for"
125 [email protected]
126 [email protected] "<"
127 [email protected]
128 [email protected] "\'a"
129 [email protected] ">"
130 [email protected] " "
131 [email protected]
132 [email protected]
133 [email protected]
134 [email protected]
135 [email protected] "Trait"
136 [email protected]
137 [email protected] "<"
138 [email protected]
139 [email protected] "\'a"
140 [email protected] ">"
141 [email protected] ")"
142 [email protected]
143 [email protected]
144 [email protected] ">"
145 [email protected] ";"
146 [email protected] "\n "
147 [email protected]
148 [email protected] "let"
149 [email protected] " "
150 [email protected]
151 [email protected] "_"
152 [email protected] ":"
153 [email protected] " "
154 [email protected]
155 [email protected]
156 [email protected]
157 [email protected]
158 [email protected] "Box"
159 [email protected]
160 [email protected] "<"
161 [email protected]
162 [email protected]
163 [email protected] "("
164 [email protected]
165 [email protected] "?"
166 [email protected]
167 [email protected]
168 [email protected]
169 [email protected]
170 [email protected]
171 [email protected] "Sized"
172 [email protected]
173 [email protected]
174 [email protected] ")"
175 [email protected] " "
176 [email protected]
177 [email protected]
178 [email protected] "+"
179 [email protected] " "
180 [email protected]
181 [email protected]
182 [email protected] "("
183 [email protected]
184 [email protected] "for"
185 [email protected]
186 [email protected]
187 [email protected]
188 [email protected] "<"
189 [email protected]
190 [email protected] "\'a"
191 [email protected] ">"
192 [email protected] " "
193 [email protected]
194 [email protected]
195 [email protected]
196 [email protected]
197 [email protected]
198 [email protected]
199 [email protected]
200 [email protected]
201 [email protected] "Trait"
202 [email protected] "<"
203 [email protected]
204 [email protected] "\'a"
205 [email protected] ">"
206 [email protected]
207 [email protected] ")"
208 [email protected] " "
209 [email protected] "+"
210 [email protected] " "
211 [email protected]
212 [email protected] "("
213 [email protected]
214 [email protected]
215 [email protected]
216 [email protected]
217 [email protected] "Copy"
218 [email protected] ")"
219 [email protected] ">"
220 [email protected]
221 [email protected] ";"
222 [email protected] "\n "
223 [email protected]
224 [email protected] "let"
225 [email protected] " "
226 [email protected]
227 [email protected] "_"
228 [email protected] ":"
229 [email protected] " "
230 [email protected]
231 [email protected]
232 [email protected]
233 [email protected]
234 [email protected]
235 [email protected]
236 [email protected]
237 [email protected] "Box"
238 [email protected]
239 [email protected] "<"
240 [email protected]
241 [email protected]
242 [email protected] "("
243 [email protected]
244 [email protected] "for"
245 [email protected]
246 [email protected] "<"
247 [email protected]
248 [email protected] "\'a"
249 [email protected] ">"
250 [email protected] " "
251 [email protected]
252 [email protected]
253 [email protected]
254 [email protected]
255 [email protected] "Trait"
256 [email protected]
257 [email protected] "<"
258 [email protected]
259 [email protected] "\'a"
260 [email protected] ">"
261 [email protected] ")"
262 [email protected] " "
263 [email protected] "+"
264 [email protected] " "
265 [email protected]
266 [email protected] "("
267 [email protected]
268 [email protected]
269 [email protected]
270 [email protected]
271 [email protected] "Copy"
272 [email protected] ")"
273 [email protected] " "
274 [email protected] "+"
275 [email protected] " "
276 [email protected]
277 [email protected] "("
278 [email protected] "?"
279 [email protected]
280 [email protected]
281 [email protected]
282 [email protected]
283 [email protected] "Sized"
284 [email protected] ")"
285 [email protected]
286 [email protected]
287 [email protected] ">"
288 [email protected] ";"
289 [email protected] "\n"
290 [email protected] "}"
291 [email protected] "\n"
292error 88..88: expected COMMA
293error 88..88: expected R_ANGLE
294error 121..121: expected SEMICOLON
295error 121..121: expected expression
296error 140..140: expected type
297error 141..141: expected R_PAREN
298error 141..141: expected COMMA
299error 141..141: expected R_ANGLE
300error 141..141: expected SEMICOLON
301error 146..146: expected SEMICOLON
302error 146..146: expected expression
303error 147..147: expected SEMICOLON
304error 148..148: expected expression
305error 149..149: expected SEMICOLON
306error 155..155: expected type
307error 158..158: expected IN_KW
308error 165..165: expected expression
309error 168..168: expected expression
310error 179..179: expected expression
311error 180..180: expected a block
312error 180..180: expected COMMA
313error 180..180: expected expression
314error 180..180: expected R_PAREN
315error 180..180: expected SEMICOLON
316error 215..215: expected COMMA
317error 215..215: expected R_ANGLE
318error 235..235: expected SEMICOLON
319error 235..235: expected expression
diff --git a/crates/syntax/test_data/parser/err/0024_many_type_parens.rs b/crates/syntax/test_data/parser/err/0024_many_type_parens.rs
new file mode 100644
index 000000000..6c2e95c02
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0024_many_type_parens.rs
@@ -0,0 +1,7 @@
1fn f<T: (Copy) + (?Sized) + (for<'a> Trait<'a>)>() {}
2
3fn main() {
4 let _: Box<(Copy) + (?Sized) + (for<'a> Trait<'a>)>;
5 let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Copy)>;
6 let _: Box<(for<'a> Trait<'a>) + (Copy) + (?Sized)>;
7}
diff --git a/crates/syntax/test_data/parser/err/0025_nope.rast b/crates/syntax/test_data/parser/err/0025_nope.rast
new file mode 100644
index 000000000..83fc9fe77
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0025_nope.rast
@@ -0,0 +1,202 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "enum"
16 [email protected] " "
17 [email protected]
18 [email protected] "Test"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] "\n "
23 [email protected]
24 [email protected]
25 [email protected] "Var1"
26 [email protected] ","
27 [email protected] "\n "
28 [email protected]
29 [email protected]
30 [email protected] "Var2"
31 [email protected]
32 [email protected] "("
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected] "String"
39 [email protected] ")"
40 [email protected] ","
41 [email protected] "\n "
42 [email protected]
43 [email protected]
44 [email protected] "Var3"
45 [email protected] " "
46 [email protected]
47 [email protected] "{"
48 [email protected] "\n "
49 [email protected]
50 [email protected]
51 [email protected] "abc"
52 [email protected] ":"
53 [email protected] " "
54 [email protected]
55 [email protected] "{"
56 [email protected] "}"
57 [email protected]
58 [email protected] ","
59 [email protected] " "
60 [email protected] "//~ ERROR: expected t ..."
61 [email protected] "\n "
62 [email protected] "}"
63 [email protected] ","
64 [email protected] "\n "
65 [email protected] "}"
66 [email protected] "\n\n "
67 [email protected] "// recover..."
68 [email protected] "\n "
69 [email protected]
70 [email protected] "let"
71 [email protected] " "
72 [email protected]
73 [email protected]
74 [email protected] "a"
75 [email protected] " "
76 [email protected] "="
77 [email protected] " "
78 [email protected]
79 [email protected] "1"
80 [email protected] ";"
81 [email protected] "\n "
82 [email protected]
83 [email protected] "enum"
84 [email protected] " "
85 [email protected]
86 [email protected] "Test2"
87 [email protected] " "
88 [email protected]
89 [email protected] "{"
90 [email protected] "\n "
91 [email protected]
92 [email protected]
93 [email protected] "Fine"
94 [email protected] ","
95 [email protected] "\n "
96 [email protected] "}"
97 [email protected] "\n\n "
98 [email protected]
99 [email protected] "enum"
100 [email protected] " "
101 [email protected]
102 [email protected] "Test3"
103 [email protected] " "
104 [email protected]
105 [email protected] "{"
106 [email protected] "\n "
107 [email protected]
108 [email protected]
109 [email protected] "StillFine"
110 [email protected] " "
111 [email protected]
112 [email protected] "{"
113 [email protected] "\n "
114 [email protected]
115 [email protected]
116 [email protected] "def"
117 [email protected] ":"
118 [email protected] " "
119 [email protected]
120 [email protected]
121 [email protected]
122 [email protected]
123 [email protected] "i32"
124 [email protected] ","
125 [email protected] "\n "
126 [email protected] "}"
127 [email protected] ","
128 [email protected] "\n "
129 [email protected] "}"
130 [email protected] "\n\n "
131 [email protected]
132 [email protected]
133 [email protected] "{"
134 [email protected] "\n "
135 [email protected]
136 [email protected] "// fail again"
137 [email protected] "\n "
138 [email protected] "enum"
139 [email protected] " "
140 [email protected]
141 [email protected] "Test4"
142 [email protected] " "
143 [email protected]
144 [email protected] "{"
145 [email protected] "\n "
146 [email protected]
147 [email protected]
148 [email protected] "Nope"
149 [email protected]
150 [email protected] "("
151 [email protected]
152 [email protected]
153 [email protected]
154 [email protected]
155 [email protected]
156 [email protected] "i32"
157 [email protected] " "
158 [email protected]
159 [email protected]
160 [email protected] "{"
161 [email protected] "}"
162 [email protected]
163 [email protected] ")"
164 [email protected] " "
165 [email protected] "//~ ERROR: found `{`"
166 [email protected] "\n ..."
167 [email protected] "//~^ ERROR: found `{`"
168 [email protected] "\n "
169 [email protected] "}"
170 [email protected] "\n "
171 [email protected] "}"
172 [email protected] "\n "
173 [email protected] "// still recover later"
174 [email protected] "\n "
175 [email protected]
176 [email protected] "let"
177 [email protected] " "
178 [email protected]
179 [email protected]
180 [email protected] "bad_syntax"
181 [email protected] " "
182 [email protected] "="
183 [email protected] " "
184 [email protected]
185 [email protected] "_"
186 [email protected] ";"
187 [email protected] " "
188 [email protected] "//~ ERROR: expected e ..."
189 [email protected] "\n"
190 [email protected] "}"
191 [email protected] "\n"
192error 95..95: expected type
193error 95..95: expected COMMA
194error 96..96: expected field
195error 98..98: expected field declaration
196error 371..371: expected COMMA
197error 372..372: expected a type
198error 372..372: expected R_PAREN
199error 372..372: expected COMMA
200error 372..372: expected enum variant
201error 374..374: expected enum variant
202error 508..508: expected expression
diff --git a/crates/syntax/test_data/parser/err/0025_nope.rs b/crates/syntax/test_data/parser/err/0025_nope.rs
new file mode 100644
index 000000000..28726ed51
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0025_nope.rs
@@ -0,0 +1,31 @@
1fn main() {
2 enum Test {
3 Var1,
4 Var2(String),
5 Var3 {
6 abc: {}, //~ ERROR: expected type, found `{`
7 },
8 }
9
10 // recover...
11 let a = 1;
12 enum Test2 {
13 Fine,
14 }
15
16 enum Test3 {
17 StillFine {
18 def: i32,
19 },
20 }
21
22 {
23 // fail again
24 enum Test4 {
25 Nope(i32 {}) //~ ERROR: found `{`
26 //~^ ERROR: found `{`
27 }
28 }
29 // still recover later
30 let bad_syntax = _; //~ ERROR: expected expression, found reserved identifier `_`
31}
diff --git a/crates/syntax/test_data/parser/err/0026_imp_recovery.rast b/crates/syntax/test_data/parser/err/0026_imp_recovery.rast
new file mode 100644
index 000000000..1b08c834e
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0026_imp_recovery.rast
@@ -0,0 +1,49 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected]
5 [email protected] "<"
6 [email protected]
7 [email protected]
8 [email protected] "T"
9 [email protected] ":"
10 [email protected] " "
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "Clone"
18 [email protected] ">"
19 [email protected] "\n"
20 [email protected]
21 [email protected] "impl"
22 [email protected]
23 [email protected] "<"
24 [email protected]
25 [email protected]
26 [email protected] "T"
27 [email protected] ">"
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "OnceCell"
34 [email protected]
35 [email protected] "<"
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "T"
42 [email protected] ">"
43 [email protected] " "
44 [email protected]
45 [email protected] "{"
46 [email protected] "}"
47 [email protected] "\n"
48error 14..14: expected trait or type
49error 14..14: expected `{`
diff --git a/crates/syntax/test_data/parser/err/0026_imp_recovery.rs b/crates/syntax/test_data/parser/err/0026_imp_recovery.rs
new file mode 100644
index 000000000..829ca1c4b
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0026_imp_recovery.rs
@@ -0,0 +1,2 @@
1impl<T: Clone>
2impl<T> OnceCell<T> {}
diff --git a/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast
new file mode 100644
index 000000000..a8e42e6ea
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast
@@ -0,0 +1,27 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] "\n "
11 [email protected]
12 [email protected] "where"
13 [email protected] " "
14 [email protected]
15 [email protected] "for"
16 [email protected]
17 [email protected] "<"
18 [email protected]
19 [email protected] "\'a"
20 [email protected] ">"
21 [email protected] "\n"
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] "\n"
26error 26..26: expected type
27error 26..26: expected colon
diff --git a/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rs b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rs
new file mode 100644
index 000000000..2792c2084
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rs
@@ -0,0 +1,3 @@
1fn foo()
2 where for<'a>
3{}
diff --git a/crates/syntax/test_data/parser/err/0029_field_completion.rast b/crates/syntax/test_data/parser/err/0029_field_completion.rast
new file mode 100644
index 000000000..c6402cdd8
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0029_field_completion.rast
@@ -0,0 +1,35 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected] "a"
13 [email protected] ":"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "A"
20 [email protected] ")"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "\n "
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "a"
31 [email protected] "."
32 [email protected] "\n"
33 [email protected] "}"
34 [email protected] "\n"
35error 21..21: expected field name or number
diff --git a/crates/syntax/test_data/parser/err/0029_field_completion.rs b/crates/syntax/test_data/parser/err/0029_field_completion.rs
new file mode 100644
index 000000000..a7cdc17bb
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0029_field_completion.rs
@@ -0,0 +1,3 @@
1fn foo(a: A) {
2 a.
3}
diff --git a/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast b/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast
new file mode 100644
index 000000000..a443b37db
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast
@@ -0,0 +1,121 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "block"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "inner"
20 [email protected] " "
21 [email protected] "="
22 [email protected] " "
23 [email protected]
24 [email protected] "{"
25 [email protected] "\n "
26 [email protected]
27 [email protected] "#"
28 [email protected] "!"
29 [email protected] "["
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "doc"
34 [email protected]
35 [email protected] "("
36 [email protected] "\"Inner attributes not ..."
37 [email protected] ")"
38 [email protected] "]"
39 [email protected] "\n "
40 [email protected] "//! Nor are ModuleDoc ..."
41 [email protected] "\n "
42 [email protected] "}"
43 [email protected] ";"
44 [email protected] "\n "
45 [email protected]
46 [email protected]
47 [email protected] "if"
48 [email protected] " "
49 [email protected]
50 [email protected]
51 [email protected] "true"
52 [email protected] " "
53 [email protected]
54 [email protected] "{"
55 [email protected] "\n "
56 [email protected]
57 [email protected] "#"
58 [email protected] "!"
59 [email protected] "["
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected] "doc"
64 [email protected]
65 [email protected] "("
66 [email protected] "\"Nor here\""
67 [email protected] ")"
68 [email protected] "]"
69 [email protected] "\n "
70 [email protected]
71 [email protected] "#"
72 [email protected] "!"
73 [email protected] "["
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected] "doc"
78 [email protected]
79 [email protected] "("
80 [email protected] "\"We error on each attr\""
81 [email protected] ")"
82 [email protected] "]"
83 [email protected] "\n "
84 [email protected] "//! Nor are ModuleDoc ..."
85 [email protected] "\n "
86 [email protected] "}"
87 [email protected] "\n "
88 [email protected]
89 [email protected] "while"
90 [email protected] " "
91 [email protected]
92 [email protected]
93 [email protected] "true"
94 [email protected] " "
95 [email protected]
96 [email protected] "{"
97 [email protected] "\n "
98 [email protected]
99 [email protected] "#"
100 [email protected] "!"
101 [email protected] "["
102 [email protected]
103 [email protected]
104 [email protected]
105 [email protected] "doc"
106 [email protected]
107 [email protected] "("
108 [email protected] "\"Nor here\""
109 [email protected] ")"
110 [email protected] "]"
111 [email protected] "\n "
112 [email protected] "//! Nor are ModuleDoc ..."
113 [email protected] "\n "
114 [email protected] "}"
115 [email protected] "\n"
116 [email protected] "}"
117 [email protected] "\n"
118error 39..83: A block in this position cannot accept inner attributes
119error 152..171: A block in this position cannot accept inner attributes
120error 180..212: A block in this position cannot accept inner attributes
121error 283..302: A block in this position cannot accept inner attributes
diff --git a/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rs b/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rs
new file mode 100644
index 000000000..6a04f2d0a
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rs
@@ -0,0 +1,15 @@
1fn block() {
2 let inner = {
3 #![doc("Inner attributes not allowed here")]
4 //! Nor are ModuleDoc comments
5 };
6 if true {
7 #![doc("Nor here")]
8 #![doc("We error on each attr")]
9 //! Nor are ModuleDoc comments
10 }
11 while true {
12 #![doc("Nor here")]
13 //! Nor are ModuleDoc comments
14 }
15}
diff --git a/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast b/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast
new file mode 100644
index 000000000..672dd054a
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast
@@ -0,0 +1,203 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "match"
17 [email protected] " "
18 [email protected]
19 [email protected] "("
20 [email protected] ")"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "\n "
25 [email protected]
26 [email protected]
27 [email protected] "_"
28 [email protected] " "
29 [email protected] "=>"
30 [email protected] " "
31 [email protected]
32 [email protected] "("
33 [email protected] ")"
34 [email protected] ","
35 [email protected] "\n "
36 [email protected]
37 [email protected]
38 [email protected] "#"
39 [email protected]
40 [email protected] "!"
41 [email protected]
42 [email protected] "["
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected] "doc"
49 [email protected]
50 [email protected] "("
51 [email protected]
52 [email protected] "\"Not allowed here\""
53 [email protected] ")"
54 [email protected] "]"
55 [email protected] "\n "
56 [email protected]
57 [email protected]
58 [email protected] "_"
59 [email protected] " "
60 [email protected] "=>"
61 [email protected] " "
62 [email protected]
63 [email protected] "("
64 [email protected] ")"
65 [email protected] ","
66 [email protected] "\n "
67 [email protected] "}"
68 [email protected] "\n\n "
69 [email protected]
70 [email protected]
71 [email protected] "match"
72 [email protected] " "
73 [email protected]
74 [email protected] "("
75 [email protected] ")"
76 [email protected] " "
77 [email protected]
78 [email protected] "{"
79 [email protected] "\n "
80 [email protected]
81 [email protected]
82 [email protected] "_"
83 [email protected] " "
84 [email protected] "=>"
85 [email protected] " "
86 [email protected]
87 [email protected] "("
88 [email protected] ")"
89 [email protected] ","
90 [email protected] "\n "
91 [email protected]
92 [email protected]
93 [email protected] "_"
94 [email protected] " "
95 [email protected] "=>"
96 [email protected] " "
97 [email protected]
98 [email protected] "("
99 [email protected] ")"
100 [email protected] ","
101 [email protected] "\n "
102 [email protected]
103 [email protected]
104 [email protected] "#"
105 [email protected]
106 [email protected] "!"
107 [email protected]
108 [email protected] "["
109 [email protected]
110 [email protected]
111 [email protected]
112 [email protected]
113 [email protected]
114 [email protected] "doc"
115 [email protected]
116 [email protected] "("
117 [email protected]
118 [email protected] "\"Nor here\""
119 [email protected] ")"
120 [email protected] "]"
121 [email protected] "\n "
122 [email protected] "}"
123 [email protected] "\n\n "
124 [email protected]
125 [email protected] "match"
126 [email protected] " "
127 [email protected]
128 [email protected] "("
129 [email protected] ")"
130 [email protected] " "
131 [email protected]
132 [email protected] "{"
133 [email protected] "\n "
134 [email protected]
135 [email protected]
136 [email protected] "#"
137 [email protected] "["
138 [email protected]
139 [email protected]
140 [email protected]
141 [email protected] "cfg"
142 [email protected]
143 [email protected] "("
144 [email protected] "test"
145 [email protected] ")"
146 [email protected] "]"
147 [email protected] "\n "
148 [email protected]
149 [email protected] "#"
150 [email protected]
151 [email protected] "!"
152 [email protected]
153 [email protected] "["
154 [email protected]
155 [email protected]
156 [email protected]
157 [email protected]
158 [email protected]
159 [email protected] "doc"
160 [email protected]
161 [email protected] "("
162 [email protected]
163 [email protected] "\"Nor here\""
164 [email protected] ")"
165 [email protected] "]"
166 [email protected] "\n "
167 [email protected]
168 [email protected]
169 [email protected] "_"
170 [email protected] " "
171 [email protected] "=>"
172 [email protected] " "
173 [email protected]
174 [email protected] "("
175 [email protected] ")"
176 [email protected] ","
177 [email protected] "\n "
178 [email protected]
179 [email protected]
180 [email protected] "_"
181 [email protected] " "
182 [email protected] "=>"
183 [email protected] " "
184 [email protected]
185 [email protected] "("
186 [email protected] ")"
187 [email protected] ","
188 [email protected] "\n "
189 [email protected] "}"
190 [email protected] "\n"
191 [email protected] "}"
192 [email protected] "\n"
193error 52..52: expected `[`
194error 52..52: expected pattern
195error 53..53: expected FAT_ARROW
196error 78..78: expected COMMA
197error 161..161: expected `[`
198error 161..161: expected pattern
199error 162..162: expected FAT_ARROW
200error 232..232: expected `[`
201error 232..232: expected pattern
202error 233..233: expected FAT_ARROW
203error 250..250: expected COMMA
diff --git a/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rs b/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rs
new file mode 100644
index 000000000..06aa47770
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rs
@@ -0,0 +1,20 @@
1fn foo() {
2 match () {
3 _ => (),
4 #![doc("Not allowed here")]
5 _ => (),
6 }
7
8 match () {
9 _ => (),
10 _ => (),
11 #![doc("Nor here")]
12 }
13
14 match () {
15 #[cfg(test)]
16 #![doc("Nor here")]
17 _ => (),
18 _ => (),
19 }
20}
diff --git a/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast b/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast
new file mode 100644
index 000000000..33bb085e9
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast
@@ -0,0 +1,66 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "match"
16 [email protected] " "
17 [email protected]
18 [email protected] "("
19 [email protected] ")"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "\n "
24 [email protected]
25 [email protected]
26 [email protected] "_"
27 [email protected] " "
28 [email protected] "=>"
29 [email protected] " "
30 [email protected]
31 [email protected] "("
32 [email protected] ")"
33 [email protected] ","
34 [email protected] "\n "
35 [email protected]
36 [email protected]
37 [email protected] "_"
38 [email protected] " "
39 [email protected] "=>"
40 [email protected] " "
41 [email protected]
42 [email protected] "("
43 [email protected] ")"
44 [email protected] ","
45 [email protected] "\n "
46 [email protected]
47 [email protected]
48 [email protected] "#"
49 [email protected] "["
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected] "cfg"
54 [email protected]
55 [email protected] "("
56 [email protected] "test"
57 [email protected] ")"
58 [email protected] "]"
59 [email protected] "\n "
60 [email protected] "}"
61 [email protected] "\n"
62 [email protected] "}"
63 [email protected] "\n"
64error 80..80: expected pattern
65error 80..80: expected FAT_ARROW
66error 80..80: expected expression
diff --git a/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rs b/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rs
new file mode 100644
index 000000000..4635222da
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rs
@@ -0,0 +1,7 @@
1fn foo() {
2 match () {
3 _ => (),
4 _ => (),
5 #[cfg(test)]
6 }
7}
diff --git a/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rast b/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rast
new file mode 100644
index 000000000..d9d49bfb5
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rast
@@ -0,0 +1,95 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "ref"
19 [email protected] " "
20 [email protected]
21 [email protected] "box"
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "i"
30 [email protected] " "
31 [email protected] "="
32 [email protected] " "
33 [email protected]
34 [email protected] "("
35 [email protected] ")"
36 [email protected] ";"
37 [email protected] "\n "
38 [email protected]
39 [email protected] "let"
40 [email protected] " "
41 [email protected]
42 [email protected] "mut"
43 [email protected] " "
44 [email protected]
45 [email protected] "box"
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected] "i"
54 [email protected] " "
55 [email protected] "="
56 [email protected] " "
57 [email protected]
58 [email protected] "("
59 [email protected] ")"
60 [email protected] ";"
61 [email protected] "\n "
62 [email protected]
63 [email protected] "let"
64 [email protected] " "
65 [email protected]
66 [email protected] "ref"
67 [email protected] " "
68 [email protected] "mut"
69 [email protected] " "
70 [email protected]
71 [email protected] "box"
72 [email protected] " "
73 [email protected]
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected] "i"
80 [email protected] " "
81 [email protected] "="
82 [email protected] " "
83 [email protected]
84 [email protected] "("
85 [email protected] ")"
86 [email protected] ";"
87 [email protected] "\n"
88 [email protected] "}"
89 [email protected] "\n\n"
90error 24..24: expected a name
91error 27..27: expected SEMICOLON
92error 48..48: expected a name
93error 51..51: expected SEMICOLON
94error 76..76: expected a name
95error 79..79: expected SEMICOLON
diff --git a/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rs b/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rs
new file mode 100644
index 000000000..d3fa2e468
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rs
@@ -0,0 +1,6 @@
1fn main() {
2 let ref box i = ();
3 let mut box i = ();
4 let ref mut box i = ();
5}
6
diff --git a/crates/syntax/test_data/parser/err/0035_use_recover.rast b/crates/syntax/test_data/parser/err/0035_use_recover.rast
new file mode 100644
index 000000000..2f03709eb
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0035_use_recover.rast
@@ -0,0 +1,53 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected]
10 [email protected] "foo"
11 [email protected] "::"
12 [email protected]
13 [email protected]
14 [email protected] "bar"
15 [email protected] ";"
16 [email protected] "\n"
17 [email protected]
18 [email protected] "use"
19 [email protected] "\n"
20 [email protected]
21 [email protected] "use"
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected] "crate"
28 [email protected] "::"
29 [email protected]
30 [email protected]
31 [email protected] "baz"
32 [email protected] ";"
33 [email protected] "\n"
34 [email protected]
35 [email protected] "use"
36 [email protected] "\n"
37 [email protected]
38 [email protected] "fn"
39 [email protected] " "
40 [email protected]
41 [email protected] "f"
42 [email protected]
43 [email protected] "("
44 [email protected] ")"
45 [email protected] " "
46 [email protected]
47 [email protected] "{"
48 [email protected] "}"
49 [email protected] "\n"
50error 17..17: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
51error 17..17: expected SEMICOLON
52error 37..37: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
53error 37..37: expected SEMICOLON
diff --git a/crates/syntax/test_data/parser/err/0035_use_recover.rs b/crates/syntax/test_data/parser/err/0035_use_recover.rs
new file mode 100644
index 000000000..4a2668126
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0035_use_recover.rs
@@ -0,0 +1,5 @@
1use foo::bar;
2use
3use crate::baz;
4use
5fn f() {}
diff --git a/crates/syntax/test_data/parser/err/0036_partial_use.rast b/crates/syntax/test_data/parser/err/0036_partial_use.rast
new file mode 100644
index 000000000..ef6172f8a
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0036_partial_use.rast
@@ -0,0 +1,51 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "std"
10 [email protected] "::"
11 [email protected]
12 [email protected] "{"
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "error"
19 [email protected] "::"
20 [email protected]
21 [email protected]
22 [email protected] "Error"
23 [email protected]
24 [email protected] ";"
25 [email protected] "\n"
26 [email protected]
27 [email protected] "use"
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "std"
35 [email protected] "::"
36 [email protected]
37 [email protected]
38 [email protected] "io"
39 [email protected]
40 [email protected] ";"
41 [email protected] "\n"
42error 22..22: expected COMMA
43error 22..22: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
44error 23..23: expected COMMA
45error 24..24: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
46error 27..27: expected COMMA
47error 35..35: expected COMMA
48error 35..35: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
49error 36..36: expected COMMA
50error 36..36: expected R_CURLY
51error 36..36: expected SEMICOLON
diff --git a/crates/syntax/test_data/parser/err/0036_partial_use.rs b/crates/syntax/test_data/parser/err/0036_partial_use.rs
new file mode 100644
index 000000000..d521a5bb2
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0036_partial_use.rs
@@ -0,0 +1,2 @@
1use std::{error::Error;
2use std::io;
diff --git a/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast
new file mode 100644
index 000000000..faf87d6e5
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast
@@ -0,0 +1,97 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "T"
10 [email protected] " "
11 [email protected] "for"
12 [email protected] " "
13 [email protected]
14 [email protected] "("
15 [email protected] ")"
16 [email protected] " "
17 [email protected]
18 [email protected] "{"
19 [email protected] "\n "
20 [email protected]
21 [email protected] "fn"
22 [email protected] " "
23 [email protected]
24 [email protected] "foo"
25 [email protected]
26 [email protected] "("
27 [email protected] ")"
28 [email protected] " "
29 [email protected]
30 [email protected] "{"
31 [email protected] "}"
32 [email protected] "\n "
33 [email protected]
34 [email protected]
35 [email protected] "pub"
36 [email protected] " "
37 [email protected] "fn"
38 [email protected] " "
39 [email protected]
40 [email protected] "bar"
41 [email protected]
42 [email protected] "("
43 [email protected] ")"
44 [email protected] " "
45 [email protected]
46 [email protected] "{"
47 [email protected] "}"
48 [email protected] "\n "
49 [email protected]
50 [email protected]
51 [email protected] "pub"
52 [email protected] "("
53 [email protected] "crate"
54 [email protected] ")"
55 [email protected] " "
56 [email protected] "type"
57 [email protected] " "
58 [email protected]
59 [email protected] "Baz"
60 [email protected] " "
61 [email protected] "="
62 [email protected] " "
63 [email protected]
64 [email protected] "("
65 [email protected] ")"
66 [email protected] ";"
67 [email protected] "\n "
68 [email protected]
69 [email protected]
70 [email protected] "pub"
71 [email protected] "("
72 [email protected] "crate"
73 [email protected] ")"
74 [email protected] " "
75 [email protected] "const"
76 [email protected] " "
77 [email protected]
78 [email protected] "C"
79 [email protected] ":"
80 [email protected] " "
81 [email protected]
82 [email protected]
83 [email protected]
84 [email protected]
85 [email protected] "i32"
86 [email protected] " "
87 [email protected] "="
88 [email protected] " "
89 [email protected]
90 [email protected] "92"
91 [email protected] ";"
92 [email protected] "\n"
93 [email protected] "}"
94 [email protected] "\n"
95error 36..39: Unnecessary visibility qualifier
96error 56..66: Unnecessary visibility qualifier
97error 86..96: Unnecessary visibility qualifier
diff --git a/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rs b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rs
new file mode 100644
index 000000000..a43e7ef10
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rs
@@ -0,0 +1,6 @@
1impl T for () {
2 fn foo() {}
3 pub fn bar() {}
4 pub(crate) type Baz = ();
5 pub(crate) const C: i32 = 92;
6}
diff --git a/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rast b/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rast
new file mode 100644
index 000000000..bed7ad6c3
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rast
@@ -0,0 +1,29 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "0"
18 [email protected] "..="
19 [email protected] ";"
20 [email protected] "\n "
21 [email protected]
22 [email protected]
23 [email protected] "..="
24 [email protected] ";"
25 [email protected] "\n"
26 [email protected] "}"
27 [email protected] "\n"
28error 16..20: An inclusive range must have an end expression
29error 26..29: An inclusive range must have an end expression
diff --git a/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rs b/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rs
new file mode 100644
index 000000000..0b4ed7a2b
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rs
@@ -0,0 +1,4 @@
1fn main() {
2 0..=;
3 ..=;
4}
diff --git a/crates/syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/syntax/test_data/parser/err/0039_lambda_recovery.rast
new file mode 100644
index 000000000..a9c5b70fd
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0039_lambda_recovery.rast
@@ -0,0 +1,82 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "->"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "i32"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] "\n "
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected] "["
29 [email protected]
30 [email protected] "1"
31 [email protected] ","
32 [email protected] " "
33 [email protected]
34 [email protected] "2"
35 [email protected] ","
36 [email protected] " "
37 [email protected]
38 [email protected] "3"
39 [email protected] "]"
40 [email protected] "."
41 [email protected]
42 [email protected] "iter"
43 [email protected]
44 [email protected] "("
45 [email protected] ")"
46 [email protected] "\n "
47 [email protected] "."
48 [email protected]
49 [email protected] "map"
50 [email protected]
51 [email protected] "("
52 [email protected]
53 [email protected]
54 [email protected] "|"
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected] "it"
59 [email protected] "|"
60 [email protected] ")"
61 [email protected] "\n "
62 [email protected] "."
63 [email protected]
64 [email protected] "max"
65 [email protected]
66 [email protected] "::"
67 [email protected] "<"
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected]
72 [email protected]
73 [email protected] "i32"
74 [email protected] ">"
75 [email protected]
76 [email protected] "("
77 [email protected] ")"
78 [email protected] ";"
79 [email protected] "\n"
80 [email protected] "}"
81 [email protected] "\n"
82error 56..56: expected expression
diff --git a/crates/syntax/test_data/parser/err/0039_lambda_recovery.rs b/crates/syntax/test_data/parser/err/0039_lambda_recovery.rs
new file mode 100644
index 000000000..a2f74bd87
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0039_lambda_recovery.rs
@@ -0,0 +1,5 @@
1fn foo() -> i32 {
2 [1, 2, 3].iter()
3 .map(|it|)
4 .max::<i32>();
5}
diff --git a/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast b/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast
new file mode 100644
index 000000000..284c8715b
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast
@@ -0,0 +1,91 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected] "::"
9 [email protected] "crate"
10 [email protected] ";"
11 [email protected] "\n"
12 [email protected]
13 [email protected] "use"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected] "{"
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "crate"
22 [email protected] ","
23 [email protected] " "
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected] "foo"
29 [email protected] "::"
30 [email protected]
31 [email protected] "{"
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected] "crate"
39 [email protected] "::"
40 [email protected]
41 [email protected]
42 [email protected] "foo"
43 [email protected] "::"
44 [email protected]
45 [email protected]
46 [email protected] "bar"
47 [email protected] "::"
48 [email protected]
49 [email protected]
50 [email protected] "baz"
51 [email protected] "}"
52 [email protected] "}"
53 [email protected] ";"
54 [email protected] "\n"
55 [email protected]
56 [email protected] "use"
57 [email protected] " "
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected] "hello"
64 [email protected] "::"
65 [email protected]
66 [email protected] "crate"
67 [email protected] ";"
68 [email protected] "\n"
69 [email protected]
70 [email protected] "use"
71 [email protected] " "
72 [email protected]
73 [email protected]
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected] "hello"
79 [email protected] "::"
80 [email protected]
81 [email protected] "crate"
82 [email protected] "::"
83 [email protected]
84 [email protected]
85 [email protected] "there"
86 [email protected] ";"
87 [email protected] "\n"
88error 6..11: The `crate` keyword is only allowed as the first segment of a path
89error 31..36: The `crate` keyword is only allowed as the first segment of a path
90error 66..71: The `crate` keyword is only allowed as the first segment of a path
91error 84..89: The `crate` keyword is only allowed as the first segment of a path
diff --git a/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs b/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs
new file mode 100644
index 000000000..508def2c7
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs
@@ -0,0 +1,4 @@
1use ::crate;
2use {crate, foo::{crate::foo::bar::baz}};
3use hello::crate;
4use hello::crate::there;
diff --git a/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast b/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast
new file mode 100644
index 000000000..2049a9d72
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast
@@ -0,0 +1,70 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected] "::"
9 [email protected] "super"
10 [email protected] ";"
11 [email protected] "\n"
12 [email protected]
13 [email protected] "use"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "a"
21 [email protected] "::"
22 [email protected]
23 [email protected] "super"
24 [email protected] ";"
25 [email protected] "\n"
26 [email protected]
27 [email protected] "use"
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "super"
35 [email protected] "::"
36 [email protected]
37 [email protected]
38 [email protected] "a"
39 [email protected] "::"
40 [email protected]
41 [email protected] "super"
42 [email protected] ";"
43 [email protected] "\n"
44 [email protected]
45 [email protected] "use"
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected] "a"
52 [email protected] "::"
53 [email protected]
54 [email protected] "{"
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected] "super"
60 [email protected] "::"
61 [email protected]
62 [email protected]
63 [email protected] "b"
64 [email protected] "}"
65 [email protected] ";"
66 [email protected] "\n"
67error 6..11: The `super` keyword may only be preceded by other `super`s
68error 20..25: The `super` keyword may only be preceded by other `super`s
69error 41..46: The `super` keyword may only be preceded by other `super`s
70error 56..61: The `super` keyword may only be preceded by other `super`s
diff --git a/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rs b/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rs
new file mode 100644
index 000000000..bd4d58042
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rs
@@ -0,0 +1,4 @@
1use ::super;
2use a::super;
3use super::a::super;
4use a::{super::b};
diff --git a/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast b/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast
new file mode 100644
index 000000000..deadf56b4
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast
@@ -0,0 +1,27 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected] "::"
9 [email protected] "self"
10 [email protected] ";"
11 [email protected] "\n"
12 [email protected]
13 [email protected] "use"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "a"
21 [email protected] "::"
22 [email protected]
23 [email protected] "self"
24 [email protected] ";"
25 [email protected] "\n"
26error 6..10: The `self` keyword is only allowed as the first segment of a path
27error 19..23: The `self` keyword is only allowed as the first segment of a path
diff --git a/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rs b/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rs
new file mode 100644
index 000000000..b9e1d7d8b
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rs
@@ -0,0 +1,2 @@
1use ::self;
2use a::self;
diff --git a/crates/syntax/test_data/parser/err/0043_weird_blocks.rast b/crates/syntax/test_data/parser/err/0043_weird_blocks.rast
new file mode 100644
index 000000000..df29017e7
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0043_weird_blocks.rast
@@ -0,0 +1,71 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "{"
17 [email protected] " "
18 [email protected]
19 [email protected] "unsafe"
20 [email protected] " "
21 [email protected]
22 [email protected] "92"
23 [email protected] " "
24 [email protected] "}"
25 [email protected] "\n "
26 [email protected]
27 [email protected]
28 [email protected] "{"
29 [email protected] " "
30 [email protected]
31 [email protected] "async"
32 [email protected] " "
33 [email protected]
34 [email protected] "92"
35 [email protected] " "
36 [email protected] "}"
37 [email protected] "\n "
38 [email protected]
39 [email protected]
40 [email protected] "{"
41 [email protected] " "
42 [email protected]
43 [email protected]
44 [email protected] "try"
45 [email protected] " "
46 [email protected]
47 [email protected] "92"
48 [email protected] " "
49 [email protected] "}"
50 [email protected] "\n "
51 [email protected]
52 [email protected] "{"
53 [email protected] " "
54 [email protected]
55 [email protected]
56 [email protected]
57 [email protected] "\'label"
58 [email protected] ":"
59 [email protected] " "
60 [email protected]
61 [email protected] "92"
62 [email protected] " "
63 [email protected] "}"
64 [email protected] "\n"
65 [email protected] "}"
66 [email protected] "\n"
67error 24..24: expected existential, fn, trait or impl
68error 41..41: expected existential, fn, trait or impl
69error 56..56: expected a block
70error 75..75: expected a loop
71error 75..75: expected SEMICOLON
diff --git a/crates/syntax/test_data/parser/err/0043_weird_blocks.rs b/crates/syntax/test_data/parser/err/0043_weird_blocks.rs
new file mode 100644
index 000000000..8fa324c1a
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0043_weird_blocks.rs
@@ -0,0 +1,6 @@
1fn main() {
2 { unsafe 92 }
3 { async 92 }
4 { try 92 }
5 { 'label: 92 }
6}
diff --git a/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast
new file mode 100644
index 000000000..71aa86494
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast
@@ -0,0 +1,240 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "ForRef"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "for"
12 [email protected]
13 [email protected] "<"
14 [email protected]
15 [email protected] "\'a"
16 [email protected] ">"
17 [email protected] " "
18 [email protected]
19 [email protected] "&"
20 [email protected] "\'a"
21 [email protected] " "
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected] "u32"
27 [email protected] ";"
28 [email protected] "\n"
29 [email protected]
30 [email protected] "type"
31 [email protected] " "
32 [email protected]
33 [email protected] "ForTup"
34 [email protected] " "
35 [email protected] "="
36 [email protected] " "
37 [email protected]
38 [email protected] "for"
39 [email protected]
40 [email protected] "<"
41 [email protected]
42 [email protected] "\'a"
43 [email protected] ">"
44 [email protected] " "
45 [email protected]
46 [email protected] "("
47 [email protected]
48 [email protected] "&"
49 [email protected] "\'a"
50 [email protected] " "
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected] "u32"
56 [email protected] ","
57 [email protected] ")"
58 [email protected] ";"
59 [email protected] "\n"
60 [email protected]
61 [email protected] "type"
62 [email protected] " "
63 [email protected]
64 [email protected] "ForSlice"
65 [email protected] " "
66 [email protected] "="
67 [email protected] " "
68 [email protected]
69 [email protected] "for"
70 [email protected]
71 [email protected] "<"
72 [email protected]
73 [email protected] "\'a"
74 [email protected] ">"
75 [email protected] " "
76 [email protected]
77 [email protected] "["
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected] "u32"
83 [email protected] "]"
84 [email protected] ";"
85 [email protected] "\n"
86 [email protected]
87 [email protected] "type"
88 [email protected] " "
89 [email protected]
90 [email protected] "ForForFn"
91 [email protected] " "
92 [email protected] "="
93 [email protected] " "
94 [email protected]
95 [email protected] "for"
96 [email protected]
97 [email protected] "<"
98 [email protected]
99 [email protected] "\'a"
100 [email protected] ">"
101 [email protected] " "
102 [email protected]
103 [email protected] "for"
104 [email protected]
105 [email protected] "<"
106 [email protected]
107 [email protected] "\'b"
108 [email protected] ">"
109 [email protected] " "
110 [email protected]
111 [email protected] "fn"
112 [email protected]
113 [email protected] "("
114 [email protected]
115 [email protected]
116 [email protected] "&"
117 [email protected] "\'a"
118 [email protected] " "
119 [email protected]
120 [email protected]
121 [email protected]
122 [email protected]
123 [email protected] "i32"
124 [email protected] ","
125 [email protected] " "
126 [email protected]
127 [email protected]
128 [email protected] "&"
129 [email protected] "\'b"
130 [email protected] " "
131 [email protected]
132 [email protected]
133 [email protected]
134 [email protected]
135 [email protected] "i32"
136 [email protected] ")"
137 [email protected] ";"
138 [email protected] "\n"
139 [email protected]
140 [email protected] "fn"
141 [email protected] " "
142 [email protected]
143 [email protected] "for_for_for"
144 [email protected]
145 [email protected] "<"
146 [email protected]
147 [email protected]
148 [email protected] "T"
149 [email protected] ">"
150 [email protected]
151 [email protected] "("
152 [email protected] ")"
153 [email protected] "\n"
154 [email protected]
155 [email protected] "where"
156 [email protected] "\n "
157 [email protected]
158 [email protected] "for"
159 [email protected]
160 [email protected] "<"
161 [email protected]
162 [email protected] "\'a"
163 [email protected] ">"
164 [email protected] " "
165 [email protected]
166 [email protected] "for"
167 [email protected]
168 [email protected] "<"
169 [email protected]
170 [email protected] "\'b"
171 [email protected] ">"
172 [email protected] " "
173 [email protected]
174 [email protected] "for"
175 [email protected]
176 [email protected] "<"
177 [email protected]
178 [email protected] "\'c"
179 [email protected] ">"
180 [email protected] " "
181 [email protected]
182 [email protected] "fn"
183 [email protected]
184 [email protected] "("
185 [email protected]
186 [email protected]
187 [email protected] "&"
188 [email protected] "\'a"
189 [email protected] " "
190 [email protected]
191 [email protected]
192 [email protected]
193 [email protected]
194 [email protected] "T"
195 [email protected] ","
196 [email protected] " "
197 [email protected]
198 [email protected]
199 [email protected] "&"
200 [email protected] "\'b"
201 [email protected] " "
202 [email protected]
203 [email protected]
204 [email protected]
205 [email protected]
206 [email protected] "T"
207 [email protected] ","
208 [email protected] " "
209 [email protected]
210 [email protected]
211 [email protected] "&"
212 [email protected] "\'c"
213 [email protected] " "
214 [email protected]
215 [email protected]
216 [email protected]
217 [email protected]
218 [email protected] "T"
219 [email protected] ")"
220 [email protected] ":"
221 [email protected] " "
222 [email protected]
223 [email protected]
224 [email protected]
225 [email protected]
226 [email protected]
227 [email protected]
228 [email protected] "Copy"
229 [email protected] ","
230 [email protected] "\n"
231 [email protected]
232 [email protected] "{"
233 [email protected] "\n"
234 [email protected] "}"
235 [email protected] "\n"
236error 21..21: expected a function pointer or path
237error 52..52: expected a function pointer or path
238error 88..88: expected a function pointer or path
239error 119..119: expected a function pointer or path
240error 195..195: expected a function pointer or path
diff --git a/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rs b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rs
new file mode 100644
index 000000000..0e9f8ccb4
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rs
@@ -0,0 +1,9 @@
1type ForRef = for<'a> &'a u32;
2type ForTup = for<'a> (&'a u32,);
3type ForSlice = for<'a> [u32];
4type ForForFn = for<'a> for<'b> fn(&'a i32, &'b i32);
5fn for_for_for<T>()
6where
7 for<'a> for<'b> for<'c> fn(&'a T, &'b T, &'c T): Copy,
8{
9}
diff --git a/crates/syntax/test_data/parser/err/0045_item_modifiers.rast b/crates/syntax/test_data/parser/err/0045_item_modifiers.rast
new file mode 100644
index 000000000..a6e6552a9
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0045_item_modifiers.rast
@@ -0,0 +1,45 @@
1[email protected]
2 [email protected]
3 [email protected] "unsafe"
4 [email protected] " "
5 [email protected]
6 [email protected] "async"
7 [email protected] " "
8 [email protected] "fn"
9 [email protected] " "
10 [email protected]
11 [email protected] "foo"
12 [email protected]
13 [email protected] "("
14 [email protected] ")"
15 [email protected] " "
16 [email protected]
17 [email protected] "{"
18 [email protected] "}"
19 [email protected] "\n"
20 [email protected]
21 [email protected] "unsafe"
22 [email protected] " "
23 [email protected] "const"
24 [email protected] " "
25 [email protected]
26 [email protected] "fn"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "bar"
33 [email protected]
34 [email protected] "("
35 [email protected] ")"
36 [email protected] " "
37 [email protected]
38 [email protected] "{"
39 [email protected] "}"
40 [email protected] "\n"
41error 6..6: expected existential, fn, trait or impl
42error 38..38: expected a name
43error 40..40: expected COLON
44error 46..46: expected SEMICOLON
45error 47..47: expected an item
diff --git a/crates/syntax/test_data/parser/err/0045_item_modifiers.rs b/crates/syntax/test_data/parser/err/0045_item_modifiers.rs
new file mode 100644
index 000000000..731e58013
--- /dev/null
+++ b/crates/syntax/test_data/parser/err/0045_item_modifiers.rs
@@ -0,0 +1,2 @@
1unsafe async fn foo() {}
2unsafe const fn bar() {}
diff --git a/crates/syntax/test_data/parser/fragments/expr/err/0000_truncated_add.rast b/crates/syntax/test_data/parser/fragments/expr/err/0000_truncated_add.rast
new file mode 100644
index 000000000..5df7507e2
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/expr/err/0000_truncated_add.rast
@@ -0,0 +1 @@
ERROR
diff --git a/crates/syntax/test_data/parser/fragments/expr/err/0000_truncated_add.rs b/crates/syntax/test_data/parser/fragments/expr/err/0000_truncated_add.rs
new file mode 100644
index 000000000..ca49acb07
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/expr/err/0000_truncated_add.rs
@@ -0,0 +1 @@
1 +
diff --git a/crates/syntax/test_data/parser/fragments/expr/ok/0000_add.rast b/crates/syntax/test_data/parser/fragments/expr/ok/0000_add.rast
new file mode 100644
index 000000000..fa78a02a6
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/expr/ok/0000_add.rast
@@ -0,0 +1,8 @@
1[email protected]
2 [email protected]
3 [email protected] "1"
4 [email protected] " "
5 [email protected] "+"
6 [email protected] " "
7 [email protected]
8 [email protected] "2"
diff --git a/crates/syntax/test_data/parser/fragments/expr/ok/0000_add.rs b/crates/syntax/test_data/parser/fragments/expr/ok/0000_add.rs
new file mode 100644
index 000000000..e0ef58402
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/expr/ok/0000_add.rs
@@ -0,0 +1 @@
1 + 2
diff --git a/crates/syntax/test_data/parser/fragments/item/err/0000_extra_keyword.rast b/crates/syntax/test_data/parser/fragments/item/err/0000_extra_keyword.rast
new file mode 100644
index 000000000..5df7507e2
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/item/err/0000_extra_keyword.rast
@@ -0,0 +1 @@
ERROR
diff --git a/crates/syntax/test_data/parser/fragments/item/err/0000_extra_keyword.rs b/crates/syntax/test_data/parser/fragments/item/err/0000_extra_keyword.rs
new file mode 100644
index 000000000..dc32389bb
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/item/err/0000_extra_keyword.rs
@@ -0,0 +1 @@
fn fn foo() {}
diff --git a/crates/syntax/test_data/parser/fragments/item/ok/0000_fn.rast b/crates/syntax/test_data/parser/fragments/item/ok/0000_fn.rast
new file mode 100644
index 000000000..93c429e12
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/item/ok/0000_fn.rast
@@ -0,0 +1,12 @@
1[email protected]
2 [email protected] "fn"
3 [email protected] " "
4 [email protected]
5 [email protected] "foo"
6 [email protected]
7 [email protected] "("
8 [email protected] ")"
9 [email protected] " "
10 [email protected]
11 [email protected] "{"
12 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/fragments/item/ok/0000_fn.rs b/crates/syntax/test_data/parser/fragments/item/ok/0000_fn.rs
new file mode 100644
index 000000000..8f3b7ef11
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/item/ok/0000_fn.rs
@@ -0,0 +1 @@
fn foo() {}
diff --git a/crates/syntax/test_data/parser/fragments/path/err/0000_reserved_word.rast b/crates/syntax/test_data/parser/fragments/path/err/0000_reserved_word.rast
new file mode 100644
index 000000000..5df7507e2
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/path/err/0000_reserved_word.rast
@@ -0,0 +1 @@
ERROR
diff --git a/crates/syntax/test_data/parser/fragments/path/err/0000_reserved_word.rs b/crates/syntax/test_data/parser/fragments/path/err/0000_reserved_word.rs
new file mode 100644
index 000000000..2046de049
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/path/err/0000_reserved_word.rs
@@ -0,0 +1 @@
struct
diff --git a/crates/syntax/test_data/parser/fragments/path/err/0001_expression.rast b/crates/syntax/test_data/parser/fragments/path/err/0001_expression.rast
new file mode 100644
index 000000000..5df7507e2
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/path/err/0001_expression.rast
@@ -0,0 +1 @@
ERROR
diff --git a/crates/syntax/test_data/parser/fragments/path/err/0001_expression.rs b/crates/syntax/test_data/parser/fragments/path/err/0001_expression.rs
new file mode 100644
index 000000000..745e8d376
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/path/err/0001_expression.rs
@@ -0,0 +1 @@
a + b
diff --git a/crates/syntax/test_data/parser/fragments/path/ok/0000_single_ident.rast b/crates/syntax/test_data/parser/fragments/path/ok/0000_single_ident.rast
new file mode 100644
index 000000000..0c5d4360f
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/path/ok/0000_single_ident.rast
@@ -0,0 +1,4 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "foo"
diff --git a/crates/syntax/test_data/parser/fragments/path/ok/0000_single_ident.rs b/crates/syntax/test_data/parser/fragments/path/ok/0000_single_ident.rs
new file mode 100644
index 000000000..257cc5642
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/path/ok/0000_single_ident.rs
@@ -0,0 +1 @@
foo
diff --git a/crates/syntax/test_data/parser/fragments/path/ok/0001_multipart.rast b/crates/syntax/test_data/parser/fragments/path/ok/0001_multipart.rast
new file mode 100644
index 000000000..4a2b45e6a
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/path/ok/0001_multipart.rast
@@ -0,0 +1,14 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected]
5 [email protected]
6 [email protected] "foo"
7 [email protected] "::"
8 [email protected]
9 [email protected]
10 [email protected] "bar"
11 [email protected] "::"
12 [email protected]
13 [email protected]
14 [email protected] "baz"
diff --git a/crates/syntax/test_data/parser/fragments/path/ok/0001_multipart.rs b/crates/syntax/test_data/parser/fragments/path/ok/0001_multipart.rs
new file mode 100644
index 000000000..81e0b21cd
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/path/ok/0001_multipart.rs
@@ -0,0 +1 @@
foo::bar::baz
diff --git a/crates/syntax/test_data/parser/fragments/pattern/err/0000_reserved_word.rast b/crates/syntax/test_data/parser/fragments/pattern/err/0000_reserved_word.rast
new file mode 100644
index 000000000..5df7507e2
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/pattern/err/0000_reserved_word.rast
@@ -0,0 +1 @@
ERROR
diff --git a/crates/syntax/test_data/parser/fragments/pattern/err/0000_reserved_word.rs b/crates/syntax/test_data/parser/fragments/pattern/err/0000_reserved_word.rs
new file mode 100644
index 000000000..ae26fc455
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/pattern/err/0000_reserved_word.rs
@@ -0,0 +1 @@
fn
diff --git a/crates/syntax/test_data/parser/fragments/pattern/err/0001_missing_paren.rast b/crates/syntax/test_data/parser/fragments/pattern/err/0001_missing_paren.rast
new file mode 100644
index 000000000..5df7507e2
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/pattern/err/0001_missing_paren.rast
@@ -0,0 +1 @@
ERROR
diff --git a/crates/syntax/test_data/parser/fragments/pattern/err/0001_missing_paren.rs b/crates/syntax/test_data/parser/fragments/pattern/err/0001_missing_paren.rs
new file mode 100644
index 000000000..61a391d08
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/pattern/err/0001_missing_paren.rs
@@ -0,0 +1 @@
Some(x
diff --git a/crates/syntax/test_data/parser/fragments/pattern/ok/0000_enum.rast b/crates/syntax/test_data/parser/fragments/pattern/ok/0000_enum.rast
new file mode 100644
index 000000000..dcf102339
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/pattern/ok/0000_enum.rast
@@ -0,0 +1,10 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected]
5 [email protected] "Some"
6 [email protected] "("
7 [email protected]
8 [email protected]
9 [email protected] "x"
10 [email protected] ")"
diff --git a/crates/syntax/test_data/parser/fragments/pattern/ok/0000_enum.rs b/crates/syntax/test_data/parser/fragments/pattern/ok/0000_enum.rs
new file mode 100644
index 000000000..87114dd78
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/pattern/ok/0000_enum.rs
@@ -0,0 +1 @@
Some(x)
diff --git a/crates/syntax/test_data/parser/fragments/type/err/0000_missing_close.rast b/crates/syntax/test_data/parser/fragments/type/err/0000_missing_close.rast
new file mode 100644
index 000000000..5df7507e2
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/type/err/0000_missing_close.rast
@@ -0,0 +1 @@
ERROR
diff --git a/crates/syntax/test_data/parser/fragments/type/err/0000_missing_close.rs b/crates/syntax/test_data/parser/fragments/type/err/0000_missing_close.rs
new file mode 100644
index 000000000..caa4d7c09
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/type/err/0000_missing_close.rs
@@ -0,0 +1 @@
Result<Foo, Bar
diff --git a/crates/syntax/test_data/parser/fragments/type/ok/0000_result.rast b/crates/syntax/test_data/parser/fragments/type/ok/0000_result.rast
new file mode 100644
index 000000000..38c15b581
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/type/ok/0000_result.rast
@@ -0,0 +1,22 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected]
5 [email protected] "Result"
6 [email protected]
7 [email protected] "<"
8 [email protected]
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected] "Foo"
14 [email protected] ","
15 [email protected] " "
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "Bar"
22 [email protected] ">"
diff --git a/crates/syntax/test_data/parser/fragments/type/ok/0000_result.rs b/crates/syntax/test_data/parser/fragments/type/ok/0000_result.rs
new file mode 100644
index 000000000..b50b3bb3b
--- /dev/null
+++ b/crates/syntax/test_data/parser/fragments/type/ok/0000_result.rs
@@ -0,0 +1 @@
Result<Foo, Bar>
diff --git a/crates/syntax/test_data/parser/fuzz-failures/0000.rs b/crates/syntax/test_data/parser/fuzz-failures/0000.rs
new file mode 100644
index 000000000..f1d0dc343
--- /dev/null
+++ b/crates/syntax/test_data/parser/fuzz-failures/0000.rs
@@ -0,0 +1,199 @@
1//! An experimental implementation of [Rust RFC#2256 lrs);
2 let root = SyntaxNode::new_owned(root);
3 validate_block_structure(root.borrowed());
4 File { root }
5 }
6 pub fn parse(text: &str) -> File {
7 let tokens = tokenize(&text);
8 let (green, errors) = parser_impl::parse_with::<syntax_node::GreenBuilder>(
9 text, &tokens, grammar::root,
10 );
11 File::new(green, errors)
12 }
13 pub fn reparse(&self, edit: &AtomTextEdit) -> File {
14 self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit))
15 }
16 pub fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option<File> {
17 let (node, reparser) = find_reparsable_node(self.syntax(), edit.delete)?;
18 let text = replace_range(
19 node.text().to_string(),
20 edit.delete - node.range().start(),
21 &edit.insert,
22 );
23 let tokens = tokenize(&text);
24 if !is_balanced(&tokens) {
25 return None;
26 }
27 let (green, new_errors) = parser_impl::parse_with::<syntax_node::GreenBuilder>(
28 &te2t, &tokens, reparser,
29 );
30 let green_root = node.replace_with(green);
31 let errors = merge_errors(self.errors(), new_errors, node, edit);
32 Some(File::new(green_root, errors))
33 }
34 fn full_reparse(&self, edit: &AtomTextEdit) -> File {
35 let text = replace_range(self.syntax().text().to_string(), edit.delete, &edit.insert);
36 File::parse(&text)
37 }
38 pub fn ast(&self) -> ast::Root {
39 ast::Root::cast(self.syntax()).unwrap()
40 }
41 pub fn syntax(&self) -> SyntaxNodeRef {
42 self.root.brroowed()
43 }
44 mp_tree(root),
45 );
46 assert!(
47 node.next_sibling().is_none() && pair.prev_sibling().is_none(),
48 "\nfloating curlys at {:?}\nfile:\n{}\nerror:\n{}\n",
49 node,
50 root.text(),
51 node.text(),
52 );
53 }
54 }
55 _ => (),
56 }
57 }
58}
59
60#[derive(Debug, Clone)]
61pub struct AtomTextEdit {
62 pub delete: TextRange,
63 pub insert: String,
64}
65
66impl AtomTextEdit {
67 pub fn replace(range: TextRange, replace_with: String) -> AtomTextEdit {
68 AtomTextEdit { delete: range, insert: replace_with }
69 }
70
71 pub fn delete(range: TextRange) -> AtomTextEdit {
72 AtomTextEdit::replace(range, String::new())
73 }
74
75 pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit {
76 AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text)
77 }
78}
79
80fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(SyntaxNodeRef, fn(&mut Parser))> {
81 let node = algo::find_covering_node(node, range);
82 return algo::ancestors(node)
83 .filter_map(|node| reparser(node).map(|r| (node, r)))
84 .next();
85
86 fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> {
87 let res = match node.kind() {
88 BLOCK => grammar::block,
89 RECORD_FIELD_LIST => grammar::record_field_list,
90 _ => return None,
91 };
92 Some(res)
93 }
94}
95
96pub /*(meh)*/ fn replace_range(mut text: String, range: TextRange, replace_with: &str) -> String {
97 let start = u32::from(range.start()) as usize;
98 let end = u32::from(range.end()) as usize;
99 text.replace_range(start..end, replace_with);
100 text
101}
102
103fn is_balanced(tokens: &[Token]) -> bool {
104 if tokens.len() == 0
105 || tokens.first().unwrap().kind != L_CURLY
106 || tokens.last().unwrap().kind != R_CURLY {
107 return false
108 }
109 let mut balance = 0usize;
110 for t in tokens.iter() {
111 match t.kind {
112 L_CURLYt {
113 pub delete: TextRange,
114 pub insert: String,
115}
116
117impl AtomTextEdit {
118 pub fn replace(range: TextRange, replace_with: String) -> AtomTextEdit {
119 AtomTextEdit { delete: range, insert: replace_with }
120 }
121
122 pub fn delete(range: TextRange) -> AtomTextEdit {
123 AtomTextEdit::replace(range, String::new())
124 }
125
126 pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit {
127 AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text)
128 }
129}
130
131fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(SyntaxNodeRef, fn(&mut Parser))> {
132 let node = algo::find_covering_node(node, range);
133 return algo::ancestors(node)
134 .filter_map(|node| reparser(node).map(|r| (node, r)))
135 .next();
136
137 fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> {
138 let res = match node.kind() {
139 ;
140 let end = u32::from(range.end()) as usize;
141 text.replaT => grammar::record_field_list,
142 _ => return None,
143 };
144 Some(res)
145 }
146}
147
148pub /*(meh)*/ fn replace_range(mut text: String, range: TextRange, replace_with: &str) -> String {
149 let start = u32::from(range.start()) as usize;
150 let end = u32::from(range.end()) as usize;
151 text.replace_range(start..end, replace_with);
152 text
153}
154
155fn is_balanced(tokens: &[Token]) -> bool {
156 if tokens.len() == 0
157 || tokens.first().unwrap().kind != L_CURLY
158 || tokens.last().unwrap().kind != R_CURLY {
159 return false
160 }
161 let mut balance = 0usize;
162 for t in tokens.iter() {
163 match t.kind {
164 L_CURLY => balance += 1,
165 R_CURLY => balance = match balance.checked_sub(1) {
166 Some(b) => b,
167 None => return false,
168 },
169 _ => (),
170 }
171 }
172 balance == 0
173}
174
175fn merge_errors(
176 old_errors: Vec<SyntaxError>,
177 new_errors: Vec<SyntaxError>,
178 old_node: SyntaxNodeRef,
179 edit: &AtomTextEdit,
180) -> Vec<SyntaxError> {
181 let mut res = Vec::new();
182 for e in old_errors {
183 if e.offset < old_node.range().start() {
184 res.push(e)
185 } else if e.offset > old_node.range().end() {
186 res.push(SyntaxError {
187 msg: e.msg,
188 offset: e.offset + TextUnit::of_str(&edit.insert) - edit.delete.len(),
189 })
190 }
191 }
192 for e in new_errors {
193 res.push(SyntaxError {
194 msg: e.msg,
195 offset: e.offset + old_node.range().start(),
196 })
197 }
198 res
199}
diff --git a/crates/syntax/test_data/parser/fuzz-failures/0001.rs b/crates/syntax/test_data/parser/fuzz-failures/0001.rs
new file mode 100644
index 000000000..f1148058e
--- /dev/null
+++ b/crates/syntax/test_data/parser/fuzz-failures/0001.rs
@@ -0,0 +1,106 @@
1use syntax::{
2 File, TextRange, SyntaxNodeRef, TextUnit,
3 SyntaxKind::*,
4 algo::{find_leaf_at_offset, LeafAtOffset, find_covering_node, ancestors, Direction, siblings},
5};
6
7pub fn extend_selection(file: &File, range: TextRange) -> Option<TextRange> {
8 let syntax = file.syntax();
9 extend(syntax.borrowed(), range)
10}
11
12pub(crate) fn extend(root: SyntaxNodeRef, range: TextRange) -> Option<TextRange> {
13 if range.is_empty() {
14 let offset = range.start();
15 let mut leaves = find_leaf_at_offset(root, offset);
16 if leaves.clone().all(|it| it.kind() == WHITESPACE) {
17 return Some(extend_ws(root, leaves.next()?, offset));
18 }
19 let leaf = match leaves {
20 LeafAtOffset::None => return None,
21 LeafAtOffset::Single(l) => l,
22 LeafAtOffset::Between(l, r) => pick_best(l, r),
23 };
24 return Some(leaf.range());
25 };
26 let node = find_covering_node(root, range);
27 if node.kind() == COMMENT && range == node.range() {
28 if let Some(range) = extend_comments(node) {
29 return Some(range);
30 }
31 }
32
33 match ancestors(node).skip_while(|n| n.range() == range).next() {
34 None => None,
35 Some(parent) => Some(parent.range()),
36 }
37}
38
39fn extend_ws(root: SyntaxNodeRef, ws: SyntaxNodeRef, offset: TextUnit) -> TextRange {
40 let ws_text = ws.leaf_text().unwrap();
41 let suffix = TextRange::from_to(offset, ws.range().end()) - ws.range().start();
42 let prefix = TextRange::from_to(ws.range().start(), offset) - ws.range().start();
43 let ws_suffix = &ws_text.as_str()[suffix];
44 let ws_prefix = &ws_text.as_str()[prefix];
45 if ws_text.contains("\n") && !ws_suffix.contains("\n") {
46 if let Some(node) = ws.next_sibling() {
47 let start = match ws_prefix.rfind('\n') {
48 Some(idx) => ws.range().start() + TextUnit::from((idx + 1) as u32),
49 None => node.range().start()
50 };
51 let end = if root.text().char_at(node.range().end()) == Some('\n') {
52 node.range().end() + TextUnit::of_char('\n')
53 } else {
54 node.range().end()
55 };
56 return TextRange::from_to(start, end);
57 }
58 }
59 ws.range()
60}
61
62fn pick_best<'a>(l: SyntaxNodeRef<'a>, r: Syntd[axNodeRef<'a>) -> SyntaxNodeRef<'a> {
63 return if priority(r) > priority(l) { r } else { l };
64 fn priority(n: SyntaxNodeRef) -> usize {
65 match n.kind() {
66 WHITESPACE => 0,
67 IDENT | SELF_KW | SUPER_KW | CRATE_KW => 2,
68 _ => 1,
69 }
70 }
71}
72
73fn extend_comments(node: SyntaxNodeRef) -> Option<TextRange> {
74 let left = adj_com[ments(node, Direction::Backward);
75 let right = adj_comments(node, Direction::Forward);
76 if left != right {
77 Some(TextRange::from_to(
78 left.range().start(),
79 right.range().end(),
80 ))
81 } else {
82 None
83 }
84}
85
86fn adj_comments(node: SyntaxNodeRef, dir: Direction) -> SyntaxNodeRef {
87 let mut res = node;
88 for node in siblings(node, dir) {
89 match node.kind() {
90 COMMENT => res = node,
91 WHITESPACE if !node.leaf_text().unwrap().as_str().contains("\n\n") => (),
92 _ => break
93 }
94 }
95 res
96}
97
98#[cfg(test)]
99mod tests {
100 use super::*;
101 use test_utils::extract_offset;
102
103 fn do_check(before: &str, afters: &[&str]) {
104 let (cursor, before) = extract_offset(before);
105 let file = File::parse(&before);
106 let mut range = TextRange::of
diff --git a/crates/syntax/test_data/parser/fuzz-failures/0002.rs b/crates/syntax/test_data/parser/fuzz-failures/0002.rs
new file mode 100644
index 000000000..f35dc7289
--- /dev/null
+++ b/crates/syntax/test_data/parser/fuzz-failures/0002.rs
@@ -0,0 +1 @@
!('\ \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/fuzz-failures/0003.rs b/crates/syntax/test_data/parser/fuzz-failures/0003.rs
new file mode 100644
index 000000000..0f59c4722
--- /dev/null
+++ b/crates/syntax/test_data/parser/fuzz-failures/0003.rs
@@ -0,0 +1 @@
if'\xɿ \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/fuzz-failures/0004.rs b/crates/syntax/test_data/parser/fuzz-failures/0004.rs
new file mode 100644
index 000000000..003290f52
--- /dev/null
+++ b/crates/syntax/test_data/parser/fuzz-failures/0004.rs
@@ -0,0 +1 @@
b"\xʿ \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast b/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast
new file mode 100644
index 000000000..0b9bbec07
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast
@@ -0,0 +1,27 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "["
12 [email protected]
13 [email protected] "("
14 [email protected] ")"
15 [email protected] " "
16 [email protected]
17 [email protected] "92"
18 [email protected]
19 [email protected] "]"
20 [email protected]
21 [email protected] ";"
22 [email protected] "\n"
23error 12..12: expected `;` or `]`
24error 12..12: expected SEMICOLON
25error 13..13: expected an item
26error 15..15: expected an item
27error 16..16: expected an item
diff --git a/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs b/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs
new file mode 100644
index 000000000..a94851443
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs
@@ -0,0 +1 @@
type T = [() 92];
diff --git a/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
new file mode 100644
index 000000000..a4271fc87
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
@@ -0,0 +1,28 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "\'loop"
18 [email protected] ":"
19 [email protected] " "
20 [email protected]
21 [email protected] "impl"
22 [email protected] "\n"
23 [email protected] "}"
24 [email protected] "\n"
25error 22..22: expected a loop
26error 22..22: expected SEMICOLON
27error 27..27: expected type
28error 27..27: expected `{`
diff --git a/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs
new file mode 100644
index 000000000..a2164c510
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs
@@ -0,0 +1,3 @@
1fn main() {
2 'loop: impl
3}
diff --git a/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast b/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast
new file mode 100644
index 000000000..0d8bf6dd6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast
@@ -0,0 +1,17 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "*"
12 [email protected]
13 [email protected] "("
14 [email protected] ")"
15 [email protected] ";"
16 [email protected] "\n"
17error 10..10: expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate)
diff --git a/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs b/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs
new file mode 100644
index 000000000..fae705131
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs
@@ -0,0 +1 @@
type T = *();
diff --git a/crates/syntax/test_data/parser/inline/err/0004_impl_type.rast b/crates/syntax/test_data/parser/inline/err/0004_impl_type.rast
new file mode 100644
index 000000000..29d6b3974
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0004_impl_type.rast
@@ -0,0 +1,79 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "Type"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "}"
14 [email protected] "\n"
15 [email protected]
16 [email protected] "impl"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "Trait1"
23 [email protected] " "
24 [email protected] "for"
25 [email protected] " "
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "T"
31 [email protected] " "
32 [email protected]
33 [email protected] "{"
34 [email protected] "}"
35 [email protected] "\n"
36 [email protected]
37 [email protected] "impl"
38 [email protected] " "
39 [email protected]
40 [email protected] "impl"
41 [email protected] " "
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected] "NotType"
47 [email protected] " "
48 [email protected]
49 [email protected] "{"
50 [email protected] "}"
51 [email protected] "\n"
52 [email protected]
53 [email protected] "impl"
54 [email protected] " "
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected] "Trait2"
60 [email protected] " "
61 [email protected] "for"
62 [email protected] " "
63 [email protected]
64 [email protected] "impl"
65 [email protected] " "
66 [email protected]
67 [email protected]
68 [email protected]
69 [email protected]
70 [email protected] "NotType"
71 [email protected] " "
72 [email protected]
73 [email protected] "{"
74 [email protected] "}"
75 [email protected] "\n"
76error 38..38: expected trait or type
77error 38..38: expected `{`
78error 70..70: expected trait or type
79error 70..70: expected `{`
diff --git a/crates/syntax/test_data/parser/inline/err/0004_impl_type.rs b/crates/syntax/test_data/parser/inline/err/0004_impl_type.rs
new file mode 100644
index 000000000..b8c7b65e3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0004_impl_type.rs
@@ -0,0 +1,4 @@
1impl Type {}
2impl Trait1 for T {}
3impl impl NotType {}
4impl Trait2 for impl NotType {}
diff --git a/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast b/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast
new file mode 100644
index 000000000..776022fd9
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast
@@ -0,0 +1,23 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "F"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected] "unsafe"
11 [email protected] " "
12 [email protected]
13 [email protected] "("
14 [email protected]
15 [email protected] ")"
16 [email protected]
17 [email protected] ";"
18 [email protected] "\n"
19error 15..15: expected `fn`
20error 15..15: expected SEMICOLON
21error 16..16: expected an item
22error 17..17: expected an item
23error 18..18: expected an item
diff --git a/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs b/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs
new file mode 100644
index 000000000..f014914ff
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs
@@ -0,0 +1 @@
type F = unsafe ();
diff --git a/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast b/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast
new file mode 100644
index 000000000..cc0f8bcaf
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast
@@ -0,0 +1,35 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected]
11 [email protected] "{"
12 [email protected] "}"
13 [email protected] " "
14 [email protected]
15 [email protected] "unsafe"
16 [email protected] " "
17 [email protected]
18 [email protected] "{"
19 [email protected] " "
20 [email protected] "}"
21 [email protected] " "
22 [email protected]
23 [email protected] "fn"
24 [email protected] " "
25 [email protected]
26 [email protected] "bar"
27 [email protected]
28 [email protected] "("
29 [email protected] ")"
30 [email protected]
31 [email protected] "{"
32 [email protected] "}"
33 [email protected] "\n"
34error 11..11: expected an item
35error 18..18: expected an item
diff --git a/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs b/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs
new file mode 100644
index 000000000..26141e904
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs
@@ -0,0 +1 @@
fn foo(){} unsafe { } fn bar(){}
diff --git a/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast b/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast
new file mode 100644
index 000000000..2c9570678
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast
@@ -0,0 +1,31 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "_"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected] "async"
24 [email protected] " "
25 [email protected]
26 [email protected] "{"
27 [email protected] "}"
28 [email protected] " "
29 [email protected] "}"
30 [email protected] "\n"
31error 27..27: expected SEMICOLON
diff --git a/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs b/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs
new file mode 100644
index 000000000..9a423248c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs
@@ -0,0 +1 @@
fn foo() { let _ = async {} }
diff --git a/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rast b/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rast
new file mode 100644
index 000000000..63a10127d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rast
@@ -0,0 +1,25 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected] "pub"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected] "92"
21 [email protected] ";"
22 [email protected] " "
23 [email protected] "}"
24 [email protected] "\n"
25error 14..14: expected an item
diff --git a/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rs b/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rs
new file mode 100644
index 000000000..2976f6862
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rs
@@ -0,0 +1 @@
fn foo() { pub 92; }
diff --git a/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast b/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast
new file mode 100644
index 000000000..8fd8d5e59
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast
@@ -0,0 +1,58 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "#"
17 [email protected] "["
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "A"
22 [email protected] "]"
23 [email protected] " "
24 [email protected]
25 [email protected]
26 [email protected] "1"
27 [email protected] " "
28 [email protected] "+"
29 [email protected] " "
30 [email protected]
31 [email protected] "2"
32 [email protected] ";"
33 [email protected] "\n "
34 [email protected]
35 [email protected]
36 [email protected] "#"
37 [email protected] "["
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "B"
42 [email protected] "]"
43 [email protected] " "
44 [email protected]
45 [email protected] "if"
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected] "true"
50 [email protected] " "
51 [email protected]
52 [email protected] "{"
53 [email protected] "}"
54 [email protected] ";"
55 [email protected] "\n"
56 [email protected] "}"
57 [email protected] "\n"
58error 24..24: attributes are not allowed on BIN_EXPR
diff --git a/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs b/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs
new file mode 100644
index 000000000..d725a07ce
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs
@@ -0,0 +1,4 @@
1fn foo() {
2 #[A] 1 + 2;
3 #[B] if true {};
4}
diff --git a/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast b/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast
new file mode 100644
index 000000000..fa14e1e6d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast
@@ -0,0 +1,52 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "x"
21 [email protected] "."
22 [email protected] "0."
23 [email protected] ";"
24 [email protected] "\n "
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "x"
32 [email protected] "."
33 [email protected]
34 [email protected] "1i32"
35 [email protected] ";"
36 [email protected] "\n "
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected]
43 [email protected] "x"
44 [email protected] "."
45 [email protected]
46 [email protected] "0x01"
47 [email protected] ";"
48 [email protected] "\n"
49 [email protected] "}"
50 [email protected] "\n"
51error 27..31: Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix
52error 39..43: Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix
diff --git a/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs b/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs
new file mode 100644
index 000000000..30cc49138
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 x.0.;
3 x.1i32;
4 x.0x01;
5}
diff --git a/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rast b/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rast
new file mode 100644
index 000000000..8d761b907
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rast
@@ -0,0 +1,21 @@
1[email protected]
2 [email protected]
3 [email protected] "static"
4 [email protected] " "
5 [email protected]
6 [email protected] "_"
7 [email protected] ":"
8 [email protected] " "
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected] "i32"
14 [email protected] " "
15 [email protected] "="
16 [email protected] " "
17 [email protected]
18 [email protected] "5"
19 [email protected] ";"
20 [email protected] "\n"
21error 7..7: expected a name
diff --git a/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rs b/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rs
new file mode 100644
index 000000000..df8cecb43
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rs
@@ -0,0 +1 @@
static _: i32 = 5;
diff --git a/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast b/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast
new file mode 100644
index 000000000..a81c442c0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast
@@ -0,0 +1,48 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "S"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected] "field"
26 [email protected] " "
27 [email protected]
28 [email protected] ".."
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected] "S"
36 [email protected] "::"
37 [email protected]
38 [email protected]
39 [email protected] "default"
40 [email protected]
41 [email protected] "("
42 [email protected] ")"
43 [email protected] " "
44 [email protected] "}"
45 [email protected] "\n"
46 [email protected] "}"
47 [email protected] "\n"
48error 25..25: expected COLON
diff --git a/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs b/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs
new file mode 100644
index 000000000..a4e5b2f69
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs
@@ -0,0 +1,3 @@
1fn main() {
2 S { field ..S::default() }
3}
diff --git a/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast
new file mode 100644
index 000000000..e872526d9
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast
@@ -0,0 +1,13 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "crate"
10 [email protected] "::"
11 [email protected] ";"
12 [email protected] "\n"
13error 11..11: expected identifier
diff --git a/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rs b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rs
new file mode 100644
index 000000000..7510664e1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rs
@@ -0,0 +1 @@
use crate::;
diff --git a/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast b/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast
new file mode 100644
index 000000000..1e80dd7e2
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast
@@ -0,0 +1,136 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected] "{"
8 [email protected]
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected] "crate"
15 [email protected] "::"
16 [email protected]
17 [email protected]
18 [email protected] "path"
19 [email protected] "::"
20 [email protected]
21 [email protected]
22 [email protected] "from"
23 [email protected] "::"
24 [email protected]
25 [email protected]
26 [email protected] "root"
27 [email protected] ","
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected] "or"
37 [email protected] "::"
38 [email protected]
39 [email protected]
40 [email protected] "path"
41 [email protected] "::"
42 [email protected]
43 [email protected]
44 [email protected] "from"
45 [email protected] "::"
46 [email protected]
47 [email protected]
48 [email protected] "crate_name"
49 [email protected] "}"
50 [email protected] ";"
51 [email protected] " "
52 [email protected] "// Rust 2018 (with a ..."
53 [email protected] "\n"
54 [email protected]
55 [email protected] "use"
56 [email protected] " "
57 [email protected]
58 [email protected]
59 [email protected] "{"
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected]
64 [email protected]
65 [email protected]
66 [email protected] "path"
67 [email protected] "::"
68 [email protected]
69 [email protected]
70 [email protected] "from"
71 [email protected] "::"
72 [email protected]
73 [email protected]
74 [email protected] "root"
75 [email protected] "}"
76 [email protected] ";"
77 [email protected] " "
78 [email protected] "// Rust 2015"
79 [email protected] "\n"
80 [email protected]
81 [email protected] "use"
82 [email protected] " "
83 [email protected]
84 [email protected] "::"
85 [email protected]
86 [email protected] "{"
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected]
92 [email protected]
93 [email protected] "some"
94 [email protected] "::"
95 [email protected]
96 [email protected]
97 [email protected] "arbritrary"
98 [email protected] "::"
99 [email protected]
100 [email protected]
101 [email protected] "path"
102 [email protected] "}"
103 [email protected] ";"
104 [email protected] " "
105 [email protected] "// Rust 2015"
106 [email protected] "\n"
107 [email protected]
108 [email protected] "use"
109 [email protected] " "
110 [email protected]
111 [email protected] "::"
112 [email protected]
113 [email protected] "{"
114 [email protected]
115 [email protected]
116 [email protected] "{"
117 [email protected]
118 [email protected]
119 [email protected] "{"
120 [email protected]
121 [email protected]
122 [email protected]
123 [email protected]
124 [email protected]
125 [email protected] "root"
126 [email protected] "::"
127 [email protected]
128 [email protected]
129 [email protected] "export"
130 [email protected] "}"
131 [email protected] "}"
132 [email protected] "}"
133 [email protected] ";"
134 [email protected] " "
135 [email protected] "// Nonsensical but pe ..."
136 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rs b/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rs
new file mode 100644
index 000000000..381cba1e2
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rs
@@ -0,0 +1,4 @@
1use {crate::path::from::root, or::path::from::crate_name}; // Rust 2018 (with a crate named `or`)
2use {path::from::root}; // Rust 2015
3use ::{some::arbritrary::path}; // Rust 2015
4use ::{{{root::export}}}; // Nonsensical but perfectly legal nesting
diff --git a/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast b/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast
new file mode 100644
index 000000000..62da7b887
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast
@@ -0,0 +1,60 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "for_trait"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "F"
12 [email protected] ">"
13 [email protected]
14 [email protected] "("
15 [email protected] ")"
16 [email protected] "\n"
17 [email protected]
18 [email protected] "where"
19 [email protected] "\n "
20 [email protected]
21 [email protected] "for"
22 [email protected]
23 [email protected] "<"
24 [email protected]
25 [email protected] "\'a"
26 [email protected] ">"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "F"
33 [email protected] ":"
34 [email protected] " "
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "Fn"
42 [email protected]
43 [email protected] "("
44 [email protected]
45 [email protected]
46 [email protected] "&"
47 [email protected] "\'a"
48 [email protected] " "
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected] "str"
54 [email protected] ")"
55 [email protected] "\n"
56 [email protected]
57 [email protected] "{"
58 [email protected] " "
59 [email protected] "}"
60 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rs b/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rs
new file mode 100644
index 000000000..423bc105b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rs
@@ -0,0 +1,4 @@
1fn for_trait<F>()
2where
3 for<'a> F: Fn(&'a str)
4{ }
diff --git a/crates/syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast b/crates/syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast
new file mode 100644
index 000000000..b650735ba
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast
@@ -0,0 +1,60 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "F"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected] "Box"
15 [email protected]
16 [email protected] "<"
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "Fn"
23 [email protected]
24 [email protected] "("
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "i32"
31 [email protected] ","
32 [email protected] " "
33 [email protected]
34 [email protected]
35 [email protected] "&"
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected] "i32"
41 [email protected] ","
42 [email protected] " "
43 [email protected]
44 [email protected]
45 [email protected] "&"
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected] "i32"
51 [email protected] ","
52 [email protected] " "
53 [email protected]
54 [email protected]
55 [email protected] "("
56 [email protected] ")"
57 [email protected] ")"
58 [email protected] ">"
59 [email protected] ";"
60 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rs b/crates/syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rs
new file mode 100644
index 000000000..93636e926
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rs
@@ -0,0 +1 @@
type F = Box<Fn(i32, &i32, &i32, ())>;
diff --git a/crates/syntax/test_data/parser/inline/ok/0005_function_type_params.rast b/crates/syntax/test_data/parser/inline/ok/0005_function_type_params.rast
new file mode 100644
index 000000000..8e0252ce7
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0005_function_type_params.rast
@@ -0,0 +1,37 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ":"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "Clone"
21 [email protected] " "
22 [email protected] "+"
23 [email protected] " "
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "Copy"
30 [email protected] ">"
31 [email protected]
32 [email protected] "("
33 [email protected] ")"
34 [email protected]
35 [email protected] "{"
36 [email protected] "}"
37 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0005_function_type_params.rs b/crates/syntax/test_data/parser/inline/ok/0005_function_type_params.rs
new file mode 100644
index 000000000..9df40ed39
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0005_function_type_params.rs
@@ -0,0 +1 @@
fn foo<T: Clone + Copy>(){}
diff --git a/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast
new file mode 100644
index 000000000..d24ad7423
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast
@@ -0,0 +1,116 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "S"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "fn"
16 [email protected] " "
17 [email protected]
18 [email protected] "a"
19 [email protected]
20 [email protected] "("
21 [email protected]
22 [email protected] "self"
23 [email protected] ")"
24 [email protected] " "
25 [email protected]
26 [email protected] "{"
27 [email protected] "}"
28 [email protected] "\n "
29 [email protected]
30 [email protected] "fn"
31 [email protected] " "
32 [email protected]
33 [email protected] "b"
34 [email protected]
35 [email protected] "("
36 [email protected]
37 [email protected] "&"
38 [email protected] "self"
39 [email protected] ","
40 [email protected] ")"
41 [email protected] " "
42 [email protected]
43 [email protected] "{"
44 [email protected] "}"
45 [email protected] "\n "
46 [email protected]
47 [email protected] "fn"
48 [email protected] " "
49 [email protected]
50 [email protected] "c"
51 [email protected]
52 [email protected] "("
53 [email protected]
54 [email protected] "&"
55 [email protected] "\'a"
56 [email protected] " "
57 [email protected] "self"
58 [email protected] ","
59 [email protected] ")"
60 [email protected] " "
61 [email protected]
62 [email protected] "{"
63 [email protected] "}"
64 [email protected] "\n "
65 [email protected]
66 [email protected] "fn"
67 [email protected] " "
68 [email protected]
69 [email protected] "d"
70 [email protected]
71 [email protected] "("
72 [email protected]
73 [email protected] "&"
74 [email protected] "\'a"
75 [email protected] " "
76 [email protected] "mut"
77 [email protected] " "
78 [email protected] "self"
79 [email protected] ","
80 [email protected] " "
81 [email protected]
82 [email protected]
83 [email protected]
84 [email protected] "x"
85 [email protected] ":"
86 [email protected] " "
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected] "i32"
92 [email protected] ")"
93 [email protected] " "
94 [email protected]
95 [email protected] "{"
96 [email protected] "}"
97 [email protected] "\n "
98 [email protected]
99 [email protected] "fn"
100 [email protected] " "
101 [email protected]
102 [email protected] "e"
103 [email protected]
104 [email protected] "("
105 [email protected]
106 [email protected] "mut"
107 [email protected] " "
108 [email protected] "self"
109 [email protected] ")"
110 [email protected] " "
111 [email protected]
112 [email protected] "{"
113 [email protected] "}"
114 [email protected] "\n"
115 [email protected] "}"
116 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0006_self_param.rs b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rs
new file mode 100644
index 000000000..80c0a43f5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rs
@@ -0,0 +1,7 @@
1impl S {
2 fn a(self) {}
3 fn b(&self,) {}
4 fn c(&'a self,) {}
5 fn d(&'a mut self, x: i32) {}
6 fn e(mut self) {}
7}
diff --git a/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast b/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
new file mode 100644
index 000000000..e95688f56
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
@@ -0,0 +1,40 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ":"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected] "\'a"
17 [email protected] " "
18 [email protected] "+"
19 [email protected] " "
20 [email protected]
21 [email protected] "?"
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected] "Sized"
27 [email protected] " "
28 [email protected] "+"
29 [email protected] " "
30 [email protected]
31 [email protected] "("
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected] "Copy"
37 [email protected] ")"
38 [email protected] ">"
39 [email protected] ";"
40 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rs b/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rs
new file mode 100644
index 000000000..919bde0ee
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rs
@@ -0,0 +1 @@
struct S<T: 'a + ?Sized + (Copy)>;
diff --git a/crates/syntax/test_data/parser/inline/ok/0008_path_part.rast b/crates/syntax/test_data/parser/inline/ok/0008_path_part.rast
new file mode 100644
index 000000000..7d2f7eab0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0008_path_part.rast
@@ -0,0 +1,96 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "foo"
23 [email protected] "::"
24 [email protected]
25 [email protected]
26 [email protected] "Bar"
27 [email protected] " "
28 [email protected] "="
29 [email protected] " "
30 [email protected]
31 [email protected] "("
32 [email protected] ")"
33 [email protected] ";"
34 [email protected] "\n "
35 [email protected]
36 [email protected] "let"
37 [email protected] " "
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "::"
42 [email protected]
43 [email protected] "Bar"
44 [email protected] " "
45 [email protected] "="
46 [email protected] " "
47 [email protected]
48 [email protected] "("
49 [email protected] ")"
50 [email protected] ";"
51 [email protected] "\n "
52 [email protected]
53 [email protected] "let"
54 [email protected] " "
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected] "Bar"
60 [email protected] " "
61 [email protected]
62 [email protected] "{"
63 [email protected] " "
64 [email protected] ".."
65 [email protected] " "
66 [email protected] "}"
67 [email protected] " "
68 [email protected] "="
69 [email protected] " "
70 [email protected]
71 [email protected] "("
72 [email protected] ")"
73 [email protected] ";"
74 [email protected] "\n "
75 [email protected]
76 [email protected] "let"
77 [email protected] " "
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected] "Bar"
83 [email protected] "("
84 [email protected]
85 [email protected] ".."
86 [email protected] ")"
87 [email protected] " "
88 [email protected] "="
89 [email protected] " "
90 [email protected]
91 [email protected] "("
92 [email protected] ")"
93 [email protected] ";"
94 [email protected] "\n"
95 [email protected] "}"
96 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0008_path_part.rs b/crates/syntax/test_data/parser/inline/ok/0008_path_part.rs
new file mode 100644
index 000000000..f6e32c7c1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0008_path_part.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 let foo::Bar = ();
3 let ::Bar = ();
4 let Bar { .. } = ();
5 let Bar(..) = ();
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0009_loop_expr.rast b/crates/syntax/test_data/parser/inline/ok/0009_loop_expr.rast
new file mode 100644
index 000000000..f62826fd5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0009_loop_expr.rast
@@ -0,0 +1,24 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "loop"
17 [email protected] " "
18 [email protected]
19 [email protected] "{"
20 [email protected] "}"
21 [email protected] ";"
22 [email protected] "\n"
23 [email protected] "}"
24 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0009_loop_expr.rs b/crates/syntax/test_data/parser/inline/ok/0009_loop_expr.rs
new file mode 100644
index 000000000..9f078fa48
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0009_loop_expr.rs
@@ -0,0 +1,3 @@
1fn foo() {
2 loop {};
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0010_extern_block.rast b/crates/syntax/test_data/parser/inline/ok/0010_extern_block.rast
new file mode 100644
index 000000000..869875875
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0010_extern_block.rast
@@ -0,0 +1,9 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "extern"
5 [email protected] " "
6 [email protected]
7 [email protected] "{"
8 [email protected] "}"
9 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0010_extern_block.rs b/crates/syntax/test_data/parser/inline/ok/0010_extern_block.rs
new file mode 100644
index 000000000..26a9ccd1e
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0010_extern_block.rs
@@ -0,0 +1 @@
extern {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0011_field_expr.rast b/crates/syntax/test_data/parser/inline/ok/0011_field_expr.rast
new file mode 100644
index 000000000..66a609346
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0011_field_expr.rast
@@ -0,0 +1,59 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "x"
21 [email protected] "."
22 [email protected]
23 [email protected] "foo"
24 [email protected] ";"
25 [email protected] "\n "
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "x"
34 [email protected] "."
35 [email protected]
36 [email protected] "0"
37 [email protected] "."
38 [email protected]
39 [email protected] "bar"
40 [email protected] ";"
41 [email protected] "\n "
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "x"
50 [email protected] "."
51 [email protected]
52 [email protected] "0"
53 [email protected]
54 [email protected] "("
55 [email protected] ")"
56 [email protected] ";"
57 [email protected] "\n"
58 [email protected] "}"
59 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0011_field_expr.rs b/crates/syntax/test_data/parser/inline/ok/0011_field_expr.rs
new file mode 100644
index 000000000..b8da2ddc3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0011_field_expr.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 x.foo;
3 x.0.bar;
4 x.0();
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast b/crates/syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast
new file mode 100644
index 000000000..28c94bfd6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast
@@ -0,0 +1,33 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "Foo"
7 [email protected] " "
8 [email protected]
9 [email protected] "where"
10 [email protected] " "
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected] "Foo"
17 [email protected] ":"
18 [email protected] " "
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "Copy"
26 [email protected] " "
27 [email protected] "="
28 [email protected] " "
29 [email protected]
30 [email protected] "("
31 [email protected] ")"
32 [email protected] ";"
33 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rs b/crates/syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rs
new file mode 100644
index 000000000..a602d07f0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rs
@@ -0,0 +1 @@
type Foo where Foo: Copy = ();
diff --git a/crates/syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast b/crates/syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast
new file mode 100644
index 000000000..d33215b50
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast
@@ -0,0 +1,35 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "M"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "*"
12 [email protected] "mut"
13 [email protected] " "
14 [email protected]
15 [email protected] "("
16 [email protected] ")"
17 [email protected] ";"
18 [email protected] "\n"
19 [email protected]
20 [email protected] "type"
21 [email protected] " "
22 [email protected]
23 [email protected] "C"
24 [email protected] " "
25 [email protected] "="
26 [email protected] " "
27 [email protected]
28 [email protected] "*"
29 [email protected] "mut"
30 [email protected] " "
31 [email protected]
32 [email protected] "("
33 [email protected] ")"
34 [email protected] ";"
35 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rs b/crates/syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rs
new file mode 100644
index 000000000..04b2bb9ba
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rs
@@ -0,0 +1,2 @@
1type M = *mut ();
2type C = *mut ();
diff --git a/crates/syntax/test_data/parser/inline/ok/0014_never_type.rast b/crates/syntax/test_data/parser/inline/ok/0014_never_type.rast
new file mode 100644
index 000000000..b1d5106ce
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0014_never_type.rast
@@ -0,0 +1,13 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "Never"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "!"
12 [email protected] ";"
13 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0014_never_type.rs b/crates/syntax/test_data/parser/inline/ok/0014_never_type.rs
new file mode 100644
index 000000000..de399fcf4
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0014_never_type.rs
@@ -0,0 +1 @@
type Never = !;
diff --git a/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast b/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast
new file mode 100644
index 000000000..104e153ce
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast
@@ -0,0 +1,35 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "loop"
16 [email protected] " "
17 [email protected]
18 [email protected] "{"
19 [email protected] "\n "
20 [email protected]
21 [email protected]
22 [email protected] "continue"
23 [email protected] ";"
24 [email protected] "\n "
25 [email protected]
26 [email protected]
27 [email protected] "continue"
28 [email protected] " "
29 [email protected] "\'l"
30 [email protected] ";"
31 [email protected] "\n "
32 [email protected] "}"
33 [email protected] "\n"
34 [email protected] "}"
35 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rs b/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rs
new file mode 100644
index 000000000..474cc3f0e
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 loop {
3 continue;
4 continue 'l;
5 }
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0017_array_type.rast b/crates/syntax/test_data/parser/inline/ok/0017_array_type.rast
new file mode 100644
index 000000000..c131df1c9
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0017_array_type.rast
@@ -0,0 +1,21 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "["
12 [email protected]
13 [email protected] "("
14 [email protected] ")"
15 [email protected] ";"
16 [email protected] " "
17 [email protected]
18 [email protected] "92"
19 [email protected] "]"
20 [email protected] ";"
21 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0017_array_type.rs b/crates/syntax/test_data/parser/inline/ok/0017_array_type.rs
new file mode 100644
index 000000000..27eb22f22
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0017_array_type.rs
@@ -0,0 +1 @@
type T = [(); 92];
diff --git a/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast b/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast
new file mode 100644
index 000000000..ddbd66588
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast
@@ -0,0 +1,72 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "S"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "fn"
16 [email protected] " "
17 [email protected]
18 [email protected] "a"
19 [email protected]
20 [email protected] "("
21 [email protected]
22 [email protected] "self"
23 [email protected] ":"
24 [email protected] " "
25 [email protected]
26 [email protected] "&"
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "Self"
32 [email protected] ")"
33 [email protected] " "
34 [email protected]
35 [email protected] "{"
36 [email protected] "}"
37 [email protected] "\n "
38 [email protected]
39 [email protected] "fn"
40 [email protected] " "
41 [email protected]
42 [email protected] "b"
43 [email protected]
44 [email protected] "("
45 [email protected]
46 [email protected] "mut"
47 [email protected] " "
48 [email protected] "self"
49 [email protected] ":"
50 [email protected] " "
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected] "Box"
56 [email protected]
57 [email protected] "<"
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected] "Self"
64 [email protected] ">"
65 [email protected] ")"
66 [email protected] " "
67 [email protected]
68 [email protected] "{"
69 [email protected] "}"
70 [email protected] "\n"
71 [email protected] "}"
72 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rs b/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rs
new file mode 100644
index 000000000..6a170d5ac
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rs
@@ -0,0 +1,4 @@
1impl S {
2 fn a(self: &Self) {}
3 fn b(mut self: Box<Self>) {}
4}
diff --git a/crates/syntax/test_data/parser/inline/ok/0019_unary_expr.rast b/crates/syntax/test_data/parser/inline/ok/0019_unary_expr.rast
new file mode 100644
index 000000000..7db38ea4d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0019_unary_expr.rast
@@ -0,0 +1,44 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "*"
17 [email protected]
18 [email protected] "*"
19 [email protected]
20 [email protected] "&"
21 [email protected]
22 [email protected] "1"
23 [email protected] ";"
24 [email protected] "\n "
25 [email protected]
26 [email protected]
27 [email protected] "!"
28 [email protected]
29 [email protected] "!"
30 [email protected]
31 [email protected] "true"
32 [email protected] ";"
33 [email protected] "\n "
34 [email protected]
35 [email protected]
36 [email protected] "-"
37 [email protected]
38 [email protected] "-"
39 [email protected]
40 [email protected] "1"
41 [email protected] ";"
42 [email protected] "\n"
43 [email protected] "}"
44 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0019_unary_expr.rs b/crates/syntax/test_data/parser/inline/ok/0019_unary_expr.rs
new file mode 100644
index 000000000..f1c3f7118
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0019_unary_expr.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 **&1;
3 !!true;
4 --1;
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0020_use_star.rast b/crates/syntax/test_data/parser/inline/ok/0020_use_star.rast
new file mode 100644
index 000000000..b3623c445
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0020_use_star.rast
@@ -0,0 +1,59 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected] "*"
7 [email protected] ";"
8 [email protected] "\n"
9 [email protected]
10 [email protected] "use"
11 [email protected] " "
12 [email protected]
13 [email protected] "::"
14 [email protected] "*"
15 [email protected] ";"
16 [email protected] "\n"
17 [email protected]
18 [email protected] "use"
19 [email protected] " "
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "some"
26 [email protected] "::"
27 [email protected]
28 [email protected]
29 [email protected] "path"
30 [email protected] "::"
31 [email protected]
32 [email protected] "{"
33 [email protected]
34 [email protected] "*"
35 [email protected] "}"
36 [email protected] ";"
37 [email protected] "\n"
38 [email protected]
39 [email protected] "use"
40 [email protected] " "
41 [email protected]
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected] "some"
47 [email protected] "::"
48 [email protected]
49 [email protected]
50 [email protected] "path"
51 [email protected] "::"
52 [email protected]
53 [email protected] "{"
54 [email protected]
55 [email protected] "::"
56 [email protected] "*"
57 [email protected] "}"
58 [email protected] ";"
59 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0020_use_star.rs b/crates/syntax/test_data/parser/inline/ok/0020_use_star.rs
new file mode 100644
index 000000000..6f15769a8
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0020_use_star.rs
@@ -0,0 +1,4 @@
1use *;
2use ::*;
3use some::path::{*};
4use some::path::{::*};
diff --git a/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast b/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast
new file mode 100644
index 000000000..ca0702aba
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast
@@ -0,0 +1,78 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "F"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "type"
16 [email protected] " "
17 [email protected]
18 [email protected] "A"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected] "i32"
27 [email protected] ";"
28 [email protected] "\n "
29 [email protected]
30 [email protected] "const"
31 [email protected] " "
32 [email protected]
33 [email protected] "B"
34 [email protected] ":"
35 [email protected] " "
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected] "i32"
41 [email protected] " "
42 [email protected] "="
43 [email protected] " "
44 [email protected]
45 [email protected] "92"
46 [email protected] ";"
47 [email protected] "\n "
48 [email protected]
49 [email protected] "fn"
50 [email protected] " "
51 [email protected]
52 [email protected] "foo"
53 [email protected]
54 [email protected] "("
55 [email protected] ")"
56 [email protected] " "
57 [email protected]
58 [email protected] "{"
59 [email protected] "}"
60 [email protected] "\n "
61 [email protected]
62 [email protected] "fn"
63 [email protected] " "
64 [email protected]
65 [email protected] "bar"
66 [email protected]
67 [email protected] "("
68 [email protected]
69 [email protected] "&"
70 [email protected] "self"
71 [email protected] ")"
72 [email protected] " "
73 [email protected]
74 [email protected] "{"
75 [email protected] "}"
76 [email protected] "\n"
77 [email protected] "}"
78 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rs b/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rs
new file mode 100644
index 000000000..f10851487
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rs
@@ -0,0 +1,6 @@
1impl F {
2 type A = i32;
3 const B: i32 = 92;
4 fn foo() {}
5 fn bar(&self) {}
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast
new file mode 100644
index 000000000..50742cbcf
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast
@@ -0,0 +1,53 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "pub"
5 [email protected] "("
6 [email protected] "crate"
7 [email protected] ")"
8 [email protected] " "
9 [email protected] "struct"
10 [email protected] " "
11 [email protected]
12 [email protected] "S"
13 [email protected] ";"
14 [email protected] "\n"
15 [email protected]
16 [email protected]
17 [email protected] "pub"
18 [email protected] "("
19 [email protected] "self"
20 [email protected] ")"
21 [email protected] " "
22 [email protected] "struct"
23 [email protected] " "
24 [email protected]
25 [email protected] "S"
26 [email protected] ";"
27 [email protected] "\n"
28 [email protected]
29 [email protected]
30 [email protected] "pub"
31 [email protected] "("
32 [email protected] "self"
33 [email protected] ")"
34 [email protected] " "
35 [email protected] "struct"
36 [email protected] " "
37 [email protected]
38 [email protected] "S"
39 [email protected] ";"
40 [email protected] "\n"
41 [email protected]
42 [email protected]
43 [email protected] "pub"
44 [email protected] "("
45 [email protected] "self"
46 [email protected] ")"
47 [email protected] " "
48 [email protected] "struct"
49 [email protected] " "
50 [email protected]
51 [email protected] "S"
52 [email protected] ";"
53 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs
new file mode 100644
index 000000000..faeefde94
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs
@@ -0,0 +1,4 @@
1pub(crate) struct S;
2pub(self) struct S;
3pub(self) struct S;
4pub(self) struct S;
diff --git a/crates/syntax/test_data/parser/inline/ok/0023_placeholder_type.rast b/crates/syntax/test_data/parser/inline/ok/0023_placeholder_type.rast
new file mode 100644
index 000000000..e4fe2b948
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0023_placeholder_type.rast
@@ -0,0 +1,13 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "Placeholder"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "_"
12 [email protected] ";"
13 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0023_placeholder_type.rs b/crates/syntax/test_data/parser/inline/ok/0023_placeholder_type.rs
new file mode 100644
index 000000000..7952dbd57
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0023_placeholder_type.rs
@@ -0,0 +1 @@
type Placeholder = _;
diff --git a/crates/syntax/test_data/parser/inline/ok/0024_slice_pat.rast b/crates/syntax/test_data/parser/inline/ok/0024_slice_pat.rast
new file mode 100644
index 000000000..2dbce34b6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0024_slice_pat.rast
@@ -0,0 +1,41 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "["
19 [email protected]
20 [email protected]
21 [email protected] "a"
22 [email protected] ","
23 [email protected] " "
24 [email protected]
25 [email protected]
26 [email protected] "b"
27 [email protected] ","
28 [email protected] " "
29 [email protected]
30 [email protected] ".."
31 [email protected] "]"
32 [email protected] " "
33 [email protected] "="
34 [email protected] " "
35 [email protected]
36 [email protected] "["
37 [email protected] "]"
38 [email protected] ";"
39 [email protected] "\n"
40 [email protected] "}"
41 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0024_slice_pat.rs b/crates/syntax/test_data/parser/inline/ok/0024_slice_pat.rs
new file mode 100644
index 000000000..7955973b9
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0024_slice_pat.rs
@@ -0,0 +1,3 @@
1fn main() {
2 let [a, b, ..] = [];
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0025_slice_type.rast b/crates/syntax/test_data/parser/inline/ok/0025_slice_type.rast
new file mode 100644
index 000000000..fd819ea37
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0025_slice_type.rast
@@ -0,0 +1,17 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "["
12 [email protected]
13 [email protected] "("
14 [email protected] ")"
15 [email protected] "]"
16 [email protected] ";"
17 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0025_slice_type.rs b/crates/syntax/test_data/parser/inline/ok/0025_slice_type.rs
new file mode 100644
index 000000000..4da1af827
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0025_slice_type.rs
@@ -0,0 +1 @@
type T = [()];
diff --git a/crates/syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast b/crates/syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast
new file mode 100644
index 000000000..467a30134
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast
@@ -0,0 +1,104 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "S"
22 [email protected] "("
23 [email protected] ")"
24 [email protected] " "
25 [email protected] "="
26 [email protected] " "
27 [email protected]
28 [email protected] "("
29 [email protected] ")"
30 [email protected] ";"
31 [email protected] "\n "
32 [email protected]
33 [email protected] "let"
34 [email protected] " "
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected] "S"
40 [email protected] "("
41 [email protected]
42 [email protected] "_"
43 [email protected] ")"
44 [email protected] " "
45 [email protected] "="
46 [email protected] " "
47 [email protected]
48 [email protected] "("
49 [email protected] ")"
50 [email protected] ";"
51 [email protected] "\n "
52 [email protected]
53 [email protected] "let"
54 [email protected] " "
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected] "S"
60 [email protected] "("
61 [email protected]
62 [email protected] "_"
63 [email protected] ","
64 [email protected] ")"
65 [email protected] " "
66 [email protected] "="
67 [email protected] " "
68 [email protected]
69 [email protected] "("
70 [email protected] ")"
71 [email protected] ";"
72 [email protected] "\n "
73 [email protected]
74 [email protected] "let"
75 [email protected] " "
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected] "S"
81 [email protected] "("
82 [email protected]
83 [email protected] "_"
84 [email protected] ","
85 [email protected] " "
86 [email protected]
87 [email protected] ".."
88 [email protected] " "
89 [email protected] ","
90 [email protected] " "
91 [email protected]
92 [email protected]
93 [email protected] "x"
94 [email protected] ")"
95 [email protected] " "
96 [email protected] "="
97 [email protected] " "
98 [email protected]
99 [email protected] "("
100 [email protected] ")"
101 [email protected] ";"
102 [email protected] "\n"
103 [email protected] "}"
104 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rs b/crates/syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rs
new file mode 100644
index 000000000..0dfe63629
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 let S() = ();
3 let S(_) = ();
4 let S(_,) = ();
5 let S(_, .. , x) = ();
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0027_ref_pat.rast b/crates/syntax/test_data/parser/inline/ok/0027_ref_pat.rast
new file mode 100644
index 000000000..348b54dc9
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0027_ref_pat.rast
@@ -0,0 +1,49 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "&"
19 [email protected]
20 [email protected]
21 [email protected] "a"
22 [email protected] " "
23 [email protected] "="
24 [email protected] " "
25 [email protected]
26 [email protected] "("
27 [email protected] ")"
28 [email protected] ";"
29 [email protected] "\n "
30 [email protected]
31 [email protected] "let"
32 [email protected] " "
33 [email protected]
34 [email protected] "&"
35 [email protected] "mut"
36 [email protected] " "
37 [email protected]
38 [email protected]
39 [email protected] "b"
40 [email protected] " "
41 [email protected] "="
42 [email protected] " "
43 [email protected]
44 [email protected] "("
45 [email protected] ")"
46 [email protected] ";"
47 [email protected] "\n"
48 [email protected] "}"
49 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0027_ref_pat.rs b/crates/syntax/test_data/parser/inline/ok/0027_ref_pat.rs
new file mode 100644
index 000000000..de41f5cae
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0027_ref_pat.rs
@@ -0,0 +1,4 @@
1fn main() {
2 let &a = ();
3 let &mut b = ();
4}
diff --git a/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast b/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
new file mode 100644
index 000000000..32b2959bd
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
@@ -0,0 +1,43 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "impl"
12 [email protected] " "
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "Iterator"
20 [email protected]
21 [email protected] "<"
22 [email protected]
23 [email protected]
24 [email protected] "Item"
25 [email protected] "="
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "Foo"
31 [email protected]
32 [email protected] "<"
33 [email protected]
34 [email protected] "\'a"
35 [email protected] ">"
36 [email protected] ">"
37 [email protected] " "
38 [email protected] "+"
39 [email protected] " "
40 [email protected]
41 [email protected] "\'a"
42 [email protected] ";"
43 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rs b/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rs
new file mode 100644
index 000000000..54c5a7c46
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rs
@@ -0,0 +1 @@
type A = impl Iterator<Item=Foo<'a>> + 'a;
diff --git a/crates/syntax/test_data/parser/inline/ok/0029_cast_expr.rast b/crates/syntax/test_data/parser/inline/ok/0029_cast_expr.rast
new file mode 100644
index 000000000..e096b3a1f
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0029_cast_expr.rast
@@ -0,0 +1,89 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "82"
18 [email protected] " "
19 [email protected] "as"
20 [email protected] " "
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "i32"
26 [email protected] ";"
27 [email protected] "\n "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "81"
33 [email protected] " "
34 [email protected] "as"
35 [email protected] " "
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected] "i8"
41 [email protected] " "
42 [email protected] "+"
43 [email protected] " "
44 [email protected]
45 [email protected] "1"
46 [email protected] ";"
47 [email protected] "\n "
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected] "79"
53 [email protected] " "
54 [email protected] "as"
55 [email protected] " "
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected] "i16"
61 [email protected] " "
62 [email protected] "-"
63 [email protected] " "
64 [email protected]
65 [email protected] "1"
66 [email protected] ";"
67 [email protected] "\n "
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected]
72 [email protected] "0x36"
73 [email protected] " "
74 [email protected] "as"
75 [email protected] " "
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected] "u8"
81 [email protected] " "
82 [email protected] "<="
83 [email protected] " "
84 [email protected]
85 [email protected] "0x37"
86 [email protected] ";"
87 [email protected] "\n"
88 [email protected] "}"
89 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0029_cast_expr.rs b/crates/syntax/test_data/parser/inline/ok/0029_cast_expr.rs
new file mode 100644
index 000000000..bfe8e4b36
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0029_cast_expr.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 82 as i32;
3 81 as i8 + 1;
4 79 as i16 - 1;
5 0x36 as u8 <= 0x37;
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0030_cond.rast b/crates/syntax/test_data/parser/inline/ok/0030_cond.rast
new file mode 100644
index 000000000..58a97d3ad
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0030_cond.rast
@@ -0,0 +1,202 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected] "if"
16 [email protected] " "
17 [email protected]
18 [email protected] "let"
19 [email protected] " "
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected] "Some"
25 [email protected] "("
26 [email protected]
27 [email protected] "_"
28 [email protected] ")"
29 [email protected] " "
30 [email protected] "="
31 [email protected] " "
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected] "None"
37 [email protected] " "
38 [email protected]
39 [email protected] "{"
40 [email protected] "}"
41 [email protected] " "
42 [email protected] "}"
43 [email protected] "\n"
44 [email protected]
45 [email protected] "fn"
46 [email protected] " "
47 [email protected]
48 [email protected] "bar"
49 [email protected]
50 [email protected] "("
51 [email protected] ")"
52 [email protected] " "
53 [email protected]
54 [email protected] "{"
55 [email protected] "\n "
56 [email protected]
57 [email protected]
58 [email protected] "if"
59 [email protected] " "
60 [email protected]
61 [email protected] "let"
62 [email protected] " "
63 [email protected]
64 [email protected]
65 [email protected]
66 [email protected]
67 [email protected]
68 [email protected] "Some"
69 [email protected] "("
70 [email protected]
71 [email protected] "_"
72 [email protected] ")"
73 [email protected] " "
74 [email protected] "|"
75 [email protected] " "
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected] "Some"
81 [email protected] "("
82 [email protected]
83 [email protected] "_"
84 [email protected] ")"
85 [email protected] " "
86 [email protected] "="
87 [email protected] " "
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected]
92 [email protected] "None"
93 [email protected] " "
94 [email protected]
95 [email protected] "{"
96 [email protected] "}"
97 [email protected] "\n "
98 [email protected]
99 [email protected]
100 [email protected] "if"
101 [email protected] " "
102 [email protected]
103 [email protected] "let"
104 [email protected] " "
105 [email protected] "|"
106 [email protected] " "
107 [email protected]
108 [email protected]
109 [email protected]
110 [email protected]
111 [email protected] "Some"
112 [email protected] "("
113 [email protected]
114 [email protected] "_"
115 [email protected] ")"
116 [email protected] " "
117 [email protected] "="
118 [email protected] " "
119 [email protected]
120 [email protected]
121 [email protected]
122 [email protected]
123 [email protected] "None"
124 [email protected] " "
125 [email protected]
126 [email protected] "{"
127 [email protected] "}"
128 [email protected] "\n "
129 [email protected]
130 [email protected]
131 [email protected] "while"
132 [email protected] " "
133 [email protected]
134 [email protected] "let"
135 [email protected] " "
136 [email protected]
137 [email protected]
138 [email protected]
139 [email protected]
140 [email protected]
141 [email protected] "Some"
142 [email protected] "("
143 [email protected]
144 [email protected] "_"
145 [email protected] ")"
146 [email protected] " "
147 [email protected] "|"
148 [email protected] " "
149 [email protected]
150 [email protected]
151 [email protected]
152 [email protected]
153 [email protected] "Some"
154 [email protected] "("
155 [email protected]
156 [email protected] "_"
157 [email protected] ")"
158 [email protected] " "
159 [email protected] "="
160 [email protected] " "
161 [email protected]
162 [email protected]
163 [email protected]
164 [email protected]
165 [email protected] "None"
166 [email protected] " "
167 [email protected]
168 [email protected] "{"
169 [email protected] "}"
170 [email protected] "\n "
171 [email protected]
172 [email protected] "while"
173 [email protected] " "
174 [email protected]
175 [email protected] "let"
176 [email protected] " "
177 [email protected] "|"
178 [email protected] " "
179 [email protected]
180 [email protected]
181 [email protected]
182 [email protected]
183 [email protected] "Some"
184 [email protected] "("
185 [email protected]
186 [email protected] "_"
187 [email protected] ")"
188 [email protected] " "
189 [email protected] "="
190 [email protected] " "
191 [email protected]
192 [email protected]
193 [email protected]
194 [email protected]
195 [email protected] "None"
196 [email protected] " "
197 [email protected]
198 [email protected] "{"
199 [email protected] "}"
200 [email protected] "\n"
201 [email protected] "}"
202 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0030_cond.rs b/crates/syntax/test_data/parser/inline/ok/0030_cond.rs
new file mode 100644
index 000000000..2552a2621
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0030_cond.rs
@@ -0,0 +1,7 @@
1fn foo() { if let Some(_) = None {} }
2fn bar() {
3 if let Some(_) | Some(_) = None {}
4 if let | Some(_) = None {}
5 while let Some(_) | Some(_) = None {}
6 while let | Some(_) = None {}
7}
diff --git a/crates/syntax/test_data/parser/inline/ok/0031_while_expr.rast b/crates/syntax/test_data/parser/inline/ok/0031_while_expr.rast
new file mode 100644
index 000000000..173cecf6d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0031_while_expr.rast
@@ -0,0 +1,84 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "while"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected] "true"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] ";"
26 [email protected] "\n "
27 [email protected]
28 [email protected]
29 [email protected] "while"
30 [email protected] " "
31 [email protected]
32 [email protected] "let"
33 [email protected] " "
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected] "Some"
39 [email protected] "("
40 [email protected]
41 [email protected]
42 [email protected] "x"
43 [email protected] ")"
44 [email protected] " "
45 [email protected] "="
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected] "it"
53 [email protected] "."
54 [email protected]
55 [email protected] "next"
56 [email protected]
57 [email protected] "("
58 [email protected] ")"
59 [email protected] " "
60 [email protected]
61 [email protected] "{"
62 [email protected] "}"
63 [email protected] ";"
64 [email protected] "\n "
65 [email protected]
66 [email protected]
67 [email protected] "while"
68 [email protected] " "
69 [email protected]
70 [email protected]
71 [email protected] "{"
72 [email protected] " "
73 [email protected]
74 [email protected] "true"
75 [email protected] " "
76 [email protected] "}"
77 [email protected] " "
78 [email protected]
79 [email protected] "{"
80 [email protected] "}"
81 [email protected] ";"
82 [email protected] "\n"
83 [email protected] "}"
84 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0031_while_expr.rs b/crates/syntax/test_data/parser/inline/ok/0031_while_expr.rs
new file mode 100644
index 000000000..2f8188160
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0031_while_expr.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 while true {};
3 while let Some(x) = it.next() {};
4 while { true } {};
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast b/crates/syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast
new file mode 100644
index 000000000..dda6577ed
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast
@@ -0,0 +1,98 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "fn"
12 [email protected]
13 [email protected] "("
14 [email protected] ")"
15 [email protected] ";"
16 [email protected] "\n"
17 [email protected]
18 [email protected] "type"
19 [email protected] " "
20 [email protected]
21 [email protected] "B"
22 [email protected] " "
23 [email protected] "="
24 [email protected] " "
25 [email protected]
26 [email protected] "unsafe"
27 [email protected] " "
28 [email protected] "fn"
29 [email protected]
30 [email protected] "("
31 [email protected] ")"
32 [email protected] ";"
33 [email protected] "\n"
34 [email protected]
35 [email protected] "type"
36 [email protected] " "
37 [email protected]
38 [email protected] "C"
39 [email protected] " "
40 [email protected] "="
41 [email protected] " "
42 [email protected]
43 [email protected] "unsafe"
44 [email protected] " "
45 [email protected]
46 [email protected] "extern"
47 [email protected] " "
48 [email protected] "\"C\""
49 [email protected] " "
50 [email protected] "fn"
51 [email protected]
52 [email protected] "("
53 [email protected] ")"
54 [email protected] ";"
55 [email protected] "\n"
56 [email protected]
57 [email protected] "type"
58 [email protected] " "
59 [email protected]
60 [email protected] "D"
61 [email protected] " "
62 [email protected] "="
63 [email protected] " "
64 [email protected]
65 [email protected]
66 [email protected] "extern"
67 [email protected] " "
68 [email protected] "\"C\""
69 [email protected] " "
70 [email protected] "fn"
71 [email protected] " "
72 [email protected]
73 [email protected] "("
74 [email protected] " "
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected] "u8"
81 [email protected] " "
82 [email protected] ","
83 [email protected] " "
84 [email protected]
85 [email protected] "..."
86 [email protected] " "
87 [email protected] ")"
88 [email protected] " "
89 [email protected]
90 [email protected] "->"
91 [email protected] " "
92 [email protected]
93 [email protected]
94 [email protected]
95 [email protected]
96 [email protected] "u8"
97 [email protected] ";"
98 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rs b/crates/syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rs
new file mode 100644
index 000000000..9493da83d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rs
@@ -0,0 +1,4 @@
1type A = fn();
2type B = unsafe fn();
3type C = unsafe extern "C" fn();
4type D = extern "C" fn ( u8 , ... ) -> u8;
diff --git a/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast b/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast
new file mode 100644
index 000000000..974df9f9a
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast
@@ -0,0 +1,50 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "&"
12 [email protected]
13 [email protected] "("
14 [email protected] ")"
15 [email protected] ";"
16 [email protected] "\n"
17 [email protected]
18 [email protected] "type"
19 [email protected] " "
20 [email protected]
21 [email protected] "B"
22 [email protected] " "
23 [email protected] "="
24 [email protected] " "
25 [email protected]
26 [email protected] "&"
27 [email protected] "\'static"
28 [email protected] " "
29 [email protected]
30 [email protected] "("
31 [email protected] ")"
32 [email protected] ";"
33 [email protected] "\n"
34 [email protected]
35 [email protected] "type"
36 [email protected] " "
37 [email protected]
38 [email protected] "C"
39 [email protected] " "
40 [email protected] "="
41 [email protected] " "
42 [email protected]
43 [email protected] "&"
44 [email protected] "mut"
45 [email protected] " "
46 [email protected]
47 [email protected] "("
48 [email protected] ")"
49 [email protected] ";"
50 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rs b/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rs
new file mode 100644
index 000000000..3ac0badab
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rs
@@ -0,0 +1,3 @@
1type A = &();
2type B = &'static ();
3type C = &mut ();
diff --git a/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast b/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast
new file mode 100644
index 000000000..f905def6f
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast
@@ -0,0 +1,53 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "loop"
16 [email protected] " "
17 [email protected]
18 [email protected] "{"
19 [email protected] "\n "
20 [email protected]
21 [email protected]
22 [email protected] "break"
23 [email protected] ";"
24 [email protected] "\n "
25 [email protected]
26 [email protected]
27 [email protected] "break"
28 [email protected] " "
29 [email protected] "\'l"
30 [email protected] ";"
31 [email protected] "\n "
32 [email protected]
33 [email protected]
34 [email protected] "break"
35 [email protected] " "
36 [email protected]
37 [email protected] "92"
38 [email protected] ";"
39 [email protected] "\n "
40 [email protected]
41 [email protected]
42 [email protected] "break"
43 [email protected] " "
44 [email protected] "\'l"
45 [email protected] " "
46 [email protected]
47 [email protected] "92"
48 [email protected] ";"
49 [email protected] "\n "
50 [email protected] "}"
51 [email protected] "\n"
52 [email protected] "}"
53 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rs b/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rs
new file mode 100644
index 000000000..1b4094636
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rs
@@ -0,0 +1,8 @@
1fn foo() {
2 loop {
3 break;
4 break 'l;
5 break 92;
6 break 'l 92;
7 }
8}
diff --git a/crates/syntax/test_data/parser/inline/ok/0037_qual_paths.rast b/crates/syntax/test_data/parser/inline/ok/0037_qual_paths.rast
new file mode 100644
index 000000000..b6379e62f
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0037_qual_paths.rast
@@ -0,0 +1,78 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "X"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected] "<"
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "A"
20 [email protected] " "
21 [email protected] "as"
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected] "B"
28 [email protected] ">"
29 [email protected] "::"
30 [email protected]
31 [email protected]
32 [email protected] "Output"
33 [email protected] ";"
34 [email protected] "\n"
35 [email protected]
36 [email protected] "fn"
37 [email protected] " "
38 [email protected]
39 [email protected] "foo"
40 [email protected]
41 [email protected] "("
42 [email protected] ")"
43 [email protected] " "
44 [email protected]
45 [email protected] "{"
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected] "<"
54 [email protected]
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected] "usize"
59 [email protected] " "
60 [email protected] "as"
61 [email protected] " "
62 [email protected]
63 [email protected]
64 [email protected]
65 [email protected]
66 [email protected] "Default"
67 [email protected] ">"
68 [email protected] "::"
69 [email protected]
70 [email protected]
71 [email protected] "default"
72 [email protected]
73 [email protected] "("
74 [email protected] ")"
75 [email protected] ";"
76 [email protected] " "
77 [email protected] "}"
78 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0037_qual_paths.rs b/crates/syntax/test_data/parser/inline/ok/0037_qual_paths.rs
new file mode 100644
index 000000000..d140692e2
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0037_qual_paths.rs
@@ -0,0 +1,2 @@
1type X = <A as B>::Output;
2fn foo() { <usize as Default>::default(); }
diff --git a/crates/syntax/test_data/parser/inline/ok/0038_full_range_expr.rast b/crates/syntax/test_data/parser/inline/ok/0038_full_range_expr.rast
new file mode 100644
index 000000000..64e705fb3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0038_full_range_expr.rast
@@ -0,0 +1,28 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "xs"
21 [email protected] "["
22 [email protected]
23 [email protected] ".."
24 [email protected] "]"
25 [email protected] ";"
26 [email protected] " "
27 [email protected] "}"
28 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0038_full_range_expr.rs b/crates/syntax/test_data/parser/inline/ok/0038_full_range_expr.rs
new file mode 100644
index 000000000..ae21ad94c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0038_full_range_expr.rs
@@ -0,0 +1 @@
fn foo() { xs[..]; }
diff --git a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast
new file mode 100644
index 000000000..69e98b9d6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast
@@ -0,0 +1,55 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected] "B"
15 [email protected]
16 [email protected] "<"
17 [email protected]
18 [email protected] "\'static"
19 [email protected] ","
20 [email protected] " "
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected] "i32"
27 [email protected] ","
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected] "1"
32 [email protected] ","
33 [email protected] " "
34 [email protected]
35 [email protected]
36 [email protected] "{"
37 [email protected] " "
38 [email protected]
39 [email protected] "2"
40 [email protected] " "
41 [email protected] "}"
42 [email protected] ","
43 [email protected] " "
44 [email protected]
45 [email protected]
46 [email protected] "Item"
47 [email protected] "="
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected] "u64"
53 [email protected] ">"
54 [email protected] ";"
55 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs
new file mode 100644
index 000000000..0d07d7651
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs
@@ -0,0 +1 @@
type A = B<'static, i32, 1, { 2 }, Item=u64>;
diff --git a/crates/syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast b/crates/syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast
new file mode 100644
index 000000000..db5bd2849
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast
@@ -0,0 +1,62 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "crate"
5 [email protected] " "
6 [email protected] "fn"
7 [email protected] " "
8 [email protected]
9 [email protected] "main"
10 [email protected]
11 [email protected] "("
12 [email protected] ")"
13 [email protected] " "
14 [email protected]
15 [email protected] "{"
16 [email protected] " "
17 [email protected] "}"
18 [email protected] "\n"
19 [email protected]
20 [email protected] "struct"
21 [email protected] " "
22 [email protected]
23 [email protected] "S"
24 [email protected] " "
25 [email protected]
26 [email protected] "{"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected] "crate"
31 [email protected] " "
32 [email protected]
33 [email protected] "field"
34 [email protected] ":"
35 [email protected] " "
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected] "u32"
41 [email protected] " "
42 [email protected] "}"
43 [email protected] "\n"
44 [email protected]
45 [email protected] "struct"
46 [email protected] " "
47 [email protected]
48 [email protected] "T"
49 [email protected]
50 [email protected] "("
51 [email protected]
52 [email protected]
53 [email protected] "crate"
54 [email protected] " "
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected] "u32"
60 [email protected] ")"
61 [email protected] ";"
62 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rs b/crates/syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rs
new file mode 100644
index 000000000..e2b5f2161
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rs
@@ -0,0 +1,3 @@
1crate fn main() { }
2struct S { crate field: u32 }
3struct T(crate u32);
diff --git a/crates/syntax/test_data/parser/inline/ok/0041_trait_item.rast b/crates/syntax/test_data/parser/inline/ok/0041_trait_item.rast
new file mode 100644
index 000000000..3638462f8
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0041_trait_item.rast
@@ -0,0 +1,125 @@
1[email protected]
2 [email protected]
3 [email protected] "trait"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "U"
12 [email protected] ">"
13 [email protected] ":"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "Hash"
22 [email protected] " "
23 [email protected] "+"
24 [email protected] " "
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "Clone"
31 [email protected] " "
32 [email protected]
33 [email protected] "where"
34 [email protected] " "
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected] "U"
41 [email protected] ":"
42 [email protected] " "
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "Copy"
50 [email protected] " "
51 [email protected]
52 [email protected] "{"
53 [email protected] "}"
54 [email protected] "\n"
55 [email protected]
56 [email protected] "trait"
57 [email protected] " "
58 [email protected]
59 [email protected] "X"
60 [email protected]
61 [email protected] "<"
62 [email protected]
63 [email protected]
64 [email protected] "U"
65 [email protected] ":"
66 [email protected] " "
67 [email protected]
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected]
72 [email protected]
73 [email protected] "Debug"
74 [email protected] " "
75 [email protected] "+"
76 [email protected] " "
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected] "Display"
83 [email protected] ">"
84 [email protected] ":"
85 [email protected] " "
86 [email protected]
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected]
92 [email protected] "Hash"
93 [email protected] " "
94 [email protected] "+"
95 [email protected] " "
96 [email protected]
97 [email protected]
98 [email protected]
99 [email protected]
100 [email protected]
101 [email protected] "Clone"
102 [email protected] " "
103 [email protected]
104 [email protected] "where"
105 [email protected] " "
106 [email protected]
107 [email protected]
108 [email protected]
109 [email protected]
110 [email protected]
111 [email protected] "U"
112 [email protected] ":"
113 [email protected] " "
114 [email protected]
115 [email protected]
116 [email protected]
117 [email protected]
118 [email protected]
119 [email protected]
120 [email protected] "Copy"
121 [email protected] " "
122 [email protected]
123 [email protected] "{"
124 [email protected] "}"
125 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0041_trait_item.rs b/crates/syntax/test_data/parser/inline/ok/0041_trait_item.rs
new file mode 100644
index 000000000..32761dd03
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0041_trait_item.rs
@@ -0,0 +1,2 @@
1trait T<U>: Hash + Clone where U: Copy {}
2trait X<U: Debug + Display>: Hash + Clone where U: Copy {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0042_call_expr.rast b/crates/syntax/test_data/parser/inline/ok/0042_call_expr.rast
new file mode 100644
index 000000000..fa38e9466
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0042_call_expr.rast
@@ -0,0 +1,147 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "_"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected] "f"
28 [email protected]
29 [email protected] "("
30 [email protected] ")"
31 [email protected] ";"
32 [email protected] "\n "
33 [email protected]
34 [email protected] "let"
35 [email protected] " "
36 [email protected]
37 [email protected] "_"
38 [email protected] " "
39 [email protected] "="
40 [email protected] " "
41 [email protected]
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected] "f"
49 [email protected]
50 [email protected] "("
51 [email protected] ")"
52 [email protected]
53 [email protected] "("
54 [email protected]
55 [email protected] "1"
56 [email protected] ")"
57 [email protected]
58 [email protected] "("
59 [email protected]
60 [email protected] "1"
61 [email protected] ","
62 [email protected] " "
63 [email protected]
64 [email protected] "2"
65 [email protected] ","
66 [email protected] ")"
67 [email protected] ";"
68 [email protected] "\n "
69 [email protected]
70 [email protected] "let"
71 [email protected] " "
72 [email protected]
73 [email protected] "_"
74 [email protected] " "
75 [email protected] "="
76 [email protected] " "
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected] "f"
83 [email protected]
84 [email protected] "("
85 [email protected]
86 [email protected]
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected] "<"
91 [email protected]
92 [email protected]
93 [email protected]
94 [email protected]
95 [email protected] "Foo"
96 [email protected] ">"
97 [email protected] "::"
98 [email protected]
99 [email protected]
100 [email protected] "func"
101 [email protected]
102 [email protected] "("
103 [email protected] ")"
104 [email protected] ")"
105 [email protected] ";"
106 [email protected] "\n "
107 [email protected]
108 [email protected]
109 [email protected]
110 [email protected]
111 [email protected]
112 [email protected]
113 [email protected] "f"
114 [email protected]
115 [email protected] "("
116 [email protected]
117 [email protected]
118 [email protected]
119 [email protected]
120 [email protected]
121 [email protected] "<"
122 [email protected]
123 [email protected]
124 [email protected]
125 [email protected]
126 [email protected] "Foo"
127 [email protected] " "
128 [email protected] "as"
129 [email protected] " "
130 [email protected]
131 [email protected]
132 [email protected]
133 [email protected]
134 [email protected] "Trait"
135 [email protected] ">"
136 [email protected] "::"
137 [email protected]
138 [email protected]
139 [email protected] "func"
140 [email protected]
141 [email protected] "("
142 [email protected] ")"
143 [email protected] ")"
144 [email protected] ";"
145 [email protected] "\n"
146 [email protected] "}"
147 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0042_call_expr.rs b/crates/syntax/test_data/parser/inline/ok/0042_call_expr.rs
new file mode 100644
index 000000000..ffbf46d6d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0042_call_expr.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 let _ = f();
3 let _ = f()(1)(1, 2,);
4 let _ = f(<Foo>::func());
5 f(<Foo as Trait>::func());
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0043_use_alias.rast b/crates/syntax/test_data/parser/inline/ok/0043_use_alias.rast
new file mode 100644
index 000000000..60b517230
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0043_use_alias.rast
@@ -0,0 +1,138 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected]
10 [email protected] "some"
11 [email protected] "::"
12 [email protected]
13 [email protected]
14 [email protected] "path"
15 [email protected] " "
16 [email protected]
17 [email protected] "as"
18 [email protected] " "
19 [email protected]
20 [email protected] "some_name"
21 [email protected] ";"
22 [email protected] "\n"
23 [email protected]
24 [email protected] "use"
25 [email protected] " "
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "some"
31 [email protected] "::"
32 [email protected]
33 [email protected] "{"
34 [email protected] "\n "
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected] "other"
41 [email protected] "::"
42 [email protected]
43 [email protected]
44 [email protected] "path"
45 [email protected] " "
46 [email protected]
47 [email protected] "as"
48 [email protected] " "
49 [email protected]
50 [email protected] "some_other_name"
51 [email protected] ","
52 [email protected] "\n "
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected] "different"
59 [email protected] "::"
60 [email protected]
61 [email protected]
62 [email protected] "path"
63 [email protected] " "
64 [email protected]
65 [email protected] "as"
66 [email protected] " "
67 [email protected]
68 [email protected] "different_name"
69 [email protected] ","
70 [email protected] "\n "
71 [email protected]
72 [email protected]
73 [email protected]
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected] "yet"
78 [email protected] "::"
79 [email protected]
80 [email protected]
81 [email protected] "another"
82 [email protected] "::"
83 [email protected]
84 [email protected]
85 [email protected] "path"
86 [email protected] ","
87 [email protected] "\n "
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected]
92 [email protected]
93 [email protected]
94 [email protected]
95 [email protected]
96 [email protected]
97 [email protected] "running"
98 [email protected] "::"
99 [email protected]
100 [email protected]
101 [email protected] "out"
102 [email protected] "::"
103 [email protected]
104 [email protected]
105 [email protected] "of"
106 [email protected] "::"
107 [email protected]
108 [email protected]
109 [email protected] "synonyms"
110 [email protected] "::"
111 [email protected]
112 [email protected]
113 [email protected] "for_"
114 [email protected] "::"
115 [email protected]
116 [email protected]
117 [email protected] "different"
118 [email protected] "::"
119 [email protected] "*"
120 [email protected] "\n"
121 [email protected] "}"
122 [email protected] ";"
123 [email protected] "\n"
124 [email protected]
125 [email protected] "use"
126 [email protected] " "
127 [email protected]
128 [email protected]
129 [email protected]
130 [email protected]
131 [email protected] "Trait"
132 [email protected] " "
133 [email protected]
134 [email protected] "as"
135 [email protected] " "
136 [email protected] "_"
137 [email protected] ";"
138 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0043_use_alias.rs b/crates/syntax/test_data/parser/inline/ok/0043_use_alias.rs
new file mode 100644
index 000000000..9be50f877
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0043_use_alias.rs
@@ -0,0 +1,8 @@
1use some::path as some_name;
2use some::{
3 other::path as some_other_name,
4 different::path as different_name,
5 yet::another::path,
6 running::out::of::synonyms::for_::different::*
7};
8use Trait as _;
diff --git a/crates/syntax/test_data/parser/inline/ok/0044_block_items.rast b/crates/syntax/test_data/parser/inline/ok/0044_block_items.rast
new file mode 100644
index 000000000..1fd3cd0e7
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0044_block_items.rast
@@ -0,0 +1,28 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "a"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected] "fn"
16 [email protected] " "
17 [email protected]
18 [email protected] "b"
19 [email protected]
20 [email protected] "("
21 [email protected] ")"
22 [email protected] " "
23 [email protected]
24 [email protected] "{"
25 [email protected] "}"
26 [email protected] " "
27 [email protected] "}"
28 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0044_block_items.rs b/crates/syntax/test_data/parser/inline/ok/0044_block_items.rs
new file mode 100644
index 000000000..d9868718c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0044_block_items.rs
@@ -0,0 +1 @@
fn a() { fn b() {} }
diff --git a/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast b/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
new file mode 100644
index 000000000..6baea6e3c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
@@ -0,0 +1,46 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "F"
12 [email protected] ":"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "FnMut"
21 [email protected]
22 [email protected] "("
23 [email protected]
24 [email protected]
25 [email protected] "&"
26 [email protected] "mut"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "Foo"
33 [email protected]
34 [email protected] "<"
35 [email protected]
36 [email protected] "\'a"
37 [email protected] ">"
38 [email protected] ")"
39 [email protected] ">"
40 [email protected]
41 [email protected] "("
42 [email protected] ")"
43 [email protected]
44 [email protected] "{"
45 [email protected] "}"
46 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rs b/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rs
new file mode 100644
index 000000000..9b93442c0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rs
@@ -0,0 +1 @@
fn foo<F: FnMut(&mut Foo<'a>)>(){}
diff --git a/crates/syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast b/crates/syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast
new file mode 100644
index 000000000..e89284c14
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast
@@ -0,0 +1,20 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "("
12 [email protected]
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected] "i32"
17 [email protected] ","
18 [email protected] ")"
19 [email protected] ";"
20 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rs b/crates/syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rs
new file mode 100644
index 000000000..cb66bad24
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rs
@@ -0,0 +1 @@
type T = (i32,);
diff --git a/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast b/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
new file mode 100644
index 000000000..4d8404e7c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
@@ -0,0 +1,81 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "->"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "Box"
19 [email protected]
20 [email protected] "<"
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "T"
30 [email protected] " "
31 [email protected] "+"
32 [email protected] " "
33 [email protected]
34 [email protected] "\'f"
35 [email protected] ">"
36 [email protected] " "
37 [email protected]
38 [email protected] "{"
39 [email protected] "}"
40 [email protected] "\n"
41 [email protected]
42 [email protected] "fn"
43 [email protected] " "
44 [email protected]
45 [email protected] "foo"
46 [email protected]
47 [email protected] "("
48 [email protected] ")"
49 [email protected] " "
50 [email protected]
51 [email protected] "->"
52 [email protected] " "
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected]
57 [email protected] "Box"
58 [email protected]
59 [email protected] "<"
60 [email protected]
61 [email protected]
62 [email protected] "dyn"
63 [email protected] " "
64 [email protected]
65 [email protected]
66 [email protected]
67 [email protected]
68 [email protected]
69 [email protected]
70 [email protected] "T"
71 [email protected] " "
72 [email protected] "+"
73 [email protected] " "
74 [email protected]
75 [email protected] "\'f"
76 [email protected] ">"
77 [email protected] " "
78 [email protected]
79 [email protected] "{"
80 [email protected] "}"
81 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rs b/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rs
new file mode 100644
index 000000000..4bb0f63b7
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rs
@@ -0,0 +1,2 @@
1fn foo() -> Box<T + 'f> {}
2fn foo() -> Box<dyn T + 'f> {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0050_fn_decl.rast b/crates/syntax/test_data/parser/inline/ok/0050_fn_decl.rast
new file mode 100644
index 000000000..a5bf55131
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0050_fn_decl.rast
@@ -0,0 +1,22 @@
1[email protected]
2 [email protected]
3 [email protected] "trait"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] " "
11 [email protected]
12 [email protected] "fn"
13 [email protected] " "
14 [email protected]
15 [email protected] "foo"
16 [email protected]
17 [email protected] "("
18 [email protected] ")"
19 [email protected] ";"
20 [email protected] " "
21 [email protected] "}"
22 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0050_fn_decl.rs b/crates/syntax/test_data/parser/inline/ok/0050_fn_decl.rs
new file mode 100644
index 000000000..c9f74f7f5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0050_fn_decl.rs
@@ -0,0 +1 @@
trait T { fn foo(); }
diff --git a/crates/syntax/test_data/parser/inline/ok/0051_unit_type.rast b/crates/syntax/test_data/parser/inline/ok/0051_unit_type.rast
new file mode 100644
index 000000000..6330dbf9e
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0051_unit_type.rast
@@ -0,0 +1,14 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "("
12 [email protected] ")"
13 [email protected] ";"
14 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0051_unit_type.rs b/crates/syntax/test_data/parser/inline/ok/0051_unit_type.rs
new file mode 100644
index 000000000..c039cf7d3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0051_unit_type.rs
@@ -0,0 +1 @@
type T = ();
diff --git a/crates/syntax/test_data/parser/inline/ok/0052_path_type.rast b/crates/syntax/test_data/parser/inline/ok/0052_path_type.rast
new file mode 100644
index 000000000..9bc36bea7
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0052_path_type.rast
@@ -0,0 +1,70 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected] "Foo"
15 [email protected] ";"
16 [email protected] "\n"
17 [email protected]
18 [email protected] "type"
19 [email protected] " "
20 [email protected]
21 [email protected] "B"
22 [email protected] " "
23 [email protected] "="
24 [email protected] " "
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected] "::"
29 [email protected]
30 [email protected] "Foo"
31 [email protected] ";"
32 [email protected] "\n"
33 [email protected]
34 [email protected] "type"
35 [email protected] " "
36 [email protected]
37 [email protected] "C"
38 [email protected] " "
39 [email protected] "="
40 [email protected] " "
41 [email protected]
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected] "self"
46 [email protected] "::"
47 [email protected]
48 [email protected]
49 [email protected] "Foo"
50 [email protected] ";"
51 [email protected] "\n"
52 [email protected]
53 [email protected] "type"
54 [email protected] " "
55 [email protected]
56 [email protected] "D"
57 [email protected] " "
58 [email protected] "="
59 [email protected] " "
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected]
64 [email protected] "super"
65 [email protected] "::"
66 [email protected]
67 [email protected]
68 [email protected] "Foo"
69 [email protected] ";"
70 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0052_path_type.rs b/crates/syntax/test_data/parser/inline/ok/0052_path_type.rs
new file mode 100644
index 000000000..bf94f32e1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0052_path_type.rs
@@ -0,0 +1,4 @@
1type A = Foo;
2type B = ::Foo;
3type C = self::Foo;
4type D = super::Foo;
diff --git a/crates/syntax/test_data/parser/inline/ok/0053_path_expr.rast b/crates/syntax/test_data/parser/inline/ok/0053_path_expr.rast
new file mode 100644
index 000000000..c34cfeb31
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0053_path_expr.rast
@@ -0,0 +1,95 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "_"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected] "a"
27 [email protected] ";"
28 [email protected] "\n "
29 [email protected]
30 [email protected] "let"
31 [email protected] " "
32 [email protected]
33 [email protected] "_"
34 [email protected] " "
35 [email protected] "="
36 [email protected] " "
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected] "a"
43 [email protected] "::"
44 [email protected]
45 [email protected]
46 [email protected] "b"
47 [email protected] ";"
48 [email protected] "\n "
49 [email protected]
50 [email protected] "let"
51 [email protected] " "
52 [email protected]
53 [email protected] "_"
54 [email protected] " "
55 [email protected] "="
56 [email protected] " "
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected] "::"
61 [email protected]
62 [email protected] "a"
63 [email protected]
64 [email protected] "::"
65 [email protected] "<"
66 [email protected]
67 [email protected]
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected] "b"
72 [email protected] ">"
73 [email protected] ";"
74 [email protected] "\n "
75 [email protected]
76 [email protected] "let"
77 [email protected] " "
78 [email protected]
79 [email protected] "_"
80 [email protected] " "
81 [email protected] "="
82 [email protected] " "
83 [email protected]
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected] "format"
88 [email protected] "!"
89 [email protected]
90 [email protected] "("
91 [email protected] ")"
92 [email protected] ";"
93 [email protected] "\n"
94 [email protected] "}"
95 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0053_path_expr.rs b/crates/syntax/test_data/parser/inline/ok/0053_path_expr.rs
new file mode 100644
index 000000000..333ebabef
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0053_path_expr.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 let _ = a;
3 let _ = a::b;
4 let _ = ::a::<b>;
5 let _ = format!();
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast b/crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast
new file mode 100644
index 000000000..9ae271817
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast
@@ -0,0 +1,44 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected]
12 [email protected]
13 [email protected] "#"
14 [email protected] "["
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "serde"
19 [email protected]
20 [email protected] "("
21 [email protected] "with"
22 [email protected] " "
23 [email protected] "="
24 [email protected] " "
25 [email protected] "\"url_serde\""
26 [email protected] ")"
27 [email protected] "]"
28 [email protected] "\n "
29 [email protected]
30 [email protected] "pub"
31 [email protected] " "
32 [email protected]
33 [email protected] "uri"
34 [email protected] ":"
35 [email protected] " "
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected] "Uri"
41 [email protected] ","
42 [email protected] "\n"
43 [email protected] "}"
44 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rs b/crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rs
new file mode 100644
index 000000000..4744d8ac0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0054_record_field_attrs.rs
@@ -0,0 +1,4 @@
1struct S {
2 #[serde(with = "url_serde")]
3 pub uri: Uri,
4}
diff --git a/crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rast b/crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rast
new file mode 100644
index 000000000..68bb43852
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rast
@@ -0,0 +1,76 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "match"
16 [email protected] " "
17 [email protected]
18 [email protected] "("
19 [email protected] ")"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "\n "
24 [email protected]
25 [email protected]
26 [email protected] "-"
27 [email protected]
28 [email protected] "1"
29 [email protected] " "
30 [email protected] "=>"
31 [email protected] " "
32 [email protected]
33 [email protected] "("
34 [email protected] ")"
35 [email protected] ","
36 [email protected] "\n "
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected] "92"
41 [email protected] " "
42 [email protected] "=>"
43 [email protected] " "
44 [email protected]
45 [email protected] "("
46 [email protected] ")"
47 [email protected] ","
48 [email protected] "\n "
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected] "\'c\'"
53 [email protected] " "
54 [email protected] "=>"
55 [email protected] " "
56 [email protected]
57 [email protected] "("
58 [email protected] ")"
59 [email protected] ","
60 [email protected] "\n "
61 [email protected]
62 [email protected]
63 [email protected]
64 [email protected] "\"hello\""
65 [email protected] " "
66 [email protected] "=>"
67 [email protected] " "
68 [email protected]
69 [email protected] "("
70 [email protected] ")"
71 [email protected] ","
72 [email protected] "\n "
73 [email protected] "}"
74 [email protected] "\n"
75 [email protected] "}"
76 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rs b/crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rs
new file mode 100644
index 000000000..6dfd67b4c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rs
@@ -0,0 +1,8 @@
1fn main() {
2 match () {
3 -1 => (),
4 92 => (),
5 'c' => (),
6 "hello" => (),
7 }
8}
diff --git a/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast b/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast
new file mode 100644
index 000000000..28129c50c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast
@@ -0,0 +1,110 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] "\n"
11 [email protected]
12 [email protected] "where"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "\'a"
16 [email protected] ":"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected] "\'b"
21 [email protected] " "
22 [email protected] "+"
23 [email protected] " "
24 [email protected]
25 [email protected] "\'c"
26 [email protected] ","
27 [email protected] "\n "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "T"
34 [email protected] ":"
35 [email protected] " "
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected] "Clone"
43 [email protected] " "
44 [email protected] "+"
45 [email protected] " "
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected] "Copy"
52 [email protected] " "
53 [email protected] "+"
54 [email protected] " "
55 [email protected]
56 [email protected] "\'static"
57 [email protected] ","
58 [email protected] "\n "
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected]
64 [email protected]
65 [email protected] "Iterator"
66 [email protected] "::"
67 [email protected]
68 [email protected]
69 [email protected] "Item"
70 [email protected] ":"
71 [email protected] " "
72 [email protected]
73 [email protected]
74 [email protected] "\'a"
75 [email protected] ","
76 [email protected] "\n "
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected] "<"
83 [email protected]
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected] "T"
88 [email protected] " "
89 [email protected] "as"
90 [email protected] " "
91 [email protected]
92 [email protected]
93 [email protected]
94 [email protected]
95 [email protected] "Iterator"
96 [email protected] ">"
97 [email protected] "::"
98 [email protected]
99 [email protected]
100 [email protected] "Item"
101 [email protected] ":"
102 [email protected] " "
103 [email protected]
104 [email protected]
105 [email protected] "\'a"
106 [email protected] "\n"
107 [email protected]
108 [email protected] "{"
109 [email protected] "}"
110 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rs b/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rs
new file mode 100644
index 000000000..19d7e571b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rs
@@ -0,0 +1,7 @@
1fn foo()
2where
3 'a: 'b + 'c,
4 T: Clone + Copy + 'static,
5 Iterator::Item: 'a,
6 <T as Iterator>::Item: 'a
7{}
diff --git a/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rast b/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rast
new file mode 100644
index 000000000..3e72f9671
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rast
@@ -0,0 +1,82 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "match"
16 [email protected] " "
17 [email protected]
18 [email protected] "92"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] "\n "
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected] "0"
28 [email protected] " "
29 [email protected] "..."
30 [email protected] " "
31 [email protected]
32 [email protected]
33 [email protected] "100"
34 [email protected] " "
35 [email protected] "=>"
36 [email protected] " "
37 [email protected]
38 [email protected] "("
39 [email protected] ")"
40 [email protected] ","
41 [email protected] "\n "
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected] "101"
47 [email protected] " "
48 [email protected] "..="
49 [email protected] " "
50 [email protected]
51 [email protected]
52 [email protected] "200"
53 [email protected] " "
54 [email protected] "=>"
55 [email protected] " "
56 [email protected]
57 [email protected] "("
58 [email protected] ")"
59 [email protected] ","
60 [email protected] "\n "
61 [email protected]
62 [email protected]
63 [email protected]
64 [email protected]
65 [email protected] "200"
66 [email protected] " "
67 [email protected] ".."
68 [email protected] " "
69 [email protected]
70 [email protected]
71 [email protected] "301"
72 [email protected] "=>"
73 [email protected] " "
74 [email protected]
75 [email protected] "("
76 [email protected] ")"
77 [email protected] ","
78 [email protected] "\n "
79 [email protected] "}"
80 [email protected] "\n"
81 [email protected] "}"
82 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rs b/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rs
new file mode 100644
index 000000000..c12ab6fce
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rs
@@ -0,0 +1,7 @@
1fn main() {
2 match 92 {
3 0 ... 100 => (),
4 101 ..= 200 => (),
5 200 .. 301=> (),
6 }
7}
diff --git a/crates/syntax/test_data/parser/inline/ok/0059_match_arms_commas.rast b/crates/syntax/test_data/parser/inline/ok/0059_match_arms_commas.rast
new file mode 100644
index 000000000..984829317
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0059_match_arms_commas.rast
@@ -0,0 +1,58 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "match"
16 [email protected] " "
17 [email protected]
18 [email protected] "("
19 [email protected] ")"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "\n "
24 [email protected]
25 [email protected]
26 [email protected] "_"
27 [email protected] " "
28 [email protected] "=>"
29 [email protected] " "
30 [email protected]
31 [email protected] "("
32 [email protected] ")"
33 [email protected] ","
34 [email protected] "\n "
35 [email protected]
36 [email protected]
37 [email protected] "_"
38 [email protected] " "
39 [email protected] "=>"
40 [email protected] " "
41 [email protected]
42 [email protected] "{"
43 [email protected] "}"
44 [email protected] "\n "
45 [email protected]
46 [email protected]
47 [email protected] "_"
48 [email protected] " "
49 [email protected] "=>"
50 [email protected] " "
51 [email protected]
52 [email protected] "("
53 [email protected] ")"
54 [email protected] "\n "
55 [email protected] "}"
56 [email protected] "\n"
57 [email protected] "}"
58 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0059_match_arms_commas.rs b/crates/syntax/test_data/parser/inline/ok/0059_match_arms_commas.rs
new file mode 100644
index 000000000..1f25d577a
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0059_match_arms_commas.rs
@@ -0,0 +1,7 @@
1fn foo() {
2 match () {
3 _ => (),
4 _ => {}
5 _ => ()
6 }
7}
diff --git a/crates/syntax/test_data/parser/inline/ok/0060_extern_crate.rast b/crates/syntax/test_data/parser/inline/ok/0060_extern_crate.rast
new file mode 100644
index 000000000..25e1777d1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0060_extern_crate.rast
@@ -0,0 +1,10 @@
1[email protected]
2 [email protected]
3 [email protected] "extern"
4 [email protected] " "
5 [email protected] "crate"
6 [email protected] " "
7 [email protected]
8 [email protected] "foo"
9 [email protected] ";"
10 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0060_extern_crate.rs b/crates/syntax/test_data/parser/inline/ok/0060_extern_crate.rs
new file mode 100644
index 000000000..49af74e1b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0060_extern_crate.rs
@@ -0,0 +1 @@
extern crate foo;
diff --git a/crates/syntax/test_data/parser/inline/ok/0061_record_lit.rast b/crates/syntax/test_data/parser/inline/ok/0061_record_lit.rast
new file mode 100644
index 000000000..a9ae1aa59
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0061_record_lit.rast
@@ -0,0 +1,124 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "S"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "}"
24 [email protected] ";"
25 [email protected] "\n "
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "S"
32 [email protected] " "
33 [email protected]
34 [email protected] "{"
35 [email protected] " "
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "x"
42 [email protected] ","
43 [email protected] " "
44 [email protected]
45 [email protected]
46 [email protected] "y"
47 [email protected] ":"
48 [email protected] " "
49 [email protected]
50 [email protected] "32"
51 [email protected] ","
52 [email protected] " "
53 [email protected] "}"
54 [email protected] ";"
55 [email protected] "\n "
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected] "S"
62 [email protected] " "
63 [email protected]
64 [email protected] "{"
65 [email protected] " "
66 [email protected]
67 [email protected]
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected] "x"
72 [email protected] ","
73 [email protected] " "
74 [email protected]
75 [email protected]
76 [email protected] "y"
77 [email protected] ":"
78 [email protected] " "
79 [email protected]
80 [email protected] "32"
81 [email protected] ","
82 [email protected] " "
83 [email protected] ".."
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected] "Default"
91 [email protected] "::"
92 [email protected]
93 [email protected]
94 [email protected] "default"
95 [email protected]
96 [email protected] "("
97 [email protected] ")"
98 [email protected] " "
99 [email protected] "}"
100 [email protected] ";"
101 [email protected] "\n "
102 [email protected]
103 [email protected]
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected] "TupleStruct"
108 [email protected] " "
109 [email protected]
110 [email protected] "{"
111 [email protected] " "
112 [email protected]
113 [email protected]
114 [email protected] "0"
115 [email protected] ":"
116 [email protected] " "
117 [email protected]
118 [email protected] "1"
119 [email protected] " "
120 [email protected] "}"
121 [email protected] ";"
122 [email protected] "\n"
123 [email protected] "}"
124 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0061_record_lit.rs b/crates/syntax/test_data/parser/inline/ok/0061_record_lit.rs
new file mode 100644
index 000000000..6285e5549
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0061_record_lit.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 S {};
3 S { x, y: 32, };
4 S { x, y: 32, ..Default::default() };
5 TupleStruct { 0: 1 };
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rast b/crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rast
new file mode 100644
index 000000000..de8217064
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rast
@@ -0,0 +1,66 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "}"
14 [email protected] "\n"
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "macro_rules"
20 [email protected] "!"
21 [email protected] " "
22 [email protected]
23 [email protected] "foo"
24 [email protected] " "
25 [email protected]
26 [email protected] "{"
27 [email protected] "}"
28 [email protected] "\n"
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "foo"
35 [email protected] "::"
36 [email protected]
37 [email protected]
38 [email protected] "bar"
39 [email protected] "!"
40 [email protected]
41 [email protected] "("
42 [email protected] ")"
43 [email protected] ";"
44 [email protected] "\n"
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "super"
50 [email protected] "::"
51 [email protected]
52 [email protected]
53 [email protected] "baz"
54 [email protected] "!"
55 [email protected] " "
56 [email protected]
57 [email protected] "{"
58 [email protected] "}"
59 [email protected] "\n"
60 [email protected]
61 [email protected] "struct"
62 [email protected] " "
63 [email protected]
64 [email protected] "S"
65 [email protected] ";"
66 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rs b/crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rs
new file mode 100644
index 000000000..24a15c5c5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0062_mod_contents.rs
@@ -0,0 +1,5 @@
1fn foo() {}
2macro_rules! foo {}
3foo::bar!();
4super::baz! {}
5struct S;
diff --git a/crates/syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast b/crates/syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast
new file mode 100644
index 000000000..4368930cc
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast
@@ -0,0 +1,23 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected] " "
5 [email protected] "!"
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected]
10 [email protected] "Send"
11 [email protected] " "
12 [email protected] "for"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "X"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] "}"
23 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0063_impl_def_neg.rs b/crates/syntax/test_data/parser/inline/ok/0063_impl_def_neg.rs
new file mode 100644
index 000000000..b7527c870
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0063_impl_def_neg.rs
@@ -0,0 +1 @@
impl !Send for X {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0064_if_expr.rast b/crates/syntax/test_data/parser/inline/ok/0064_if_expr.rast
new file mode 100644
index 000000000..587160003
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0064_if_expr.rast
@@ -0,0 +1,121 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "if"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected] "true"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] ";"
26 [email protected] "\n "
27 [email protected]
28 [email protected]
29 [email protected] "if"
30 [email protected] " "
31 [email protected]
32 [email protected]
33 [email protected] "true"
34 [email protected] " "
35 [email protected]
36 [email protected] "{"
37 [email protected] "}"
38 [email protected] " "
39 [email protected] "else"
40 [email protected] " "
41 [email protected]
42 [email protected] "{"
43 [email protected] "}"
44 [email protected] ";"
45 [email protected] "\n "
46 [email protected]
47 [email protected]
48 [email protected] "if"
49 [email protected] " "
50 [email protected]
51 [email protected]
52 [email protected] "true"
53 [email protected] " "
54 [email protected]
55 [email protected] "{"
56 [email protected] "}"
57 [email protected] " "
58 [email protected] "else"
59 [email protected] " "
60 [email protected]
61 [email protected] "if"
62 [email protected] " "
63 [email protected]
64 [email protected]
65 [email protected] "false"
66 [email protected] " "
67 [email protected]
68 [email protected] "{"
69 [email protected] "}"
70 [email protected] " "
71 [email protected] "else"
72 [email protected] " "
73 [email protected]
74 [email protected] "{"
75 [email protected] "}"
76 [email protected] ";"
77 [email protected] "\n "
78 [email protected]
79 [email protected]
80 [email protected] "if"
81 [email protected] " "
82 [email protected]
83 [email protected]
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected] "S"
88 [email protected] " "
89 [email protected]
90 [email protected] "{"
91 [email protected] "}"
92 [email protected] ";"
93 [email protected] "\n "
94 [email protected]
95 [email protected]
96 [email protected] "if"
97 [email protected] " "
98 [email protected]
99 [email protected]
100 [email protected] "{"
101 [email protected] " "
102 [email protected]
103 [email protected] "true"
104 [email protected] " "
105 [email protected] "}"
106 [email protected] " "
107 [email protected]
108 [email protected] "{"
109 [email protected] " "
110 [email protected] "}"
111 [email protected] " "
112 [email protected] "else"
113 [email protected] " "
114 [email protected]
115 [email protected] "{"
116 [email protected] " "
117 [email protected] "}"
118 [email protected] ";"
119 [email protected] "\n"
120 [email protected] "}"
121 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0064_if_expr.rs b/crates/syntax/test_data/parser/inline/ok/0064_if_expr.rs
new file mode 100644
index 000000000..40f227ba3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0064_if_expr.rs
@@ -0,0 +1,7 @@
1fn foo() {
2 if true {};
3 if true {} else {};
4 if true {} else if false {} else {};
5 if S {};
6 if { true } { } else { };
7}
diff --git a/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast b/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
new file mode 100644
index 000000000..3a7fcfe24
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
@@ -0,0 +1,43 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "dyn"
12 [email protected] " "
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "Iterator"
20 [email protected]
21 [email protected] "<"
22 [email protected]
23 [email protected]
24 [email protected] "Item"
25 [email protected] "="
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "Foo"
31 [email protected]
32 [email protected] "<"
33 [email protected]
34 [email protected] "\'a"
35 [email protected] ">"
36 [email protected] ">"
37 [email protected] " "
38 [email protected] "+"
39 [email protected] " "
40 [email protected]
41 [email protected] "\'a"
42 [email protected] ";"
43 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rs b/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rs
new file mode 100644
index 000000000..c3ecabb99
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rs
@@ -0,0 +1 @@
type A = dyn Iterator<Item=Foo<'a>> + 'a;
diff --git a/crates/syntax/test_data/parser/inline/ok/0066_match_arm.rast b/crates/syntax/test_data/parser/inline/ok/0066_match_arm.rast
new file mode 100644
index 000000000..57d0661a5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0066_match_arm.rast
@@ -0,0 +1,151 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "match"
17 [email protected] " "
18 [email protected]
19 [email protected] "("
20 [email protected] ")"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "\n "
25 [email protected]
26 [email protected]
27 [email protected] "_"
28 [email protected] " "
29 [email protected] "=>"
30 [email protected] " "
31 [email protected]
32 [email protected] "("
33 [email protected] ")"
34 [email protected] ","
35 [email protected] "\n "
36 [email protected]
37 [email protected]
38 [email protected] "_"
39 [email protected] " "
40 [email protected]
41 [email protected] "if"
42 [email protected] " "
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected] "Test"
49 [email protected] " "
50 [email protected] ">"
51 [email protected] " "
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected] "Test"
57 [email protected]
58 [email protected] "{"
59 [email protected]
60 [email protected]
61 [email protected] "field"
62 [email protected] ":"
63 [email protected] " "
64 [email protected]
65 [email protected] "0"
66 [email protected] "}"
67 [email protected] " "
68 [email protected] "=>"
69 [email protected] " "
70 [email protected]
71 [email protected] "("
72 [email protected] ")"
73 [email protected] ","
74 [email protected] "\n "
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected] "X"
80 [email protected] " "
81 [email protected] "|"
82 [email protected] " "
83 [email protected]
84 [email protected]
85 [email protected] "Y"
86 [email protected] " "
87 [email protected]
88 [email protected] "if"
89 [email protected] " "
90 [email protected]
91 [email protected]
92 [email protected]
93 [email protected]
94 [email protected] "Z"
95 [email protected] " "
96 [email protected] "=>"
97 [email protected] " "
98 [email protected]
99 [email protected] "("
100 [email protected] ")"
101 [email protected] ","
102 [email protected] "\n "
103 [email protected]
104 [email protected] "|"
105 [email protected] " "
106 [email protected]
107 [email protected]
108 [email protected]
109 [email protected] "X"
110 [email protected] " "
111 [email protected] "|"
112 [email protected] " "
113 [email protected]
114 [email protected]
115 [email protected] "Y"
116 [email protected] " "
117 [email protected]
118 [email protected] "if"
119 [email protected] " "
120 [email protected]
121 [email protected]
122 [email protected]
123 [email protected]
124 [email protected] "Z"
125 [email protected] " "
126 [email protected] "=>"
127 [email protected] " "
128 [email protected]
129 [email protected] "("
130 [email protected] ")"
131 [email protected] ","
132 [email protected] "\n "
133 [email protected]
134 [email protected] "|"
135 [email protected] " "
136 [email protected]
137 [email protected]
138 [email protected] "X"
139 [email protected] " "
140 [email protected] "=>"
141 [email protected] " "
142 [email protected]
143 [email protected] "("
144 [email protected] ")"
145 [email protected] ","
146 [email protected] "\n "
147 [email protected] "}"
148 [email protected] ";"
149 [email protected] "\n"
150 [email protected] "}"
151 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0066_match_arm.rs b/crates/syntax/test_data/parser/inline/ok/0066_match_arm.rs
new file mode 100644
index 000000000..9e009e24f
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0066_match_arm.rs
@@ -0,0 +1,9 @@
1fn foo() {
2 match () {
3 _ => (),
4 _ if Test > Test{field: 0} => (),
5 X | Y if Z => (),
6 | X | Y if Z => (),
7 | X => (),
8 };
9}
diff --git a/crates/syntax/test_data/parser/inline/ok/0067_crate_path.rast b/crates/syntax/test_data/parser/inline/ok/0067_crate_path.rast
new file mode 100644
index 000000000..702f2e0b0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0067_crate_path.rast
@@ -0,0 +1,15 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "crate"
10 [email protected] "::"
11 [email protected]
12 [email protected]
13 [email protected] "foo"
14 [email protected] ";"
15 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0067_crate_path.rs b/crates/syntax/test_data/parser/inline/ok/0067_crate_path.rs
new file mode 100644
index 000000000..1bbb5930b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0067_crate_path.rs
@@ -0,0 +1 @@
use crate::foo;
diff --git a/crates/syntax/test_data/parser/inline/ok/0068_union_items.rast b/crates/syntax/test_data/parser/inline/ok/0068_union_items.rast
new file mode 100644
index 000000000..6589e4795
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0068_union_items.rast
@@ -0,0 +1,46 @@
1[email protected]
2 [email protected]
3 [email protected] "union"
4 [email protected] " "
5 [email protected]
6 [email protected] "Foo"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "}"
11 [email protected] "\n"
12 [email protected]
13 [email protected] "union"
14 [email protected] " "
15 [email protected]
16 [email protected] "Foo"
17 [email protected] " "
18 [email protected]
19 [email protected] "{"
20 [email protected] "\n "
21 [email protected]
22 [email protected]
23 [email protected] "a"
24 [email protected] ":"
25 [email protected] " "
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "i32"
31 [email protected] ","
32 [email protected] "\n "
33 [email protected]
34 [email protected]
35 [email protected] "b"
36 [email protected] ":"
37 [email protected] " "
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected] "f32"
43 [email protected] ","
44 [email protected] "\n"
45 [email protected] "}"
46 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0068_union_items.rs b/crates/syntax/test_data/parser/inline/ok/0068_union_items.rs
new file mode 100644
index 000000000..b7dd610d8
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0068_union_items.rs
@@ -0,0 +1,5 @@
1union Foo {}
2union Foo {
3 a: i32,
4 b: f32,
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast b/crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast
new file mode 100644
index 000000000..c4c5bc51e
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast
@@ -0,0 +1,37 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected] "crate"
9 [email protected] "::"
10 [email protected]
11 [email protected] "{"
12 [email protected]
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected] "Item"
17 [email protected] "}"
18 [email protected] ";"
19 [email protected] "\n"
20 [email protected]
21 [email protected] "use"
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected] "self"
27 [email protected] "::"
28 [email protected]
29 [email protected] "{"
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "Item"
35 [email protected] "}"
36 [email protected] ";"
37 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rs b/crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rs
new file mode 100644
index 000000000..c0a3d634e
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rs
@@ -0,0 +1,2 @@
1use crate::{Item};
2use self::{Item};
diff --git a/crates/syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast b/crates/syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast
new file mode 100644
index 000000000..36c9cd5bb
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast
@@ -0,0 +1,50 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "_"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected]
24 [email protected] "{"
25 [email protected]
26 [email protected] "1"
27 [email protected] "}"
28 [email protected] " "
29 [email protected] "&"
30 [email protected] " "
31 [email protected]
32 [email protected] "2"
33 [email protected] ";"
34 [email protected] "\n "
35 [email protected]
36 [email protected]
37 [email protected] "{"
38 [email protected]
39 [email protected] "1"
40 [email protected] "}"
41 [email protected] " "
42 [email protected]
43 [email protected]
44 [email protected] "&"
45 [email protected]
46 [email protected] "2"
47 [email protected] ";"
48 [email protected] "\n"
49 [email protected] "}"
50 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rs b/crates/syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rs
new file mode 100644
index 000000000..37b843742
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rs
@@ -0,0 +1,4 @@
1fn foo() {
2 let _ = {1} & 2;
3 {1} &2;
4}
diff --git a/crates/syntax/test_data/parser/inline/ok/0071_match_expr.rast b/crates/syntax/test_data/parser/inline/ok/0071_match_expr.rast
new file mode 100644
index 000000000..d34d98ced
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0071_match_expr.rast
@@ -0,0 +1,93 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "match"
17 [email protected] " "
18 [email protected]
19 [email protected] "("
20 [email protected] ")"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] " "
25 [email protected] "}"
26 [email protected] ";"
27 [email protected] "\n "
28 [email protected]
29 [email protected]
30 [email protected] "match"
31 [email protected] " "
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected] "S"
37 [email protected] " "
38 [email protected]
39 [email protected] "{"
40 [email protected] "}"
41 [email protected] ";"
42 [email protected] "\n "
43 [email protected]
44 [email protected]
45 [email protected] "match"
46 [email protected] " "
47 [email protected]
48 [email protected] "{"
49 [email protected] " "
50 [email protected] "}"
51 [email protected] " "
52 [email protected]
53 [email protected] "{"
54 [email protected] " "
55 [email protected]
56 [email protected]
57 [email protected] "_"
58 [email protected] " "
59 [email protected] "=>"
60 [email protected] " "
61 [email protected]
62 [email protected] "("
63 [email protected] ")"
64 [email protected] " "
65 [email protected] "}"
66 [email protected] ";"
67 [email protected] "\n "
68 [email protected]
69 [email protected]
70 [email protected] "match"
71 [email protected] " "
72 [email protected]
73 [email protected] "{"
74 [email protected] " "
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected] "S"
80 [email protected] " "
81 [email protected]
82 [email protected] "{"
83 [email protected] "}"
84 [email protected] " "
85 [email protected] "}"
86 [email protected] " "
87 [email protected]
88 [email protected] "{"
89 [email protected] "}"
90 [email protected] ";"
91 [email protected] "\n"
92 [email protected] "}"
93 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0071_match_expr.rs b/crates/syntax/test_data/parser/inline/ok/0071_match_expr.rs
new file mode 100644
index 000000000..c4021dc10
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0071_match_expr.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 match () { };
3 match S {};
4 match { } { _ => () };
5 match { S {} } {};
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0072_return_expr.rast b/crates/syntax/test_data/parser/inline/ok/0072_return_expr.rast
new file mode 100644
index 000000000..437d7ac04
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0072_return_expr.rast
@@ -0,0 +1,28 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "return"
17 [email protected] ";"
18 [email protected] "\n "
19 [email protected]
20 [email protected]
21 [email protected] "return"
22 [email protected] " "
23 [email protected]
24 [email protected] "92"
25 [email protected] ";"
26 [email protected] "\n"
27 [email protected] "}"
28 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0072_return_expr.rs b/crates/syntax/test_data/parser/inline/ok/0072_return_expr.rs
new file mode 100644
index 000000000..5733666b6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0072_return_expr.rs
@@ -0,0 +1,4 @@
1fn foo() {
2 return;
3 return 92;
4}
diff --git a/crates/syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast b/crates/syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast
new file mode 100644
index 000000000..00cce69e6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast
@@ -0,0 +1,20 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "Result"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ">"
13 [email protected] " "
14 [email protected] "="
15 [email protected] " "
16 [email protected]
17 [email protected] "("
18 [email protected] ")"
19 [email protected] ";"
20 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0073_type_item_type_params.rs b/crates/syntax/test_data/parser/inline/ok/0073_type_item_type_params.rs
new file mode 100644
index 000000000..defd110c4
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0073_type_item_type_params.rs
@@ -0,0 +1 @@
type Result<T> = ();
diff --git a/crates/syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast b/crates/syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast
new file mode 100644
index 000000000..3a789b9f5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast
@@ -0,0 +1,59 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "match"
16 [email protected] " "
17 [email protected]
18 [email protected] "("
19 [email protected] ")"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "\n "
24 [email protected]
25 [email protected]
26 [email protected] "_"
27 [email protected] " "
28 [email protected] "=>"
29 [email protected] " "
30 [email protected]
31 [email protected] "{"
32 [email protected] "}"
33 [email protected] "\n "
34 [email protected]
35 [email protected]
36 [email protected] "("
37 [email protected] ")"
38 [email protected] " "
39 [email protected] "=>"
40 [email protected] " "
41 [email protected]
42 [email protected] "{"
43 [email protected] "}"
44 [email protected] "\n "
45 [email protected]
46 [email protected]
47 [email protected] "["
48 [email protected] "]"
49 [email protected] " "
50 [email protected] "=>"
51 [email protected] " "
52 [email protected]
53 [email protected] "{"
54 [email protected] "}"
55 [email protected] "\n "
56 [email protected] "}"
57 [email protected] "\n"
58 [email protected] "}"
59 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rs b/crates/syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rs
new file mode 100644
index 000000000..2edd578f9
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rs
@@ -0,0 +1,7 @@
1fn foo() {
2 match () {
3 _ => {}
4 () => {}
5 [] => {}
6 }
7}
diff --git a/crates/syntax/test_data/parser/inline/ok/0075_block.rast b/crates/syntax/test_data/parser/inline/ok/0075_block.rast
new file mode 100644
index 000000000..e847ce9b2
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0075_block.rast
@@ -0,0 +1,86 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "a"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "}"
14 [email protected] "\n"
15 [email protected]
16 [email protected] "fn"
17 [email protected] " "
18 [email protected]
19 [email protected] "b"
20 [email protected]
21 [email protected] "("
22 [email protected] ")"
23 [email protected] " "
24 [email protected]
25 [email protected] "{"
26 [email protected] " "
27 [email protected]
28 [email protected] "let"
29 [email protected] " "
30 [email protected]
31 [email protected] "_"
32 [email protected] " "
33 [email protected] "="
34 [email protected] " "
35 [email protected]
36 [email protected] "1"
37 [email protected] ";"
38 [email protected] " "
39 [email protected] "}"
40 [email protected] "\n"
41 [email protected]
42 [email protected] "fn"
43 [email protected] " "
44 [email protected]
45 [email protected] "c"
46 [email protected]
47 [email protected] "("
48 [email protected] ")"
49 [email protected] " "
50 [email protected]
51 [email protected] "{"
52 [email protected] " "
53 [email protected]
54 [email protected]
55 [email protected] "1"
56 [email protected] ";"
57 [email protected] " "
58 [email protected]
59 [email protected]
60 [email protected] "2"
61 [email protected] ";"
62 [email protected] " "
63 [email protected] "}"
64 [email protected] "\n"
65 [email protected]
66 [email protected] "fn"
67 [email protected] " "
68 [email protected]
69 [email protected] "d"
70 [email protected]
71 [email protected] "("
72 [email protected] ")"
73 [email protected] " "
74 [email protected]
75 [email protected] "{"
76 [email protected] " "
77 [email protected]
78 [email protected]
79 [email protected] "1"
80 [email protected] ";"
81 [email protected] " "
82 [email protected]
83 [email protected] "2"
84 [email protected] " "
85 [email protected] "}"
86 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0075_block.rs b/crates/syntax/test_data/parser/inline/ok/0075_block.rs
new file mode 100644
index 000000000..81f44c533
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0075_block.rs
@@ -0,0 +1,4 @@
1fn a() {}
2fn b() { let _ = 1; }
3fn c() { 1; 2; }
4fn d() { 1; 2 }
diff --git a/crates/syntax/test_data/parser/inline/ok/0076_function_where_clause.rast b/crates/syntax/test_data/parser/inline/ok/0076_function_where_clause.rast
new file mode 100644
index 000000000..96217a7fd
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0076_function_where_clause.rast
@@ -0,0 +1,39 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ">"
13 [email protected]
14 [email protected] "("
15 [email protected] ")"
16 [email protected] " "
17 [email protected]
18 [email protected] "where"
19 [email protected] " "
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "T"
26 [email protected] ":"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "Copy"
35 [email protected] " "
36 [email protected]
37 [email protected] "{"
38 [email protected] "}"
39 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0076_function_where_clause.rs b/crates/syntax/test_data/parser/inline/ok/0076_function_where_clause.rs
new file mode 100644
index 000000000..f0920b2a8
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0076_function_where_clause.rs
@@ -0,0 +1 @@
fn foo<T>() where T: Copy {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0077_try_expr.rast b/crates/syntax/test_data/parser/inline/ok/0077_try_expr.rast
new file mode 100644
index 000000000..33e6fb93f
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0077_try_expr.rast
@@ -0,0 +1,25 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "x"
21 [email protected] "?"
22 [email protected] ";"
23 [email protected] "\n"
24 [email protected] "}"
25 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0077_try_expr.rs b/crates/syntax/test_data/parser/inline/ok/0077_try_expr.rs
new file mode 100644
index 000000000..8b74f7bc8
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0077_try_expr.rs
@@ -0,0 +1,3 @@
1fn foo() {
2 x?;
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0078_type_item.rast b/crates/syntax/test_data/parser/inline/ok/0078_type_item.rast
new file mode 100644
index 000000000..2befc8388
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0078_type_item.rast
@@ -0,0 +1,16 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "Foo"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected] "Bar"
15 [email protected] ";"
16 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0078_type_item.rs b/crates/syntax/test_data/parser/inline/ok/0078_type_item.rs
new file mode 100644
index 000000000..04c0344fa
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0078_type_item.rs
@@ -0,0 +1 @@
type Foo = Bar;
diff --git a/crates/syntax/test_data/parser/inline/ok/0079_impl_def.rast b/crates/syntax/test_data/parser/inline/ok/0079_impl_def.rast
new file mode 100644
index 000000000..209711fc4
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0079_impl_def.rast
@@ -0,0 +1,14 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "Foo"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "}"
14 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0079_impl_def.rs b/crates/syntax/test_data/parser/inline/ok/0079_impl_def.rs
new file mode 100644
index 000000000..d6337f6b3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0079_impl_def.rs
@@ -0,0 +1 @@
impl Foo {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0080_postfix_range.rast b/crates/syntax/test_data/parser/inline/ok/0080_postfix_range.rast
new file mode 100644
index 000000000..b3003577c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0080_postfix_range.rast
@@ -0,0 +1,95 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "x"
20 [email protected] " "
21 [email protected] "="
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected] "1"
26 [email protected] ".."
27 [email protected] ";"
28 [email protected] "\n "
29 [email protected]
30 [email protected]
31 [email protected] "match"
32 [email protected] " "
33 [email protected]
34 [email protected]
35 [email protected] "1"
36 [email protected] ".."
37 [email protected] " "
38 [email protected]
39 [email protected] "{"
40 [email protected] " "
41 [email protected]
42 [email protected]
43 [email protected] "_"
44 [email protected] " "
45 [email protected] "=>"
46 [email protected] " "
47 [email protected]
48 [email protected] "("
49 [email protected] ")"
50 [email protected] " "
51 [email protected] "}"
52 [email protected] ";"
53 [email protected] "\n "
54 [email protected]
55 [email protected]
56 [email protected] "match"
57 [email protected] " "
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected]
64 [email protected] "a"
65 [email protected] "."
66 [email protected]
67 [email protected] "b"
68 [email protected]
69 [email protected] "("
70 [email protected] ")"
71 [email protected] ".."
72 [email protected]
73 [email protected]
74 [email protected]
75 [email protected]
76 [email protected] "S"
77 [email protected] " "
78 [email protected]
79 [email protected] "{"
80 [email protected] " "
81 [email protected]
82 [email protected]
83 [email protected] "_"
84 [email protected] " "
85 [email protected] "=>"
86 [email protected] " "
87 [email protected]
88 [email protected] "("
89 [email protected] ")"
90 [email protected] " "
91 [email protected] "}"
92 [email protected] ";"
93 [email protected] "\n"
94 [email protected] "}"
95 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0080_postfix_range.rs b/crates/syntax/test_data/parser/inline/ok/0080_postfix_range.rs
new file mode 100644
index 000000000..e7b7cfc6b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0080_postfix_range.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 let x = 1..;
3 match 1.. { _ => () };
4 match a.b()..S { _ => () };
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast
new file mode 100644
index 000000000..f319d5141
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast
@@ -0,0 +1,112 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "for"
12 [email protected]
13 [email protected] "<"
14 [email protected]
15 [email protected] "\'a"
16 [email protected] ">"
17 [email protected] " "
18 [email protected]
19 [email protected] "fn"
20 [email protected]
21 [email protected] "("
22 [email protected] ")"
23 [email protected] " "
24 [email protected]
25 [email protected] "->"
26 [email protected] " "
27 [email protected]
28 [email protected] "("
29 [email protected] ")"
30 [email protected] ";"
31 [email protected] "\n"
32 [email protected]
33 [email protected] "type"
34 [email protected] " "
35 [email protected]
36 [email protected] "B"
37 [email protected] " "
38 [email protected] "="
39 [email protected] " "
40 [email protected]
41 [email protected] "for"
42 [email protected]
43 [email protected] "<"
44 [email protected]
45 [email protected] "\'a"
46 [email protected] ">"
47 [email protected] " "
48 [email protected]
49 [email protected] "unsafe"
50 [email protected] " "
51 [email protected]
52 [email protected] "extern"
53 [email protected] " "
54 [email protected] "\"C\""
55 [email protected] " "
56 [email protected] "fn"
57 [email protected]
58 [email protected] "("
59 [email protected]
60 [email protected]
61 [email protected] "&"
62 [email protected] "\'a"
63 [email protected] " "
64 [email protected]
65 [email protected] "("
66 [email protected] ")"
67 [email protected] ")"
68 [email protected] " "
69 [email protected]
70 [email protected] "->"
71 [email protected] " "
72 [email protected]
73 [email protected] "("
74 [email protected] ")"
75 [email protected] ";"
76 [email protected] "\n"
77 [email protected]
78 [email protected] "type"
79 [email protected] " "
80 [email protected]
81 [email protected] "Obj"
82 [email protected] " "
83 [email protected] "="
84 [email protected] " "
85 [email protected]
86 [email protected] "for"
87 [email protected]
88 [email protected] "<"
89 [email protected]
90 [email protected] "\'a"
91 [email protected] ">"
92 [email protected] " "
93 [email protected]
94 [email protected]
95 [email protected]
96 [email protected]
97 [email protected] "PartialEq"
98 [email protected]
99 [email protected] "<"
100 [email protected]
101 [email protected]
102 [email protected] "&"
103 [email protected] "\'a"
104 [email protected] " "
105 [email protected]
106 [email protected]
107 [email protected]
108 [email protected]
109 [email protected] "i32"
110 [email protected] ">"
111 [email protected] ";"
112 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0081_for_type.rs b/crates/syntax/test_data/parser/inline/ok/0081_for_type.rs
new file mode 100644
index 000000000..8ac7b9e10
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0081_for_type.rs
@@ -0,0 +1,3 @@
1type A = for<'a> fn() -> ();
2type B = for<'a> unsafe extern "C" fn(&'a ()) -> ();
3type Obj = for<'a> PartialEq<&'a i32>;
diff --git a/crates/syntax/test_data/parser/inline/ok/0082_ref_expr.rast b/crates/syntax/test_data/parser/inline/ok/0082_ref_expr.rast
new file mode 100644
index 000000000..70b975c0b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0082_ref_expr.rast
@@ -0,0 +1,138 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected] "// reference operator"
15 [email protected] "\n "
16 [email protected]
17 [email protected] "let"
18 [email protected] " "
19 [email protected]
20 [email protected] "_"
21 [email protected] " "
22 [email protected] "="
23 [email protected] " "
24 [email protected]
25 [email protected] "&"
26 [email protected]
27 [email protected] "1"
28 [email protected] ";"
29 [email protected] "\n "
30 [email protected]
31 [email protected] "let"
32 [email protected] " "
33 [email protected]
34 [email protected] "_"
35 [email protected] " "
36 [email protected] "="
37 [email protected] " "
38 [email protected]
39 [email protected] "&"
40 [email protected] "mut"
41 [email protected] " "
42 [email protected]
43 [email protected] "&"
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "f"
50 [email protected]
51 [email protected] "("
52 [email protected] ")"
53 [email protected] ";"
54 [email protected] "\n "
55 [email protected]
56 [email protected] "let"
57 [email protected] " "
58 [email protected]
59 [email protected] "_"
60 [email protected] " "
61 [email protected] "="
62 [email protected] " "
63 [email protected]
64 [email protected] "&"
65 [email protected]
66 [email protected]
67 [email protected]
68 [email protected]
69 [email protected] "raw"
70 [email protected] ";"
71 [email protected] "\n "
72 [email protected]
73 [email protected] "let"
74 [email protected] " "
75 [email protected]
76 [email protected] "_"
77 [email protected] " "
78 [email protected] "="
79 [email protected] " "
80 [email protected]
81 [email protected] "&"
82 [email protected]
83 [email protected]
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected] "raw"
88 [email protected] "."
89 [email protected]
90 [email protected] "0"
91 [email protected] ";"
92 [email protected] "\n "
93 [email protected] "// raw reference oper ..."
94 [email protected] "\n "
95 [email protected]
96 [email protected] "let"
97 [email protected] " "
98 [email protected]
99 [email protected] "_"
100 [email protected] " "
101 [email protected] "="
102 [email protected] " "
103 [email protected]
104 [email protected] "&"
105 [email protected] "raw"
106 [email protected] " "
107 [email protected] "mut"
108 [email protected] " "
109 [email protected]
110 [email protected]
111 [email protected]
112 [email protected]
113 [email protected] "foo"
114 [email protected] ";"
115 [email protected] "\n "
116 [email protected]
117 [email protected] "let"
118 [email protected] " "
119 [email protected]
120 [email protected] "_"
121 [email protected] " "
122 [email protected] "="
123 [email protected] " "
124 [email protected]
125 [email protected] "&"
126 [email protected] "raw"
127 [email protected] " "
128 [email protected] "const"
129 [email protected] " "
130 [email protected]
131 [email protected]
132 [email protected]
133 [email protected]
134 [email protected] "foo"
135 [email protected] ";"
136 [email protected] "\n"
137 [email protected] "}"
138 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0082_ref_expr.rs b/crates/syntax/test_data/parser/inline/ok/0082_ref_expr.rs
new file mode 100644
index 000000000..c5262f446
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0082_ref_expr.rs
@@ -0,0 +1,10 @@
1fn foo() {
2 // reference operator
3 let _ = &1;
4 let _ = &mut &f();
5 let _ = &raw;
6 let _ = &raw.0;
7 // raw reference operator
8 let _ = &raw mut foo;
9 let _ = &raw const foo;
10}
diff --git a/crates/syntax/test_data/parser/inline/ok/0083_struct_items.rast b/crates/syntax/test_data/parser/inline/ok/0083_struct_items.rast
new file mode 100644
index 000000000..cdbc40fe0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0083_struct_items.rast
@@ -0,0 +1,87 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "Foo"
7 [email protected] ";"
8 [email protected] "\n"
9 [email protected]
10 [email protected] "struct"
11 [email protected] " "
12 [email protected]
13 [email protected] "Foo"
14 [email protected] " "
15 [email protected]
16 [email protected] "{"
17 [email protected] "}"
18 [email protected] "\n"
19 [email protected]
20 [email protected] "struct"
21 [email protected] " "
22 [email protected]
23 [email protected] "Foo"
24 [email protected]
25 [email protected] "("
26 [email protected] ")"
27 [email protected] ";"
28 [email protected] "\n"
29 [email protected]
30 [email protected] "struct"
31 [email protected] " "
32 [email protected]
33 [email protected] "Foo"
34 [email protected]
35 [email protected] "("
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "String"
42 [email protected] ","
43 [email protected] " "
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "usize"
50 [email protected] ")"
51 [email protected] ";"
52 [email protected] "\n"
53 [email protected]
54 [email protected] "struct"
55 [email protected] " "
56 [email protected]
57 [email protected] "Foo"
58 [email protected] " "
59 [email protected]
60 [email protected] "{"
61 [email protected] "\n "
62 [email protected]
63 [email protected]
64 [email protected] "a"
65 [email protected] ":"
66 [email protected] " "
67 [email protected]
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected] "i32"
72 [email protected] ","
73 [email protected] "\n "
74 [email protected]
75 [email protected]
76 [email protected] "b"
77 [email protected] ":"
78 [email protected] " "
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected]
83 [email protected] "f32"
84 [email protected] ","
85 [email protected] "\n"
86 [email protected] "}"
87 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0083_struct_items.rs b/crates/syntax/test_data/parser/inline/ok/0083_struct_items.rs
new file mode 100644
index 000000000..693e3f3ee
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0083_struct_items.rs
@@ -0,0 +1,8 @@
1struct Foo;
2struct Foo {}
3struct Foo();
4struct Foo(String, usize);
5struct Foo {
6 a: i32,
7 b: f32,
8}
diff --git a/crates/syntax/test_data/parser/inline/ok/0084_paren_type.rast b/crates/syntax/test_data/parser/inline/ok/0084_paren_type.rast
new file mode 100644
index 000000000..ee8894966
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0084_paren_type.rast
@@ -0,0 +1,19 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "("
12 [email protected]
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected] "i32"
17 [email protected] ")"
18 [email protected] ";"
19 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0084_paren_type.rs b/crates/syntax/test_data/parser/inline/ok/0084_paren_type.rs
new file mode 100644
index 000000000..6e1b25101
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0084_paren_type.rs
@@ -0,0 +1 @@
type T = (i32);
diff --git a/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast b/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast
new file mode 100644
index 000000000..9a87b5b93
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast
@@ -0,0 +1,135 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "_"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected] "true"
24 [email protected] ";"
25 [email protected] "\n "
26 [email protected]
27 [email protected] "let"
28 [email protected] " "
29 [email protected]
30 [email protected] "_"
31 [email protected] " "
32 [email protected] "="
33 [email protected] " "
34 [email protected]
35 [email protected] "false"
36 [email protected] ";"
37 [email protected] "\n "
38 [email protected]
39 [email protected] "let"
40 [email protected] " "
41 [email protected]
42 [email protected] "_"
43 [email protected] " "
44 [email protected] "="
45 [email protected] " "
46 [email protected]
47 [email protected] "1"
48 [email protected] ";"
49 [email protected] "\n "
50 [email protected]
51 [email protected] "let"
52 [email protected] " "
53 [email protected]
54 [email protected] "_"
55 [email protected] " "
56 [email protected] "="
57 [email protected] " "
58 [email protected]
59 [email protected] "2.0"
60 [email protected] ";"
61 [email protected] "\n "
62 [email protected]
63 [email protected] "let"
64 [email protected] " "
65 [email protected]
66 [email protected] "_"
67 [email protected] " "
68 [email protected] "="
69 [email protected] " "
70 [email protected]
71 [email protected] "b\'a\'"
72 [email protected] ";"
73 [email protected] "\n "
74 [email protected]
75 [email protected] "let"
76 [email protected] " "
77 [email protected]
78 [email protected] "_"
79 [email protected] " "
80 [email protected] "="
81 [email protected] " "
82 [email protected]
83 [email protected] "\'b\'"
84 [email protected] ";"
85 [email protected] "\n "
86 [email protected]
87 [email protected] "let"
88 [email protected] " "
89 [email protected]
90 [email protected] "_"
91 [email protected] " "
92 [email protected] "="
93 [email protected] " "
94 [email protected]
95 [email protected] "\"c\""
96 [email protected] ";"
97 [email protected] "\n "
98 [email protected]
99 [email protected] "let"
100 [email protected] " "
101 [email protected]
102 [email protected] "_"
103 [email protected] " "
104 [email protected] "="
105 [email protected] " "
106 [email protected]
107 [email protected] "r\"d\""
108 [email protected] ";"
109 [email protected] "\n "
110 [email protected]
111 [email protected] "let"
112 [email protected] " "
113 [email protected]
114 [email protected] "_"
115 [email protected] " "
116 [email protected] "="
117 [email protected] " "
118 [email protected]
119 [email protected] "b\"e\""
120 [email protected] ";"
121 [email protected] "\n "
122 [email protected]
123 [email protected] "let"
124 [email protected] " "
125 [email protected]
126 [email protected] "_"
127 [email protected] " "
128 [email protected] "="
129 [email protected] " "
130 [email protected]
131 [email protected] "br\"f\""
132 [email protected] ";"
133 [email protected] "\n"
134 [email protected] "}"
135 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rs b/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rs
new file mode 100644
index 000000000..2e11a5a6e
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rs
@@ -0,0 +1,12 @@
1fn foo() {
2 let _ = true;
3 let _ = false;
4 let _ = 1;
5 let _ = 2.0;
6 let _ = b'a';
7 let _ = 'b';
8 let _ = "c";
9 let _ = r"d";
10 let _ = b"e";
11 let _ = br"f";
12}
diff --git a/crates/syntax/test_data/parser/inline/ok/0086_function_ret_type.rast b/crates/syntax/test_data/parser/inline/ok/0086_function_ret_type.rast
new file mode 100644
index 000000000..70e05a859
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0086_function_ret_type.rast
@@ -0,0 +1,34 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "}"
14 [email protected] "\n"
15 [email protected]
16 [email protected] "fn"
17 [email protected] " "
18 [email protected]
19 [email protected] "bar"
20 [email protected]
21 [email protected] "("
22 [email protected] ")"
23 [email protected] " "
24 [email protected]
25 [email protected] "->"
26 [email protected] " "
27 [email protected]
28 [email protected] "("
29 [email protected] ")"
30 [email protected] " "
31 [email protected]
32 [email protected] "{"
33 [email protected] "}"
34 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0086_function_ret_type.rs b/crates/syntax/test_data/parser/inline/ok/0086_function_ret_type.rs
new file mode 100644
index 000000000..d22d8cada
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0086_function_ret_type.rs
@@ -0,0 +1,2 @@
1fn foo() {}
2fn bar() -> () {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0088_break_ambiguity.rast b/crates/syntax/test_data/parser/inline/ok/0088_break_ambiguity.rast
new file mode 100644
index 000000000..f7b839303
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0088_break_ambiguity.rast
@@ -0,0 +1,65 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected]
11 [email protected] "{"
12 [email protected] "\n "
13 [email protected]
14 [email protected]
15 [email protected] "if"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "break"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "}"
24 [email protected] "\n "
25 [email protected]
26 [email protected]
27 [email protected] "while"
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected] "break"
32 [email protected] " "
33 [email protected]
34 [email protected] "{"
35 [email protected] "}"
36 [email protected] "\n "
37 [email protected]
38 [email protected]
39 [email protected] "for"
40 [email protected] " "
41 [email protected]
42 [email protected]
43 [email protected] "i"
44 [email protected] " "
45 [email protected] "in"
46 [email protected] " "
47 [email protected]
48 [email protected] "break"
49 [email protected] " "
50 [email protected]
51 [email protected] "{"
52 [email protected] "}"
53 [email protected] "\n "
54 [email protected]
55 [email protected] "match"
56 [email protected] " "
57 [email protected]
58 [email protected] "break"
59 [email protected] " "
60 [email protected]
61 [email protected] "{"
62 [email protected] "}"
63 [email protected] "\n"
64 [email protected] "}"
65 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0088_break_ambiguity.rs b/crates/syntax/test_data/parser/inline/ok/0088_break_ambiguity.rs
new file mode 100644
index 000000000..560eb05b9
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0088_break_ambiguity.rs
@@ -0,0 +1,6 @@
1fn foo(){
2 if break {}
3 while break {}
4 for i in break {}
5 match break {}
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0090_type_param_default.rast b/crates/syntax/test_data/parser/inline/ok/0090_type_param_default.rast
new file mode 100644
index 000000000..2ef026e37
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0090_type_param_default.rast
@@ -0,0 +1,22 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] " "
13 [email protected] "="
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "i32"
20 [email protected] ">"
21 [email protected] ";"
22 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0090_type_param_default.rs b/crates/syntax/test_data/parser/inline/ok/0090_type_param_default.rs
new file mode 100644
index 000000000..540eacb02
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0090_type_param_default.rs
@@ -0,0 +1 @@
struct S<T = i32>;
diff --git a/crates/syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast b/crates/syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast
new file mode 100644
index 000000000..f80326465
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast
@@ -0,0 +1,23 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "F"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "fn"
12 [email protected]
13 [email protected] "("
14 [email protected] ")"
15 [email protected] " "
16 [email protected]
17 [email protected] "->"
18 [email protected] " "
19 [email protected]
20 [email protected] "("
21 [email protected] ")"
22 [email protected] ";"
23 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rs b/crates/syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rs
new file mode 100644
index 000000000..e3ba5e87f
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rs
@@ -0,0 +1 @@
type F = fn() -> ();
diff --git a/crates/syntax/test_data/parser/inline/ok/0093_index_expr.rast b/crates/syntax/test_data/parser/inline/ok/0093_index_expr.rast
new file mode 100644
index 000000000..82f03f9c1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0093_index_expr.rast
@@ -0,0 +1,33 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "x"
22 [email protected] "["
23 [email protected]
24 [email protected] "1"
25 [email protected] "]"
26 [email protected] "["
27 [email protected]
28 [email protected] "2"
29 [email protected] "]"
30 [email protected] ";"
31 [email protected] "\n"
32 [email protected] "}"
33 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0093_index_expr.rs b/crates/syntax/test_data/parser/inline/ok/0093_index_expr.rs
new file mode 100644
index 000000000..b9ba78a6c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0093_index_expr.rs
@@ -0,0 +1,3 @@
1fn foo() {
2 x[1][2];
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast b/crates/syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast
new file mode 100644
index 000000000..c1fdc6e25
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast
@@ -0,0 +1,28 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "_"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected] "("
24 [email protected] ")"
25 [email protected] ";"
26 [email protected] " "
27 [email protected] "}"
28 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0095_placeholder_pat.rs b/crates/syntax/test_data/parser/inline/ok/0095_placeholder_pat.rs
new file mode 100644
index 000000000..4d719c433
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0095_placeholder_pat.rs
@@ -0,0 +1 @@
fn main() { let _ = (); }
diff --git a/crates/syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast b/crates/syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast
new file mode 100644
index 000000000..e757249f0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast
@@ -0,0 +1,123 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "if"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected] "true"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] "\n "
26 [email protected]
27 [email protected]
28 [email protected] "loop"
29 [email protected] " "
30 [email protected]
31 [email protected] "{"
32 [email protected] "}"
33 [email protected] "\n "
34 [email protected]
35 [email protected]
36 [email protected] "match"
37 [email protected] " "
38 [email protected]
39 [email protected] "("
40 [email protected] ")"
41 [email protected] " "
42 [email protected]
43 [email protected] "{"
44 [email protected] "}"
45 [email protected] "\n "
46 [email protected]
47 [email protected]
48 [email protected] "while"
49 [email protected] " "
50 [email protected]
51 [email protected]
52 [email protected] "true"
53 [email protected] " "
54 [email protected]
55 [email protected] "{"
56 [email protected] "}"
57 [email protected] "\n "
58 [email protected]
59 [email protected]
60 [email protected] "for"
61 [email protected] " "
62 [email protected]
63 [email protected] "_"
64 [email protected] " "
65 [email protected] "in"
66 [email protected] " "
67 [email protected]
68 [email protected] "("
69 [email protected] ")"
70 [email protected] " "
71 [email protected]
72 [email protected] "{"
73 [email protected] "}"
74 [email protected] "\n "
75 [email protected]
76 [email protected]
77 [email protected] "{"
78 [email protected] "}"
79 [email protected] "\n "
80 [email protected]
81 [email protected]
82 [email protected] "{"
83 [email protected] "}"
84 [email protected] "\n "
85 [email protected]
86 [email protected]
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected] "macro_rules"
91 [email protected] "!"
92 [email protected] " "
93 [email protected]
94 [email protected] "test"
95 [email protected] " "
96 [email protected]
97 [email protected] "{"
98 [email protected] "\n "
99 [email protected]
100 [email protected] "("
101 [email protected] ")"
102 [email protected] " "
103 [email protected] "="
104 [email protected] ">"
105 [email protected] " "
106 [email protected]
107 [email protected] "{"
108 [email protected] "}"
109 [email protected] "\n "
110 [email protected] "}"
111 [email protected] "\n "
112 [email protected]
113 [email protected]
114 [email protected]
115 [email protected]
116 [email protected] "test"
117 [email protected] "!"
118 [email protected]
119 [email protected] "{"
120 [email protected] "}"
121 [email protected] "\n"
122 [email protected] "}"
123 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rs b/crates/syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rs
new file mode 100644
index 000000000..4919665cb
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rs
@@ -0,0 +1,13 @@
1fn foo() {
2 if true {}
3 loop {}
4 match () {}
5 while true {}
6 for _ in () {}
7 {}
8 {}
9 macro_rules! test {
10 () => {}
11 }
12 test!{}
13}
diff --git a/crates/syntax/test_data/parser/inline/ok/0099_param_list.rast b/crates/syntax/test_data/parser/inline/ok/0099_param_list.rast
new file mode 100644
index 000000000..f19e9fd52
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0099_param_list.rast
@@ -0,0 +1,99 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "a"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "}"
14 [email protected] "\n"
15 [email protected]
16 [email protected] "fn"
17 [email protected] " "
18 [email protected]
19 [email protected] "b"
20 [email protected]
21 [email protected] "("
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "x"
26 [email protected] ":"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "i32"
33 [email protected] ")"
34 [email protected] " "
35 [email protected]
36 [email protected] "{"
37 [email protected] "}"
38 [email protected] "\n"
39 [email protected]
40 [email protected] "fn"
41 [email protected] " "
42 [email protected]
43 [email protected] "c"
44 [email protected]
45 [email protected] "("
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "x"
50 [email protected] ":"
51 [email protected] " "
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected] "i32"
57 [email protected] ","
58 [email protected] " "
59 [email protected] ")"
60 [email protected] " "
61 [email protected]
62 [email protected] "{"
63 [email protected] "}"
64 [email protected] "\n"
65 [email protected]
66 [email protected] "fn"
67 [email protected] " "
68 [email protected]
69 [email protected] "d"
70 [email protected]
71 [email protected] "("
72 [email protected]
73 [email protected]
74 [email protected]
75 [email protected] "x"
76 [email protected] ":"
77 [email protected] " "
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected] "i32"
83 [email protected] ","
84 [email protected] " "
85 [email protected]
86 [email protected]
87 [email protected]
88 [email protected] "y"
89 [email protected] ":"
90 [email protected] " "
91 [email protected]
92 [email protected] "("
93 [email protected] ")"
94 [email protected] ")"
95 [email protected] " "
96 [email protected]
97 [email protected] "{"
98 [email protected] "}"
99 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0099_param_list.rs b/crates/syntax/test_data/parser/inline/ok/0099_param_list.rs
new file mode 100644
index 000000000..9d55bedbb
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0099_param_list.rs
@@ -0,0 +1,4 @@
1fn a() {}
2fn b(x: i32) {}
3fn c(x: i32, ) {}
4fn d(x: i32, y: ()) {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0100_for_expr.rast b/crates/syntax/test_data/parser/inline/ok/0100_for_expr.rast
new file mode 100644
index 000000000..5c4055e44
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0100_for_expr.rast
@@ -0,0 +1,34 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "for"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected] "x"
21 [email protected] " "
22 [email protected] "in"
23 [email protected] " "
24 [email protected]
25 [email protected] "["
26 [email protected] "]"
27 [email protected] " "
28 [email protected]
29 [email protected] "{"
30 [email protected] "}"
31 [email protected] ";"
32 [email protected] "\n"
33 [email protected] "}"
34 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0100_for_expr.rs b/crates/syntax/test_data/parser/inline/ok/0100_for_expr.rs
new file mode 100644
index 000000000..972197d2a
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0100_for_expr.rs
@@ -0,0 +1,3 @@
1fn foo() {
2 for x in [] {};
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast b/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
new file mode 100644
index 000000000..866e60ed8
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
@@ -0,0 +1,132 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "S"
22 [email protected] " "
23 [email protected]
24 [email protected] "{"
25 [email protected] "}"
26 [email protected] " "
27 [email protected] "="
28 [email protected] " "
29 [email protected]
30 [email protected] "("
31 [email protected] ")"
32 [email protected] ";"
33 [email protected] "\n "
34 [email protected]
35 [email protected] "let"
36 [email protected] " "
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "S"
42 [email protected] " "
43 [email protected]
44 [email protected] "{"
45 [email protected] " "
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "f"
50 [email protected] ","
51 [email protected] " "
52 [email protected]
53 [email protected]
54 [email protected] "ref"
55 [email protected] " "
56 [email protected] "mut"
57 [email protected] " "
58 [email protected]
59 [email protected] "g"
60 [email protected] " "
61 [email protected] "}"
62 [email protected] " "
63 [email protected] "="
64 [email protected] " "
65 [email protected]
66 [email protected] "("
67 [email protected] ")"
68 [email protected] ";"
69 [email protected] "\n "
70 [email protected]
71 [email protected] "let"
72 [email protected] " "
73 [email protected]
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected] "S"
78 [email protected] " "
79 [email protected]
80 [email protected] "{"
81 [email protected] " "
82 [email protected]
83 [email protected]
84 [email protected] "h"
85 [email protected] ":"
86 [email protected] " "
87 [email protected]
88 [email protected] "_"
89 [email protected] ","
90 [email protected] " "
91 [email protected] ".."
92 [email protected] "}"
93 [email protected] " "
94 [email protected] "="
95 [email protected] " "
96 [email protected]
97 [email protected] "("
98 [email protected] ")"
99 [email protected] ";"
100 [email protected] "\n "
101 [email protected]
102 [email protected] "let"
103 [email protected] " "
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected]
108 [email protected] "S"
109 [email protected] " "
110 [email protected]
111 [email protected] "{"
112 [email protected] " "
113 [email protected]
114 [email protected]
115 [email protected] "h"
116 [email protected] ":"
117 [email protected] " "
118 [email protected]
119 [email protected] "_"
120 [email protected] ","
121 [email protected] " "
122 [email protected] "}"
123 [email protected] " "
124 [email protected] "="
125 [email protected] " "
126 [email protected]
127 [email protected] "("
128 [email protected] ")"
129 [email protected] ";"
130 [email protected] "\n"
131 [email protected] "}"
132 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rs b/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rs
new file mode 100644
index 000000000..da3412fa8
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 let S {} = ();
3 let S { f, ref mut g } = ();
4 let S { h: _, ..} = ();
5 let S { h: _, } = ();
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0103_array_expr.rast b/crates/syntax/test_data/parser/inline/ok/0103_array_expr.rast
new file mode 100644
index 000000000..c4c0a0568
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0103_array_expr.rast
@@ -0,0 +1,54 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "["
17 [email protected] "]"
18 [email protected] ";"
19 [email protected] "\n "
20 [email protected]
21 [email protected]
22 [email protected] "["
23 [email protected]
24 [email protected] "1"
25 [email protected] "]"
26 [email protected] ";"
27 [email protected] "\n "
28 [email protected]
29 [email protected]
30 [email protected] "["
31 [email protected]
32 [email protected] "1"
33 [email protected] ","
34 [email protected] " "
35 [email protected]
36 [email protected] "2"
37 [email protected] ","
38 [email protected] "]"
39 [email protected] ";"
40 [email protected] "\n "
41 [email protected]
42 [email protected]
43 [email protected] "["
44 [email protected]
45 [email protected] "1"
46 [email protected] ";"
47 [email protected] " "
48 [email protected]
49 [email protected] "2"
50 [email protected] "]"
51 [email protected] ";"
52 [email protected] "\n"
53 [email protected] "}"
54 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0103_array_expr.rs b/crates/syntax/test_data/parser/inline/ok/0103_array_expr.rs
new file mode 100644
index 000000000..4dc1999d1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0103_array_expr.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 [];
3 [1];
4 [1, 2,];
5 [1; 2];
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast b/crates/syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast
new file mode 100644
index 000000000..1244a5031
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast
@@ -0,0 +1,41 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "F"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected] "Box"
15 [email protected]
16 [email protected] "<"
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "Fn"
23 [email protected]
24 [email protected] "("
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "i32"
31 [email protected] ")"
32 [email protected] " "
33 [email protected]
34 [email protected] "->"
35 [email protected] " "
36 [email protected]
37 [email protected] "("
38 [email protected] ")"
39 [email protected] ">"
40 [email protected] ";"
41 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rs b/crates/syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rs
new file mode 100644
index 000000000..17ed20e5b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rs
@@ -0,0 +1 @@
type F = Box<Fn(i32) -> ()>;
diff --git a/crates/syntax/test_data/parser/inline/ok/0106_lambda_expr.rast b/crates/syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
new file mode 100644
index 000000000..9b8381619
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
@@ -0,0 +1,135 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "|"
18 [email protected] "|"
19 [email protected] " "
20 [email protected]
21 [email protected] "("
22 [email protected] ")"
23 [email protected] ";"
24 [email protected] "\n "
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected] "|"
29 [email protected] "|"
30 [email protected] " "
31 [email protected]
32 [email protected] "->"
33 [email protected] " "
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected] "i32"
39 [email protected] " "
40 [email protected]
41 [email protected] "{"
42 [email protected] " "
43 [email protected]
44 [email protected] "92"
45 [email protected] " "
46 [email protected] "}"
47 [email protected] ";"
48 [email protected] "\n "
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected] "|"
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected] "x"
57 [email protected] "|"
58 [email protected] " "
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected] "x"
64 [email protected] ";"
65 [email protected] "\n "
66 [email protected]
67 [email protected]
68 [email protected] "move"
69 [email protected] " "
70 [email protected]
71 [email protected] "|"
72 [email protected]
73 [email protected]
74 [email protected]
75 [email protected] "x"
76 [email protected] ":"
77 [email protected] " "
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected] "i32"
83 [email protected] ","
84 [email protected] "|"
85 [email protected] " "
86 [email protected]
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected] "x"
91 [email protected] ";"
92 [email protected] "\n "
93 [email protected]
94 [email protected]
95 [email protected] "async"
96 [email protected] " "
97 [email protected]
98 [email protected] "|"
99 [email protected] "|"
100 [email protected] " "
101 [email protected]
102 [email protected] "{"
103 [email protected] "}"
104 [email protected] ";"
105 [email protected] "\n "
106 [email protected]
107 [email protected]
108 [email protected] "move"
109 [email protected] " "
110 [email protected]
111 [email protected] "|"
112 [email protected] "|"
113 [email protected] " "
114 [email protected]
115 [email protected] "{"
116 [email protected] "}"
117 [email protected] ";"
118 [email protected] "\n "
119 [email protected]
120 [email protected]
121 [email protected] "async"
122 [email protected] " "
123 [email protected] "move"
124 [email protected] " "
125 [email protected]
126 [email protected] "|"
127 [email protected] "|"
128 [email protected] " "
129 [email protected]
130 [email protected] "{"
131 [email protected] "}"
132 [email protected] ";"
133 [email protected] "\n"
134 [email protected] "}"
135 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0106_lambda_expr.rs b/crates/syntax/test_data/parser/inline/ok/0106_lambda_expr.rs
new file mode 100644
index 000000000..075717823
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0106_lambda_expr.rs
@@ -0,0 +1,9 @@
1fn foo() {
2 || ();
3 || -> i32 { 92 };
4 |x| x;
5 move |x: i32,| x;
6 async || {};
7 move || {};
8 async move || {};
9}
diff --git a/crates/syntax/test_data/parser/inline/ok/0107_method_call_expr.rast b/crates/syntax/test_data/parser/inline/ok/0107_method_call_expr.rast
new file mode 100644
index 000000000..be8365e05
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0107_method_call_expr.rast
@@ -0,0 +1,62 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "x"
21 [email protected] "."
22 [email protected]
23 [email protected] "foo"
24 [email protected]
25 [email protected] "("
26 [email protected] ")"
27 [email protected] ";"
28 [email protected] "\n "
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected] "y"
36 [email protected] "."
37 [email protected]
38 [email protected] "bar"
39 [email protected]
40 [email protected] "::"
41 [email protected] "<"
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected] "T"
48 [email protected] ">"
49 [email protected]
50 [email protected] "("
51 [email protected]
52 [email protected] "1"
53 [email protected] ","
54 [email protected] " "
55 [email protected]
56 [email protected] "2"
57 [email protected] ","
58 [email protected] ")"
59 [email protected] ";"
60 [email protected] "\n"
61 [email protected] "}"
62 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0107_method_call_expr.rs b/crates/syntax/test_data/parser/inline/ok/0107_method_call_expr.rs
new file mode 100644
index 000000000..1a3aa35ae
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0107_method_call_expr.rs
@@ -0,0 +1,4 @@
1fn foo() {
2 x.foo();
3 y.bar::<T>(1, 2,);
4}
diff --git a/crates/syntax/test_data/parser/inline/ok/0108_tuple_expr.rast b/crates/syntax/test_data/parser/inline/ok/0108_tuple_expr.rast
new file mode 100644
index 000000000..ca7e4a5c3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0108_tuple_expr.rast
@@ -0,0 +1,38 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "("
17 [email protected] ")"
18 [email protected] ";"
19 [email protected] "\n "
20 [email protected]
21 [email protected]
22 [email protected] "("
23 [email protected]
24 [email protected] "1"
25 [email protected] ")"
26 [email protected] ";"
27 [email protected] "\n "
28 [email protected]
29 [email protected]
30 [email protected] "("
31 [email protected]
32 [email protected] "1"
33 [email protected] ","
34 [email protected] ")"
35 [email protected] ";"
36 [email protected] "\n"
37 [email protected] "}"
38 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0108_tuple_expr.rs b/crates/syntax/test_data/parser/inline/ok/0108_tuple_expr.rs
new file mode 100644
index 000000000..e4f774280
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0108_tuple_expr.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 ();
3 (1);
4 (1,);
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0109_label.rast b/crates/syntax/test_data/parser/inline/ok/0109_label.rast
new file mode 100644
index 000000000..c9588025c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0109_label.rast
@@ -0,0 +1,64 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "\'a"
18 [email protected] ":"
19 [email protected] " "
20 [email protected] "loop"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] "\n "
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "\'b"
30 [email protected] ":"
31 [email protected] " "
32 [email protected] "while"
33 [email protected] " "
34 [email protected]
35 [email protected]
36 [email protected] "true"
37 [email protected] " "
38 [email protected]
39 [email protected] "{"
40 [email protected] "}"
41 [email protected] "\n "
42 [email protected]
43 [email protected]
44 [email protected] "\'c"
45 [email protected] ":"
46 [email protected] " "
47 [email protected] "for"
48 [email protected] " "
49 [email protected]
50 [email protected]
51 [email protected] "x"
52 [email protected] " "
53 [email protected] "in"
54 [email protected] " "
55 [email protected]
56 [email protected] "("
57 [email protected] ")"
58 [email protected] " "
59 [email protected]
60 [email protected] "{"
61 [email protected] "}"
62 [email protected] "\n"
63 [email protected] "}"
64 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0109_label.rs b/crates/syntax/test_data/parser/inline/ok/0109_label.rs
new file mode 100644
index 000000000..48e83f263
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0109_label.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 'a: loop {}
3 'b: while true {}
4 'c: for x in () {}
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast b/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast
new file mode 100644
index 000000000..82028096f
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast
@@ -0,0 +1,38 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected] "::"
9 [email protected]
10 [email protected] "crate_name"
11 [email protected] ";"
12 [email protected] " "
13 [email protected] "// Rust 2018 - All fl ..."
14 [email protected] "\n"
15 [email protected]
16 [email protected] "use"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "crate_name"
23 [email protected] ";"
24 [email protected] " "
25 [email protected] "// Rust 2018 - Anchor ..."
26 [email protected] "\n"
27 [email protected]
28 [email protected] "use"
29 [email protected] " "
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "item_in_scope_or_crat ..."
35 [email protected] ";"
36 [email protected] " "
37 [email protected] "// Rust 2018 - Unifor ..."
38 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0110_use_path.rs b/crates/syntax/test_data/parser/inline/ok/0110_use_path.rs
new file mode 100644
index 000000000..328e94736
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0110_use_path.rs
@@ -0,0 +1,3 @@
1use ::crate_name; // Rust 2018 - All flavours
2use crate_name; // Rust 2018 - Anchored paths
3use item_in_scope_or_crate_name; // Rust 2018 - Uniform Paths
diff --git a/crates/syntax/test_data/parser/inline/ok/0111_tuple_pat.rast b/crates/syntax/test_data/parser/inline/ok/0111_tuple_pat.rast
new file mode 100644
index 000000000..b82ed0230
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0111_tuple_pat.rast
@@ -0,0 +1,89 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "("
19 [email protected]
20 [email protected]
21 [email protected] "a"
22 [email protected] ","
23 [email protected] " "
24 [email protected]
25 [email protected]
26 [email protected] "b"
27 [email protected] ","
28 [email protected] " "
29 [email protected]
30 [email protected] ".."
31 [email protected] ")"
32 [email protected] " "
33 [email protected] "="
34 [email protected] " "
35 [email protected]
36 [email protected] "("
37 [email protected] ")"
38 [email protected] ";"
39 [email protected] "\n "
40 [email protected]
41 [email protected] "let"
42 [email protected] " "
43 [email protected]
44 [email protected] "("
45 [email protected]
46 [email protected]
47 [email protected] "a"
48 [email protected] ","
49 [email protected] ")"
50 [email protected] " "
51 [email protected] "="
52 [email protected] " "
53 [email protected]
54 [email protected] "("
55 [email protected] ")"
56 [email protected] ";"
57 [email protected] "\n "
58 [email protected]
59 [email protected] "let"
60 [email protected] " "
61 [email protected]
62 [email protected] "("
63 [email protected]
64 [email protected] ".."
65 [email protected] ")"
66 [email protected] " "
67 [email protected] "="
68 [email protected] " "
69 [email protected]
70 [email protected] "("
71 [email protected] ")"
72 [email protected] ";"
73 [email protected] "\n "
74 [email protected]
75 [email protected] "let"
76 [email protected] " "
77 [email protected]
78 [email protected] "("
79 [email protected] ")"
80 [email protected] " "
81 [email protected] "="
82 [email protected] " "
83 [email protected]
84 [email protected] "("
85 [email protected] ")"
86 [email protected] ";"
87 [email protected] "\n"
88 [email protected] "}"
89 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0111_tuple_pat.rs b/crates/syntax/test_data/parser/inline/ok/0111_tuple_pat.rs
new file mode 100644
index 000000000..ba719879d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0111_tuple_pat.rs
@@ -0,0 +1,6 @@
1fn main() {
2 let (a, b, ..) = ();
3 let (a,) = ();
4 let (..) = ();
5 let () = ();
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0112_bind_pat.rast b/crates/syntax/test_data/parser/inline/ok/0112_bind_pat.rast
new file mode 100644
index 000000000..7b9a498c8
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0112_bind_pat.rast
@@ -0,0 +1,127 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "a"
20 [email protected] " "
21 [email protected] "="
22 [email protected] " "
23 [email protected]
24 [email protected] "("
25 [email protected] ")"
26 [email protected] ";"
27 [email protected] "\n "
28 [email protected]
29 [email protected] "let"
30 [email protected] " "
31 [email protected]
32 [email protected] "mut"
33 [email protected] " "
34 [email protected]
35 [email protected] "b"
36 [email protected] " "
37 [email protected] "="
38 [email protected] " "
39 [email protected]
40 [email protected] "("
41 [email protected] ")"
42 [email protected] ";"
43 [email protected] "\n "
44 [email protected]
45 [email protected] "let"
46 [email protected] " "
47 [email protected]
48 [email protected] "ref"
49 [email protected] " "
50 [email protected]
51 [email protected] "c"
52 [email protected] " "
53 [email protected] "="
54 [email protected] " "
55 [email protected]
56 [email protected] "("
57 [email protected] ")"
58 [email protected] ";"
59 [email protected] "\n "
60 [email protected]
61 [email protected] "let"
62 [email protected] " "
63 [email protected]
64 [email protected] "ref"
65 [email protected] " "
66 [email protected] "mut"
67 [email protected] " "
68 [email protected]
69 [email protected] "d"
70 [email protected] " "
71 [email protected] "="
72 [email protected] " "
73 [email protected]
74 [email protected] "("
75 [email protected] ")"
76 [email protected] ";"
77 [email protected] "\n "
78 [email protected]
79 [email protected] "let"
80 [email protected] " "
81 [email protected]
82 [email protected]
83 [email protected] "e"
84 [email protected] " "
85 [email protected] "@"
86 [email protected] " "
87 [email protected]
88 [email protected] "_"
89 [email protected] " "
90 [email protected] "="
91 [email protected] " "
92 [email protected]
93 [email protected] "("
94 [email protected] ")"
95 [email protected] ";"
96 [email protected] "\n "
97 [email protected]
98 [email protected] "let"
99 [email protected] " "
100 [email protected]
101 [email protected] "ref"
102 [email protected] " "
103 [email protected] "mut"
104 [email protected] " "
105 [email protected]
106 [email protected] "f"
107 [email protected] " "
108 [email protected] "@"
109 [email protected] " "
110 [email protected]
111 [email protected]
112 [email protected] "g"
113 [email protected] " "
114 [email protected] "@"
115 [email protected] " "
116 [email protected]
117 [email protected] "_"
118 [email protected] " "
119 [email protected] "="
120 [email protected] " "
121 [email protected]
122 [email protected] "("
123 [email protected] ")"
124 [email protected] ";"
125 [email protected] "\n"
126 [email protected] "}"
127 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0112_bind_pat.rs b/crates/syntax/test_data/parser/inline/ok/0112_bind_pat.rs
new file mode 100644
index 000000000..820a9e72c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0112_bind_pat.rs
@@ -0,0 +1,8 @@
1fn main() {
2 let a = ();
3 let mut b = ();
4 let ref c = ();
5 let ref mut d = ();
6 let e @ _ = ();
7 let ref mut f @ g @ _ = ();
8}
diff --git a/crates/syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast b/crates/syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast
new file mode 100644
index 000000000..d761c1c68
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast
@@ -0,0 +1,55 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected]
11 [email protected] "{"
12 [email protected] "\n "
13 [email protected] ";"
14 [email protected] ";"
15 [email protected] ";"
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "some_expr"
23 [email protected]
24 [email protected] "("
25 [email protected] ")"
26 [email protected] ";"
27 [email protected] ";"
28 [email protected] ";"
29 [email protected] ";"
30 [email protected]
31 [email protected]
32 [email protected] "{"
33 [email protected] ";"
34 [email protected] ";"
35 [email protected] ";"
36 [email protected] "}"
37 [email protected] ";"
38 [email protected] ";"
39 [email protected] ";"
40 [email protected] ";"
41 [email protected]
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected] "Ok"
47 [email protected]
48 [email protected] "("
49 [email protected]
50 [email protected] "("
51 [email protected] ")"
52 [email protected] ")"
53 [email protected] "\n"
54 [email protected] "}"
55 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0113_nocontentexpr.rs b/crates/syntax/test_data/parser/inline/ok/0113_nocontentexpr.rs
new file mode 100644
index 000000000..bbf09e367
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0113_nocontentexpr.rs
@@ -0,0 +1,3 @@
1fn foo(){
2 ;;;some_expr();;;;{;;;};;;;Ok(())
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast b/crates/syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast
new file mode 100644
index 000000000..0e1594dc4
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast
@@ -0,0 +1,64 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "Test"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ">"
13 [email protected]
14 [email protected] "("
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "T"
21 [email protected] ")"
22 [email protected] " "
23 [email protected]
24 [email protected] "where"
25 [email protected] " "
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "T"
32 [email protected] ":"
33 [email protected] " "
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected] "Clone"
41 [email protected] ";"
42 [email protected] "\n"
43 [email protected]
44 [email protected] "struct"
45 [email protected] " "
46 [email protected]
47 [email protected] "Test"
48 [email protected]
49 [email protected] "<"
50 [email protected]
51 [email protected]
52 [email protected] "T"
53 [email protected] ">"
54 [email protected]
55 [email protected] "("
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected] "T"
62 [email protected] ")"
63 [email protected] ";"
64 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rs b/crates/syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rs
new file mode 100644
index 000000000..ddd59016d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rs
@@ -0,0 +1,2 @@
1struct Test<T>(T) where T: Clone;
2struct Test<T>(T);
diff --git a/crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast b/crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast
new file mode 100644
index 000000000..4d09c9f50
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast
@@ -0,0 +1,41 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected] " "
8 [email protected]
9 [email protected] "("
10 [email protected] "\n "
11 [email protected]
12 [email protected]
13 [email protected] "#"
14 [email protected] "["
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "serde"
19 [email protected]
20 [email protected] "("
21 [email protected] "with"
22 [email protected] " "
23 [email protected] "="
24 [email protected] " "
25 [email protected] "\"url_serde\""
26 [email protected] ")"
27 [email protected] "]"
28 [email protected] "\n "
29 [email protected]
30 [email protected] "pub"
31 [email protected] " "
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected] "Uri"
37 [email protected] ","
38 [email protected] "\n"
39 [email protected] ")"
40 [email protected] ";"
41 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rs b/crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rs
new file mode 100644
index 000000000..635b9ac21
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rs
@@ -0,0 +1,4 @@
1struct S (
2 #[serde(with = "url_serde")]
3 pub Uri,
4);
diff --git a/crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rast b/crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rast
new file mode 100644
index 000000000..f3d4ad72c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rast
@@ -0,0 +1,43 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected] "foo"
15 [email protected] "!"
16 [email protected]
17 [email protected] "("
18 [email protected] ")"
19 [email protected] ";"
20 [email protected] "\n"
21 [email protected]
22 [email protected] "type"
23 [email protected] " "
24 [email protected]
25 [email protected] "B"
26 [email protected] " "
27 [email protected] "="
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "crate"
34 [email protected] "::"
35 [email protected]
36 [email protected]
37 [email protected] "foo"
38 [email protected] "!"
39 [email protected]
40 [email protected] "("
41 [email protected] ")"
42 [email protected] ";"
43 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rs b/crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rs
new file mode 100644
index 000000000..edb470c89
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0117_macro_call_type.rs
@@ -0,0 +1,2 @@
1type A = foo!();
2type B = crate::foo!();
diff --git a/crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast b/crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
new file mode 100644
index 000000000..141a7b203
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
@@ -0,0 +1,40 @@
1[email protected]
2 [email protected]
3 [email protected] "enum"
4 [email protected] " "
5 [email protected]
6 [email protected] "F"
7 [email protected]
8 [email protected] "{"
9 [email protected] "}"
10 [email protected] "\n"
11 [email protected]
12 [email protected] "impl"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "F"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] "\n "
23 [email protected] "//! This is a doc com ..."
24 [email protected] "\n "
25 [email protected]
26 [email protected] "#"
27 [email protected] "!"
28 [email protected] "["
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "doc"
33 [email protected]
34 [email protected] "("
35 [email protected] "\"This is also a doc c ..."
36 [email protected] ")"
37 [email protected] "]"
38 [email protected] "\n"
39 [email protected] "}"
40 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rs b/crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rs
new file mode 100644
index 000000000..4d68cceb7
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rs
@@ -0,0 +1,5 @@
1enum F{}
2impl F {
3 //! This is a doc comment
4 #![doc("This is also a doc comment")]
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0118_match_guard.rast b/crates/syntax/test_data/parser/inline/ok/0118_match_guard.rast
new file mode 100644
index 000000000..0cf4eb0a5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0118_match_guard.rast
@@ -0,0 +1,47 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "match"
16 [email protected] " "
17 [email protected]
18 [email protected] "("
19 [email protected] ")"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "\n "
24 [email protected]
25 [email protected]
26 [email protected] "_"
27 [email protected] " "
28 [email protected]
29 [email protected] "if"
30 [email protected] " "
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected] "foo"
36 [email protected] " "
37 [email protected] "=>"
38 [email protected] " "
39 [email protected]
40 [email protected] "("
41 [email protected] ")"
42 [email protected] ","
43 [email protected] "\n "
44 [email protected] "}"
45 [email protected] "\n"
46 [email protected] "}"
47 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0118_match_guard.rs b/crates/syntax/test_data/parser/inline/ok/0118_match_guard.rs
new file mode 100644
index 000000000..f1bd72fc4
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0118_match_guard.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 match () {
3 _ if foo => (),
4 }
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast b/crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast
new file mode 100644
index 000000000..ec7a00f1d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast
@@ -0,0 +1,80 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "match"
16 [email protected] " "
17 [email protected]
18 [email protected] "("
19 [email protected] ")"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "\n "
24 [email protected]
25 [email protected] "#"
26 [email protected] "!"
27 [email protected] "["
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "doc"
32 [email protected]
33 [email protected] "("
34 [email protected] "\"Inner attribute\""
35 [email protected] ")"
36 [email protected] "]"
37 [email protected] "\n "
38 [email protected]
39 [email protected] "#"
40 [email protected] "!"
41 [email protected] "["
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected] "doc"
46 [email protected]
47 [email protected] "("
48 [email protected] "\"Can be\""
49 [email protected] ")"
50 [email protected] "]"
51 [email protected] "\n "
52 [email protected]
53 [email protected] "#"
54 [email protected] "!"
55 [email protected] "["
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected] "doc"
60 [email protected]
61 [email protected] "("
62 [email protected] "\"Stacked\""
63 [email protected] ")"
64 [email protected] "]"
65 [email protected] "\n "
66 [email protected]
67 [email protected]
68 [email protected] "_"
69 [email protected] " "
70 [email protected] "=>"
71 [email protected] " "
72 [email protected]
73 [email protected] "("
74 [email protected] ")"
75 [email protected] ","
76 [email protected] "\n "
77 [email protected] "}"
78 [email protected] "\n"
79 [email protected] "}"
80 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rs b/crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rs
new file mode 100644
index 000000000..54a67c9d7
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rs
@@ -0,0 +1,8 @@
1fn foo() {
2 match () {
3 #![doc("Inner attribute")]
4 #![doc("Can be")]
5 #![doc("Stacked")]
6 _ => (),
7 }
8}
diff --git a/crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast b/crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast
new file mode 100644
index 000000000..97924da05
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast
@@ -0,0 +1,145 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "match"
16 [email protected] " "
17 [email protected]
18 [email protected] "("
19 [email protected] ")"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "\n "
24 [email protected]
25 [email protected]
26 [email protected] "#"
27 [email protected] "["
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "cfg"
32 [email protected]
33 [email protected] "("
34 [email protected] "feature"
35 [email protected] " "
36 [email protected] "="
37 [email protected] " "
38 [email protected] "\"some\""
39 [email protected] ")"
40 [email protected] "]"
41 [email protected] "\n "
42 [email protected]
43 [email protected] "_"
44 [email protected] " "
45 [email protected] "=>"
46 [email protected] " "
47 [email protected]
48 [email protected] "("
49 [email protected] ")"
50 [email protected] ","
51 [email protected] "\n "
52 [email protected]
53 [email protected]
54 [email protected] "#"
55 [email protected] "["
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected] "cfg"
60 [email protected]
61 [email protected] "("
62 [email protected] "feature"
63 [email protected] " "
64 [email protected] "="
65 [email protected] " "
66 [email protected] "\"other\""
67 [email protected] ")"
68 [email protected] "]"
69 [email protected] "\n "
70 [email protected]
71 [email protected] "_"
72 [email protected] " "
73 [email protected] "=>"
74 [email protected] " "
75 [email protected]
76 [email protected] "("
77 [email protected] ")"
78 [email protected] ","
79 [email protected] "\n "
80 [email protected]
81 [email protected]
82 [email protected] "#"
83 [email protected] "["
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected] "cfg"
88 [email protected]
89 [email protected] "("
90 [email protected] "feature"
91 [email protected] " "
92 [email protected] "="
93 [email protected] " "
94 [email protected] "\"many\""
95 [email protected] ")"
96 [email protected] "]"
97 [email protected] "\n "
98 [email protected]
99 [email protected] "#"
100 [email protected] "["
101 [email protected]
102 [email protected]
103 [email protected]
104 [email protected] "cfg"
105 [email protected]
106 [email protected] "("
107 [email protected] "feature"
108 [email protected] " "
109 [email protected] "="
110 [email protected] " "
111 [email protected] "\"attributes\""
112 [email protected] ")"
113 [email protected] "]"
114 [email protected] "\n "
115 [email protected]
116 [email protected] "#"
117 [email protected] "["
118 [email protected]
119 [email protected]
120 [email protected]
121 [email protected] "cfg"
122 [email protected]
123 [email protected] "("
124 [email protected] "feature"
125 [email protected] " "
126 [email protected] "="
127 [email protected] " "
128 [email protected] "\"before\""
129 [email protected] ")"
130 [email protected] "]"
131 [email protected] "\n "
132 [email protected]
133 [email protected] "_"
134 [email protected] " "
135 [email protected] "=>"
136 [email protected] " "
137 [email protected]
138 [email protected] "("
139 [email protected] ")"
140 [email protected] ","
141 [email protected] "\n "
142 [email protected] "}"
143 [email protected] "\n"
144 [email protected] "}"
145 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rs b/crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rs
new file mode 100644
index 000000000..676db42d1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rs
@@ -0,0 +1,12 @@
1fn foo() {
2 match () {
3 #[cfg(feature = "some")]
4 _ => (),
5 #[cfg(feature = "other")]
6 _ => (),
7 #[cfg(feature = "many")]
8 #[cfg(feature = "attributes")]
9 #[cfg(feature = "before")]
10 _ => (),
11 }
12}
diff --git a/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast b/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
new file mode 100644
index 000000000..570b95205
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
@@ -0,0 +1,65 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "#"
12 [email protected] "["
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected] "derive"
17 [email protected]
18 [email protected] "("
19 [email protected] "Lifetime"
20 [email protected] ")"
21 [email protected] "]"
22 [email protected] " "
23 [email protected] "\'a"
24 [email protected] ","
25 [email protected] " "
26 [email protected]
27 [email protected]
28 [email protected] "#"
29 [email protected] "["
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "derive"
34 [email protected]
35 [email protected] "("
36 [email protected] "Type"
37 [email protected] ")"
38 [email protected] "]"
39 [email protected] " "
40 [email protected]
41 [email protected] "T"
42 [email protected] ">"
43 [email protected]
44 [email protected] "("
45 [email protected]
46 [email protected]
47 [email protected] "_"
48 [email protected] ":"
49 [email protected] " "
50 [email protected]
51 [email protected] "&"
52 [email protected] "\'a"
53 [email protected] " "
54 [email protected]
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected] "T"
59 [email protected] ")"
60 [email protected] " "
61 [email protected]
62 [email protected] "{"
63 [email protected] "\n"
64 [email protected] "}"
65 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rs b/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rs
new file mode 100644
index 000000000..e8fdf741f
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rs
@@ -0,0 +1,2 @@
1fn foo<#[derive(Lifetime)] 'a, #[derive(Type)] T>(_: &'a T) {
2}
diff --git a/crates/syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast b/crates/syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast
new file mode 100644
index 000000000..7cdec6634
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast
@@ -0,0 +1,50 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "extern"
5 [email protected] " "
6 [email protected] "\"C\""
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] " "
11 [email protected]
12 [email protected] "fn"
13 [email protected] " "
14 [email protected]
15 [email protected] "printf"
16 [email protected]
17 [email protected] "("
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "format"
22 [email protected] ":"
23 [email protected] " "
24 [email protected]
25 [email protected] "*"
26 [email protected] "const"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "i8"
33 [email protected] ","
34 [email protected] " "
35 [email protected]
36 [email protected] "..."
37 [email protected] ")"
38 [email protected] " "
39 [email protected]
40 [email protected] "->"
41 [email protected] " "
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected] "i32"
47 [email protected] ";"
48 [email protected] " "
49 [email protected] "}"
50 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0123_param_list_vararg.rs b/crates/syntax/test_data/parser/inline/ok/0123_param_list_vararg.rs
new file mode 100644
index 000000000..c59addaf4
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0123_param_list_vararg.rs
@@ -0,0 +1 @@
extern "C" { fn printf(format: *const i8, ...) -> i32; }
diff --git a/crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast b/crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast
new file mode 100644
index 000000000..aa4d7a784
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast
@@ -0,0 +1,31 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "crate"
21 [email protected] "::"
22 [email protected]
23 [email protected]
24 [email protected] "foo"
25 [email protected]
26 [email protected] "("
27 [email protected] ")"
28 [email protected] ";"
29 [email protected] " "
30 [email protected] "}"
31 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rs b/crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rs
new file mode 100644
index 000000000..0f454d121
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rs
@@ -0,0 +1 @@
fn foo() { crate::foo(); }
diff --git a/crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast b/crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast
new file mode 100644
index 000000000..54ea2c7c6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast
@@ -0,0 +1,47 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "S"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected] "#"
26 [email protected] "["
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "cfg"
31 [email protected]
32 [email protected] "("
33 [email protected] "test"
34 [email protected] ")"
35 [email protected] "]"
36 [email protected] " "
37 [email protected]
38 [email protected] "field"
39 [email protected] ":"
40 [email protected] " "
41 [email protected]
42 [email protected] "1"
43 [email protected] " "
44 [email protected] "}"
45 [email protected] "\n"
46 [email protected] "}"
47 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rs b/crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rs
new file mode 100644
index 000000000..a6c7760c7
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rs
@@ -0,0 +1,3 @@
1fn main() {
2 S { #[cfg(test)] field: 1 }
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast b/crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast
new file mode 100644
index 000000000..0342e64f3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast
@@ -0,0 +1,97 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "#"
17 [email protected] "["
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "A"
22 [email protected] "]"
23 [email protected] " "
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "foo"
30 [email protected]
31 [email protected] "("
32 [email protected] ")"
33 [email protected] ";"
34 [email protected] "\n "
35 [email protected]
36 [email protected]
37 [email protected] "#"
38 [email protected] "["
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected] "B"
43 [email protected] "]"
44 [email protected] " "
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "bar"
50 [email protected] "!"
51 [email protected]
52 [email protected] "{"
53 [email protected] "}"
54 [email protected] "\n "
55 [email protected]
56 [email protected]
57 [email protected] "#"
58 [email protected] "["
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected] "C"
63 [email protected] "]"
64 [email protected] " "
65 [email protected]
66 [email protected] "#"
67 [email protected] "["
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected] "D"
72 [email protected] "]"
73 [email protected] " "
74 [email protected]
75 [email protected] "{"
76 [email protected] "}"
77 [email protected] "\n "
78 [email protected]
79 [email protected]
80 [email protected] "#"
81 [email protected] "["
82 [email protected]
83 [email protected]
84 [email protected]
85 [email protected] "D"
86 [email protected] "]"
87 [email protected] " "
88 [email protected]
89 [email protected] "return"
90 [email protected] " "
91 [email protected]
92 [email protected] "("
93 [email protected] ")"
94 [email protected] ";"
95 [email protected] "\n"
96 [email protected] "}"
97 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rs b/crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rs
new file mode 100644
index 000000000..b28c078f9
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rs
@@ -0,0 +1,6 @@
1fn foo() {
2 #[A] foo();
3 #[B] bar!{}
4 #[C] #[D] {}
5 #[D] return ();
6}
diff --git a/crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast b/crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast
new file mode 100644
index 000000000..3b46e5b47
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast
@@ -0,0 +1,57 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "{"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected] "#"
21 [email protected] "["
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "A"
26 [email protected] "]"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "bar"
33 [email protected] "!"
34 [email protected]
35 [email protected] "("
36 [email protected] ")"
37 [email protected] "?"
38 [email protected] " "
39 [email protected] "}"
40 [email protected] "\n "
41 [email protected]
42 [email protected]
43 [email protected] "#"
44 [email protected] "["
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected] "B"
49 [email protected] "]"
50 [email protected] " "
51 [email protected] "&"
52 [email protected]
53 [email protected] "("
54 [email protected] ")"
55 [email protected] "\n"
56 [email protected] "}"
57 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rs b/crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rs
new file mode 100644
index 000000000..9c5c8eb36
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rs
@@ -0,0 +1,4 @@
1fn foo() {
2 { #[A] bar!()? }
3 #[B] &()
4}
diff --git a/crates/syntax/test_data/parser/inline/ok/0129_marco_pat.rast b/crates/syntax/test_data/parser/inline/ok/0129_marco_pat.rast
new file mode 100644
index 000000000..e283966ca
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0129_marco_pat.rast
@@ -0,0 +1,36 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "m"
23 [email protected] "!"
24 [email protected]
25 [email protected] "("
26 [email protected] "x"
27 [email protected] ")"
28 [email protected] " "
29 [email protected] "="
30 [email protected] " "
31 [email protected]
32 [email protected] "0"
33 [email protected] ";"
34 [email protected] "\n"
35 [email protected] "}"
36 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0129_marco_pat.rs b/crates/syntax/test_data/parser/inline/ok/0129_marco_pat.rs
new file mode 100644
index 000000000..811181d9b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0129_marco_pat.rs
@@ -0,0 +1,3 @@
1fn main() {
2 let m!(x) = 0;
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rast b/crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rast
new file mode 100644
index 000000000..4c07cefa6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rast
@@ -0,0 +1,126 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "a"
20 [email protected] ";"
21 [email protected] "\n "
22 [email protected]
23 [email protected] "let"
24 [email protected] " "
25 [email protected]
26 [email protected]
27 [email protected] "b"
28 [email protected] ":"
29 [email protected] " "
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "i32"
35 [email protected] ";"
36 [email protected] "\n "
37 [email protected]
38 [email protected] "let"
39 [email protected] " "
40 [email protected]
41 [email protected]
42 [email protected] "c"
43 [email protected] " "
44 [email protected] "="
45 [email protected] " "
46 [email protected]
47 [email protected] "92"
48 [email protected] ";"
49 [email protected] "\n "
50 [email protected]
51 [email protected] "let"
52 [email protected] " "
53 [email protected]
54 [email protected]
55 [email protected] "d"
56 [email protected] ":"
57 [email protected] " "
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected] "i32"
63 [email protected] " "
64 [email protected] "="
65 [email protected] " "
66 [email protected]
67 [email protected] "92"
68 [email protected] ";"
69 [email protected] "\n "
70 [email protected]
71 [email protected] "let"
72 [email protected] " "
73 [email protected]
74 [email protected]
75 [email protected] "e"
76 [email protected] ":"
77 [email protected] " "
78 [email protected]
79 [email protected] "!"
80 [email protected] ";"
81 [email protected] "\n "
82 [email protected]
83 [email protected] "let"
84 [email protected] " "
85 [email protected]
86 [email protected] "_"
87 [email protected] ":"
88 [email protected] " "
89 [email protected]
90 [email protected] "!"
91 [email protected] " "
92 [email protected] "="
93 [email protected] " "
94 [email protected]
95 [email protected] "{"
96 [email protected] "}"
97 [email protected] ";"
98 [email protected] "\n "
99 [email protected]
100 [email protected] "let"
101 [email protected] " "
102 [email protected]
103 [email protected]
104 [email protected] "f"
105 [email protected] " "
106 [email protected] "="
107 [email protected] " "
108 [email protected]
109 [email protected]
110 [email protected] "#"
111 [email protected] "["
112 [email protected]
113 [email protected]
114 [email protected]
115 [email protected] "attr"
116 [email protected] "]"
117 [email protected]
118 [email protected] "|"
119 [email protected] "|"
120 [email protected]
121 [email protected] "{"
122 [email protected] "}"
123 [email protected] ";"
124 [email protected] "\n"
125 [email protected] "}"
126 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rs b/crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rs
new file mode 100644
index 000000000..fa8ee49a2
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0130_let_stmt.rs
@@ -0,0 +1,9 @@
1fn foo() {
2 let a;
3 let b: i32;
4 let c = 92;
5 let d: i32 = 92;
6 let e: !;
7 let _: ! = {};
8 let f = #[attr]||{};
9}
diff --git a/crates/syntax/test_data/parser/inline/ok/0130_try_block_expr.rast b/crates/syntax/test_data/parser/inline/ok/0130_try_block_expr.rast
new file mode 100644
index 000000000..ffdffe2f8
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0130_try_block_expr.rast
@@ -0,0 +1,31 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "_"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected] "try"
24 [email protected] " "
25 [email protected]
26 [email protected] "{"
27 [email protected] "}"
28 [email protected] ";"
29 [email protected] "\n"
30 [email protected] "}"
31 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0130_try_block_expr.rs b/crates/syntax/test_data/parser/inline/ok/0130_try_block_expr.rs
new file mode 100644
index 000000000..0f1b41eb6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0130_try_block_expr.rs
@@ -0,0 +1,3 @@
1fn foo() {
2 let _ = try {};
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0131_existential_type.rast b/crates/syntax/test_data/parser/inline/ok/0131_existential_type.rast
new file mode 100644
index 000000000..d47071a91
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0131_existential_type.rast
@@ -0,0 +1,31 @@
1[email protected]
2 [email protected]
3 [email protected] "existential"
4 [email protected] " "
5 [email protected] "type"
6 [email protected] " "
7 [email protected]
8 [email protected] "Foo"
9 [email protected] ":"
10 [email protected] " "
11 [email protected]
12 [email protected]
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "Fn"
18 [email protected]
19 [email protected] "("
20 [email protected] ")"
21 [email protected] " "
22 [email protected]
23 [email protected] "->"
24 [email protected] " "
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "usize"
30 [email protected] ";"
31 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0131_existential_type.rs b/crates/syntax/test_data/parser/inline/ok/0131_existential_type.rs
new file mode 100644
index 000000000..23baf7145
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0131_existential_type.rs
@@ -0,0 +1 @@
existential type Foo: Fn() -> usize;
diff --git a/crates/syntax/test_data/parser/inline/ok/0132_box_expr.rast b/crates/syntax/test_data/parser/inline/ok/0132_box_expr.rast
new file mode 100644
index 000000000..c55038247
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0132_box_expr.rast
@@ -0,0 +1,89 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "x"
20 [email protected] " "
21 [email protected] "="
22 [email protected] " "
23 [email protected]
24 [email protected] "box"
25 [email protected] " "
26 [email protected]
27 [email protected] "1i32"
28 [email protected] ";"
29 [email protected] "\n "
30 [email protected]
31 [email protected] "let"
32 [email protected] " "
33 [email protected]
34 [email protected]
35 [email protected] "y"
36 [email protected] " "
37 [email protected] "="
38 [email protected] " "
39 [email protected]
40 [email protected] "("
41 [email protected]
42 [email protected] "box"
43 [email protected] " "
44 [email protected]
45 [email protected] "1i32"
46 [email protected] ","
47 [email protected] " "
48 [email protected]
49 [email protected] "box"
50 [email protected] " "
51 [email protected]
52 [email protected] "2i32"
53 [email protected] ")"
54 [email protected] ";"
55 [email protected] "\n "
56 [email protected]
57 [email protected] "let"
58 [email protected] " "
59 [email protected]
60 [email protected]
61 [email protected] "z"
62 [email protected] " "
63 [email protected] "="
64 [email protected] " "
65 [email protected]
66 [email protected]
67 [email protected]
68 [email protected]
69 [email protected]
70 [email protected] "Foo"
71 [email protected]
72 [email protected] "("
73 [email protected]
74 [email protected] "box"
75 [email protected] " "
76 [email protected]
77 [email protected] "1i32"
78 [email protected] ","
79 [email protected] " "
80 [email protected]
81 [email protected] "box"
82 [email protected] " "
83 [email protected]
84 [email protected] "2i32"
85 [email protected] ")"
86 [email protected] ";"
87 [email protected] "\n"
88 [email protected] "}"
89 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0132_box_expr.rs b/crates/syntax/test_data/parser/inline/ok/0132_box_expr.rs
new file mode 100644
index 000000000..fc9923b71
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0132_box_expr.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 let x = box 1i32;
3 let y = (box 1i32, box 2i32);
4 let z = Foo(box 1i32, box 2i32);
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast b/crates/syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
new file mode 100644
index 000000000..429a0506e
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
@@ -0,0 +1,62 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "simple_function"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "enum"
16 [email protected] " "
17 [email protected]
18 [email protected] "LocalEnum"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] "\n "
23 [email protected]
24 [email protected]
25 [email protected] "One"
26 [email protected] ","
27 [email protected] "\n "
28 [email protected]
29 [email protected]
30 [email protected] "Two"
31 [email protected] ","
32 [email protected] "\n "
33 [email protected] "}"
34 [email protected] ";"
35 [email protected] "\n "
36 [email protected]
37 [email protected] "fn"
38 [email protected] " "
39 [email protected]
40 [email protected] "f"
41 [email protected]
42 [email protected] "("
43 [email protected] ")"
44 [email protected] " "
45 [email protected]
46 [email protected] "{"
47 [email protected] "}"
48 [email protected] ";"
49 [email protected] "\n "
50 [email protected]
51 [email protected] "struct"
52 [email protected] " "
53 [email protected]
54 [email protected] "S"
55 [email protected] " "
56 [email protected]
57 [email protected] "{"
58 [email protected] "}"
59 [email protected] ";"
60 [email protected] "\n"
61 [email protected] "}"
62 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rs b/crates/syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rs
new file mode 100644
index 000000000..eadc7fffb
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rs
@@ -0,0 +1,8 @@
1fn simple_function() {
2 enum LocalEnum {
3 One,
4 Two,
5 };
6 fn f() {};
7 struct S {};
8}
diff --git a/crates/syntax/test_data/parser/inline/ok/0137_await_expr.rast b/crates/syntax/test_data/parser/inline/ok/0137_await_expr.rast
new file mode 100644
index 000000000..923effe38
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0137_await_expr.rast
@@ -0,0 +1,69 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "x"
21 [email protected] "."
22 [email protected] "await"
23 [email protected] ";"
24 [email protected] "\n "
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "x"
33 [email protected] "."
34 [email protected]
35 [email protected] "0"
36 [email protected] "."
37 [email protected] "await"
38 [email protected] ";"
39 [email protected] "\n "
40 [email protected]
41 [email protected]
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected] "x"
51 [email protected] "."
52 [email protected]
53 [email protected] "0"
54 [email protected]
55 [email protected] "("
56 [email protected] ")"
57 [email protected] "."
58 [email protected] "await"
59 [email protected] "?"
60 [email protected] "."
61 [email protected]
62 [email protected] "hello"
63 [email protected]
64 [email protected] "("
65 [email protected] ")"
66 [email protected] ";"
67 [email protected] "\n"
68 [email protected] "}"
69 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0137_await_expr.rs b/crates/syntax/test_data/parser/inline/ok/0137_await_expr.rs
new file mode 100644
index 000000000..d2ba89ca6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0137_await_expr.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 x.await;
3 x.0.await;
4 x.0().await?.hello();
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast b/crates/syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast
new file mode 100644
index 000000000..3870ec135
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast
@@ -0,0 +1,55 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "print_all"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ":"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "Iterator"
21 [email protected]
22 [email protected] "<"
23 [email protected]
24 [email protected]
25 [email protected] "Item"
26 [email protected] ":"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "Display"
35 [email protected] ">"
36 [email protected] ">"
37 [email protected]
38 [email protected] "("
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected] "printables"
43 [email protected] ":"
44 [email protected] " "
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "T"
50 [email protected] ")"
51 [email protected] " "
52 [email protected]
53 [email protected] "{"
54 [email protected] "}"
55 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rs b/crates/syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rs
new file mode 100644
index 000000000..eb21a657b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rs
@@ -0,0 +1 @@
fn print_all<T: Iterator<Item: Display>>(printables: T) {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0138_expression_after_block.rast b/crates/syntax/test_data/parser/inline/ok/0138_expression_after_block.rast
new file mode 100644
index 000000000..f7c0e0ab0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0138_expression_after_block.rast
@@ -0,0 +1,64 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "mut"
19 [email protected] " "
20 [email protected]
21 [email protected] "p"
22 [email protected] " "
23 [email protected] "="
24 [email protected] " "
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "F"
30 [email protected]
31 [email protected] "{"
32 [email protected]
33 [email protected]
34 [email protected] "x"
35 [email protected] ":"
36 [email protected] " "
37 [email protected]
38 [email protected] "5"
39 [email protected] "}"
40 [email protected] ";"
41 [email protected] "\n "
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected] "{"
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected] "p"
52 [email protected] "}"
53 [email protected] "."
54 [email protected]
55 [email protected] "x"
56 [email protected] " "
57 [email protected] "="
58 [email protected] " "
59 [email protected]
60 [email protected] "10"
61 [email protected] ";"
62 [email protected] "\n"
63 [email protected] "}"
64 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0138_expression_after_block.rs b/crates/syntax/test_data/parser/inline/ok/0138_expression_after_block.rs
new file mode 100644
index 000000000..76007e3ee
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0138_expression_after_block.rs
@@ -0,0 +1,4 @@
1fn foo() {
2 let mut p = F{x: 5};
3 {p}.x = 10;
4}
diff --git a/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast b/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast
new file mode 100644
index 000000000..6403ff8d5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast
@@ -0,0 +1,25 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "f"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected] "#"
11 [email protected] "["
12 [email protected]
13 [email protected]
14 [email protected]
15 [email protected] "must_use"
16 [email protected] "]"
17 [email protected] " "
18 [email protected]
19 [email protected] "self"
20 [email protected] ")"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rs b/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rs
new file mode 100644
index 000000000..35155057a
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rs
@@ -0,0 +1 @@
fn f(#[must_use] self) {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast b/crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast
new file mode 100644
index 000000000..495e4c51b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast
@@ -0,0 +1,34 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "f"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected] "#"
11 [email protected] "["
12 [email protected]
13 [email protected]
14 [email protected]
15 [email protected] "attr1"
16 [email protected] "]"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "pat"
22 [email protected] ":"
23 [email protected] " "
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected] "Type"
29 [email protected] ")"
30 [email protected] " "
31 [email protected]
32 [email protected] "{"
33 [email protected] "}"
34 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rs b/crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rs
new file mode 100644
index 000000000..c238be791
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0139_param_outer_arg.rs
@@ -0,0 +1 @@
fn f(#[attr1] pat: Type) {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0142_for_range_from.rast b/crates/syntax/test_data/parser/inline/ok/0142_for_range_from.rast
new file mode 100644
index 000000000..36e448c94
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0142_for_range_from.rast
@@ -0,0 +1,40 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "for"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "x"
20 [email protected] " "
21 [email protected] "in"
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected] "0"
26 [email protected] " "
27 [email protected] ".."
28 [email protected] " "
29 [email protected]
30 [email protected] "{"
31 [email protected] "\n "
32 [email protected]
33 [email protected]
34 [email protected] "break"
35 [email protected] ";"
36 [email protected] "\n "
37 [email protected] "}"
38 [email protected] "\n"
39 [email protected] "}"
40 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0142_for_range_from.rs b/crates/syntax/test_data/parser/inline/ok/0142_for_range_from.rs
new file mode 100644
index 000000000..af0d40a7a
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0142_for_range_from.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 for x in 0 .. {
3 break;
4 }
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0143_box_pat.rast b/crates/syntax/test_data/parser/inline/ok/0143_box_pat.rast
new file mode 100644
index 000000000..65887b962
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0143_box_pat.rast
@@ -0,0 +1,110 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "box"
19 [email protected] " "
20 [email protected]
21 [email protected]
22 [email protected] "i"
23 [email protected] " "
24 [email protected] "="
25 [email protected] " "
26 [email protected]
27 [email protected] "("
28 [email protected] ")"
29 [email protected] ";"
30 [email protected] "\n "
31 [email protected]
32 [email protected] "let"
33 [email protected] " "
34 [email protected]
35 [email protected] "box"
36 [email protected] " "
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "Outer"
42 [email protected] " "
43 [email protected]
44 [email protected] "{"
45 [email protected] " "
46 [email protected]
47 [email protected]
48 [email protected] "box"
49 [email protected] " "
50 [email protected]
51 [email protected]
52 [email protected] "i"
53 [email protected] ","
54 [email protected] " "
55 [email protected]
56 [email protected]
57 [email protected] "j"
58 [email protected] ":"
59 [email protected] " "
60 [email protected]
61 [email protected] "box"
62 [email protected] " "
63 [email protected]
64 [email protected]
65 [email protected]
66 [email protected]
67 [email protected] "Inner"
68 [email protected] "("
69 [email protected]
70 [email protected] "box"
71 [email protected] " "
72 [email protected]
73 [email protected] "&"
74 [email protected]
75 [email protected]
76 [email protected] "x"
77 [email protected] ")"
78 [email protected] " "
79 [email protected] "}"
80 [email protected] " "
81 [email protected] "="
82 [email protected] " "
83 [email protected]
84 [email protected] "("
85 [email protected] ")"
86 [email protected] ";"
87 [email protected] "\n "
88 [email protected]
89 [email protected] "let"
90 [email protected] " "
91 [email protected]
92 [email protected] "box"
93 [email protected] " "
94 [email protected]
95 [email protected] "ref"
96 [email protected] " "
97 [email protected] "mut"
98 [email protected] " "
99 [email protected]
100 [email protected] "i"
101 [email protected] " "
102 [email protected] "="
103 [email protected] " "
104 [email protected]
105 [email protected] "("
106 [email protected] ")"
107 [email protected] ";"
108 [email protected] "\n"
109 [email protected] "}"
110 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0143_box_pat.rs b/crates/syntax/test_data/parser/inline/ok/0143_box_pat.rs
new file mode 100644
index 000000000..9d458aa1e
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0143_box_pat.rs
@@ -0,0 +1,5 @@
1fn main() {
2 let box i = ();
3 let box Outer { box i, j: box Inner(box &x) } = ();
4 let box ref mut i = ();
5}
diff --git a/crates/syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast b/crates/syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast
new file mode 100644
index 000000000..8a5bde0b6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast
@@ -0,0 +1,455 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] ".."
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected] "("
24 [email protected] ")"
25 [email protected] ";"
26 [email protected] "\n "
27 [email protected] "//"
28 [email protected] "\n "
29 [email protected] "// Tuples"
30 [email protected] "\n "
31 [email protected] "//"
32 [email protected] "\n "
33 [email protected]
34 [email protected] "let"
35 [email protected] " "
36 [email protected]
37 [email protected] "("
38 [email protected]
39 [email protected]
40 [email protected] "a"
41 [email protected] ","
42 [email protected] " "
43 [email protected]
44 [email protected] ".."
45 [email protected] ")"
46 [email protected] " "
47 [email protected] "="
48 [email protected] " "
49 [email protected]
50 [email protected] "("
51 [email protected] ")"
52 [email protected] ";"
53 [email protected] "\n "
54 [email protected]
55 [email protected] "let"
56 [email protected] " "
57 [email protected]
58 [email protected] "("
59 [email protected]
60 [email protected]
61 [email protected] "a"
62 [email protected] ","
63 [email protected] " "
64 [email protected]
65 [email protected] ".."
66 [email protected] ","
67 [email protected] ")"
68 [email protected] " "
69 [email protected] "="
70 [email protected] " "
71 [email protected]
72 [email protected] "("
73 [email protected] ")"
74 [email protected] ";"
75 [email protected] "\n "
76 [email protected]
77 [email protected] "let"
78 [email protected] " "
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected]
83 [email protected] "Tuple"
84 [email protected] "("
85 [email protected]
86 [email protected]
87 [email protected] "a"
88 [email protected] ","
89 [email protected] " "
90 [email protected]
91 [email protected] ".."
92 [email protected] ")"
93 [email protected] " "
94 [email protected] "="
95 [email protected] " "
96 [email protected]
97 [email protected] "("
98 [email protected] ")"
99 [email protected] ";"
100 [email protected] "\n "
101 [email protected]
102 [email protected] "let"
103 [email protected] " "
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected]
108 [email protected] "Tuple"
109 [email protected] "("
110 [email protected]
111 [email protected]
112 [email protected] "a"
113 [email protected] ","
114 [email protected] " "
115 [email protected]
116 [email protected] ".."
117 [email protected] ","
118 [email protected] ")"
119 [email protected] " "
120 [email protected] "="
121 [email protected] " "
122 [email protected]
123 [email protected] "("
124 [email protected] ")"
125 [email protected] ";"
126 [email protected] "\n "
127 [email protected]
128 [email protected] "let"
129 [email protected] " "
130 [email protected]
131 [email protected] "("
132 [email protected]
133 [email protected] ".."
134 [email protected] ","
135 [email protected] " "
136 [email protected]
137 [email protected] ".."
138 [email protected] ")"
139 [email protected] " "
140 [email protected] "="
141 [email protected] " "
142 [email protected]
143 [email protected] "("
144 [email protected] ")"
145 [email protected] ";"
146 [email protected] "\n "
147 [email protected]
148 [email protected] "let"
149 [email protected] " "
150 [email protected]
151 [email protected]
152 [email protected]
153 [email protected]
154 [email protected] "Tuple"
155 [email protected] "("
156 [email protected]
157 [email protected] ".."
158 [email protected] ","
159 [email protected] " "
160 [email protected]
161 [email protected] ".."
162 [email protected] ")"
163 [email protected] " "
164 [email protected] "="
165 [email protected] " "
166 [email protected]
167 [email protected] "("
168 [email protected] ")"
169 [email protected] ";"
170 [email protected] "\n "
171 [email protected]
172 [email protected] "let"
173 [email protected] " "
174 [email protected]
175 [email protected] "("
176 [email protected]
177 [email protected] ".."
178 [email protected] ","
179 [email protected] " "
180 [email protected]
181 [email protected]
182 [email protected] "a"
183 [email protected] ","
184 [email protected] " "
185 [email protected]
186 [email protected] ".."
187 [email protected] ")"
188 [email protected] " "
189 [email protected] "="
190 [email protected] " "
191 [email protected]
192 [email protected] "("
193 [email protected] ")"
194 [email protected] ";"
195 [email protected] "\n "
196 [email protected]
197 [email protected] "let"
198 [email protected] " "
199 [email protected]
200 [email protected]
201 [email protected]
202 [email protected]
203 [email protected] "Tuple"
204 [email protected] "("
205 [email protected]
206 [email protected] ".."
207 [email protected] ","
208 [email protected] " "
209 [email protected]
210 [email protected]
211 [email protected] "a"
212 [email protected] ","
213 [email protected] " "
214 [email protected]
215 [email protected] ".."
216 [email protected] ")"
217 [email protected] " "
218 [email protected] "="
219 [email protected] " "
220 [email protected]
221 [email protected] "("
222 [email protected] ")"
223 [email protected] ";"
224 [email protected] "\n "
225 [email protected] "//"
226 [email protected] "\n "
227 [email protected] "// Slices"
228 [email protected] "\n "
229 [email protected] "//"
230 [email protected] "\n "
231 [email protected]
232 [email protected] "let"
233 [email protected] " "
234 [email protected]
235 [email protected] "["
236 [email protected]
237 [email protected] ".."
238 [email protected] "]"
239 [email protected] " "
240 [email protected] "="
241 [email protected] " "
242 [email protected]
243 [email protected] "("
244 [email protected] ")"
245 [email protected] ";"
246 [email protected] "\n "
247 [email protected]
248 [email protected] "let"
249 [email protected] " "
250 [email protected]
251 [email protected] "["
252 [email protected]
253 [email protected]
254 [email protected] "head"
255 [email protected] ","
256 [email protected] " "
257 [email protected]
258 [email protected] ".."
259 [email protected] "]"
260 [email protected] " "
261 [email protected] "="
262 [email protected] " "
263 [email protected]
264 [email protected] "("
265 [email protected] ")"
266 [email protected] ";"
267 [email protected] "\n "
268 [email protected]
269 [email protected] "let"
270 [email protected] " "
271 [email protected]
272 [email protected] "["
273 [email protected]
274 [email protected]
275 [email protected] "head"
276 [email protected] ","
277 [email protected] " "
278 [email protected]
279 [email protected]
280 [email protected] "tail"
281 [email protected] " "
282 [email protected] "@"
283 [email protected] " "
284 [email protected]
285 [email protected] ".."
286 [email protected] "]"
287 [email protected] " "
288 [email protected] "="
289 [email protected] " "
290 [email protected]
291 [email protected] "("
292 [email protected] ")"
293 [email protected] ";"
294 [email protected] "\n "
295 [email protected]
296 [email protected] "let"
297 [email protected] " "
298 [email protected]
299 [email protected] "["
300 [email protected]
301 [email protected]
302 [email protected] "head"
303 [email protected] ","
304 [email protected] " "
305 [email protected]
306 [email protected] ".."
307 [email protected] ","
308 [email protected] " "
309 [email protected]
310 [email protected]
311 [email protected] "cons"
312 [email protected] "]"
313 [email protected] " "
314 [email protected] "="
315 [email protected] " "
316 [email protected]
317 [email protected] "("
318 [email protected] ")"
319 [email protected] ";"
320 [email protected] "\n "
321 [email protected]
322 [email protected] "let"
323 [email protected] " "
324 [email protected]
325 [email protected] "["
326 [email protected]
327 [email protected]
328 [email protected] "head"
329 [email protected] ","
330 [email protected] " "
331 [email protected]
332 [email protected]
333 [email protected] "mid"
334 [email protected] " "
335 [email protected] "@"
336 [email protected] " "
337 [email protected]
338 [email protected] ".."
339 [email protected] ","
340 [email protected] " "
341 [email protected]
342 [email protected]
343 [email protected] "cons"
344 [email protected] "]"
345 [email protected] " "
346 [email protected] "="
347 [email protected] " "
348 [email protected]
349 [email protected] "("
350 [email protected] ")"
351 [email protected] ";"
352 [email protected] "\n "
353 [email protected]
354 [email protected] "let"
355 [email protected] " "
356 [email protected]
357 [email protected] "["
358 [email protected]
359 [email protected]
360 [email protected] "head"
361 [email protected] ","
362 [email protected] " "
363 [email protected]
364 [email protected] ".."
365 [email protected] ","
366 [email protected] " "
367 [email protected]
368 [email protected] ".."
369 [email protected] ","
370 [email protected] " "
371 [email protected]
372 [email protected]
373 [email protected] "cons"
374 [email protected] "]"
375 [email protected] " "
376 [email protected] "="
377 [email protected] " "
378 [email protected]
379 [email protected] "("
380 [email protected] ")"
381 [email protected] ";"
382 [email protected] "\n "
383 [email protected]
384 [email protected] "let"
385 [email protected] " "
386 [email protected]
387 [email protected] "["
388 [email protected]
389 [email protected]
390 [email protected] "head"
391 [email protected] ","
392 [email protected] " "
393 [email protected]
394 [email protected] ".."
395 [email protected] ","
396 [email protected] " "
397 [email protected]
398 [email protected]
399 [email protected] "mid"
400 [email protected] ","
401 [email protected] " "
402 [email protected]
403 [email protected]
404 [email protected] "tail"
405 [email protected] " "
406 [email protected] "@"
407 [email protected] " "
408 [email protected]
409 [email protected] ".."
410 [email protected] "]"
411 [email protected] " "
412 [email protected] "="
413 [email protected] " "
414 [email protected]
415 [email protected] "("
416 [email protected] ")"
417 [email protected] ";"
418 [email protected] "\n "
419 [email protected]
420 [email protected] "let"
421 [email protected] " "
422 [email protected]
423 [email protected] "["
424 [email protected]
425 [email protected]
426 [email protected] "head"
427 [email protected] ","
428 [email protected] " "
429 [email protected]
430 [email protected] ".."
431 [email protected] ","
432 [email protected] " "
433 [email protected]
434 [email protected]
435 [email protected] "mid"
436 [email protected] ","
437 [email protected] " "
438 [email protected]
439 [email protected] ".."
440 [email protected] ","
441 [email protected] " "
442 [email protected]
443 [email protected]
444 [email protected] "cons"
445 [email protected] "]"
446 [email protected] " "
447 [email protected] "="
448 [email protected] " "
449 [email protected]
450 [email protected] "("
451 [email protected] ")"
452 [email protected] ";"
453 [email protected] "\n"
454 [email protected] "}"
455 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rs b/crates/syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rs
new file mode 100644
index 000000000..3262f27e1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rs
@@ -0,0 +1,25 @@
1fn main() {
2 let .. = ();
3 //
4 // Tuples
5 //
6 let (a, ..) = ();
7 let (a, ..,) = ();
8 let Tuple(a, ..) = ();
9 let Tuple(a, ..,) = ();
10 let (.., ..) = ();
11 let Tuple(.., ..) = ();
12 let (.., a, ..) = ();
13 let Tuple(.., a, ..) = ();
14 //
15 // Slices
16 //
17 let [..] = ();
18 let [head, ..] = ();
19 let [head, tail @ ..] = ();
20 let [head, .., cons] = ();
21 let [head, mid @ .., cons] = ();
22 let [head, .., .., cons] = ();
23 let [head, .., mid, tail @ ..] = ();
24 let [head, .., mid, .., cons] = ();
25}
diff --git a/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rast b/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
new file mode 100644
index 000000000..925409bdf
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
@@ -0,0 +1,75 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "S"
22 [email protected] " "
23 [email protected]
24 [email protected] "{"
25 [email protected] " "
26 [email protected]
27 [email protected]
28 [email protected] "0"
29 [email protected] ":"
30 [email protected] " "
31 [email protected]
32 [email protected]
33 [email protected] "1"
34 [email protected] " "
35 [email protected] "}"
36 [email protected] " "
37 [email protected] "="
38 [email protected] " "
39 [email protected]
40 [email protected] "("
41 [email protected] ")"
42 [email protected] ";"
43 [email protected] "\n "
44 [email protected]
45 [email protected] "let"
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected] "S"
52 [email protected] " "
53 [email protected]
54 [email protected] "{"
55 [email protected] " "
56 [email protected]
57 [email protected]
58 [email protected] "x"
59 [email protected] ":"
60 [email protected] " "
61 [email protected]
62 [email protected]
63 [email protected] "1"
64 [email protected] " "
65 [email protected] "}"
66 [email protected] " "
67 [email protected] "="
68 [email protected] " "
69 [email protected]
70 [email protected] "("
71 [email protected] ")"
72 [email protected] ";"
73 [email protected] "\n"
74 [email protected] "}"
75 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rs b/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rs
new file mode 100644
index 000000000..26b1d5f89
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rs
@@ -0,0 +1,4 @@
1fn foo() {
2 let S { 0: 1 } = ();
3 let S { x: 1 } = ();
4}
diff --git a/crates/syntax/test_data/parser/inline/ok/0146_as_precedence.rast b/crates/syntax/test_data/parser/inline/ok/0146_as_precedence.rast
new file mode 100644
index 000000000..a36cc8dab
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0146_as_precedence.rast
@@ -0,0 +1,42 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "_"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected]
24 [email protected] "&"
25 [email protected]
26 [email protected] "1"
27 [email protected] " "
28 [email protected] "as"
29 [email protected] " "
30 [email protected]
31 [email protected] "*"
32 [email protected] "const"
33 [email protected] " "
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected] "i32"
39 [email protected] ";"
40 [email protected] "\n"
41 [email protected] "}"
42 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0146_as_precedence.rs b/crates/syntax/test_data/parser/inline/ok/0146_as_precedence.rs
new file mode 100644
index 000000000..a06dec1fa
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0146_as_precedence.rs
@@ -0,0 +1,3 @@
1fn foo() {
2 let _ = &1 as *const i32;
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0147_const_param.rast b/crates/syntax/test_data/parser/inline/ok/0147_const_param.rast
new file mode 100644
index 000000000..9312eab65
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0147_const_param.rast
@@ -0,0 +1,23 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected] "const"
11 [email protected] " "
12 [email protected]
13 [email protected] "N"
14 [email protected] ":"
15 [email protected] " "
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "u32"
21 [email protected] ">"
22 [email protected] ";"
23 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0147_const_param.rs b/crates/syntax/test_data/parser/inline/ok/0147_const_param.rs
new file mode 100644
index 000000000..8cdb3b703
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0147_const_param.rs
@@ -0,0 +1 @@
struct S<const N: u32>;
diff --git a/crates/syntax/test_data/parser/inline/ok/0147_macro_def.rast b/crates/syntax/test_data/parser/inline/ok/0147_macro_def.rast
new file mode 100644
index 000000000..6655aeab1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0147_macro_def.rast
@@ -0,0 +1,45 @@
1[email protected]
2 [email protected]
3 [email protected] "macro"
4 [email protected] " "
5 [email protected]
6 [email protected] "m"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] " "
11 [email protected]
12 [email protected] "("
13 [email protected] "$"
14 [email protected] "i"
15 [email protected] ":"
16 [email protected] "ident"
17 [email protected] ")"
18 [email protected] " "
19 [email protected] "="
20 [email protected] ">"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] " "
26 [email protected] "}"
27 [email protected] "\n"
28 [email protected]
29 [email protected] "macro"
30 [email protected] " "
31 [email protected]
32 [email protected] "m"
33 [email protected]
34 [email protected]
35 [email protected] "("
36 [email protected] "$"
37 [email protected] "i"
38 [email protected] ":"
39 [email protected] "ident"
40 [email protected] ")"
41 [email protected] " "
42 [email protected]
43 [email protected] "{"
44 [email protected] "}"
45 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0147_macro_def.rs b/crates/syntax/test_data/parser/inline/ok/0147_macro_def.rs
new file mode 100644
index 000000000..319a4e2aa
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0147_macro_def.rs
@@ -0,0 +1,2 @@
1macro m { ($i:ident) => {} }
2macro m($i:ident) {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0148_pub_macro_def.rast b/crates/syntax/test_data/parser/inline/ok/0148_pub_macro_def.rast
new file mode 100644
index 000000000..1c527f60b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0148_pub_macro_def.rast
@@ -0,0 +1,21 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "pub"
5 [email protected] " "
6 [email protected] "macro"
7 [email protected] " "
8 [email protected]
9 [email protected] "m"
10 [email protected]
11 [email protected]
12 [email protected] "("
13 [email protected] "$"
14 [email protected] ":"
15 [email protected] "ident"
16 [email protected] ")"
17 [email protected] " "
18 [email protected]
19 [email protected] "{"
20 [email protected] "}"
21 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs b/crates/syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs
new file mode 100644
index 000000000..3b2be597f
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs
@@ -0,0 +1 @@
pub macro m($:ident) {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rast b/crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rast
new file mode 100644
index 000000000..f284aafcd
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rast
@@ -0,0 +1,47 @@
1[email protected]
2 [email protected]
3 [email protected] "const"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected] ":"
8 [email protected] " "
9 [email protected]
10 [email protected] "&"
11 [email protected]
12 [email protected] "["
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "i64"
18 [email protected] "]"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected] "&"
24 [email protected]
25 [email protected] "["
26 [email protected]
27 [email protected] "1"
28 [email protected] ","
29 [email protected] " "
30 [email protected]
31 [email protected]
32 [email protected] "#"
33 [email protected] "["
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected] "cfg"
38 [email protected]
39 [email protected] "("
40 [email protected] "test"
41 [email protected] ")"
42 [email protected] "]"
43 [email protected] " "
44 [email protected] "2"
45 [email protected] "]"
46 [email protected] ";"
47 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rs b/crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rs
new file mode 100644
index 000000000..2ac310924
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0150_array_attrs.rs
@@ -0,0 +1 @@
const A: &[i64] = &[1, #[cfg(test)] 2];
diff --git a/crates/syntax/test_data/parser/inline/ok/0150_impl_type_params.rast b/crates/syntax/test_data/parser/inline/ok/0150_impl_type_params.rast
new file mode 100644
index 000000000..12194abda
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0150_impl_type_params.rast
@@ -0,0 +1,38 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected]
5 [email protected] "<"
6 [email protected]
7 [email protected] "const"
8 [email protected] " "
9 [email protected]
10 [email protected] "N"
11 [email protected] ":"
12 [email protected] " "
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "u32"
18 [email protected] ">"
19 [email protected] " "
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected] "Bar"
25 [email protected]
26 [email protected] "<"
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "N"
33 [email protected] ">"
34 [email protected] " "
35 [email protected]
36 [email protected] "{"
37 [email protected] "}"
38 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0150_impl_type_params.rs b/crates/syntax/test_data/parser/inline/ok/0150_impl_type_params.rs
new file mode 100644
index 000000000..cb0a105c2
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0150_impl_type_params.rs
@@ -0,0 +1 @@
impl<const N: u32> Bar<N> {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0151_fn.rast b/crates/syntax/test_data/parser/inline/ok/0151_fn.rast
new file mode 100644
index 000000000..23c4269b3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0151_fn.rast
@@ -0,0 +1,14 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "}"
14 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0151_fn.rs b/crates/syntax/test_data/parser/inline/ok/0151_fn.rs
new file mode 100644
index 000000000..8f3b7ef11
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0151_fn.rs
@@ -0,0 +1 @@
fn foo() {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0151_trait_alias.rast b/crates/syntax/test_data/parser/inline/ok/0151_trait_alias.rast
new file mode 100644
index 000000000..dac50410e
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0151_trait_alias.rast
@@ -0,0 +1,128 @@
1[email protected]
2 [email protected]
3 [email protected] "trait"
4 [email protected] " "
5 [email protected]
6 [email protected] "Z"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "U"
12 [email protected] ">"
13 [email protected] " "
14 [email protected] "="
15 [email protected] " "
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "T"
23 [email protected]
24 [email protected] "<"
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "U"
31 [email protected] ">"
32 [email protected] ";"
33 [email protected] "\n"
34 [email protected]
35 [email protected] "trait"
36 [email protected] " "
37 [email protected]
38 [email protected] "Z"
39 [email protected]
40 [email protected] "<"
41 [email protected]
42 [email protected]
43 [email protected] "U"
44 [email protected] ">"
45 [email protected] " "
46 [email protected] "="
47 [email protected] " "
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected] "T"
55 [email protected]
56 [email protected] "<"
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected] "U"
63 [email protected] ">"
64 [email protected] " "
65 [email protected]
66 [email protected] "where"
67 [email protected] " "
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected]
72 [email protected]
73 [email protected] "U"
74 [email protected] ":"
75 [email protected] " "
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected] "Copy"
83 [email protected] ";"
84 [email protected] "\n"
85 [email protected]
86 [email protected] "trait"
87 [email protected] " "
88 [email protected]
89 [email protected] "Z"
90 [email protected]
91 [email protected] "<"
92 [email protected]
93 [email protected]
94 [email protected] "U"
95 [email protected] ">"
96 [email protected] " "
97 [email protected] "="
98 [email protected] " "
99 [email protected]
100 [email protected]
101 [email protected] "where"
102 [email protected] " "
103 [email protected]
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected]
108 [email protected] "Self"
109 [email protected] ":"
110 [email protected] " "
111 [email protected]
112 [email protected]
113 [email protected]
114 [email protected]
115 [email protected]
116 [email protected]
117 [email protected] "T"
118 [email protected]
119 [email protected] "<"
120 [email protected]
121 [email protected]
122 [email protected]
123 [email protected]
124 [email protected]
125 [email protected] "U"
126 [email protected] ">"
127 [email protected] ";"
128 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0151_trait_alias.rs b/crates/syntax/test_data/parser/inline/ok/0151_trait_alias.rs
new file mode 100644
index 000000000..4bd428ee4
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0151_trait_alias.rs
@@ -0,0 +1,3 @@
1trait Z<U> = T<U>;
2trait Z<U> = T<U> where U: Copy;
3trait Z<U> = where Self: T<U>;
diff --git a/crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast b/crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast
new file mode 100644
index 000000000..2905c5f1a
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast
@@ -0,0 +1,36 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "foo"
20 [email protected]
21 [email protected] "("
22 [email protected]
23 [email protected]
24 [email protected] "#"
25 [email protected] "["
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "attr"
30 [email protected] "]"
31 [email protected] " "
32 [email protected] "92"
33 [email protected] ")"
34 [email protected] "\n"
35 [email protected] "}"
36 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs b/crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs
new file mode 100644
index 000000000..5daf1d7b0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs
@@ -0,0 +1,3 @@
1fn main() {
2 foo(#[attr] 92)
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0152_impl.rast b/crates/syntax/test_data/parser/inline/ok/0152_impl.rast
new file mode 100644
index 000000000..7968cf9ff
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0152_impl.rast
@@ -0,0 +1,22 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "T"
10 [email protected] " "
11 [email protected] "for"
12 [email protected] " "
13 [email protected]
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "S"
18 [email protected] " "
19 [email protected]
20 [email protected] "{"
21 [email protected] "}"
22 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0152_impl.rs b/crates/syntax/test_data/parser/inline/ok/0152_impl.rs
new file mode 100644
index 000000000..a1a550d8a
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0152_impl.rs
@@ -0,0 +1 @@
impl T for S {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0153_trait.rast b/crates/syntax/test_data/parser/inline/ok/0153_trait.rast
new file mode 100644
index 000000000..9881e5048
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0153_trait.rast
@@ -0,0 +1,11 @@
1[email protected]
2 [email protected]
3 [email protected] "trait"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "}"
11 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0153_trait.rs b/crates/syntax/test_data/parser/inline/ok/0153_trait.rs
new file mode 100644
index 000000000..8d183dbb5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0153_trait.rs
@@ -0,0 +1 @@
trait T {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast b/crates/syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast
new file mode 100644
index 000000000..e6aff7b37
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast
@@ -0,0 +1,58 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "Foo"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "fn"
12 [email protected]
13 [email protected] "("
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "Bar"
21 [email protected] "::"
22 [email protected]
23 [email protected]
24 [email protected] "Baz"
25 [email protected] ")"
26 [email protected] ";"
27 [email protected] "\n"
28 [email protected]
29 [email protected] "type"
30 [email protected] " "
31 [email protected]
32 [email protected] "Qux"
33 [email protected] " "
34 [email protected] "="
35 [email protected] " "
36 [email protected]
37 [email protected] "fn"
38 [email protected]
39 [email protected] "("
40 [email protected]
41 [email protected]
42 [email protected]
43 [email protected] "baz"
44 [email protected] ":"
45 [email protected] " "
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected] "Bar"
52 [email protected] "::"
53 [email protected]
54 [email protected]
55 [email protected] "Baz"
56 [email protected] ")"
57 [email protected] ";"
58 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rs b/crates/syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rs
new file mode 100644
index 000000000..80a1701fd
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rs
@@ -0,0 +1,2 @@
1type Foo = fn(Bar::Baz);
2type Qux = fn(baz: Bar::Baz);
diff --git a/crates/syntax/test_data/parser/inline/ok/0155_closure_params.rast b/crates/syntax/test_data/parser/inline/ok/0155_closure_params.rast
new file mode 100644
index 000000000..31671b420
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0155_closure_params.rast
@@ -0,0 +1,69 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "foo"
20 [email protected] " "
21 [email protected] "="
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected] "|"
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "bar"
30 [email protected] ","
31 [email protected] " "
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected] "baz"
36 [email protected] ":"
37 [email protected] " "
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected] "Baz"
43 [email protected] ","
44 [email protected] " "
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected] "qux"
49 [email protected] ":"
50 [email protected] " "
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected] "Qux"
57 [email protected] "::"
58 [email protected]
59 [email protected]
60 [email protected] "Quux"
61 [email protected] "|"
62 [email protected] " "
63 [email protected]
64 [email protected] "("
65 [email protected] ")"
66 [email protected] ";"
67 [email protected] "\n"
68 [email protected] "}"
69 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0155_closure_params.rs b/crates/syntax/test_data/parser/inline/ok/0155_closure_params.rs
new file mode 100644
index 000000000..6ca8dd2d6
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0155_closure_params.rs
@@ -0,0 +1,3 @@
1fn main() {
2 let foo = |bar, baz: Baz, qux: Qux::Quux| ();
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0156_fn_def_param.rast b/crates/syntax/test_data/parser/inline/ok/0156_fn_def_param.rast
new file mode 100644
index 000000000..508b4aca7
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0156_fn_def_param.rast
@@ -0,0 +1,43 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected]
11 [email protected] "("
12 [email protected]
13 [email protected]
14 [email protected] "x"
15 [email protected] ","
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "y"
20 [email protected] ")"
21 [email protected] ":"
22 [email protected] " "
23 [email protected]
24 [email protected] "("
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "i32"
30 [email protected] ","
31 [email protected] " "
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected] "i32"
37 [email protected] ")"
38 [email protected] ")"
39 [email protected] " "
40 [email protected]
41 [email protected] "{"
42 [email protected] "}"
43 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0156_fn_def_param.rs b/crates/syntax/test_data/parser/inline/ok/0156_fn_def_param.rs
new file mode 100644
index 000000000..7b277c16b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0156_fn_def_param.rs
@@ -0,0 +1 @@
fn foo((x, y): (i32, i32)) {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0156_or_pattern.rast b/crates/syntax/test_data/parser/inline/ok/0156_or_pattern.rast
new file mode 100644
index 000000000..88a513cee
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0156_or_pattern.rast
@@ -0,0 +1,111 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "match"
16 [email protected] " "
17 [email protected]
18 [email protected] "("
19 [email protected] ")"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "\n "
24 [email protected]
25 [email protected]
26 [email protected] "("
27 [email protected]
28 [email protected]
29 [email protected] "_"
30 [email protected] " "
31 [email protected] "|"
32 [email protected] " "
33 [email protected]
34 [email protected] "_"
35 [email protected] ")"
36 [email protected] " "
37 [email protected] "=>"
38 [email protected] " "
39 [email protected]
40 [email protected] "("
41 [email protected] ")"
42 [email protected] ","
43 [email protected] "\n "
44 [email protected]
45 [email protected]
46 [email protected] "&"
47 [email protected]
48 [email protected] "("
49 [email protected]
50 [email protected]
51 [email protected] "_"
52 [email protected] " "
53 [email protected] "|"
54 [email protected] " "
55 [email protected]
56 [email protected] "_"
57 [email protected] ")"
58 [email protected] " "
59 [email protected] "=>"
60 [email protected] " "
61 [email protected]
62 [email protected] "("
63 [email protected] ")"
64 [email protected] ","
65 [email protected] "\n "
66 [email protected]
67 [email protected]
68 [email protected] "("
69 [email protected]
70 [email protected]
71 [email protected] "_"
72 [email protected] " "
73 [email protected] "|"
74 [email protected] " "
75 [email protected]
76 [email protected] "_"
77 [email protected] ","
78 [email protected] ")"
79 [email protected] " "
80 [email protected] "=>"
81 [email protected] " "
82 [email protected]
83 [email protected] "("
84 [email protected] ")"
85 [email protected] ","
86 [email protected] "\n "
87 [email protected]
88 [email protected]
89 [email protected] "["
90 [email protected]
91 [email protected]
92 [email protected] "_"
93 [email protected] " "
94 [email protected] "|"
95 [email protected] " "
96 [email protected]
97 [email protected] "_"
98 [email protected] ","
99 [email protected] "]"
100 [email protected] " "
101 [email protected] "=>"
102 [email protected] " "
103 [email protected]
104 [email protected] "("
105 [email protected] ")"
106 [email protected] ","
107 [email protected] "\n "
108 [email protected] "}"
109 [email protected] "\n"
110 [email protected] "}"
111 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0156_or_pattern.rs b/crates/syntax/test_data/parser/inline/ok/0156_or_pattern.rs
new file mode 100644
index 000000000..a26316605
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0156_or_pattern.rs
@@ -0,0 +1,8 @@
1fn main() {
2 match () {
3 (_ | _) => (),
4 &(_ | _) => (),
5 (_ | _,) => (),
6 [_ | _,] => (),
7 }
8}
diff --git a/crates/syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast b/crates/syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast
new file mode 100644
index 000000000..6abb4fe5a
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast
@@ -0,0 +1,26 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "Foo"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "fn"
12 [email protected]
13 [email protected] "("
14 [email protected]
15 [email protected]
16 [email protected] "_"
17 [email protected] ":"
18 [email protected] " "
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected] "bar"
24 [email protected] ")"
25 [email protected] ";"
26 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rs b/crates/syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rs
new file mode 100644
index 000000000..1ebbe5b03
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rs
@@ -0,0 +1 @@
type Foo = fn(_: bar);
diff --git a/crates/syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast b/crates/syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast
new file mode 100644
index 000000000..a2e05eb2e
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast
@@ -0,0 +1,30 @@
1[email protected]
2 [email protected]
3 [email protected] "enum"
4 [email protected] " "
5 [email protected]
6 [email protected] "E"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] " "
11 [email protected]
12 [email protected]
13 [email protected] "X"
14 [email protected]
15 [email protected] "("
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "i32"
22 [email protected] ")"
23 [email protected] " "
24 [email protected] "="
25 [email protected] " "
26 [email protected]
27 [email protected] "10"
28 [email protected] " "
29 [email protected] "}"
30 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0157_variant_discriminant.rs b/crates/syntax/test_data/parser/inline/ok/0157_variant_discriminant.rs
new file mode 100644
index 000000000..c8c5c0f17
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0157_variant_discriminant.rs
@@ -0,0 +1 @@
enum E { X(i32) = 10 }
diff --git a/crates/syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast b/crates/syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast
new file mode 100644
index 000000000..8ae24b9c1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast
@@ -0,0 +1,36 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "v"
21 [email protected] " "
22 [email protected] "="
23 [email protected] " "
24 [email protected]
25 [email protected]
26 [email protected] "{"
27 [email protected]
28 [email protected] "1"
29 [email protected] "}"
30 [email protected] "&"
31 [email protected]
32 [email protected] "2"
33 [email protected] ";"
34 [email protected] "\n"
35 [email protected] "}"
36 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rs b/crates/syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rs
new file mode 100644
index 000000000..05acc30f1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rs
@@ -0,0 +1,3 @@
1fn foo() {
2 v = {1}&2;
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast b/crates/syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
new file mode 100644
index 000000000..aa4099a92
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
@@ -0,0 +1,43 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "|"
19 [email protected] "|"
20 [email protected] " "
21 [email protected]
22 [email protected] "->"
23 [email protected] " "
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected] "i32"
29 [email protected] " "
30 [email protected]
31 [email protected] "{"
32 [email protected] " "
33 [email protected]
34 [email protected] "92"
35 [email protected] " "
36 [email protected] "}"
37 [email protected]
38 [email protected] "("
39 [email protected] ")"
40 [email protected] ";"
41 [email protected] " "
42 [email protected] "}"
43 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rs b/crates/syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rs
new file mode 100644
index 000000000..061118d3a
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rs
@@ -0,0 +1 @@
fn main() { || -> i32 { 92 }(); }
diff --git a/crates/syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rast b/crates/syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rast
new file mode 100644
index 000000000..fb46d4ce4
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rast
@@ -0,0 +1,34 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "try"
20 [email protected] "!"
21 [email protected]
22 [email protected] "("
23 [email protected] "Ok"
24 [email protected]
25 [email protected] "("
26 [email protected]
27 [email protected] "("
28 [email protected] ")"
29 [email protected] ")"
30 [email protected] ")"
31 [email protected] ";"
32 [email protected] " "
33 [email protected] "}"
34 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rs b/crates/syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rs
new file mode 100644
index 000000000..61a6b46a0
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rs
@@ -0,0 +1 @@
fn foo() { try!(Ok(())); }
diff --git a/crates/syntax/test_data/parser/inline/ok/0160_try_macro_rules.rast b/crates/syntax/test_data/parser/inline/ok/0160_try_macro_rules.rast
new file mode 100644
index 000000000..05b89d1c3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0160_try_macro_rules.rast
@@ -0,0 +1,27 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected]
5 [email protected]
6 [email protected] "macro_rules"
7 [email protected] "!"
8 [email protected] " "
9 [email protected]
10 [email protected] "try"
11 [email protected] " "
12 [email protected]
13 [email protected] "{"
14 [email protected] " "
15 [email protected]
16 [email protected] "("
17 [email protected] ")"
18 [email protected] " "
19 [email protected] "="
20 [email protected] ">"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] " "
26 [email protected] "}"
27 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0160_try_macro_rules.rs b/crates/syntax/test_data/parser/inline/ok/0160_try_macro_rules.rs
new file mode 100644
index 000000000..2e2ab6e60
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0160_try_macro_rules.rs
@@ -0,0 +1 @@
macro_rules! try { () => {} }
diff --git a/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast b/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast
new file mode 100644
index 000000000..9e9a5f9c5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast
@@ -0,0 +1,26 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "f"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "\'label"
18 [email protected] ":"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] "}"
23 [email protected] ";"
24 [email protected] " "
25 [email protected] "}"
26 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rs b/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rs
new file mode 100644
index 000000000..18b4ff4b1
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rs
@@ -0,0 +1 @@
fn f() { 'label: {}; }
diff --git a/crates/syntax/test_data/parser/inline/ok/0162_unsafe_block.rast b/crates/syntax/test_data/parser/inline/ok/0162_unsafe_block.rast
new file mode 100644
index 000000000..ca9a1183d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0162_unsafe_block.rast
@@ -0,0 +1,23 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "f"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected] "unsafe"
16 [email protected] " "
17 [email protected]
18 [email protected] "{"
19 [email protected] " "
20 [email protected] "}"
21 [email protected] " "
22 [email protected] "}"
23 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0162_unsafe_block.rs b/crates/syntax/test_data/parser/inline/ok/0162_unsafe_block.rs
new file mode 100644
index 000000000..dfb9b2a1c
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0162_unsafe_block.rs
@@ -0,0 +1 @@
fn f() { unsafe { } }
diff --git a/crates/syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rast b/crates/syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rast
new file mode 100644
index 000000000..f2e201460
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rast
@@ -0,0 +1,44 @@
1[email protected]
2 [email protected]
3 [email protected] "default"
4 [email protected] " "
5 [email protected] "unsafe"
6 [email protected] " "
7 [email protected] "impl"
8 [email protected] " "
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected] "T"
14 [email protected] " "
15 [email protected] "for"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "Foo"
22 [email protected] " "
23 [email protected]
24 [email protected] "{"
25 [email protected] "\n "
26 [email protected]
27 [email protected] "default"
28 [email protected] " "
29 [email protected] "unsafe"
30 [email protected] " "
31 [email protected] "fn"
32 [email protected] " "
33 [email protected]
34 [email protected] "foo"
35 [email protected]
36 [email protected] "("
37 [email protected] ")"
38 [email protected] " "
39 [email protected]
40 [email protected] "{"
41 [email protected] "}"
42 [email protected] "\n"
43 [email protected] "}"
44 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rs b/crates/syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rs
new file mode 100644
index 000000000..96340f84a
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rs
@@ -0,0 +1,3 @@
1default unsafe impl T for Foo {
2 default unsafe fn foo() {}
3}
diff --git a/crates/syntax/test_data/parser/inline/ok/0164_default_item.rast b/crates/syntax/test_data/parser/inline/ok/0164_default_item.rast
new file mode 100644
index 000000000..9282772f3
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0164_default_item.rast
@@ -0,0 +1,24 @@
1[email protected]
2 [email protected]
3 [email protected] "default"
4 [email protected] " "
5 [email protected] "impl"
6 [email protected] " "
7 [email protected]
8 [email protected]
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] " "
13 [email protected] "for"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "Foo"
20 [email protected] " "
21 [email protected]
22 [email protected] "{"
23 [email protected] "}"
24 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0164_default_item.rs b/crates/syntax/test_data/parser/inline/ok/0164_default_item.rs
new file mode 100644
index 000000000..a6836cbd5
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0164_default_item.rs
@@ -0,0 +1 @@
default impl T for Foo {}
diff --git a/crates/syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast b/crates/syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast
new file mode 100644
index 000000000..f8910677b
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast
@@ -0,0 +1,38 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "<"
22 [email protected]
23 [email protected] "_"
24 [email protected] ">"
25 [email protected] "::"
26 [email protected]
27 [email protected]
28 [email protected] "Foo"
29 [email protected] " "
30 [email protected] "="
31 [email protected] " "
32 [email protected]
33 [email protected] "("
34 [email protected] ")"
35 [email protected] ";"
36 [email protected] " "
37 [email protected] "}"
38 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rs b/crates/syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rs
new file mode 100644
index 000000000..ebe26834d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rs
@@ -0,0 +1 @@
fn main() { let <_>::Foo = (); }
diff --git a/crates/syntax/test_data/parser/ok/0000_empty.rast b/crates/syntax/test_data/parser/ok/0000_empty.rast
new file mode 100644
index 000000000..6b234b0b2
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0000_empty.rast
@@ -0,0 +1 @@
[email protected]
diff --git a/crates/syntax/test_data/parser/ok/0000_empty.rs b/crates/syntax/test_data/parser/ok/0000_empty.rs
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0000_empty.rs
diff --git a/crates/syntax/test_data/parser/ok/0001_struct_item.rast b/crates/syntax/test_data/parser/ok/0001_struct_item.rast
new file mode 100644
index 000000000..a171fe7a8
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0001_struct_item.rast
@@ -0,0 +1,39 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ":"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "Copy"
21 [email protected] ">"
22 [email protected] " "
23 [email protected]
24 [email protected] "{"
25 [email protected] "\n "
26 [email protected]
27 [email protected]
28 [email protected] "f"
29 [email protected] ":"
30 [email protected] " "
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected] "T"
36 [email protected] ","
37 [email protected] "\n"
38 [email protected] "}"
39 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0001_struct_item.rs b/crates/syntax/test_data/parser/ok/0001_struct_item.rs
new file mode 100644
index 000000000..512aeb3e7
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0001_struct_item.rs
@@ -0,0 +1,3 @@
1struct S<T: Copy> {
2 f: T,
3}
diff --git a/crates/syntax/test_data/parser/ok/0002_struct_item_field.rast b/crates/syntax/test_data/parser/ok/0002_struct_item_field.rast
new file mode 100644
index 000000000..362892b91
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0002_struct_item_field.rast
@@ -0,0 +1,22 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected]
12 [email protected]
13 [email protected] "foo"
14 [email protected] ":"
15 [email protected] " "
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "u32"
21 [email protected] "\n"
22 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/ok/0002_struct_item_field.rs b/crates/syntax/test_data/parser/ok/0002_struct_item_field.rs
new file mode 100644
index 000000000..cc3866d25
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0002_struct_item_field.rs
@@ -0,0 +1,3 @@
1struct S {
2 foo: u32
3} \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0004_file_shebang.rast b/crates/syntax/test_data/parser/ok/0004_file_shebang.rast
new file mode 100644
index 000000000..67e21df13
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0004_file_shebang.rast
@@ -0,0 +1,2 @@
1[email protected]
2 [email protected] "#!/use/bin/env rusti"
diff --git a/crates/syntax/test_data/parser/ok/0004_file_shebang.rs b/crates/syntax/test_data/parser/ok/0004_file_shebang.rs
new file mode 100644
index 000000000..53dc9e617
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0004_file_shebang.rs
@@ -0,0 +1 @@
#!/use/bin/env rusti \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0005_fn_item.rast b/crates/syntax/test_data/parser/ok/0005_fn_item.rast
new file mode 100644
index 000000000..a7a2b11a7
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0005_fn_item.rast
@@ -0,0 +1,15 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n"
14 [email protected] "}"
15 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0005_fn_item.rs b/crates/syntax/test_data/parser/ok/0005_fn_item.rs
new file mode 100644
index 000000000..03210551c
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0005_fn_item.rs
@@ -0,0 +1,2 @@
1fn foo() {
2}
diff --git a/crates/syntax/test_data/parser/ok/0006_inner_attributes.rast b/crates/syntax/test_data/parser/ok/0006_inner_attributes.rast
new file mode 100644
index 000000000..42587243a
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0006_inner_attributes.rast
@@ -0,0 +1,184 @@
1[email protected]
2 [email protected]
3 [email protected] "#"
4 [email protected] "!"
5 [email protected] "["
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "attr"
10 [email protected] "]"
11 [email protected] "\n"
12 [email protected]
13 [email protected] "#"
14 [email protected] "!"
15 [email protected] "["
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "attr"
20 [email protected]
21 [email protected] "("
22 [email protected] "true"
23 [email protected] ")"
24 [email protected] "]"
25 [email protected] "\n"
26 [email protected]
27 [email protected] "#"
28 [email protected] "!"
29 [email protected] "["
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "attr"
34 [email protected]
35 [email protected] "("
36 [email protected] "ident"
37 [email protected] ")"
38 [email protected] "]"
39 [email protected] "\n"
40 [email protected]
41 [email protected] "#"
42 [email protected] "!"
43 [email protected] "["
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected] "attr"
48 [email protected]
49 [email protected] "("
50 [email protected] "ident"
51 [email protected] ","
52 [email protected] " "
53 [email protected] "100"
54 [email protected] ","
55 [email protected] " "
56 [email protected] "true"
57 [email protected] ","
58 [email protected] " "
59 [email protected] "\"true\""
60 [email protected] ","
61 [email protected] " "
62 [email protected] "ident"
63 [email protected] " "
64 [email protected] "="
65 [email protected] " "
66 [email protected] "100"
67 [email protected] ","
68 [email protected] " "
69 [email protected] "ident"
70 [email protected] " "
71 [email protected] "="
72 [email protected] " "
73 [email protected] "\"hello\""
74 [email protected] ","
75 [email protected] " "
76 [email protected] "ident"
77 [email protected]
78 [email protected] "("
79 [email protected] "100"
80 [email protected] ")"
81 [email protected] ")"
82 [email protected] "]"
83 [email protected] "\n"
84 [email protected]
85 [email protected] "#"
86 [email protected] "!"
87 [email protected] "["
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected] "attr"
92 [email protected]
93 [email protected] "("
94 [email protected] "100"
95 [email protected] ")"
96 [email protected] "]"
97 [email protected] "\n"
98 [email protected]
99 [email protected] "#"
100 [email protected] "!"
101 [email protected] "["
102 [email protected]
103 [email protected]
104 [email protected]
105 [email protected] "attr"
106 [email protected]
107 [email protected] "("
108 [email protected] "enabled"
109 [email protected] " "
110 [email protected] "="
111 [email protected] " "
112 [email protected] "true"
113 [email protected] ")"
114 [email protected] "]"
115 [email protected] "\n"
116 [email protected]
117 [email protected] "#"
118 [email protected] "!"
119 [email protected] "["
120 [email protected]
121 [email protected]
122 [email protected]
123 [email protected] "enabled"
124 [email protected]
125 [email protected] "("
126 [email protected] "true"
127 [email protected] ")"
128 [email protected] "]"
129 [email protected] "\n"
130 [email protected]
131 [email protected] "#"
132 [email protected] "!"
133 [email protected] "["
134 [email protected]
135 [email protected]
136 [email protected]
137 [email protected] "attr"
138 [email protected]
139 [email protected] "("
140 [email protected] "\"hello\""
141 [email protected] ")"
142 [email protected] "]"
143 [email protected] "\n"
144 [email protected]
145 [email protected] "#"
146 [email protected] "!"
147 [email protected] "["
148 [email protected]
149 [email protected]
150 [email protected]
151 [email protected] "repr"
152 [email protected]
153 [email protected] "("
154 [email protected] "C"
155 [email protected] ","
156 [email protected] " "
157 [email protected] "align"
158 [email protected] " "
159 [email protected] "="
160 [email protected] " "
161 [email protected] "4"
162 [email protected] ")"
163 [email protected] "]"
164 [email protected] "\n"
165 [email protected]
166 [email protected] "#"
167 [email protected] "!"
168 [email protected] "["
169 [email protected]
170 [email protected]
171 [email protected]
172 [email protected] "repr"
173 [email protected]
174 [email protected] "("
175 [email protected] "C"
176 [email protected] ","
177 [email protected] " "
178 [email protected] "align"
179 [email protected]
180 [email protected] "("
181 [email protected] "4"
182 [email protected] ")"
183 [email protected] ")"
184 [email protected] "]"
diff --git a/crates/syntax/test_data/parser/ok/0006_inner_attributes.rs b/crates/syntax/test_data/parser/ok/0006_inner_attributes.rs
new file mode 100644
index 000000000..e81f8b1e8
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0006_inner_attributes.rs
@@ -0,0 +1,10 @@
1#![attr]
2#![attr(true)]
3#![attr(ident)]
4#![attr(ident, 100, true, "true", ident = 100, ident = "hello", ident(100))]
5#![attr(100)]
6#![attr(enabled = true)]
7#![enabled(true)]
8#![attr("hello")]
9#![repr(C, align = 4)]
10#![repr(C, align(4))] \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0007_extern_crate.rast b/crates/syntax/test_data/parser/ok/0007_extern_crate.rast
new file mode 100644
index 000000000..594c2f8f2
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0007_extern_crate.rast
@@ -0,0 +1,39 @@
1[email protected]
2 [email protected]
3 [email protected] "extern"
4 [email protected] " "
5 [email protected] "crate"
6 [email protected] " "
7 [email protected]
8 [email protected] "foo"
9 [email protected] ";"
10 [email protected] "\n"
11 [email protected]
12 [email protected] "extern"
13 [email protected] " "
14 [email protected] "crate"
15 [email protected] " "
16 [email protected]
17 [email protected] "foo"
18 [email protected] " "
19 [email protected]
20 [email protected] "as"
21 [email protected] " "
22 [email protected]
23 [email protected] "bar"
24 [email protected] ";"
25 [email protected] "\n"
26 [email protected]
27 [email protected] "extern"
28 [email protected] " "
29 [email protected] "crate"
30 [email protected] " "
31 [email protected] "self"
32 [email protected] " "
33 [email protected]
34 [email protected] "as"
35 [email protected] " "
36 [email protected]
37 [email protected] "baz"
38 [email protected] ";"
39 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0007_extern_crate.rs b/crates/syntax/test_data/parser/ok/0007_extern_crate.rs
new file mode 100644
index 000000000..ab81a608c
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0007_extern_crate.rs
@@ -0,0 +1,3 @@
1extern crate foo;
2extern crate foo as bar;
3extern crate self as baz;
diff --git a/crates/syntax/test_data/parser/ok/0008_mod_item.rast b/crates/syntax/test_data/parser/ok/0008_mod_item.rast
new file mode 100644
index 000000000..b2c1d791f
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0008_mod_item.rast
@@ -0,0 +1,92 @@
1[email protected]
2 [email protected]
3 [email protected] "mod"
4 [email protected] " "
5 [email protected]
6 [email protected] "a"
7 [email protected] ";"
8 [email protected] "\n\n"
9 [email protected]
10 [email protected] "mod"
11 [email protected] " "
12 [email protected]
13 [email protected] "b"
14 [email protected] " "
15 [email protected]
16 [email protected] "{"
17 [email protected] "\n"
18 [email protected] "}"
19 [email protected] "\n\n"
20 [email protected]
21 [email protected] "mod"
22 [email protected] " "
23 [email protected]
24 [email protected] "c"
25 [email protected] " "
26 [email protected]
27 [email protected] "{"
28 [email protected] "\n "
29 [email protected]
30 [email protected] "fn"
31 [email protected] " "
32 [email protected]
33 [email protected] "foo"
34 [email protected]
35 [email protected] "("
36 [email protected] ")"
37 [email protected] " "
38 [email protected]
39 [email protected] "{"
40 [email protected] "\n "
41 [email protected] "}"
42 [email protected] "\n "
43 [email protected]
44 [email protected] "struct"
45 [email protected] " "
46 [email protected]
47 [email protected] "S"
48 [email protected] " "
49 [email protected]
50 [email protected] "{"
51 [email protected] "}"
52 [email protected] "\n"
53 [email protected] "}"
54 [email protected] "\n\n"
55 [email protected]
56 [email protected] "mod"
57 [email protected] " "
58 [email protected]
59 [email protected] "d"
60 [email protected] " "
61 [email protected]
62 [email protected] "{"
63 [email protected] "\n "
64 [email protected]
65 [email protected] "#"
66 [email protected] "!"
67 [email protected] "["
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected] "attr"
72 [email protected] "]"
73 [email protected] "\n "
74 [email protected]
75 [email protected] "mod"
76 [email protected] " "
77 [email protected]
78 [email protected] "e"
79 [email protected] ";"
80 [email protected] "\n "
81 [email protected]
82 [email protected] "mod"
83 [email protected] " "
84 [email protected]
85 [email protected] "f"
86 [email protected] " "
87 [email protected]
88 [email protected] "{"
89 [email protected] "\n "
90 [email protected] "}"
91 [email protected] "\n"
92 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/ok/0008_mod_item.rs b/crates/syntax/test_data/parser/ok/0008_mod_item.rs
new file mode 100644
index 000000000..d22993bc1
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0008_mod_item.rs
@@ -0,0 +1,17 @@
1mod a;
2
3mod b {
4}
5
6mod c {
7 fn foo() {
8 }
9 struct S {}
10}
11
12mod d {
13 #![attr]
14 mod e;
15 mod f {
16 }
17} \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0009_use_item.rast b/crates/syntax/test_data/parser/ok/0009_use_item.rast
new file mode 100644
index 000000000..6be1cf9fc
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0009_use_item.rast
@@ -0,0 +1,21 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "foo"
10 [email protected] ";"
11 [email protected] "\n"
12 [email protected]
13 [email protected] "use"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "::"
19 [email protected]
20 [email protected] "bar"
21 [email protected] ";"
diff --git a/crates/syntax/test_data/parser/ok/0009_use_item.rs b/crates/syntax/test_data/parser/ok/0009_use_item.rs
new file mode 100644
index 000000000..05a6aff83
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0009_use_item.rs
@@ -0,0 +1,2 @@
1use foo;
2use ::bar; \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0010_use_path_segments.rast b/crates/syntax/test_data/parser/ok/0010_use_path_segments.rast
new file mode 100644
index 000000000..4d49e7933
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0010_use_path_segments.rast
@@ -0,0 +1,42 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected]
10 [email protected] "::"
11 [email protected]
12 [email protected] "foo"
13 [email protected] "::"
14 [email protected]
15 [email protected]
16 [email protected] "bar"
17 [email protected] "::"
18 [email protected]
19 [email protected]
20 [email protected] "baz"
21 [email protected] ";"
22 [email protected] "\n"
23 [email protected]
24 [email protected] "use"
25 [email protected] " "
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "foo"
33 [email protected] "::"
34 [email protected]
35 [email protected]
36 [email protected] "bar"
37 [email protected] "::"
38 [email protected]
39 [email protected]
40 [email protected] "baz"
41 [email protected] ";"
42 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0010_use_path_segments.rs b/crates/syntax/test_data/parser/ok/0010_use_path_segments.rs
new file mode 100644
index 000000000..1e71b7a6c
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0010_use_path_segments.rs
@@ -0,0 +1,2 @@
1use ::foo::bar::baz;
2use foo::bar::baz;
diff --git a/crates/syntax/test_data/parser/ok/0011_outer_attribute.rast b/crates/syntax/test_data/parser/ok/0011_outer_attribute.rast
new file mode 100644
index 000000000..478fdba75
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0011_outer_attribute.rast
@@ -0,0 +1,57 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "#"
5 [email protected] "["
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "cfg"
10 [email protected]
11 [email protected] "("
12 [email protected] "test"
13 [email protected] ")"
14 [email protected] "]"
15 [email protected] "\n"
16 [email protected]
17 [email protected] "#"
18 [email protected] "["
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "ignore"
23 [email protected] "]"
24 [email protected] "\n"
25 [email protected] "fn"
26 [email protected] " "
27 [email protected]
28 [email protected] "foo"
29 [email protected]
30 [email protected] "("
31 [email protected] ")"
32 [email protected] " "
33 [email protected]
34 [email protected] "{"
35 [email protected] "}"
36 [email protected] "\n\n"
37 [email protected]
38 [email protected]
39 [email protected] "#"
40 [email protected] "["
41 [email protected]
42 [email protected]
43 [email protected]
44 [email protected] "path"
45 [email protected] " "
46 [email protected] "="
47 [email protected] " "
48 [email protected]
49 [email protected] "\"a.rs\""
50 [email protected] "]"
51 [email protected] "\n"
52 [email protected] "mod"
53 [email protected] " "
54 [email protected]
55 [email protected] "b"
56 [email protected] ";"
57 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0011_outer_attribute.rs b/crates/syntax/test_data/parser/ok/0011_outer_attribute.rs
new file mode 100644
index 000000000..3d2e01d5c
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0011_outer_attribute.rs
@@ -0,0 +1,6 @@
1#[cfg(test)]
2#[ignore]
3fn foo() {}
4
5#[path = "a.rs"]
6mod b;
diff --git a/crates/syntax/test_data/parser/ok/0012_visibility.rast b/crates/syntax/test_data/parser/ok/0012_visibility.rast
new file mode 100644
index 000000000..83a93b5a9
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0012_visibility.rast
@@ -0,0 +1,102 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "a"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "}"
14 [email protected] "\n"
15 [email protected]
16 [email protected]
17 [email protected] "pub"
18 [email protected] " "
19 [email protected] "fn"
20 [email protected] " "
21 [email protected]
22 [email protected] "b"
23 [email protected]
24 [email protected] "("
25 [email protected] ")"
26 [email protected] " "
27 [email protected]
28 [email protected] "{"
29 [email protected] "}"
30 [email protected] "\n"
31 [email protected]
32 [email protected]
33 [email protected] "pub"
34 [email protected] "("
35 [email protected] "crate"
36 [email protected] ")"
37 [email protected] " "
38 [email protected] "fn"
39 [email protected] " "
40 [email protected]
41 [email protected] "c"
42 [email protected]
43 [email protected] "("
44 [email protected] ")"
45 [email protected] " "
46 [email protected]
47 [email protected] "{"
48 [email protected] "}"
49 [email protected] "\n"
50 [email protected]
51 [email protected]
52 [email protected] "pub"
53 [email protected] "("
54 [email protected] "super"
55 [email protected] ")"
56 [email protected] " "
57 [email protected] "fn"
58 [email protected] " "
59 [email protected]
60 [email protected] "d"
61 [email protected]
62 [email protected] "("
63 [email protected] ")"
64 [email protected] " "
65 [email protected]
66 [email protected] "{"
67 [email protected] "}"
68 [email protected] "\n"
69 [email protected]
70 [email protected]
71 [email protected] "pub"
72 [email protected] "("
73 [email protected] "in"
74 [email protected] " "
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected] "foo"
81 [email protected] "::"
82 [email protected]
83 [email protected]
84 [email protected] "bar"
85 [email protected] "::"
86 [email protected]
87 [email protected]
88 [email protected] "baz"
89 [email protected] ")"
90 [email protected] " "
91 [email protected] "fn"
92 [email protected] " "
93 [email protected]
94 [email protected] "e"
95 [email protected]
96 [email protected] "("
97 [email protected] ")"
98 [email protected] " "
99 [email protected]
100 [email protected] "{"
101 [email protected] "}"
102 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0012_visibility.rs b/crates/syntax/test_data/parser/ok/0012_visibility.rs
new file mode 100644
index 000000000..75b1db121
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0012_visibility.rs
@@ -0,0 +1,5 @@
1fn a() {}
2pub fn b() {}
3pub(crate) fn c() {}
4pub(super) fn d() {}
5pub(in foo::bar::baz) fn e() {}
diff --git a/crates/syntax/test_data/parser/ok/0013_use_path_self_super.rast b/crates/syntax/test_data/parser/ok/0013_use_path_self_super.rast
new file mode 100644
index 000000000..66ab13660
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0013_use_path_self_super.rast
@@ -0,0 +1,33 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "self"
10 [email protected] "::"
11 [email protected]
12 [email protected]
13 [email protected] "foo"
14 [email protected] ";"
15 [email protected] "\n"
16 [email protected]
17 [email protected] "use"
18 [email protected] " "
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected] "super"
25 [email protected] "::"
26 [email protected]
27 [email protected] "super"
28 [email protected] "::"
29 [email protected]
30 [email protected]
31 [email protected] "bar"
32 [email protected] ";"
33 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0013_use_path_self_super.rs b/crates/syntax/test_data/parser/ok/0013_use_path_self_super.rs
new file mode 100644
index 000000000..9d9eb9917
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0013_use_path_self_super.rs
@@ -0,0 +1,2 @@
1use self::foo;
2use super::super::bar;
diff --git a/crates/syntax/test_data/parser/ok/0014_use_tree.rast b/crates/syntax/test_data/parser/ok/0014_use_tree.rast
new file mode 100644
index 000000000..4389d2d4b
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0014_use_tree.rast
@@ -0,0 +1,95 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected] "*"
7 [email protected] ";"
8 [email protected] "\n"
9 [email protected]
10 [email protected] "use"
11 [email protected] " "
12 [email protected]
13 [email protected] "::"
14 [email protected] "*"
15 [email protected] ";"
16 [email protected] "\n"
17 [email protected]
18 [email protected] "use"
19 [email protected] " "
20 [email protected]
21 [email protected] "::"
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] ";"
26 [email protected] "\n"
27 [email protected]
28 [email protected] "use"
29 [email protected] " "
30 [email protected]
31 [email protected]
32 [email protected] "{"
33 [email protected] "}"
34 [email protected] ";"
35 [email protected] "\n"
36 [email protected]
37 [email protected] "use"
38 [email protected] " "
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected]
43 [email protected] "foo"
44 [email protected] "::"
45 [email protected] "*"
46 [email protected] ";"
47 [email protected] "\n"
48 [email protected]
49 [email protected] "use"
50 [email protected] " "
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected] "foo"
56 [email protected] "::"
57 [email protected]
58 [email protected] "{"
59 [email protected] "}"
60 [email protected] ";"
61 [email protected] "\n"
62 [email protected]
63 [email protected] "use"
64 [email protected] " "
65 [email protected]
66 [email protected]
67 [email protected]
68 [email protected] "::"
69 [email protected]
70 [email protected] "foo"
71 [email protected] "::"
72 [email protected]
73 [email protected] "{"
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected] "a"
79 [email protected] ","
80 [email protected] " "
81 [email protected]
82 [email protected]
83 [email protected]
84 [email protected]
85 [email protected] "b"
86 [email protected] ","
87 [email protected] " "
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected]
92 [email protected] "c"
93 [email protected] "}"
94 [email protected] ";"
95 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0014_use_tree.rs b/crates/syntax/test_data/parser/ok/0014_use_tree.rs
new file mode 100644
index 000000000..5e4aa3a33
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0014_use_tree.rs
@@ -0,0 +1,7 @@
1use *;
2use ::*;
3use ::{};
4use {};
5use foo::*;
6use foo::{};
7use ::foo::{a, b, c};
diff --git a/crates/syntax/test_data/parser/ok/0015_use_tree.rast b/crates/syntax/test_data/parser/ok/0015_use_tree.rast
new file mode 100644
index 000000000..d7e93f7eb
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0015_use_tree.rast
@@ -0,0 +1,65 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "foo"
10 [email protected] " "
11 [email protected]
12 [email protected] "as"
13 [email protected] " "
14 [email protected]
15 [email protected] "bar"
16 [email protected] ";"
17 [email protected] "\n"
18 [email protected]
19 [email protected] "use"
20 [email protected] " "
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "foo"
26 [email protected] "::"
27 [email protected]
28 [email protected] "{"
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "a"
34 [email protected] " "
35 [email protected]
36 [email protected] "as"
37 [email protected] " "
38 [email protected]
39 [email protected] "b"
40 [email protected] ","
41 [email protected] " "
42 [email protected]
43 [email protected] "*"
44 [email protected] ","
45 [email protected] " "
46 [email protected]
47 [email protected] "::"
48 [email protected] "*"
49 [email protected] ","
50 [email protected] " "
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected] "::"
55 [email protected]
56 [email protected] "foo"
57 [email protected] " "
58 [email protected]
59 [email protected] "as"
60 [email protected] " "
61 [email protected]
62 [email protected] "x"
63 [email protected] "}"
64 [email protected] ";"
65 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0015_use_tree.rs b/crates/syntax/test_data/parser/ok/0015_use_tree.rs
new file mode 100644
index 000000000..46a0783a2
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0015_use_tree.rs
@@ -0,0 +1,2 @@
1use foo as bar;
2use foo::{a as b, *, ::*, ::foo as x};
diff --git a/crates/syntax/test_data/parser/ok/0016_struct_flavors.rast b/crates/syntax/test_data/parser/ok/0016_struct_flavors.rast
new file mode 100644
index 000000000..b15f41dd7
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0016_struct_flavors.rast
@@ -0,0 +1,93 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected] ";"
8 [email protected] "\n"
9 [email protected]
10 [email protected] "struct"
11 [email protected] " "
12 [email protected]
13 [email protected] "B"
14 [email protected] " "
15 [email protected]
16 [email protected] "{"
17 [email protected] "}"
18 [email protected] "\n"
19 [email protected]
20 [email protected] "struct"
21 [email protected] " "
22 [email protected]
23 [email protected] "C"
24 [email protected]
25 [email protected] "("
26 [email protected] ")"
27 [email protected] ";"
28 [email protected] "\n\n"
29 [email protected]
30 [email protected] "struct"
31 [email protected] " "
32 [email protected]
33 [email protected] "D"
34 [email protected] " "
35 [email protected]
36 [email protected] "{"
37 [email protected] "\n "
38 [email protected]
39 [email protected]
40 [email protected] "a"
41 [email protected] ":"
42 [email protected] " "
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected] "u32"
48 [email protected] ","
49 [email protected] "\n "
50 [email protected]
51 [email protected]
52 [email protected] "pub"
53 [email protected] " "
54 [email protected]
55 [email protected] "b"
56 [email protected] ":"
57 [email protected] " "
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected] "u32"
63 [email protected] "\n"
64 [email protected] "}"
65 [email protected] "\n\n"
66 [email protected]
67 [email protected] "struct"
68 [email protected] " "
69 [email protected]
70 [email protected] "E"
71 [email protected]
72 [email protected] "("
73 [email protected]
74 [email protected]
75 [email protected] "pub"
76 [email protected] " "
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected]
81 [email protected] "x"
82 [email protected] ","
83 [email protected] " "
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected]
88 [email protected]
89 [email protected] "y"
90 [email protected] ","
91 [email protected] ")"
92 [email protected] ";"
93 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0016_struct_flavors.rs b/crates/syntax/test_data/parser/ok/0016_struct_flavors.rs
new file mode 100644
index 000000000..69638350c
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0016_struct_flavors.rs
@@ -0,0 +1,10 @@
1struct A;
2struct B {}
3struct C();
4
5struct D {
6 a: u32,
7 pub b: u32
8}
9
10struct E(pub x, y,);
diff --git a/crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rast b/crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rast
new file mode 100644
index 000000000..a3e091ad3
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rast
@@ -0,0 +1,28 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "#"
5 [email protected] "["
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "foo"
10 [email protected]
11 [email protected] "("
12 [email protected] "a"
13 [email protected] ","
14 [email protected] ")"
15 [email protected] "]"
16 [email protected] "\n"
17 [email protected] "fn"
18 [email protected] " "
19 [email protected]
20 [email protected] "foo"
21 [email protected]
22 [email protected] "("
23 [email protected] ")"
24 [email protected] " "
25 [email protected]
26 [email protected] "{"
27 [email protected] "}"
28 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rs b/crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rs
new file mode 100644
index 000000000..fe0a7bb97
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0017_attr_trailing_comma.rs
@@ -0,0 +1,2 @@
1#[foo(a,)]
2fn foo() {}
diff --git a/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast b/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast
new file mode 100644
index 000000000..630aa0708
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast
@@ -0,0 +1,257 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S1"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ">"
13 [email protected] ";"
14 [email protected] "\n"
15 [email protected]
16 [email protected] "struct"
17 [email protected] " "
18 [email protected]
19 [email protected] "S2"
20 [email protected]
21 [email protected] "<"
22 [email protected]
23 [email protected]
24 [email protected] "T"
25 [email protected] ">"
26 [email protected]
27 [email protected] "("
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "u32"
34 [email protected] ")"
35 [email protected] ";"
36 [email protected] "\n"
37 [email protected]
38 [email protected] "struct"
39 [email protected] " "
40 [email protected]
41 [email protected] "S3"
42 [email protected]
43 [email protected] "<"
44 [email protected]
45 [email protected]
46 [email protected] "T"
47 [email protected] ">"
48 [email protected] " "
49 [email protected]
50 [email protected] "{"
51 [email protected] " "
52 [email protected]
53 [email protected]
54 [email protected] "u"
55 [email protected] ":"
56 [email protected] " "
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected] "u32"
62 [email protected] " "
63 [email protected] "}"
64 [email protected] "\n\n"
65 [email protected]
66 [email protected] "struct"
67 [email protected] " "
68 [email protected]
69 [email protected] "S4"
70 [email protected]
71 [email protected] "<"
72 [email protected] ">"
73 [email protected] ";"
74 [email protected] "\n"
75 [email protected]
76 [email protected] "struct"
77 [email protected] " "
78 [email protected]
79 [email protected] "S5"
80 [email protected]
81 [email protected] "<"
82 [email protected]
83 [email protected] "\'a"
84 [email protected] ">"
85 [email protected] ";"
86 [email protected] "\n"
87 [email protected]
88 [email protected] "struct"
89 [email protected] " "
90 [email protected]
91 [email protected] "S6"
92 [email protected]
93 [email protected] "<"
94 [email protected]
95 [email protected] "\'a"
96 [email protected] ":"
97 [email protected] ">"
98 [email protected] ";"
99 [email protected] "\n"
100 [email protected]
101 [email protected] "struct"
102 [email protected] " "
103 [email protected]
104 [email protected] "S7"
105 [email protected]
106 [email protected] "<"
107 [email protected]
108 [email protected] "\'a"
109 [email protected] ":"
110 [email protected] " "
111 [email protected] "\'b"
112 [email protected] ">"
113 [email protected] ";"
114 [email protected] "\n"
115 [email protected]
116 [email protected] "struct"
117 [email protected] " "
118 [email protected]
119 [email protected] "S8"
120 [email protected]
121 [email protected] "<"
122 [email protected]
123 [email protected] "\'a"
124 [email protected] ":"
125 [email protected] " "
126 [email protected] "\'b"
127 [email protected] " "
128 [email protected] "+"
129 [email protected] " "
130 [email protected] ">"
131 [email protected] ";"
132 [email protected] "\n"
133 [email protected]
134 [email protected] "struct"
135 [email protected] " "
136 [email protected]
137 [email protected] "S9"
138 [email protected]
139 [email protected] "<"
140 [email protected]
141 [email protected] "\'a"
142 [email protected] ":"
143 [email protected] " "
144 [email protected] "\'b"
145 [email protected] " "
146 [email protected] "+"
147 [email protected] " "
148 [email protected] "\'c"
149 [email protected] ">"
150 [email protected] ";"
151 [email protected] "\n"
152 [email protected]
153 [email protected] "struct"
154 [email protected] " "
155 [email protected]
156 [email protected] "S10"
157 [email protected]
158 [email protected] "<"
159 [email protected]
160 [email protected] "\'a"
161 [email protected] ","
162 [email protected] ">"
163 [email protected] ";"
164 [email protected] "\n"
165 [email protected]
166 [email protected] "struct"
167 [email protected] " "
168 [email protected]
169 [email protected] "S11"
170 [email protected]
171 [email protected] "<"
172 [email protected]
173 [email protected] "\'a"
174 [email protected] ","
175 [email protected] " "
176 [email protected]
177 [email protected] "\'b"
178 [email protected] ">"
179 [email protected] ";"
180 [email protected] "\n"
181 [email protected]
182 [email protected] "struct"
183 [email protected] " "
184 [email protected]
185 [email protected] "S12"
186 [email protected]
187 [email protected] "<"
188 [email protected]
189 [email protected] "\'a"
190 [email protected] ":"
191 [email protected] " "
192 [email protected] "\'b"
193 [email protected] "+"
194 [email protected] ","
195 [email protected] " "
196 [email protected]
197 [email protected] "\'b"
198 [email protected] ":"
199 [email protected] " "
200 [email protected] "\'c"
201 [email protected] ","
202 [email protected] ">"
203 [email protected] ";"
204 [email protected] "\n\n"
205 [email protected]
206 [email protected] "struct"
207 [email protected] " "
208 [email protected]
209 [email protected] "S13"
210 [email protected]
211 [email protected] "<"
212 [email protected]
213 [email protected]
214 [email protected] "T"
215 [email protected] ">"
216 [email protected] ";"
217 [email protected] "\n"
218 [email protected]
219 [email protected] "struct"
220 [email protected] " "
221 [email protected]
222 [email protected] "S14"
223 [email protected]
224 [email protected] "<"
225 [email protected]
226 [email protected]
227 [email protected] "T"
228 [email protected] ","
229 [email protected] " "
230 [email protected]
231 [email protected]
232 [email protected] "U"
233 [email protected] ">"
234 [email protected] ";"
235 [email protected] "\n"
236 [email protected]
237 [email protected] "struct"
238 [email protected] " "
239 [email protected]
240 [email protected] "S15"
241 [email protected]
242 [email protected] "<"
243 [email protected]
244 [email protected] "\'a"
245 [email protected] ","
246 [email protected] " "
247 [email protected]
248 [email protected]
249 [email protected] "T"
250 [email protected] ","
251 [email protected] " "
252 [email protected]
253 [email protected]
254 [email protected] "U"
255 [email protected] ">"
256 [email protected] ";"
257 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0018_struct_type_params.rs b/crates/syntax/test_data/parser/ok/0018_struct_type_params.rs
new file mode 100644
index 000000000..88c544923
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0018_struct_type_params.rs
@@ -0,0 +1,17 @@
1struct S1<T>;
2struct S2<T>(u32);
3struct S3<T> { u: u32 }
4
5struct S4<>;
6struct S5<'a>;
7struct S6<'a:>;
8struct S7<'a: 'b>;
9struct S8<'a: 'b + >;
10struct S9<'a: 'b + 'c>;
11struct S10<'a,>;
12struct S11<'a, 'b>;
13struct S12<'a: 'b+, 'b: 'c,>;
14
15struct S13<T>;
16struct S14<T, U>;
17struct S15<'a, T, U>;
diff --git a/crates/syntax/test_data/parser/ok/0019_enums.rast b/crates/syntax/test_data/parser/ok/0019_enums.rast
new file mode 100644
index 000000000..c3df00814
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0019_enums.rast
@@ -0,0 +1,155 @@
1[email protected]
2 [email protected]
3 [email protected] "enum"
4 [email protected] " "
5 [email protected]
6 [email protected] "E1"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n"
11 [email protected] "}"
12 [email protected] "\n\n"
13 [email protected]
14 [email protected] "enum"
15 [email protected] " "
16 [email protected]
17 [email protected] "E2"
18 [email protected]
19 [email protected] "<"
20 [email protected]
21 [email protected]
22 [email protected] "T"
23 [email protected] ">"
24 [email protected] " "
25 [email protected]
26 [email protected] "{"
27 [email protected] "\n"
28 [email protected] "}"
29 [email protected] "\n\n"
30 [email protected]
31 [email protected] "enum"
32 [email protected] " "
33 [email protected]
34 [email protected] "E3"
35 [email protected] " "
36 [email protected]
37 [email protected] "{"
38 [email protected] "\n "
39 [email protected]
40 [email protected]
41 [email protected] "X"
42 [email protected] "\n"
43 [email protected] "}"
44 [email protected] "\n\n"
45 [email protected]
46 [email protected] "enum"
47 [email protected] " "
48 [email protected]
49 [email protected] "E4"
50 [email protected] " "
51 [email protected]
52 [email protected] "{"
53 [email protected] "\n "
54 [email protected]
55 [email protected]
56 [email protected] "X"
57 [email protected] ","
58 [email protected] "\n"
59 [email protected] "}"
60 [email protected] "\n\n"
61 [email protected]
62 [email protected] "enum"
63 [email protected] " "
64 [email protected]
65 [email protected] "E5"
66 [email protected] " "
67 [email protected]
68 [email protected] "{"
69 [email protected] "\n "
70 [email protected]
71 [email protected]
72 [email protected] "A"
73 [email protected] ","
74 [email protected] "\n "
75 [email protected]
76 [email protected]
77 [email protected] "B"
78 [email protected] " "
79 [email protected] "="
80 [email protected] " "
81 [email protected]
82 [email protected] "92"
83 [email protected] ","
84 [email protected] "\n "
85 [email protected]
86 [email protected]
87 [email protected] "C"
88 [email protected] " "
89 [email protected]
90 [email protected] "{"
91 [email protected] "\n "
92 [email protected]
93 [email protected]
94 [email protected] "a"
95 [email protected] ":"
96 [email protected] " "
97 [email protected]
98 [email protected]
99 [email protected]
100 [email protected]
101 [email protected] "u32"
102 [email protected] ","
103 [email protected] "\n "
104 [email protected]
105 [email protected]
106 [email protected] "pub"
107 [email protected] " "
108 [email protected]
109 [email protected] "b"
110 [email protected] ":"
111 [email protected] " "
112 [email protected]
113 [email protected]
114 [email protected]
115 [email protected]
116 [email protected] "f64"
117 [email protected] ","
118 [email protected] "\n "
119 [email protected] "}"
120 [email protected] ","
121 [email protected] "\n "
122 [email protected]
123 [email protected]
124 [email protected] "F"
125 [email protected] " "
126 [email protected]
127 [email protected] "{"
128 [email protected] "}"
129 [email protected] ","
130 [email protected] "\n "
131 [email protected]
132 [email protected]
133 [email protected] "D"
134 [email protected]
135 [email protected] "("
136 [email protected]
137 [email protected]
138 [email protected]
139 [email protected]
140 [email protected]
141 [email protected] "u32"
142 [email protected] ","
143 [email protected] ")"
144 [email protected] ","
145 [email protected] "\n "
146 [email protected]
147 [email protected]
148 [email protected] "E"
149 [email protected]
150 [email protected] "("
151 [email protected] ")"
152 [email protected] ","
153 [email protected] "\n"
154 [email protected] "}"
155 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0019_enums.rs b/crates/syntax/test_data/parser/ok/0019_enums.rs
new file mode 100644
index 000000000..7a1afa0e6
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0019_enums.rs
@@ -0,0 +1,25 @@
1enum E1 {
2}
3
4enum E2<T> {
5}
6
7enum E3 {
8 X
9}
10
11enum E4 {
12 X,
13}
14
15enum E5 {
16 A,
17 B = 92,
18 C {
19 a: u32,
20 pub b: f64,
21 },
22 F {},
23 D(u32,),
24 E(),
25}
diff --git a/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast b/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast
new file mode 100644
index 000000000..9bdc50e1e
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast
@@ -0,0 +1,268 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "A"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ">"
13 [email protected] ";"
14 [email protected] "\n"
15 [email protected]
16 [email protected] "struct"
17 [email protected] " "
18 [email protected]
19 [email protected] "B"
20 [email protected]
21 [email protected] "<"
22 [email protected]
23 [email protected]
24 [email protected] "T"
25 [email protected] ":"
26 [email protected]
27 [email protected] ">"
28 [email protected] ";"
29 [email protected] "\n"
30 [email protected]
31 [email protected] "struct"
32 [email protected] " "
33 [email protected]
34 [email protected] "C"
35 [email protected]
36 [email protected] "<"
37 [email protected]
38 [email protected]
39 [email protected] "T"
40 [email protected] ":"
41 [email protected] " "
42 [email protected]
43 [email protected]
44 [email protected] "\'a"
45 [email protected] ">"
46 [email protected] ";"
47 [email protected] "\n"
48 [email protected]
49 [email protected] "struct"
50 [email protected] " "
51 [email protected]
52 [email protected] "D"
53 [email protected]
54 [email protected] "<"
55 [email protected]
56 [email protected]
57 [email protected] "T"
58 [email protected] ":"
59 [email protected] " "
60 [email protected]
61 [email protected]
62 [email protected] "\'a"
63 [email protected] " "
64 [email protected] "+"
65 [email protected] " "
66 [email protected] ">"
67 [email protected] ";"
68 [email protected] "\n"
69 [email protected]
70 [email protected] "struct"
71 [email protected] " "
72 [email protected]
73 [email protected] "E"
74 [email protected]
75 [email protected] "<"
76 [email protected]
77 [email protected]
78 [email protected] "T"
79 [email protected] ":"
80 [email protected] " "
81 [email protected]
82 [email protected]
83 [email protected] "\'a"
84 [email protected] " "
85 [email protected] "+"
86 [email protected] " "
87 [email protected]
88 [email protected] "\'d"
89 [email protected] " "
90 [email protected] ">"
91 [email protected] ";"
92 [email protected] "\n"
93 [email protected]
94 [email protected] "struct"
95 [email protected] " "
96 [email protected]
97 [email protected] "F"
98 [email protected]
99 [email protected] "<"
100 [email protected]
101 [email protected]
102 [email protected] "T"
103 [email protected] ":"
104 [email protected] " "
105 [email protected]
106 [email protected]
107 [email protected] "\'a"
108 [email protected] " "
109 [email protected] "+"
110 [email protected] " "
111 [email protected]
112 [email protected] "\'d"
113 [email protected] " "
114 [email protected] "+"
115 [email protected] " "
116 [email protected]
117 [email protected]
118 [email protected]
119 [email protected]
120 [email protected]
121 [email protected] "Clone"
122 [email protected] ">"
123 [email protected] ";"
124 [email protected] "\n"
125 [email protected]
126 [email protected] "struct"
127 [email protected] " "
128 [email protected]
129 [email protected] "G"
130 [email protected]
131 [email protected] "<"
132 [email protected]
133 [email protected]
134 [email protected] "T"
135 [email protected] ":"
136 [email protected] " "
137 [email protected]
138 [email protected]
139 [email protected]
140 [email protected]
141 [email protected]
142 [email protected]
143 [email protected] "Clone"
144 [email protected] " "
145 [email protected] "+"
146 [email protected] " "
147 [email protected]
148 [email protected]
149 [email protected]
150 [email protected]
151 [email protected]
152 [email protected] "Copy"
153 [email protected] ">"
154 [email protected] ";"
155 [email protected] "\n"
156 [email protected]
157 [email protected] "struct"
158 [email protected] " "
159 [email protected]
160 [email protected] "H"
161 [email protected]
162 [email protected] "<"
163 [email protected]
164 [email protected]
165 [email protected] "T"
166 [email protected] ":"
167 [email protected] " "
168 [email protected]
169 [email protected]
170 [email protected]
171 [email protected]
172 [email protected]
173 [email protected] "::"
174 [email protected]
175 [email protected] "Foo"
176 [email protected] " "
177 [email protected] "+"
178 [email protected] " "
179 [email protected]
180 [email protected]
181 [email protected]
182 [email protected]
183 [email protected]
184 [email protected] "self"
185 [email protected] "::"
186 [email protected]
187 [email protected]
188 [email protected] "Bar"
189 [email protected] " "
190 [email protected] "+"
191 [email protected] " "
192 [email protected]
193 [email protected] "\'a"
194 [email protected] ">"
195 [email protected] ";"
196 [email protected] "\n"
197 [email protected]
198 [email protected] "struct"
199 [email protected] " "
200 [email protected]
201 [email protected] "I"
202 [email protected]
203 [email protected] "<"
204 [email protected]
205 [email protected]
206 [email protected] "T"
207 [email protected] ":"
208 [email protected]
209 [email protected] ","
210 [email protected] " "
211 [email protected]
212 [email protected]
213 [email protected] "U"
214 [email protected] ":"
215 [email protected]
216 [email protected] ","
217 [email protected] ">"
218 [email protected] ";"
219 [email protected] "\n"
220 [email protected]
221 [email protected] "struct"
222 [email protected] " "
223 [email protected]
224 [email protected] "K"
225 [email protected]
226 [email protected] "<"
227 [email protected]
228 [email protected] "\'a"
229 [email protected] ":"
230 [email protected] " "
231 [email protected] "\'d"
232 [email protected] ","
233 [email protected] " "
234 [email protected]
235 [email protected] "\'d"
236 [email protected] ":"
237 [email protected] " "
238 [email protected] "\'a"
239 [email protected] " "
240 [email protected] "+"
241 [email protected] " "
242 [email protected] "\'b"
243 [email protected] ","
244 [email protected] " "
245 [email protected]
246 [email protected]
247 [email protected] "T"
248 [email protected] ":"
249 [email protected] " "
250 [email protected]
251 [email protected]
252 [email protected] "\'a"
253 [email protected] " "
254 [email protected] "+"
255 [email protected] " "
256 [email protected]
257 [email protected] "\'d"
258 [email protected] " "
259 [email protected] "+"
260 [email protected] " "
261 [email protected]
262 [email protected]
263 [email protected]
264 [email protected]
265 [email protected]
266 [email protected] "Clone"
267 [email protected] ">"
268 [email protected] ";"
diff --git a/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rs b/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rs
new file mode 100644
index 000000000..712898978
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rs
@@ -0,0 +1,10 @@
1struct A<T>;
2struct B<T:>;
3struct C<T: 'a>;
4struct D<T: 'a + >;
5struct E<T: 'a + 'd >;
6struct F<T: 'a + 'd + Clone>;
7struct G<T: Clone + Copy>;
8struct H<T: ::Foo + self::Bar + 'a>;
9struct I<T:, U:,>;
10struct K<'a: 'd, 'd: 'a + 'b, T: 'a + 'd + Clone>; \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0022_empty_extern_block.rast b/crates/syntax/test_data/parser/ok/0022_empty_extern_block.rast
new file mode 100644
index 000000000..26abae3b2
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0022_empty_extern_block.rast
@@ -0,0 +1,21 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "extern"
5 [email protected] " "
6 [email protected]
7 [email protected] "{"
8 [email protected] "\n"
9 [email protected] "}"
10 [email protected] "\n\n"
11 [email protected]
12 [email protected]
13 [email protected] "extern"
14 [email protected] " "
15 [email protected] "\"C\""
16 [email protected] " "
17 [email protected]
18 [email protected] "{"
19 [email protected] "\n"
20 [email protected] "}"
21 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0022_empty_extern_block.rs b/crates/syntax/test_data/parser/ok/0022_empty_extern_block.rs
new file mode 100644
index 000000000..f5fe0e6ef
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0022_empty_extern_block.rs
@@ -0,0 +1,5 @@
1extern {
2}
3
4extern "C" {
5}
diff --git a/crates/syntax/test_data/parser/ok/0023_static_items.rast b/crates/syntax/test_data/parser/ok/0023_static_items.rast
new file mode 100644
index 000000000..9374cf5e9
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0023_static_items.rast
@@ -0,0 +1,41 @@
1[email protected]
2 [email protected]
3 [email protected] "static"
4 [email protected] " "
5 [email protected]
6 [email protected] "FOO"
7 [email protected] ":"
8 [email protected] " "
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected]
13 [email protected] "u32"
14 [email protected] " "
15 [email protected] "="
16 [email protected] " "
17 [email protected]
18 [email protected] "1"
19 [email protected] ";"
20 [email protected] "\n"
21 [email protected]
22 [email protected] "static"
23 [email protected] " "
24 [email protected] "mut"
25 [email protected] " "
26 [email protected]
27 [email protected] "BAR"
28 [email protected] ":"
29 [email protected] " "
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "i32"
35 [email protected] " "
36 [email protected] "="
37 [email protected] " "
38 [email protected]
39 [email protected] "92"
40 [email protected] ";"
41 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0023_static_items.rs b/crates/syntax/test_data/parser/ok/0023_static_items.rs
new file mode 100644
index 000000000..5fb92ce33
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0023_static_items.rs
@@ -0,0 +1,2 @@
1static FOO: u32 = 1;
2static mut BAR: i32 = 92;
diff --git a/crates/syntax/test_data/parser/ok/0024_const_item.rast b/crates/syntax/test_data/parser/ok/0024_const_item.rast
new file mode 100644
index 000000000..dd1b9c9a0
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0024_const_item.rast
@@ -0,0 +1,59 @@
1[email protected]
2 [email protected]
3 [email protected] "const"
4 [email protected] " "
5 [email protected] "_"
6 [email protected] ":"
7 [email protected] " "
8 [email protected]
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected] "u32"
13 [email protected] " "
14 [email protected] "="
15 [email protected] " "
16 [email protected]
17 [email protected] "0"
18 [email protected] ";"
19 [email protected] "\n"
20 [email protected]
21 [email protected] "const"
22 [email protected] " "
23 [email protected]
24 [email protected] "FOO"
25 [email protected] ":"
26 [email protected] " "
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "u32"
32 [email protected] " "
33 [email protected] "="
34 [email protected] " "
35 [email protected]
36 [email protected] "92"
37 [email protected] ";"
38 [email protected] "\n"
39 [email protected]
40 [email protected] "const"
41 [email protected] " "
42 [email protected] "mut"
43 [email protected] " "
44 [email protected]
45 [email protected] "BAR"
46 [email protected] ":"
47 [email protected] " "
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected] "u32"
53 [email protected] " "
54 [email protected] "="
55 [email protected] " "
56 [email protected]
57 [email protected] "62"
58 [email protected] ";"
59 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0024_const_item.rs b/crates/syntax/test_data/parser/ok/0024_const_item.rs
new file mode 100644
index 000000000..a806a209d
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0024_const_item.rs
@@ -0,0 +1,3 @@
1const _: u32 = 0;
2const FOO: u32 = 92;
3const mut BAR: u32 = 62;
diff --git a/crates/syntax/test_data/parser/ok/0025_extern_fn_in_block.rast b/crates/syntax/test_data/parser/ok/0025_extern_fn_in_block.rast
new file mode 100644
index 000000000..bb6527b48
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0025_extern_fn_in_block.rast
@@ -0,0 +1,31 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "extern"
17 [email protected] " "
18 [email protected] "fn"
19 [email protected] " "
20 [email protected]
21 [email protected] "f"
22 [email protected]
23 [email protected] "("
24 [email protected] ")"
25 [email protected] " "
26 [email protected]
27 [email protected] "{"
28 [email protected] "}"
29 [email protected] "\n"
30 [email protected] "}"
31 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0025_extern_fn_in_block.rs b/crates/syntax/test_data/parser/ok/0025_extern_fn_in_block.rs
new file mode 100644
index 000000000..289809809
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0025_extern_fn_in_block.rs
@@ -0,0 +1,3 @@
1fn main() {
2 extern fn f() {}
3}
diff --git a/crates/syntax/test_data/parser/ok/0026_const_fn_in_block.rast b/crates/syntax/test_data/parser/ok/0026_const_fn_in_block.rast
new file mode 100644
index 000000000..5bcf54deb
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0026_const_fn_in_block.rast
@@ -0,0 +1,30 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "const"
16 [email protected] " "
17 [email protected] "fn"
18 [email protected] " "
19 [email protected]
20 [email protected] "f"
21 [email protected]
22 [email protected] "("
23 [email protected] ")"
24 [email protected] " "
25 [email protected]
26 [email protected] "{"
27 [email protected] "}"
28 [email protected] "\n"
29 [email protected] "}"
30 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0026_const_fn_in_block.rs b/crates/syntax/test_data/parser/ok/0026_const_fn_in_block.rs
new file mode 100644
index 000000000..7641a3d28
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0026_const_fn_in_block.rs
@@ -0,0 +1,3 @@
1fn main() {
2 const fn f() {}
3}
diff --git a/crates/syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rast b/crates/syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rast
new file mode 100644
index 000000000..a7cc12295
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rast
@@ -0,0 +1,41 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "unsafe"
16 [email protected] " "
17 [email protected] "fn"
18 [email protected] " "
19 [email protected]
20 [email protected] "f"
21 [email protected]
22 [email protected] "("
23 [email protected] ")"
24 [email protected] " "
25 [email protected]
26 [email protected] "{"
27 [email protected] "}"
28 [email protected] "\n "
29 [email protected]
30 [email protected] "unsafe"
31 [email protected] " "
32 [email protected]
33 [email protected] "{"
34 [email protected] " "
35 [email protected]
36 [email protected] "92"
37 [email protected] " "
38 [email protected] "}"
39 [email protected] "\n"
40 [email protected] "}"
41 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rs b/crates/syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rs
new file mode 100644
index 000000000..f3c5ff938
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rs
@@ -0,0 +1,4 @@
1fn main() {
2 unsafe fn f() {}
3 unsafe { 92 }
4}
diff --git a/crates/syntax/test_data/parser/ok/0028_operator_binding_power.rast b/crates/syntax/test_data/parser/ok/0028_operator_binding_power.rast
new file mode 100644
index 000000000..3271a4695
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0028_operator_binding_power.rast
@@ -0,0 +1,185 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "binding_power"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "x"
20 [email protected] " "
21 [email protected] "="
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected] "1"
27 [email protected] " "
28 [email protected] "+"
29 [email protected] " "
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected] "2"
34 [email protected] " "
35 [email protected] "*"
36 [email protected] " "
37 [email protected]
38 [email protected] "3"
39 [email protected] " "
40 [email protected] "%"
41 [email protected] " "
42 [email protected]
43 [email protected] "4"
44 [email protected] " "
45 [email protected] "-"
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected] "5"
50 [email protected] " "
51 [email protected] "/"
52 [email protected] " "
53 [email protected]
54 [email protected] "6"
55 [email protected] ";"
56 [email protected] "\n "
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected] "1"
61 [email protected] " "
62 [email protected] "+"
63 [email protected] " "
64 [email protected]
65 [email protected]
66 [email protected] "2"
67 [email protected] " "
68 [email protected] "*"
69 [email protected] " "
70 [email protected]
71 [email protected] "3"
72 [email protected] ";"
73 [email protected] "\n "
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected] "1"
78 [email protected] " "
79 [email protected] "<<"
80 [email protected] " "
81 [email protected]
82 [email protected]
83 [email protected] "2"
84 [email protected] " "
85 [email protected] "+"
86 [email protected] " "
87 [email protected]
88 [email protected] "3"
89 [email protected] ";"
90 [email protected] "\n "
91 [email protected]
92 [email protected]
93 [email protected]
94 [email protected] "1"
95 [email protected] " "
96 [email protected] "&"
97 [email protected] " "
98 [email protected]
99 [email protected]
100 [email protected] "2"
101 [email protected] " "
102 [email protected] ">>"
103 [email protected] " "
104 [email protected]
105 [email protected] "3"
106 [email protected] ";"
107 [email protected] "\n "
108 [email protected]
109 [email protected]
110 [email protected]
111 [email protected] "1"
112 [email protected] " "
113 [email protected] "^"
114 [email protected] " "
115 [email protected]
116 [email protected]
117 [email protected] "2"
118 [email protected] " "
119 [email protected] "&"
120 [email protected] " "
121 [email protected]
122 [email protected] "3"
123 [email protected] ";"
124 [email protected] "\n "
125 [email protected]
126 [email protected]
127 [email protected]
128 [email protected] "1"
129 [email protected] " "
130 [email protected] "|"
131 [email protected] " "
132 [email protected]
133 [email protected]
134 [email protected] "2"
135 [email protected] " "
136 [email protected] "^"
137 [email protected] " "
138 [email protected]
139 [email protected] "3"
140 [email protected] ";"
141 [email protected] "\n "
142 [email protected]
143 [email protected]
144 [email protected]
145 [email protected] "1"
146 [email protected] " "
147 [email protected] "=="
148 [email protected] " "
149 [email protected]
150 [email protected]
151 [email protected] "2"
152 [email protected] " "
153 [email protected] "|"
154 [email protected] " "
155 [email protected]
156 [email protected] "3"
157 [email protected] ";"
158 [email protected] "\n "
159 [email protected]
160 [email protected]
161 [email protected]
162 [email protected] "1"
163 [email protected] " "
164 [email protected] "&&"
165 [email protected] " "
166 [email protected]
167 [email protected]
168 [email protected] "2"
169 [email protected] " "
170 [email protected] "=="
171 [email protected] " "
172 [email protected]
173 [email protected] "3"
174 [email protected] ";"
175 [email protected] "\n "
176 [email protected] "//1 || 2 && 2;"
177 [email protected] "\n "
178 [email protected] "//1 .. 2 || 3;"
179 [email protected] "\n "
180 [email protected] "//1 = 2 .. 3;"
181 [email protected] "\n "
182 [email protected] "//---&*1 - --2 * 9;"
183 [email protected] "\n"
184 [email protected] "}"
185 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0028_operator_binding_power.rs b/crates/syntax/test_data/parser/ok/0028_operator_binding_power.rs
new file mode 100644
index 000000000..cc9598470
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0028_operator_binding_power.rs
@@ -0,0 +1,14 @@
1fn binding_power() {
2 let x = 1 + 2 * 3 % 4 - 5 / 6;
3 1 + 2 * 3;
4 1 << 2 + 3;
5 1 & 2 >> 3;
6 1 ^ 2 & 3;
7 1 | 2 ^ 3;
8 1 == 2 | 3;
9 1 && 2 == 3;
10 //1 || 2 && 2;
11 //1 .. 2 || 3;
12 //1 = 2 .. 3;
13 //---&*1 - --2 * 9;
14}
diff --git a/crates/syntax/test_data/parser/ok/0029_range_forms.rast b/crates/syntax/test_data/parser/ok/0029_range_forms.rast
new file mode 100644
index 000000000..a732f11c4
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0029_range_forms.rast
@@ -0,0 +1,151 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] ".."
17 [email protected]
18 [email protected]
19 [email protected] "1"
20 [email protected] " "
21 [email protected] "+"
22 [email protected] " "
23 [email protected]
24 [email protected] "1"
25 [email protected] ";"
26 [email protected] "\n "
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] ".."
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected] "z"
36 [email protected] " "
37 [email protected] "="
38 [email protected] " "
39 [email protected]
40 [email protected] "2"
41 [email protected] ";"
42 [email protected] "\n "
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "x"
50 [email protected] " "
51 [email protected] "="
52 [email protected] " "
53 [email protected]
54 [email protected]
55 [email protected] "false"
56 [email protected] ".."
57 [email protected]
58 [email protected]
59 [email protected] "1"
60 [email protected] " "
61 [email protected] "=="
62 [email protected] " "
63 [email protected]
64 [email protected] "1"
65 [email protected] ";"
66 [email protected] "\n "
67 [email protected]
68 [email protected] "let"
69 [email protected] " "
70 [email protected]
71 [email protected]
72 [email protected] "x"
73 [email protected] " "
74 [email protected] "="
75 [email protected] " "
76 [email protected]
77 [email protected]
78 [email protected] "1"
79 [email protected] ".."
80 [email protected] ";"
81 [email protected] "\n \n "
82 [email protected]
83 [email protected]
84 [email protected] "..="
85 [email protected]
86 [email protected]
87 [email protected] "1"
88 [email protected] " "
89 [email protected] "+"
90 [email protected] " "
91 [email protected]
92 [email protected] "1"
93 [email protected] ";"
94 [email protected] "\n "
95 [email protected]
96 [email protected]
97 [email protected]
98 [email protected] "..="
99 [email protected]
100 [email protected]
101 [email protected]
102 [email protected]
103 [email protected] "z"
104 [email protected] " "
105 [email protected] "="
106 [email protected] " "
107 [email protected]
108 [email protected] "2"
109 [email protected] ";"
110 [email protected] "\n "
111 [email protected]
112 [email protected]
113 [email protected]
114 [email protected]
115 [email protected]
116 [email protected]
117 [email protected] "x"
118 [email protected] " "
119 [email protected] "="
120 [email protected] " "
121 [email protected]
122 [email protected]
123 [email protected] "false"
124 [email protected] "..="
125 [email protected]
126 [email protected]
127 [email protected] "1"
128 [email protected] " "
129 [email protected] "=="
130 [email protected] " "
131 [email protected]
132 [email protected] "1"
133 [email protected] ";"
134 [email protected] "\n "
135 [email protected]
136 [email protected] "let"
137 [email protected] " "
138 [email protected]
139 [email protected]
140 [email protected] "x"
141 [email protected] " "
142 [email protected] "="
143 [email protected] " "
144 [email protected]
145 [email protected]
146 [email protected] "1"
147 [email protected] ".."
148 [email protected] ";"
149 [email protected] "\n"
150 [email protected] "}"
151 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0029_range_forms.rs b/crates/syntax/test_data/parser/ok/0029_range_forms.rs
new file mode 100644
index 000000000..f9ff444d4
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0029_range_forms.rs
@@ -0,0 +1,11 @@
1fn foo() {
2 ..1 + 1;
3 ..z = 2;
4 x = false..1 == 1;
5 let x = 1..;
6
7 ..=1 + 1;
8 ..=z = 2;
9 x = false..=1 == 1;
10 let x = 1..;
11}
diff --git a/crates/syntax/test_data/parser/ok/0030_string_suffixes.rast b/crates/syntax/test_data/parser/ok/0030_string_suffixes.rast
new file mode 100644
index 000000000..80f7f5942
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0030_string_suffixes.rast
@@ -0,0 +1,63 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected] "_"
19 [email protected] " "
20 [email protected] "="
21 [email protected] " "
22 [email protected]
23 [email protected] "\'c\'u32"
24 [email protected] ";"
25 [email protected] "\n "
26 [email protected]
27 [email protected] "let"
28 [email protected] " "
29 [email protected]
30 [email protected] "_"
31 [email protected] " "
32 [email protected] "="
33 [email protected] " "
34 [email protected]
35 [email protected] "\"string\"invalid"
36 [email protected] ";"
37 [email protected] "\n "
38 [email protected]
39 [email protected] "let"
40 [email protected] " "
41 [email protected]
42 [email protected] "_"
43 [email protected] " "
44 [email protected] "="
45 [email protected] " "
46 [email protected]
47 [email protected] "b\'b\'_suff"
48 [email protected] ";"
49 [email protected] "\n "
50 [email protected]
51 [email protected] "let"
52 [email protected] " "
53 [email protected]
54 [email protected] "_"
55 [email protected] " "
56 [email protected] "="
57 [email protected] " "
58 [email protected]
59 [email protected] "b\"bs\"invalid"
60 [email protected] ";"
61 [email protected] "\n"
62 [email protected] "}"
63 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0030_string_suffixes.rs b/crates/syntax/test_data/parser/ok/0030_string_suffixes.rs
new file mode 100644
index 000000000..261aad1fb
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0030_string_suffixes.rs
@@ -0,0 +1,6 @@
1fn main() {
2 let _ = 'c'u32;
3 let _ = "string"invalid;
4 let _ = b'b'_suff;
5 let _ = b"bs"invalid;
6}
diff --git a/crates/syntax/test_data/parser/ok/0030_traits.rast b/crates/syntax/test_data/parser/ok/0030_traits.rast
new file mode 100644
index 000000000..d07c6683a
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0030_traits.rast
@@ -0,0 +1,61 @@
1[email protected]
2 [email protected]
3 [email protected] "trait"
4 [email protected] " "
5 [email protected]
6 [email protected] "Runnable"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected]
12 [email protected] "fn"
13 [email protected] " "
14 [email protected]
15 [email protected] "handler"
16 [email protected]
17 [email protected] "("
18 [email protected] ")"
19 [email protected] ";"
20 [email protected] "\n"
21 [email protected] "}"
22 [email protected] "\n\n"
23 [email protected]
24 [email protected] "trait"
25 [email protected] " "
26 [email protected]
27 [email protected] "TraitWithExpr"
28 [email protected] " "
29 [email protected]
30 [email protected] "{"
31 [email protected] "\n "
32 [email protected]
33 [email protected] "fn"
34 [email protected] " "
35 [email protected]
36 [email protected] "fn_with_expr"
37 [email protected]
38 [email protected] "("
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected] "x"
43 [email protected] ":"
44 [email protected] " "
45 [email protected]
46 [email protected] "["
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected] "i32"
52 [email protected] ";"
53 [email protected] " "
54 [email protected]
55 [email protected] "1"
56 [email protected] "]"
57 [email protected] ")"
58 [email protected] ";"
59 [email protected] "\n"
60 [email protected] "}"
61 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0030_traits.rs b/crates/syntax/test_data/parser/ok/0030_traits.rs
new file mode 100644
index 000000000..ac30843ef
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0030_traits.rs
@@ -0,0 +1,7 @@
1trait Runnable {
2 fn handler();
3}
4
5trait TraitWithExpr {
6 fn fn_with_expr(x: [i32; 1]);
7}
diff --git a/crates/syntax/test_data/parser/ok/0031_extern.rast b/crates/syntax/test_data/parser/ok/0031_extern.rast
new file mode 100644
index 000000000..8150d445f
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0031_extern.rast
@@ -0,0 +1,973 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "extern"
5 [email protected] " "
6 [email protected]
7 [email protected] "{"
8 [email protected] "\n "
9 [email protected]
10 [email protected]
11 [email protected] "pub"
12 [email protected] " "
13 [email protected] "fn"
14 [email protected] " "
15 [email protected]
16 [email protected] "socket"
17 [email protected]
18 [email protected] "("
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "domain"
23 [email protected] ":"
24 [email protected] " "
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected] "::"
29 [email protected]
30 [email protected] "c_int"
31 [email protected] ","
32 [email protected] " "
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected] "ty"
37 [email protected] ":"
38 [email protected] " "
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected] "::"
43 [email protected]
44 [email protected] "c_int"
45 [email protected] ","
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected] "protocol"
51 [email protected] ":"
52 [email protected] " "
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected] "::"
57 [email protected]
58 [email protected] "c_int"
59 [email protected] ")"
60 [email protected] " "
61 [email protected]
62 [email protected] "->"
63 [email protected] " "
64 [email protected]
65 [email protected]
66 [email protected]
67 [email protected] "::"
68 [email protected]
69 [email protected] "c_int"
70 [email protected] ";"
71 [email protected] "\n "
72 [email protected]
73 [email protected]
74 [email protected] "pub"
75 [email protected] " "
76 [email protected] "fn"
77 [email protected] " "
78 [email protected]
79 [email protected] "bind"
80 [email protected]
81 [email protected] "("
82 [email protected]
83 [email protected]
84 [email protected]
85 [email protected] "fd"
86 [email protected] ":"
87 [email protected] " "
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected] "::"
92 [email protected]
93 [email protected] "c_int"
94 [email protected] ","
95 [email protected] " "
96 [email protected]
97 [email protected]
98 [email protected]
99 [email protected] "addr"
100 [email protected] ":"
101 [email protected] " "
102 [email protected]
103 [email protected] "*"
104 [email protected] "const"
105 [email protected] " "
106 [email protected]
107 [email protected]
108 [email protected]
109 [email protected]
110 [email protected] "sockaddr"
111 [email protected] ","
112 [email protected] " "
113 [email protected]
114 [email protected]
115 [email protected]
116 [email protected] "len"
117 [email protected] ":"
118 [email protected] " "
119 [email protected]
120 [email protected]
121 [email protected]
122 [email protected]
123 [email protected] "socklen_t"
124 [email protected] ")"
125 [email protected] " "
126 [email protected]
127 [email protected] "->"
128 [email protected] " "
129 [email protected]
130 [email protected]
131 [email protected]
132 [email protected] "::"
133 [email protected]
134 [email protected] "c_int"
135 [email protected] ";"
136 [email protected] "\n "
137 [email protected]
138 [email protected]
139 [email protected] "pub"
140 [email protected] " "
141 [email protected] "fn"
142 [email protected] " "
143 [email protected]
144 [email protected] "connect"
145 [email protected]
146 [email protected] "("
147 [email protected]
148 [email protected]
149 [email protected]
150 [email protected] "socket"
151 [email protected] ":"
152 [email protected] " "
153 [email protected]
154 [email protected]
155 [email protected]
156 [email protected] "::"
157 [email protected]
158 [email protected] "c_int"
159 [email protected] ","
160 [email protected] " "
161 [email protected]
162 [email protected]
163 [email protected]
164 [email protected] "address"
165 [email protected] ":"
166 [email protected] " "
167 [email protected]
168 [email protected] "*"
169 [email protected] "const"
170 [email protected] " "
171 [email protected]
172 [email protected]
173 [email protected]
174 [email protected]
175 [email protected] "sockaddr"
176 [email protected] ","
177 [email protected] "\n "
178 [email protected]
179 [email protected]
180 [email protected]
181 [email protected] "len"
182 [email protected] ":"
183 [email protected] " "
184 [email protected]
185 [email protected]
186 [email protected]
187 [email protected]
188 [email protected] "socklen_t"
189 [email protected] ")"
190 [email protected] " "
191 [email protected]
192 [email protected] "->"
193 [email protected] " "
194 [email protected]
195 [email protected]
196 [email protected]
197 [email protected] "::"
198 [email protected]
199 [email protected] "c_int"
200 [email protected] ";"
201 [email protected] "\n "
202 [email protected]
203 [email protected]
204 [email protected] "pub"
205 [email protected] " "
206 [email protected] "fn"
207 [email protected] " "
208 [email protected]
209 [email protected] "listen"
210 [email protected]
211 [email protected] "("
212 [email protected]
213 [email protected]
214 [email protected]
215 [email protected] "socket"
216 [email protected] ":"
217 [email protected] " "
218 [email protected]
219 [email protected]
220 [email protected]
221 [email protected] "::"
222 [email protected]
223 [email protected] "c_int"
224 [email protected] ","
225 [email protected] " "
226 [email protected]
227 [email protected]
228 [email protected]
229 [email protected] "backlog"
230 [email protected] ":"
231 [email protected] " "
232 [email protected]
233 [email protected]
234 [email protected]
235 [email protected] "::"
236 [email protected]
237 [email protected] "c_int"
238 [email protected] ")"
239 [email protected] " "
240 [email protected]
241 [email protected] "->"
242 [email protected] " "
243 [email protected]
244 [email protected]
245 [email protected]
246 [email protected] "::"
247 [email protected]
248 [email protected] "c_int"
249 [email protected] ";"
250 [email protected] "\n "
251 [email protected]
252 [email protected]
253 [email protected] "pub"
254 [email protected] " "
255 [email protected] "fn"
256 [email protected] " "
257 [email protected]
258 [email protected] "getsockname"
259 [email protected]
260 [email protected] "("
261 [email protected]
262 [email protected]
263 [email protected]
264 [email protected] "socket"
265 [email protected] ":"
266 [email protected] " "
267 [email protected]
268 [email protected]
269 [email protected]
270 [email protected] "::"
271 [email protected]
272 [email protected] "c_int"
273 [email protected] ","
274 [email protected] " "
275 [email protected]
276 [email protected]
277 [email protected]
278 [email protected] "address"
279 [email protected] ":"
280 [email protected] " "
281 [email protected]
282 [email protected] "*"
283 [email protected] "mut"
284 [email protected] " "
285 [email protected]
286 [email protected]
287 [email protected]
288 [email protected]
289 [email protected] "sockaddr"
290 [email protected] ","
291 [email protected] "\n "
292 [email protected]
293 [email protected]
294 [email protected]
295 [email protected] "address_len"
296 [email protected] ":"
297 [email protected] " "
298 [email protected]
299 [email protected] "*"
300 [email protected] "mut"
301 [email protected] " "
302 [email protected]
303 [email protected]
304 [email protected]
305 [email protected]
306 [email protected] "socklen_t"
307 [email protected] ")"
308 [email protected] " "
309 [email protected]
310 [email protected] "->"
311 [email protected] " "
312 [email protected]
313 [email protected]
314 [email protected]
315 [email protected] "::"
316 [email protected]
317 [email protected] "c_int"
318 [email protected] ";"
319 [email protected] "\n "
320 [email protected]
321 [email protected]
322 [email protected] "pub"
323 [email protected] " "
324 [email protected] "fn"
325 [email protected] " "
326 [email protected]
327 [email protected] "getsockopt"
328 [email protected]
329 [email protected] "("
330 [email protected]
331 [email protected]
332 [email protected]
333 [email protected] "sockfd"
334 [email protected] ":"
335 [email protected] " "
336 [email protected]
337 [email protected]
338 [email protected]
339 [email protected] "::"
340 [email protected]
341 [email protected] "c_int"
342 [email protected] ","
343 [email protected] "\n "
344 [email protected]
345 [email protected]
346 [email protected]
347 [email protected] "level"
348 [email protected] ":"
349 [email protected] " "
350 [email protected]
351 [email protected]
352 [email protected]
353 [email protected] "::"
354 [email protected]
355 [email protected] "c_int"
356 [email protected] ","
357 [email protected] "\n "
358 [email protected]
359 [email protected]
360 [email protected]
361 [email protected] "optname"
362 [email protected] ":"
363 [email protected] " "
364 [email protected]
365 [email protected]
366 [email protected]
367 [email protected] "::"
368 [email protected]
369 [email protected] "c_int"
370 [email protected] ","
371 [email protected] "\n "
372 [email protected]
373 [email protected]
374 [email protected]
375 [email protected] "optval"
376 [email protected] ":"
377 [email protected] " "
378 [email protected]
379 [email protected] "*"
380 [email protected] "mut"
381 [email protected] " "
382 [email protected]
383 [email protected]
384 [email protected]
385 [email protected] "::"
386 [email protected]
387 [email protected] "c_void"
388 [email protected] ","
389 [email protected] "\n "
390 [email protected]
391 [email protected]
392 [email protected]
393 [email protected] "optlen"
394 [email protected] ":"
395 [email protected] " "
396 [email protected]
397 [email protected] "*"
398 [email protected] "mut"
399 [email protected] " "
400 [email protected]
401 [email protected]
402 [email protected]
403 [email protected] "::"
404 [email protected]
405 [email protected] "socklen_t"
406 [email protected] ")"
407 [email protected] " "
408 [email protected]
409 [email protected] "->"
410 [email protected] " "
411 [email protected]
412 [email protected]
413 [email protected]
414 [email protected] "::"
415 [email protected]
416 [email protected] "c_int"
417 [email protected] ";"
418 [email protected] "\n "
419 [email protected]
420 [email protected]
421 [email protected] "pub"
422 [email protected] " "
423 [email protected] "fn"
424 [email protected] " "
425 [email protected]
426 [email protected] "setsockopt"
427 [email protected]
428 [email protected] "("
429 [email protected]
430 [email protected]
431 [email protected]
432 [email protected] "socket"
433 [email protected] ":"
434 [email protected] " "
435 [email protected]
436 [email protected]
437 [email protected]
438 [email protected] "::"
439 [email protected]
440 [email protected] "c_int"
441 [email protected] ","
442 [email protected] " "
443 [email protected]
444 [email protected]
445 [email protected]
446 [email protected] "level"
447 [email protected] ":"
448 [email protected] " "
449 [email protected]
450 [email protected]
451 [email protected]
452 [email protected] "::"
453 [email protected]
454 [email protected] "c_int"
455 [email protected] ","
456 [email protected] " "
457 [email protected]
458 [email protected]
459 [email protected]
460 [email protected] "name"
461 [email protected] ":"
462 [email protected] " "
463 [email protected]
464 [email protected]
465 [email protected]
466 [email protected] "::"
467 [email protected]
468 [email protected] "c_int"
469 [email protected] ","
470 [email protected] "\n "
471 [email protected]
472 [email protected]
473 [email protected]
474 [email protected] "value"
475 [email protected] ":"
476 [email protected] " "
477 [email protected]
478 [email protected] "*"
479 [email protected] "const"
480 [email protected] " "
481 [email protected]
482 [email protected]
483 [email protected]
484 [email protected] "::"
485 [email protected]
486 [email protected] "c_void"
487 [email protected] ","
488 [email protected] "\n "
489 [email protected]
490 [email protected]
491 [email protected]
492 [email protected] "option_len"
493 [email protected] ":"
494 [email protected] " "
495 [email protected]
496 [email protected]
497 [email protected]
498 [email protected]
499 [email protected] "socklen_t"
500 [email protected] ")"
501 [email protected] " "
502 [email protected]
503 [email protected] "->"
504 [email protected] " "
505 [email protected]
506 [email protected]
507 [email protected]
508 [email protected] "::"
509 [email protected]
510 [email protected] "c_int"
511 [email protected] ";"
512 [email protected] "\n "
513 [email protected]
514 [email protected]
515 [email protected] "pub"
516 [email protected] " "
517 [email protected] "fn"
518 [email protected] " "
519 [email protected]
520 [email protected] "getpeername"
521 [email protected]
522 [email protected] "("
523 [email protected]
524 [email protected]
525 [email protected]
526 [email protected] "socket"
527 [email protected] ":"
528 [email protected] " "
529 [email protected]
530 [email protected]
531 [email protected]
532 [email protected] "::"
533 [email protected]
534 [email protected] "c_int"
535 [email protected] ","
536 [email protected] " "
537 [email protected]
538 [email protected]
539 [email protected]
540 [email protected] "address"
541 [email protected] ":"
542 [email protected] " "
543 [email protected]
544 [email protected] "*"
545 [email protected] "mut"
546 [email protected] " "
547 [email protected]
548 [email protected]
549 [email protected]
550 [email protected]
551 [email protected] "sockaddr"
552 [email protected] ","
553 [email protected] "\n "
554 [email protected]
555 [email protected]
556 [email protected]
557 [email protected] "address_len"
558 [email protected] ":"
559 [email protected] " "
560 [email protected]
561 [email protected] "*"
562 [email protected] "mut"
563 [email protected] " "
564 [email protected]
565 [email protected]
566 [email protected]
567 [email protected]
568 [email protected] "socklen_t"
569 [email protected] ")"
570 [email protected] " "
571 [email protected]
572 [email protected] "->"
573 [email protected] " "
574 [email protected]
575 [email protected]
576 [email protected]
577 [email protected] "::"
578 [email protected]
579 [email protected] "c_int"
580 [email protected] ";"
581 [email protected] "\n "
582 [email protected]
583 [email protected]
584 [email protected] "pub"
585 [email protected] " "
586 [email protected] "fn"
587 [email protected] " "
588 [email protected]
589 [email protected] "sendto"
590 [email protected]
591 [email protected] "("
592 [email protected]
593 [email protected]
594 [email protected]
595 [email protected] "socket"
596 [email protected] ":"
597 [email protected] " "
598 [email protected]
599 [email protected]
600 [email protected]
601 [email protected] "::"
602 [email protected]
603 [email protected] "c_int"
604 [email protected] ","
605 [email protected] " "
606 [email protected]
607 [email protected]
608 [email protected]
609 [email protected] "buf"
610 [email protected] ":"
611 [email protected] " "
612 [email protected]
613 [email protected] "*"
614 [email protected] "const"
615 [email protected] " "
616 [email protected]
617 [email protected]
618 [email protected]
619 [email protected] "::"
620 [email protected]
621 [email protected] "c_void"
622 [email protected] ","
623 [email protected] " "
624 [email protected]
625 [email protected]
626 [email protected]
627 [email protected] "len"
628 [email protected] ":"
629 [email protected] " "
630 [email protected]
631 [email protected]
632 [email protected]
633 [email protected] "::"
634 [email protected]
635 [email protected] "size_t"
636 [email protected] ","
637 [email protected] "\n "
638 [email protected]
639 [email protected]
640 [email protected]
641 [email protected] "flags"
642 [email protected] ":"
643 [email protected] " "
644 [email protected]
645 [email protected]
646 [email protected]
647 [email protected] "::"
648 [email protected]
649 [email protected] "c_int"
650 [email protected] ","
651 [email protected] " "
652 [email protected]
653 [email protected]
654 [email protected]
655 [email protected] "addr"
656 [email protected] ":"
657 [email protected] " "
658 [email protected]
659 [email protected] "*"
660 [email protected] "const"
661 [email protected] " "
662 [email protected]
663 [email protected]
664 [email protected]
665 [email protected]
666 [email protected] "sockaddr"
667 [email protected] ","
668 [email protected] "\n "
669 [email protected]
670 [email protected]
671 [email protected]
672 [email protected] "addrlen"
673 [email protected] ":"
674 [email protected] " "
675 [email protected]
676 [email protected]
677 [email protected]
678 [email protected]
679 [email protected] "socklen_t"
680 [email protected] ")"
681 [email protected] " "
682 [email protected]
683 [email protected] "->"
684 [email protected] " "
685 [email protected]
686 [email protected]
687 [email protected]
688 [email protected] "::"
689 [email protected]
690 [email protected] "ssize_t"
691 [email protected] ";"
692 [email protected] "\n "
693 [email protected]
694 [email protected]
695 [email protected] "pub"
696 [email protected] " "
697 [email protected] "fn"
698 [email protected] " "
699 [email protected]
700 [email protected] "send"
701 [email protected]
702 [email protected] "("
703 [email protected]
704 [email protected]
705 [email protected]
706 [email protected] "socket"
707 [email protected] ":"
708 [email protected] " "
709 [email protected]
710 [email protected]
711 [email protected]
712 [email protected] "::"
713 [email protected]
714 [email protected] "c_int"
715 [email protected] ","
716 [email protected] " "
717 [email protected]
718 [email protected]
719 [email protected]
720 [email protected] "buf"
721 [email protected] ":"
722 [email protected] " "
723 [email protected]
724 [email protected] "*"
725 [email protected] "const"
726 [email protected] " "
727 [email protected]
728 [email protected]
729 [email protected]
730 [email protected] "::"
731 [email protected]
732 [email protected] "c_void"
733 [email protected] ","
734 [email protected] " "
735 [email protected]
736 [email protected]
737 [email protected]
738 [email protected] "len"
739 [email protected] ":"
740 [email protected] " "
741 [email protected]
742 [email protected]
743 [email protected]
744 [email protected] "::"
745 [email protected]
746 [email protected] "size_t"
747 [email protected] ","
748 [email protected] "\n "
749 [email protected]
750 [email protected]
751 [email protected]
752 [email protected] "flags"
753 [email protected] ":"
754 [email protected] " "
755 [email protected]
756 [email protected]
757 [email protected]
758 [email protected] "::"
759 [email protected]
760 [email protected] "c_int"
761 [email protected] ")"
762 [email protected] " "
763 [email protected]
764 [email protected] "->"
765 [email protected] " "
766 [email protected]
767 [email protected]
768 [email protected]
769 [email protected] "::"
770 [email protected]
771 [email protected] "ssize_t"
772 [email protected] ";"
773 [email protected] "\n "
774 [email protected]
775 [email protected]
776 [email protected] "pub"
777 [email protected] " "
778 [email protected] "fn"
779 [email protected] " "
780 [email protected]
781 [email protected] "recvfrom"
782 [email protected]
783 [email protected] "("
784 [email protected]
785 [email protected]
786 [email protected]
787 [email protected] "socket"
788 [email protected] ":"
789 [email protected] " "
790 [email protected]
791 [email protected]
792 [email protected]
793 [email protected] "::"
794 [email protected]
795 [email protected] "c_int"
796 [email protected] ","
797 [email protected] " "
798 [email protected]
799 [email protected]
800 [email protected]
801 [email protected] "buf"
802 [email protected] ":"
803 [email protected] " "
804 [email protected]
805 [email protected] "*"
806 [email protected] "mut"
807 [email protected] " "
808 [email protected]
809 [email protected]
810 [email protected]
811 [email protected] "::"
812 [email protected]
813 [email protected] "c_void"
814 [email protected] ","
815 [email protected] " "
816 [email protected]
817 [email protected]
818 [email protected]
819 [email protected] "len"
820 [email protected] ":"
821 [email protected] " "
822 [email protected]
823 [email protected]
824 [email protected]
825 [email protected] "::"
826 [email protected]
827 [email protected] "size_t"
828 [email protected] ","
829 [email protected] "\n "
830 [email protected]
831 [email protected]
832 [email protected]
833 [email protected] "flags"
834 [email protected] ":"
835 [email protected] " "
836 [email protected]
837 [email protected]
838 [email protected]
839 [email protected] "::"
840 [email protected]
841 [email protected] "c_int"
842 [email protected] ","
843 [email protected] " "
844 [email protected]
845 [email protected]
846 [email protected]
847 [email protected] "addr"
848 [email protected] ":"
849 [email protected] " "
850 [email protected]
851 [email protected] "*"
852 [email protected] "mut"
853 [email protected] " "
854 [email protected]
855 [email protected]
856 [email protected]
857 [email protected] "::"
858 [email protected]
859 [email protected] "sockaddr"
860 [email protected] ","
861 [email protected] "\n "
862 [email protected]
863 [email protected]
864 [email protected]
865 [email protected] "addrlen"
866 [email protected] ":"
867 [email protected] " "
868 [email protected]
869 [email protected] "*"
870 [email protected] "mut"
871 [email protected] " "
872 [email protected]
873 [email protected]
874 [email protected]
875 [email protected] "::"
876 [email protected]
877 [email protected] "socklen_t"
878 [email protected] ")"
879 [email protected] " "
880 [email protected]
881 [email protected] "->"
882 [email protected] " "
883 [email protected]
884 [email protected]
885 [email protected]
886 [email protected] "::"
887 [email protected]
888 [email protected] "ssize_t"
889 [email protected] ";"
890 [email protected] "\n "
891 [email protected]
892 [email protected]
893 [email protected] "pub"
894 [email protected] " "
895 [email protected] "fn"
896 [email protected] " "
897 [email protected]
898 [email protected] "recv"
899 [email protected]
900 [email protected] "("
901 [email protected]
902 [email protected]
903 [email protected]
904 [email protected] "socket"
905 [email protected] ":"
906 [email protected] " "
907 [email protected]
908 [email protected]
909 [email protected]
910 [email protected] "::"
911 [email protected]
912 [email protected] "c_int"
913 [email protected] ","
914 [email protected] " "
915 [email protected]
916 [email protected]
917 [email protected]
918 [email protected] "buf"
919 [email protected] ":"
920 [email protected] " "
921 [email protected]
922 [email protected] "*"
923 [email protected] "mut"
924 [email protected] " "
925 [email protected]
926 [email protected]
927 [email protected]
928 [email protected] "::"
929 [email protected]
930 [email protected] "c_void"
931 [email protected] ","
932 [email protected] " "
933 [email protected]
934 [email protected]
935 [email protected]
936 [email protected] "len"
937 [email protected] ":"
938 [email protected] " "
939 [email protected]
940 [email protected]
941 [email protected]
942 [email protected] "::"
943 [email protected]
944 [email protected] "size_t"
945 [email protected] ","
946 [email protected] "\n "
947 [email protected]
948 [email protected]
949 [email protected]
950 [email protected] "flags"
951 [email protected] ":"
952 [email protected] " "
953 [email protected]
954 [email protected]
955 [email protected]
956 [email protected] "::"
957 [email protected]
958 [email protected] "c_int"
959 [email protected] ")"
960 [email protected] " "
961 [email protected]
962 [email protected] "->"
963 [email protected] " "
964 [email protected]
965 [email protected]
966 [email protected]
967 [email protected] "::"
968 [email protected]
969 [email protected] "ssize_t"
970 [email protected] ";"
971 [email protected] "\n"
972 [email protected] "}"
973 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0031_extern.rs b/crates/syntax/test_data/parser/ok/0031_extern.rs
new file mode 100644
index 000000000..b33ac273c
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0031_extern.rs
@@ -0,0 +1,29 @@
1extern {
2 pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
3 pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int;
4 pub fn connect(socket: ::c_int, address: *const sockaddr,
5 len: socklen_t) -> ::c_int;
6 pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
7 pub fn getsockname(socket: ::c_int, address: *mut sockaddr,
8 address_len: *mut socklen_t) -> ::c_int;
9 pub fn getsockopt(sockfd: ::c_int,
10 level: ::c_int,
11 optname: ::c_int,
12 optval: *mut ::c_void,
13 optlen: *mut ::socklen_t) -> ::c_int;
14 pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int,
15 value: *const ::c_void,
16 option_len: socklen_t) -> ::c_int;
17 pub fn getpeername(socket: ::c_int, address: *mut sockaddr,
18 address_len: *mut socklen_t) -> ::c_int;
19 pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
20 flags: ::c_int, addr: *const sockaddr,
21 addrlen: socklen_t) -> ::ssize_t;
22 pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
23 flags: ::c_int) -> ::ssize_t;
24 pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
25 flags: ::c_int, addr: *mut ::sockaddr,
26 addrlen: *mut ::socklen_t) -> ::ssize_t;
27 pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
28 flags: ::c_int) -> ::ssize_t;
29}
diff --git a/crates/syntax/test_data/parser/ok/0032_where_for.rast b/crates/syntax/test_data/parser/ok/0032_where_for.rast
new file mode 100644
index 000000000..d59548f21
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0032_where_for.rast
@@ -0,0 +1,90 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "test_serialization"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "SER"
12 [email protected] ">"
13 [email protected]
14 [email protected] "("
15 [email protected] ")"
16 [email protected] "\n"
17 [email protected]
18 [email protected] "where"
19 [email protected] "\n "
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "SER"
26 [email protected] ":"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "Serialize"
35 [email protected] " "
36 [email protected] "+"
37 [email protected] " "
38 [email protected]
39 [email protected]
40 [email protected] "for"
41 [email protected]
42 [email protected] "<"
43 [email protected]
44 [email protected] "\'de"
45 [email protected] ">"
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected] "Deserialize"
52 [email protected]
53 [email protected] "<"
54 [email protected]
55 [email protected] "\'de"
56 [email protected] ">"
57 [email protected] " "
58 [email protected] "+"
59 [email protected] " "
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected]
64 [email protected]
65 [email protected] "PartialEq"
66 [email protected] " "
67 [email protected] "+"
68 [email protected] " "
69 [email protected]
70 [email protected]
71 [email protected]
72 [email protected]
73 [email protected]
74 [email protected]
75 [email protected]
76 [email protected] "std"
77 [email protected] "::"
78 [email protected]
79 [email protected]
80 [email protected] "fmt"
81 [email protected] "::"
82 [email protected]
83 [email protected]
84 [email protected] "Debug"
85 [email protected] ","
86 [email protected] "\n"
87 [email protected]
88 [email protected] "{"
89 [email protected] "}"
90 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0032_where_for.rs b/crates/syntax/test_data/parser/ok/0032_where_for.rs
new file mode 100644
index 000000000..588170fbe
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0032_where_for.rs
@@ -0,0 +1,4 @@
1fn test_serialization<SER>()
2where
3 SER: Serialize + for<'de> Deserialize<'de> + PartialEq + std::fmt::Debug,
4{}
diff --git a/crates/syntax/test_data/parser/ok/0033_label_break.rast b/crates/syntax/test_data/parser/ok/0033_label_break.rast
new file mode 100644
index 000000000..88800ca7a
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0033_label_break.rast
@@ -0,0 +1,215 @@
1[email protected]
2 [email protected]
3 [email protected] "// format with label ..."
4 [email protected] "\n"
5 [email protected] "fn"
6 [email protected] " "
7 [email protected]
8 [email protected] "main"
9 [email protected]
10 [email protected] "("
11 [email protected] ")"
12 [email protected] " "
13 [email protected]
14 [email protected] "{"
15 [email protected] "\n "
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "\'empty_block"
20 [email protected] ":"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] "\n\n "
26 [email protected]
27 [email protected]
28 [email protected]
29 [email protected] "\'block"
30 [email protected] ":"
31 [email protected] " "
32 [email protected]
33 [email protected] "{"
34 [email protected] "\n "
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "do_thing"
42 [email protected]
43 [email protected] "("
44 [email protected] ")"
45 [email protected] ";"
46 [email protected] "\n "
47 [email protected]
48 [email protected]
49 [email protected] "if"
50 [email protected] " "
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected]
57 [email protected] "condition_not_met"
58 [email protected]
59 [email protected] "("
60 [email protected] ")"
61 [email protected] " "
62 [email protected]
63 [email protected] "{"
64 [email protected] "\n "
65 [email protected]
66 [email protected]
67 [email protected] "break"
68 [email protected] " "
69 [email protected] "\'block"
70 [email protected] ";"
71 [email protected] "\n "
72 [email protected] "}"
73 [email protected] "\n "
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected] "do_next_thing"
81 [email protected]
82 [email protected] "("
83 [email protected] ")"
84 [email protected] ";"
85 [email protected] "\n "
86 [email protected]
87 [email protected]
88 [email protected] "if"
89 [email protected] " "
90 [email protected]
91 [email protected]
92 [email protected]
93 [email protected]
94 [email protected]
95 [email protected]
96 [email protected] "condition_not_met"
97 [email protected]
98 [email protected] "("
99 [email protected] ")"
100 [email protected] " "
101 [email protected]
102 [email protected] "{"
103 [email protected] "\n "
104 [email protected]
105 [email protected]
106 [email protected] "break"
107 [email protected] " "
108 [email protected] "\'block"
109 [email protected] ";"
110 [email protected] "\n "
111 [email protected] "}"
112 [email protected] "\n "
113 [email protected]
114 [email protected]
115 [email protected]
116 [email protected]
117 [email protected]
118 [email protected]
119 [email protected] "do_last_thing"
120 [email protected]
121 [email protected] "("
122 [email protected] ")"
123 [email protected] ";"
124 [email protected] "\n "
125 [email protected] "}"
126 [email protected] "\n\n "
127 [email protected]
128 [email protected] "let"
129 [email protected] " "
130 [email protected]
131 [email protected]
132 [email protected] "result"
133 [email protected] " "
134 [email protected] "="
135 [email protected] " "
136 [email protected]
137 [email protected]
138 [email protected] "\'block"
139 [email protected] ":"
140 [email protected] " "
141 [email protected]
142 [email protected] "{"
143 [email protected] "\n "
144 [email protected]
145 [email protected]
146 [email protected] "if"
147 [email protected] " "
148 [email protected]
149 [email protected]
150 [email protected]
151 [email protected]
152 [email protected]
153 [email protected]
154 [email protected] "foo"
155 [email protected]
156 [email protected] "("
157 [email protected] ")"
158 [email protected] " "
159 [email protected]
160 [email protected] "{"
161 [email protected] "\n "
162 [email protected] "// comment"
163 [email protected] "\n "
164 [email protected]
165 [email protected]
166 [email protected] "break"
167 [email protected] " "
168 [email protected] "\'block"
169 [email protected] " "
170 [email protected]
171 [email protected] "1"
172 [email protected] ";"
173 [email protected] "\n "
174 [email protected] "}"
175 [email protected] "\n "
176 [email protected]
177 [email protected]
178 [email protected] "if"
179 [email protected] " "
180 [email protected]
181 [email protected]
182 [email protected]
183 [email protected]
184 [email protected]
185 [email protected]
186 [email protected] "bar"
187 [email protected]
188 [email protected] "("
189 [email protected] ")"
190 [email protected] " "
191 [email protected]
192 [email protected] "{"
193 [email protected] "\n "
194 [email protected] "/* comment */"
195 [email protected] "\n "
196 [email protected]
197 [email protected]
198 [email protected] "break"
199 [email protected] " "
200 [email protected] "\'block"
201 [email protected] " "
202 [email protected]
203 [email protected] "2"
204 [email protected] ";"
205 [email protected] "\n "
206 [email protected] "}"
207 [email protected] "\n "
208 [email protected]
209 [email protected] "3"
210 [email protected] "\n "
211 [email protected] "}"
212 [email protected] ";"
213 [email protected] "\n"
214 [email protected] "}"
215 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0033_label_break.rs b/crates/syntax/test_data/parser/ok/0033_label_break.rs
new file mode 100644
index 000000000..728d78137
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0033_label_break.rs
@@ -0,0 +1,28 @@
1// format with label break value.
2fn main() {
3 'empty_block: {}
4
5 'block: {
6 do_thing();
7 if condition_not_met() {
8 break 'block;
9 }
10 do_next_thing();
11 if condition_not_met() {
12 break 'block;
13 }
14 do_last_thing();
15 }
16
17 let result = 'block: {
18 if foo() {
19 // comment
20 break 'block 1;
21 }
22 if bar() {
23 /* comment */
24 break 'block 2;
25 }
26 3
27 };
28}
diff --git a/crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rast b/crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rast
new file mode 100644
index 000000000..5ad8c570d
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rast
@@ -0,0 +1,41 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "make_query"
21 [email protected]
22 [email protected] "("
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected] "crate"
29 [email protected] "::"
30 [email protected]
31 [email protected]
32 [email protected] "module_map"
33 [email protected] "::"
34 [email protected]
35 [email protected]
36 [email protected] "module_tree"
37 [email protected] ")"
38 [email protected] ";"
39 [email protected] "\n"
40 [email protected] "}"
41 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rs b/crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rs
new file mode 100644
index 000000000..f1ed30220
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0034_crate_path_in_call.rs
@@ -0,0 +1,3 @@
1fn main() {
2 make_query(crate::module_map::module_tree);
3}
diff --git a/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
new file mode 100644
index 000000000..7c61b5006
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
@@ -0,0 +1,2291 @@
1[email protected]
2 [email protected] "//! Adapted from a `r ..."
3 [email protected] "\n"
4 [email protected] "//! https://github.co ..."
5 [email protected] "\n"
6 [email protected] "//! "
7 [email protected] "\n"
8 [email protected] "//! Reported to rust- ..."
9 [email protected] "\n\n"
10 [email protected]
11 [email protected] "#"
12 [email protected] "!"
13 [email protected] "["
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "allow"
18 [email protected]
19 [email protected] "("
20 [email protected] "non_camel_case_types"
21 [email protected] ")"
22 [email protected] "]"
23 [email protected] "\n"
24 [email protected]
25 [email protected] "#"
26 [email protected] "!"
27 [email protected] "["
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "allow"
32 [email protected]
33 [email protected] "("
34 [email protected] "dead_code"
35 [email protected] ")"
36 [email protected] "]"
37 [email protected] "\n"
38 [email protected]
39 [email protected] "#"
40 [email protected] "!"
41 [email protected] "["
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected] "allow"
46 [email protected]
47 [email protected] "("
48 [email protected] "unreachable_code"
49 [email protected] ")"
50 [email protected] "]"
51 [email protected] "\n"
52 [email protected]
53 [email protected] "#"
54 [email protected] "!"
55 [email protected] "["
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected] "allow"
60 [email protected]
61 [email protected] "("
62 [email protected] "unused_parens"
63 [email protected] ")"
64 [email protected] "]"
65 [email protected] "\n\n"
66 [email protected]
67 [email protected] "#"
68 [email protected] "!"
69 [email protected] "["
70 [email protected]
71 [email protected]
72 [email protected]
73 [email protected] "recursion_limit"
74 [email protected] " "
75 [email protected] "="
76 [email protected] " "
77 [email protected]
78 [email protected] "\"128\""
79 [email protected] "]"
80 [email protected] "\n\n"
81 [email protected]
82 [email protected] "use"
83 [email protected] " "
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected] "std"
91 [email protected] "::"
92 [email protected]
93 [email protected]
94 [email protected] "cell"
95 [email protected] "::"
96 [email protected]
97 [email protected]
98 [email protected] "Cell"
99 [email protected] ";"
100 [email protected] "\n"
101 [email protected]
102 [email protected] "use"
103 [email protected] " "
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected]
108 [email protected]
109 [email protected]
110 [email protected] "std"
111 [email protected] "::"
112 [email protected]
113 [email protected]
114 [email protected] "mem"
115 [email protected] "::"
116 [email protected]
117 [email protected]
118 [email protected] "swap"
119 [email protected] ";"
120 [email protected] "\n\n"
121 [email protected] "// Just a grab bag of ..."
122 [email protected] "\n\n"
123 [email protected]
124 [email protected] "fn"
125 [email protected] " "
126 [email protected]
127 [email protected] "strange"
128 [email protected]
129 [email protected] "("
130 [email protected] ")"
131 [email protected] " "
132 [email protected]
133 [email protected] "->"
134 [email protected] " "
135 [email protected]
136 [email protected]
137 [email protected]
138 [email protected]
139 [email protected] "bool"
140 [email protected] " "
141 [email protected]
142 [email protected] "{"
143 [email protected] " "
144 [email protected]
145 [email protected] "let"
146 [email protected] " "
147 [email protected]
148 [email protected]
149 [email protected] "_x"
150 [email protected] ":"
151 [email protected] " "
152 [email protected]
153 [email protected]
154 [email protected]
155 [email protected]
156 [email protected] "bool"
157 [email protected] " "
158 [email protected] "="
159 [email protected] " "
160 [email protected]
161 [email protected] "return"
162 [email protected] " "
163 [email protected]
164 [email protected] "true"
165 [email protected] ";"
166 [email protected] " "
167 [email protected] "}"
168 [email protected] "\n\n"
169 [email protected]
170 [email protected] "fn"
171 [email protected] " "
172 [email protected]
173 [email protected] "funny"
174 [email protected]
175 [email protected] "("
176 [email protected] ")"
177 [email protected] " "
178 [email protected]
179 [email protected] "{"
180 [email protected] "\n "
181 [email protected]
182 [email protected] "fn"
183 [email protected] " "
184 [email protected]
185 [email protected] "f"
186 [email protected]
187 [email protected] "("
188 [email protected]
189 [email protected]
190 [email protected]
191 [email protected] "_x"
192 [email protected] ":"
193 [email protected] " "
194 [email protected]
195 [email protected] "("
196 [email protected] ")"
197 [email protected] ")"
198 [email protected] " "
199 [email protected]
200 [email protected] "{"
201 [email protected] " "
202 [email protected] "}"
203 [email protected] "\n "
204 [email protected]
205 [email protected]
206 [email protected]
207 [email protected]
208 [email protected]
209 [email protected]
210 [email protected] "f"
211 [email protected]
212 [email protected] "("
213 [email protected]
214 [email protected] "return"
215 [email protected] ")"
216 [email protected] ";"
217 [email protected] "\n"
218 [email protected] "}"
219 [email protected] "\n\n"
220 [email protected]
221 [email protected] "fn"
222 [email protected] " "
223 [email protected]
224 [email protected] "what"
225 [email protected]
226 [email protected] "("
227 [email protected] ")"
228 [email protected] " "
229 [email protected]
230 [email protected] "{"
231 [email protected] "\n "
232 [email protected]
233 [email protected] "fn"
234 [email protected] " "
235 [email protected]
236 [email protected] "the"
237 [email protected]
238 [email protected] "("
239 [email protected]
240 [email protected]
241 [email protected]
242 [email protected] "x"
243 [email protected] ":"
244 [email protected] " "
245 [email protected]
246 [email protected] "&"
247 [email protected]
248 [email protected]
249 [email protected]
250 [email protected]
251 [email protected] "Cell"
252 [email protected]
253 [email protected] "<"
254 [email protected]
255 [email protected]
256 [email protected]
257 [email protected]
258 [email protected]
259 [email protected] "bool"
260 [email protected] ">"
261 [email protected] ")"
262 [email protected] " "
263 [email protected]
264 [email protected] "{"
265 [email protected] "\n "
266 [email protected]
267 [email protected]
268 [email protected] "return"
269 [email protected] " "
270 [email protected]
271 [email protected] "while"
272 [email protected] " "
273 [email protected]
274 [email protected]
275 [email protected] "!"
276 [email protected]
277 [email protected]
278 [email protected]
279 [email protected]
280 [email protected]
281 [email protected] "x"
282 [email protected] "."
283 [email protected]
284 [email protected] "get"
285 [email protected]
286 [email protected] "("
287 [email protected] ")"
288 [email protected] " "
289 [email protected]
290 [email protected] "{"
291 [email protected] " "
292 [email protected]
293 [email protected]
294 [email protected]
295 [email protected]
296 [email protected]
297 [email protected]
298 [email protected] "x"
299 [email protected] "."
300 [email protected]
301 [email protected] "set"
302 [email protected]
303 [email protected] "("
304 [email protected]
305 [email protected] "true"
306 [email protected] ")"
307 [email protected] ";"
308 [email protected] " "
309 [email protected] "}"
310 [email protected] ";"
311 [email protected] "\n "
312 [email protected] "}"
313 [email protected] "\n "
314 [email protected]
315 [email protected] "let"
316 [email protected] " "
317 [email protected]
318 [email protected]
319 [email protected] "i"
320 [email protected] " "
321 [email protected] "="
322 [email protected] " "
323 [email protected]
324 [email protected] "&"
325 [email protected]
326 [email protected]
327 [email protected]
328 [email protected]
329 [email protected]
330 [email protected]
331 [email protected] "Cell"
332 [email protected] "::"
333 [email protected]
334 [email protected]
335 [email protected] "new"
336 [email protected]
337 [email protected] "("
338 [email protected]
339 [email protected] "false"
340 [email protected] ")"
341 [email protected] ";"
342 [email protected] "\n "
343 [email protected]
344 [email protected] "let"
345 [email protected] " "
346 [email protected]
347 [email protected]
348 [email protected] "dont"
349 [email protected] " "
350 [email protected] "="
351 [email protected] " "
352 [email protected]
353 [email protected] "{"
354 [email protected]
355 [email protected]
356 [email protected] "|"
357 [email protected] "|"
358 [email protected]
359 [email protected]
360 [email protected]
361 [email protected]
362 [email protected]
363 [email protected] "the"
364 [email protected]
365 [email protected] "("
366 [email protected]
367 [email protected]
368 [email protected]
369 [email protected]
370 [email protected] "i"
371 [email protected] ")"
372 [email protected] "}"
373 [email protected] ";"
374 [email protected] "\n "
375 [email protected]
376 [email protected]
377 [email protected]
378 [email protected]
379 [email protected]
380 [email protected]
381 [email protected] "dont"
382 [email protected]
383 [email protected] "("
384 [email protected] ")"
385 [email protected] ";"
386 [email protected] "\n "
387 [email protected]
388 [email protected]
389 [email protected]
390 [email protected]
391 [email protected]
392 [email protected] "assert"
393 [email protected] "!"
394 [email protected]
395 [email protected] "("
396 [email protected]
397 [email protected] "("
398 [email protected] "i"
399 [email protected] "."
400 [email protected] "get"
401 [email protected]
402 [email protected] "("
403 [email protected] ")"
404 [email protected] ")"
405 [email protected] ")"
406 [email protected] ";"
407 [email protected] "\n"
408 [email protected] "}"
409 [email protected] "\n\n"
410 [email protected]
411 [email protected] "fn"
412 [email protected] " "
413 [email protected]
414 [email protected] "zombiejesus"
415 [email protected]
416 [email protected] "("
417 [email protected] ")"
418 [email protected] " "
419 [email protected]
420 [email protected] "{"
421 [email protected] "\n "
422 [email protected]
423 [email protected] "loop"
424 [email protected] " "
425 [email protected]
426 [email protected] "{"
427 [email protected] "\n "
428 [email protected]
429 [email protected]
430 [email protected] "while"
431 [email protected] " "
432 [email protected]
433 [email protected]
434 [email protected] "("
435 [email protected]
436 [email protected] "return"
437 [email protected] ")"
438 [email protected] " "
439 [email protected]
440 [email protected] "{"
441 [email protected] "\n "
442 [email protected]
443 [email protected] "if"
444 [email protected] " "
445 [email protected]
446 [email protected]
447 [email protected] "("
448 [email protected]
449 [email protected] "return"
450 [email protected] ")"
451 [email protected] " "
452 [email protected]
453 [email protected] "{"
454 [email protected] "\n "
455 [email protected]
456 [email protected]
457 [email protected] "match"
458 [email protected] " "
459 [email protected]
460 [email protected] "("
461 [email protected]
462 [email protected] "return"
463 [email protected] ")"
464 [email protected] " "
465 [email protected]
466 [email protected] "{"
467 [email protected] "\n "
468 [email protected]
469 [email protected]
470 [email protected]
471 [email protected] "1"
472 [email protected] " "
473 [email protected] "=>"
474 [email protected] " "
475 [email protected]
476 [email protected] "{"
477 [email protected] "\n ..."
478 [email protected]
479 [email protected] "if"
480 [email protected] " "
481 [email protected]
482 [email protected]
483 [email protected] "("
484 [email protected]
485 [email protected] "return"
486 [email protected] ")"
487 [email protected] " "
488 [email protected]
489 [email protected] "{"
490 [email protected] "\n ..."
491 [email protected]
492 [email protected] "return"
493 [email protected] "\n ..."
494 [email protected] "}"
495 [email protected] " "
496 [email protected] "else"
497 [email protected] " "
498 [email protected]
499 [email protected] "{"
500 [email protected] "\n ..."
501 [email protected]
502 [email protected] "return"
503 [email protected] "\n ..."
504 [email protected] "}"
505 [email protected] "\n "
506 [email protected] "}"
507 [email protected] "\n "
508 [email protected]
509 [email protected]
510 [email protected] "_"
511 [email protected] " "
512 [email protected] "=>"
513 [email protected] " "
514 [email protected]
515 [email protected] "{"
516 [email protected] " "
517 [email protected]
518 [email protected] "return"
519 [email protected] " "
520 [email protected] "}"
521 [email protected] "\n "
522 [email protected] "}"
523 [email protected] ";"
524 [email protected] "\n "
525 [email protected] "}"
526 [email protected] " "
527 [email protected] "else"
528 [email protected] " "
529 [email protected]
530 [email protected] "if"
531 [email protected] " "
532 [email protected]
533 [email protected]
534 [email protected] "("
535 [email protected]
536 [email protected] "return"
537 [email protected] ")"
538 [email protected] " "
539 [email protected]
540 [email protected] "{"
541 [email protected] "\n "
542 [email protected]
543 [email protected]
544 [email protected] "return"
545 [email protected] ";"
546 [email protected] "\n "
547 [email protected] "}"
548 [email protected] "\n "
549 [email protected] "}"
550 [email protected] "\n "
551 [email protected]
552 [email protected] "if"
553 [email protected] " "
554 [email protected]
555 [email protected]
556 [email protected] "("
557 [email protected]
558 [email protected] "return"
559 [email protected] ")"
560 [email protected] " "
561 [email protected]
562 [email protected] "{"
563 [email protected] " "
564 [email protected]
565 [email protected]
566 [email protected] "break"
567 [email protected] ";"
568 [email protected] " "
569 [email protected] "}"
570 [email protected] "\n "
571 [email protected] "}"
572 [email protected] "\n"
573 [email protected] "}"
574 [email protected] "\n\n"
575 [email protected]
576 [email protected] "fn"
577 [email protected] " "
578 [email protected]
579 [email protected] "notsure"
580 [email protected]
581 [email protected] "("
582 [email protected] ")"
583 [email protected] " "
584 [email protected]
585 [email protected] "{"
586 [email protected] "\n "
587 [email protected]
588 [email protected] "let"
589 [email protected] " "
590 [email protected]
591 [email protected] "mut"
592 [email protected] " "
593 [email protected]
594 [email protected] "_x"
595 [email protected] ":"
596 [email protected] " "
597 [email protected]
598 [email protected]
599 [email protected]
600 [email protected]
601 [email protected] "isize"
602 [email protected] ";"
603 [email protected] "\n "
604 [email protected]
605 [email protected] "let"
606 [email protected] " "
607 [email protected]
608 [email protected] "mut"
609 [email protected] " "
610 [email protected]
611 [email protected] "_y"
612 [email protected] " "
613 [email protected] "="
614 [email protected] " "
615 [email protected]
616 [email protected]
617 [email protected] "("
618 [email protected]
619 [email protected]
620 [email protected]
621 [email protected]
622 [email protected]
623 [email protected] "_x"
624 [email protected] " "
625 [email protected] "="
626 [email protected] " "
627 [email protected]
628 [email protected] "0"
629 [email protected] ")"
630 [email protected] " "
631 [email protected] "=="
632 [email protected] " "
633 [email protected]
634 [email protected] "("
635 [email protected]
636 [email protected]
637 [email protected]
638 [email protected]
639 [email protected]
640 [email protected] "_x"
641 [email protected] " "
642 [email protected] "="
643 [email protected] " "
644 [email protected]
645 [email protected] "0"
646 [email protected] ")"
647 [email protected] ";"
648 [email protected] "\n "
649 [email protected]
650 [email protected] "let"
651 [email protected] " "
652 [email protected]
653 [email protected] "mut"
654 [email protected] " "
655 [email protected]
656 [email protected] "_z"
657 [email protected] " "
658 [email protected] "="
659 [email protected] " "
660 [email protected]
661 [email protected]
662 [email protected] "("
663 [email protected]
664 [email protected]
665 [email protected]
666 [email protected]
667 [email protected]
668 [email protected] "_x"
669 [email protected] " "
670 [email protected] "="
671 [email protected] " "
672 [email protected]
673 [email protected] "0"
674 [email protected] ")"
675 [email protected] " "
676 [email protected] "<"
677 [email protected] " "
678 [email protected]
679 [email protected] "("
680 [email protected]
681 [email protected]
682 [email protected]
683 [email protected]
684 [email protected]
685 [email protected] "_x"
686 [email protected] " "
687 [email protected] "="
688 [email protected] " "
689 [email protected]
690 [email protected] "0"
691 [email protected] ")"
692 [email protected] ";"
693 [email protected] "\n "
694 [email protected]
695 [email protected] "let"
696 [email protected] " "
697 [email protected]
698 [email protected]
699 [email protected] "_a"
700 [email protected] " "
701 [email protected] "="
702 [email protected] " "
703 [email protected]
704 [email protected]
705 [email protected] "("
706 [email protected]
707 [email protected]
708 [email protected]
709 [email protected]
710 [email protected]
711 [email protected] "_x"
712 [email protected] " "
713 [email protected] "+="
714 [email protected] " "
715 [email protected]
716 [email protected] "0"
717 [email protected] ")"
718 [email protected] " "
719 [email protected] "=="
720 [email protected] " "
721 [email protected]
722 [email protected] "("
723 [email protected]
724 [email protected]
725 [email protected]
726 [email protected]
727 [email protected]
728 [email protected] "_x"
729 [email protected] " "
730 [email protected] "="
731 [email protected] " "
732 [email protected]
733 [email protected] "0"
734 [email protected] ")"
735 [email protected] ";"
736 [email protected] "\n "
737 [email protected]
738 [email protected] "let"
739 [email protected] " "
740 [email protected]
741 [email protected]
742 [email protected] "_b"
743 [email protected] " "
744 [email protected] "="
745 [email protected] " "
746 [email protected]
747 [email protected]
748 [email protected]
749 [email protected]
750 [email protected]
751 [email protected]
752 [email protected] "swap"
753 [email protected]
754 [email protected] "("
755 [email protected]
756 [email protected] "&"
757 [email protected] "mut"
758 [email protected] " "
759 [email protected]
760 [email protected]
761 [email protected]
762 [email protected]
763 [email protected] "_y"
764 [email protected] ","
765 [email protected] " "
766 [email protected]
767 [email protected] "&"
768 [email protected] "mut"
769 [email protected] " "
770 [email protected]
771 [email protected]
772 [email protected]
773 [email protected]
774 [email protected] "_z"
775 [email protected] ")"
776 [email protected] " "
777 [email protected] "=="
778 [email protected] " "
779 [email protected]
780 [email protected]
781 [email protected]
782 [email protected]
783 [email protected]
784 [email protected] "swap"
785 [email protected]
786 [email protected] "("
787 [email protected]
788 [email protected] "&"
789 [email protected] "mut"
790 [email protected] " "
791 [email protected]
792 [email protected]
793 [email protected]
794 [email protected]
795 [email protected] "_y"
796 [email protected] ","
797 [email protected] " "
798 [email protected]
799 [email protected] "&"
800 [email protected] "mut"
801 [email protected] " "
802 [email protected]
803 [email protected]
804 [email protected]
805 [email protected]
806 [email protected] "_z"
807 [email protected] ")"
808 [email protected] ";"
809 [email protected] "\n"
810 [email protected] "}"
811 [email protected] "\n\n"
812 [email protected]
813 [email protected] "fn"
814 [email protected] " "
815 [email protected]
816 [email protected] "canttouchthis"
817 [email protected]
818 [email protected] "("
819 [email protected] ")"
820 [email protected] " "
821 [email protected]
822 [email protected] "->"
823 [email protected] " "
824 [email protected]
825 [email protected]
826 [email protected]
827 [email protected]
828 [email protected] "usize"
829 [email protected] " "
830 [email protected]
831 [email protected] "{"
832 [email protected] "\n "
833 [email protected]
834 [email protected] "fn"
835 [email protected] " "
836 [email protected]
837 [email protected] "p"
838 [email protected]
839 [email protected] "("
840 [email protected] ")"
841 [email protected] " "
842 [email protected]
843 [email protected] "->"
844 [email protected] " "
845 [email protected]
846 [email protected]
847 [email protected]
848 [email protected]
849 [email protected] "bool"
850 [email protected] " "
851 [email protected]
852 [email protected] "{"
853 [email protected] " "
854 [email protected]
855 [email protected] "true"
856 [email protected] " "
857 [email protected] "}"
858 [email protected] "\n "
859 [email protected]
860 [email protected] "let"
861 [email protected] " "
862 [email protected]
863 [email protected]
864 [email protected] "_a"
865 [email protected] " "
866 [email protected] "="
867 [email protected] " "
868 [email protected]
869 [email protected] "("
870 [email protected]
871 [email protected]
872 [email protected]
873 [email protected]
874 [email protected]
875 [email protected] "assert"
876 [email protected] "!"
877 [email protected]
878 [email protected] "("
879 [email protected]
880 [email protected] "("
881 [email protected] "true"
882 [email protected] ")"
883 [email protected] ")"
884 [email protected] " "
885 [email protected] "=="
886 [email protected] " "
887 [email protected]
888 [email protected] "("
889 [email protected]
890 [email protected]
891 [email protected]
892 [email protected]
893 [email protected] "assert"
894 [email protected] "!"
895 [email protected]
896 [email protected] "("
897 [email protected] "p"
898 [email protected]
899 [email protected] "("
900 [email protected] ")"
901 [email protected] ")"
902 [email protected] ")"
903 [email protected] ")"
904 [email protected] ";"
905 [email protected] "\n "
906 [email protected]
907 [email protected] "let"
908 [email protected] " "
909 [email protected]
910 [email protected]
911 [email protected] "_c"
912 [email protected] " "
913 [email protected] "="
914 [email protected] " "
915 [email protected]
916 [email protected] "("
917 [email protected]
918 [email protected]
919 [email protected]
920 [email protected]
921 [email protected]
922 [email protected] "assert"
923 [email protected] "!"
924 [email protected]
925 [email protected] "("
926 [email protected]
927 [email protected] "("
928 [email protected] "p"
929 [email protected]
930 [email protected] "("
931 [email protected] ")"
932 [email protected] ")"
933 [email protected] ")"
934 [email protected] " "
935 [email protected] "=="
936 [email protected] " "
937 [email protected]
938 [email protected] "("
939 [email protected] ")"
940 [email protected] ")"
941 [email protected] ";"
942 [email protected] "\n "
943 [email protected]
944 [email protected] "let"
945 [email protected] " "
946 [email protected]
947 [email protected]
948 [email protected] "_b"
949 [email protected] ":"
950 [email protected] " "
951 [email protected]
952 [email protected]
953 [email protected]
954 [email protected]
955 [email protected] "bool"
956 [email protected] " "
957 [email protected] "="
958 [email protected] " "
959 [email protected]
960 [email protected] "("
961 [email protected]
962 [email protected]
963 [email protected]
964 [email protected]
965 [email protected]
966 [email protected] "println"
967 [email protected] "!"
968 [email protected]
969 [email protected] "("
970 [email protected] "\"{}\""
971 [email protected] ","
972 [email protected] " "
973 [email protected] "0"
974 [email protected] ")"
975 [email protected] " "
976 [email protected] "=="
977 [email protected] " "
978 [email protected]
979 [email protected] "("
980 [email protected]
981 [email protected] "return"
982 [email protected] " "
983 [email protected]
984 [email protected] "0"
985 [email protected] ")"
986 [email protected] ")"
987 [email protected] ";"
988 [email protected] "\n"
989 [email protected] "}"
990 [email protected] "\n\n"
991 [email protected]
992 [email protected] "fn"
993 [email protected] " "
994 [email protected]
995 [email protected] "angrydome"
996 [email protected]
997 [email protected] "("
998 [email protected] ")"
999 [email protected] " "
1000 [email protected]
1001 [email protected] "{"
1002 [email protected] "\n "
1003 [email protected]
1004 [email protected]
1005 [email protected] "loop"
1006 [email protected] " "
1007 [email protected]
1008 [email protected] "{"
1009 [email protected] " "
1010 [email protected]
1011 [email protected] "if"
1012 [email protected] " "
1013 [email protected]
1014 [email protected]
1015 [email protected] "break"
1016 [email protected] " "
1017 [email protected]
1018 [email protected] "{"
1019 [email protected] " "
1020 [email protected] "}"
1021 [email protected] " "
1022 [email protected] "}"
1023 [email protected] "\n "
1024 [email protected]
1025 [email protected] "let"
1026 [email protected] " "
1027 [email protected]
1028 [email protected] "mut"
1029 [email protected] " "
1030 [email protected]
1031 [email protected] "i"
1032 [email protected] " "
1033 [email protected] "="
1034 [email protected] " "
1035 [email protected]
1036 [email protected] "0"
1037 [email protected] ";"
1038 [email protected] "\n "
1039 [email protected]
1040 [email protected] "loop"
1041 [email protected] " "
1042 [email protected]
1043 [email protected] "{"
1044 [email protected] " "
1045 [email protected]
1046 [email protected]
1047 [email protected]
1048 [email protected]
1049 [email protected]
1050 [email protected]
1051 [email protected] "i"
1052 [email protected] " "
1053 [email protected] "+="
1054 [email protected] " "
1055 [email protected]
1056 [email protected] "1"
1057 [email protected] ";"
1058 [email protected] " "
1059 [email protected]
1060 [email protected]
1061 [email protected] "if"
1062 [email protected] " "
1063 [email protected]
1064 [email protected]
1065 [email protected]
1066 [email protected]
1067 [email protected]
1068 [email protected]
1069 [email protected] "i"
1070 [email protected] " "
1071 [email protected] "=="
1072 [email protected] " "
1073 [email protected]
1074 [email protected] "1"
1075 [email protected] " "
1076 [email protected]
1077 [email protected] "{"
1078 [email protected] " "
1079 [email protected]
1080 [email protected] "match"
1081 [email protected] " "
1082 [email protected]
1083 [email protected] "("
1084 [email protected]
1085 [email protected] "continue"
1086 [email protected] ")"
1087 [email protected] " "
1088 [email protected]
1089 [email protected] "{"
1090 [email protected] " "
1091 [email protected]
1092 [email protected]
1093 [email protected]
1094 [email protected] "1"
1095 [email protected] " "
1096 [email protected] "=>"
1097 [email protected] " "
1098 [email protected]
1099 [email protected] "{"
1100 [email protected] " "
1101 [email protected] "}"
1102 [email protected] ","
1103 [email protected] " "
1104 [email protected]
1105 [email protected]
1106 [email protected] "_"
1107 [email protected] " "
1108 [email protected] "=>"
1109 [email protected] " "
1110 [email protected]
1111 [email protected]
1112 [email protected]
1113 [email protected]
1114 [email protected] "panic"
1115 [email protected] "!"
1116 [email protected]
1117 [email protected] "("
1118 [email protected] "\"wat\""
1119 [email protected] ")"
1120 [email protected] " "
1121 [email protected] "}"
1122 [email protected] " "
1123 [email protected] "}"
1124 [email protected] "\n "
1125 [email protected]
1126 [email protected]
1127 [email protected] "break"
1128 [email protected] ";"
1129 [email protected] " "
1130 [email protected] "}"
1131 [email protected] "\n"
1132 [email protected] "}"
1133 [email protected] "\n\n"
1134 [email protected]
1135 [email protected] "fn"
1136 [email protected] " "
1137 [email protected]
1138 [email protected] "evil_lincoln"
1139 [email protected]
1140 [email protected] "("
1141 [email protected] ")"
1142 [email protected] " "
1143 [email protected]
1144 [email protected] "{"
1145 [email protected] " "
1146 [email protected]
1147 [email protected] "let"
1148 [email protected] " "
1149 [email protected]
1150 [email protected]
1151 [email protected] "_evil"
1152 [email protected] " "
1153 [email protected] "="
1154 [email protected] " "
1155 [email protected]
1156 [email protected]
1157 [email protected]
1158 [email protected]
1159 [email protected] "println"
1160 [email protected] "!"
1161 [email protected]
1162 [email protected] "("
1163 [email protected] "\"lincoln\""
1164 [email protected] ")"
1165 [email protected] ";"
1166 [email protected] " "
1167 [email protected] "}"
1168 [email protected] "\n\n"
1169 [email protected]
1170 [email protected] "fn"
1171 [email protected] " "
1172 [email protected]
1173 [email protected] "dots"
1174 [email protected]
1175 [email protected] "("
1176 [email protected] ")"
1177 [email protected] " "
1178 [email protected]
1179 [email protected] "{"
1180 [email protected] "\n "
1181 [email protected]
1182 [email protected]
1183 [email protected]
1184 [email protected]
1185 [email protected]
1186 [email protected] "assert_eq"
1187 [email protected] "!"
1188 [email protected]
1189 [email protected] "("
1190 [email protected] "String"
1191 [email protected] ":"
1192 [email protected] ":"
1193 [email protected] "from"
1194 [email protected]
1195 [email protected] "("
1196 [email protected] "\".................... ..."
1197 [email protected] ")"
1198 [email protected] ","
1199 [email protected] "\n "
1200 [email protected] "format"
1201 [email protected] "!"
1202 [email protected]
1203 [email protected] "("
1204 [email protected] "\"{:?}\""
1205 [email protected] ","
1206 [email protected] " "
1207 [email protected] "."
1208 [email protected] "."
1209 [email protected] " "
1210 [email protected] "."
1211 [email protected] "."
1212 [email protected] " "
1213 [email protected] "."
1214 [email protected] "."
1215 [email protected] " "
1216 [email protected] "."
1217 [email protected] "."
1218 [email protected] " "
1219 [email protected] "."
1220 [email protected] "."
1221 [email protected] " "
1222 [email protected] "."
1223 [email protected] "."
1224 [email protected] " "
1225 [email protected] "."
1226 [email protected] "."
1227 [email protected] " "
1228 [email protected] "."
1229 [email protected] "."
1230 [email protected] " "
1231 [email protected] "."
1232 [email protected] "."
1233 [email protected] " "
1234 [email protected] "."
1235 [email protected] "."
1236 [email protected] " "
1237 [email protected] "."
1238 [email protected] "."
1239 [email protected] " "
1240 [email protected] "."
1241 [email protected] "."
1242 [email protected] " "
1243 [email protected] "."
1244 [email protected] "."
1245 [email protected] "\n ..."
1246 [email protected] "."
1247 [email protected] "."
1248 [email protected] " "
1249 [email protected] "."
1250 [email protected] "."
1251 [email protected] " "
1252 [email protected] "."
1253 [email protected] "."
1254 [email protected] " "
1255 [email protected] "."
1256 [email protected] "."
1257 [email protected] " "
1258 [email protected] "."
1259 [email protected] "."
1260 [email protected] " "
1261 [email protected] "."
1262 [email protected] "."
1263 [email protected] " "
1264 [email protected] "."
1265 [email protected] "."
1266 [email protected] " "
1267 [email protected] "."
1268 [email protected] "."
1269 [email protected] " "
1270 [email protected] "."
1271 [email protected] "."
1272 [email protected] " "
1273 [email protected] "."
1274 [email protected] "."
1275 [email protected] " "
1276 [email protected] "."
1277 [email protected] "."
1278 [email protected] " "
1279 [email protected] "."
1280 [email protected] "."
1281 [email protected] ")"
1282 [email protected] ")"
1283 [email protected] ";"
1284 [email protected] "\n"
1285 [email protected] "}"
1286 [email protected] "\n\n"
1287 [email protected]
1288 [email protected] "fn"
1289 [email protected] " "
1290 [email protected]
1291 [email protected] "u8"
1292 [email protected]
1293 [email protected] "("
1294 [email protected]
1295 [email protected]
1296 [email protected]
1297 [email protected] "u8"
1298 [email protected] ":"
1299 [email protected] " "
1300 [email protected]
1301 [email protected]
1302 [email protected]
1303 [email protected]
1304 [email protected] "u8"
1305 [email protected] ")"
1306 [email protected] " "
1307 [email protected]
1308 [email protected] "{"
1309 [email protected] "\n "
1310 [email protected]
1311 [email protected] "if"
1312 [email protected] " "
1313 [email protected]
1314 [email protected]
1315 [email protected]
1316 [email protected]
1317 [email protected]
1318 [email protected]
1319 [email protected] "u8"
1320 [email protected] " "
1321 [email protected] "!="
1322 [email protected] " "
1323 [email protected]
1324 [email protected] "0u8"
1325 [email protected] " "
1326 [email protected]
1327 [email protected] "{"
1328 [email protected] "\n "
1329 [email protected]
1330 [email protected]
1331 [email protected]
1332 [email protected]
1333 [email protected]
1334 [email protected] "assert_eq"
1335 [email protected] "!"
1336 [email protected]
1337 [email protected] "("
1338 [email protected] "8u8"
1339 [email protected] ","
1340 [email protected] " "
1341 [email protected]
1342 [email protected] "{"
1343 [email protected] "\n "
1344 [email protected] "macro_rules"
1345 [email protected] "!"
1346 [email protected] " "
1347 [email protected] "u8"
1348 [email protected] " "
1349 [email protected]
1350 [email protected] "{"
1351 [email protected] "\n "
1352 [email protected]
1353 [email protected] "("
1354 [email protected] "u8"
1355 [email protected] ")"
1356 [email protected] " "
1357 [email protected] "="
1358 [email protected] ">"
1359 [email protected] " "
1360 [email protected]
1361 [email protected] "{"
1362 [email protected] "\n "
1363 [email protected] "mod"
1364 [email protected] " "
1365 [email protected] "u8"
1366 [email protected] " "
1367 [email protected]
1368 [email protected] "{"
1369 [email protected] "\n ..."
1370 [email protected] "pub"
1371 [email protected] " "
1372 [email protected] "fn"
1373 [email protected] " "
1374 [email protected] "u8"
1375 [email protected] "<"
1376 [email protected] "\'u8"
1377 [email protected] ":"
1378 [email protected] " "
1379 [email protected] "\'u8"
1380 [email protected] " "
1381 [email protected] "+"
1382 [email protected] " "
1383 [email protected] "\'u8"
1384 [email protected] ">"
1385 [email protected]
1386 [email protected] "("
1387 [email protected] "u8"
1388 [email protected] ":"
1389 [email protected] " "
1390 [email protected] "&"
1391 [email protected] "\'u8"
1392 [email protected] " "
1393 [email protected] "u8"
1394 [email protected] ")"
1395 [email protected] " "
1396 [email protected] "-"
1397 [email protected] ">"
1398 [email protected] " "
1399 [email protected] "&"
1400 [email protected] "\'u8"
1401 [email protected] " "
1402 [email protected] "u8"
1403 [email protected] " "
1404 [email protected]
1405 [email protected] "{"
1406 [email protected] "\n ..."
1407 [email protected] "\"u8\""
1408 [email protected] ";"
1409 [email protected] "\n ..."
1410 [email protected] "u8"
1411 [email protected] "\n ..."
1412 [email protected] "}"
1413 [email protected] "\n "
1414 [email protected] "}"
1415 [email protected] "\n "
1416 [email protected] "}"
1417 [email protected] ";"
1418 [email protected] "\n "
1419 [email protected] "}"
1420 [email protected] "\n\n "
1421 [email protected] "u8"
1422 [email protected] "!"
1423 [email protected]
1424 [email protected] "("
1425 [email protected] "u8"
1426 [email protected] ")"
1427 [email protected] ";"
1428 [email protected] "\n "
1429 [email protected] "let"
1430 [email protected] " "
1431 [email protected] "&"
1432 [email protected] "u8"
1433 [email protected] ":"
1434 [email protected] " "
1435 [email protected] "&"
1436 [email protected] "u8"
1437 [email protected] " "
1438 [email protected] "="
1439 [email protected] " "
1440 [email protected] "u8"
1441 [email protected] ":"
1442 [email protected] ":"
1443 [email protected] "u8"
1444 [email protected]
1445 [email protected] "("
1446 [email protected] "&"
1447 [email protected] "8u8"
1448 [email protected] ")"
1449 [email protected] ";"
1450 [email protected] "\n "
1451 [email protected] "crate"
1452 [email protected] ":"
1453 [email protected] ":"
1454 [email protected] "u8"
1455 [email protected]
1456 [email protected] "("
1457 [email protected] "0u8"
1458 [email protected] ")"
1459 [email protected] ";"
1460 [email protected] "\n "
1461 [email protected] "u8"
1462 [email protected] "\n "
1463 [email protected] "}"
1464 [email protected] ")"
1465 [email protected] ";"
1466 [email protected] "\n "
1467 [email protected] "}"
1468 [email protected] "\n"
1469 [email protected] "}"
1470 [email protected] "\n\n"
1471 [email protected]
1472 [email protected] "fn"
1473 [email protected] " "
1474 [email protected]
1475 [email protected] "fishy"
1476 [email protected]
1477 [email protected] "("
1478 [email protected] ")"
1479 [email protected] " "
1480 [email protected]
1481 [email protected] "{"
1482 [email protected] "\n "
1483 [email protected]
1484 [email protected]
1485 [email protected]
1486 [email protected]
1487 [email protected]
1488 [email protected] "assert_eq"
1489 [email protected] "!"
1490 [email protected]
1491 [email protected] "("
1492 [email protected] "String"
1493 [email protected] ":"
1494 [email protected] ":"
1495 [email protected] "from"
1496 [email protected]
1497 [email protected] "("
1498 [email protected] "\"><>\""
1499 [email protected] ")"
1500 [email protected] ","
1501 [email protected] "\n "
1502 [email protected] "String"
1503 [email protected] ":"
1504 [email protected] ":"
1505 [email protected] "<"
1506 [email protected] ">"
1507 [email protected] ":"
1508 [email protected] ":"
1509 [email protected] "from"
1510 [email protected] ":"
1511 [email protected] ":"
1512 [email protected] "<"
1513 [email protected] ">"
1514 [email protected]
1515 [email protected] "("
1516 [email protected] "\"><>\""
1517 [email protected] ")"
1518 [email protected] "."
1519 [email protected] "chars"
1520 [email protected] ":"
1521 [email protected] ":"
1522 [email protected] "<"
1523 [email protected] ">"
1524 [email protected]
1525 [email protected] "("
1526 [email protected] ")"
1527 [email protected] "."
1528 [email protected] "rev"
1529 [email protected] ":"
1530 [email protected] ":"
1531 [email protected] "<"
1532 [email protected] ">"
1533 [email protected]
1534 [email protected] "("
1535 [email protected] ")"
1536 [email protected] "."
1537 [email protected] "collect"
1538 [email protected] ":"
1539 [email protected] ":"
1540 [email protected] "<"
1541 [email protected] "String"
1542 [email protected] ">"
1543 [email protected]
1544 [email protected] "("
1545 [email protected] ")"
1546 [email protected] ")"
1547 [email protected] ";"
1548 [email protected] "\n"
1549 [email protected] "}"
1550 [email protected] "\n\n"
1551 [email protected]
1552 [email protected] "fn"
1553 [email protected] " "
1554 [email protected]
1555 [email protected] "union"
1556 [email protected]
1557 [email protected] "("
1558 [email protected] ")"
1559 [email protected] " "
1560 [email protected]
1561 [email protected] "{"
1562 [email protected] "\n "
1563 [email protected]
1564 [email protected] "union"
1565 [email protected] " "
1566 [email protected]
1567 [email protected] "union"
1568 [email protected]
1569 [email protected] "<"
1570 [email protected]
1571 [email protected] "\'union"
1572 [email protected] ">"
1573 [email protected] " "
1574 [email protected]
1575 [email protected] "{"
1576 [email protected] " "
1577 [email protected]
1578 [email protected]
1579 [email protected] "union"
1580 [email protected] ":"
1581 [email protected] " "
1582 [email protected]
1583 [email protected] "&"
1584 [email protected] "\'union"
1585 [email protected] " "
1586 [email protected]
1587 [email protected]
1588 [email protected]
1589 [email protected]
1590 [email protected] "union"
1591 [email protected]
1592 [email protected] "<"
1593 [email protected]
1594 [email protected] "\'union"
1595 [email protected] ">"
1596 [email protected] ","
1597 [email protected] " "
1598 [email protected] "}"
1599 [email protected] "\n"
1600 [email protected] "}"
1601 [email protected] "\n\n"
1602 [email protected]
1603 [email protected] "fn"
1604 [email protected] " "
1605 [email protected]
1606 [email protected] "special_characters"
1607 [email protected]
1608 [email protected] "("
1609 [email protected] ")"
1610 [email protected] " "
1611 [email protected]
1612 [email protected] "{"
1613 [email protected] "\n "
1614 [email protected]
1615 [email protected] "let"
1616 [email protected] " "
1617 [email protected]
1618 [email protected]
1619 [email protected] "val"
1620 [email protected] " "
1621 [email protected] "="
1622 [email protected] " "
1623 [email protected]
1624 [email protected] "!"
1625 [email protected]
1626 [email protected] "("
1627 [email protected]
1628 [email protected]
1629 [email protected]
1630 [email protected] "("
1631 [email protected]
1632 [email protected]
1633 [email protected] "|"
1634 [email protected]
1635 [email protected]
1636 [email protected] "("
1637 [email protected]
1638 [email protected] ".."
1639 [email protected] ")"
1640 [email protected] ":"
1641 [email protected]
1642 [email protected] "("
1643 [email protected]
1644 [email protected] "_"
1645 [email protected] ","
1646 [email protected]
1647 [email protected] "_"
1648 [email protected] ")"
1649 [email protected] ","
1650 [email protected]
1651 [email protected]
1652 [email protected]
1653 [email protected] "__"
1654 [email protected] "@"
1655 [email protected]
1656 [email protected] "_"
1657 [email protected] "|"
1658 [email protected]
1659 [email protected]
1660 [email protected]
1661 [email protected]
1662 [email protected] "__"
1663 [email protected] ")"
1664 [email protected]
1665 [email protected] "("
1666 [email protected]
1667 [email protected] "("
1668 [email protected]
1669 [email protected] "&"
1670 [email protected]
1671 [email protected] "*"
1672 [email protected]
1673 [email protected] "\"\\\\\""
1674 [email protected] ","
1675 [email protected]
1676 [email protected] "\'🤔\'"
1677 [email protected] ")"
1678 [email protected] "/**/"
1679 [email protected] ","
1680 [email protected]
1681 [email protected] "{"
1682 [email protected] "}"
1683 [email protected] ")"
1684 [email protected] "=="
1685 [email protected]
1686 [email protected] "{"
1687 [email protected]
1688 [email protected]
1689 [email protected] "&"
1690 [email protected]
1691 [email protected]
1692 [email protected] "["
1693 [email protected]
1694 [email protected] "..="
1695 [email protected]
1696 [email protected] ".."
1697 [email protected] "]"
1698 [email protected] "["
1699 [email protected]
1700 [email protected] ".."
1701 [email protected] "]"
1702 [email protected] ";"
1703 [email protected] "}"
1704 [email protected] ")"
1705 [email protected] "//"
1706 [email protected] "\n "
1707 [email protected] ";"
1708 [email protected] "\n "
1709 [email protected]
1710 [email protected]
1711 [email protected]
1712 [email protected]
1713 [email protected]
1714 [email protected] "assert"
1715 [email protected] "!"
1716 [email protected]
1717 [email protected] "("
1718 [email protected] "!"
1719 [email protected] "val"
1720 [email protected] ")"
1721 [email protected] ";"
1722 [email protected] "\n"
1723 [email protected] "}"
1724 [email protected] "\n\n"
1725 [email protected]
1726 [email protected] "fn"
1727 [email protected] " "
1728 [email protected]
1729 [email protected] "punch_card"
1730 [email protected]
1731 [email protected] "("
1732 [email protected] ")"
1733 [email protected] " "
1734 [email protected]
1735 [email protected] "->"
1736 [email protected] " "
1737 [email protected]
1738 [email protected] "impl"
1739 [email protected] " "
1740 [email protected]
1741 [email protected]
1742 [email protected]
1743 [email protected]
1744 [email protected]
1745 [email protected]
1746 [email protected]
1747 [email protected]
1748 [email protected] "std"
1749 [email protected] "::"
1750 [email protected]
1751 [email protected]
1752 [email protected] "fmt"
1753 [email protected] "::"
1754 [email protected]
1755 [email protected]
1756 [email protected] "Debug"
1757 [email protected] " "
1758 [email protected]
1759 [email protected] "{"
1760 [email protected] "\n "
1761 [email protected]
1762 [email protected] "..="
1763 [email protected]
1764 [email protected] "..="
1765 [email protected]
1766 [email protected] ".."
1767 [email protected] " "
1768 [email protected]
1769 [email protected] ".."
1770 [email protected] " "
1771 [email protected]
1772 [email protected] ".."
1773 [email protected] " "
1774 [email protected]
1775 [email protected] ".."
1776 [email protected] " "
1777 [email protected]
1778 [email protected] ".."
1779 [email protected] " "
1780 [email protected]
1781 [email protected] ".."
1782 [email protected] " "
1783 [email protected]
1784 [email protected] ".."
1785 [email protected] " "
1786 [email protected]
1787 [email protected] ".."
1788 [email protected] " "
1789 [email protected]
1790 [email protected] ".."
1791 [email protected] " "
1792 [email protected]
1793 [email protected] ".."
1794 [email protected] " "
1795 [email protected]
1796 [email protected] ".."
1797 [email protected] " "
1798 [email protected]
1799 [email protected] "..="
1800 [email protected]
1801 [email protected] ".."
1802 [email protected] " "
1803 [email protected]
1804 [email protected] ".."
1805 [email protected] "\n "
1806 [email protected]
1807 [email protected] "..="
1808 [email protected]
1809 [email protected] ".."
1810 [email protected] " "
1811 [email protected]
1812 [email protected] "..="
1813 [email protected]
1814 [email protected] ".."
1815 [email protected] " "
1816 [email protected]
1817 [email protected] ".."
1818 [email protected] " "
1819 [email protected]
1820 [email protected] ".."
1821 [email protected] " "
1822 [email protected]
1823 [email protected] ".."
1824 [email protected] " "
1825 [email protected]
1826 [email protected] ".."
1827 [email protected] " "
1828 [email protected]
1829 [email protected] ".."
1830 [email protected] " "
1831 [email protected]
1832 [email protected] ".."
1833 [email protected] " "
1834 [email protected]
1835 [email protected] ".."
1836 [email protected] " "
1837 [email protected]
1838 [email protected] ".."
1839 [email protected] " "
1840 [email protected]
1841 [email protected] "..="
1842 [email protected]
1843 [email protected] "..="
1844 [email protected]
1845 [email protected] "..="
1846 [email protected]
1847 [email protected] ".."
1848 [email protected] "\n "
1849 [email protected]
1850 [email protected] "..="
1851 [email protected]
1852 [email protected] ".."
1853 [email protected] " "
1854 [email protected]
1855 [email protected] "..="
1856 [email protected]
1857 [email protected] ".."
1858 [email protected] " "
1859 [email protected]
1860 [email protected] "..="
1861 [email protected]
1862 [email protected] ".."
1863 [email protected] " "
1864 [email protected]
1865 [email protected] "..="
1866 [email protected]
1867 [email protected] ".."
1868 [email protected] " "
1869 [email protected]
1870 [email protected] ".."
1871 [email protected] " "
1872 [email protected]
1873 [email protected] "..="
1874 [email protected]
1875 [email protected] "..="
1876 [email protected]
1877 [email protected] ".."
1878 [email protected] " "
1879 [email protected]
1880 [email protected] ".."
1881 [email protected] " "
1882 [email protected]
1883 [email protected] "..="
1884 [email protected]
1885 [email protected] ".."
1886 [email protected] " "
1887 [email protected]
1888 [email protected] ".."
1889 [email protected] "\n "
1890 [email protected]
1891 [email protected] "..="
1892 [email protected]
1893 [email protected] "..="
1894 [email protected]
1895 [email protected] ".."
1896 [email protected] " "
1897 [email protected]
1898 [email protected] ".."
1899 [email protected] " "
1900 [email protected]
1901 [email protected] "..="
1902 [email protected]
1903 [email protected] ".."
1904 [email protected] " "
1905 [email protected]
1906 [email protected] "..="
1907 [email protected]
1908 [email protected] ".."
1909 [email protected] " "
1910 [email protected]
1911 [email protected] "..="
1912 [email protected]
1913 [email protected] ".."
1914 [email protected] " "
1915 [email protected]
1916 [email protected] ".."
1917 [email protected] " "
1918 [email protected]
1919 [email protected] ".."
1920 [email protected] " "
1921 [email protected]
1922 [email protected] ".."
1923 [email protected] " "
1924 [email protected]
1925 [email protected] "..="
1926 [email protected]
1927 [email protected] ".."
1928 [email protected] " "
1929 [email protected]
1930 [email protected] ".."
1931 [email protected] "\n "
1932 [email protected]
1933 [email protected] "..="
1934 [email protected]
1935 [email protected] ".."
1936 [email protected] " "
1937 [email protected]
1938 [email protected] "..="
1939 [email protected]
1940 [email protected] ".."
1941 [email protected] " "
1942 [email protected]
1943 [email protected] "..="
1944 [email protected]
1945 [email protected] ".."
1946 [email protected] " "
1947 [email protected]
1948 [email protected] "..="
1949 [email protected]
1950 [email protected] ".."
1951 [email protected] " "
1952 [email protected]
1953 [email protected] ".."
1954 [email protected] " "
1955 [email protected]
1956 [email protected] "..="
1957 [email protected]
1958 [email protected] ".."
1959 [email protected] " "
1960 [email protected]
1961 [email protected] ".."
1962 [email protected] " "
1963 [email protected]
1964 [email protected] ".."
1965 [email protected] " "
1966 [email protected]
1967 [email protected] "..="
1968 [email protected]
1969 [email protected] ".."
1970 [email protected] " "
1971 [email protected]
1972 [email protected] ".."
1973 [email protected] "\n "
1974 [email protected]
1975 [email protected] "..="
1976 [email protected]
1977 [email protected] ".."
1978 [email protected] " "
1979 [email protected]
1980 [email protected] "..="
1981 [email protected]
1982 [email protected] ".."
1983 [email protected] " "
1984 [email protected]
1985 [email protected] "..="
1986 [email protected]
1987 [email protected] ".."
1988 [email protected] " "
1989 [email protected]
1990 [email protected] "..="
1991 [email protected]
1992 [email protected] ".."
1993 [email protected] " "
1994 [email protected]
1995 [email protected] ".."
1996 [email protected] " "
1997 [email protected]
1998 [email protected] ".."
1999 [email protected] " "
2000 [email protected]
2001 [email protected] "..="
2002 [email protected]
2003 [email protected] ".."
2004 [email protected] " "
2005 [email protected]
2006 [email protected] ".."
2007 [email protected] " "
2008 [email protected]
2009 [email protected] "..="
2010 [email protected]
2011 [email protected] ".."
2012 [email protected] " "
2013 [email protected]
2014 [email protected] ".."
2015 [email protected] "\n "
2016 [email protected]
2017 [email protected] "..="
2018 [email protected]
2019 [email protected] ".."
2020 [email protected] " "
2021 [email protected]
2022 [email protected] "..="
2023 [email protected]
2024 [email protected] ".."
2025 [email protected] " "
2026 [email protected]
2027 [email protected] ".."
2028 [email protected] " "
2029 [email protected]
2030 [email protected] "..="
2031 [email protected]
2032 [email protected] "..="
2033 [email protected]
2034 [email protected] ".."
2035 [email protected] " "
2036 [email protected]
2037 [email protected] "..="
2038 [email protected]
2039 [email protected] "..="
2040 [email protected]
2041 [email protected] ".."
2042 [email protected] " "
2043 [email protected]
2044 [email protected] ".."
2045 [email protected] " "
2046 [email protected]
2047 [email protected] ".."
2048 [email protected] " "
2049 [email protected]
2050 [email protected] "..="
2051 [email protected]
2052 [email protected] ".."
2053 [email protected] " "
2054 [email protected]
2055 [email protected] ".."
2056 [email protected] "\n"
2057 [email protected] "}"
2058 [email protected] "\n\n"
2059 [email protected]
2060 [email protected] "fn"
2061 [email protected] " "
2062 [email protected]
2063 [email protected] "ktulhu"
2064 [email protected]
2065 [email protected] "("
2066 [email protected] ")"
2067 [email protected] " "
2068 [email protected]
2069 [email protected] "{"
2070 [email protected] "\n "
2071 [email protected] ";"
2072 [email protected] ";"
2073 [email protected] ";"
2074 [email protected]
2075 [email protected]
2076 [email protected] "("
2077 [email protected] ")"
2078 [email protected] ";"
2079 [email protected] ";"
2080 [email protected] ";"
2081 [email protected] ";"
2082 [email protected] ";"
2083 [email protected] ";"
2084 [email protected] ";"
2085 [email protected] ";"
2086 [email protected] ";"
2087 [email protected]
2088 [email protected] "("
2089 [email protected] ")"
2090 [email protected] "\n"
2091 [email protected] "}"
2092 [email protected] "\n\n"
2093 [email protected]
2094 [email protected]
2095 [email protected] "pub"
2096 [email protected] " "
2097 [email protected] "fn"
2098 [email protected] " "
2099 [email protected]
2100 [email protected] "main"
2101 [email protected]
2102 [email protected] "("
2103 [email protected] ")"
2104 [email protected] " "
2105 [email protected]
2106 [email protected] "{"
2107 [email protected] "\n "
2108 [email protected]
2109 [email protected]
2110 [email protected]
2111 [email protected]
2112 [email protected]
2113 [email protected]
2114 [email protected] "strange"
2115 [email protected]
2116 [email protected] "("
2117 [email protected] ")"
2118 [email protected] ";"
2119 [email protected] "\n "
2120 [email protected]
2121 [email protected]
2122 [email protected]
2123 [email protected]
2124 [email protected]
2125 [email protected]
2126 [email protected] "funny"
2127 [email protected]
2128 [email protected] "("
2129 [email protected] ")"
2130 [email protected] ";"
2131 [email protected] "\n "
2132 [email protected]
2133 [email protected]
2134 [email protected]
2135 [email protected]
2136 [email protected]
2137 [email protected]
2138 [email protected] "what"
2139 [email protected]
2140 [email protected] "("
2141 [email protected] ")"
2142 [email protected] ";"
2143 [email protected] "\n "
2144 [email protected]
2145 [email protected]
2146 [email protected]
2147 [email protected]
2148 [email protected]
2149 [email protected]
2150 [email protected] "zombiejesus"
2151 [email protected]
2152 [email protected] "("
2153 [email protected] ")"
2154 [email protected] ";"
2155 [email protected] "\n "
2156 [email protected]
2157 [email protected]
2158 [email protected]
2159 [email protected]
2160 [email protected]
2161 [email protected]
2162 [email protected] "notsure"
2163 [email protected]
2164 [email protected] "("
2165 [email protected] ")"
2166 [email protected] ";"
2167 [email protected] "\n "
2168 [email protected]
2169 [email protected]
2170 [email protected]
2171 [email protected]
2172 [email protected]
2173 [email protected]
2174 [email protected] "canttouchthis"
2175 [email protected]
2176 [email protected] "("
2177 [email protected] ")"
2178 [email protected] ";"
2179 [email protected] "\n "
2180 [email protected]
2181 [email protected]
2182 [email protected]
2183 [email protected]
2184 [email protected]
2185 [email protected]
2186 [email protected] "angrydome"
2187 [email protected]
2188 [email protected] "("
2189 [email protected] ")"
2190 [email protected] ";"
2191 [email protected] "\n "
2192 [email protected]
2193 [email protected]
2194 [email protected]
2195 [email protected]
2196 [email protected]
2197 [email protected]
2198 [email protected] "evil_lincoln"
2199 [email protected]
2200 [email protected] "("
2201 [email protected] ")"
2202 [email protected] ";"
2203 [email protected] "\n "
2204 [email protected]
2205 [email protected]
2206 [email protected]
2207 [email protected]
2208 [email protected]
2209 [email protected]
2210 [email protected] "dots"
2211 [email protected]
2212 [email protected] "("
2213 [email protected] ")"
2214 [email protected] ";"
2215 [email protected] "\n "
2216 [email protected]
2217 [email protected]
2218 [email protected]
2219 [email protected]
2220 [email protected]
2221 [email protected]
2222 [email protected] "u8"
2223 [email protected]
2224 [email protected] "("
2225 [email protected]
2226 [email protected] "8u8"
2227 [email protected] ")"
2228 [email protected] ";"
2229 [email protected] "\n "
2230 [email protected]
2231 [email protected]
2232 [email protected]
2233 [email protected]
2234 [email protected]
2235 [email protected]
2236 [email protected] "fishy"
2237 [email protected]
2238 [email protected] "("
2239 [email protected] ")"
2240 [email protected] ";"
2241 [email protected] "\n "
2242 [email protected]
2243 [email protected]
2244 [email protected]
2245 [email protected]
2246 [email protected]
2247 [email protected]
2248 [email protected] "union"
2249 [email protected]
2250 [email protected] "("
2251 [email protected] ")"
2252 [email protected] ";"
2253 [email protected] "\n "
2254 [email protected]
2255 [email protected]
2256 [email protected]
2257 [email protected]
2258 [email protected]
2259 [email protected]
2260 [email protected] "special_characters"
2261 [email protected]
2262 [email protected] "("
2263 [email protected] ")"
2264 [email protected] ";"
2265 [email protected] "\n "
2266 [email protected]
2267 [email protected]
2268 [email protected]
2269 [email protected]
2270 [email protected]
2271 [email protected]
2272 [email protected] "punch_card"
2273 [email protected]
2274 [email protected] "("
2275 [email protected] ")"
2276 [email protected] ";"
2277 [email protected] "\n "
2278 [email protected]
2279 [email protected]
2280 [email protected]
2281 [email protected]
2282 [email protected]
2283 [email protected]
2284 [email protected] "ktulhu"
2285 [email protected]
2286 [email protected] "("
2287 [email protected] ")"
2288 [email protected] ";"
2289 [email protected] "\n"
2290 [email protected] "}"
2291 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0035_weird_exprs.rs b/crates/syntax/test_data/parser/ok/0035_weird_exprs.rs
new file mode 100644
index 000000000..8c1323163
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0035_weird_exprs.rs
@@ -0,0 +1,154 @@
1//! Adapted from a `rustc` test, which can be found at
2//! https://github.com/rust-lang/rust/blob/6d34ec18c7d7e574553f6347ecf08e1e1c45c13d/src/test/run-pass/weird-exprs.rs.
3//!
4//! Reported to rust-analyzer in https://github.com/rust-analyzer/rust-analyzer/issues/290
5
6#![allow(non_camel_case_types)]
7#![allow(dead_code)]
8#![allow(unreachable_code)]
9#![allow(unused_parens)]
10
11#![recursion_limit = "128"]
12
13use std::cell::Cell;
14use std::mem::swap;
15
16// Just a grab bag of stuff that you wouldn't want to actually write.
17
18fn strange() -> bool { let _x: bool = return true; }
19
20fn funny() {
21 fn f(_x: ()) { }
22 f(return);
23}
24
25fn what() {
26 fn the(x: &Cell<bool>) {
27 return while !x.get() { x.set(true); };
28 }
29 let i = &Cell::new(false);
30 let dont = {||the(i)};
31 dont();
32 assert!((i.get()));
33}
34
35fn zombiejesus() {
36 loop {
37 while (return) {
38 if (return) {
39 match (return) {
40 1 => {
41 if (return) {
42 return
43 } else {
44 return
45 }
46 }
47 _ => { return }
48 };
49 } else if (return) {
50 return;
51 }
52 }
53 if (return) { break; }
54 }
55}
56
57fn notsure() {
58 let mut _x: isize;
59 let mut _y = (_x = 0) == (_x = 0);
60 let mut _z = (_x = 0) < (_x = 0);
61 let _a = (_x += 0) == (_x = 0);
62 let _b = swap(&mut _y, &mut _z) == swap(&mut _y, &mut _z);
63}
64
65fn canttouchthis() -> usize {
66 fn p() -> bool { true }
67 let _a = (assert!((true)) == (assert!(p())));
68 let _c = (assert!((p())) == ());
69 let _b: bool = (println!("{}", 0) == (return 0));
70}
71
72fn angrydome() {
73 loop { if break { } }
74 let mut i = 0;
75 loop { i += 1; if i == 1 { match (continue) { 1 => { }, _ => panic!("wat") } }
76 break; }
77}
78
79fn evil_lincoln() { let _evil = println!("lincoln"); }
80
81fn dots() {
82 assert_eq!(String::from(".................................................."),
83 format!("{:?}", .. .. .. .. .. .. .. .. .. .. .. .. ..
84 .. .. .. .. .. .. .. .. .. .. .. ..));
85}
86
87fn u8(u8: u8) {
88 if u8 != 0u8 {
89 assert_eq!(8u8, {
90 macro_rules! u8 {
91 (u8) => {
92 mod u8 {
93 pub fn u8<'u8: 'u8 + 'u8>(u8: &'u8 u8) -> &'u8 u8 {
94 "u8";
95 u8
96 }
97 }
98 };
99 }
100
101 u8!(u8);
102 let &u8: &u8 = u8::u8(&8u8);
103 crate::u8(0u8);
104 u8
105 });
106 }
107}
108
109fn fishy() {
110 assert_eq!(String::from("><>"),
111 String::<>::from::<>("><>").chars::<>().rev::<>().collect::<String>());
112}
113
114fn union() {
115 union union<'union> { union: &'union union<'union>, }
116}
117
118fn special_characters() {
119 let val = !((|(..):(_,_),__@_|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})//
120 ;
121 assert!(!val);
122}
123
124fn punch_card() -> impl std::fmt::Debug {
125 ..=..=.. .. .. .. .. .. .. .. .. .. .. ..=.. ..
126 ..=.. ..=.. .. .. .. .. .. .. .. .. ..=..=..=..
127 ..=.. ..=.. ..=.. ..=.. .. ..=..=.. .. ..=.. ..
128 ..=..=.. .. ..=.. ..=.. ..=.. .. .. .. ..=.. ..
129 ..=.. ..=.. ..=.. ..=.. .. ..=.. .. .. ..=.. ..
130 ..=.. ..=.. ..=.. ..=.. .. .. ..=.. .. ..=.. ..
131 ..=.. ..=.. .. ..=..=.. ..=..=.. .. .. ..=.. ..
132}
133
134fn ktulhu() {
135 ;;;();;;;;;;;;()
136}
137
138pub fn main() {
139 strange();
140 funny();
141 what();
142 zombiejesus();
143 notsure();
144 canttouchthis();
145 angrydome();
146 evil_lincoln();
147 dots();
148 u8(8u8);
149 fishy();
150 union();
151 special_characters();
152 punch_card();
153 ktulhu();
154}
diff --git a/crates/syntax/test_data/parser/ok/0036_fully_qualified.rast b/crates/syntax/test_data/parser/ok/0036_fully_qualified.rast
new file mode 100644
index 000000000..c4da317b9
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0036_fully_qualified.rast
@@ -0,0 +1,92 @@
1[email protected]
2 [email protected] "// https://github.com ..."
3 [email protected] "\n\n"
4 [email protected]
5 [email protected]
6 [email protected] "pub"
7 [email protected] " "
8 [email protected] "fn"
9 [email protected] " "
10 [email protected]
11 [email protected] "foo"
12 [email protected]
13 [email protected] "<"
14 [email protected]
15 [email protected]
16 [email protected] "S"
17 [email protected] ":"
18 [email protected] " "
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "Iterator"
26 [email protected] ">"
27 [email protected]
28 [email protected] "("
29 [email protected] ")"
30 [email protected] " "
31 [email protected]
32 [email protected] "->"
33 [email protected] " "
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected] "String"
39 [email protected] "\n"
40 [email protected]
41 [email protected] "where"
42 [email protected] "\n "
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected] "<"
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected] "S"
54 [email protected] " "
55 [email protected] "as"
56 [email protected] " "
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected] "Iterator"
62 [email protected] ">"
63 [email protected] "::"
64 [email protected]
65 [email protected]
66 [email protected] "Item"
67 [email protected] ":"
68 [email protected] " "
69 [email protected]
70 [email protected]
71 [email protected]
72 [email protected]
73 [email protected]
74 [email protected]
75 [email protected] "Eq"
76 [email protected] ","
77 [email protected] "\n"
78 [email protected]
79 [email protected] "{"
80 [email protected] "\n "
81 [email protected]
82 [email protected]
83 [email protected] "\"\""
84 [email protected] "."
85 [email protected]
86 [email protected] "to_owned"
87 [email protected]
88 [email protected] "("
89 [email protected] ")"
90 [email protected] "\n"
91 [email protected] "}"
92 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0036_fully_qualified.rs b/crates/syntax/test_data/parser/ok/0036_fully_qualified.rs
new file mode 100644
index 000000000..6da27933e
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0036_fully_qualified.rs
@@ -0,0 +1,8 @@
1// https://github.com/rust-analyzer/rust-analyzer/issues/311
2
3pub fn foo<S: Iterator>() -> String
4where
5 <S as Iterator>::Item: Eq,
6{
7 "".to_owned()
8}
diff --git a/crates/syntax/test_data/parser/ok/0037_mod.rast b/crates/syntax/test_data/parser/ok/0037_mod.rast
new file mode 100644
index 000000000..1d5d94bde
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0037_mod.rast
@@ -0,0 +1,16 @@
1[email protected]
2 [email protected] "// https://github.com ..."
3 [email protected] "\n\n"
4 [email protected]
5 [email protected] "//! docs"
6 [email protected] "\n"
7 [email protected] "// non-docs"
8 [email protected] "\n"
9 [email protected] "mod"
10 [email protected] " "
11 [email protected]
12 [email protected] "foo"
13 [email protected] " "
14 [email protected]
15 [email protected] "{"
16 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/ok/0037_mod.rs b/crates/syntax/test_data/parser/ok/0037_mod.rs
new file mode 100644
index 000000000..7e5a1b835
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0037_mod.rs
@@ -0,0 +1,5 @@
1// https://github.com/rust-analyzer/rust-analyzer/issues/357
2
3//! docs
4// non-docs
5mod foo {} \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0038_where_pred_type.rast b/crates/syntax/test_data/parser/ok/0038_where_pred_type.rast
new file mode 100644
index 000000000..22168eaf1
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0038_where_pred_type.rast
@@ -0,0 +1,42 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "test"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "where"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected] "("
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "u64"
22 [email protected] ","
23 [email protected] " "
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected]
28 [email protected] "u64"
29 [email protected] ")"
30 [email protected] ":"
31 [email protected] " "
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected] "Foo"
39 [email protected] " "
40 [email protected]
41 [email protected] "{"
42 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/ok/0038_where_pred_type.rs b/crates/syntax/test_data/parser/ok/0038_where_pred_type.rs
new file mode 100644
index 000000000..8bfc341a5
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0038_where_pred_type.rs
@@ -0,0 +1 @@
fn test() where (u64, u64): Foo {} \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0039_raw_fn_item.rast b/crates/syntax/test_data/parser/ok/0039_raw_fn_item.rast
new file mode 100644
index 000000000..68a366354
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0039_raw_fn_item.rast
@@ -0,0 +1,15 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "r#foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n"
14 [email protected] "}"
15 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0039_raw_fn_item.rs b/crates/syntax/test_data/parser/ok/0039_raw_fn_item.rs
new file mode 100644
index 000000000..8380d1e79
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0039_raw_fn_item.rs
@@ -0,0 +1,2 @@
1fn r#foo() {
2}
diff --git a/crates/syntax/test_data/parser/ok/0040_raw_struct_item_field.rast b/crates/syntax/test_data/parser/ok/0040_raw_struct_item_field.rast
new file mode 100644
index 000000000..8cfc14f49
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0040_raw_struct_item_field.rast
@@ -0,0 +1,22 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "S"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected]
12 [email protected]
13 [email protected] "r#foo"
14 [email protected] ":"
15 [email protected] " "
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "u32"
21 [email protected] "\n"
22 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/ok/0040_raw_struct_item_field.rs b/crates/syntax/test_data/parser/ok/0040_raw_struct_item_field.rs
new file mode 100644
index 000000000..098a60a72
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0040_raw_struct_item_field.rs
@@ -0,0 +1,3 @@
1struct S {
2 r#foo: u32
3} \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0041_raw_keywords.rast b/crates/syntax/test_data/parser/ok/0041_raw_keywords.rast
new file mode 100644
index 000000000..4035aef6f
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0041_raw_keywords.rast
@@ -0,0 +1,49 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] " "
14 [email protected]
15 [email protected] "let"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "r#struct"
20 [email protected] " "
21 [email protected] "="
22 [email protected] " "
23 [email protected]
24 [email protected] "92"
25 [email protected] ";"
26 [email protected] " "
27 [email protected]
28 [email protected] "let"
29 [email protected] " "
30 [email protected]
31 [email protected]
32 [email protected] "r#trait"
33 [email protected] " "
34 [email protected] "="
35 [email protected] " "
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "r#struct"
42 [email protected] " "
43 [email protected] "*"
44 [email protected] " "
45 [email protected]
46 [email protected] "2"
47 [email protected] ";"
48 [email protected] " "
49 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/ok/0041_raw_keywords.rs b/crates/syntax/test_data/parser/ok/0041_raw_keywords.rs
new file mode 100644
index 000000000..d59a6d347
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0041_raw_keywords.rs
@@ -0,0 +1 @@
fn foo() { let r#struct = 92; let r#trait = r#struct * 2; } \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0042_ufcs_call_list.rast b/crates/syntax/test_data/parser/ok/0042_ufcs_call_list.rast
new file mode 100644
index 000000000..e71e069f1
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0042_ufcs_call_list.rast
@@ -0,0 +1,123 @@
1[email protected]
2 [email protected] "// https://github.com ..."
3 [email protected] "\n\n"
4 [email protected]
5 [email protected] "struct"
6 [email protected] " "
7 [email protected]
8 [email protected] "Foo"
9 [email protected] ";"
10 [email protected] "\n\n"
11 [email protected]
12 [email protected] "impl"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "Foo"
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] "\n "
23 [email protected]
24 [email protected] "fn"
25 [email protected] " "
26 [email protected]
27 [email protected] "bar"
28 [email protected]
29 [email protected] "("
30 [email protected] ")"
31 [email protected] " "
32 [email protected]
33 [email protected] "->"
34 [email protected] " "
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected] "bool"
40 [email protected] " "
41 [email protected]
42 [email protected] "{"
43 [email protected] "\n "
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected] "unimplemented"
49 [email protected] "!"
50 [email protected]
51 [email protected] "("
52 [email protected] ")"
53 [email protected] "\n "
54 [email protected] "}"
55 [email protected] "\n"
56 [email protected] "}"
57 [email protected] "\n\n"
58 [email protected]
59 [email protected] "fn"
60 [email protected] " "
61 [email protected]
62 [email protected] "baz"
63 [email protected]
64 [email protected] "("
65 [email protected]
66 [email protected]
67 [email protected] "_"
68 [email protected] ":"
69 [email protected] " "
70 [email protected]
71 [email protected]
72 [email protected]
73 [email protected]
74 [email protected] "bool"
75 [email protected] ")"
76 [email protected] " "
77 [email protected]
78 [email protected] "{"
79 [email protected] "}"
80 [email protected] "\n\n"
81 [email protected]
82 [email protected] "fn"
83 [email protected] " "
84 [email protected]
85 [email protected] "main"
86 [email protected]
87 [email protected] "("
88 [email protected] ")"
89 [email protected] " "
90 [email protected]
91 [email protected] "{"
92 [email protected] "\n "
93 [email protected]
94 [email protected]
95 [email protected]
96 [email protected]
97 [email protected]
98 [email protected] "baz"
99 [email protected]
100 [email protected] "("
101 [email protected]
102 [email protected]
103 [email protected]
104 [email protected]
105 [email protected]
106 [email protected] "<"
107 [email protected]
108 [email protected]
109 [email protected]
110 [email protected]
111 [email protected] "Foo"
112 [email protected] ">"
113 [email protected] "::"
114 [email protected]
115 [email protected]
116 [email protected] "bar"
117 [email protected]
118 [email protected] "("
119 [email protected] ")"
120 [email protected] ")"
121 [email protected] "\n"
122 [email protected] "}"
123 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0042_ufcs_call_list.rs b/crates/syntax/test_data/parser/ok/0042_ufcs_call_list.rs
new file mode 100644
index 000000000..6c02e65ed
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0042_ufcs_call_list.rs
@@ -0,0 +1,15 @@
1// https://github.com/rust-analyzer/rust-analyzer/issues/596
2
3struct Foo;
4
5impl Foo {
6 fn bar() -> bool {
7 unimplemented!()
8 }
9}
10
11fn baz(_: bool) {}
12
13fn main() {
14 baz(<Foo>::bar())
15}
diff --git a/crates/syntax/test_data/parser/ok/0043_complex_assignment.rast b/crates/syntax/test_data/parser/ok/0043_complex_assignment.rast
new file mode 100644
index 000000000..adc4a22e9
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0043_complex_assignment.rast
@@ -0,0 +1,109 @@
1[email protected]
2 [email protected] "// https://github.com ..."
3 [email protected] "\n\n"
4 [email protected]
5 [email protected] "struct"
6 [email protected] " "
7 [email protected]
8 [email protected] "Repr"
9 [email protected] " "
10 [email protected]
11 [email protected] "{"
12 [email protected] " "
13 [email protected]
14 [email protected]
15 [email protected] "raw"
16 [email protected] ":"
17 [email protected] " "
18 [email protected]
19 [email protected] "["
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected] "u8"
25 [email protected] ";"
26 [email protected] " "
27 [email protected]
28 [email protected] "1"
29 [email protected] "]"
30 [email protected] " "
31 [email protected] "}"
32 [email protected] "\n\n"
33 [email protected]
34 [email protected] "fn"
35 [email protected] " "
36 [email protected]
37 [email protected] "abc"
38 [email protected]
39 [email protected] "("
40 [email protected] ")"
41 [email protected] " "
42 [email protected]
43 [email protected] "{"
44 [email protected] "\n "
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected] "Repr"
54 [email protected] " "
55 [email protected]
56 [email protected] "{"
57 [email protected] " "
58 [email protected]
59 [email protected]
60 [email protected] "raw"
61 [email protected] ":"
62 [email protected] " "
63 [email protected]
64 [email protected] "["
65 [email protected]
66 [email protected] "0"
67 [email protected] "]"
68 [email protected] " "
69 [email protected] "}"
70 [email protected] "."
71 [email protected]
72 [email protected] "raw"
73 [email protected] "["
74 [email protected]
75 [email protected] "0"
76 [email protected] "]"
77 [email protected] " "
78 [email protected] "="
79 [email protected] " "
80 [email protected]
81 [email protected] "0"
82 [email protected] ";"
83 [email protected] "\n "
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected] "Repr"
91 [email protected]
92 [email protected] "{"
93 [email protected]
94 [email protected]
95 [email protected] "raw"
96 [email protected] ":"
97 [email protected]
98 [email protected] "["
99 [email protected]
100 [email protected] "0"
101 [email protected] "]"
102 [email protected] "}"
103 [email protected]
104 [email protected] "("
105 [email protected] ")"
106 [email protected] ";"
107 [email protected] "\n"
108 [email protected] "}"
109 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0043_complex_assignment.rs b/crates/syntax/test_data/parser/ok/0043_complex_assignment.rs
new file mode 100644
index 000000000..7e4a28bf7
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0043_complex_assignment.rs
@@ -0,0 +1,8 @@
1// https://github.com/rust-analyzer/rust-analyzer/issues/674
2
3struct Repr { raw: [u8; 1] }
4
5fn abc() {
6 Repr { raw: [0] }.raw[0] = 0;
7 Repr{raw:[0]}();
8}
diff --git a/crates/syntax/test_data/parser/ok/0044_let_attrs.rast b/crates/syntax/test_data/parser/ok/0044_let_attrs.rast
new file mode 100644
index 000000000..af44a4dbe
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0044_let_attrs.rast
@@ -0,0 +1,75 @@
1[email protected]
2 [email protected]
3 [email protected] "// https://github.com ..."
4 [email protected] "\n"
5 [email protected] "fn"
6 [email protected] " "
7 [email protected]
8 [email protected] "main"
9 [email protected]
10 [email protected] "("
11 [email protected] ")"
12 [email protected] " "
13 [email protected]
14 [email protected] "{"
15 [email protected] "\n "
16 [email protected]
17 [email protected]
18 [email protected] "#"
19 [email protected] "["
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected] "cfg"
24 [email protected]
25 [email protected] "("
26 [email protected] "feature"
27 [email protected] " "
28 [email protected] "="
29 [email protected] " "
30 [email protected] "\"backtrace\""
31 [email protected] ")"
32 [email protected] "]"
33 [email protected] "\n "
34 [email protected] "let"
35 [email protected] " "
36 [email protected]
37 [email protected]
38 [email protected] "exit_code"
39 [email protected] " "
40 [email protected] "="
41 [email protected] " "
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected] "panic"
49 [email protected] "::"
50 [email protected]
51 [email protected]
52 [email protected] "catch_unwind"
53 [email protected]
54 [email protected] "("
55 [email protected]
56 [email protected] "move"
57 [email protected] " "
58 [email protected]
59 [email protected] "|"
60 [email protected] "|"
61 [email protected] " "
62 [email protected]
63 [email protected]
64 [email protected]
65 [email protected]
66 [email protected]
67 [email protected] "main"
68 [email protected]
69 [email protected] "("
70 [email protected] ")"
71 [email protected] ")"
72 [email protected] ";"
73 [email protected] "\n"
74 [email protected] "}"
75 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0044_let_attrs.rs b/crates/syntax/test_data/parser/ok/0044_let_attrs.rs
new file mode 100644
index 000000000..325a97aeb
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0044_let_attrs.rs
@@ -0,0 +1,5 @@
1// https://github.com/rust-analyzer/rust-analyzer/issues/677
2fn main() {
3 #[cfg(feature = "backtrace")]
4 let exit_code = panic::catch_unwind(move || main());
5}
diff --git a/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast b/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast
new file mode 100644
index 000000000..0ac56df6d
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast
@@ -0,0 +1,177 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "block"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "#"
16 [email protected] "!"
17 [email protected] "["
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected] "doc"
22 [email protected]
23 [email protected] "("
24 [email protected] "\"Inner attributes all ..."
25 [email protected] ")"
26 [email protected] "]"
27 [email protected] "\n "
28 [email protected] "//! As are ModuleDoc ..."
29 [email protected] "\n "
30 [email protected]
31 [email protected]
32 [email protected] "{"
33 [email protected] "\n "
34 [email protected]
35 [email protected] "#"
36 [email protected] "!"
37 [email protected] "["
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "doc"
42 [email protected]
43 [email protected] "("
44 [email protected] "\"Inner attributes are ..."
45 [email protected] ")"
46 [email protected] "]"
47 [email protected] "\n "
48 [email protected]
49 [email protected] "#"
50 [email protected] "!"
51 [email protected] "["
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected] "doc"
56 [email protected]
57 [email protected] "("
58 [email protected] "\"Being validated is n ..."
59 [email protected] ")"
60 [email protected] "]"
61 [email protected] "\n "
62 [email protected] "//! As are ModuleDoc ..."
63 [email protected] "\n "
64 [email protected] "}"
65 [email protected] ";"
66 [email protected] "\n "
67 [email protected]
68 [email protected] "{"
69 [email protected] "\n "
70 [email protected]
71 [email protected] "#"
72 [email protected] "!"
73 [email protected] "["
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected] "doc"
78 [email protected]
79 [email protected] "("
80 [email protected] "\"Inner attributes are ..."
81 [email protected] ")"
82 [email protected] "]"
83 [email protected] "\n "
84 [email protected] "//! As are ModuleDoc ..."
85 [email protected] "\n "
86 [email protected] "}"
87 [email protected] "\n"
88 [email protected] "}"
89 [email protected] "\n\n"
90 [email protected] "// https://github.com ..."
91 [email protected] "\n"
92 [email protected]
93 [email protected] "impl"
94 [email protected] " "
95 [email protected]
96 [email protected]
97 [email protected]
98 [email protected]
99 [email protected] "Whatever"
100 [email protected] " "
101 [email protected]
102 [email protected] "{"
103 [email protected] "\n "
104 [email protected]
105 [email protected] "fn"
106 [email protected] " "
107 [email protected]
108 [email protected] "salsa_event"
109 [email protected]
110 [email protected] "("
111 [email protected]
112 [email protected] "&"
113 [email protected] "self"
114 [email protected] ","
115 [email protected] " "
116 [email protected]
117 [email protected]
118 [email protected]
119 [email protected] "event_fn"
120 [email protected] ":"
121 [email protected] " "
122 [email protected]
123 [email protected] "impl"
124 [email protected] " "
125 [email protected]
126 [email protected]
127 [email protected]
128 [email protected]
129 [email protected]
130 [email protected]
131 [email protected] "Fn"
132 [email protected]
133 [email protected] "("
134 [email protected] ")"
135 [email protected] " "
136 [email protected]
137 [email protected] "->"
138 [email protected] " "
139 [email protected]
140 [email protected]
141 [email protected]
142 [email protected]
143 [email protected] "Event"
144 [email protected]
145 [email protected] "<"
146 [email protected]
147 [email protected]
148 [email protected]
149 [email protected]
150 [email protected]
151 [email protected] "Self"
152 [email protected] ">"
153 [email protected] ")"
154 [email protected] " "
155 [email protected]
156 [email protected] "{"
157 [email protected] "\n "
158 [email protected]
159 [email protected] "#"
160 [email protected] "!"
161 [email protected] "["
162 [email protected]
163 [email protected]
164 [email protected]
165 [email protected] "allow"
166 [email protected]
167 [email protected] "("
168 [email protected] "unused_variables"
169 [email protected] ")"
170 [email protected] "]"
171 [email protected] " "
172 [email protected] "// this is `inner_at ..."
173 [email protected] "\n "
174 [email protected] "}"
175 [email protected] "\n"
176 [email protected] "}"
177 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rs b/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rs
new file mode 100644
index 000000000..88df8138e
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rs
@@ -0,0 +1,20 @@
1fn block() {
2 #![doc("Inner attributes allowed here")]
3 //! As are ModuleDoc style comments
4 {
5 #![doc("Inner attributes are allowed in blocks used as statements")]
6 #![doc("Being validated is not affected by duplcates")]
7 //! As are ModuleDoc style comments
8 };
9 {
10 #![doc("Inner attributes are allowed in blocks when they are the last statement of another block")]
11 //! As are ModuleDoc style comments
12 }
13}
14
15// https://github.com/rust-analyzer/rust-analyzer/issues/689
16impl Whatever {
17 fn salsa_event(&self, event_fn: impl Fn() -> Event<Self>) {
18 #![allow(unused_variables)] // this is `inner_attr` of the block
19 }
20}
diff --git a/crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rast b/crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rast
new file mode 100644
index 000000000..37594769a
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rast
@@ -0,0 +1,28 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "extern"
5 [email protected] " "
6 [email protected] "\"C\""
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected] "//! This is a doc com ..."
12 [email protected] "\n "
13 [email protected]
14 [email protected] "#"
15 [email protected] "!"
16 [email protected] "["
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "doc"
21 [email protected]
22 [email protected] "("
23 [email protected] "\"This is also a doc c ..."
24 [email protected] ")"
25 [email protected] "]"
26 [email protected] "\n"
27 [email protected] "}"
28 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rs b/crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rs
new file mode 100644
index 000000000..fe67e2df4
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0046_extern_inner_attributes.rs
@@ -0,0 +1,4 @@
1extern "C" {
2 //! This is a doc comment
3 #![doc("This is also a doc comment")]
4}
diff --git a/crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast b/crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast
new file mode 100644
index 000000000..4f8dff909
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast
@@ -0,0 +1,320 @@
1[email protected]
2 [email protected] "// https://github.com ..."
3 [email protected] "\n\n"
4 [email protected]
5 [email protected] "fn"
6 [email protected] " "
7 [email protected]
8 [email protected] "main"
9 [email protected]
10 [email protected] "("
11 [email protected] ")"
12 [email protected] " "
13 [email protected]
14 [email protected] "{"
15 [email protected] "\n "
16 [email protected]
17 [email protected]
18 [email protected] "match"
19 [email protected] " "
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "Some"
26 [email protected]
27 [email protected] "("
28 [email protected]
29 [email protected] "-"
30 [email protected]
31 [email protected] "1"
32 [email protected] ")"
33 [email protected] " "
34 [email protected]
35 [email protected] "{"
36 [email protected] "\n "
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected] "Some"
43 [email protected] "("
44 [email protected]
45 [email protected] "-"
46 [email protected]
47 [email protected] "1"
48 [email protected] ")"
49 [email protected] " "
50 [email protected] "=>"
51 [email protected] " "
52 [email protected]
53 [email protected] "("
54 [email protected] ")"
55 [email protected] ","
56 [email protected] "\n "
57 [email protected]
58 [email protected]
59 [email protected] "_"
60 [email protected] " "
61 [email protected] "=>"
62 [email protected] " "
63 [email protected]
64 [email protected] "("
65 [email protected] ")"
66 [email protected] ","
67 [email protected] "\n "
68 [email protected] "}"
69 [email protected] "\n\n "
70 [email protected]
71 [email protected]
72 [email protected] "match"
73 [email protected] " "
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected] "Some"
80 [email protected]
81 [email protected] "("
82 [email protected]
83 [email protected] "("
84 [email protected]
85 [email protected] "-"
86 [email protected]
87 [email protected] "1"
88 [email protected] ","
89 [email protected] " "
90 [email protected]
91 [email protected] "-"
92 [email protected]
93 [email protected] "1"
94 [email protected] ")"
95 [email protected] ")"
96 [email protected] " "
97 [email protected]
98 [email protected] "{"
99 [email protected] "\n "
100 [email protected]
101 [email protected]
102 [email protected]
103 [email protected]
104 [email protected]
105 [email protected] "Some"
106 [email protected] "("
107 [email protected]
108 [email protected] "("
109 [email protected]
110 [email protected] "-"
111 [email protected]
112 [email protected] "1"
113 [email protected] ","
114 [email protected] " "
115 [email protected]
116 [email protected] "-"
117 [email protected]
118 [email protected] "1"
119 [email protected] ")"
120 [email protected] ")"
121 [email protected] " "
122 [email protected] "=>"
123 [email protected] " "
124 [email protected]
125 [email protected] "("
126 [email protected] ")"
127 [email protected] ","
128 [email protected] "\n "
129 [email protected]
130 [email protected]
131 [email protected] "_"
132 [email protected] " "
133 [email protected] "=>"
134 [email protected] " "
135 [email protected]
136 [email protected] "("
137 [email protected] ")"
138 [email protected] ","
139 [email protected] "\n "
140 [email protected] "}"
141 [email protected] "\n\n "
142 [email protected]
143 [email protected]
144 [email protected] "match"
145 [email protected] " "
146 [email protected]
147 [email protected]
148 [email protected]
149 [email protected]
150 [email protected]
151 [email protected]
152 [email protected] "A"
153 [email protected] "::"
154 [email protected]
155 [email protected]
156 [email protected] "B"
157 [email protected]
158 [email protected] "("
159 [email protected]
160 [email protected] "-"
161 [email protected]
162 [email protected] "1"
163 [email protected] ","
164 [email protected] " "
165 [email protected]
166 [email protected] "-"
167 [email protected]
168 [email protected] "1"
169 [email protected] ")"
170 [email protected] " "
171 [email protected]
172 [email protected] "{"
173 [email protected] "\n "
174 [email protected]
175 [email protected]
176 [email protected]
177 [email protected]
178 [email protected]
179 [email protected]
180 [email protected] "A"
181 [email protected] "::"
182 [email protected]
183 [email protected]
184 [email protected] "B"
185 [email protected] "("
186 [email protected]
187 [email protected] "-"
188 [email protected]
189 [email protected] "1"
190 [email protected] ","
191 [email protected] " "
192 [email protected]
193 [email protected] "-"
194 [email protected]
195 [email protected] "1"
196 [email protected] ")"
197 [email protected] " "
198 [email protected] "=>"
199 [email protected] " "
200 [email protected]
201 [email protected] "("
202 [email protected] ")"
203 [email protected] ","
204 [email protected] "\n "
205 [email protected]
206 [email protected]
207 [email protected] "_"
208 [email protected] " "
209 [email protected] "=>"
210 [email protected] " "
211 [email protected]
212 [email protected] "("
213 [email protected] ")"
214 [email protected] ","
215 [email protected] "\n "
216 [email protected] "}"
217 [email protected] "\n\n "
218 [email protected]
219 [email protected] "if"
220 [email protected] " "
221 [email protected]
222 [email protected] "let"
223 [email protected] " "
224 [email protected]
225 [email protected]
226 [email protected]
227 [email protected]
228 [email protected] "Some"
229 [email protected] "("
230 [email protected]
231 [email protected] "-"
232 [email protected]
233 [email protected] "1"
234 [email protected] ")"
235 [email protected] " "
236 [email protected] "="
237 [email protected] " "
238 [email protected]
239 [email protected]
240 [email protected]
241 [email protected]
242 [email protected]
243 [email protected] "Some"
244 [email protected]
245 [email protected] "("
246 [email protected]
247 [email protected] "-"
248 [email protected]
249 [email protected] "1"
250 [email protected] ")"
251 [email protected] " "
252 [email protected]
253 [email protected] "{"
254 [email protected] "\n "
255 [email protected] "}"
256 [email protected] "\n"
257 [email protected] "}"
258 [email protected] "\n\n"
259 [email protected]
260 [email protected] "enum"
261 [email protected] " "
262 [email protected]
263 [email protected] "A"
264 [email protected] " "
265 [email protected]
266 [email protected] "{"
267 [email protected] "\n "
268 [email protected]
269 [email protected]
270 [email protected] "B"
271 [email protected]
272 [email protected] "("
273 [email protected]
274 [email protected]
275 [email protected]
276 [email protected]
277 [email protected]
278 [email protected] "i8"
279 [email protected] ","
280 [email protected] " "
281 [email protected]
282 [email protected]
283 [email protected]
284 [email protected]
285 [email protected]
286 [email protected] "i8"
287 [email protected] ")"
288 [email protected] "\n"
289 [email protected] "}"
290 [email protected] "\n\n"
291 [email protected]
292 [email protected] "fn"
293 [email protected] " "
294 [email protected]
295 [email protected] "foo"
296 [email protected]
297 [email protected] "("
298 [email protected]
299 [email protected]
300 [email protected]
301 [email protected] "-"
302 [email protected]
303 [email protected] "128"
304 [email protected] "..="
305 [email protected]
306 [email protected]
307 [email protected] "127"
308 [email protected] ":"
309 [email protected] " "
310 [email protected]
311 [email protected]
312 [email protected]
313 [email protected]
314 [email protected] "i8"
315 [email protected] ")"
316 [email protected] " "
317 [email protected]
318 [email protected] "{"
319 [email protected] "}"
320 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rs b/crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rs
new file mode 100644
index 000000000..bbd6b0f6e
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rs
@@ -0,0 +1,27 @@
1// https://github.com/rust-analyzer/rust-analyzer/issues/972
2
3fn main() {
4 match Some(-1) {
5 Some(-1) => (),
6 _ => (),
7 }
8
9 match Some((-1, -1)) {
10 Some((-1, -1)) => (),
11 _ => (),
12 }
13
14 match A::B(-1, -1) {
15 A::B(-1, -1) => (),
16 _ => (),
17 }
18
19 if let Some(-1) = Some(-1) {
20 }
21}
22
23enum A {
24 B(i8, i8)
25}
26
27fn foo(-128..=127: i8) {}
diff --git a/crates/syntax/test_data/parser/ok/0048_compound_assignment.rast b/crates/syntax/test_data/parser/ok/0048_compound_assignment.rast
new file mode 100644
index 000000000..eaab47843
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0048_compound_assignment.rast
@@ -0,0 +1,200 @@
1[email protected]
2 [email protected] "// https://github.com ..."
3 [email protected] "\n\n"
4 [email protected]
5 [email protected] "fn"
6 [email protected] " "
7 [email protected]
8 [email protected] "compound_assignment"
9 [email protected]
10 [email protected] "("
11 [email protected] ")"
12 [email protected] " "
13 [email protected]
14 [email protected] "{"
15 [email protected] "\n "
16 [email protected]
17 [email protected] "let"
18 [email protected] " "
19 [email protected]
20 [email protected] "mut"
21 [email protected] " "
22 [email protected]
23 [email protected] "a"
24 [email protected] " "
25 [email protected] "="
26 [email protected] " "
27 [email protected]
28 [email protected] "0"
29 [email protected] ";"
30 [email protected] "\n "
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected] "a"
38 [email protected] " "
39 [email protected] "+="
40 [email protected] " "
41 [email protected]
42 [email protected] "1"
43 [email protected] ";"
44 [email protected] "\n "
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected] "a"
52 [email protected] " "
53 [email protected] "-="
54 [email protected] " "
55 [email protected]
56 [email protected] "2"
57 [email protected] ";"
58 [email protected] "\n "
59 [email protected]
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected]
64 [email protected]
65 [email protected] "a"
66 [email protected] " "
67 [email protected] "*="
68 [email protected] " "
69 [email protected]
70 [email protected] "3"
71 [email protected] ";"
72 [email protected] "\n "
73 [email protected]
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected] "a"
80 [email protected] " "
81 [email protected] "%="
82 [email protected] " "
83 [email protected]
84 [email protected] "4"
85 [email protected] ";"
86 [email protected] "\n "
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected]
92 [email protected]
93 [email protected] "a"
94 [email protected] " "
95 [email protected] "/="
96 [email protected] " "
97 [email protected]
98 [email protected] "5"
99 [email protected] ";"
100 [email protected] "\n "
101 [email protected]
102 [email protected]
103 [email protected]
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected] "a"
108 [email protected] " "
109 [email protected] "|="
110 [email protected] " "
111 [email protected]
112 [email protected] "6"
113 [email protected] ";"
114 [email protected] "\n "
115 [email protected]
116 [email protected]
117 [email protected]
118 [email protected]
119 [email protected]
120 [email protected]
121 [email protected] "a"
122 [email protected] " "
123 [email protected] "&="
124 [email protected] " "
125 [email protected]
126 [email protected] "7"
127 [email protected] ";"
128 [email protected] "\n "
129 [email protected]
130 [email protected]
131 [email protected]
132 [email protected]
133 [email protected]
134 [email protected]
135 [email protected] "a"
136 [email protected] " "
137 [email protected] "^="
138 [email protected] " "
139 [email protected]
140 [email protected] "8"
141 [email protected] ";"
142 [email protected] "\n "
143 [email protected]
144 [email protected]
145 [email protected]
146 [email protected]
147 [email protected]
148 [email protected]
149 [email protected] "a"
150 [email protected] " "
151 [email protected] "<="
152 [email protected] " "
153 [email protected]
154 [email protected] "9"
155 [email protected] ";"
156 [email protected] "\n "
157 [email protected]
158 [email protected]
159 [email protected]
160 [email protected]
161 [email protected]
162 [email protected]
163 [email protected] "a"
164 [email protected] " "
165 [email protected] ">="
166 [email protected] " "
167 [email protected]
168 [email protected] "10"
169 [email protected] ";"
170 [email protected] "\n "
171 [email protected]
172 [email protected]
173 [email protected]
174 [email protected]
175 [email protected]
176 [email protected]
177 [email protected] "a"
178 [email protected] " "
179 [email protected] ">>="
180 [email protected] " "
181 [email protected]
182 [email protected] "11"
183 [email protected] ";"
184 [email protected] "\n "
185 [email protected]
186 [email protected]
187 [email protected]
188 [email protected]
189 [email protected]
190 [email protected]
191 [email protected] "a"
192 [email protected] " "
193 [email protected] "<<="
194 [email protected] " "
195 [email protected]
196 [email protected] "12"
197 [email protected] ";"
198 [email protected] "\n"
199 [email protected] "}"
200 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0048_compound_assignment.rs b/crates/syntax/test_data/parser/ok/0048_compound_assignment.rs
new file mode 100644
index 000000000..871720a49
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0048_compound_assignment.rs
@@ -0,0 +1,17 @@
1// https://github.com/rust-analyzer/rust-analyzer/pull/983
2
3fn compound_assignment() {
4 let mut a = 0;
5 a += 1;
6 a -= 2;
7 a *= 3;
8 a %= 4;
9 a /= 5;
10 a |= 6;
11 a &= 7;
12 a ^= 8;
13 a <= 9;
14 a >= 10;
15 a >>= 11;
16 a <<= 12;
17}
diff --git a/crates/syntax/test_data/parser/ok/0049_async_block.rast b/crates/syntax/test_data/parser/ok/0049_async_block.rast
new file mode 100644
index 000000000..57ecad3cf
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0049_async_block.rast
@@ -0,0 +1,35 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected] "async"
17 [email protected] " "
18 [email protected]
19 [email protected] "{"
20 [email protected] "}"
21 [email protected] ";"
22 [email protected] "\n "
23 [email protected]
24 [email protected]
25 [email protected] "async"
26 [email protected] " "
27 [email protected] "move"
28 [email protected] " "
29 [email protected]
30 [email protected] "{"
31 [email protected] "}"
32 [email protected] ";"
33 [email protected] "\n"
34 [email protected] "}"
35 [email protected] "\n\n"
diff --git a/crates/syntax/test_data/parser/ok/0049_async_block.rs b/crates/syntax/test_data/parser/ok/0049_async_block.rs
new file mode 100644
index 000000000..4781b3225
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0049_async_block.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 async {};
3 async move {};
4}
5
diff --git a/crates/syntax/test_data/parser/ok/0050_async_block_as_argument.rast b/crates/syntax/test_data/parser/ok/0050_async_block_as_argument.rast
new file mode 100644
index 000000000..c7ce12e93
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0050_async_block_as_argument.rast
@@ -0,0 +1,90 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected] "x"
13 [email protected] ":"
14 [email protected] " "
15 [email protected]
16 [email protected] "impl"
17 [email protected] " "
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected] "std"
27 [email protected] "::"
28 [email protected]
29 [email protected]
30 [email protected] "future"
31 [email protected] "::"
32 [email protected]
33 [email protected]
34 [email protected] "Future"
35 [email protected]
36 [email protected] "<"
37 [email protected]
38 [email protected]
39 [email protected] "Output"
40 [email protected] " "
41 [email protected] "="
42 [email protected] " "
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected] "i32"
48 [email protected] ">"
49 [email protected] ")"
50 [email protected] " "
51 [email protected]
52 [email protected] "{"
53 [email protected] "}"
54 [email protected] "\n\n"
55 [email protected]
56 [email protected] "fn"
57 [email protected] " "
58 [email protected]
59 [email protected] "main"
60 [email protected]
61 [email protected] "("
62 [email protected] ")"
63 [email protected] " "
64 [email protected]
65 [email protected] "{"
66 [email protected] "\n "
67 [email protected]
68 [email protected]
69 [email protected]
70 [email protected]
71 [email protected]
72 [email protected] "foo"
73 [email protected]
74 [email protected] "("
75 [email protected]
76 [email protected] "async"
77 [email protected] " "
78 [email protected] "move"
79 [email protected] " "
80 [email protected]
81 [email protected] "{"
82 [email protected] " "
83 [email protected]
84 [email protected] "12"
85 [email protected] " "
86 [email protected] "}"
87 [email protected] ")"
88 [email protected] "\n"
89 [email protected] "}"
90 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0050_async_block_as_argument.rs b/crates/syntax/test_data/parser/ok/0050_async_block_as_argument.rs
new file mode 100644
index 000000000..ec4612cff
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0050_async_block_as_argument.rs
@@ -0,0 +1,5 @@
1fn foo(x: impl std::future::Future<Output = i32>) {}
2
3fn main() {
4 foo(async move { 12 })
5}
diff --git a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast
new file mode 100644
index 000000000..d4f05f279
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast
@@ -0,0 +1,508 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "g1"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected] "#"
11 [email protected] "["
12 [email protected]
13 [email protected]
14 [email protected]
15 [email protected] "attr1"
16 [email protected] "]"
17 [email protected] " "
18 [email protected]
19 [email protected] "#"
20 [email protected] "["
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected] "attr2"
25 [email protected] "]"
26 [email protected] " "
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected] "pat"
31 [email protected] ":"
32 [email protected] " "
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected] "Type"
38 [email protected] ")"
39 [email protected] " "
40 [email protected]
41 [email protected] "{"
42 [email protected] "}"
43 [email protected] "\n"
44 [email protected]
45 [email protected] "fn"
46 [email protected] " "
47 [email protected]
48 [email protected] "g2"
49 [email protected]
50 [email protected] "("
51 [email protected]
52 [email protected] "#"
53 [email protected] "["
54 [email protected]
55 [email protected]
56 [email protected]
57 [email protected] "attr1"
58 [email protected] "]"
59 [email protected] " "
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected] "x"
64 [email protected] ":"
65 [email protected] " "
66 [email protected]
67 [email protected]
68 [email protected]
69 [email protected]
70 [email protected] "u8"
71 [email protected] ")"
72 [email protected] " "
73 [email protected]
74 [email protected] "{"
75 [email protected] "}"
76 [email protected] "\n\n"
77 [email protected]
78 [email protected]
79 [email protected] "extern"
80 [email protected] " "
81 [email protected] "\"C\""
82 [email protected] " "
83 [email protected]
84 [email protected] "{"
85 [email protected] " "
86 [email protected]
87 [email protected] "fn"
88 [email protected] " "
89 [email protected]
90 [email protected] "printf"
91 [email protected]
92 [email protected] "("
93 [email protected]
94 [email protected]
95 [email protected]
96 [email protected] "format"
97 [email protected] ":"
98 [email protected] " "
99 [email protected]
100 [email protected] "*"
101 [email protected] "const"
102 [email protected] " "
103 [email protected]
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected] "i8"
108 [email protected] ","
109 [email protected] " "
110 [email protected]
111 [email protected] "#"
112 [email protected] "["
113 [email protected]
114 [email protected]
115 [email protected]
116 [email protected] "attr"
117 [email protected] "]"
118 [email protected] " "
119 [email protected]
120 [email protected] "..."
121 [email protected] ")"
122 [email protected] " "
123 [email protected]
124 [email protected] "->"
125 [email protected] " "
126 [email protected]
127 [email protected]
128 [email protected]
129 [email protected]
130 [email protected] "i32"
131 [email protected] ";"
132 [email protected] " "
133 [email protected] "}"
134 [email protected] "\n\n"
135 [email protected]
136 [email protected] "fn"
137 [email protected] " "
138 [email protected]
139 [email protected] "foo"
140 [email protected]
141 [email protected] "<"
142 [email protected]
143 [email protected]
144 [email protected] "F"
145 [email protected] ":"
146 [email protected] " "
147 [email protected]
148 [email protected]
149 [email protected]
150 [email protected]
151 [email protected]
152 [email protected]
153 [email protected] "FnMut"
154 [email protected]
155 [email protected] "("
156 [email protected]
157 [email protected] "#"
158 [email protected] "["
159 [email protected]
160 [email protected]
161 [email protected]
162 [email protected] "attr"
163 [email protected] "]"
164 [email protected] " "
165 [email protected]
166 [email protected]
167 [email protected] "&"
168 [email protected] "mut"
169 [email protected] " "
170 [email protected]
171 [email protected]
172 [email protected]
173 [email protected]
174 [email protected] "Foo"
175 [email protected]
176 [email protected] "<"
177 [email protected]
178 [email protected] "\'a"
179 [email protected] ">"
180 [email protected] ")"
181 [email protected] ">"
182 [email protected]
183 [email protected] "("
184 [email protected] ")"
185 [email protected]
186 [email protected] "{"
187 [email protected] "}"
188 [email protected] "\n\n"
189 [email protected]
190 [email protected] "trait"
191 [email protected] " "
192 [email protected]
193 [email protected] "Foo"
194 [email protected] " "
195 [email protected]
196 [email protected] "{"
197 [email protected] "\n "
198 [email protected]
199 [email protected] "fn"
200 [email protected] " "
201 [email protected]
202 [email protected] "bar"
203 [email protected]
204 [email protected] "("
205 [email protected]
206 [email protected] "#"
207 [email protected] "["
208 [email protected]
209 [email protected]
210 [email protected]
211 [email protected] "attr"
212 [email protected] "]"
213 [email protected] " "
214 [email protected]
215 [email protected]
216 [email protected] "_"
217 [email protected] ":"
218 [email protected] " "
219 [email protected]
220 [email protected]
221 [email protected]
222 [email protected]
223 [email protected] "u64"
224 [email protected] ","
225 [email protected] " "
226 [email protected]
227 [email protected] "#"
228 [email protected] " "
229 [email protected] "["
230 [email protected]
231 [email protected]
232 [email protected]
233 [email protected] "attr"
234 [email protected] "]"
235 [email protected] " "
236 [email protected]
237 [email protected]
238 [email protected] "mut"
239 [email protected] " "
240 [email protected]
241 [email protected] "x"
242 [email protected] ":"
243 [email protected] " "
244 [email protected]
245 [email protected]
246 [email protected]
247 [email protected]
248 [email protected] "i32"
249 [email protected] ")"
250 [email protected] ";"
251 [email protected] "\n"
252 [email protected] "}"
253 [email protected] "\n\n"
254 [email protected]
255 [email protected] "impl"
256 [email protected] " "
257 [email protected]
258 [email protected]
259 [email protected]
260 [email protected]
261 [email protected] "S"
262 [email protected] " "
263 [email protected]
264 [email protected] "{"
265 [email protected] "\n "
266 [email protected]
267 [email protected] "fn"
268 [email protected] " "
269 [email protected]
270 [email protected] "f"
271 [email protected]
272 [email protected] "("
273 [email protected]
274 [email protected] "#"
275 [email protected] "["
276 [email protected]
277 [email protected]
278 [email protected]
279 [email protected] "must_use"
280 [email protected] "]"
281 [email protected] " "
282 [email protected]
283 [email protected] "self"
284 [email protected] ")"
285 [email protected] " "
286 [email protected]
287 [email protected] "{"
288 [email protected] "}"
289 [email protected] "\n "
290 [email protected]
291 [email protected] "fn"
292 [email protected] " "
293 [email protected]
294 [email protected] "g1"
295 [email protected]
296 [email protected] "("
297 [email protected]
298 [email protected] "#"
299 [email protected] "["
300 [email protected]
301 [email protected]
302 [email protected]
303 [email protected] "attr"
304 [email protected] "]"
305 [email protected] " "
306 [email protected]
307 [email protected] "self"
308 [email protected] ")"
309 [email protected] " "
310 [email protected]
311 [email protected] "{"
312 [email protected] "}"
313 [email protected] "\n "
314 [email protected]
315 [email protected] "fn"
316 [email protected] " "
317 [email protected]
318 [email protected] "g2"
319 [email protected]
320 [email protected] "("
321 [email protected]
322 [email protected] "#"
323 [email protected] "["
324 [email protected]
325 [email protected]
326 [email protected]
327 [email protected] "attr"
328 [email protected] "]"
329 [email protected] " "
330 [email protected]
331 [email protected] "&"
332 [email protected] "self"
333 [email protected] ")"
334 [email protected] " "
335 [email protected]
336 [email protected] "{"
337 [email protected] "}"
338 [email protected] "\n "
339 [email protected]
340 [email protected] "fn"
341 [email protected] " "
342 [email protected]
343 [email protected] "g3"
344 [email protected]
345 [email protected] "<"
346 [email protected]
347 [email protected] "\'a"
348 [email protected] ">"
349 [email protected]
350 [email protected] "("
351 [email protected]
352 [email protected] "#"
353 [email protected] "["
354 [email protected]
355 [email protected]
356 [email protected]
357 [email protected] "attr"
358 [email protected] "]"
359 [email protected] " "
360 [email protected]
361 [email protected] "&"
362 [email protected] "mut"
363 [email protected] " "
364 [email protected] "self"
365 [email protected] ")"
366 [email protected] " "
367 [email protected]
368 [email protected] "{"
369 [email protected] "}"
370 [email protected] "\n "
371 [email protected]
372 [email protected] "fn"
373 [email protected] " "
374 [email protected]
375 [email protected] "g4"
376 [email protected]
377 [email protected] "<"
378 [email protected]
379 [email protected] "\'a"
380 [email protected] ">"
381 [email protected]
382 [email protected] "("
383 [email protected]
384 [email protected] "#"
385 [email protected] "["
386 [email protected]
387 [email protected]
388 [email protected]
389 [email protected] "attr"
390 [email protected] "]"
391 [email protected] " "
392 [email protected]
393 [email protected] "&"
394 [email protected] "\'a"
395 [email protected] " "
396 [email protected] "self"
397 [email protected] ")"
398 [email protected] " "
399 [email protected]
400 [email protected] "{"
401 [email protected] "}"
402 [email protected] "\n "
403 [email protected]
404 [email protected] "fn"
405 [email protected] " "
406 [email protected]
407 [email protected] "g5"
408 [email protected]
409 [email protected] "<"
410 [email protected]
411 [email protected] "\'a"
412 [email protected] ">"
413 [email protected]
414 [email protected] "("
415 [email protected]
416 [email protected] "#"
417 [email protected] "["
418 [email protected]
419 [email protected]
420 [email protected]
421 [email protected] "attr"
422 [email protected] "]"
423 [email protected] " "
424 [email protected]
425 [email protected] "&"
426 [email protected] "\'a"
427 [email protected] " "
428 [email protected] "mut"
429 [email protected] " "
430 [email protected] "self"
431 [email protected] ")"
432 [email protected] " "
433 [email protected]
434 [email protected] "{"
435 [email protected] "}"
436 [email protected] "\n "
437 [email protected]
438 [email protected] "fn"
439 [email protected] " "
440 [email protected]
441 [email protected] "c"
442 [email protected]
443 [email protected] "("
444 [email protected]
445 [email protected] "#"
446 [email protected] "["
447 [email protected]
448 [email protected]
449 [email protected]
450 [email protected] "attr"
451 [email protected] "]"
452 [email protected] " "
453 [email protected]
454 [email protected] "self"
455 [email protected] ":"
456 [email protected] " "
457 [email protected]
458 [email protected]
459 [email protected]
460 [email protected]
461 [email protected] "Self"
462 [email protected] ")"
463 [email protected] " "
464 [email protected]
465 [email protected] "{"
466 [email protected] "}"
467 [email protected] "\n "
468 [email protected]
469 [email protected] "fn"
470 [email protected] " "
471 [email protected]
472 [email protected] "d"
473 [email protected]
474 [email protected] "("
475 [email protected]
476 [email protected] "#"
477 [email protected] "["
478 [email protected]
479 [email protected]
480 [email protected]
481 [email protected] "attr"
482 [email protected] "]"
483 [email protected] " "
484 [email protected]
485 [email protected] "self"
486 [email protected] ":"
487 [email protected] " "
488 [email protected]
489 [email protected]
490 [email protected]
491 [email protected]
492 [email protected] "Rc"
493 [email protected]
494 [email protected] "<"
495 [email protected]
496 [email protected]
497 [email protected]
498 [email protected]
499 [email protected]
500 [email protected] "Self"
501 [email protected] ">"
502 [email protected] ")"
503 [email protected] " "
504 [email protected]
505 [email protected] "{"
506 [email protected] "}"
507 [email protected] "\n"
508 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rs b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rs
new file mode 100644
index 000000000..de350d858
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rs
@@ -0,0 +1,21 @@
1fn g1(#[attr1] #[attr2] pat: Type) {}
2fn g2(#[attr1] x: u8) {}
3
4extern "C" { fn printf(format: *const i8, #[attr] ...) -> i32; }
5
6fn foo<F: FnMut(#[attr] &mut Foo<'a>)>(){}
7
8trait Foo {
9 fn bar(#[attr] _: u64, # [attr] mut x: i32);
10}
11
12impl S {
13 fn f(#[must_use] self) {}
14 fn g1(#[attr] self) {}
15 fn g2(#[attr] &self) {}
16 fn g3<'a>(#[attr] &mut self) {}
17 fn g4<'a>(#[attr] &'a self) {}
18 fn g5<'a>(#[attr] &'a mut self) {}
19 fn c(#[attr] self: Self) {}
20 fn d(#[attr] self: Rc<Self>) {}
21} \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0052_for_range_block.rast b/crates/syntax/test_data/parser/ok/0052_for_range_block.rast
new file mode 100644
index 000000000..350823ba3
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0052_for_range_block.rast
@@ -0,0 +1,78 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "for"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected] "_x"
20 [email protected] " "
21 [email protected] "in"
22 [email protected] " "
23 [email protected]
24 [email protected]
25 [email protected] "0"
26 [email protected] " "
27 [email protected] ".."
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected] "("
32 [email protected]
33 [email protected]
34 [email protected] "0"
35 [email protected] " "
36 [email protected] ".."
37 [email protected] " "
38 [email protected]
39 [email protected] "{"
40 [email protected]
41 [email protected]
42 [email protected] "1"
43 [email protected] " "
44 [email protected] "+"
45 [email protected] " "
46 [email protected]
47 [email protected] "2"
48 [email protected] "}"
49 [email protected] ")"
50 [email protected] "."
51 [email protected]
52 [email protected] "sum"
53 [email protected]
54 [email protected] "::"
55 [email protected] "<"
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected] "u32"
62 [email protected] ">"
63 [email protected]
64 [email protected] "("
65 [email protected] ")"
66 [email protected] " "
67 [email protected]
68 [email protected] "{"
69 [email protected] "\n "
70 [email protected]
71 [email protected]
72 [email protected] "break"
73 [email protected] ";"
74 [email protected] "\n "
75 [email protected] "}"
76 [email protected] "\n"
77 [email protected] "}"
78 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0052_for_range_block.rs b/crates/syntax/test_data/parser/ok/0052_for_range_block.rs
new file mode 100644
index 000000000..b51b19630
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0052_for_range_block.rs
@@ -0,0 +1,5 @@
1fn foo() {
2 for _x in 0 .. (0 .. {1 + 2}).sum::<u32>() {
3 break;
4 }
5}
diff --git a/crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast b/crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast
new file mode 100644
index 000000000..be60f7a8e
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast
@@ -0,0 +1,39 @@
1[email protected]
2 [email protected]
3 [email protected] "/// Some docs"
4 [email protected] "\n"
5 [email protected]
6 [email protected] "#"
7 [email protected] "["
8 [email protected]
9 [email protected]
10 [email protected]
11 [email protected] "macro_export"
12 [email protected] "]"
13 [email protected] "\n"
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected] "macro_rules"
18 [email protected] "!"
19 [email protected] " "
20 [email protected]
21 [email protected] "foo"
22 [email protected] " "
23 [email protected]
24 [email protected] "{"
25 [email protected] "\n "
26 [email protected]
27 [email protected] "("
28 [email protected] ")"
29 [email protected] " "
30 [email protected] "="
31 [email protected] ">"
32 [email protected] " "
33 [email protected]
34 [email protected] "{"
35 [email protected] "}"
36 [email protected] ";"
37 [email protected] "\n"
38 [email protected] "}"
39 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rs b/crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rs
new file mode 100644
index 000000000..b59c23c56
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rs
@@ -0,0 +1,5 @@
1/// Some docs
2#[macro_export]
3macro_rules! foo {
4 () => {};
5}
diff --git a/crates/syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast b/crates/syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast
new file mode 100644
index 000000000..f25c9ac36
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast
@@ -0,0 +1,123 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "a"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "->"
13 [email protected] " "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "Foo"
19 [email protected]
20 [email protected] "<"
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected]
27 [email protected] "bar"
28 [email protected] "::"
29 [email protected]
30 [email protected]
31 [email protected] "Baz"
32 [email protected] ">"
33 [email protected] " "
34 [email protected]
35 [email protected] "{"
36 [email protected] "}"
37 [email protected] "\n\n"
38 [email protected]
39 [email protected] "fn"
40 [email protected] " "
41 [email protected]
42 [email protected] "b"
43 [email protected]
44 [email protected] "("
45 [email protected]
46 [email protected]
47 [email protected] "_"
48 [email protected] ":"
49 [email protected] " "
50 [email protected]
51 [email protected] "impl"
52 [email protected] " "
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected] "FnMut"
60 [email protected]
61 [email protected] "("
62 [email protected]
63 [email protected]
64 [email protected]
65 [email protected]
66 [email protected]
67 [email protected]
68 [email protected] "x"
69 [email protected] "::"
70 [email protected]
71 [email protected]
72 [email protected] "Y"
73 [email protected] ")"
74 [email protected] ")"
75 [email protected] " "
76 [email protected]
77 [email protected] "{"
78 [email protected] "}"
79 [email protected] "\n\n"
80 [email protected]
81 [email protected] "fn"
82 [email protected] " "
83 [email protected]
84 [email protected] "c"
85 [email protected]
86 [email protected] "("
87 [email protected]
88 [email protected]
89 [email protected] "_"
90 [email protected] ":"
91 [email protected] " "
92 [email protected]
93 [email protected] "impl"
94 [email protected] " "
95 [email protected]
96 [email protected]
97 [email protected]
98 [email protected]
99 [email protected]
100 [email protected]
101 [email protected] "FnMut"
102 [email protected]
103 [email protected] "("
104 [email protected]
105 [email protected]
106 [email protected] "&"
107 [email protected]
108 [email protected]
109 [email protected]
110 [email protected]
111 [email protected]
112 [email protected] "x"
113 [email protected] "::"
114 [email protected]
115 [email protected]
116 [email protected] "Y"
117 [email protected] ")"
118 [email protected] ")"
119 [email protected] " "
120 [email protected]
121 [email protected] "{"
122 [email protected] "}"
123 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rs b/crates/syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rs
new file mode 100644
index 000000000..0d3f5722a
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rs
@@ -0,0 +1,5 @@
1fn a() -> Foo<bar::Baz> {}
2
3fn b(_: impl FnMut(x::Y)) {}
4
5fn c(_: impl FnMut(&x::Y)) {}
diff --git a/crates/syntax/test_data/parser/ok/0055_dot_dot_dot.rast b/crates/syntax/test_data/parser/ok/0055_dot_dot_dot.rast
new file mode 100644
index 000000000..7447d516e
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0055_dot_dot_dot.rast
@@ -0,0 +1,49 @@
1[email protected]
2 [email protected]
3 [email protected] "type"
4 [email protected] " "
5 [email protected]
6 [email protected] "X"
7 [email protected] " "
8 [email protected] "="
9 [email protected] " "
10 [email protected]
11 [email protected] "("
12 [email protected] ")"
13 [email protected] ";"
14 [email protected] "\n\n"
15 [email protected]
16 [email protected] "fn"
17 [email protected] " "
18 [email protected]
19 [email protected] "main"
20 [email protected]
21 [email protected] "("
22 [email protected] ")"
23 [email protected] " "
24 [email protected]
25 [email protected] "{"
26 [email protected] "\n "
27 [email protected]
28 [email protected] "let"
29 [email protected] " "
30 [email protected]
31 [email protected] "("
32 [email protected] ")"
33 [email protected] ":"
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected] "::"
38 [email protected]
39 [email protected] "X"
40 [email protected] " "
41 [email protected] "="
42 [email protected] " "
43 [email protected]
44 [email protected] "("
45 [email protected] ")"
46 [email protected] ";"
47 [email protected] "\n"
48 [email protected] "}"
49 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0055_dot_dot_dot.rs b/crates/syntax/test_data/parser/ok/0055_dot_dot_dot.rs
new file mode 100644
index 000000000..cd204f65e
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0055_dot_dot_dot.rs
@@ -0,0 +1,5 @@
1type X = ();
2
3fn main() {
4 let ():::X = ();
5}
diff --git a/crates/syntax/test_data/parser/ok/0056_neq_in_type.rast b/crates/syntax/test_data/parser/ok/0056_neq_in_type.rast
new file mode 100644
index 000000000..3ef916e55
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0056_neq_in_type.rast
@@ -0,0 +1,64 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "if"
16 [email protected] " "
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected]
21 [email protected]
22 [email protected] "1.0f32"
23 [email protected] "."
24 [email protected]
25 [email protected] "floor"
26 [email protected]
27 [email protected] "("
28 [email protected] ")"
29 [email protected] " "
30 [email protected] "as"
31 [email protected] " "
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected]
36 [email protected] "i64"
37 [email protected] " "
38 [email protected] "!="
39 [email protected] " "
40 [email protected]
41 [email protected]
42 [email protected]
43 [email protected] "1.0f32"
44 [email protected] "."
45 [email protected]
46 [email protected] "floor"
47 [email protected]
48 [email protected] "("
49 [email protected] ")"
50 [email protected] " "
51 [email protected] "as"
52 [email protected] " "
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected]
57 [email protected] "i64"
58 [email protected] " "
59 [email protected]
60 [email protected] "{"
61 [email protected] "}"
62 [email protected] "\n"
63 [email protected] "}"
64 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0056_neq_in_type.rs b/crates/syntax/test_data/parser/ok/0056_neq_in_type.rs
new file mode 100644
index 000000000..6210683ce
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0056_neq_in_type.rs
@@ -0,0 +1,3 @@
1fn main() {
2 if 1.0f32.floor() as i64 != 1.0f32.floor() as i64 {}
3}
diff --git a/crates/syntax/test_data/parser/ok/0057_loop_in_call.rast b/crates/syntax/test_data/parser/ok/0057_loop_in_call.rast
new file mode 100644
index 000000000..76301004a
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0057_loop_in_call.rast
@@ -0,0 +1,56 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected]
11 [email protected]
12 [email protected] "x"
13 [email protected] ":"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "i32"
20 [email protected] ")"
21 [email protected] " "
22 [email protected]
23 [email protected] "{"
24 [email protected] "}"
25 [email protected] "\n\n"
26 [email protected]
27 [email protected] "fn"
28 [email protected] " "
29 [email protected]
30 [email protected] "main"
31 [email protected]
32 [email protected] "("
33 [email protected] ")"
34 [email protected] " "
35 [email protected]
36 [email protected] "{"
37 [email protected] "\n "
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected]
42 [email protected]
43 [email protected]
44 [email protected] "foo"
45 [email protected]
46 [email protected] "("
47 [email protected]
48 [email protected] "loop"
49 [email protected] " "
50 [email protected]
51 [email protected] "{"
52 [email protected] "}"
53 [email protected] ")"
54 [email protected] ";"
55 [email protected] "\n"
56 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/ok/0057_loop_in_call.rs b/crates/syntax/test_data/parser/ok/0057_loop_in_call.rs
new file mode 100644
index 000000000..31c12522f
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0057_loop_in_call.rs
@@ -0,0 +1,5 @@
1fn foo(x: i32) {}
2
3fn main() {
4 foo(loop {});
5} \ No newline at end of file
diff --git a/crates/syntax/test_data/parser/ok/0058_unary_expr_precedence.rast b/crates/syntax/test_data/parser/ok/0058_unary_expr_precedence.rast
new file mode 100644
index 000000000..a1dfd58f2
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0058_unary_expr_precedence.rast
@@ -0,0 +1,96 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "foo"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "1"
19 [email protected] " "
20 [email protected] "+"
21 [email protected] " "
22 [email protected]
23 [email protected] "*"
24 [email protected]
25 [email protected] "&"
26 [email protected]
27 [email protected] "2"
28 [email protected] " "
29 [email protected] "+"
30 [email protected] " "
31 [email protected]
32 [email protected] "3"
33 [email protected] ";"
34 [email protected] "\n "
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected] "*"
39 [email protected]
40 [email protected] "&"
41 [email protected]
42 [email protected] "1"
43 [email protected] " "
44 [email protected] "as"
45 [email protected] " "
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected] "u64"
51 [email protected] ";"
52 [email protected] "\n "
53 [email protected]
54 [email protected]
55 [email protected] "*"
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected] "x"
62 [email protected]
63 [email protected] "("
64 [email protected]
65 [email protected] "1"
66 [email protected] ")"
67 [email protected] ";"
68 [email protected] "\n "
69 [email protected]
70 [email protected]
71 [email protected] "&"
72 [email protected]
73 [email protected]
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected] "x"
78 [email protected] "["
79 [email protected]
80 [email protected] "1"
81 [email protected] "]"
82 [email protected] ";"
83 [email protected] "\n "
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected] "-"
88 [email protected]
89 [email protected] "1"
90 [email protected] ".."
91 [email protected]
92 [email protected] "2"
93 [email protected] ";"
94 [email protected] "\n"
95 [email protected] "}"
96 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0058_unary_expr_precedence.rs b/crates/syntax/test_data/parser/ok/0058_unary_expr_precedence.rs
new file mode 100644
index 000000000..100fccc64
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0058_unary_expr_precedence.rs
@@ -0,0 +1,7 @@
1fn foo() {
2 1 + *&2 + 3;
3 *&1 as u64;
4 *x(1);
5 &x[1];
6 -1..2;
7}
diff --git a/crates/syntax/test_data/parser/ok/0059_loops_in_parens.rast b/crates/syntax/test_data/parser/ok/0059_loops_in_parens.rast
new file mode 100644
index 000000000..213f7b381
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0059_loops_in_parens.rast
@@ -0,0 +1,97 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "Some"
21 [email protected]
22 [email protected] "("
23 [email protected]
24 [email protected] "for"
25 [email protected] " "
26 [email protected]
27 [email protected] "_"
28 [email protected] " "
29 [email protected] "in"
30 [email protected] " "
31 [email protected]
32 [email protected]
33 [email protected] "["
34 [email protected]
35 [email protected] "1"
36 [email protected] "]"
37 [email protected] "."
38 [email protected]
39 [email protected] "into_iter"
40 [email protected]
41 [email protected] "("
42 [email protected] ")"
43 [email protected] " "
44 [email protected]
45 [email protected] "{"
46 [email protected] "}"
47 [email protected] ")"
48 [email protected] ";"
49 [email protected] "\n "
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected]
56 [email protected] "Some"
57 [email protected]
58 [email protected] "("
59 [email protected]
60 [email protected] "loop"
61 [email protected] " "
62 [email protected]
63 [email protected] "{"
64 [email protected] " "
65 [email protected]
66 [email protected]
67 [email protected] "break"
68 [email protected] ";"
69 [email protected] " "
70 [email protected] "}"
71 [email protected] ")"
72 [email protected] ";"
73 [email protected] "\n "
74 [email protected]
75 [email protected]
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected]
80 [email protected] "Some"
81 [email protected]
82 [email protected] "("
83 [email protected]
84 [email protected] "while"
85 [email protected] " "
86 [email protected]
87 [email protected]
88 [email protected] "true"
89 [email protected] " "
90 [email protected]
91 [email protected] "{"
92 [email protected] "}"
93 [email protected] ")"
94 [email protected] ";"
95 [email protected] "\n"
96 [email protected] "}"
97 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0059_loops_in_parens.rs b/crates/syntax/test_data/parser/ok/0059_loops_in_parens.rs
new file mode 100644
index 000000000..6e8b718aa
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0059_loops_in_parens.rs
@@ -0,0 +1,5 @@
1fn main() {
2 Some(for _ in [1].into_iter() {});
3 Some(loop { break; });
4 Some(while true {});
5}
diff --git a/crates/syntax/test_data/parser/ok/0060_as_range.rast b/crates/syntax/test_data/parser/ok/0060_as_range.rast
new file mode 100644
index 000000000..1fd1a2888
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0060_as_range.rast
@@ -0,0 +1,55 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected] "0"
19 [email protected] " "
20 [email protected] "as"
21 [email protected] " "
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected]
26 [email protected] "usize"
27 [email protected] " "
28 [email protected] ".."
29 [email protected] ";"
30 [email protected] "\n "
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected]
35 [email protected] "1"
36 [email protected] " "
37 [email protected] "+"
38 [email protected] " "
39 [email protected]
40 [email protected]
41 [email protected] "2"
42 [email protected] " "
43 [email protected] "as"
44 [email protected] " "
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected]
49 [email protected] "usize"
50 [email protected] " "
51 [email protected] ".."
52 [email protected] ";"
53 [email protected] "\n"
54 [email protected] "}"
55 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0060_as_range.rs b/crates/syntax/test_data/parser/ok/0060_as_range.rs
new file mode 100644
index 000000000..f063ffadb
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0060_as_range.rs
@@ -0,0 +1,4 @@
1fn main() {
2 0 as usize ..;
3 1 + 2 as usize ..;
4}
diff --git a/crates/syntax/test_data/parser/ok/0061_match_full_range.rast b/crates/syntax/test_data/parser/ok/0061_match_full_range.rast
new file mode 100644
index 000000000..ba49c115b
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0061_match_full_range.rast
@@ -0,0 +1,26 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "main"
7 [email protected]
8 [email protected] "("
9 [email protected] ")"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "match"
16 [email protected] " "
17 [email protected]
18 [email protected] ".."
19 [email protected] " "
20 [email protected]
21 [email protected] "{"
22 [email protected] "\n "
23 [email protected] "}"
24 [email protected] "\n"
25 [email protected] "}"
26 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0061_match_full_range.rs b/crates/syntax/test_data/parser/ok/0061_match_full_range.rs
new file mode 100644
index 000000000..2c4ed11e1
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0061_match_full_range.rs
@@ -0,0 +1,4 @@
1fn main() {
2 match .. {
3 }
4}
diff --git a/crates/syntax/test_data/parser/ok/0062_macro_2.0.rast b/crates/syntax/test_data/parser/ok/0062_macro_2.0.rast
new file mode 100644
index 000000000..0c22c31a4
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0062_macro_2.0.rast
@@ -0,0 +1,175 @@
1[email protected]
2 [email protected]
3 [email protected] "macro"
4 [email protected] " "
5 [email protected]
6 [email protected] "parse_use_trees"
7 [email protected]
8 [email protected]
9 [email protected] "("
10 [email protected] "$"
11 [email protected]
12 [email protected] "("
13 [email protected] "$"
14 [email protected] "s"
15 [email protected] ":"
16 [email protected] "expr"
17 [email protected] ")"
18 [email protected] ","
19 [email protected] "*"
20 [email protected] " "
21 [email protected] "$"
22 [email protected]
23 [email protected] "("
24 [email protected] ","
25 [email protected] ")"
26 [email protected] "*"
27 [email protected] ")"
28 [email protected] " "
29 [email protected]
30 [email protected] "{"
31 [email protected] "\n "
32 [email protected] "vec"
33 [email protected] "!"
34 [email protected]
35 [email protected] "["
36 [email protected] "\n "
37 [email protected] "$"
38 [email protected]
39 [email protected] "("
40 [email protected] "parse_use_tree"
41 [email protected]
42 [email protected] "("
43 [email protected] "$"
44 [email protected] "s"
45 [email protected] ")"
46 [email protected] ","
47 [email protected] ")"
48 [email protected] "*"
49 [email protected] "\n "
50 [email protected] "]"
51 [email protected] "\n"
52 [email protected] "}"
53 [email protected] "\n\n"
54 [email protected]
55 [email protected]
56 [email protected] "#"
57 [email protected] "["
58 [email protected]
59 [email protected]
60 [email protected]
61 [email protected] "test"
62 [email protected] "]"
63 [email protected] "\n"
64 [email protected] "fn"
65 [email protected] " "
66 [email protected]
67 [email protected] "test_use_tree_merge"
68 [email protected]
69 [email protected] "("
70 [email protected] ")"
71 [email protected] " "
72 [email protected]
73 [email protected] "{"
74 [email protected] "\n "
75 [email protected]
76 [email protected] "macro"
77 [email protected] " "
78 [email protected]
79 [email protected] "test_merge"
80 [email protected]
81 [email protected]
82 [email protected] "("
83 [email protected]
84 [email protected] "["
85 [email protected] "$"
86 [email protected]
87 [email protected] "("
88 [email protected] "$"
89 [email protected] "input"
90 [email protected] ":"
91 [email protected] "expr"
92 [email protected] ")"
93 [email protected] ","
94 [email protected] "*"
95 [email protected] " "
96 [email protected] "$"
97 [email protected]
98 [email protected] "("
99 [email protected] ","
100 [email protected] ")"
101 [email protected] "*"
102 [email protected] "]"
103 [email protected] ","
104 [email protected] " "
105 [email protected]
106 [email protected] "["
107 [email protected] "$"
108 [email protected]
109 [email protected] "("
110 [email protected] "$"
111 [email protected] "output"
112 [email protected] ":"
113 [email protected] "expr"
114 [email protected] ")"
115 [email protected] ","
116 [email protected] "*"
117 [email protected] " "
118 [email protected] "$"
119 [email protected]
120 [email protected] "("
121 [email protected] ","
122 [email protected] ")"
123 [email protected] "*"
124 [email protected] "]"
125 [email protected] ")"
126 [email protected] " "
127 [email protected]
128 [email protected] "{"
129 [email protected] "\n "
130 [email protected] "assert_eq"
131 [email protected] "!"
132 [email protected]
133 [email protected] "("
134 [email protected] "\n "
135 [email protected] "merge_use_trees"
136 [email protected]
137 [email protected] "("
138 [email protected] "parse_use_trees"
139 [email protected] "!"
140 [email protected]
141 [email protected] "("
142 [email protected] "$"
143 [email protected]
144 [email protected] "("
145 [email protected] "$"
146 [email protected] "input"
147 [email protected] ","
148 [email protected] ")"
149 [email protected] "*"
150 [email protected] ")"
151 [email protected] ")"
152 [email protected] ","
153 [email protected] "\n "
154 [email protected] "parse_use_trees"
155 [email protected] "!"
156 [email protected]
157 [email protected] "("
158 [email protected] "$"
159 [email protected]
160 [email protected] "("
161 [email protected] "$"
162 [email protected] "output"
163 [email protected] ","
164 [email protected] ")"
165 [email protected] "*"
166 [email protected] ")"
167 [email protected] ","
168 [email protected] "\n "
169 [email protected] ")"
170 [email protected] ";"
171 [email protected] "\n "
172 [email protected] "}"
173 [email protected] "\n"
174 [email protected] "}"
175 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0062_macro_2.0.rs b/crates/syntax/test_data/parser/ok/0062_macro_2.0.rs
new file mode 100644
index 000000000..781047ba1
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0062_macro_2.0.rs
@@ -0,0 +1,15 @@
1macro parse_use_trees($($s:expr),* $(,)*) {
2 vec![
3 $(parse_use_tree($s),)*
4 ]
5}
6
7#[test]
8fn test_use_tree_merge() {
9 macro test_merge([$($input:expr),* $(,)*], [$($output:expr),* $(,)*]) {
10 assert_eq!(
11 merge_use_trees(parse_use_trees!($($input,)*)),
12 parse_use_trees!($($output,)*),
13 );
14 }
15}
diff --git a/crates/syntax/test_data/parser/ok/0063_trait_fn_patterns.rast b/crates/syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
new file mode 100644
index 000000000..8eda59976
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
@@ -0,0 +1,194 @@
1[email protected]
2 [email protected]
3 [email protected] "trait"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected]
12 [email protected] "fn"
13 [email protected] " "
14 [email protected]
15 [email protected] "f1"
16 [email protected]
17 [email protected] "("
18 [email protected]
19 [email protected]
20 [email protected] "("
21 [email protected]
22 [email protected]
23 [email protected] "a"
24 [email protected] ","
25 [email protected] " "
26 [email protected]
27 [email protected]
28 [email protected] "b"
29 [email protected] ")"
30 [email protected] ":"
31 [email protected] " "
32 [email protected]
33 [email protected] "("
34 [email protected]
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected] "usize"
39 [email protected] ","
40 [email protected] " "
41 [email protected]
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected] "usize"
46 [email protected] ")"
47 [email protected] ")"
48 [email protected] " "
49 [email protected]
50 [email protected] "{"
51 [email protected] "}"
52 [email protected] "\n "
53 [email protected]
54 [email protected] "fn"
55 [email protected] " "
56 [email protected]
57 [email protected] "f2"
58 [email protected]
59 [email protected] "("
60 [email protected]
61 [email protected]
62 [email protected]
63 [email protected]
64 [email protected]
65 [email protected] "S"
66 [email protected] " "
67 [email protected]
68 [email protected] "{"
69 [email protected] " "
70 [email protected]
71 [email protected]
72 [email protected]
73 [email protected] "a"
74 [email protected] ","
75 [email protected] " "
76 [email protected]
77 [email protected]
78 [email protected]
79 [email protected] "b"
80 [email protected] " "
81 [email protected] "}"
82 [email protected] ":"
83 [email protected] " "
84 [email protected]
85 [email protected]
86 [email protected]
87 [email protected]
88 [email protected] "S"
89 [email protected] ")"
90 [email protected] " "
91 [email protected]
92 [email protected] "{"
93 [email protected] "}"
94 [email protected] "\n "
95 [email protected]
96 [email protected] "fn"
97 [email protected] " "
98 [email protected]
99 [email protected] "f3"
100 [email protected]
101 [email protected] "("
102 [email protected]
103 [email protected]
104 [email protected]
105 [email protected]
106 [email protected]
107 [email protected] "NewType"
108 [email protected] "("
109 [email protected]
110 [email protected]
111 [email protected] "a"
112 [email protected] ")"
113 [email protected] ":"
114 [email protected] " "
115 [email protected]
116 [email protected]
117 [email protected]
118 [email protected]
119 [email protected] "NewType"
120 [email protected] ")"
121 [email protected] " "
122 [email protected]
123 [email protected] "{"
124 [email protected] "}"
125 [email protected] "\n "
126 [email protected]
127 [email protected] "fn"
128 [email protected] " "
129 [email protected]
130 [email protected] "f4"
131 [email protected]
132 [email protected] "("
133 [email protected]
134 [email protected]
135 [email protected] "&"
136 [email protected]
137 [email protected] "&"
138 [email protected]
139 [email protected]
140 [email protected] "a"
141 [email protected] ":"
142 [email protected] " "
143 [email protected]
144 [email protected] "&"
145 [email protected]
146 [email protected] "&"
147 [email protected]
148 [email protected]
149 [email protected]
150 [email protected]
151 [email protected] "usize"
152 [email protected] ")"
153 [email protected] " "
154 [email protected]
155 [email protected] "{"
156 [email protected] "}"
157 [email protected] "\n "
158 [email protected]
159 [email protected] "fn"
160 [email protected] " "
161 [email protected]
162 [email protected] "bar"
163 [email protected]
164 [email protected] "("
165 [email protected]
166 [email protected]
167 [email protected] "_"
168 [email protected] ":"
169 [email protected] " "
170 [email protected]
171 [email protected]
172 [email protected]
173 [email protected]
174 [email protected] "u64"
175 [email protected] ","
176 [email protected] " "
177 [email protected]
178 [email protected]
179 [email protected] "mut"
180 [email protected] " "
181 [email protected]
182 [email protected] "x"
183 [email protected] ":"
184 [email protected] " "
185 [email protected]
186 [email protected]
187 [email protected]
188 [email protected]
189 [email protected] "i32"
190 [email protected] ")"
191 [email protected] ";"
192 [email protected] "\n"
193 [email protected] "}"
194 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0063_trait_fn_patterns.rs b/crates/syntax/test_data/parser/ok/0063_trait_fn_patterns.rs
new file mode 100644
index 000000000..3b666af8e
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0063_trait_fn_patterns.rs
@@ -0,0 +1,7 @@
1trait T {
2 fn f1((a, b): (usize, usize)) {}
3 fn f2(S { a, b }: S) {}
4 fn f3(NewType(a): NewType) {}
5 fn f4(&&a: &&usize) {}
6 fn bar(_: u64, mut x: i32);
7}
diff --git a/crates/syntax/test_data/parser/ok/0063_variadic_fun.rast b/crates/syntax/test_data/parser/ok/0063_variadic_fun.rast
new file mode 100644
index 000000000..4009b3ff8
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0063_variadic_fun.rast
@@ -0,0 +1,133 @@
1[email protected]
2 [email protected]
3 [email protected]
4 [email protected] "extern"
5 [email protected] " "
6 [email protected] "\"C\""
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected]
12 [email protected] "fn"
13 [email protected] " "
14 [email protected]
15 [email protected] "a"
16 [email protected]
17 [email protected] "("
18 [email protected]
19 [email protected]
20 [email protected] "_"
21 [email protected] ":"
22 [email protected] " "
23 [email protected]
24 [email protected] "*"
25 [email protected] "mut"
26 [email protected] " "
27 [email protected]
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected] "u8"
32 [email protected] ","
33 [email protected] " "
34 [email protected]
35 [email protected] "..."
36 [email protected] ","
37 [email protected] ")"
38 [email protected] ";"
39 [email protected] "\n "
40 [email protected]
41 [email protected] "fn"
42 [email protected] " "
43 [email protected]
44 [email protected] "b"
45 [email protected]
46 [email protected] "("
47 [email protected]
48 [email protected]
49 [email protected] "_"
50 [email protected] ":"
51 [email protected] " "
52 [email protected]
53 [email protected] "*"
54 [email protected] "mut"
55 [email protected] " "
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected]
60 [email protected] "u8"
61 [email protected] ","
62 [email protected] " "
63 [email protected]
64 [email protected]
65 [email protected] "_"
66 [email protected] ":"
67 [email protected] " "
68 [email protected] "..."
69 [email protected] ")"
70 [email protected] ";"
71 [email protected] "\n "
72 [email protected]
73 [email protected] "fn"
74 [email protected] " "
75 [email protected]
76 [email protected] "c"
77 [email protected]
78 [email protected] "("
79 [email protected]
80 [email protected]
81 [email protected] "_"
82 [email protected] ":"
83 [email protected] " "
84 [email protected]
85 [email protected] "*"
86 [email protected] "mut"
87 [email protected] " "
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected]
92 [email protected] "u8"
93 [email protected] ","
94 [email protected] " "
95 [email protected]
96 [email protected] "#"
97 [email protected] "["
98 [email protected]
99 [email protected]
100 [email protected]
101 [email protected] "cfg"
102 [email protected]
103 [email protected] "("
104 [email protected] "never"
105 [email protected] ")"
106 [email protected] "]"
107 [email protected] " "
108 [email protected]
109 [email protected]
110 [email protected] "["
111 [email protected]
112 [email protected]
113 [email protected] "w"
114 [email protected] ","
115 [email protected] " "
116 [email protected]
117 [email protected]
118 [email protected] "t"
119 [email protected] ","
120 [email protected] " "
121 [email protected]
122 [email protected]
123 [email protected] "f"
124 [email protected] "]"
125 [email protected] ":"
126 [email protected] " "
127 [email protected] "..."
128 [email protected] ","
129 [email protected] ")"
130 [email protected] ";"
131 [email protected] "\n"
132 [email protected] "}"
133 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0063_variadic_fun.rs b/crates/syntax/test_data/parser/ok/0063_variadic_fun.rs
new file mode 100644
index 000000000..a16afbaf3
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0063_variadic_fun.rs
@@ -0,0 +1,5 @@
1extern "C" {
2 fn a(_: *mut u8, ...,);
3 fn b(_: *mut u8, _: ...);
4 fn c(_: *mut u8, #[cfg(never)] [w, t, f]: ...,);
5}
diff --git a/crates/syntax/test_data/parser/ok/0064_impl_fn_params.rast b/crates/syntax/test_data/parser/ok/0064_impl_fn_params.rast
new file mode 100644
index 000000000..a3c6ed82e
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0064_impl_fn_params.rast
@@ -0,0 +1,162 @@
1[email protected]
2 [email protected]
3 [email protected] "impl"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected]
9 [email protected] "U"
10 [email protected] " "
11 [email protected]
12 [email protected] "{"
13 [email protected] "\n "
14 [email protected]
15 [email protected] "fn"
16 [email protected] " "
17 [email protected]
18 [email protected] "f1"
19 [email protected]
20 [email protected] "("
21 [email protected]
22 [email protected]
23 [email protected] "("
24 [email protected]
25 [email protected]
26 [email protected] "a"
27 [email protected] ","
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected] "b"
32 [email protected] ")"
33 [email protected] ":"
34 [email protected] " "
35 [email protected]
36 [email protected] "("
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "usize"
42 [email protected] ","
43 [email protected] " "
44 [email protected]
45 [email protected]
46 [email protected]
47 [email protected]
48 [email protected] "usize"
49 [email protected] ")"
50 [email protected] ")"
51 [email protected] " "
52 [email protected]
53 [email protected] "{"
54 [email protected] "}"
55 [email protected] "\n "
56 [email protected]
57 [email protected] "fn"
58 [email protected] " "
59 [email protected]
60 [email protected] "f2"
61 [email protected]
62 [email protected] "("
63 [email protected]
64 [email protected]
65 [email protected]
66 [email protected]
67 [email protected]
68 [email protected] "S"
69 [email protected] " "
70 [email protected]
71 [email protected] "{"
72 [email protected] " "
73 [email protected]
74 [email protected]
75 [email protected]
76 [email protected] "a"
77 [email protected] ","
78 [email protected] " "
79 [email protected]
80 [email protected]
81 [email protected]
82 [email protected] "b"
83 [email protected] " "
84 [email protected] "}"
85 [email protected] ":"
86 [email protected] " "
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected]
91 [email protected] "S"
92 [email protected] ")"
93 [email protected] " "
94 [email protected]
95 [email protected] "{"
96 [email protected] "}"
97 [email protected] "\n "
98 [email protected]
99 [email protected] "fn"
100 [email protected] " "
101 [email protected]
102 [email protected] "f3"
103 [email protected]
104 [email protected] "("
105 [email protected]
106 [email protected]
107 [email protected]
108 [email protected]
109 [email protected]
110 [email protected] "NewType"
111 [email protected] "("
112 [email protected]
113 [email protected]
114 [email protected] "a"
115 [email protected] ")"
116 [email protected] ":"
117 [email protected] " "
118 [email protected]
119 [email protected]
120 [email protected]
121 [email protected]
122 [email protected] "NewType"
123 [email protected] ")"
124 [email protected] " "
125 [email protected]
126 [email protected] "{"
127 [email protected] "}"
128 [email protected] "\n "
129 [email protected]
130 [email protected] "fn"
131 [email protected] " "
132 [email protected]
133 [email protected] "f4"
134 [email protected]
135 [email protected] "("
136 [email protected]
137 [email protected]
138 [email protected] "&"
139 [email protected]
140 [email protected] "&"
141 [email protected]
142 [email protected]
143 [email protected] "a"
144 [email protected] ":"
145 [email protected] " "
146 [email protected]
147 [email protected] "&"
148 [email protected]
149 [email protected] "&"
150 [email protected]
151 [email protected]
152 [email protected]
153 [email protected]
154 [email protected] "usize"
155 [email protected] ")"
156 [email protected] " "
157 [email protected]
158 [email protected] "{"
159 [email protected] "}"
160 [email protected] "\n"
161 [email protected] "}"
162 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0064_impl_fn_params.rs b/crates/syntax/test_data/parser/ok/0064_impl_fn_params.rs
new file mode 100644
index 000000000..b49e872d7
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0064_impl_fn_params.rs
@@ -0,0 +1,6 @@
1impl U {
2 fn f1((a, b): (usize, usize)) {}
3 fn f2(S { a, b }: S) {}
4 fn f3(NewType(a): NewType) {}
5 fn f4(&&a: &&usize) {}
6}
diff --git a/crates/syntax/test_data/parser/ok/0065_comment_newline.rast b/crates/syntax/test_data/parser/ok/0065_comment_newline.rast
new file mode 100644
index 000000000..29bd38c05
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0065_comment_newline.rast
@@ -0,0 +1,16 @@
1[email protected]
2 [email protected]
3 [email protected] "/// Example"
4 [email protected] "\n\n"
5 [email protected] "fn"
6 [email protected] " "
7 [email protected]
8 [email protected] "test"
9 [email protected]
10 [email protected] "("
11 [email protected] ")"
12 [email protected] " "
13 [email protected]
14 [email protected] "{"
15 [email protected] "}"
16 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0065_comment_newline.rs b/crates/syntax/test_data/parser/ok/0065_comment_newline.rs
new file mode 100644
index 000000000..1fafe216b
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0065_comment_newline.rs
@@ -0,0 +1,3 @@
1/// Example
2
3fn test() {}
diff --git a/crates/syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast b/crates/syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast
new file mode 100644
index 000000000..2c699ffcb
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast
@@ -0,0 +1,60 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "f"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "T"
12 [email protected] ">"
13 [email protected]
14 [email protected] "("
15 [email protected] ")"
16 [email protected] " "
17 [email protected]
18 [email protected] "where"
19 [email protected] " "
20 [email protected]
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "T"
26 [email protected] ":"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "Fn"
35 [email protected]
36 [email protected] "("
37 [email protected] ")"
38 [email protected] " "
39 [email protected]
40 [email protected] "->"
41 [email protected] " "
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected]
46 [email protected] "u8"
47 [email protected] " "
48 [email protected] "+"
49 [email protected] " "
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected]
54 [email protected]
55 [email protected] "Send"
56 [email protected] " "
57 [email protected]
58 [email protected] "{"
59 [email protected] "}"
60 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rs b/crates/syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rs
new file mode 100644
index 000000000..29f3655e0
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rs
@@ -0,0 +1 @@
fn f<T>() where T: Fn() -> u8 + Send {}
diff --git a/crates/syntax/test_data/parser/ok/0066_default_modifier.rast b/crates/syntax/test_data/parser/ok/0066_default_modifier.rast
new file mode 100644
index 000000000..e9b57ec3b
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0066_default_modifier.rast
@@ -0,0 +1,218 @@
1[email protected]
2 [email protected]
3 [email protected] "trait"
4 [email protected] " "
5 [email protected]
6 [email protected] "T"
7 [email protected] " "
8 [email protected]
9 [email protected] "{"
10 [email protected] "\n "
11 [email protected]
12 [email protected] "default"
13 [email protected] " "
14 [email protected] "type"
15 [email protected] " "
16 [email protected]
17 [email protected] "T"
18 [email protected] " "
19 [email protected] "="
20 [email protected] " "
21 [email protected]
22 [email protected]
23 [email protected]
24 [email protected]
25 [email protected] "Bar"
26 [email protected] ";"
27 [email protected] "\n "
28 [email protected]
29 [email protected] "default"
30 [email protected] " "
31 [email protected] "const"
32 [email protected] " "
33 [email protected]
34 [email protected] "f"
35 [email protected] ":"
36 [email protected] " "
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "u8"
42 [email protected] " "
43 [email protected] "="
44 [email protected] " "
45 [email protected]
46 [email protected] "0"
47 [email protected] ";"
48 [email protected] "\n "
49 [email protected]
50 [email protected] "default"
51 [email protected] " "
52 [email protected] "fn"
53 [email protected] " "
54 [email protected]
55 [email protected] "foo"
56 [email protected]
57 [email protected] "("
58 [email protected] ")"
59 [email protected] " "
60 [email protected]
61 [email protected] "{"
62 [email protected] "}"
63 [email protected] "\n "
64 [email protected]
65 [email protected] "default"
66 [email protected] " "
67 [email protected] "unsafe"
68 [email protected] " "
69 [email protected] "fn"
70 [email protected] " "
71 [email protected]
72 [email protected] "bar"
73 [email protected]
74 [email protected] "("
75 [email protected] ")"
76 [email protected] " "
77 [email protected]
78 [email protected] "{"
79 [email protected] "}"
80 [email protected] "\n"
81 [email protected] "}"
82 [email protected] "\n\n"
83 [email protected]
84 [email protected] "impl"
85 [email protected] " "
86 [email protected]
87 [email protected]
88 [email protected]
89 [email protected]
90 [email protected] "T"
91 [email protected] " "
92 [email protected] "for"
93 [email protected] " "
94 [email protected]
95 [email protected]
96 [email protected]
97 [email protected]
98 [email protected] "Foo"
99 [email protected] " "
100 [email protected]
101 [email protected] "{"
102 [email protected] "\n "
103 [email protected]
104 [email protected] "default"
105 [email protected] " "
106 [email protected] "type"
107 [email protected] " "
108 [email protected]
109 [email protected] "T"
110 [email protected] " "
111 [email protected] "="
112 [email protected] " "
113 [email protected]
114 [email protected]
115 [email protected]
116 [email protected]
117 [email protected] "Bar"
118 [email protected] ";"
119 [email protected] "\n "
120 [email protected]
121 [email protected] "default"
122 [email protected] " "
123 [email protected] "const"
124 [email protected] " "
125 [email protected]
126 [email protected] "f"
127 [email protected] ":"
128 [email protected] " "
129 [email protected]
130 [email protected]
131 [email protected]
132 [email protected]
133 [email protected] "u8"
134 [email protected] " "
135 [email protected] "="
136 [email protected] " "
137 [email protected]
138 [email protected] "0"
139 [email protected] ";"
140 [email protected] "\n "
141 [email protected]
142 [email protected] "default"
143 [email protected] " "
144 [email protected] "fn"
145 [email protected] " "
146 [email protected]
147 [email protected] "foo"
148 [email protected]
149 [email protected] "("
150 [email protected] ")"
151 [email protected] " "
152 [email protected]
153 [email protected] "{"
154 [email protected] "}"
155 [email protected] "\n "
156 [email protected]
157 [email protected] "default"
158 [email protected] " "
159 [email protected] "unsafe"
160 [email protected] " "
161 [email protected] "fn"
162 [email protected] " "
163 [email protected]
164 [email protected] "bar"
165 [email protected]
166 [email protected] "("
167 [email protected] ")"
168 [email protected] " "
169 [email protected]
170 [email protected] "{"
171 [email protected] "}"
172 [email protected] "\n"
173 [email protected] "}"
174 [email protected] "\n\n"
175 [email protected]
176 [email protected] "default"
177 [email protected] " "
178 [email protected] "impl"
179 [email protected] " "
180 [email protected]
181 [email protected]
182 [email protected]
183 [email protected]
184 [email protected] "T"
185 [email protected] " "
186 [email protected] "for"
187 [email protected] " "
188 [email protected]
189 [email protected] "("
190 [email protected] ")"
191 [email protected] " "
192 [email protected]
193 [email protected] "{"
194 [email protected] "}"
195 [email protected] "\n"
196 [email protected]
197 [email protected] "default"
198 [email protected] " "
199 [email protected] "unsafe"
200 [email protected] " "
201 [email protected] "impl"
202 [email protected] " "
203 [email protected]
204 [email protected]
205 [email protected]
206 [email protected]
207 [email protected] "T"
208 [email protected] " "
209 [email protected] "for"
210 [email protected] " "
211 [email protected]
212 [email protected] "("
213 [email protected] ")"
214 [email protected] " "
215 [email protected]
216 [email protected] "{"
217 [email protected] "}"
218 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0066_default_modifier.rs b/crates/syntax/test_data/parser/ok/0066_default_modifier.rs
new file mode 100644
index 000000000..e443e3495
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0066_default_modifier.rs
@@ -0,0 +1,16 @@
1trait T {
2 default type T = Bar;
3 default const f: u8 = 0;
4 default fn foo() {}
5 default unsafe fn bar() {}
6}
7
8impl T for Foo {
9 default type T = Bar;
10 default const f: u8 = 0;
11 default fn foo() {}
12 default unsafe fn bar() {}
13}
14
15default impl T for () {}
16default unsafe impl T for () {}
diff --git a/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast b/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast
new file mode 100644
index 000000000..8f8639a37
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast
@@ -0,0 +1,392 @@
1[email protected]
2 [email protected]
3 [email protected] "fn"
4 [email protected] " "
5 [email protected]
6 [email protected] "for_trait"
7 [email protected]
8 [email protected] "<"
9 [email protected]
10 [email protected]
11 [email protected] "F"
12 [email protected] ">"
13 [email protected]
14 [email protected] "("
15 [email protected] ")"
16 [email protected] "\n"
17 [email protected]
18 [email protected] "where"
19 [email protected] "\n "
20 [email protected]
21 [email protected] "for"
22 [email protected]
23 [email protected] "<"
24 [email protected]
25 [email protected] "\'a"
26 [email protected] ">"
27 [email protected] " "
28 [email protected]
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected] "F"
33 [email protected] ":"
34 [email protected] " "
35 [email protected]
36 [email protected]
37 [email protected]
38 [email protected]
39 [email protected]
40 [email protected]
41 [email protected] "Fn"
42 [email protected]
43 [email protected] "("
44 [email protected]
45 [email protected]
46 [email protected] "&"
47 [email protected] "\'a"
48 [email protected] " "
49 [email protected]
50 [email protected]
51 [email protected]
52 [email protected]
53 [email protected] "str"
54 [email protected] ")"
55 [email protected] ","
56 [email protected] "\n"
57 [email protected]
58 [email protected] "{"
59 [email protected] "\n"
60 [email protected] "}"
61 [email protected] "\n"
62 [email protected]
63 [email protected] "fn"
64 [email protected] " "
65 [email protected]
66 [email protected] "for_ref"
67 [email protected]
68 [email protected] "<"
69 [email protected]
70 [email protected]
71 [email protected] "F"
72 [email protected] ">"
73 [email protected]
74 [email protected] "("
75 [email protected] ")"
76 [email protected] "\n"
77 [email protected]
78 [email protected] "where"
79 [email protected] "\n "
80 [email protected]
81 [email protected] "for"
82 [email protected]
83 [email protected] "<"
84 [email protected]
85 [email protected] "\'a"
86 [email protected] ">"
87 [email protected] " "
88 [email protected]
89 [email protected] "&"
90 [email protected] "\'a"
91 [email protected] " "
92 [email protected]
93 [email protected]
94 [email protected]
95 [email protected]
96 [email protected] "F"
97 [email protected] ":"
98 [email protected] " "
99 [email protected]
100 [email protected]
101 [email protected]
102 [email protected]
103 [email protected]
104 [email protected]
105 [email protected] "Debug"
106 [email protected] ","
107 [email protected] "\n"
108 [email protected]
109 [email protected] "{"
110 [email protected] "\n"
111 [email protected] "}"
112 [email protected] "\n"
113 [email protected]
114 [email protected] "fn"
115 [email protected] " "
116 [email protected]
117 [email protected] "for_parens"
118 [email protected]
119 [email protected] "<"
120 [email protected]
121 [email protected]
122 [email protected] "F"
123 [email protected] ">"
124 [email protected]
125 [email protected] "("
126 [email protected] ")"
127 [email protected] "\n"
128 [email protected]
129 [email protected] "where"
130 [email protected] "\n "
131 [email protected]
132 [email protected] "for"
133 [email protected]
134 [email protected] "<"
135 [email protected]
136 [email protected] "\'a"
137 [email protected] ">"
138 [email protected] " "
139 [email protected]
140 [email protected] "("
141 [email protected]
142 [email protected] "&"
143 [email protected] "\'a"
144 [email protected] " "
145 [email protected]
146 [email protected]
147 [email protected]
148 [email protected]
149 [email protected] "F"
150 [email protected] ")"
151 [email protected] ":"
152 [email protected] " "
153 [email protected]
154 [email protected]
155 [email protected]
156 [email protected]
157 [email protected]
158 [email protected]
159 [email protected] "Fn"
160 [email protected]
161 [email protected] "("
162 [email protected]
163 [email protected]
164 [email protected] "&"
165 [email protected] "\'a"
166 [email protected] " "
167 [email protected]
168 [email protected]
169 [email protected]
170 [email protected]
171 [email protected] "str"
172 [email protected] ")"
173 [email protected] ","
174 [email protected] "\n"
175 [email protected]
176 [email protected] "{"
177 [email protected] "\n"
178 [email protected] "}"
179 [email protected] "\n"
180 [email protected]
181 [email protected] "fn"
182 [email protected] " "
183 [email protected]
184 [email protected] "for_slice"
185 [email protected]
186 [email protected] "<"
187 [email protected]
188 [email protected]
189 [email protected] "F"
190 [email protected] ">"
191 [email protected]
192 [email protected] "("
193 [email protected] ")"
194 [email protected] "\n"
195 [email protected]
196 [email protected] "where"
197 [email protected] "\n "
198 [email protected]
199 [email protected] "for"
200 [email protected]
201 [email protected] "<"
202 [email protected]
203 [email protected] "\'a"
204 [email protected] ">"
205 [email protected] " "
206 [email protected]
207 [email protected] "["
208 [email protected]
209 [email protected] "&"
210 [email protected] "\'a"
211 [email protected] " "
212 [email protected]
213 [email protected]
214 [email protected]
215 [email protected]
216 [email protected] "F"
217 [email protected] "]"
218 [email protected] ":"
219 [email protected] " "
220 [email protected]
221 [email protected]
222 [email protected]
223 [email protected]
224 [email protected]
225 [email protected]
226 [email protected] "Eq"
227 [email protected] ","
228 [email protected] "\n"
229 [email protected]
230 [email protected] "{"
231 [email protected] "\n"
232 [email protected] "}"
233 [email protected] "\n"
234 [email protected]
235 [email protected] "fn"
236 [email protected] " "
237 [email protected]
238 [email protected] "for_qpath"
239 [email protected]
240 [email protected] "<"
241 [email protected]
242 [email protected]
243 [email protected] "T"
244 [email protected] ">"
245 [email protected]
246 [email protected] "("
247 [email protected]
248 [email protected]
249 [email protected]
250 [email protected] "_t"
251 [email protected] ":"
252 [email protected] " "
253 [email protected]
254 [email protected] "&"
255 [email protected]
256 [email protected]
257 [email protected]
258 [email protected]
259 [email protected] "T"
260 [email protected] ")"
261 [email protected] "\n"
262 [email protected]
263 [email protected] "where"
264 [email protected] "\n "
265 [email protected]
266 [email protected] "for"
267 [email protected]
268 [email protected] "<"
269 [email protected]
270 [email protected] "\'a"
271 [email protected] ">"
272 [email protected] " "
273 [email protected]
274 [email protected]
275 [email protected]
276 [email protected]
277 [email protected] "<"
278 [email protected]
279 [email protected] "&"
280 [email protected] "\'a"
281 [email protected] " "
282 [email protected]
283 [email protected]
284 [email protected]
285 [email protected]
286 [email protected] "T"
287 [email protected] " "
288 [email protected] "as"
289 [email protected] " "
290 [email protected]
291 [email protected]
292 [email protected]
293 [email protected]
294 [email protected] "Baz"
295 [email protected] ">"
296 [email protected] "::"
297 [email protected]
298 [email protected]
299 [email protected] "Foo"
300 [email protected] ":"
301 [email protected] " "
302 [email protected]
303 [email protected]
304 [email protected]
305 [email protected]
306 [email protected]
307 [email protected]
308 [email protected] "Iterator"
309 [email protected] ","
310 [email protected] "\n"
311 [email protected]
312 [email protected] "{"
313 [email protected] "\n"
314 [email protected] "}"
315 [email protected] "\n"
316 [email protected]
317 [email protected] "fn"
318 [email protected] " "
319 [email protected]
320 [email protected] "for_for_fn"
321 [email protected]
322 [email protected] "<"
323 [email protected]
324 [email protected]
325 [email protected] "T"
326 [email protected] ">"
327 [email protected]
328 [email protected] "("
329 [email protected] ")"
330 [email protected] "\n"
331 [email protected]
332 [email protected] "where"
333 [email protected] "\n "
334 [email protected]
335 [email protected] "for"
336 [email protected]
337 [email protected] "<"
338 [email protected]
339 [email protected] "\'a"
340 [email protected] ">"
341 [email protected] " "
342 [email protected]
343 [email protected] "for"
344 [email protected]
345 [email protected] "<"
346 [email protected]
347 [email protected] "\'b"
348 [email protected] ">"
349 [email protected] " "
350 [email protected]
351 [email protected] "fn"
352 [email protected]
353 [email protected] "("
354 [email protected]
355 [email protected]
356 [email protected] "&"
357 [email protected] "\'a"
358 [email protected] " "
359 [email protected]
360 [email protected]
361 [email protected]
362 [email protected]
363 [email protected] "T"
364 [email protected] ","
365 [email protected] " "
366 [email protected]
367 [email protected]
368 [email protected] "&"
369 [email protected] "\'b"
370 [email protected] " "
371 [email protected]
372 [email protected]
373 [email protected]
374 [email protected]
375 [email protected] "T"
376 [email protected] ")"
377 [email protected] ":"
378 [email protected] " "
379 [email protected]
380 [email protected]
381 [email protected]
382 [email protected]
383 [email protected]
384 [email protected]
385 [email protected] "Copy"
386 [email protected] ","
387 [email protected] "\n"
388 [email protected]
389 [email protected] "{"
390 [email protected] "\n"
391 [email protected] "}"
392 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0067_where_for_pred.rs b/crates/syntax/test_data/parser/ok/0067_where_for_pred.rs
new file mode 100644
index 000000000..9058c4619
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0067_where_for_pred.rs
@@ -0,0 +1,30 @@
1fn for_trait<F>()
2where
3 for<'a> F: Fn(&'a str),
4{
5}
6fn for_ref<F>()
7where
8 for<'a> &'a F: Debug,
9{
10}
11fn for_parens<F>()
12where
13 for<'a> (&'a F): Fn(&'a str),
14{
15}
16fn for_slice<F>()
17where
18 for<'a> [&'a F]: Eq,
19{
20}
21fn for_qpath<T>(_t: &T)
22where
23 for<'a> <&'a T as Baz>::Foo: Iterator,
24{
25}
26fn for_for_fn<T>()
27where
28 for<'a> for<'b> fn(&'a T, &'b T): Copy,
29{
30}
diff --git a/crates/syntax/test_data/parser/ok/0068_item_modifiers.rast b/crates/syntax/test_data/parser/ok/0068_item_modifiers.rast
new file mode 100644
index 000000000..50a6d8ee9
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0068_item_modifiers.rast
@@ -0,0 +1,218 @@
1[email protected]
2 [email protected]
3 [email protected] "async"
4 [email protected] " "
5 [email protected] "fn"
6 [email protected] " "
7 [email protected]
8 [email protected] "foo"
9 [email protected]
10 [email protected] "("
11 [email protected] ")"
12 [email protected] " "
13 [email protected]
14 [email protected] "{"
15 [email protected] "}"
16 [email protected] "\n"
17 [email protected]
18 [email protected]
19 [email protected] "extern"
20 [email protected] " "
21 [email protected] "fn"
22 [email protected] " "
23 [email protected]
24 [email protected] "foo"
25 [email protected]
26 [email protected] "("
27 [email protected] ")"
28 [email protected] " "
29 [email protected]
30 [email protected] "{"
31 [email protected] "}"
32 [email protected] "\n"
33 [email protected]
34 [email protected] "const"
35 [email protected] " "
36 [email protected] "fn"
37 [email protected] " "
38 [email protected]
39 [email protected] "foo"
40 [email protected]
41 [email protected] "("
42 [email protected] ")"
43 [email protected] " "
44 [email protected]
45 [email protected] "{"
46 [email protected] "}"
47 [email protected] "\n"
48 [email protected]
49 [email protected] "const"
50 [email protected] " "
51 [email protected] "unsafe"
52 [email protected] " "
53 [email protected] "fn"
54 [email protected] " "
55 [email protected]
56 [email protected] "foo"
57 [email protected]
58 [email protected] "("
59 [email protected] ")"
60 [email protected] " "
61 [email protected]
62 [email protected] "{"
63 [email protected] "}"
64 [email protected] "\n"
65 [email protected]
66 [email protected] "unsafe"
67 [email protected] " "
68 [email protected]
69 [email protected] "extern"
70 [email protected] " "
71 [email protected] "\"C\""
72 [email protected] " "
73 [email protected] "fn"
74 [email protected] " "
75 [email protected]
76 [email protected] "foo"
77 [email protected]
78 [email protected] "("
79 [email protected] ")"
80 [email protected] " "
81 [email protected]
82 [email protected] "{"
83 [email protected] "}"
84 [email protected] "\n"
85 [email protected]
86 [email protected] "unsafe"
87 [email protected] " "
88 [email protected] "fn"
89 [email protected] " "
90 [email protected]
91 [email protected] "foo"
92 [email protected]
93 [email protected] "("
94 [email protected] ")"
95 [email protected] " "
96 [email protected]
97 [email protected] "{"
98 [email protected] "}"
99 [email protected] "\n"
100 [email protected]
101 [email protected] "async"
102 [email protected] " "
103 [email protected] "unsafe"
104 [email protected] " "
105 [email protected] "fn"
106 [email protected] " "
107 [email protected]
108 [email protected] "foo"
109 [email protected]
110 [email protected] "("
111 [email protected] ")"
112 [email protected] " "
113 [email protected]
114 [email protected] "{"
115 [email protected] "}"
116 [email protected] "\n"
117 [email protected]
118 [email protected] "const"
119 [email protected] " "
120 [email protected] "unsafe"
121 [email protected] " "
122 [email protected] "fn"
123 [email protected] " "
124 [email protected]
125 [email protected] "bar"
126 [email protected]
127 [email protected] "("
128 [email protected] ")"
129 [email protected] " "
130 [email protected]
131 [email protected] "{"
132 [email protected] "}"
133 [email protected] "\n\n"
134 [email protected]
135 [email protected] "unsafe"
136 [email protected] " "
137 [email protected] "trait"
138 [email protected] " "
139 [email protected]
140 [email protected] "T"
141 [email protected] " "
142 [email protected]
143 [email protected] "{"
144 [email protected] "}"
145 [email protected] "\n"
146 [email protected]
147 [email protected] "auto"
148 [email protected] " "
149 [email protected] "trait"
150 [email protected] " "
151 [email protected]
152 [email protected] "T"
153 [email protected] " "
154 [email protected]
155 [email protected] "{"
156 [email protected] "}"
157 [email protected] "\n"
158 [email protected]
159 [email protected] "unsafe"
160 [email protected] " "
161 [email protected] "auto"
162 [email protected] " "
163 [email protected] "trait"
164 [email protected] " "
165 [email protected]
166 [email protected] "T"
167 [email protected] " "
168 [email protected]
169 [email protected] "{"
170 [email protected] "}"
171 [email protected] "\n\n"
172 [email protected]
173 [email protected] "unsafe"
174 [email protected] " "
175 [email protected] "impl"
176 [email protected] " "
177 [email protected]
178 [email protected]
179 [email protected]
180 [email protected]
181 [email protected] "Foo"
182 [email protected] " "
183 [email protected]
184 [email protected] "{"
185 [email protected] "}"
186 [email protected] "\n"
187 [email protected]
188 [email protected] "default"
189 [email protected] " "
190 [email protected] "impl"
191 [email protected] " "
192 [email protected]
193 [email protected]
194 [email protected]
195 [email protected]
196 [email protected] "Foo"
197 [email protected] " "
198 [email protected]
199 [email protected] "{"
200 [email protected] "}"
201 [email protected] "\n"
202 [email protected]
203 [email protected] "unsafe"
204 [email protected] " "
205 [email protected] "default"
206 [email protected] " "
207 [email protected] "impl"
208 [email protected] " "
209 [email protected]
210 [email protected]
211 [email protected]
212 [email protected]
213 [email protected] "Foo"
214 [email protected] " "
215 [email protected]
216 [email protected] "{"
217 [email protected] "}"
218 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0068_item_modifiers.rs b/crates/syntax/test_data/parser/ok/0068_item_modifiers.rs
new file mode 100644
index 000000000..8d697c04b
--- /dev/null
+++ b/crates/syntax/test_data/parser/ok/0068_item_modifiers.rs
@@ -0,0 +1,16 @@
1async fn foo() {}
2extern fn foo() {}
3const fn foo() {}
4const unsafe fn foo() {}
5unsafe extern "C" fn foo() {}
6unsafe fn foo() {}
7async unsafe fn foo() {}
8const unsafe fn bar() {}
9
10unsafe trait T {}
11auto trait T {}
12unsafe auto trait T {}
13
14unsafe impl Foo {}
15default impl Foo {}
16unsafe default impl Foo {}
diff --git a/crates/syntax/test_data/reparse/fuzz-failures/0000.rs b/crates/syntax/test_data/reparse/fuzz-failures/0000.rs
new file mode 100644
index 000000000..388eb74ed
--- /dev/null
+++ b/crates/syntax/test_data/reparse/fuzz-failures/0000.rs
@@ -0,0 +1,6 @@
10
21
3
4
5
60 \ No newline at end of file
diff --git a/crates/syntax/test_data/reparse/fuzz-failures/0001.rs b/crates/syntax/test_data/reparse/fuzz-failures/0001.rs
new file mode 100644
index 000000000..d2d42c6f9
--- /dev/null
+++ b/crates/syntax/test_data/reparse/fuzz-failures/0001.rs
@@ -0,0 +1,4 @@
10
21
3
4bb" \ No newline at end of file
diff --git a/crates/syntax/test_data/reparse/fuzz-failures/0002.rs b/crates/syntax/test_data/reparse/fuzz-failures/0002.rs
new file mode 100644
index 000000000..3fbee1548
--- /dev/null
+++ b/crates/syntax/test_data/reparse/fuzz-failures/0002.rs
@@ -0,0 +1,4 @@
11
21
3
4""! \ No newline at end of file
diff --git a/crates/syntax/test_data/reparse/fuzz-failures/0003.rs b/crates/syntax/test_data/reparse/fuzz-failures/0003.rs
new file mode 100644
index 000000000..d2757cd08
--- /dev/null
+++ b/crates/syntax/test_data/reparse/fuzz-failures/0003.rs
Binary files differ
diff --git a/crates/syntax/test_data/reparse/fuzz-failures/0004.rs b/crates/syntax/test_data/reparse/fuzz-failures/0004.rs
new file mode 100644
index 000000000..481617a70
--- /dev/null
+++ b/crates/syntax/test_data/reparse/fuzz-failures/0004.rs
@@ -0,0 +1,4 @@
10
20
3}
4{; \ No newline at end of file
diff --git a/crates/syntax/test_data/reparse/fuzz-failures/0005.rs b/crates/syntax/test_data/reparse/fuzz-failures/0005.rs
new file mode 100644
index 000000000..074d761c7
--- /dev/null
+++ b/crates/syntax/test_data/reparse/fuzz-failures/0005.rs
@@ -0,0 +1,7 @@
105
21
3
4
5
6b'
7 \ No newline at end of file