aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/doc_tests/generated.rs2
-rw-r--r--crates/ra_assists/src/handlers/add_explicit_type.rs4
-rw-r--r--crates/ra_assists/src/handlers/add_impl.rs2
-rw-r--r--crates/ra_assists/src/handlers/add_missing_impl_members.rs34
-rw-r--r--crates/ra_assists/src/handlers/add_new.rs3
-rw-r--r--crates/ra_assists/src/handlers/introduce_variable.rs2
-rw-r--r--crates/ra_assists/src/handlers/merge_imports.rs4
-rw-r--r--crates/ra_assists/src/handlers/move_bounds.rs3
-rw-r--r--crates/ra_hir/src/source_analyzer.rs38
-rw-r--r--crates/ra_hir_def/src/adt.rs20
-rw-r--r--crates/ra_hir_def/src/attr.rs1
-rw-r--r--crates/ra_hir_def/src/body.rs72
-rw-r--r--crates/ra_hir_def/src/body/lower.rs58
-rw-r--r--crates/ra_hir_def/src/data.rs37
-rw-r--r--crates/ra_hir_def/src/diagnostics.rs2
-rw-r--r--crates/ra_hir_def/src/expr.rs33
-rw-r--r--crates/ra_hir_def/src/lang_item.rs5
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs14
-rw-r--r--crates/ra_hir_def/src/nameres/raw.rs2
-rw-r--r--crates/ra_hir_def/src/nameres/tests/incremental.rs6
-rw-r--r--crates/ra_hir_def/src/path.rs5
-rw-r--r--crates/ra_hir_expand/src/ast_id_map.rs2
-rw-r--r--crates/ra_hir_ty/Cargo.toml2
-rw-r--r--crates/ra_hir_ty/src/db.rs9
-rw-r--r--crates/ra_hir_ty/src/diagnostics.rs31
-rw-r--r--crates/ra_hir_ty/src/display.rs26
-rw-r--r--crates/ra_hir_ty/src/expr.rs137
-rw-r--r--crates/ra_hir_ty/src/infer/pat.rs2
-rw-r--r--crates/ra_hir_ty/src/method_resolution.rs45
-rw-r--r--crates/ra_hir_ty/src/tests.rs46
-rw-r--r--crates/ra_hir_ty/src/tests/macros.rs31
-rw-r--r--crates/ra_hir_ty/src/traits.rs27
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs92
-rw-r--r--crates/ra_hir_ty/src/traits/chalk/tls.rs231
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs4
-rw-r--r--crates/ra_ide/src/completion/complete_unqualified_path.rs2
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs2
-rw-r--r--crates/ra_ide/src/inlay_hints.rs17
-rw-r--r--crates/ra_ide/src/syntax_tree.rs8
-rw-r--r--crates/ra_ide/src/typing.rs2
-rw-r--r--crates/ra_ide_db/src/defs.rs2
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs36
-rw-r--r--crates/ra_mbe/src/tests.rs20
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs40
-rw-r--r--crates/ra_parser/src/grammar/types.rs15
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs328
-rw-r--r--crates/ra_proc_macro_srv/Cargo.toml5
-rw-r--r--crates/ra_proc_macro_srv/src/dylib.rs211
-rw-r--r--crates/ra_proc_macro_srv/src/lib.rs36
-rw-r--r--crates/ra_proc_macro_srv/src/rustc_server.rs4
-rw-r--r--crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt188
-rw-r--r--crates/ra_proc_macro_srv/src/tests/mod.rs47
-rw-r--r--crates/ra_proc_macro_srv/src/tests/utils.rs65
-rw-r--r--crates/ra_prof/src/lib.rs15
-rw-r--r--crates/ra_syntax/src/ast.rs8
-rw-r--r--crates/ra_syntax/src/ast/edit.rs14
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs98
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs553
-rw-r--r--crates/ra_syntax/src/ast/generated/tokens.rs1829
-rw-r--r--crates/ra_syntax/src/ast/make.rs3
-rw-r--r--crates/ra_syntax/src/ast/traits.rs5
-rw-r--r--crates/ra_syntax/src/lib.rs5
-rw-r--r--crates/ra_syntax/src/parsing/lexer.rs77
-rw-r--r--crates/ra_syntax/src/ptr.rs17
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt6
-rw-r--r--crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0019_let_recover.rast14
-rw-r--r--crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast24
-rw-r--r--crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast20
-rw-r--r--crates/ra_syntax/test_data/parser/err/0025_nope.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/err/0035_use_recover.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/err/0036_partial_use.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast49
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0002_use_tree_list.rast34
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast16
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0020_use_star.rast20
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast30
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast14
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast16
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0060_extern_crate.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast14
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0067_crate_path.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast20
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast14
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0110_use_path.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast28
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast18
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast82
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0006_inner_attributes.rast20
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0009_use_item.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0010_use_path_segments.rast14
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0011_outer_attribute.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0012_visibility.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0013_use_path_self_super.rast20
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0014_use_tree.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0015_use_tree.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast28
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast24
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0023_static_items.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0024_const_item.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast22
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast36
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0030_traits.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0031_extern.rast120
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0032_where_for.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0033_label_break.rast16
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0034_crate_path_in_call.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast432
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0046_extern_inner_attributes.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0049_async_block.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0058_unary_expr_precedence.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0060_as_range.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0061_match_full_range.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast12
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs12
-rw-r--r--crates/rust-analyzer/src/cli/load_cargo.rs4
-rw-r--r--crates/rust-analyzer/src/world.rs4
-rw-r--r--crates/stdx/src/lib.rs16
267 files changed, 2962 insertions, 3830 deletions
diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs
index 6dc049715..b63b4d81a 100644
--- a/crates/ra_assists/src/doc_tests/generated.rs
+++ b/crates/ra_assists/src/doc_tests/generated.rs
@@ -180,7 +180,7 @@ trait Trait<T> {
180} 180}
181 181
182impl Trait<u32> for () { 182impl Trait<u32> for () {
183 fn foo(&self) -> u32 { unimplemented!() } 183 fn foo(&self) -> u32 { todo!() }
184 184
185} 185}
186"#####, 186"#####,
diff --git a/crates/ra_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs
index e7dcfb44e..d86d804b2 100644
--- a/crates/ra_assists/src/handlers/add_explicit_type.rs
+++ b/crates/ra_assists/src/handlers/add_explicit_type.rs
@@ -1,6 +1,6 @@
1use hir::HirDisplay; 1use hir::HirDisplay;
2use ra_syntax::{ 2use ra_syntax::{
3 ast::{self, AstNode, AstToken, LetStmt, NameOwner, TypeAscriptionOwner}, 3 ast::{self, AstNode, LetStmt, NameOwner, TypeAscriptionOwner},
4 TextRange, 4 TextRange,
5}; 5};
6 6
@@ -35,7 +35,7 @@ pub(crate) fn add_explicit_type(ctx: AssistCtx) -> Option<Assist> {
35 let name = pat.name()?; 35 let name = pat.name()?;
36 let name_range = name.syntax().text_range(); 36 let name_range = name.syntax().text_range();
37 let stmt_range = stmt.syntax().text_range(); 37 let stmt_range = stmt.syntax().text_range();
38 let eq_range = stmt.eq_token()?.syntax().text_range(); 38 let eq_range = stmt.eq_token()?.text_range();
39 // Assist should only be applicable if cursor is between 'let' and '=' 39 // Assist should only be applicable if cursor is between 'let' and '='
40 let let_range = TextRange::from_to(stmt_range.start(), eq_range.start()); 40 let let_range = TextRange::from_to(stmt_range.start(), eq_range.start());
41 let cursor_in_range = ctx.frange.range.is_subrange(&let_range); 41 let cursor_in_range = ctx.frange.range.is_subrange(&let_range);
diff --git a/crates/ra_assists/src/handlers/add_impl.rs b/crates/ra_assists/src/handlers/add_impl.rs
index 26dfed237..6622eadb2 100644
--- a/crates/ra_assists/src/handlers/add_impl.rs
+++ b/crates/ra_assists/src/handlers/add_impl.rs
@@ -1,5 +1,5 @@
1use ra_syntax::{ 1use ra_syntax::{
2 ast::{self, AstNode, AstToken, NameOwner, TypeParamsOwner}, 2 ast::{self, AstNode, NameOwner, TypeParamsOwner},
3 TextUnit, 3 TextUnit,
4}; 4};
5use stdx::{format_to, SepBy}; 5use stdx::{format_to, SepBy};
diff --git a/crates/ra_assists/src/handlers/add_missing_impl_members.rs b/crates/ra_assists/src/handlers/add_missing_impl_members.rs
index 722f207e2..2d6d44980 100644
--- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs
+++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs
@@ -40,7 +40,7 @@ enum AddMissingImplMembersMode {
40// } 40// }
41// 41//
42// impl Trait<u32> for () { 42// impl Trait<u32> for () {
43// fn foo(&self) -> u32 { unimplemented!() } 43// fn foo(&self) -> u32 { todo!() }
44// 44//
45// } 45// }
46// ``` 46// ```
@@ -165,7 +165,7 @@ fn add_missing_impl_members_inner(
165 165
166fn add_body(fn_def: ast::FnDef) -> ast::FnDef { 166fn add_body(fn_def: ast::FnDef) -> ast::FnDef {
167 if fn_def.body().is_none() { 167 if fn_def.body().is_none() {
168 fn_def.with_body(make::block_from_expr(make::expr_unimplemented())) 168 fn_def.with_body(make::block_from_expr(make::expr_todo()))
169 } else { 169 } else {
170 fn_def 170 fn_def
171 } 171 }
@@ -215,8 +215,8 @@ impl Foo for S {
215 fn bar(&self) {} 215 fn bar(&self) {}
216 <|>type Output; 216 <|>type Output;
217 const CONST: usize = 42; 217 const CONST: usize = 42;
218 fn foo(&self) { unimplemented!() } 218 fn foo(&self) { todo!() }
219 fn baz(&self) { unimplemented!() } 219 fn baz(&self) { todo!() }
220 220
221}", 221}",
222 ); 222 );
@@ -250,7 +250,7 @@ struct S;
250 250
251impl Foo for S { 251impl Foo for S {
252 fn bar(&self) {} 252 fn bar(&self) {}
253 <|>fn foo(&self) { unimplemented!() } 253 <|>fn foo(&self) { todo!() }
254 254
255}", 255}",
256 ); 256 );
@@ -268,7 +268,7 @@ impl Foo for S { <|> }",
268trait Foo { fn foo(&self); } 268trait Foo { fn foo(&self); }
269struct S; 269struct S;
270impl Foo for S { 270impl Foo for S {
271 <|>fn foo(&self) { unimplemented!() } 271 <|>fn foo(&self) { todo!() }
272}", 272}",
273 ); 273 );
274 } 274 }
@@ -285,7 +285,7 @@ impl Foo<u32> for S { <|> }",
285trait Foo<T> { fn foo(&self, t: T) -> &T; } 285trait Foo<T> { fn foo(&self, t: T) -> &T; }
286struct S; 286struct S;
287impl Foo<u32> for S { 287impl Foo<u32> for S {
288 <|>fn foo(&self, t: u32) -> &u32 { unimplemented!() } 288 <|>fn foo(&self, t: u32) -> &u32 { todo!() }
289}", 289}",
290 ); 290 );
291 } 291 }
@@ -302,7 +302,7 @@ impl<U> Foo<U> for S { <|> }",
302trait Foo<T> { fn foo(&self, t: T) -> &T; } 302trait Foo<T> { fn foo(&self, t: T) -> &T; }
303struct S; 303struct S;
304impl<U> Foo<U> for S { 304impl<U> Foo<U> for S {
305 <|>fn foo(&self, t: U) -> &U { unimplemented!() } 305 <|>fn foo(&self, t: U) -> &U { todo!() }
306}", 306}",
307 ); 307 );
308 } 308 }
@@ -319,7 +319,7 @@ impl Foo for S {}<|>",
319trait Foo { fn foo(&self); } 319trait Foo { fn foo(&self); }
320struct S; 320struct S;
321impl Foo for S { 321impl Foo for S {
322 <|>fn foo(&self) { unimplemented!() } 322 <|>fn foo(&self) { todo!() }
323}", 323}",
324 ) 324 )
325 } 325 }
@@ -342,7 +342,7 @@ mod foo {
342} 342}
343struct S; 343struct S;
344impl foo::Foo for S { 344impl foo::Foo for S {
345 <|>fn foo(&self, bar: foo::Bar) { unimplemented!() } 345 <|>fn foo(&self, bar: foo::Bar) { todo!() }
346}", 346}",
347 ); 347 );
348 } 348 }
@@ -365,7 +365,7 @@ mod foo {
365} 365}
366struct S; 366struct S;
367impl foo::Foo for S { 367impl foo::Foo for S {
368 <|>fn foo(&self, bar: foo::Bar<u32>) { unimplemented!() } 368 <|>fn foo(&self, bar: foo::Bar<u32>) { todo!() }
369}", 369}",
370 ); 370 );
371 } 371 }
@@ -388,7 +388,7 @@ mod foo {
388} 388}
389struct S; 389struct S;
390impl foo::Foo<u32> for S { 390impl foo::Foo<u32> for S {
391 <|>fn foo(&self, bar: foo::Bar<u32>) { unimplemented!() } 391 <|>fn foo(&self, bar: foo::Bar<u32>) { todo!() }
392}", 392}",
393 ); 393 );
394 } 394 }
@@ -414,7 +414,7 @@ mod foo {
414struct Param; 414struct Param;
415struct S; 415struct S;
416impl foo::Foo<Param> for S { 416impl foo::Foo<Param> for S {
417 <|>fn foo(&self, bar: Param) { unimplemented!() } 417 <|>fn foo(&self, bar: Param) { todo!() }
418}", 418}",
419 ); 419 );
420 } 420 }
@@ -439,7 +439,7 @@ mod foo {
439} 439}
440struct S; 440struct S;
441impl foo::Foo for S { 441impl foo::Foo for S {
442 <|>fn foo(&self, bar: foo::Bar<u32>::Assoc) { unimplemented!() } 442 <|>fn foo(&self, bar: foo::Bar<u32>::Assoc) { todo!() }
443}", 443}",
444 ); 444 );
445 } 445 }
@@ -464,7 +464,7 @@ mod foo {
464} 464}
465struct S; 465struct S;
466impl foo::Foo for S { 466impl foo::Foo for S {
467 <|>fn foo(&self, bar: foo::Bar<foo::Baz>) { unimplemented!() } 467 <|>fn foo(&self, bar: foo::Bar<foo::Baz>) { todo!() }
468}", 468}",
469 ); 469 );
470 } 470 }
@@ -487,7 +487,7 @@ mod foo {
487} 487}
488struct S; 488struct S;
489impl foo::Foo for S { 489impl foo::Foo for S {
490 <|>fn foo(&self, bar: dyn Fn(u32) -> i32) { unimplemented!() } 490 <|>fn foo(&self, bar: dyn Fn(u32) -> i32) { todo!() }
491}", 491}",
492 ); 492 );
493 } 493 }
@@ -544,7 +544,7 @@ trait Foo {
544struct S; 544struct S;
545impl Foo for S { 545impl Foo for S {
546 <|>type Output; 546 <|>type Output;
547 fn foo(&self) { unimplemented!() } 547 fn foo(&self) { todo!() }
548}"#, 548}"#,
549 ) 549 )
550 } 550 }
diff --git a/crates/ra_assists/src/handlers/add_new.rs b/crates/ra_assists/src/handlers/add_new.rs
index 30360af94..240b19fa3 100644
--- a/crates/ra_assists/src/handlers/add_new.rs
+++ b/crates/ra_assists/src/handlers/add_new.rs
@@ -1,8 +1,7 @@
1use hir::Adt; 1use hir::Adt;
2use ra_syntax::{ 2use ra_syntax::{
3 ast::{ 3 ast::{
4 self, AstNode, AstToken, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, 4 self, AstNode, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, VisibilityOwner,
5 VisibilityOwner,
6 }, 5 },
7 TextUnit, T, 6 TextUnit, T,
8}; 7};
diff --git a/crates/ra_assists/src/handlers/introduce_variable.rs b/crates/ra_assists/src/handlers/introduce_variable.rs
index ab6bdf6bb..8d0f7e922 100644
--- a/crates/ra_assists/src/handlers/introduce_variable.rs
+++ b/crates/ra_assists/src/handlers/introduce_variable.rs
@@ -61,7 +61,7 @@ pub(crate) fn introduce_variable(ctx: AssistCtx) -> Option<Assist> {
61 }; 61 };
62 if is_full_stmt { 62 if is_full_stmt {
63 tested_by!(test_introduce_var_expr_stmt); 63 tested_by!(test_introduce_var_expr_stmt);
64 if full_stmt.unwrap().semi_token().is_none() { 64 if full_stmt.unwrap().semicolon_token().is_none() {
65 buf.push_str(";"); 65 buf.push_str(";");
66 } 66 }
67 edit.replace(expr.syntax().text_range(), buf); 67 edit.replace(expr.syntax().text_range(), buf);
diff --git a/crates/ra_assists/src/handlers/merge_imports.rs b/crates/ra_assists/src/handlers/merge_imports.rs
index 936d50ab4..0958f52f1 100644
--- a/crates/ra_assists/src/handlers/merge_imports.rs
+++ b/crates/ra_assists/src/handlers/merge_imports.rs
@@ -3,7 +3,7 @@ use std::iter::successors;
3use ra_syntax::{ 3use ra_syntax::{
4 algo::{neighbor, SyntaxRewriter}, 4 algo::{neighbor, SyntaxRewriter},
5 ast::{self, edit::AstNodeEdit, make}, 5 ast::{self, edit::AstNodeEdit, make},
6 AstNode, AstToken, Direction, InsertPosition, SyntaxElement, T, 6 AstNode, Direction, InsertPosition, SyntaxElement, T,
7}; 7};
8 8
9use crate::{Assist, AssistCtx, AssistId}; 9use crate::{Assist, AssistCtx, AssistId};
@@ -82,7 +82,7 @@ fn try_merge_trees(old: &ast::UseTree, new: &ast::UseTree) -> Option<ast::UseTre
82 .filter(|it| it.kind() != T!['{'] && it.kind() != T!['}']), 82 .filter(|it| it.kind() != T!['{'] && it.kind() != T!['}']),
83 ); 83 );
84 let use_tree_list = lhs.use_tree_list()?; 84 let use_tree_list = lhs.use_tree_list()?;
85 let pos = InsertPosition::Before(use_tree_list.r_curly_token()?.syntax().clone().into()); 85 let pos = InsertPosition::Before(use_tree_list.r_curly_token()?.into());
86 let use_tree_list = use_tree_list.insert_children(pos, to_insert); 86 let use_tree_list = use_tree_list.insert_children(pos, to_insert);
87 Some(lhs.with_use_tree_list(use_tree_list)) 87 Some(lhs.with_use_tree_list(use_tree_list))
88} 88}
diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs
index 93f26f51a..0f26884dc 100644
--- a/crates/ra_assists/src/handlers/move_bounds.rs
+++ b/crates/ra_assists/src/handlers/move_bounds.rs
@@ -2,6 +2,7 @@ use ra_syntax::{
2 ast::{self, edit::AstNodeEdit, make, AstNode, NameOwner, TypeBoundsOwner}, 2 ast::{self, edit::AstNodeEdit, make, AstNode, NameOwner, TypeBoundsOwner},
3 match_ast, 3 match_ast,
4 SyntaxKind::*, 4 SyntaxKind::*,
5 T,
5}; 6};
6 7
7use crate::{Assist, AssistCtx, AssistId}; 8use crate::{Assist, AssistCtx, AssistId};
@@ -42,7 +43,7 @@ pub(crate) fn move_bounds_to_where_clause(ctx: AssistCtx) -> Option<Assist> {
42 ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), 43 ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(),
43 ast::StructDef(it) => { 44 ast::StructDef(it) => {
44 it.syntax().children_with_tokens() 45 it.syntax().children_with_tokens()
45 .find(|it| it.kind() == RECORD_FIELD_DEF_LIST || it.kind() == SEMI)? 46 .find(|it| it.kind() == RECORD_FIELD_DEF_LIST || it.kind() == T![;])?
46 }, 47 },
47 _ => return None 48 _ => return None
48 } 49 }
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs
index 45631f8fd..58ae6ce41 100644
--- a/crates/ra_hir/src/source_analyzer.rs
+++ b/crates/ra_hir/src/source_analyzer.rs
@@ -139,7 +139,7 @@ impl SourceAnalyzer {
139 &self, 139 &self,
140 db: &dyn HirDatabase, 140 db: &dyn HirDatabase,
141 field: &ast::FieldExpr, 141 field: &ast::FieldExpr,
142 ) -> Option<crate::StructField> { 142 ) -> Option<StructField> {
143 let expr_id = self.expr_id(db, &field.clone().into())?; 143 let expr_id = self.expr_id(db, &field.clone().into())?;
144 self.infer.as_ref()?.field_resolution(expr_id).map(|it| it.into()) 144 self.infer.as_ref()?.field_resolution(expr_id).map(|it| it.into())
145 } 145 }
@@ -148,21 +148,19 @@ impl SourceAnalyzer {
148 &self, 148 &self,
149 db: &dyn HirDatabase, 149 db: &dyn HirDatabase,
150 field: &ast::RecordField, 150 field: &ast::RecordField,
151 ) -> Option<(crate::StructField, Option<Local>)> { 151 ) -> Option<(StructField, Option<Local>)> {
152 let (expr_id, local) = match field.expr() { 152 let expr = field.expr()?;
153 Some(it) => (self.expr_id(db, &it)?, None), 153 let expr_id = self.expr_id(db, &expr)?;
154 None => { 154 let local = if field.name_ref().is_some() {
155 let src = InFile { file_id: self.file_id, value: field }; 155 None
156 let expr_id = self.body_source_map.as_ref()?.field_init_shorthand_expr(src)?; 156 } else {
157 let local_name = field.name_ref()?.as_name(); 157 let local_name = field.field_name()?.as_name();
158 let path = ModPath::from_segments(PathKind::Plain, once(local_name)); 158 let path = ModPath::from_segments(PathKind::Plain, once(local_name));
159 let local = match self.resolver.resolve_path_in_value_ns_fully(db.upcast(), &path) { 159 match self.resolver.resolve_path_in_value_ns_fully(db.upcast(), &path) {
160 Some(ValueNs::LocalBinding(pat_id)) => { 160 Some(ValueNs::LocalBinding(pat_id)) => {
161 Some(Local { pat_id, parent: self.resolver.body_owner()? }) 161 Some(Local { pat_id, parent: self.resolver.body_owner()? })
162 } 162 }
163 _ => None, 163 _ => None,
164 };
165 (expr_id, local)
166 } 164 }
167 }; 165 };
168 let struct_field = self.infer.as_ref()?.record_field_resolution(expr_id)?; 166 let struct_field = self.infer.as_ref()?.record_field_resolution(expr_id)?;
@@ -255,7 +253,7 @@ impl SourceAnalyzer {
255 _ => return None, 253 _ => return None,
256 }; 254 };
257 255
258 let (variant, missing_fields) = 256 let (variant, missing_fields, _exhaustive) =
259 record_pattern_missing_fields(db, infer, pat_id, &body[pat_id])?; 257 record_pattern_missing_fields(db, infer, pat_id, &body[pat_id])?;
260 let res = self.missing_fields(db, krate, substs, variant, missing_fields); 258 let res = self.missing_fields(db, krate, substs, variant, missing_fields);
261 Some(res) 259 Some(res)
@@ -319,8 +317,7 @@ fn scope_for_offset(
319 if source.file_id != offset.file_id { 317 if source.file_id != offset.file_id {
320 return None; 318 return None;
321 } 319 }
322 let syntax_node_ptr = 320 let syntax_node_ptr = source.value.syntax_node_ptr();
323 source.value.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr());
324 Some((syntax_node_ptr, scope)) 321 Some((syntax_node_ptr, scope))
325 }) 322 })
326 // find containing scope 323 // find containing scope
@@ -399,8 +396,7 @@ fn adjust(
399 if source.file_id != file_id { 396 if source.file_id != file_id {
400 return None; 397 return None;
401 } 398 }
402 let syntax_node_ptr = 399 let syntax_node_ptr = source.value.syntax_node_ptr();
403 source.value.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr());
404 Some((syntax_node_ptr, scope)) 400 Some((syntax_node_ptr, scope))
405 }) 401 })
406 .map(|(ptr, scope)| (ptr.range(), scope)) 402 .map(|(ptr, scope)| (ptr.range(), scope))
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs
index be4b0accb..7c0d93691 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -4,7 +4,6 @@ use std::sync::Arc;
4 4
5use either::Either; 5use either::Either;
6use hir_expand::{ 6use hir_expand::{
7 hygiene::Hygiene,
8 name::{AsName, Name}, 7 name::{AsName, Name},
9 InFile, 8 InFile,
10}; 9};
@@ -13,7 +12,7 @@ use ra_prof::profile;
13use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner, VisibilityOwner}; 12use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner, VisibilityOwner};
14 13
15use crate::{ 14use crate::{
16 attr::Attrs, db::DefDatabase, src::HasChildSource, src::HasSource, trace::Trace, 15 body::CfgExpander, db::DefDatabase, src::HasChildSource, src::HasSource, trace::Trace,
17 type_ref::TypeRef, visibility::RawVisibility, EnumId, HasModule, LocalEnumVariantId, 16 type_ref::TypeRef, visibility::RawVisibility, EnumId, HasModule, LocalEnumVariantId,
18 LocalStructFieldId, Lookup, ModuleId, StructId, UnionId, VariantId, 17 LocalStructFieldId, Lookup, ModuleId, StructId, UnionId, VariantId,
19}; 18};
@@ -125,8 +124,9 @@ fn lower_enum(
125 124
126impl VariantData { 125impl VariantData {
127 fn new(db: &dyn DefDatabase, flavor: InFile<ast::StructKind>, module_id: ModuleId) -> Self { 126 fn new(db: &dyn DefDatabase, flavor: InFile<ast::StructKind>, module_id: ModuleId) -> Self {
127 let mut expander = CfgExpander::new(db, flavor.file_id, module_id.krate);
128 let mut trace = Trace::new_for_arena(); 128 let mut trace = Trace::new_for_arena();
129 match lower_struct(db, &mut trace, &flavor, module_id) { 129 match lower_struct(db, &mut expander, &mut trace, &flavor) {
130 StructKind::Tuple => VariantData::Tuple(trace.into_arena()), 130 StructKind::Tuple => VariantData::Tuple(trace.into_arena()),
131 StructKind::Record => VariantData::Record(trace.into_arena()), 131 StructKind::Record => VariantData::Record(trace.into_arena()),
132 StructKind::Unit => VariantData::Unit, 132 StructKind::Unit => VariantData::Unit,
@@ -178,8 +178,9 @@ impl HasChildSource for VariantId {
178 it.lookup(db).container.module(db), 178 it.lookup(db).container.module(db),
179 ), 179 ),
180 }; 180 };
181 let mut expander = CfgExpander::new(db, src.file_id, module_id.krate);
181 let mut trace = Trace::new_for_map(); 182 let mut trace = Trace::new_for_map();
182 lower_struct(db, &mut trace, &src, module_id); 183 lower_struct(db, &mut expander, &mut trace, &src);
183 src.with_value(trace.into_map()) 184 src.with_value(trace.into_map())
184 } 185 }
185} 186}
@@ -193,16 +194,15 @@ pub enum StructKind {
193 194
194fn lower_struct( 195fn lower_struct(
195 db: &dyn DefDatabase, 196 db: &dyn DefDatabase,
197 expander: &mut CfgExpander,
196 trace: &mut Trace<StructFieldData, Either<ast::TupleFieldDef, ast::RecordFieldDef>>, 198 trace: &mut Trace<StructFieldData, Either<ast::TupleFieldDef, ast::RecordFieldDef>>,
197 ast: &InFile<ast::StructKind>, 199 ast: &InFile<ast::StructKind>,
198 module_id: ModuleId,
199) -> StructKind { 200) -> StructKind {
200 let crate_graph = db.crate_graph();
201 match &ast.value { 201 match &ast.value {
202 ast::StructKind::Tuple(fl) => { 202 ast::StructKind::Tuple(fl) => {
203 for (i, fd) in fl.fields().enumerate() { 203 for (i, fd) in fl.fields().enumerate() {
204 let attrs = Attrs::new(&fd, &Hygiene::new(db.upcast(), ast.file_id)); 204 let attrs = expander.parse_attrs(&fd);
205 if !attrs.is_cfg_enabled(&crate_graph[module_id.krate].cfg_options) { 205 if !expander.is_cfg_enabled(&attrs) {
206 continue; 206 continue;
207 } 207 }
208 208
@@ -219,8 +219,8 @@ fn lower_struct(
219 } 219 }
220 ast::StructKind::Record(fl) => { 220 ast::StructKind::Record(fl) => {
221 for fd in fl.fields() { 221 for fd in fl.fields() {
222 let attrs = Attrs::new(&fd, &Hygiene::new(db.upcast(), ast.file_id)); 222 let attrs = expander.parse_attrs(&fd);
223 if !attrs.is_cfg_enabled(&crate_graph[module_id.krate].cfg_options) { 223 if !expander.is_cfg_enabled(&attrs) {
224 continue; 224 continue;
225 } 225 }
226 226
diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs
index 7b0c506b1..2f2e3e5ba 100644
--- a/crates/ra_hir_def/src/attr.rs
+++ b/crates/ra_hir_def/src/attr.rs
@@ -93,6 +93,7 @@ impl Attrs {
93 } 93 }
94 94
95 pub(crate) fn is_cfg_enabled(&self, cfg_options: &CfgOptions) -> bool { 95 pub(crate) fn is_cfg_enabled(&self, cfg_options: &CfgOptions) -> bool {
96 // FIXME: handle cfg_attr :-)
96 self.by_key("cfg").tt_values().all(|tt| cfg_options.is_cfg_enabled(tt) != Some(false)) 97 self.by_key("cfg").tt_values().all(|tt| cfg_options.is_cfg_enabled(tt) != Some(false))
97 } 98 }
98} 99}
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs
index 5f9d53ecb..eafaf48c1 100644
--- a/crates/ra_hir_def/src/body.rs
+++ b/crates/ra_hir_def/src/body.rs
@@ -9,11 +9,14 @@ use drop_bomb::DropBomb;
9use either::Either; 9use either::Either;
10use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; 10use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId};
11use ra_arena::{map::ArenaMap, Arena}; 11use ra_arena::{map::ArenaMap, Arena};
12use ra_cfg::CfgOptions;
13use ra_db::CrateId;
12use ra_prof::profile; 14use ra_prof::profile;
13use ra_syntax::{ast, AstNode, AstPtr}; 15use ra_syntax::{ast, AstNode, AstPtr};
14use rustc_hash::FxHashMap; 16use rustc_hash::FxHashMap;
15 17
16use crate::{ 18use crate::{
19 attr::Attrs,
17 db::DefDatabase, 20 db::DefDatabase,
18 expr::{Expr, ExprId, Pat, PatId}, 21 expr::{Expr, ExprId, Pat, PatId},
19 item_scope::BuiltinShadowMode, 22 item_scope::BuiltinShadowMode,
@@ -24,25 +27,59 @@ use crate::{
24 AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId, 27 AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId,
25}; 28};
26 29
30/// A subser of Exander that only deals with cfg attributes. We only need it to
31/// avoid cyclic queries in crate def map during enum processing.
32pub(crate) struct CfgExpander {
33 cfg_options: CfgOptions,
34 hygiene: Hygiene,
35}
36
27pub(crate) struct Expander { 37pub(crate) struct Expander {
38 cfg_expander: CfgExpander,
28 crate_def_map: Arc<CrateDefMap>, 39 crate_def_map: Arc<CrateDefMap>,
29 current_file_id: HirFileId, 40 current_file_id: HirFileId,
30 hygiene: Hygiene,
31 ast_id_map: Arc<AstIdMap>, 41 ast_id_map: Arc<AstIdMap>,
32 module: ModuleId, 42 module: ModuleId,
33 recursive_limit: usize, 43 recursive_limit: usize,
34} 44}
35 45
46impl CfgExpander {
47 pub(crate) fn new(
48 db: &dyn DefDatabase,
49 current_file_id: HirFileId,
50 krate: CrateId,
51 ) -> CfgExpander {
52 let hygiene = Hygiene::new(db.upcast(), current_file_id);
53 let cfg_options = db.crate_graph()[krate].cfg_options.clone();
54 CfgExpander { cfg_options, hygiene }
55 }
56
57 pub(crate) fn parse_attrs(&self, owner: &dyn ast::AttrsOwner) -> Attrs {
58 Attrs::new(owner, &self.hygiene)
59 }
60
61 pub(crate) fn is_cfg_enabled(&self, attrs: &Attrs) -> bool {
62 attrs.is_cfg_enabled(&self.cfg_options)
63 }
64}
65
36impl Expander { 66impl Expander {
37 pub(crate) fn new( 67 pub(crate) fn new(
38 db: &dyn DefDatabase, 68 db: &dyn DefDatabase,
39 current_file_id: HirFileId, 69 current_file_id: HirFileId,
40 module: ModuleId, 70 module: ModuleId,
41 ) -> Expander { 71 ) -> Expander {
72 let cfg_expander = CfgExpander::new(db, current_file_id, module.krate);
42 let crate_def_map = db.crate_def_map(module.krate); 73 let crate_def_map = db.crate_def_map(module.krate);
43 let hygiene = Hygiene::new(db.upcast(), current_file_id);
44 let ast_id_map = db.ast_id_map(current_file_id); 74 let ast_id_map = db.ast_id_map(current_file_id);
45 Expander { crate_def_map, current_file_id, hygiene, ast_id_map, module, recursive_limit: 0 } 75 Expander {
76 cfg_expander,
77 crate_def_map,
78 current_file_id,
79 ast_id_map,
80 module,
81 recursive_limit: 0,
82 }
46 } 83 }
47 84
48 pub(crate) fn enter_expand<T: ast::AstNode>( 85 pub(crate) fn enter_expand<T: ast::AstNode>(
@@ -75,7 +112,7 @@ impl Expander {
75 ast_id_map: mem::take(&mut self.ast_id_map), 112 ast_id_map: mem::take(&mut self.ast_id_map),
76 bomb: DropBomb::new("expansion mark dropped"), 113 bomb: DropBomb::new("expansion mark dropped"),
77 }; 114 };
78 self.hygiene = Hygiene::new(db.upcast(), file_id); 115 self.cfg_expander.hygiene = Hygiene::new(db.upcast(), file_id);
79 self.current_file_id = file_id; 116 self.current_file_id = file_id;
80 self.ast_id_map = db.ast_id_map(file_id); 117 self.ast_id_map = db.ast_id_map(file_id);
81 self.recursive_limit += 1; 118 self.recursive_limit += 1;
@@ -91,7 +128,7 @@ impl Expander {
91 } 128 }
92 129
93 pub(crate) fn exit(&mut self, db: &dyn DefDatabase, mut mark: Mark) { 130 pub(crate) fn exit(&mut self, db: &dyn DefDatabase, mut mark: Mark) {
94 self.hygiene = Hygiene::new(db.upcast(), mark.file_id); 131 self.cfg_expander.hygiene = Hygiene::new(db.upcast(), mark.file_id);
95 self.current_file_id = mark.file_id; 132 self.current_file_id = mark.file_id;
96 self.ast_id_map = mem::take(&mut mark.ast_id_map); 133 self.ast_id_map = mem::take(&mut mark.ast_id_map);
97 self.recursive_limit -= 1; 134 self.recursive_limit -= 1;
@@ -102,8 +139,16 @@ impl Expander {
102 InFile { file_id: self.current_file_id, value } 139 InFile { file_id: self.current_file_id, value }
103 } 140 }
104 141
142 pub(crate) fn parse_attrs(&self, owner: &dyn ast::AttrsOwner) -> Attrs {
143 self.cfg_expander.parse_attrs(owner)
144 }
145
146 pub(crate) fn is_cfg_enabled(&self, attrs: &Attrs) -> bool {
147 self.cfg_expander.is_cfg_enabled(attrs)
148 }
149
105 fn parse_path(&mut self, path: ast::Path) -> Option<Path> { 150 fn parse_path(&mut self, path: ast::Path) -> Option<Path> {
106 Path::from_src(path, &self.hygiene) 151 Path::from_src(path, &self.cfg_expander.hygiene)
107 } 152 }
108 153
109 fn resolve_path_as_macro(&self, db: &dyn DefDatabase, path: &ModPath) -> Option<MacroDefId> { 154 fn resolve_path_as_macro(&self, db: &dyn DefDatabase, path: &ModPath) -> Option<MacroDefId> {
@@ -142,7 +187,7 @@ pub struct Body {
142 pub item_scope: ItemScope, 187 pub item_scope: ItemScope,
143} 188}
144 189
145pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>; 190pub type ExprPtr = AstPtr<ast::Expr>;
146pub type ExprSource = InFile<ExprPtr>; 191pub type ExprSource = InFile<ExprPtr>;
147 192
148pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; 193pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>;
@@ -236,11 +281,11 @@ impl Index<PatId> for Body {
236 281
237impl BodySourceMap { 282impl BodySourceMap {
238 pub fn expr_syntax(&self, expr: ExprId) -> Result<ExprSource, SyntheticSyntax> { 283 pub fn expr_syntax(&self, expr: ExprId) -> Result<ExprSource, SyntheticSyntax> {
239 self.expr_map_back[expr] 284 self.expr_map_back[expr].clone()
240 } 285 }
241 286
242 pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> { 287 pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> {
243 let src = node.map(|it| Either::Left(AstPtr::new(it))); 288 let src = node.map(|it| AstPtr::new(it));
244 self.expr_map.get(&src).cloned() 289 self.expr_map.get(&src).cloned()
245 } 290 }
246 291
@@ -249,13 +294,8 @@ impl BodySourceMap {
249 self.expansions.get(&src).cloned() 294 self.expansions.get(&src).cloned()
250 } 295 }
251 296
252 pub fn field_init_shorthand_expr(&self, node: InFile<&ast::RecordField>) -> Option<ExprId> {
253 let src = node.map(|it| Either::Right(AstPtr::new(it)));
254 self.expr_map.get(&src).cloned()
255 }
256
257 pub fn pat_syntax(&self, pat: PatId) -> Result<PatSource, SyntheticSyntax> { 297 pub fn pat_syntax(&self, pat: PatId) -> Result<PatSource, SyntheticSyntax> {
258 self.pat_map_back[pat] 298 self.pat_map_back[pat].clone()
259 } 299 }
260 300
261 pub fn node_pat(&self, node: InFile<&ast::Pat>) -> Option<PatId> { 301 pub fn node_pat(&self, node: InFile<&ast::Pat>) -> Option<PatId> {
@@ -264,6 +304,6 @@ impl BodySourceMap {
264 } 304 }
265 305
266 pub fn field_syntax(&self, expr: ExprId, field: usize) -> AstPtr<ast::RecordField> { 306 pub fn field_syntax(&self, expr: ExprId, field: usize) -> AstPtr<ast::RecordField> {
267 self.field_map[&(expr, field)] 307 self.field_map[&(expr, field)].clone()
268 } 308 }
269} 309}
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index e1b08d48f..c057dc8f2 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -2,9 +2,7 @@
2//! representation. 2//! representation.
3 3
4use either::Either; 4use either::Either;
5
6use hir_expand::{ 5use hir_expand::{
7 hygiene::Hygiene,
8 name::{name, AsName, Name}, 6 name::{name, AsName, Name},
9 MacroDefId, MacroDefKind, 7 MacroDefId, MacroDefKind,
10}; 8};
@@ -18,10 +16,8 @@ use ra_syntax::{
18}; 16};
19use test_utils::tested_by; 17use test_utils::tested_by;
20 18
21use super::{ExprSource, PatSource};
22use crate::{ 19use crate::{
23 adt::StructKind, 20 adt::StructKind,
24 attr::Attrs,
25 body::{Body, BodySourceMap, Expander, PatPtr, SyntheticSyntax}, 21 body::{Body, BodySourceMap, Expander, PatPtr, SyntheticSyntax},
26 builtin_type::{BuiltinFloat, BuiltinInt}, 22 builtin_type::{BuiltinFloat, BuiltinInt},
27 db::DefDatabase, 23 db::DefDatabase,
@@ -31,12 +27,13 @@ use crate::{
31 }, 27 },
32 item_scope::BuiltinShadowMode, 28 item_scope::BuiltinShadowMode,
33 path::GenericArgs, 29 path::GenericArgs,
34 path::Path,
35 type_ref::{Mutability, TypeRef}, 30 type_ref::{Mutability, TypeRef},
36 AdtId, ConstLoc, ContainerId, DefWithBodyId, EnumLoc, FunctionLoc, HasModule, Intern, 31 AdtId, ConstLoc, ContainerId, DefWithBodyId, EnumLoc, FunctionLoc, Intern, ModuleDefId,
37 ModuleDefId, StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, UnionLoc, 32 StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, UnionLoc,
38}; 33};
39 34
35use super::{ExprSource, PatSource};
36
40pub(super) fn lower( 37pub(super) fn lower(
41 db: &dyn DefDatabase, 38 db: &dyn DefDatabase,
42 def: DefWithBodyId, 39 def: DefWithBodyId,
@@ -104,9 +101,8 @@ impl ExprCollector<'_> {
104 } 101 }
105 102
106 fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr<ast::Expr>) -> ExprId { 103 fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr<ast::Expr>) -> ExprId {
107 let ptr = Either::Left(ptr);
108 let src = self.expander.to_source(ptr); 104 let src = self.expander.to_source(ptr);
109 let id = self.make_expr(expr, Ok(src)); 105 let id = self.make_expr(expr, Ok(src.clone()));
110 self.source_map.expr_map.insert(src, id); 106 self.source_map.expr_map.insert(src, id);
111 id 107 id
112 } 108 }
@@ -115,13 +111,6 @@ impl ExprCollector<'_> {
115 fn alloc_expr_desugared(&mut self, expr: Expr) -> ExprId { 111 fn alloc_expr_desugared(&mut self, expr: Expr) -> ExprId {
116 self.make_expr(expr, Err(SyntheticSyntax)) 112 self.make_expr(expr, Err(SyntheticSyntax))
117 } 113 }
118 fn alloc_expr_field_shorthand(&mut self, expr: Expr, ptr: AstPtr<ast::RecordField>) -> ExprId {
119 let ptr = Either::Right(ptr);
120 let src = self.expander.to_source(ptr);
121 let id = self.make_expr(expr, Ok(src));
122 self.source_map.expr_map.insert(src, id);
123 id
124 }
125 fn empty_block(&mut self) -> ExprId { 114 fn empty_block(&mut self) -> ExprId {
126 self.alloc_expr_desugared(Expr::Block { statements: Vec::new(), tail: None }) 115 self.alloc_expr_desugared(Expr::Block { statements: Vec::new(), tail: None })
127 } 116 }
@@ -136,7 +125,7 @@ impl ExprCollector<'_> {
136 125
137 fn alloc_pat(&mut self, pat: Pat, ptr: PatPtr) -> PatId { 126 fn alloc_pat(&mut self, pat: Pat, ptr: PatPtr) -> PatId {
138 let src = self.expander.to_source(ptr); 127 let src = self.expander.to_source(ptr);
139 let id = self.make_pat(pat, Ok(src)); 128 let id = self.make_pat(pat, Ok(src.clone()));
140 self.source_map.pat_map.insert(src, id); 129 self.source_map.pat_map.insert(src, id);
141 id 130 id
142 } 131 }
@@ -291,7 +280,7 @@ impl ExprCollector<'_> {
291 ast::Expr::ParenExpr(e) => { 280 ast::Expr::ParenExpr(e) => {
292 let inner = self.collect_expr_opt(e.expr()); 281 let inner = self.collect_expr_opt(e.expr());
293 // make the paren expr point to the inner expression as well 282 // make the paren expr point to the inner expression as well
294 let src = self.expander.to_source(Either::Left(syntax_ptr)); 283 let src = self.expander.to_source(syntax_ptr);
295 self.source_map.expr_map.insert(src, inner); 284 self.source_map.expr_map.insert(src, inner);
296 inner 285 inner
297 } 286 }
@@ -300,7 +289,6 @@ impl ExprCollector<'_> {
300 self.alloc_expr(Expr::Return { expr }, syntax_ptr) 289 self.alloc_expr(Expr::Return { expr }, syntax_ptr)
301 } 290 }
302 ast::Expr::RecordLit(e) => { 291 ast::Expr::RecordLit(e) => {
303 let crate_graph = self.db.crate_graph();
304 let path = e.path().and_then(|path| self.expander.parse_path(path)); 292 let path = e.path().and_then(|path| self.expander.parse_path(path));
305 let mut field_ptrs = Vec::new(); 293 let mut field_ptrs = Vec::new();
306 let record_lit = if let Some(nfl) = e.record_field_list() { 294 let record_lit = if let Some(nfl) = e.record_field_list() {
@@ -308,31 +296,17 @@ impl ExprCollector<'_> {
308 .fields() 296 .fields()
309 .inspect(|field| field_ptrs.push(AstPtr::new(field))) 297 .inspect(|field| field_ptrs.push(AstPtr::new(field)))
310 .filter_map(|field| { 298 .filter_map(|field| {
311 let module_id = ContainerId::DefWithBodyId(self.def).module(self.db); 299 let attrs = self.expander.parse_attrs(&field);
312 let attrs = Attrs::new( 300 if !self.expander.is_cfg_enabled(&attrs) {
313 &field,
314 &Hygiene::new(self.db.upcast(), self.expander.current_file_id),
315 );
316
317 if !attrs.is_cfg_enabled(&crate_graph[module_id.krate].cfg_options) {
318 return None; 301 return None;
319 } 302 }
303 let name = field.field_name()?.as_name();
320 304
321 Some(RecordLitField { 305 Some(RecordLitField {
322 name: field 306 name,
323 .name_ref() 307 expr: match field.expr() {
324 .map(|nr| nr.as_name()) 308 Some(e) => self.collect_expr(e),
325 .unwrap_or_else(Name::missing), 309 None => self.missing_expr(),
326 expr: if let Some(e) = field.expr() {
327 self.collect_expr(e)
328 } else if let Some(nr) = field.name_ref() {
329 // field shorthand
330 self.alloc_expr_field_shorthand(
331 Expr::Path(Path::from_name_ref(&nr)),
332 AstPtr::new(&field),
333 )
334 } else {
335 self.missing_expr()
336 }, 310 },
337 }) 311 })
338 }) 312 })
@@ -668,7 +642,9 @@ impl ExprCollector<'_> {
668 }); 642 });
669 fields.extend(iter); 643 fields.extend(iter);
670 644
671 Pat::Record { path, args: fields } 645 let ellipsis = record_field_pat_list.dotdot_token().is_some();
646
647 Pat::Record { path, args: fields, ellipsis }
672 } 648 }
673 ast::Pat::SlicePat(p) => { 649 ast::Pat::SlicePat(p) => {
674 let SlicePatComponents { prefix, slice, suffix } = p.components(); 650 let SlicePatComponents { prefix, slice, suffix } = p.components();
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs
index b8fbf0ed4..56a20c5bd 100644
--- a/crates/ra_hir_def/src/data.rs
+++ b/crates/ra_hir_def/src/data.rs
@@ -20,7 +20,7 @@ use crate::{
20 type_ref::{Mutability, TypeBound, TypeRef}, 20 type_ref::{Mutability, TypeBound, TypeRef},
21 visibility::RawVisibility, 21 visibility::RawVisibility,
22 AssocContainerId, AssocItemId, ConstId, ConstLoc, Expander, FunctionId, FunctionLoc, HasModule, 22 AssocContainerId, AssocItemId, ConstId, ConstLoc, Expander, FunctionId, FunctionLoc, HasModule,
23 ImplId, Intern, Lookup, ModuleId, StaticId, TraitId, TypeAliasId, TypeAliasLoc, 23 ImplId, Intern, Lookup, StaticId, TraitId, TypeAliasId, TypeAliasLoc,
24}; 24};
25 25
26#[derive(Debug, Clone, PartialEq, Eq)] 26#[derive(Debug, Clone, PartialEq, Eq)]
@@ -218,10 +218,17 @@ impl ImplData {
218 let mut items = Vec::new(); 218 let mut items = Vec::new();
219 219
220 if let Some(item_list) = src.value.item_list() { 220 if let Some(item_list) = src.value.item_list() {
221 items.extend(collect_impl_items(db, item_list.impl_items(), src.file_id, id)); 221 let mut expander = Expander::new(db, impl_loc.ast_id.file_id, module_id);
222 items.extend(collect_impl_items(
223 db,
224 &mut expander,
225 item_list.impl_items(),
226 src.file_id,
227 id,
228 ));
222 items.extend(collect_impl_items_in_macros( 229 items.extend(collect_impl_items_in_macros(
223 db, 230 db,
224 module_id, 231 &mut expander,
225 &src.with_value(item_list), 232 &src.with_value(item_list),
226 id, 233 id,
227 )); 234 ));
@@ -268,18 +275,17 @@ impl ConstData {
268 275
269fn collect_impl_items_in_macros( 276fn collect_impl_items_in_macros(
270 db: &dyn DefDatabase, 277 db: &dyn DefDatabase,
271 module_id: ModuleId, 278 expander: &mut Expander,
272 impl_def: &InFile<ast::ItemList>, 279 impl_def: &InFile<ast::ItemList>,
273 id: ImplId, 280 id: ImplId,
274) -> Vec<AssocItemId> { 281) -> Vec<AssocItemId> {
275 let mut expander = Expander::new(db, impl_def.file_id, module_id);
276 let mut res = Vec::new(); 282 let mut res = Vec::new();
277 283
278 // We set a limit to protect against infinite recursion 284 // We set a limit to protect against infinite recursion
279 let limit = 100; 285 let limit = 100;
280 286
281 for m in impl_def.value.syntax().children().filter_map(ast::MacroCall::cast) { 287 for m in impl_def.value.syntax().children().filter_map(ast::MacroCall::cast) {
282 res.extend(collect_impl_items_in_macro(db, &mut expander, m, id, limit)) 288 res.extend(collect_impl_items_in_macro(db, expander, m, id, limit))
283 } 289 }
284 290
285 res 291 res
@@ -300,6 +306,7 @@ fn collect_impl_items_in_macro(
300 let items: InFile<ast::MacroItems> = expander.to_source(items); 306 let items: InFile<ast::MacroItems> = expander.to_source(items);
301 let mut res = collect_impl_items( 307 let mut res = collect_impl_items(
302 db, 308 db,
309 expander,
303 items.value.items().filter_map(|it| ImplItem::cast(it.syntax().clone())), 310 items.value.items().filter_map(|it| ImplItem::cast(it.syntax().clone())),
304 items.file_id, 311 items.file_id,
305 id, 312 id,
@@ -319,32 +326,26 @@ fn collect_impl_items_in_macro(
319 326
320fn collect_impl_items( 327fn collect_impl_items(
321 db: &dyn DefDatabase, 328 db: &dyn DefDatabase,
329 expander: &mut Expander,
322 impl_items: impl Iterator<Item = ImplItem>, 330 impl_items: impl Iterator<Item = ImplItem>,
323 file_id: crate::HirFileId, 331 file_id: crate::HirFileId,
324 id: ImplId, 332 id: ImplId,
325) -> Vec<AssocItemId> { 333) -> Vec<AssocItemId> {
326 let items = db.ast_id_map(file_id); 334 let items = db.ast_id_map(file_id);
327 let crate_graph = db.crate_graph();
328 let module_id = id.lookup(db).container.module(db);
329 335
330 impl_items 336 impl_items
331 .filter_map(|item_node| match item_node { 337 .filter_map(|item_node| match item_node {
332 ast::ImplItem::FnDef(it) => { 338 ast::ImplItem::FnDef(it) => {
339 let attrs = expander.parse_attrs(&it);
340 if !expander.is_cfg_enabled(&attrs) {
341 return None;
342 }
333 let def = FunctionLoc { 343 let def = FunctionLoc {
334 container: AssocContainerId::ImplId(id), 344 container: AssocContainerId::ImplId(id),
335 ast_id: AstId::new(file_id, items.ast_id(&it)), 345 ast_id: AstId::new(file_id, items.ast_id(&it)),
336 } 346 }
337 .intern(db); 347 .intern(db);
338 348 Some(def.into())
339 if !db
340 .function_data(def)
341 .attrs
342 .is_cfg_enabled(&crate_graph[module_id.krate].cfg_options)
343 {
344 None
345 } else {
346 Some(def.into())
347 }
348 } 349 }
349 ast::ImplItem::ConstDef(it) => { 350 ast::ImplItem::ConstDef(it) => {
350 let def = ConstLoc { 351 let def = ConstLoc {
diff --git a/crates/ra_hir_def/src/diagnostics.rs b/crates/ra_hir_def/src/diagnostics.rs
index 095498429..cfa0f2f76 100644
--- a/crates/ra_hir_def/src/diagnostics.rs
+++ b/crates/ra_hir_def/src/diagnostics.rs
@@ -20,7 +20,7 @@ impl Diagnostic for UnresolvedModule {
20 "unresolved module".to_string() 20 "unresolved module".to_string()
21 } 21 }
22 fn source(&self) -> InFile<SyntaxNodePtr> { 22 fn source(&self) -> InFile<SyntaxNodePtr> {
23 InFile { file_id: self.file, value: self.decl.into() } 23 InFile { file_id: self.file, value: self.decl.clone().into() }
24 } 24 }
25 fn as_any(&self) -> &(dyn Any + Send + 'static) { 25 fn as_any(&self) -> &(dyn Any + Send + 'static) {
26 self 26 self
diff --git a/crates/ra_hir_def/src/expr.rs b/crates/ra_hir_def/src/expr.rs
index 197bbe9bd..e11bdf3ec 100644
--- a/crates/ra_hir_def/src/expr.rs
+++ b/crates/ra_hir_def/src/expr.rs
@@ -376,35 +376,14 @@ pub enum Pat {
376 Wild, 376 Wild,
377 Tuple(Vec<PatId>), 377 Tuple(Vec<PatId>),
378 Or(Vec<PatId>), 378 Or(Vec<PatId>),
379 Record { 379 Record { path: Option<Path>, args: Vec<RecordFieldPat>, ellipsis: bool },
380 path: Option<Path>, 380 Range { start: ExprId, end: ExprId },
381 args: Vec<RecordFieldPat>, 381 Slice { prefix: Vec<PatId>, slice: Option<PatId>, suffix: Vec<PatId> },
382 // FIXME: 'ellipsis' option
383 },
384 Range {
385 start: ExprId,
386 end: ExprId,
387 },
388 Slice {
389 prefix: Vec<PatId>,
390 slice: Option<PatId>,
391 suffix: Vec<PatId>,
392 },
393 Path(Path), 382 Path(Path),
394 Lit(ExprId), 383 Lit(ExprId),
395 Bind { 384 Bind { mode: BindingAnnotation, name: Name, subpat: Option<PatId> },
396 mode: BindingAnnotation, 385 TupleStruct { path: Option<Path>, args: Vec<PatId> },
397 name: Name, 386 Ref { pat: PatId, mutability: Mutability },
398 subpat: Option<PatId>,
399 },
400 TupleStruct {
401 path: Option<Path>,
402 args: Vec<PatId>,
403 },
404 Ref {
405 pat: PatId,
406 mutability: Mutability,
407 },
408} 387}
409 388
410impl Pat { 389impl Pat {
diff --git a/crates/ra_hir_def/src/lang_item.rs b/crates/ra_hir_def/src/lang_item.rs
index 01b367278..d96ac8c0a 100644
--- a/crates/ra_hir_def/src/lang_item.rs
+++ b/crates/ra_hir_def/src/lang_item.rs
@@ -4,6 +4,7 @@
4//! features, such as Fn family of traits. 4//! features, such as Fn family of traits.
5use std::sync::Arc; 5use std::sync::Arc;
6 6
7use ra_prof::profile;
7use ra_syntax::SmolStr; 8use ra_syntax::SmolStr;
8use rustc_hash::FxHashMap; 9use rustc_hash::FxHashMap;
9 10
@@ -78,6 +79,8 @@ impl LangItems {
78 79
79 /// Salsa query. This will look for lang items in a specific crate. 80 /// Salsa query. This will look for lang items in a specific crate.
80 pub(crate) fn crate_lang_items_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<LangItems> { 81 pub(crate) fn crate_lang_items_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<LangItems> {
82 let _p = profile("crate_lang_items_query");
83
81 let mut lang_items = LangItems::default(); 84 let mut lang_items = LangItems::default();
82 85
83 let crate_def_map = db.crate_def_map(krate); 86 let crate_def_map = db.crate_def_map(krate);
@@ -95,6 +98,7 @@ impl LangItems {
95 db: &dyn DefDatabase, 98 db: &dyn DefDatabase,
96 module: ModuleId, 99 module: ModuleId,
97 ) -> Option<Arc<LangItems>> { 100 ) -> Option<Arc<LangItems>> {
101 let _p = profile("module_lang_items_query");
98 let mut lang_items = LangItems::default(); 102 let mut lang_items = LangItems::default();
99 lang_items.collect_lang_items(db, module); 103 lang_items.collect_lang_items(db, module);
100 if lang_items.items.is_empty() { 104 if lang_items.items.is_empty() {
@@ -111,6 +115,7 @@ impl LangItems {
111 start_crate: CrateId, 115 start_crate: CrateId,
112 item: SmolStr, 116 item: SmolStr,
113 ) -> Option<LangItemTarget> { 117 ) -> Option<LangItemTarget> {
118 let _p = profile("lang_item_query");
114 let lang_items = db.crate_lang_items(start_crate); 119 let lang_items = db.crate_lang_items(start_crate);
115 let start_crate_target = lang_items.items.get(&item); 120 let start_crate_target = lang_items.items.get(&item);
116 if let Some(target) = start_crate_target { 121 if let Some(target) = start_crate_target {
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 8fe3f8617..98c74fe25 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -462,6 +462,14 @@ impl DefCollector<'_> {
462 Some(ModuleDefId::AdtId(AdtId::EnumId(e))) => { 462 Some(ModuleDefId::AdtId(AdtId::EnumId(e))) => {
463 tested_by!(glob_enum); 463 tested_by!(glob_enum);
464 // glob import from enum => just import all the variants 464 // glob import from enum => just import all the variants
465
466 // XXX: urgh, so this works by accident! Here, we look at
467 // the enum data, and, in theory, this might require us to
468 // look back at the crate_def_map, creating a cycle. For
469 // example, `enum E { crate::some_macro!(); }`. Luckely, the
470 // only kind of macro that is allowed inside enum is a
471 // `cfg_macro`, and we don't need to run name resolution for
472 // it, but this is sheer luck!
465 let enum_data = self.db.enum_data(e); 473 let enum_data = self.db.enum_data(e);
466 let resolutions = enum_data 474 let resolutions = enum_data
467 .variants 475 .variants
@@ -977,11 +985,7 @@ impl ModCollector<'_, '_> {
977 } 985 }
978 986
979 fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { 987 fn is_cfg_enabled(&self, attrs: &Attrs) -> bool {
980 // FIXME: handle cfg_attr :-) 988 attrs.is_cfg_enabled(self.def_collector.cfg_options)
981 attrs
982 .by_key("cfg")
983 .tt_values()
984 .all(|tt| self.def_collector.cfg_options.is_cfg_enabled(tt) != Some(false))
985 } 989 }
986} 990}
987 991
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs
index e72ba52cf..afd538e4a 100644
--- a/crates/ra_hir_def/src/nameres/raw.rs
+++ b/crates/ra_hir_def/src/nameres/raw.rs
@@ -287,7 +287,7 @@ impl RawItemsCollector {
287 let visibility = RawVisibility::from_ast_with_hygiene(module.visibility(), &self.hygiene); 287 let visibility = RawVisibility::from_ast_with_hygiene(module.visibility(), &self.hygiene);
288 288
289 let ast_id = self.source_ast_id_map.ast_id(&module); 289 let ast_id = self.source_ast_id_map.ast_id(&module);
290 if module.semi_token().is_some() { 290 if module.semicolon_token().is_some() {
291 let item = 291 let item =
292 self.raw_items.modules.alloc(ModuleData::Declaration { name, visibility, ast_id }); 292 self.raw_items.modules.alloc(ModuleData::Declaration { name, visibility, ast_id });
293 self.push_item(current_module, attrs, RawItemKind::Module(item)); 293 self.push_item(current_module, attrs, RawItemKind::Module(item));
diff --git a/crates/ra_hir_def/src/nameres/tests/incremental.rs b/crates/ra_hir_def/src/nameres/tests/incremental.rs
index 496fc6b08..87165ac33 100644
--- a/crates/ra_hir_def/src/nameres/tests/incremental.rs
+++ b/crates/ra_hir_def/src/nameres/tests/incremental.rs
@@ -32,6 +32,9 @@ fn typing_inside_a_function_should_not_invalidate_def_map() {
32 32
33 use crate::foo::bar::Baz; 33 use crate::foo::bar::Baz;
34 34
35 enum E { A, B }
36 use E::*;
37
35 fn foo() -> i32 { 38 fn foo() -> i32 {
36 1 + 1 39 1 + 1
37 } 40 }
@@ -46,6 +49,9 @@ fn typing_inside_a_function_should_not_invalidate_def_map() {
46 49
47 use crate::foo::bar::Baz; 50 use crate::foo::bar::Baz;
48 51
52 enum E { A, B }
53 use E::*;
54
49 fn foo() -> i32 { 92 } 55 fn foo() -> i32 { 92 }
50 ", 56 ",
51 ); 57 );
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs
index 904080341..91c7b3e09 100644
--- a/crates/ra_hir_def/src/path.rs
+++ b/crates/ra_hir_def/src/path.rs
@@ -134,11 +134,6 @@ impl Path {
134 lower::lower_path(path, hygiene) 134 lower::lower_path(path, hygiene)
135 } 135 }
136 136
137 /// Converts an `ast::NameRef` into a single-identifier `Path`.
138 pub(crate) fn from_name_ref(name_ref: &ast::NameRef) -> Path {
139 Path { type_anchor: None, mod_path: name_ref.as_name().into(), generic_args: vec![None] }
140 }
141
142 /// Converts a known mod path to `Path`. 137 /// Converts a known mod path to `Path`.
143 pub(crate) fn from_known_path( 138 pub(crate) fn from_known_path(
144 path: ModPath, 139 path: ModPath,
diff --git a/crates/ra_hir_expand/src/ast_id_map.rs b/crates/ra_hir_expand/src/ast_id_map.rs
index 5643ecdce..a3ca302c2 100644
--- a/crates/ra_hir_expand/src/ast_id_map.rs
+++ b/crates/ra_hir_expand/src/ast_id_map.rs
@@ -90,7 +90,7 @@ impl AstIdMap {
90 } 90 }
91 91
92 pub(crate) fn get<N: AstNode>(&self, id: FileAstId<N>) -> AstPtr<N> { 92 pub(crate) fn get<N: AstNode>(&self, id: FileAstId<N>) -> AstPtr<N> {
93 self.arena[id.raw].cast::<N>().unwrap() 93 self.arena[id.raw].clone().cast::<N>().unwrap()
94 } 94 }
95 95
96 fn alloc(&mut self, item: &SyntaxNode) -> ErasedFileAstId { 96 fn alloc(&mut self, item: &SyntaxNode) -> ErasedFileAstId {
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml
index 9a4a7aa6f..59efc1c31 100644
--- a/crates/ra_hir_ty/Cargo.toml
+++ b/crates/ra_hir_ty/Cargo.toml
@@ -24,6 +24,8 @@ ra_prof = { path = "../ra_prof" }
24ra_syntax = { path = "../ra_syntax" } 24ra_syntax = { path = "../ra_syntax" }
25test_utils = { path = "../test_utils" } 25test_utils = { path = "../test_utils" }
26 26
27scoped-tls = "1"
28
27chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" } 29chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" }
28chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" } 30chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" }
29chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" } 31chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" }
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs
index 1462b053f..33da16b48 100644
--- a/crates/ra_hir_ty/src/db.rs
+++ b/crates/ra_hir_ty/src/db.rs
@@ -11,7 +11,7 @@ use ra_db::{impl_intern_key, salsa, CrateId, Upcast};
11use ra_prof::profile; 11use ra_prof::profile;
12 12
13use crate::{ 13use crate::{
14 method_resolution::CrateImplDefs, 14 method_resolution::{CrateImplDefs, TyFingerprint},
15 traits::{chalk, AssocTyValue, Impl}, 15 traits::{chalk, AssocTyValue, Impl},
16 Binders, CallableDef, GenericPredicate, InferenceResult, PolyFnSig, Substs, TraitRef, Ty, 16 Binders, CallableDef, GenericPredicate, InferenceResult, PolyFnSig, Substs, TraitRef, Ty,
17 TyDefId, TypeCtor, ValueTyDefId, 17 TyDefId, TypeCtor, ValueTyDefId,
@@ -65,7 +65,12 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
65 fn impls_in_crate(&self, krate: CrateId) -> Arc<CrateImplDefs>; 65 fn impls_in_crate(&self, krate: CrateId) -> Arc<CrateImplDefs>;
66 66
67 #[salsa::invoke(crate::traits::impls_for_trait_query)] 67 #[salsa::invoke(crate::traits::impls_for_trait_query)]
68 fn impls_for_trait(&self, krate: CrateId, trait_: TraitId) -> Arc<[ImplId]>; 68 fn impls_for_trait(
69 &self,
70 krate: CrateId,
71 trait_: TraitId,
72 self_ty_fp: Option<TyFingerprint>,
73 ) -> Arc<[ImplId]>;
69 74
70 // Interned IDs for Chalk integration 75 // Interned IDs for Chalk integration
71 #[salsa::interned] 76 #[salsa::interned]
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs
index 8cbce1168..927896d6f 100644
--- a/crates/ra_hir_ty/src/diagnostics.rs
+++ b/crates/ra_hir_ty/src/diagnostics.rs
@@ -21,7 +21,7 @@ impl Diagnostic for NoSuchField {
21 } 21 }
22 22
23 fn source(&self) -> InFile<SyntaxNodePtr> { 23 fn source(&self) -> InFile<SyntaxNodePtr> {
24 InFile { file_id: self.file, value: self.field.into() } 24 InFile { file_id: self.file, value: self.field.clone().into() }
25 } 25 }
26 26
27 fn as_any(&self) -> &(dyn Any + Send + 'static) { 27 fn as_any(&self) -> &(dyn Any + Send + 'static) {
@@ -45,7 +45,7 @@ impl Diagnostic for MissingFields {
45 buf 45 buf
46 } 46 }
47 fn source(&self) -> InFile<SyntaxNodePtr> { 47 fn source(&self) -> InFile<SyntaxNodePtr> {
48 InFile { file_id: self.file, value: self.field_list.into() } 48 InFile { file_id: self.file, value: self.field_list.clone().into() }
49 } 49 }
50 fn as_any(&self) -> &(dyn Any + Send + 'static) { 50 fn as_any(&self) -> &(dyn Any + Send + 'static) {
51 self 51 self
@@ -63,6 +63,29 @@ impl AstDiagnostic for MissingFields {
63} 63}
64 64
65#[derive(Debug)] 65#[derive(Debug)]
66pub struct MissingPatFields {
67 pub file: HirFileId,
68 pub field_list: AstPtr<ast::RecordFieldPatList>,
69 pub missed_fields: Vec<Name>,
70}
71
72impl Diagnostic for MissingPatFields {
73 fn message(&self) -> String {
74 let mut buf = String::from("Missing structure fields:\n");
75 for field in &self.missed_fields {
76 format_to!(buf, "- {}", field);
77 }
78 buf
79 }
80 fn source(&self) -> InFile<SyntaxNodePtr> {
81 InFile { file_id: self.file, value: self.field_list.clone().into() }
82 }
83 fn as_any(&self) -> &(dyn Any + Send + 'static) {
84 self
85 }
86}
87
88#[derive(Debug)]
66pub struct MissingMatchArms { 89pub struct MissingMatchArms {
67 pub file: HirFileId, 90 pub file: HirFileId,
68 pub match_expr: AstPtr<ast::Expr>, 91 pub match_expr: AstPtr<ast::Expr>,
@@ -74,7 +97,7 @@ impl Diagnostic for MissingMatchArms {
74 String::from("Missing match arm") 97 String::from("Missing match arm")
75 } 98 }
76 fn source(&self) -> InFile<SyntaxNodePtr> { 99 fn source(&self) -> InFile<SyntaxNodePtr> {
77 InFile { file_id: self.file, value: self.match_expr.into() } 100 InFile { file_id: self.file, value: self.match_expr.clone().into() }
78 } 101 }
79 fn as_any(&self) -> &(dyn Any + Send + 'static) { 102 fn as_any(&self) -> &(dyn Any + Send + 'static) {
80 self 103 self
@@ -92,7 +115,7 @@ impl Diagnostic for MissingOkInTailExpr {
92 "wrap return expression in Ok".to_string() 115 "wrap return expression in Ok".to_string()
93 } 116 }
94 fn source(&self) -> InFile<SyntaxNodePtr> { 117 fn source(&self) -> InFile<SyntaxNodePtr> {
95 InFile { file_id: self.file, value: self.expr.into() } 118 InFile { file_id: self.file, value: self.expr.clone().into() }
96 } 119 }
97 fn as_any(&self) -> &(dyn Any + Send + 'static) { 120 fn as_any(&self) -> &(dyn Any + Send + 'static) {
98 self 121 self
diff --git a/crates/ra_hir_ty/src/display.rs b/crates/ra_hir_ty/src/display.rs
index 0e9313aa1..d03bbd5a7 100644
--- a/crates/ra_hir_ty/src/display.rs
+++ b/crates/ra_hir_ty/src/display.rs
@@ -247,19 +247,21 @@ impl HirDisplay for ApplicationTy {
247 } 247 }
248 } 248 }
249 TypeCtor::Closure { .. } => { 249 TypeCtor::Closure { .. } => {
250 let sig = self.parameters[0] 250 let sig = self.parameters[0].callable_sig(f.db);
251 .callable_sig(f.db) 251 if let Some(sig) = sig {
252 .expect("first closure parameter should contain signature"); 252 if sig.params().is_empty() {
253 if sig.params().is_empty() { 253 write!(f, "||")?;
254 write!(f, "||")?; 254 } else if f.omit_verbose_types() {
255 } else if f.omit_verbose_types() { 255 write!(f, "|{}|", TYPE_HINT_TRUNCATION)?;
256 write!(f, "|{}|", TYPE_HINT_TRUNCATION)?; 256 } else {
257 write!(f, "|")?;
258 f.write_joined(sig.params(), ", ")?;
259 write!(f, "|")?;
260 };
261 write!(f, " -> {}", sig.ret().display(f.db))?;
257 } else { 262 } else {
258 write!(f, "|")?; 263 write!(f, "{{closure}}")?;
259 f.write_joined(sig.params(), ", ")?; 264 }
260 write!(f, "|")?;
261 };
262 write!(f, " -> {}", sig.ret().display(f.db))?;
263 } 265 }
264 } 266 }
265 Ok(()) 267 Ok(())
diff --git a/crates/ra_hir_ty/src/expr.rs b/crates/ra_hir_ty/src/expr.rs
index e45e9ea14..69b527f74 100644
--- a/crates/ra_hir_ty/src/expr.rs
+++ b/crates/ra_hir_ty/src/expr.rs
@@ -9,7 +9,7 @@ use rustc_hash::FxHashSet;
9 9
10use crate::{ 10use crate::{
11 db::HirDatabase, 11 db::HirDatabase,
12 diagnostics::{MissingFields, MissingMatchArms, MissingOkInTailExpr}, 12 diagnostics::{MissingFields, MissingMatchArms, MissingOkInTailExpr, MissingPatFields},
13 utils::variant_data, 13 utils::variant_data,
14 ApplicationTy, InferenceResult, Ty, TypeCtor, 14 ApplicationTy, InferenceResult, Ty, TypeCtor,
15 _match::{is_useful, MatchCheckCtx, Matrix, PatStack, Usefulness}, 15 _match::{is_useful, MatchCheckCtx, Matrix, PatStack, Usefulness},
@@ -49,39 +49,95 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
49 if let Some((variant_def, missed_fields, true)) = 49 if let Some((variant_def, missed_fields, true)) =
50 record_literal_missing_fields(db, &self.infer, id, expr) 50 record_literal_missing_fields(db, &self.infer, id, expr)
51 { 51 {
52 // XXX: only look at source_map if we do have missing fields 52 self.create_record_literal_missing_fields_diagnostic(
53 let (_, source_map) = db.body_with_source_map(self.func.into()); 53 id,
54 54 db,
55 if let Ok(source_ptr) = source_map.expr_syntax(id) { 55 variant_def,
56 if let Some(expr) = source_ptr.value.left() { 56 missed_fields,
57 let root = source_ptr.file_syntax(db.upcast()); 57 );
58 if let ast::Expr::RecordLit(record_lit) = expr.to_node(&root) {
59 if let Some(field_list) = record_lit.record_field_list() {
60 let variant_data = variant_data(db.upcast(), variant_def);
61 let missed_fields = missed_fields
62 .into_iter()
63 .map(|idx| variant_data.fields()[idx].name.clone())
64 .collect();
65 self.sink.push(MissingFields {
66 file: source_ptr.file_id,
67 field_list: AstPtr::new(&field_list),
68 missed_fields,
69 })
70 }
71 }
72 }
73 }
74 } 58 }
75 if let Expr::Match { expr, arms } = expr { 59 if let Expr::Match { expr, arms } = expr {
76 self.validate_match(id, *expr, arms, db, self.infer.clone()); 60 self.validate_match(id, *expr, arms, db, self.infer.clone());
77 } 61 }
78 } 62 }
63 for (id, pat) in body.pats.iter() {
64 if let Some((variant_def, missed_fields, true)) =
65 record_pattern_missing_fields(db, &self.infer, id, pat)
66 {
67 self.create_record_pattern_missing_fields_diagnostic(
68 id,
69 db,
70 variant_def,
71 missed_fields,
72 );
73 }
74 }
79 let body_expr = &body[body.body_expr]; 75 let body_expr = &body[body.body_expr];
80 if let Expr::Block { tail: Some(t), .. } = body_expr { 76 if let Expr::Block { tail: Some(t), .. } = body_expr {
81 self.validate_results_in_tail_expr(body.body_expr, *t, db); 77 self.validate_results_in_tail_expr(body.body_expr, *t, db);
82 } 78 }
83 } 79 }
84 80
81 fn create_record_literal_missing_fields_diagnostic(
82 &mut self,
83 id: ExprId,
84 db: &dyn HirDatabase,
85 variant_def: VariantId,
86 missed_fields: Vec<LocalStructFieldId>,
87 ) {
88 // XXX: only look at source_map if we do have missing fields
89 let (_, source_map) = db.body_with_source_map(self.func.into());
90
91 if let Ok(source_ptr) = source_map.expr_syntax(id) {
92 let root = source_ptr.file_syntax(db.upcast());
93 if let ast::Expr::RecordLit(record_lit) = &source_ptr.value.to_node(&root) {
94 if let Some(field_list) = record_lit.record_field_list() {
95 let variant_data = variant_data(db.upcast(), variant_def);
96 let missed_fields = missed_fields
97 .into_iter()
98 .map(|idx| variant_data.fields()[idx].name.clone())
99 .collect();
100 self.sink.push(MissingFields {
101 file: source_ptr.file_id,
102 field_list: AstPtr::new(&field_list),
103 missed_fields,
104 })
105 }
106 }
107 }
108 }
109
110 fn create_record_pattern_missing_fields_diagnostic(
111 &mut self,
112 id: PatId,
113 db: &dyn HirDatabase,
114 variant_def: VariantId,
115 missed_fields: Vec<LocalStructFieldId>,
116 ) {
117 // XXX: only look at source_map if we do have missing fields
118 let (_, source_map) = db.body_with_source_map(self.func.into());
119
120 if let Ok(source_ptr) = source_map.pat_syntax(id) {
121 if let Some(expr) = source_ptr.value.as_ref().left() {
122 let root = source_ptr.file_syntax(db.upcast());
123 if let ast::Pat::RecordPat(record_pat) = expr.to_node(&root) {
124 if let Some(field_list) = record_pat.record_field_pat_list() {
125 let variant_data = variant_data(db.upcast(), variant_def);
126 let missed_fields = missed_fields
127 .into_iter()
128 .map(|idx| variant_data.fields()[idx].name.clone())
129 .collect();
130 self.sink.push(MissingPatFields {
131 file: source_ptr.file_id,
132 field_list: AstPtr::new(&field_list),
133 missed_fields,
134 })
135 }
136 }
137 }
138 }
139 }
140
85 fn validate_match( 141 fn validate_match(
86 &mut self, 142 &mut self,
87 id: ExprId, 143 id: ExprId,
@@ -147,18 +203,16 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
147 } 203 }
148 204
149 if let Ok(source_ptr) = source_map.expr_syntax(id) { 205 if let Ok(source_ptr) = source_map.expr_syntax(id) {
150 if let Some(expr) = source_ptr.value.left() { 206 let root = source_ptr.file_syntax(db.upcast());
151 let root = source_ptr.file_syntax(db.upcast()); 207 if let ast::Expr::MatchExpr(match_expr) = &source_ptr.value.to_node(&root) {
152 if let ast::Expr::MatchExpr(match_expr) = expr.to_node(&root) { 208 if let (Some(match_expr), Some(arms)) =
153 if let (Some(match_expr), Some(arms)) = 209 (match_expr.expr(), match_expr.match_arm_list())
154 (match_expr.expr(), match_expr.match_arm_list()) 210 {
155 { 211 self.sink.push(MissingMatchArms {
156 self.sink.push(MissingMatchArms { 212 file: source_ptr.file_id,
157 file: source_ptr.file_id, 213 match_expr: AstPtr::new(&match_expr),
158 match_expr: AstPtr::new(&match_expr), 214 arms: AstPtr::new(&arms),
159 arms: AstPtr::new(&arms), 215 })
160 })
161 }
162 } 216 }
163 } 217 }
164 } 218 }
@@ -189,9 +243,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
189 let (_, source_map) = db.body_with_source_map(self.func.into()); 243 let (_, source_map) = db.body_with_source_map(self.func.into());
190 244
191 if let Ok(source_ptr) = source_map.expr_syntax(id) { 245 if let Ok(source_ptr) = source_map.expr_syntax(id) {
192 if let Some(expr) = source_ptr.value.left() { 246 self.sink
193 self.sink.push(MissingOkInTailExpr { file: source_ptr.file_id, expr }); 247 .push(MissingOkInTailExpr { file: source_ptr.file_id, expr: source_ptr.value });
194 }
195 } 248 }
196 } 249 }
197 } 250 }
@@ -232,9 +285,9 @@ pub fn record_pattern_missing_fields(
232 infer: &InferenceResult, 285 infer: &InferenceResult,
233 id: PatId, 286 id: PatId,
234 pat: &Pat, 287 pat: &Pat,
235) -> Option<(VariantId, Vec<LocalStructFieldId>)> { 288) -> Option<(VariantId, Vec<LocalStructFieldId>, /*exhaustive*/ bool)> {
236 let fields = match pat { 289 let (fields, exhaustive) = match pat {
237 Pat::Record { path: _, args } => args, 290 Pat::Record { path: _, args, ellipsis } => (args, !ellipsis),
238 _ => return None, 291 _ => return None,
239 }; 292 };
240 293
@@ -254,5 +307,5 @@ pub fn record_pattern_missing_fields(
254 if missed_fields.is_empty() { 307 if missed_fields.is_empty() {
255 return None; 308 return None;
256 } 309 }
257 Some((variant_def, missed_fields)) 310 Some((variant_def, missed_fields, exhaustive))
258} 311}
diff --git a/crates/ra_hir_ty/src/infer/pat.rs b/crates/ra_hir_ty/src/infer/pat.rs
index 69bbb4307..078476f76 100644
--- a/crates/ra_hir_ty/src/infer/pat.rs
+++ b/crates/ra_hir_ty/src/infer/pat.rs
@@ -158,7 +158,7 @@ impl<'a> InferenceContext<'a> {
158 Pat::TupleStruct { path: p, args: subpats } => { 158 Pat::TupleStruct { path: p, args: subpats } => {
159 self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm, pat) 159 self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm, pat)
160 } 160 }
161 Pat::Record { path: p, args: fields } => { 161 Pat::Record { path: p, args: fields, ellipsis: _ } => {
162 self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat) 162 self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat)
163 } 163 }
164 Pat::Path(path) => { 164 Pat::Path(path) => {
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/ra_hir_ty/src/method_resolution.rs
index 74a0bc7db..657284fd0 100644
--- a/crates/ra_hir_ty/src/method_resolution.rs
+++ b/crates/ra_hir_ty/src/method_resolution.rs
@@ -34,7 +34,7 @@ impl TyFingerprint {
34 /// Creates a TyFingerprint for looking up an impl. Only certain types can 34 /// Creates a TyFingerprint for looking up an impl. Only certain types can
35 /// have impls: if we have some `struct S`, we can have an `impl S`, but not 35 /// have impls: if we have some `struct S`, we can have an `impl S`, but not
36 /// `impl &S`. Hence, this will return `None` for reference types and such. 36 /// `impl &S`. Hence, this will return `None` for reference types and such.
37 fn for_impl(ty: &Ty) -> Option<TyFingerprint> { 37 pub(crate) fn for_impl(ty: &Ty) -> Option<TyFingerprint> {
38 match ty { 38 match ty {
39 Ty::Apply(a_ty) => Some(TyFingerprint::Apply(a_ty.ctor)), 39 Ty::Apply(a_ty) => Some(TyFingerprint::Apply(a_ty.ctor)),
40 _ => None, 40 _ => None,
@@ -45,7 +45,7 @@ impl TyFingerprint {
45#[derive(Debug, PartialEq, Eq)] 45#[derive(Debug, PartialEq, Eq)]
46pub struct CrateImplDefs { 46pub struct CrateImplDefs {
47 impls: FxHashMap<TyFingerprint, Vec<ImplId>>, 47 impls: FxHashMap<TyFingerprint, Vec<ImplId>>,
48 impls_by_trait: FxHashMap<TraitId, Vec<ImplId>>, 48 impls_by_trait: FxHashMap<TraitId, FxHashMap<Option<TyFingerprint>, Vec<ImplId>>>,
49} 49}
50 50
51impl CrateImplDefs { 51impl CrateImplDefs {
@@ -59,7 +59,14 @@ impl CrateImplDefs {
59 for impl_id in module_data.scope.impls() { 59 for impl_id in module_data.scope.impls() {
60 match db.impl_trait(impl_id) { 60 match db.impl_trait(impl_id) {
61 Some(tr) => { 61 Some(tr) => {
62 res.impls_by_trait.entry(tr.value.trait_).or_default().push(impl_id); 62 let self_ty = db.impl_self_ty(impl_id);
63 let self_ty_fp = TyFingerprint::for_impl(&self_ty.value);
64 res.impls_by_trait
65 .entry(tr.value.trait_)
66 .or_default()
67 .entry(self_ty_fp)
68 .or_default()
69 .push(impl_id);
63 } 70 }
64 None => { 71 None => {
65 let self_ty = db.impl_self_ty(impl_id); 72 let self_ty = db.impl_self_ty(impl_id);
@@ -79,11 +86,39 @@ impl CrateImplDefs {
79 } 86 }
80 87
81 pub fn lookup_impl_defs_for_trait(&self, tr: TraitId) -> impl Iterator<Item = ImplId> + '_ { 88 pub fn lookup_impl_defs_for_trait(&self, tr: TraitId) -> impl Iterator<Item = ImplId> + '_ {
82 self.impls_by_trait.get(&tr).into_iter().flatten().copied() 89 self.impls_by_trait
90 .get(&tr)
91 .into_iter()
92 .flat_map(|m| m.values().flat_map(|v| v.iter().copied()))
93 }
94
95 pub fn lookup_impl_defs_for_trait_and_ty(
96 &self,
97 tr: TraitId,
98 fp: TyFingerprint,
99 ) -> impl Iterator<Item = ImplId> + '_ {
100 self.impls_by_trait
101 .get(&tr)
102 .and_then(|m| m.get(&Some(fp)))
103 .into_iter()
104 .flatten()
105 .copied()
106 .chain(
107 self.impls_by_trait
108 .get(&tr)
109 .and_then(|m| m.get(&None))
110 .into_iter()
111 .flatten()
112 .copied(),
113 )
83 } 114 }
84 115
85 pub fn all_impls<'a>(&'a self) -> impl Iterator<Item = ImplId> + 'a { 116 pub fn all_impls<'a>(&'a self) -> impl Iterator<Item = ImplId> + 'a {
86 self.impls.values().chain(self.impls_by_trait.values()).flatten().copied() 117 self.impls
118 .values()
119 .chain(self.impls_by_trait.values().flat_map(|m| m.values()))
120 .flatten()
121 .copied()
87 } 122 }
88} 123}
89 124
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index 002cffba6..81fc0f63a 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -82,12 +82,10 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
82 82
83 for (expr, ty) in inference_result.type_of_expr.iter() { 83 for (expr, ty) in inference_result.type_of_expr.iter() {
84 let syntax_ptr = match body_source_map.expr_syntax(expr) { 84 let syntax_ptr = match body_source_map.expr_syntax(expr) {
85 Ok(sp) => { 85 Ok(sp) => sp.map(|ast| ast.syntax_node_ptr()),
86 sp.map(|ast| ast.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr()))
87 }
88 Err(SyntheticSyntax) => continue, 86 Err(SyntheticSyntax) => continue,
89 }; 87 };
90 types.push((syntax_ptr, ty)); 88 types.push((syntax_ptr.clone(), ty));
91 if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr) { 89 if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr) {
92 mismatches.push((syntax_ptr, mismatch)); 90 mismatches.push((syntax_ptr, mismatch));
93 } 91 }
@@ -409,3 +407,43 @@ fn no_such_field_with_feature_flag_diagnostics_on_struct_fields() {
409 407
410 assert_snapshot!(diagnostics, @r###""###); 408 assert_snapshot!(diagnostics, @r###""###);
411} 409}
410
411#[test]
412fn missing_record_pat_field_diagnostic() {
413 let diagnostics = TestDB::with_files(
414 r"
415 //- /lib.rs
416 struct S { foo: i32, bar: () }
417 fn baz(s: S) {
418 let S { foo: _ } = s;
419 }
420 ",
421 )
422 .diagnostics()
423 .0;
424
425 assert_snapshot!(diagnostics, @r###"
426 "{ foo: _ }": Missing structure fields:
427 - bar
428 "###
429 );
430}
431
432#[test]
433fn missing_record_pat_field_no_diagnostic_if_not_exhaustive() {
434 let diagnostics = TestDB::with_files(
435 r"
436 //- /lib.rs
437 struct S { foo: i32, bar: () }
438 fn baz(s: S) -> i32 {
439 match s {
440 S { foo, .. } => foo,
441 }
442 }
443 ",
444 )
445 .diagnostics()
446 .0;
447
448 assert_snapshot!(diagnostics, @"");
449}
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs
index ff4599b71..f2a9b1c40 100644
--- a/crates/ra_hir_ty/src/tests/macros.rs
+++ b/crates/ra_hir_ty/src/tests/macros.rs
@@ -1,10 +1,13 @@
1use std::fs;
2
1use insta::assert_snapshot; 3use insta::assert_snapshot;
2use ra_db::fixture::WithFixture; 4use ra_db::fixture::WithFixture;
3 5use test_utils::project_dir;
4use super::{infer, type_at, type_at_pos};
5 6
6use crate::test_db::TestDB; 7use crate::test_db::TestDB;
7 8
9use super::{infer, type_at, type_at_pos};
10
8#[test] 11#[test]
9fn cfg_impl_def() { 12fn cfg_impl_def() {
10 let (db, pos) = TestDB::with_position( 13 let (db, pos) = TestDB::with_position(
@@ -482,6 +485,30 @@ fn bar() -> u32 {0}
482} 485}
483 486
484#[test] 487#[test]
488#[ignore]
489fn include_accidentally_quadratic() {
490 let file = project_dir().join("crates/ra_syntax/test_data/accidentally_quadratic");
491 let big_file = fs::read_to_string(file).unwrap();
492 let big_file = vec![big_file; 10].join("\n");
493
494 let fixture = r#"
495//- /main.rs
496#[rustc_builtin_macro]
497macro_rules! include {() => {}}
498
499include!("foo.rs");
500
501fn main() {
502 RegisterBlock { }<|>;
503}
504 "#;
505 let fixture = format!("{}\n//- /foo.rs\n{}", fixture, big_file);
506
507 let (db, pos) = TestDB::with_position(&fixture);
508 assert_eq!("RegisterBlock", type_at_pos(&db, pos));
509}
510
511#[test]
485fn infer_builtin_macros_include_concat() { 512fn infer_builtin_macros_include_concat() {
486 let (db, pos) = TestDB::with_position( 513 let (db, pos) = TestDB::with_position(
487 r#" 514 r#"
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs
index 5a1e12ce9..43d8d1e80 100644
--- a/crates/ra_hir_ty/src/traits.rs
+++ b/crates/ra_hir_ty/src/traits.rs
@@ -7,7 +7,7 @@ use ra_db::{impl_intern_key, salsa, CrateId};
7use ra_prof::profile; 7use ra_prof::profile;
8use rustc_hash::FxHashSet; 8use rustc_hash::FxHashSet;
9 9
10use crate::{db::HirDatabase, DebruijnIndex}; 10use crate::{db::HirDatabase, method_resolution::TyFingerprint, DebruijnIndex};
11 11
12use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; 12use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk};
13 13
@@ -40,7 +40,12 @@ pub(crate) fn impls_for_trait_query(
40 db: &dyn HirDatabase, 40 db: &dyn HirDatabase,
41 krate: CrateId, 41 krate: CrateId,
42 trait_: TraitId, 42 trait_: TraitId,
43 self_ty_fp: Option<TyFingerprint>,
43) -> Arc<[ImplId]> { 44) -> Arc<[ImplId]> {
45 // FIXME: We could be a lot smarter here - because of the orphan rules and
46 // the fact that the trait and the self type need to be in the dependency
47 // tree of a crate somewhere for an impl to exist, we could skip looking in
48 // a lot of crates completely
44 let mut impls = FxHashSet::default(); 49 let mut impls = FxHashSet::default();
45 // We call the query recursively here. On the one hand, this means we can 50 // We call the query recursively here. On the one hand, this means we can
46 // reuse results from queries for different crates; on the other hand, this 51 // reuse results from queries for different crates; on the other hand, this
@@ -48,10 +53,13 @@ pub(crate) fn impls_for_trait_query(
48 // ones the user is editing), so this may actually be a waste of memory. I'm 53 // ones the user is editing), so this may actually be a waste of memory. I'm
49 // doing it like this mainly for simplicity for now. 54 // doing it like this mainly for simplicity for now.
50 for dep in &db.crate_graph()[krate].dependencies { 55 for dep in &db.crate_graph()[krate].dependencies {
51 impls.extend(db.impls_for_trait(dep.crate_id, trait_).iter()); 56 impls.extend(db.impls_for_trait(dep.crate_id, trait_, self_ty_fp).iter());
52 } 57 }
53 let crate_impl_defs = db.impls_in_crate(krate); 58 let crate_impl_defs = db.impls_in_crate(krate);
54 impls.extend(crate_impl_defs.lookup_impl_defs_for_trait(trait_)); 59 match self_ty_fp {
60 Some(fp) => impls.extend(crate_impl_defs.lookup_impl_defs_for_trait_and_ty(trait_, fp)),
61 None => impls.extend(crate_impl_defs.lookup_impl_defs_for_trait(trait_)),
62 }
55 impls.into_iter().collect() 63 impls.into_iter().collect()
56} 64}
57 65
@@ -177,7 +185,7 @@ fn solve(
177 185
178 let fuel = std::cell::Cell::new(CHALK_SOLVER_FUEL); 186 let fuel = std::cell::Cell::new(CHALK_SOLVER_FUEL);
179 187
180 let solution = solver.solve_limited(&context, goal, || { 188 let should_continue = || {
181 context.db.check_canceled(); 189 context.db.check_canceled();
182 let remaining = fuel.get(); 190 let remaining = fuel.get();
183 fuel.set(remaining - 1); 191 fuel.set(remaining - 1);
@@ -185,12 +193,21 @@ fn solve(
185 log::debug!("fuel exhausted"); 193 log::debug!("fuel exhausted");
186 } 194 }
187 remaining > 0 195 remaining > 0
188 }); 196 };
197 let mut solve = || solver.solve_limited(&context, goal, should_continue);
198 // don't set the TLS for Chalk unless Chalk debugging is active, to make
199 // extra sure we only use it for debugging
200 let solution =
201 if is_chalk_debug() { chalk::tls::set_current_program(db, solve) } else { solve() };
189 202
190 log::debug!("solve({:?}) => {:?}", goal, solution); 203 log::debug!("solve({:?}) => {:?}", goal, solution);
191 solution 204 solution
192} 205}
193 206
207fn is_chalk_debug() -> bool {
208 std::env::var("CHALK_DEBUG").is_ok()
209}
210
194fn solution_from_chalk( 211fn solution_from_chalk(
195 db: &dyn HirDatabase, 212 db: &dyn HirDatabase,
196 solution: chalk_solve::Solution<Interner>, 213 solution: chalk_solve::Solution<Interner>,
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs
index 1bc0f0713..e05fea843 100644
--- a/crates/ra_hir_ty/src/traits/chalk.rs
+++ b/crates/ra_hir_ty/src/traits/chalk.rs
@@ -16,10 +16,12 @@ use ra_db::{
16 16
17use super::{builtin, AssocTyValue, Canonical, ChalkContext, Impl, Obligation}; 17use super::{builtin, AssocTyValue, Canonical, ChalkContext, Impl, Obligation};
18use crate::{ 18use crate::{
19 db::HirDatabase, display::HirDisplay, utils::generics, ApplicationTy, GenericPredicate, 19 db::HirDatabase, display::HirDisplay, method_resolution::TyFingerprint, utils::generics,
20 ProjectionTy, Substs, TraitRef, Ty, TypeCtor, 20 ApplicationTy, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor,
21}; 21};
22 22
23pub(super) mod tls;
24
23#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] 25#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
24pub struct Interner; 26pub struct Interner;
25 27
@@ -33,90 +35,85 @@ impl chalk_ir::interner::Interner for Interner {
33 type Identifier = TypeAliasId; 35 type Identifier = TypeAliasId;
34 type DefId = InternId; 36 type DefId = InternId;
35 37
36 // FIXME: implement these
37 fn debug_struct_id( 38 fn debug_struct_id(
38 _type_kind_id: chalk_ir::StructId<Self>, 39 type_kind_id: StructId,
39 _fmt: &mut fmt::Formatter<'_>, 40 fmt: &mut fmt::Formatter<'_>,
40 ) -> Option<fmt::Result> { 41 ) -> Option<fmt::Result> {
41 None 42 tls::with_current_program(|prog| Some(prog?.debug_struct_id(type_kind_id, fmt)))
42 } 43 }
43 44
44 fn debug_trait_id( 45 fn debug_trait_id(type_kind_id: TraitId, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> {
45 _type_kind_id: chalk_ir::TraitId<Self>, 46 tls::with_current_program(|prog| Some(prog?.debug_trait_id(type_kind_id, fmt)))
46 _fmt: &mut fmt::Formatter<'_>,
47 ) -> Option<fmt::Result> {
48 None
49 } 47 }
50 48
51 fn debug_assoc_type_id( 49 fn debug_assoc_type_id(id: AssocTypeId, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> {
52 _id: chalk_ir::AssocTypeId<Self>, 50 tls::with_current_program(|prog| Some(prog?.debug_assoc_type_id(id, fmt)))
53 _fmt: &mut fmt::Formatter<'_>,
54 ) -> Option<fmt::Result> {
55 None
56 } 51 }
57 52
58 fn debug_alias( 53 fn debug_alias(
59 _projection: &chalk_ir::AliasTy<Self>, 54 alias: &chalk_ir::AliasTy<Interner>,
60 _fmt: &mut fmt::Formatter<'_>, 55 fmt: &mut fmt::Formatter<'_>,
61 ) -> Option<fmt::Result> { 56 ) -> Option<fmt::Result> {
62 None 57 tls::with_current_program(|prog| Some(prog?.debug_alias(alias, fmt)))
63 } 58 }
64 59
65 fn debug_ty(_ty: &chalk_ir::Ty<Self>, _fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { 60 fn debug_ty(ty: &chalk_ir::Ty<Interner>, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> {
66 None 61 tls::with_current_program(|prog| Some(prog?.debug_ty(ty, fmt)))
67 } 62 }
68 63
69 fn debug_lifetime( 64 fn debug_lifetime(
70 _lifetime: &chalk_ir::Lifetime<Self>, 65 lifetime: &chalk_ir::Lifetime<Interner>,
71 _fmt: &mut fmt::Formatter<'_>, 66 fmt: &mut fmt::Formatter<'_>,
72 ) -> Option<fmt::Result> { 67 ) -> Option<fmt::Result> {
73 None 68 tls::with_current_program(|prog| Some(prog?.debug_lifetime(lifetime, fmt)))
74 } 69 }
75 70
76 fn debug_parameter( 71 fn debug_parameter(
77 _parameter: &Parameter<Self>, 72 parameter: &Parameter<Interner>,
78 _fmt: &mut fmt::Formatter<'_>, 73 fmt: &mut fmt::Formatter<'_>,
79 ) -> Option<fmt::Result> { 74 ) -> Option<fmt::Result> {
80 None 75 tls::with_current_program(|prog| Some(prog?.debug_parameter(parameter, fmt)))
81 } 76 }
82 77
83 fn debug_goal(_goal: &Goal<Self>, _fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { 78 fn debug_goal(goal: &Goal<Interner>, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> {
84 None 79 tls::with_current_program(|prog| Some(prog?.debug_goal(goal, fmt)))
85 } 80 }
86 81
87 fn debug_goals( 82 fn debug_goals(
88 _goals: &chalk_ir::Goals<Self>, 83 goals: &chalk_ir::Goals<Interner>,
89 _fmt: &mut fmt::Formatter<'_>, 84 fmt: &mut fmt::Formatter<'_>,
90 ) -> Option<fmt::Result> { 85 ) -> Option<fmt::Result> {
91 None 86 tls::with_current_program(|prog| Some(prog?.debug_goals(goals, fmt)))
92 } 87 }
93 88
94 fn debug_program_clause_implication( 89 fn debug_program_clause_implication(
95 _pci: &chalk_ir::ProgramClauseImplication<Self>, 90 pci: &chalk_ir::ProgramClauseImplication<Interner>,
96 _fmt: &mut fmt::Formatter<'_>, 91 fmt: &mut fmt::Formatter<'_>,
97 ) -> Option<fmt::Result> { 92 ) -> Option<fmt::Result> {
98 None 93 tls::with_current_program(|prog| Some(prog?.debug_program_clause_implication(pci, fmt)))
99 } 94 }
100 95
101 fn debug_application_ty( 96 fn debug_application_ty(
102 _application_ty: &chalk_ir::ApplicationTy<Self>, 97 application_ty: &chalk_ir::ApplicationTy<Interner>,
103 _fmt: &mut fmt::Formatter<'_>, 98 fmt: &mut fmt::Formatter<'_>,
104 ) -> Option<fmt::Result> { 99 ) -> Option<fmt::Result> {
105 None 100 tls::with_current_program(|prog| Some(prog?.debug_application_ty(application_ty, fmt)))
106 } 101 }
107 102
108 fn debug_substitution( 103 fn debug_substitution(
109 _substitution: &chalk_ir::Substitution<Self>, 104 substitution: &chalk_ir::Substitution<Interner>,
110 _fmt: &mut fmt::Formatter<'_>, 105 fmt: &mut fmt::Formatter<'_>,
111 ) -> Option<fmt::Result> { 106 ) -> Option<fmt::Result> {
112 None 107 tls::with_current_program(|prog| Some(prog?.debug_substitution(substitution, fmt)))
113 } 108 }
114 109
115 fn debug_separator_trait_ref( 110 fn debug_separator_trait_ref(
116 _separator_trait_ref: &chalk_ir::SeparatorTraitRef<Self>, 111 separator_trait_ref: &chalk_ir::SeparatorTraitRef<Interner>,
117 _fmt: &mut fmt::Formatter<'_>, 112 fmt: &mut fmt::Formatter<'_>,
118 ) -> Option<fmt::Result> { 113 ) -> Option<fmt::Result> {
119 None 114 tls::with_current_program(|prog| {
115 Some(prog?.debug_separator_trait_ref(separator_trait_ref, fmt))
116 })
120 } 117 }
121 118
122 fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> { 119 fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> {
@@ -650,19 +647,22 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
650 debug!("impls_for_trait {:?}", trait_id); 647 debug!("impls_for_trait {:?}", trait_id);
651 let trait_: hir_def::TraitId = from_chalk(self.db, trait_id); 648 let trait_: hir_def::TraitId = from_chalk(self.db, trait_id);
652 649
650 let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref(&Interner).clone());
651
652 let self_ty_fp = TyFingerprint::for_impl(&ty);
653
653 // Note: Since we're using impls_for_trait, only impls where the trait 654 // Note: Since we're using impls_for_trait, only impls where the trait
654 // can be resolved should ever reach Chalk. `impl_datum` relies on that 655 // can be resolved should ever reach Chalk. `impl_datum` relies on that
655 // and will panic if the trait can't be resolved. 656 // and will panic if the trait can't be resolved.
656 let mut result: Vec<_> = self 657 let mut result: Vec<_> = self
657 .db 658 .db
658 .impls_for_trait(self.krate, trait_) 659 .impls_for_trait(self.krate, trait_, self_ty_fp)
659 .iter() 660 .iter()
660 .copied() 661 .copied()
661 .map(Impl::ImplDef) 662 .map(Impl::ImplDef)
662 .map(|impl_| impl_.to_chalk(self.db)) 663 .map(|impl_| impl_.to_chalk(self.db))
663 .collect(); 664 .collect();
664 665
665 let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref(&Interner).clone());
666 let arg: Option<Ty> = 666 let arg: Option<Ty> =
667 parameters.get(1).map(|p| from_chalk(self.db, p.assert_ty_ref(&Interner).clone())); 667 parameters.get(1).map(|p| from_chalk(self.db, p.assert_ty_ref(&Interner).clone()));
668 668
diff --git a/crates/ra_hir_ty/src/traits/chalk/tls.rs b/crates/ra_hir_ty/src/traits/chalk/tls.rs
new file mode 100644
index 000000000..d9bbb54a5
--- /dev/null
+++ b/crates/ra_hir_ty/src/traits/chalk/tls.rs
@@ -0,0 +1,231 @@
1//! Implementation of Chalk debug helper functions using TLS.
2use std::fmt;
3
4use chalk_ir::{AliasTy, Goal, Goals, Lifetime, Parameter, ProgramClauseImplication, TypeName};
5
6use super::{from_chalk, Interner};
7use crate::{db::HirDatabase, CallableDef, TypeCtor};
8use hir_def::{AdtId, AssocContainerId, Lookup, TypeAliasId};
9
10pub use unsafe_tls::{set_current_program, with_current_program};
11
12pub struct DebugContext<'a>(&'a (dyn HirDatabase + 'a));
13
14impl DebugContext<'_> {
15 pub fn debug_struct_id(
16 &self,
17 id: super::StructId,
18 f: &mut fmt::Formatter<'_>,
19 ) -> Result<(), fmt::Error> {
20 let type_ctor: TypeCtor = from_chalk(self.0, TypeName::Struct(id));
21 match type_ctor {
22 TypeCtor::Bool => write!(f, "bool")?,
23 TypeCtor::Char => write!(f, "char")?,
24 TypeCtor::Int(t) => write!(f, "{}", t)?,
25 TypeCtor::Float(t) => write!(f, "{}", t)?,
26 TypeCtor::Str => write!(f, "str")?,
27 TypeCtor::Slice => write!(f, "slice")?,
28 TypeCtor::Array => write!(f, "array")?,
29 TypeCtor::RawPtr(m) => write!(f, "*{}", m.as_keyword_for_ptr())?,
30 TypeCtor::Ref(m) => write!(f, "&{}", m.as_keyword_for_ref())?,
31 TypeCtor::Never => write!(f, "!")?,
32 TypeCtor::Tuple { .. } => {
33 write!(f, "()")?;
34 }
35 TypeCtor::FnPtr { .. } => {
36 write!(f, "fn")?;
37 }
38 TypeCtor::FnDef(def) => {
39 let name = match def {
40 CallableDef::FunctionId(ff) => self.0.function_data(ff).name.clone(),
41 CallableDef::StructId(s) => self.0.struct_data(s).name.clone(),
42 CallableDef::EnumVariantId(e) => {
43 let enum_data = self.0.enum_data(e.parent);
44 enum_data.variants[e.local_id].name.clone()
45 }
46 };
47 match def {
48 CallableDef::FunctionId(_) => write!(f, "{{fn {}}}", name)?,
49 CallableDef::StructId(_) | CallableDef::EnumVariantId(_) => {
50 write!(f, "{{ctor {}}}", name)?
51 }
52 }
53 }
54 TypeCtor::Adt(def_id) => {
55 let name = match def_id {
56 AdtId::StructId(it) => self.0.struct_data(it).name.clone(),
57 AdtId::UnionId(it) => self.0.union_data(it).name.clone(),
58 AdtId::EnumId(it) => self.0.enum_data(it).name.clone(),
59 };
60 write!(f, "{}", name)?;
61 }
62 TypeCtor::AssociatedType(type_alias) => {
63 let trait_ = match type_alias.lookup(self.0.upcast()).container {
64 AssocContainerId::TraitId(it) => it,
65 _ => panic!("not an associated type"),
66 };
67 let trait_name = self.0.trait_data(trait_).name.clone();
68 let name = self.0.type_alias_data(type_alias).name.clone();
69 write!(f, "{}::{}", trait_name, name)?;
70 }
71 TypeCtor::Closure { def, expr } => {
72 write!(f, "{{closure {:?} in {:?}}}", expr.into_raw(), def)?;
73 }
74 }
75 Ok(())
76 }
77
78 pub fn debug_trait_id(
79 &self,
80 id: super::TraitId,
81 fmt: &mut fmt::Formatter<'_>,
82 ) -> Result<(), fmt::Error> {
83 let trait_: hir_def::TraitId = from_chalk(self.0, id);
84 let trait_data = self.0.trait_data(trait_);
85 write!(fmt, "{}", trait_data.name)
86 }
87
88 pub fn debug_assoc_type_id(
89 &self,
90 id: super::AssocTypeId,
91 fmt: &mut fmt::Formatter<'_>,
92 ) -> Result<(), fmt::Error> {
93 let type_alias: TypeAliasId = from_chalk(self.0, id);
94 let type_alias_data = self.0.type_alias_data(type_alias);
95 let trait_ = match type_alias.lookup(self.0.upcast()).container {
96 AssocContainerId::TraitId(t) => t,
97 _ => panic!("associated type not in trait"),
98 };
99 let trait_data = self.0.trait_data(trait_);
100 write!(fmt, "{}::{}", trait_data.name, type_alias_data.name)
101 }
102
103 pub fn debug_alias(
104 &self,
105 alias: &AliasTy<Interner>,
106 fmt: &mut fmt::Formatter<'_>,
107 ) -> Result<(), fmt::Error> {
108 let type_alias: TypeAliasId = from_chalk(self.0, alias.associated_ty_id);
109 let type_alias_data = self.0.type_alias_data(type_alias);
110 let trait_ = match type_alias.lookup(self.0.upcast()).container {
111 AssocContainerId::TraitId(t) => t,
112 _ => panic!("associated type not in trait"),
113 };
114 let trait_data = self.0.trait_data(trait_);
115 let params = alias.substitution.parameters(&Interner);
116 write!(
117 fmt,
118 "<{:?} as {}<{:?}>>::{}",
119 &params[0],
120 trait_data.name,
121 &params[1..],
122 type_alias_data.name
123 )
124 }
125
126 pub fn debug_ty(
127 &self,
128 ty: &chalk_ir::Ty<Interner>,
129 fmt: &mut fmt::Formatter<'_>,
130 ) -> Result<(), fmt::Error> {
131 write!(fmt, "{:?}", ty.data(&Interner))
132 }
133
134 pub fn debug_lifetime(
135 &self,
136 lifetime: &Lifetime<Interner>,
137 fmt: &mut fmt::Formatter<'_>,
138 ) -> Result<(), fmt::Error> {
139 write!(fmt, "{:?}", lifetime.data(&Interner))
140 }
141
142 pub fn debug_parameter(
143 &self,
144 parameter: &Parameter<Interner>,
145 fmt: &mut fmt::Formatter<'_>,
146 ) -> Result<(), fmt::Error> {
147 write!(fmt, "{:?}", parameter.data(&Interner).inner_debug())
148 }
149
150 pub fn debug_goal(
151 &self,
152 goal: &Goal<Interner>,
153 fmt: &mut fmt::Formatter<'_>,
154 ) -> Result<(), fmt::Error> {
155 let goal_data = goal.data(&Interner);
156 write!(fmt, "{:?}", goal_data)
157 }
158
159 pub fn debug_goals(
160 &self,
161 goals: &Goals<Interner>,
162 fmt: &mut fmt::Formatter<'_>,
163 ) -> Result<(), fmt::Error> {
164 write!(fmt, "{:?}", goals.debug(&Interner))
165 }
166
167 pub fn debug_program_clause_implication(
168 &self,
169 pci: &ProgramClauseImplication<Interner>,
170 fmt: &mut fmt::Formatter<'_>,
171 ) -> Result<(), fmt::Error> {
172 write!(fmt, "{:?}", pci.debug(&Interner))
173 }
174
175 pub fn debug_application_ty(
176 &self,
177 application_ty: &chalk_ir::ApplicationTy<Interner>,
178 fmt: &mut fmt::Formatter<'_>,
179 ) -> Result<(), fmt::Error> {
180 write!(fmt, "{:?}", application_ty.debug(&Interner))
181 }
182
183 pub fn debug_substitution(
184 &self,
185 substitution: &chalk_ir::Substitution<Interner>,
186 fmt: &mut fmt::Formatter<'_>,
187 ) -> Result<(), fmt::Error> {
188 write!(fmt, "{:?}", substitution.debug(&Interner))
189 }
190
191 pub fn debug_separator_trait_ref(
192 &self,
193 separator_trait_ref: &chalk_ir::SeparatorTraitRef<Interner>,
194 fmt: &mut fmt::Formatter<'_>,
195 ) -> Result<(), fmt::Error> {
196 write!(fmt, "{:?}", separator_trait_ref.debug(&Interner))
197 }
198}
199
200mod unsafe_tls {
201 use super::DebugContext;
202 use crate::db::HirDatabase;
203 use scoped_tls::scoped_thread_local;
204
205 scoped_thread_local!(static PROGRAM: DebugContext);
206
207 pub fn with_current_program<R>(
208 op: impl for<'a> FnOnce(Option<&'a DebugContext<'a>>) -> R,
209 ) -> R {
210 if PROGRAM.is_set() {
211 PROGRAM.with(|prog| op(Some(prog)))
212 } else {
213 op(None)
214 }
215 }
216
217 pub fn set_current_program<OP, R>(p: &dyn HirDatabase, op: OP) -> R
218 where
219 OP: FnOnce() -> R,
220 {
221 let ctx = DebugContext(p);
222 // we're transmuting the lifetime in the DebugContext to static. This is
223 // fine because we only keep the reference for the lifetime of this
224 // function, *and* the only way to access the context is through
225 // `with_current_program`, which hides the lifetime through the `for`
226 // type.
227 let static_p: &DebugContext<'static> =
228 unsafe { std::mem::transmute::<&DebugContext, &DebugContext<'static>>(&ctx) };
229 PROGRAM.set(static_p, || op())
230 }
231}
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs
index ded1ff3bc..fab02945c 100644
--- a/crates/ra_ide/src/completion/complete_trait_impl.rs
+++ b/crates/ra_ide/src/completion/complete_trait_impl.rs
@@ -35,7 +35,7 @@ use hir::{self, Docs, HasSource};
35use ra_assists::utils::get_missing_impl_items; 35use ra_assists::utils::get_missing_impl_items;
36use ra_syntax::{ 36use ra_syntax::{
37 ast::{self, edit, ImplDef}, 37 ast::{self, edit, ImplDef},
38 AstNode, SyntaxKind, SyntaxNode, TextRange, 38 AstNode, SyntaxKind, SyntaxNode, TextRange, T,
39}; 39};
40use ra_text_edit::TextEdit; 40use ra_text_edit::TextEdit;
41 41
@@ -204,7 +204,7 @@ fn make_const_compl_syntax(const_: &ast::ConstDef) -> String {
204 let end = const_ 204 let end = const_
205 .syntax() 205 .syntax()
206 .children_with_tokens() 206 .children_with_tokens()
207 .find(|s| s.kind() == SyntaxKind::SEMI || s.kind() == SyntaxKind::EQ) 207 .find(|s| s.kind() == T![;] || s.kind() == T![=])
208 .map_or(const_end, |f| f.text_range().start()); 208 .map_or(const_end, |f| f.text_range().start());
209 209
210 let len = end - start; 210 let len = end - start;
diff --git a/crates/ra_ide/src/completion/complete_unqualified_path.rs b/crates/ra_ide/src/completion/complete_unqualified_path.rs
index efde9bf73..0b0da6ee4 100644
--- a/crates/ra_ide/src/completion/complete_unqualified_path.rs
+++ b/crates/ra_ide/src/completion/complete_unqualified_path.rs
@@ -3,7 +3,7 @@
3use crate::completion::{CompletionContext, Completions}; 3use crate::completion::{CompletionContext, Completions};
4 4
5pub(super) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) { 5pub(super) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) {
6 if !(ctx.is_trivial_path && !ctx.is_pat_binding_or_const) { 6 if !(ctx.is_trivial_path && !ctx.is_pat_binding_or_const && !ctx.record_lit_syntax.is_some()) {
7 return; 7 return;
8 } 8 }
9 9
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index 6637afaf7..14a4a14d7 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -227,7 +227,7 @@ impl<'a> CompletionContext<'a> {
227 self.name_ref_syntax = 227 self.name_ref_syntax =
228 find_node_at_offset(&original_file, name_ref.syntax().text_range().start()); 228 find_node_at_offset(&original_file, name_ref.syntax().text_range().start());
229 let name_range = name_ref.syntax().text_range(); 229 let name_range = name_ref.syntax().text_range();
230 if name_ref.syntax().parent().and_then(ast::RecordField::cast).is_some() { 230 if ast::RecordField::for_field_name(&name_ref).is_some() {
231 self.record_lit_syntax = 231 self.record_lit_syntax =
232 self.sema.find_node_at_offset_with_macros(&original_file, offset); 232 self.sema.find_node_at_offset_with_macros(&original_file, offset);
233 } 233 }
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index da9f55a69..45b9f7802 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -235,7 +235,10 @@ fn should_show_param_hint(
235 param_name: &str, 235 param_name: &str,
236 argument: &ast::Expr, 236 argument: &ast::Expr,
237) -> bool { 237) -> bool {
238 if param_name.is_empty() || is_argument_similar_to_param(argument, param_name) { 238 if param_name.is_empty()
239 || is_argument_similar_to_param(argument, param_name)
240 || Some(param_name) == fn_signature.name.as_ref().map(String::as_str)
241 {
239 return false; 242 return false;
240 } 243 }
241 244
@@ -247,10 +250,7 @@ fn should_show_param_hint(
247 250
248 // avoid displaying hints for common functions like map, filter, etc. 251 // avoid displaying hints for common functions like map, filter, etc.
249 // or other obvious words used in std 252 // or other obvious words used in std
250 if parameters_len == 1 && is_obvious_param(param_name) { 253 parameters_len != 1 || !is_obvious_param(param_name)
251 return false;
252 }
253 true
254} 254}
255 255
256fn is_argument_similar_to_param(argument: &ast::Expr, param_name: &str) -> bool { 256fn is_argument_similar_to_param(argument: &ast::Expr, param_name: &str) -> bool {
@@ -1086,6 +1086,8 @@ impl Test {
1086 } 1086 }
1087 1087
1088 fn no_hints_expected(&self, _: i32, test_var: i32) {} 1088 fn no_hints_expected(&self, _: i32, test_var: i32) {}
1089
1090 fn frob(&self, frob: bool) {}
1089} 1091}
1090 1092
1091struct Param {} 1093struct Param {}
@@ -1093,6 +1095,8 @@ struct Param {}
1093fn different_order(param: &Param) {} 1095fn different_order(param: &Param) {}
1094fn different_order_mut(param: &mut Param) {} 1096fn different_order_mut(param: &mut Param) {}
1095 1097
1098fn twiddle(twiddle: bool) {}
1099
1096fn main() { 1100fn main() {
1097 let container: TestVarContainer = TestVarContainer { test_var: 42 }; 1101 let container: TestVarContainer = TestVarContainer { test_var: 42 };
1098 let test: Test = Test {}; 1102 let test: Test = Test {};
@@ -1105,6 +1109,9 @@ fn main() {
1105 let test_var: i32 = 55; 1109 let test_var: i32 = 55;
1106 test_processed.no_hints_expected(22, test_var); 1110 test_processed.no_hints_expected(22, test_var);
1107 test_processed.no_hints_expected(33, container.test_var); 1111 test_processed.no_hints_expected(33, container.test_var);
1112 test_processed.frob(false);
1113
1114 twiddle(true);
1108 1115
1109 let param_begin: Param = Param {}; 1116 let param_begin: Param = Param {};
1110 different_order(&param_begin); 1117 different_order(&param_begin);
diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs
index f58e436d1..5842ae2e8 100644
--- a/crates/ra_ide/src/syntax_tree.rs
+++ b/crates/ra_ide/src/syntax_tree.rs
@@ -165,7 +165,7 @@ SOURCE_FILE@[0; 60)
165 PATH_SEGMENT@[16; 22) 165 PATH_SEGMENT@[16; 22)
166 NAME_REF@[16; 22) 166 NAME_REF@[16; 22)
167 IDENT@[16; 22) "assert" 167 IDENT@[16; 22) "assert"
168 EXCL@[22; 23) "!" 168 BANG@[22; 23) "!"
169 TOKEN_TREE@[23; 57) 169 TOKEN_TREE@[23; 57)
170 L_PAREN@[23; 24) "(" 170 L_PAREN@[23; 24) "("
171 STRING@[24; 52) "\"\n fn foo() {\n ..." 171 STRING@[24; 52) "\"\n fn foo() {\n ..."
@@ -173,7 +173,7 @@ SOURCE_FILE@[0; 60)
173 WHITESPACE@[53; 54) " " 173 WHITESPACE@[53; 54) " "
174 STRING@[54; 56) "\"\"" 174 STRING@[54; 56) "\"\""
175 R_PAREN@[56; 57) ")" 175 R_PAREN@[56; 57) ")"
176 SEMI@[57; 58) ";" 176 SEMICOLON@[57; 58) ";"
177 WHITESPACE@[58; 59) "\n" 177 WHITESPACE@[58; 59) "\n"
178 R_CURLY@[59; 60) "}" 178 R_CURLY@[59; 60) "}"
179"# 179"#
@@ -226,7 +226,7 @@ EXPR_STMT@[16; 58)
226 PATH_SEGMENT@[16; 22) 226 PATH_SEGMENT@[16; 22)
227 NAME_REF@[16; 22) 227 NAME_REF@[16; 22)
228 IDENT@[16; 22) "assert" 228 IDENT@[16; 22) "assert"
229 EXCL@[22; 23) "!" 229 BANG@[22; 23) "!"
230 TOKEN_TREE@[23; 57) 230 TOKEN_TREE@[23; 57)
231 L_PAREN@[23; 24) "(" 231 L_PAREN@[23; 24) "("
232 STRING@[24; 52) "\"\n fn foo() {\n ..." 232 STRING@[24; 52) "\"\n fn foo() {\n ..."
@@ -234,7 +234,7 @@ EXPR_STMT@[16; 58)
234 WHITESPACE@[53; 54) " " 234 WHITESPACE@[53; 54) " "
235 STRING@[54; 56) "\"\"" 235 STRING@[54; 56) "\"\""
236 R_PAREN@[56; 57) ")" 236 R_PAREN@[56; 57) ")"
237 SEMI@[57; 58) ";" 237 SEMICOLON@[57; 58) ";"
238"# 238"#
239 .trim() 239 .trim()
240 ); 240 );
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs
index 71d2bcb04..f55cd3bf5 100644
--- a/crates/ra_ide/src/typing.rs
+++ b/crates/ra_ide/src/typing.rs
@@ -63,7 +63,7 @@ fn on_char_typed_inner(
63fn on_eq_typed(file: &SourceFile, offset: TextUnit) -> Option<SingleFileChange> { 63fn on_eq_typed(file: &SourceFile, offset: TextUnit) -> Option<SingleFileChange> {
64 assert_eq!(file.syntax().text().char_at(offset), Some('=')); 64 assert_eq!(file.syntax().text().char_at(offset), Some('='));
65 let let_stmt: ast::LetStmt = find_node_at_offset(file.syntax(), offset)?; 65 let let_stmt: ast::LetStmt = find_node_at_offset(file.syntax(), offset)?;
66 if let_stmt.semi_token().is_some() { 66 if let_stmt.semicolon_token().is_some() {
67 return None; 67 return None;
68 } 68 }
69 if let Some(expr) = let_stmt.initializer() { 69 if let Some(expr) = let_stmt.initializer() {
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index e9934844e..49a8c74fb 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -216,7 +216,7 @@ pub fn classify_name_ref(
216 } 216 }
217 } 217 }
218 218
219 if let Some(record_field) = ast::RecordField::cast(parent.clone()) { 219 if let Some(record_field) = ast::RecordField::for_field_name(name_ref) {
220 tested_by!(goto_def_for_record_fields; force); 220 tested_by!(goto_def_for_record_fields; force);
221 tested_by!(goto_def_for_field_init_shorthand; force); 221 tested_by!(goto_def_for_field_init_shorthand; force);
222 if let Some((field, local)) = sema.resolve_record_field(&record_field) { 222 if let Some((field, local)) = sema.resolve_record_field(&record_field) {
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index 8e8ae2b29..9fb5cb058 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -137,21 +137,23 @@ impl TokenMap {
137 token_id: tt::TokenId, 137 token_id: tt::TokenId,
138 open_relative_range: TextRange, 138 open_relative_range: TextRange,
139 close_relative_range: TextRange, 139 close_relative_range: TextRange,
140 ) { 140 ) -> usize {
141 let res = self.entries.len();
141 self.entries 142 self.entries
142 .push((token_id, TokenTextRange::Delimiter(open_relative_range, close_relative_range))); 143 .push((token_id, TokenTextRange::Delimiter(open_relative_range, close_relative_range)));
144 res
143 } 145 }
144 146
145 fn update_close_delim(&mut self, token_id: tt::TokenId, close_relative_range: TextRange) { 147 fn update_close_delim(&mut self, idx: usize, close_relative_range: TextRange) {
146 if let Some(entry) = self.entries.iter_mut().find(|(tid, _)| *tid == token_id) { 148 let (_, token_text_range) = &mut self.entries[idx];
147 if let TokenTextRange::Delimiter(dim, _) = entry.1 { 149 if let TokenTextRange::Delimiter(dim, _) = token_text_range {
148 entry.1 = TokenTextRange::Delimiter(dim, close_relative_range); 150 *token_text_range = TokenTextRange::Delimiter(*dim, close_relative_range);
149 }
150 } 151 }
151 } 152 }
152 153
153 fn remove_delim(&mut self, token_id: tt::TokenId) { 154 fn remove_delim(&mut self, idx: usize) {
154 self.entries.retain(|(tid, _)| *tid != token_id); 155 // FIXME: This could be accidently quadratic
156 self.entries.remove(idx);
155 } 157 }
156} 158}
157 159
@@ -238,24 +240,24 @@ impl TokenIdAlloc {
238 token_id 240 token_id
239 } 241 }
240 242
241 fn open_delim(&mut self, open_abs_range: TextRange) -> tt::TokenId { 243 fn open_delim(&mut self, open_abs_range: TextRange) -> (tt::TokenId, usize) {
242 let token_id = tt::TokenId(self.next_id); 244 let token_id = tt::TokenId(self.next_id);
243 self.next_id += 1; 245 self.next_id += 1;
244 self.map.insert_delim( 246 let idx = self.map.insert_delim(
245 token_id, 247 token_id,
246 open_abs_range - self.global_offset, 248 open_abs_range - self.global_offset,
247 open_abs_range - self.global_offset, 249 open_abs_range - self.global_offset,
248 ); 250 );
249 token_id 251 (token_id, idx)
250 } 252 }
251 253
252 fn close_delim(&mut self, id: tt::TokenId, close_abs_range: Option<TextRange>) { 254 fn close_delim(&mut self, idx: usize, close_abs_range: Option<TextRange>) {
253 match close_abs_range { 255 match close_abs_range {
254 None => { 256 None => {
255 self.map.remove_delim(id); 257 self.map.remove_delim(idx);
256 } 258 }
257 Some(close) => { 259 Some(close) => {
258 self.map.update_close_delim(id, close - self.global_offset); 260 self.map.update_close_delim(idx, close - self.global_offset);
259 } 261 }
260 } 262 }
261 } 263 }
@@ -322,7 +324,7 @@ trait TokenConvertor {
322 324
323 if let Some((kind, closed)) = delim { 325 if let Some((kind, closed)) = delim {
324 let mut subtree = tt::Subtree::default(); 326 let mut subtree = tt::Subtree::default();
325 let id = self.id_alloc().open_delim(range); 327 let (id, idx) = self.id_alloc().open_delim(range);
326 subtree.delimiter = Some(tt::Delimiter { kind, id }); 328 subtree.delimiter = Some(tt::Delimiter { kind, id });
327 329
328 while self.peek().map(|it| it.kind() != closed).unwrap_or(false) { 330 while self.peek().map(|it| it.kind() != closed).unwrap_or(false) {
@@ -331,7 +333,7 @@ trait TokenConvertor {
331 let last_range = match self.bump() { 333 let last_range = match self.bump() {
332 None => { 334 None => {
333 // For error resilience, we insert an char punct for the opening delim here 335 // For error resilience, we insert an char punct for the opening delim here
334 self.id_alloc().close_delim(id, None); 336 self.id_alloc().close_delim(idx, None);
335 let leaf: tt::Leaf = tt::Punct { 337 let leaf: tt::Leaf = tt::Punct {
336 id: self.id_alloc().alloc(range), 338 id: self.id_alloc().alloc(range),
337 char: token.to_char().unwrap(), 339 char: token.to_char().unwrap(),
@@ -344,7 +346,7 @@ trait TokenConvertor {
344 } 346 }
345 Some(it) => it.1, 347 Some(it) => it.1,
346 }; 348 };
347 self.id_alloc().close_delim(id, Some(last_range)); 349 self.id_alloc().close_delim(idx, Some(last_range));
348 subtree.into() 350 subtree.into()
349 } else { 351 } else {
350 let spacing = match self.peek() { 352 let spacing = match self.peek() {
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs
index 1ef6f6eed..5d1274d21 100644
--- a/crates/ra_mbe/src/tests.rs
+++ b/crates/ra_mbe/src/tests.rs
@@ -252,7 +252,7 @@ fn test_expr_order() {
252 STAR@[11; 12) "*" 252 STAR@[11; 12) "*"
253 LITERAL@[12; 13) 253 LITERAL@[12; 13)
254 INT_NUMBER@[12; 13) "2" 254 INT_NUMBER@[12; 13) "2"
255 SEMI@[13; 14) ";" 255 SEMICOLON@[13; 14) ";"
256 R_CURLY@[14; 15) "}""#, 256 R_CURLY@[14; 15) "}""#,
257 ); 257 );
258} 258}
@@ -605,7 +605,7 @@ fn test_tt_to_stmts() {
605 EQ@[4; 5) "=" 605 EQ@[4; 5) "="
606 LITERAL@[5; 6) 606 LITERAL@[5; 6)
607 INT_NUMBER@[5; 6) "0" 607 INT_NUMBER@[5; 6) "0"
608 SEMI@[6; 7) ";" 608 SEMICOLON@[6; 7) ";"
609 EXPR_STMT@[7; 14) 609 EXPR_STMT@[7; 14)
610 BIN_EXPR@[7; 13) 610 BIN_EXPR@[7; 13)
611 PATH_EXPR@[7; 8) 611 PATH_EXPR@[7; 8)
@@ -620,7 +620,7 @@ fn test_tt_to_stmts() {
620 PLUS@[11; 12) "+" 620 PLUS@[11; 12) "+"
621 LITERAL@[12; 13) 621 LITERAL@[12; 13)
622 INT_NUMBER@[12; 13) "1" 622 INT_NUMBER@[12; 13) "1"
623 SEMI@[13; 14) ";" 623 SEMICOLON@[13; 14) ";"
624 EXPR_STMT@[14; 15) 624 EXPR_STMT@[14; 15)
625 PATH_EXPR@[14; 15) 625 PATH_EXPR@[14; 15)
626 PATH@[14; 15) 626 PATH@[14; 15)
@@ -953,7 +953,7 @@ fn test_tt_composite2() {
953 PATH_SEGMENT@[0; 3) 953 PATH_SEGMENT@[0; 3)
954 NAME_REF@[0; 3) 954 NAME_REF@[0; 3)
955 IDENT@[0; 3) "abs" 955 IDENT@[0; 3) "abs"
956 EXCL@[3; 4) "!" 956 BANG@[3; 4) "!"
957 TOKEN_TREE@[4; 10) 957 TOKEN_TREE@[4; 10)
958 L_PAREN@[4; 5) "(" 958 L_PAREN@[4; 5) "("
959 EQ@[5; 6) "=" 959 EQ@[5; 6) "="
@@ -1073,14 +1073,14 @@ fn test_vec() {
1073 PATH_SEGMENT@[9; 12) 1073 PATH_SEGMENT@[9; 12)
1074 NAME_REF@[9; 12) 1074 NAME_REF@[9; 12)
1075 IDENT@[9; 12) "Vec" 1075 IDENT@[9; 12) "Vec"
1076 COLONCOLON@[12; 14) "::" 1076 COLON2@[12; 14) "::"
1077 PATH_SEGMENT@[14; 17) 1077 PATH_SEGMENT@[14; 17)
1078 NAME_REF@[14; 17) 1078 NAME_REF@[14; 17)
1079 IDENT@[14; 17) "new" 1079 IDENT@[14; 17) "new"
1080 ARG_LIST@[17; 19) 1080 ARG_LIST@[17; 19)
1081 L_PAREN@[17; 18) "(" 1081 L_PAREN@[17; 18) "("
1082 R_PAREN@[18; 19) ")" 1082 R_PAREN@[18; 19) ")"
1083 SEMI@[19; 20) ";" 1083 SEMICOLON@[19; 20) ";"
1084 EXPR_STMT@[20; 33) 1084 EXPR_STMT@[20; 33)
1085 METHOD_CALL_EXPR@[20; 32) 1085 METHOD_CALL_EXPR@[20; 32)
1086 PATH_EXPR@[20; 21) 1086 PATH_EXPR@[20; 21)
@@ -1096,7 +1096,7 @@ fn test_vec() {
1096 LITERAL@[27; 31) 1096 LITERAL@[27; 31)
1097 INT_NUMBER@[27; 31) "1u32" 1097 INT_NUMBER@[27; 31) "1u32"
1098 R_PAREN@[31; 32) ")" 1098 R_PAREN@[31; 32) ")"
1099 SEMI@[32; 33) ";" 1099 SEMICOLON@[32; 33) ";"
1100 EXPR_STMT@[33; 43) 1100 EXPR_STMT@[33; 43)
1101 METHOD_CALL_EXPR@[33; 42) 1101 METHOD_CALL_EXPR@[33; 42)
1102 PATH_EXPR@[33; 34) 1102 PATH_EXPR@[33; 34)
@@ -1112,7 +1112,7 @@ fn test_vec() {
1112 LITERAL@[40; 41) 1112 LITERAL@[40; 41)
1113 INT_NUMBER@[40; 41) "2" 1113 INT_NUMBER@[40; 41) "2"
1114 R_PAREN@[41; 42) ")" 1114 R_PAREN@[41; 42) ")"
1115 SEMI@[42; 43) ";" 1115 SEMICOLON@[42; 43) ";"
1116 PATH_EXPR@[43; 44) 1116 PATH_EXPR@[43; 44)
1117 PATH@[43; 44) 1117 PATH@[43; 44)
1118 PATH_SEGMENT@[43; 44) 1118 PATH_SEGMENT@[43; 44)
@@ -1760,7 +1760,7 @@ fn test_no_space_after_semi_colon() {
1760 MOD_KW@[21; 24) "mod" 1760 MOD_KW@[21; 24) "mod"
1761 NAME@[24; 25) 1761 NAME@[24; 25)
1762 IDENT@[24; 25) "m" 1762 IDENT@[24; 25) "m"
1763 SEMI@[25; 26) ";" 1763 SEMICOLON@[25; 26) ";"
1764 MODULE@[26; 52) 1764 MODULE@[26; 52)
1765 ATTR@[26; 47) 1765 ATTR@[26; 47)
1766 POUND@[26; 27) "#" 1766 POUND@[26; 27) "#"
@@ -1779,7 +1779,7 @@ fn test_no_space_after_semi_colon() {
1779 MOD_KW@[47; 50) "mod" 1779 MOD_KW@[47; 50) "mod"
1780 NAME@[50; 51) 1780 NAME@[50; 51)
1781 IDENT@[50; 51) "f" 1781 IDENT@[50; 51) "f"
1782 SEMI@[51; 52) ";""###, 1782 SEMICOLON@[51; 52) ";""###,
1783 ); 1783 );
1784} 1784}
1785 1785
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs
index c486c0211..cb30b25a8 100644
--- a/crates/ra_parser/src/grammar/expressions.rs
+++ b/crates/ra_parser/src/grammar/expressions.rs
@@ -339,7 +339,8 @@ fn expr_bp(p: &mut Parser, mut r: Restrictions, bp: u8) -> (Option<CompletedMark
339 (Some(lhs), BlockLike::NotBlock) 339 (Some(lhs), BlockLike::NotBlock)
340} 340}
341 341
342const LHS_FIRST: TokenSet = atom::ATOM_EXPR_FIRST.union(token_set![AMP, STAR, EXCL, DOT, MINUS]); 342const LHS_FIRST: TokenSet =
343 atom::ATOM_EXPR_FIRST.union(token_set![T![&], T![*], T![!], T![.], T![-]]);
343 344
344fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> { 345fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> {
345 let m; 346 let m;
@@ -618,26 +619,39 @@ pub(crate) fn record_field_list(p: &mut Parser) {
618 let m = p.start(); 619 let m = p.start();
619 p.bump(T!['{']); 620 p.bump(T!['{']);
620 while !p.at(EOF) && !p.at(T!['}']) { 621 while !p.at(EOF) && !p.at(T!['}']) {
622 let m = p.start();
623 // test record_literal_field_with_attr
624 // fn main() {
625 // S { #[cfg(test)] field: 1 }
626 // }
627 attributes::outer_attributes(p);
628
621 match p.current() { 629 match p.current() {
622 // test record_literal_field_with_attr 630 IDENT | INT_NUMBER => {
623 // fn main() { 631 // test_err record_literal_before_ellipsis_recovery
624 // S { #[cfg(test)] field: 1 } 632 // fn main() {
625 // } 633 // S { field ..S::default() }
626 IDENT | INT_NUMBER | T![#] => { 634 // }
627 let m = p.start(); 635 if p.nth_at(1, T![:]) || p.nth_at(1, T![..]) {
628 attributes::outer_attributes(p); 636 name_ref_or_index(p);
629 name_ref_or_index(p); 637 p.expect(T![:]);
630 if p.eat(T![:]) {
631 expr(p);
632 } 638 }
639 expr(p);
633 m.complete(p, RECORD_FIELD); 640 m.complete(p, RECORD_FIELD);
634 } 641 }
635 T![.] if p.at(T![..]) => { 642 T![.] if p.at(T![..]) => {
643 m.abandon(p);
636 p.bump(T![..]); 644 p.bump(T![..]);
637 expr(p); 645 expr(p);
638 } 646 }
639 T!['{'] => error_block(p, "expected a field"), 647 T!['{'] => {
640 _ => p.err_and_bump("expected identifier"), 648 error_block(p, "expected a field");
649 m.abandon(p);
650 }
651 _ => {
652 p.err_and_bump("expected identifier");
653 m.abandon(p);
654 }
641 } 655 }
642 if !p.at(T!['}']) { 656 if !p.at(T!['}']) {
643 p.expect(T![,]); 657 p.expect(T![,]);
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs
index 386969d2d..fe1a039cb 100644
--- a/crates/ra_parser/src/grammar/types.rs
+++ b/crates/ra_parser/src/grammar/types.rs
@@ -3,8 +3,19 @@
3use super::*; 3use super::*;
4 4
5pub(super) const TYPE_FIRST: TokenSet = paths::PATH_FIRST.union(token_set![ 5pub(super) const TYPE_FIRST: TokenSet = paths::PATH_FIRST.union(token_set![
6 L_PAREN, EXCL, STAR, L_BRACK, AMP, UNDERSCORE, FN_KW, UNSAFE_KW, EXTERN_KW, FOR_KW, IMPL_KW, 6 T!['('],
7 DYN_KW, L_ANGLE, 7 T!['['],
8 T![<],
9 T![!],
10 T![*],
11 T![&],
12 T![_],
13 T![fn],
14 T![unsafe],
15 T![extern],
16 T![for],
17 T![impl],
18 T![dyn],
8]); 19]);
9 20
10const TYPE_RECOVERY_SET: TokenSet = token_set![R_PAREN, COMMA, L_DOLLAR]; 21const TYPE_RECOVERY_SET: TokenSet = token_set![R_PAREN, COMMA, L_DOLLAR];
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 004f4e564..524e7d784 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -9,7 +9,7 @@ pub enum SyntaxKind {
9 TOMBSTONE, 9 TOMBSTONE,
10 #[doc(hidden)] 10 #[doc(hidden)]
11 EOF, 11 EOF,
12 SEMI, 12 SEMICOLON,
13 COMMA, 13 COMMA,
14 L_PAREN, 14 L_PAREN,
15 R_PAREN, 15 R_PAREN,
@@ -33,15 +33,15 @@ pub enum SyntaxKind {
33 PERCENT, 33 PERCENT,
34 UNDERSCORE, 34 UNDERSCORE,
35 DOT, 35 DOT,
36 DOTDOT, 36 DOT2,
37 DOTDOTDOT, 37 DOT3,
38 DOTDOTEQ, 38 DOT2EQ,
39 COLON, 39 COLON,
40 COLONCOLON, 40 COLON2,
41 EQ, 41 EQ,
42 EQEQ, 42 EQ2,
43 FAT_ARROW, 43 FAT_ARROW,
44 EXCL, 44 BANG,
45 NEQ, 45 NEQ,
46 MINUS, 46 MINUS,
47 THIN_ARROW, 47 THIN_ARROW,
@@ -55,8 +55,8 @@ pub enum SyntaxKind {
55 SLASHEQ, 55 SLASHEQ,
56 STAREQ, 56 STAREQ,
57 PERCENTEQ, 57 PERCENTEQ,
58 AMPAMP, 58 AMP2,
59 PIPEPIPE, 59 PIPE2,
60 SHL, 60 SHL,
61 SHR, 61 SHR,
62 SHLEQ, 62 SHLEQ,
@@ -265,12 +265,12 @@ impl SyntaxKind {
265 } 265 }
266 pub fn is_punct(self) -> bool { 266 pub fn is_punct(self) -> bool {
267 match self { 267 match self {
268 SEMI | COMMA | L_PAREN | R_PAREN | L_CURLY | R_CURLY | L_BRACK | R_BRACK | L_ANGLE 268 SEMICOLON | COMMA | L_PAREN | R_PAREN | L_CURLY | R_CURLY | L_BRACK | R_BRACK
269 | R_ANGLE | AT | POUND | TILDE | QUESTION | DOLLAR | AMP | PIPE | PLUS | STAR 269 | L_ANGLE | R_ANGLE | AT | POUND | TILDE | QUESTION | DOLLAR | AMP | PIPE | PLUS
270 | SLASH | CARET | PERCENT | UNDERSCORE | DOT | DOTDOT | DOTDOTDOT | DOTDOTEQ 270 | STAR | SLASH | CARET | PERCENT | UNDERSCORE | DOT | DOT2 | DOT3 | DOT2EQ | COLON
271 | COLON | COLONCOLON | EQ | EQEQ | FAT_ARROW | EXCL | NEQ | MINUS | THIN_ARROW 271 | COLON2 | EQ | EQ2 | FAT_ARROW | BANG | NEQ | MINUS | THIN_ARROW | LTEQ | GTEQ
272 | LTEQ | GTEQ | PLUSEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ 272 | PLUSEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ | PERCENTEQ | AMP2
273 | PERCENTEQ | AMPAMP | PIPEPIPE | SHL | SHR | SHLEQ | SHREQ => true, 273 | PIPE2 | SHL | SHR | SHLEQ | SHREQ => true,
274 _ => false, 274 _ => false,
275 } 275 }
276 } 276 }
@@ -329,7 +329,7 @@ impl SyntaxKind {
329 } 329 }
330 pub fn from_char(c: char) -> Option<SyntaxKind> { 330 pub fn from_char(c: char) -> Option<SyntaxKind> {
331 let tok = match c { 331 let tok = match c {
332 ';' => SEMI, 332 ';' => SEMICOLON,
333 ',' => COMMA, 333 ',' => COMMA,
334 '(' => L_PAREN, 334 '(' => L_PAREN,
335 ')' => R_PAREN, 335 ')' => R_PAREN,
@@ -355,7 +355,7 @@ impl SyntaxKind {
355 '.' => DOT, 355 '.' => DOT,
356 ':' => COLON, 356 ':' => COLON,
357 '=' => EQ, 357 '=' => EQ,
358 '!' => EXCL, 358 '!' => BANG,
359 '-' => MINUS, 359 '-' => MINUS,
360 _ => return None, 360 _ => return None,
361 }; 361 };
@@ -363,296 +363,4 @@ impl SyntaxKind {
363 } 363 }
364} 364}
365#[macro_export] 365#[macro_export]
366macro_rules! T { 366macro_rules ! T { [ ; ] => { $ crate :: SyntaxKind :: SEMICOLON } ; [ , ] => { $ crate :: SyntaxKind :: COMMA } ; [ '(' ] => { $ crate :: SyntaxKind :: L_PAREN } ; [ ')' ] => { $ crate :: SyntaxKind :: R_PAREN } ; [ '{' ] => { $ crate :: SyntaxKind :: L_CURLY } ; [ '}' ] => { $ crate :: SyntaxKind :: R_CURLY } ; [ '[' ] => { $ crate :: SyntaxKind :: L_BRACK } ; [ ']' ] => { $ crate :: SyntaxKind :: R_BRACK } ; [ < ] => { $ crate :: SyntaxKind :: L_ANGLE } ; [ > ] => { $ crate :: SyntaxKind :: R_ANGLE } ; [ @ ] => { $ crate :: SyntaxKind :: AT } ; [ # ] => { $ crate :: SyntaxKind :: POUND } ; [ ~ ] => { $ crate :: SyntaxKind :: TILDE } ; [ ? ] => { $ crate :: SyntaxKind :: QUESTION } ; [ $ ] => { $ crate :: SyntaxKind :: DOLLAR } ; [ & ] => { $ crate :: SyntaxKind :: AMP } ; [ | ] => { $ crate :: SyntaxKind :: PIPE } ; [ + ] => { $ crate :: SyntaxKind :: PLUS } ; [ * ] => { $ crate :: SyntaxKind :: STAR } ; [ / ] => { $ crate :: SyntaxKind :: SLASH } ; [ ^ ] => { $ crate :: SyntaxKind :: CARET } ; [ % ] => { $ crate :: SyntaxKind :: PERCENT } ; [ _ ] => { $ crate :: SyntaxKind :: UNDERSCORE } ; [ . ] => { $ crate :: SyntaxKind :: DOT } ; [ .. ] => { $ crate :: SyntaxKind :: DOT2 } ; [ ... ] => { $ crate :: SyntaxKind :: DOT3 } ; [ ..= ] => { $ crate :: SyntaxKind :: DOT2EQ } ; [ : ] => { $ crate :: SyntaxKind :: COLON } ; [ :: ] => { $ crate :: SyntaxKind :: COLON2 } ; [ = ] => { $ crate :: SyntaxKind :: EQ } ; [ == ] => { $ crate :: SyntaxKind :: EQ2 } ; [ => ] => { $ crate :: SyntaxKind :: FAT_ARROW } ; [ ! ] => { $ crate :: SyntaxKind :: BANG } ; [ != ] => { $ crate :: SyntaxKind :: NEQ } ; [ - ] => { $ crate :: SyntaxKind :: MINUS } ; [ -> ] => { $ crate :: SyntaxKind :: THIN_ARROW } ; [ <= ] => { $ crate :: SyntaxKind :: LTEQ } ; [ >= ] => { $ crate :: SyntaxKind :: GTEQ } ; [ += ] => { $ crate :: SyntaxKind :: PLUSEQ } ; [ -= ] => { $ crate :: SyntaxKind :: MINUSEQ } ; [ |= ] => { $ crate :: SyntaxKind :: PIPEEQ } ; [ &= ] => { $ crate :: SyntaxKind :: AMPEQ } ; [ ^= ] => { $ crate :: SyntaxKind :: CARETEQ } ; [ /= ] => { $ crate :: SyntaxKind :: SLASHEQ } ; [ *= ] => { $ crate :: SyntaxKind :: STAREQ } ; [ %= ] => { $ crate :: SyntaxKind :: PERCENTEQ } ; [ && ] => { $ crate :: SyntaxKind :: AMP2 } ; [ || ] => { $ crate :: SyntaxKind :: PIPE2 } ; [ << ] => { $ crate :: SyntaxKind :: SHL } ; [ >> ] => { $ crate :: SyntaxKind :: SHR } ; [ <<= ] => { $ crate :: SyntaxKind :: SHLEQ } ; [ >>= ] => { $ crate :: SyntaxKind :: SHREQ } ; [ as ] => { $ crate :: SyntaxKind :: AS_KW } ; [ async ] => { $ crate :: SyntaxKind :: ASYNC_KW } ; [ await ] => { $ crate :: SyntaxKind :: AWAIT_KW } ; [ box ] => { $ crate :: SyntaxKind :: BOX_KW } ; [ break ] => { $ crate :: SyntaxKind :: BREAK_KW } ; [ const ] => { $ crate :: SyntaxKind :: CONST_KW } ; [ continue ] => { $ crate :: SyntaxKind :: CONTINUE_KW } ; [ crate ] => { $ crate :: SyntaxKind :: CRATE_KW } ; [ dyn ] => { $ crate :: SyntaxKind :: DYN_KW } ; [ else ] => { $ crate :: SyntaxKind :: ELSE_KW } ; [ enum ] => { $ crate :: SyntaxKind :: ENUM_KW } ; [ extern ] => { $ crate :: SyntaxKind :: EXTERN_KW } ; [ false ] => { $ crate :: SyntaxKind :: FALSE_KW } ; [ fn ] => { $ crate :: SyntaxKind :: FN_KW } ; [ for ] => { $ crate :: SyntaxKind :: FOR_KW } ; [ if ] => { $ crate :: SyntaxKind :: IF_KW } ; [ impl ] => { $ crate :: SyntaxKind :: IMPL_KW } ; [ in ] => { $ crate :: SyntaxKind :: IN_KW } ; [ let ] => { $ crate :: SyntaxKind :: LET_KW } ; [ loop ] => { $ crate :: SyntaxKind :: LOOP_KW } ; [ macro ] => { $ crate :: SyntaxKind :: MACRO_KW } ; [ match ] => { $ crate :: SyntaxKind :: MATCH_KW } ; [ mod ] => { $ crate :: SyntaxKind :: MOD_KW } ; [ move ] => { $ crate :: SyntaxKind :: MOVE_KW } ; [ mut ] => { $ crate :: SyntaxKind :: MUT_KW } ; [ pub ] => { $ crate :: SyntaxKind :: PUB_KW } ; [ ref ] => { $ crate :: SyntaxKind :: REF_KW } ; [ return ] => { $ crate :: SyntaxKind :: RETURN_KW } ; [ self ] => { $ crate :: SyntaxKind :: SELF_KW } ; [ static ] => { $ crate :: SyntaxKind :: STATIC_KW } ; [ struct ] => { $ crate :: SyntaxKind :: STRUCT_KW } ; [ super ] => { $ crate :: SyntaxKind :: SUPER_KW } ; [ trait ] => { $ crate :: SyntaxKind :: TRAIT_KW } ; [ true ] => { $ crate :: SyntaxKind :: TRUE_KW } ; [ try ] => { $ crate :: SyntaxKind :: TRY_KW } ; [ type ] => { $ crate :: SyntaxKind :: TYPE_KW } ; [ unsafe ] => { $ crate :: SyntaxKind :: UNSAFE_KW } ; [ use ] => { $ crate :: SyntaxKind :: USE_KW } ; [ where ] => { $ crate :: SyntaxKind :: WHERE_KW } ; [ while ] => { $ crate :: SyntaxKind :: WHILE_KW } ; [ auto ] => { $ crate :: SyntaxKind :: AUTO_KW } ; [ default ] => { $ crate :: SyntaxKind :: DEFAULT_KW } ; [ existential ] => { $ crate :: SyntaxKind :: EXISTENTIAL_KW } ; [ union ] => { $ crate :: SyntaxKind :: UNION_KW } ; [ raw ] => { $ crate :: SyntaxKind :: RAW_KW } ; [ lifetime ] => { $ crate :: SyntaxKind :: LIFETIME } ; [ ident ] => { $ crate :: SyntaxKind :: IDENT } ; }
367 ( ; ) => {
368 $crate::SyntaxKind::SEMI
369 };
370 ( , ) => {
371 $crate::SyntaxKind::COMMA
372 };
373 ( '(' ) => {
374 $crate::SyntaxKind::L_PAREN
375 };
376 ( ')' ) => {
377 $crate::SyntaxKind::R_PAREN
378 };
379 ( '{' ) => {
380 $crate::SyntaxKind::L_CURLY
381 };
382 ( '}' ) => {
383 $crate::SyntaxKind::R_CURLY
384 };
385 ( '[' ) => {
386 $crate::SyntaxKind::L_BRACK
387 };
388 ( ']' ) => {
389 $crate::SyntaxKind::R_BRACK
390 };
391 ( < ) => {
392 $crate::SyntaxKind::L_ANGLE
393 };
394 ( > ) => {
395 $crate::SyntaxKind::R_ANGLE
396 };
397 ( @ ) => {
398 $crate::SyntaxKind::AT
399 };
400 ( # ) => {
401 $crate::SyntaxKind::POUND
402 };
403 ( ~ ) => {
404 $crate::SyntaxKind::TILDE
405 };
406 ( ? ) => {
407 $crate::SyntaxKind::QUESTION
408 };
409 ( $ ) => {
410 $crate::SyntaxKind::DOLLAR
411 };
412 ( & ) => {
413 $crate::SyntaxKind::AMP
414 };
415 ( | ) => {
416 $crate::SyntaxKind::PIPE
417 };
418 ( + ) => {
419 $crate::SyntaxKind::PLUS
420 };
421 ( * ) => {
422 $crate::SyntaxKind::STAR
423 };
424 ( / ) => {
425 $crate::SyntaxKind::SLASH
426 };
427 ( ^ ) => {
428 $crate::SyntaxKind::CARET
429 };
430 ( % ) => {
431 $crate::SyntaxKind::PERCENT
432 };
433 ( _ ) => {
434 $crate::SyntaxKind::UNDERSCORE
435 };
436 ( . ) => {
437 $crate::SyntaxKind::DOT
438 };
439 ( .. ) => {
440 $crate::SyntaxKind::DOTDOT
441 };
442 ( ... ) => {
443 $crate::SyntaxKind::DOTDOTDOT
444 };
445 ( ..= ) => {
446 $crate::SyntaxKind::DOTDOTEQ
447 };
448 ( : ) => {
449 $crate::SyntaxKind::COLON
450 };
451 ( :: ) => {
452 $crate::SyntaxKind::COLONCOLON
453 };
454 ( = ) => {
455 $crate::SyntaxKind::EQ
456 };
457 ( == ) => {
458 $crate::SyntaxKind::EQEQ
459 };
460 ( => ) => {
461 $crate::SyntaxKind::FAT_ARROW
462 };
463 ( ! ) => {
464 $crate::SyntaxKind::EXCL
465 };
466 ( != ) => {
467 $crate::SyntaxKind::NEQ
468 };
469 ( - ) => {
470 $crate::SyntaxKind::MINUS
471 };
472 ( -> ) => {
473 $crate::SyntaxKind::THIN_ARROW
474 };
475 ( <= ) => {
476 $crate::SyntaxKind::LTEQ
477 };
478 ( >= ) => {
479 $crate::SyntaxKind::GTEQ
480 };
481 ( += ) => {
482 $crate::SyntaxKind::PLUSEQ
483 };
484 ( -= ) => {
485 $crate::SyntaxKind::MINUSEQ
486 };
487 ( |= ) => {
488 $crate::SyntaxKind::PIPEEQ
489 };
490 ( &= ) => {
491 $crate::SyntaxKind::AMPEQ
492 };
493 ( ^= ) => {
494 $crate::SyntaxKind::CARETEQ
495 };
496 ( /= ) => {
497 $crate::SyntaxKind::SLASHEQ
498 };
499 ( *= ) => {
500 $crate::SyntaxKind::STAREQ
501 };
502 ( %= ) => {
503 $crate::SyntaxKind::PERCENTEQ
504 };
505 ( && ) => {
506 $crate::SyntaxKind::AMPAMP
507 };
508 ( || ) => {
509 $crate::SyntaxKind::PIPEPIPE
510 };
511 ( << ) => {
512 $crate::SyntaxKind::SHL
513 };
514 ( >> ) => {
515 $crate::SyntaxKind::SHR
516 };
517 ( <<= ) => {
518 $crate::SyntaxKind::SHLEQ
519 };
520 ( >>= ) => {
521 $crate::SyntaxKind::SHREQ
522 };
523 ( as ) => {
524 $crate::SyntaxKind::AS_KW
525 };
526 ( async ) => {
527 $crate::SyntaxKind::ASYNC_KW
528 };
529 ( await ) => {
530 $crate::SyntaxKind::AWAIT_KW
531 };
532 ( box ) => {
533 $crate::SyntaxKind::BOX_KW
534 };
535 ( break ) => {
536 $crate::SyntaxKind::BREAK_KW
537 };
538 ( const ) => {
539 $crate::SyntaxKind::CONST_KW
540 };
541 ( continue ) => {
542 $crate::SyntaxKind::CONTINUE_KW
543 };
544 ( crate ) => {
545 $crate::SyntaxKind::CRATE_KW
546 };
547 ( dyn ) => {
548 $crate::SyntaxKind::DYN_KW
549 };
550 ( else ) => {
551 $crate::SyntaxKind::ELSE_KW
552 };
553 ( enum ) => {
554 $crate::SyntaxKind::ENUM_KW
555 };
556 ( extern ) => {
557 $crate::SyntaxKind::EXTERN_KW
558 };
559 ( false ) => {
560 $crate::SyntaxKind::FALSE_KW
561 };
562 ( fn ) => {
563 $crate::SyntaxKind::FN_KW
564 };
565 ( for ) => {
566 $crate::SyntaxKind::FOR_KW
567 };
568 ( if ) => {
569 $crate::SyntaxKind::IF_KW
570 };
571 ( impl ) => {
572 $crate::SyntaxKind::IMPL_KW
573 };
574 ( in ) => {
575 $crate::SyntaxKind::IN_KW
576 };
577 ( let ) => {
578 $crate::SyntaxKind::LET_KW
579 };
580 ( loop ) => {
581 $crate::SyntaxKind::LOOP_KW
582 };
583 ( macro ) => {
584 $crate::SyntaxKind::MACRO_KW
585 };
586 ( match ) => {
587 $crate::SyntaxKind::MATCH_KW
588 };
589 ( mod ) => {
590 $crate::SyntaxKind::MOD_KW
591 };
592 ( move ) => {
593 $crate::SyntaxKind::MOVE_KW
594 };
595 ( mut ) => {
596 $crate::SyntaxKind::MUT_KW
597 };
598 ( pub ) => {
599 $crate::SyntaxKind::PUB_KW
600 };
601 ( ref ) => {
602 $crate::SyntaxKind::REF_KW
603 };
604 ( return ) => {
605 $crate::SyntaxKind::RETURN_KW
606 };
607 ( self ) => {
608 $crate::SyntaxKind::SELF_KW
609 };
610 ( static ) => {
611 $crate::SyntaxKind::STATIC_KW
612 };
613 ( struct ) => {
614 $crate::SyntaxKind::STRUCT_KW
615 };
616 ( super ) => {
617 $crate::SyntaxKind::SUPER_KW
618 };
619 ( trait ) => {
620 $crate::SyntaxKind::TRAIT_KW
621 };
622 ( true ) => {
623 $crate::SyntaxKind::TRUE_KW
624 };
625 ( try ) => {
626 $crate::SyntaxKind::TRY_KW
627 };
628 ( type ) => {
629 $crate::SyntaxKind::TYPE_KW
630 };
631 ( unsafe ) => {
632 $crate::SyntaxKind::UNSAFE_KW
633 };
634 ( use ) => {
635 $crate::SyntaxKind::USE_KW
636 };
637 ( where ) => {
638 $crate::SyntaxKind::WHERE_KW
639 };
640 ( while ) => {
641 $crate::SyntaxKind::WHILE_KW
642 };
643 ( auto ) => {
644 $crate::SyntaxKind::AUTO_KW
645 };
646 ( default ) => {
647 $crate::SyntaxKind::DEFAULT_KW
648 };
649 ( existential ) => {
650 $crate::SyntaxKind::EXISTENTIAL_KW
651 };
652 ( union ) => {
653 $crate::SyntaxKind::UNION_KW
654 };
655 ( raw ) => {
656 $crate::SyntaxKind::RAW_KW
657 };
658}
diff --git a/crates/ra_proc_macro_srv/Cargo.toml b/crates/ra_proc_macro_srv/Cargo.toml
index f08de5fc7..1e0f50339 100644
--- a/crates/ra_proc_macro_srv/Cargo.toml
+++ b/crates/ra_proc_macro_srv/Cargo.toml
@@ -12,9 +12,12 @@ doctest = false
12ra_tt = { path = "../ra_tt" } 12ra_tt = { path = "../ra_tt" }
13ra_mbe = { path = "../ra_mbe" } 13ra_mbe = { path = "../ra_mbe" }
14ra_proc_macro = { path = "../ra_proc_macro" } 14ra_proc_macro = { path = "../ra_proc_macro" }
15goblin = "0.2.1"
16libloading = "0.6.0"
17test_utils = { path = "../test_utils" }
15 18
16[dev-dependencies] 19[dev-dependencies]
17cargo_metadata = "0.9.1" 20cargo_metadata = "0.9.1"
18difference = "2.0.0" 21difference = "2.0.0"
19# used as proc macro test target 22# used as proc macro test target
20serde_derive = "=1.0.104" \ No newline at end of file 23serde_derive = "=1.0.104"
diff --git a/crates/ra_proc_macro_srv/src/dylib.rs b/crates/ra_proc_macro_srv/src/dylib.rs
new file mode 100644
index 000000000..ec63d587b
--- /dev/null
+++ b/crates/ra_proc_macro_srv/src/dylib.rs
@@ -0,0 +1,211 @@
1//! Handles dynamic library loading for proc macro
2
3use crate::{proc_macro::bridge, rustc_server::TokenStream};
4use std::path::Path;
5
6use goblin::{mach::Mach, Object};
7use libloading::Library;
8use ra_proc_macro::ProcMacroKind;
9
10use std::io::Error as IoError;
11use std::io::ErrorKind as IoErrorKind;
12
13const NEW_REGISTRAR_SYMBOL: &str = "_rustc_proc_macro_decls_";
14
15fn invalid_data_err(e: impl Into<Box<dyn std::error::Error + Send + Sync>>) -> IoError {
16 IoError::new(IoErrorKind::InvalidData, e)
17}
18
19fn get_symbols_from_lib(file: &Path) -> Result<Vec<String>, IoError> {
20 let buffer = std::fs::read(file)?;
21 let object = Object::parse(&buffer).map_err(invalid_data_err)?;
22
23 match object {
24 Object::Elf(elf) => {
25 let symbols = elf.dynstrtab.to_vec().map_err(invalid_data_err)?;
26 let names = symbols.iter().map(|s| s.to_string()).collect();
27 Ok(names)
28 }
29 Object::PE(pe) => {
30 let symbol_names =
31 pe.exports.iter().flat_map(|s| s.name).map(|n| n.to_string()).collect();
32 Ok(symbol_names)
33 }
34 Object::Mach(mach) => match mach {
35 Mach::Binary(binary) => {
36 let exports = binary.exports().map_err(invalid_data_err)?;
37 let names = exports
38 .into_iter()
39 .map(|s| {
40 // In macos doc:
41 // https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dlsym.3.html
42 // Unlike other dyld API's, the symbol name passed to dlsym() must NOT be
43 // prepended with an underscore.
44 if s.name.starts_with("_") {
45 s.name[1..].to_string()
46 } else {
47 s.name
48 }
49 })
50 .collect();
51 Ok(names)
52 }
53 Mach::Fat(_) => Ok(vec![]),
54 },
55 Object::Archive(_) | Object::Unknown(_) => Ok(vec![]),
56 }
57}
58
59fn is_derive_registrar_symbol(symbol: &str) -> bool {
60 symbol.contains(NEW_REGISTRAR_SYMBOL)
61}
62
63fn find_registrar_symbol(file: &Path) -> Result<Option<String>, IoError> {
64 let symbols = get_symbols_from_lib(file)?;
65 Ok(symbols.into_iter().find(|s| is_derive_registrar_symbol(s)))
66}
67
68/// Loads dynamic library in platform dependent manner.
69///
70/// For unix, you have to use RTLD_DEEPBIND flag to escape problems described
71/// [here](https://github.com/fedochet/rust-proc-macro-panic-inside-panic-expample)
72/// and [here](https://github.com/rust-lang/rust/issues/60593).
73///
74/// Usage of RTLD_DEEPBIND
75/// [here](https://github.com/fedochet/rust-proc-macro-panic-inside-panic-expample/issues/1)
76///
77/// It seems that on Windows that behaviour is default, so we do nothing in that case.
78#[cfg(windows)]
79fn load_library(file: &Path) -> Result<Library, libloading::Error> {
80 Library::new(file)
81}
82
83#[cfg(unix)]
84fn load_library(file: &Path) -> Result<Library, libloading::Error> {
85 use libloading::os::unix::Library as UnixLibrary;
86 use std::os::raw::c_int;
87
88 const RTLD_NOW: c_int = 0x00002;
89 const RTLD_DEEPBIND: c_int = 0x00008;
90
91 UnixLibrary::open(Some(file), RTLD_NOW | RTLD_DEEPBIND).map(|lib| lib.into())
92}
93
94struct ProcMacroLibraryLibloading {
95 // Hold the dylib to prevent it for unloadeding
96 _lib: Library,
97 exported_macros: Vec<bridge::client::ProcMacro>,
98}
99
100impl ProcMacroLibraryLibloading {
101 fn open(file: &Path) -> Result<Self, IoError> {
102 let symbol_name = find_registrar_symbol(file)?
103 .ok_or(invalid_data_err(format!("Cannot find registrar symbol in file {:?}", file)))?;
104
105 let lib = load_library(file).map_err(invalid_data_err)?;
106 let exported_macros = {
107 let macros: libloading::Symbol<&&[bridge::client::ProcMacro]> =
108 unsafe { lib.get(symbol_name.as_bytes()) }.map_err(invalid_data_err)?;
109 macros.to_vec()
110 };
111
112 Ok(ProcMacroLibraryLibloading { _lib: lib, exported_macros })
113 }
114}
115
116type ProcMacroLibraryImpl = ProcMacroLibraryLibloading;
117
118pub struct Expander {
119 libs: Vec<ProcMacroLibraryImpl>,
120}
121
122impl Expander {
123 pub fn new<P: AsRef<Path>>(lib: &P) -> Result<Expander, String> {
124 let mut libs = vec![];
125 /* Some libraries for dynamic loading require canonicalized path (even when it is
126 already absolute
127 */
128 let lib =
129 lib.as_ref().canonicalize().expect(&format!("Cannot canonicalize {:?}", lib.as_ref()));
130
131 let library = ProcMacroLibraryImpl::open(&lib).map_err(|e| e.to_string())?;
132 libs.push(library);
133
134 Ok(Expander { libs })
135 }
136
137 pub fn expand(
138 &self,
139 macro_name: &str,
140 macro_body: &ra_tt::Subtree,
141 attributes: Option<&ra_tt::Subtree>,
142 ) -> Result<ra_tt::Subtree, bridge::PanicMessage> {
143 let parsed_body = TokenStream::with_subtree(macro_body.clone());
144
145 let parsed_attributes = attributes
146 .map_or(crate::rustc_server::TokenStream::new(), |attr| {
147 TokenStream::with_subtree(attr.clone())
148 });
149
150 for lib in &self.libs {
151 for proc_macro in &lib.exported_macros {
152 match proc_macro {
153 bridge::client::ProcMacro::CustomDerive { trait_name, client, .. }
154 if *trait_name == macro_name =>
155 {
156 let res = client.run(
157 &crate::proc_macro::bridge::server::SameThread,
158 crate::rustc_server::Rustc::default(),
159 parsed_body,
160 );
161 return res.map(|it| it.subtree);
162 }
163 bridge::client::ProcMacro::Bang { name, client } if *name == macro_name => {
164 let res = client.run(
165 &crate::proc_macro::bridge::server::SameThread,
166 crate::rustc_server::Rustc::default(),
167 parsed_body,
168 );
169 return res.map(|it| it.subtree);
170 }
171 bridge::client::ProcMacro::Attr { name, client } if *name == macro_name => {
172 let res = client.run(
173 &crate::proc_macro::bridge::server::SameThread,
174 crate::rustc_server::Rustc::default(),
175 parsed_attributes,
176 parsed_body,
177 );
178
179 return res.map(|it| it.subtree);
180 }
181 _ => continue,
182 }
183 }
184 }
185
186 Err(bridge::PanicMessage::String("Nothing to expand".to_string()))
187 }
188
189 pub fn list_macros(&self) -> Result<Vec<(String, ProcMacroKind)>, bridge::PanicMessage> {
190 let mut result = vec![];
191
192 for lib in &self.libs {
193 for proc_macro in &lib.exported_macros {
194 let res = match proc_macro {
195 bridge::client::ProcMacro::CustomDerive { trait_name, .. } => {
196 (trait_name.to_string(), ProcMacroKind::CustomDerive)
197 }
198 bridge::client::ProcMacro::Bang { name, .. } => {
199 (name.to_string(), ProcMacroKind::FuncLike)
200 }
201 bridge::client::ProcMacro::Attr { name, .. } => {
202 (name.to_string(), ProcMacroKind::Attr)
203 }
204 };
205 result.push(res);
206 }
207 }
208
209 Ok(result)
210 }
211}
diff --git a/crates/ra_proc_macro_srv/src/lib.rs b/crates/ra_proc_macro_srv/src/lib.rs
index f376df236..59716cbb3 100644
--- a/crates/ra_proc_macro_srv/src/lib.rs
+++ b/crates/ra_proc_macro_srv/src/lib.rs
@@ -17,13 +17,41 @@ mod proc_macro;
17#[doc(hidden)] 17#[doc(hidden)]
18mod rustc_server; 18mod rustc_server;
19 19
20mod dylib;
21
20use proc_macro::bridge::client::TokenStream; 22use proc_macro::bridge::client::TokenStream;
21use ra_proc_macro::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTask}; 23use ra_proc_macro::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTask};
22 24
23pub fn expand_task(_task: &ExpansionTask) -> Result<ExpansionResult, String> { 25pub fn expand_task(task: &ExpansionTask) -> Result<ExpansionResult, String> {
24 unimplemented!() 26 let expander = dylib::Expander::new(&task.lib)
27 .expect(&format!("Cannot expand with provided libraries: ${:?}", &task.lib));
28
29 match expander.expand(&task.macro_name, &task.macro_body, task.attributes.as_ref()) {
30 Ok(expansion) => Ok(ExpansionResult { expansion }),
31 Err(msg) => {
32 let reason = format!(
33 "Cannot perform expansion for {}: error {:?}!",
34 &task.macro_name,
35 msg.as_str()
36 );
37 Err(reason)
38 }
39 }
25} 40}
26 41
27pub fn list_macros(_task: &ListMacrosTask) -> Result<ListMacrosResult, String> { 42pub fn list_macros(task: &ListMacrosTask) -> Result<ListMacrosResult, String> {
28 unimplemented!() 43 let expander = dylib::Expander::new(&task.lib)
44 .expect(&format!("Cannot expand with provided libraries: ${:?}", &task.lib));
45
46 match expander.list_macros() {
47 Ok(macros) => Ok(ListMacrosResult { macros }),
48 Err(msg) => {
49 let reason =
50 format!("Cannot perform expansion for {:?}: error {:?}!", &task.lib, msg.as_str());
51 Err(reason)
52 }
53 }
29} 54}
55
56#[cfg(test)]
57mod tests;
diff --git a/crates/ra_proc_macro_srv/src/rustc_server.rs b/crates/ra_proc_macro_srv/src/rustc_server.rs
index 92d1fd989..ec0d35692 100644
--- a/crates/ra_proc_macro_srv/src/rustc_server.rs
+++ b/crates/ra_proc_macro_srv/src/rustc_server.rs
@@ -34,6 +34,10 @@ impl TokenStream {
34 TokenStream { subtree: Default::default() } 34 TokenStream { subtree: Default::default() }
35 } 35 }
36 36
37 pub fn with_subtree(subtree: tt::Subtree) -> Self {
38 TokenStream { subtree }
39 }
40
37 pub fn is_empty(&self) -> bool { 41 pub fn is_empty(&self) -> bool {
38 self.subtree.token_trees.is_empty() 42 self.subtree.token_trees.is_empty()
39 } 43 }
diff --git a/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
new file mode 100644
index 000000000..24507d98d
--- /dev/null
+++ b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
@@ -0,0 +1,188 @@
1SUBTREE $
2 PUNCH # [alone] 4294967295
3 SUBTREE [] 4294967295
4 IDENT allow 4294967295
5 SUBTREE () 4294967295
6 IDENT non_upper_case_globals 4294967295
7 PUNCH , [alone] 4294967295
8 IDENT unused_attributes 4294967295
9 PUNCH , [alone] 4294967295
10 IDENT unused_qualifications 4294967295
11 IDENT const 4294967295
12 IDENT _IMPL_SERIALIZE_FOR_Foo 4294967295
13 PUNCH : [alone] 4294967295
14 SUBTREE () 4294967295
15 PUNCH = [alone] 4294967295
16 SUBTREE {} 4294967295
17 PUNCH # [alone] 4294967295
18 SUBTREE [] 4294967295
19 IDENT allow 4294967295
20 SUBTREE () 4294967295
21 IDENT unknown_lints 4294967295
22 PUNCH # [alone] 4294967295
23 SUBTREE [] 4294967295
24 IDENT cfg_attr 4294967295
25 SUBTREE () 4294967295
26 IDENT feature 4294967295
27 PUNCH = [alone] 4294967295
28 SUBTREE $
29 LITERAL "cargo-clippy" 0
30 PUNCH , [alone] 4294967295
31 IDENT allow 4294967295
32 SUBTREE () 4294967295
33 IDENT useless_attribute 4294967295
34 PUNCH # [alone] 4294967295
35 SUBTREE [] 4294967295
36 IDENT allow 4294967295
37 SUBTREE () 4294967295
38 IDENT rust_2018_idioms 4294967295
39 IDENT extern 4294967295
40 IDENT crate 4294967295
41 IDENT serde 4294967295
42 IDENT as 4294967295
43 IDENT _serde 4294967295
44 PUNCH ; [alone] 4294967295
45 PUNCH # [alone] 4294967295
46 SUBTREE [] 4294967295
47 IDENT allow 4294967295
48 SUBTREE () 4294967295
49 IDENT unused_macros 4294967295
50 IDENT macro_rules 4294967295
51 PUNCH ! [alone] 4294967295
52 IDENT try 4294967295
53 SUBTREE {} 4294967295
54 SUBTREE () 4294967295
55 PUNCH $ [alone] 4294967295
56 IDENT __expr 4294967295
57 PUNCH : [alone] 4294967295
58 IDENT expr 4294967295
59 PUNCH = [joint] 4294967295
60 PUNCH > [alone] 4294967295
61 SUBTREE {} 4294967295
62 IDENT match 4294967295
63 PUNCH $ [alone] 4294967295
64 IDENT __expr 4294967295
65 SUBTREE {} 4294967295
66 IDENT _serde 4294967295
67 PUNCH : [joint] 4294967295
68 PUNCH : [alone] 4294967295
69 IDENT export 4294967295
70 PUNCH : [joint] 4294967295
71 PUNCH : [alone] 4294967295
72 IDENT Ok 4294967295
73 SUBTREE () 4294967295
74 IDENT __val 4294967295
75 PUNCH = [joint] 4294967295
76 PUNCH > [alone] 4294967295
77 IDENT __val 4294967295
78 PUNCH , [alone] 4294967295
79 IDENT _serde 4294967295
80 PUNCH : [joint] 4294967295
81 PUNCH : [alone] 4294967295
82 IDENT export 4294967295
83 PUNCH : [joint] 4294967295
84 PUNCH : [alone] 4294967295
85 IDENT Err 4294967295
86 SUBTREE () 4294967295
87 IDENT __err 4294967295
88 PUNCH = [joint] 4294967295
89 PUNCH > [alone] 4294967295
90 SUBTREE {} 4294967295
91 IDENT return 4294967295
92 IDENT _serde 4294967295
93 PUNCH : [joint] 4294967295
94 PUNCH : [alone] 4294967295
95 IDENT export 4294967295
96 PUNCH : [joint] 4294967295
97 PUNCH : [alone] 4294967295
98 IDENT Err 4294967295
99 SUBTREE () 4294967295
100 IDENT __err 4294967295
101 PUNCH ; [alone] 4294967295
102 PUNCH # [alone] 4294967295
103 SUBTREE [] 4294967295
104 IDENT automatically_derived 4294967295
105 IDENT impl 4294967295
106 IDENT _serde 4294967295
107 PUNCH : [joint] 4294967295
108 PUNCH : [alone] 4294967295
109 IDENT Serialize 4294967295
110 IDENT for 4294967295
111 IDENT Foo 1
112 SUBTREE {} 4294967295
113 IDENT fn 4294967295
114 IDENT serialize 4294967295
115 PUNCH < [alone] 4294967295
116 IDENT __S 4294967295
117 PUNCH > [alone] 4294967295
118 SUBTREE () 4294967295
119 PUNCH & [alone] 4294967295
120 IDENT self 4294967295
121 PUNCH , [alone] 4294967295
122 IDENT __serializer 4294967295
123 PUNCH : [alone] 4294967295
124 IDENT __S 4294967295
125 PUNCH - [joint] 4294967295
126 PUNCH > [alone] 4294967295
127 IDENT _serde 4294967295
128 PUNCH : [joint] 4294967295
129 PUNCH : [alone] 4294967295
130 IDENT export 4294967295
131 PUNCH : [joint] 4294967295
132 PUNCH : [alone] 4294967295
133 IDENT Result 4294967295
134 PUNCH < [alone] 4294967295
135 IDENT __S 4294967295
136 PUNCH : [joint] 4294967295
137 PUNCH : [alone] 4294967295
138 IDENT Ok 4294967295
139 PUNCH , [alone] 4294967295
140 IDENT __S 4294967295
141 PUNCH : [joint] 4294967295
142 PUNCH : [alone] 4294967295
143 IDENT Error 4294967295
144 PUNCH > [alone] 4294967295
145 IDENT where 4294967295
146 IDENT __S 4294967295
147 PUNCH : [alone] 4294967295
148 IDENT _serde 4294967295
149 PUNCH : [joint] 4294967295
150 PUNCH : [alone] 4294967295
151 IDENT Serializer 4294967295
152 PUNCH , [alone] 4294967295
153 SUBTREE {} 4294967295
154 IDENT let 4294967295
155 IDENT __serde_state 4294967295
156 PUNCH = [alone] 4294967295
157 IDENT try 4294967295
158 PUNCH ! [alone] 4294967295
159 SUBTREE () 4294967295
160 IDENT _serde 4294967295
161 PUNCH : [joint] 4294967295
162 PUNCH : [alone] 4294967295
163 IDENT Serializer 4294967295
164 PUNCH : [joint] 4294967295
165 PUNCH : [alone] 4294967295
166 IDENT serialize_struct 4294967295
167 SUBTREE () 4294967295
168 IDENT __serializer 4294967295
169 PUNCH , [alone] 4294967295
170 LITERAL "Foo" 4294967295
171 PUNCH , [alone] 4294967295
172 IDENT false 4294967295
173 IDENT as 4294967295
174 IDENT usize 4294967295
175 PUNCH ; [alone] 4294967295
176 IDENT _serde 4294967295
177 PUNCH : [joint] 4294967295
178 PUNCH : [alone] 4294967295
179 IDENT ser 4294967295
180 PUNCH : [joint] 4294967295
181 PUNCH : [alone] 4294967295
182 IDENT SerializeStruct 4294967295
183 PUNCH : [joint] 4294967295
184 PUNCH : [alone] 4294967295
185 IDENT end 4294967295
186 SUBTREE () 4294967295
187 IDENT __serde_state 4294967295
188 PUNCH ; [alone] 4294967295 \ No newline at end of file
diff --git a/crates/ra_proc_macro_srv/src/tests/mod.rs b/crates/ra_proc_macro_srv/src/tests/mod.rs
new file mode 100644
index 000000000..03f79bc5d
--- /dev/null
+++ b/crates/ra_proc_macro_srv/src/tests/mod.rs
@@ -0,0 +1,47 @@
1//! proc-macro tests
2
3#[macro_use]
4mod utils;
5use test_utils::assert_eq_text;
6use utils::*;
7
8#[test]
9fn test_derive_serialize_proc_macro() {
10 assert_expand(
11 "serde_derive",
12 "Serialize",
13 "1.0.104",
14 r##"struct Foo {}"##,
15 include_str!("fixtures/test_serialize_proc_macro.txt"),
16 );
17}
18
19#[test]
20fn test_derive_serialize_proc_macro_failed() {
21 assert_expand(
22 "serde_derive",
23 "Serialize",
24 "1.0.104",
25 r##"
26 struct {}
27"##,
28 r##"
29SUBTREE $
30 IDENT compile_error 4294967295
31 PUNCH ! [alone] 4294967295
32 SUBTREE {} 4294967295
33 LITERAL "expected identifier" 4294967295
34"##,
35 );
36}
37
38#[test]
39fn test_derive_proc_macro_list() {
40 let res = list("serde_derive", "1.0.104").join("\n");
41
42 assert_eq_text!(
43 &res,
44 r#"Serialize [CustomDerive]
45Deserialize [CustomDerive]"#
46 );
47}
diff --git a/crates/ra_proc_macro_srv/src/tests/utils.rs b/crates/ra_proc_macro_srv/src/tests/utils.rs
new file mode 100644
index 000000000..1ee409449
--- /dev/null
+++ b/crates/ra_proc_macro_srv/src/tests/utils.rs
@@ -0,0 +1,65 @@
1//! utils used in proc-macro tests
2
3use crate::dylib;
4use crate::list_macros;
5pub use difference::Changeset as __Changeset;
6use ra_proc_macro::ListMacrosTask;
7use std::str::FromStr;
8use test_utils::assert_eq_text;
9
10mod fixtures {
11 use cargo_metadata::{parse_messages, Message};
12 use std::process::Command;
13
14 // Use current project metadata to get the proc-macro dylib path
15 pub fn dylib_path(crate_name: &str, version: &str) -> std::path::PathBuf {
16 let command = Command::new("cargo")
17 .args(&["check", "--message-format", "json"])
18 .output()
19 .unwrap()
20 .stdout;
21
22 for message in parse_messages(command.as_slice()) {
23 match message.unwrap() {
24 Message::CompilerArtifact(artifact) => {
25 if artifact.target.kind.contains(&"proc-macro".to_string()) {
26 let repr = format!("{} {}", crate_name, version);
27 if artifact.package_id.repr.starts_with(&repr) {
28 return artifact.filenames[0].clone();
29 }
30 }
31 }
32 _ => (), // Unknown message
33 }
34 }
35
36 panic!("No proc-macro dylib for {} found!", crate_name);
37 }
38}
39
40fn parse_string(code: &str) -> Option<crate::rustc_server::TokenStream> {
41 Some(crate::rustc_server::TokenStream::from_str(code).unwrap())
42}
43
44pub fn assert_expand(
45 crate_name: &str,
46 macro_name: &str,
47 version: &str,
48 fixture: &str,
49 expect: &str,
50) {
51 let path = fixtures::dylib_path(crate_name, version);
52 let expander = dylib::Expander::new(&path).unwrap();
53 let fixture = parse_string(fixture).unwrap();
54
55 let res = expander.expand(macro_name, &fixture.subtree, None).unwrap();
56 assert_eq_text!(&format!("{:?}", res), &expect.trim());
57}
58
59pub fn list(crate_name: &str, version: &str) -> Vec<String> {
60 let path = fixtures::dylib_path(crate_name, version);
61 let task = ListMacrosTask { lib: path };
62
63 let res = list_macros(&task).unwrap();
64 res.macros.into_iter().map(|(name, kind)| format!("{} [{:?}]", name, kind)).collect()
65}
diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs
index 00ea3a9b0..2d4f68f5e 100644
--- a/crates/ra_prof/src/lib.rs
+++ b/crates/ra_prof/src/lib.rs
@@ -113,21 +113,6 @@ pub fn profile(label: Label) -> Profiler {
113 }) 113 })
114} 114}
115 115
116pub fn print_time(label: Label) -> impl Drop {
117 struct Guard {
118 label: Label,
119 start: Instant,
120 }
121
122 impl Drop for Guard {
123 fn drop(&mut self) {
124 eprintln!("{}: {:?}", self.label, self.start.elapsed())
125 }
126 }
127
128 Guard { label, start: Instant::now() }
129}
130
131pub struct Profiler { 116pub struct Profiler {
132 label: Option<Label>, 117 label: Option<Label>,
133 detail: Option<String>, 118 detail: Option<String>,
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index 1ee60e74c..99c6b7219 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -80,7 +80,7 @@ impl<N: AstNode> Iterator for AstChildren<N> {
80} 80}
81 81
82mod support { 82mod support {
83 use super::{AstChildren, AstNode, AstToken, SyntaxKind, SyntaxNode, SyntaxToken}; 83 use super::{AstChildren, AstNode, SyntaxKind, SyntaxNode, SyntaxToken};
84 84
85 pub(super) fn child<N: AstNode>(parent: &SyntaxNode) -> Option<N> { 85 pub(super) fn child<N: AstNode>(parent: &SyntaxNode) -> Option<N> {
86 parent.children().find_map(N::cast) 86 parent.children().find_map(N::cast)
@@ -90,11 +90,7 @@ mod support {
90 AstChildren::new(parent) 90 AstChildren::new(parent)
91 } 91 }
92 92
93 pub(super) fn token<T: AstToken>(parent: &SyntaxNode) -> Option<T> { 93 pub(super) fn token(parent: &SyntaxNode, kind: SyntaxKind) -> Option<SyntaxToken> {
94 parent.children_with_tokens().filter_map(|it| it.into_token()).find_map(T::cast)
95 }
96
97 pub(super) fn token2(parent: &SyntaxNode, kind: SyntaxKind) -> Option<SyntaxToken> {
98 parent.children_with_tokens().filter_map(|it| it.into_token()).find(|it| it.kind() == kind) 94 parent.children_with_tokens().filter_map(|it| it.into_token()).find(|it| it.kind() == kind)
99 } 95 }
100} 96}
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index 3d428fab3..9e5411ee5 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -32,9 +32,9 @@ impl ast::FnDef {
32 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new(); 32 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new();
33 let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() { 33 let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() {
34 old_body.syntax().clone().into() 34 old_body.syntax().clone().into()
35 } else if let Some(semi) = self.semi_token() { 35 } else if let Some(semi) = self.semicolon_token() {
36 to_insert.push(make::tokens::single_space().into()); 36 to_insert.push(make::tokens::single_space().into());
37 semi.syntax.clone().into() 37 semi.into()
38 } else { 38 } else {
39 to_insert.push(make::tokens::single_space().into()); 39 to_insert.push(make::tokens::single_space().into());
40 to_insert.push(body.syntax().clone().into()); 40 to_insert.push(body.syntax().clone().into());
@@ -98,7 +98,7 @@ impl ast::ItemList {
98 None => match self.l_curly_token() { 98 None => match self.l_curly_token() {
99 Some(it) => ( 99 Some(it) => (
100 " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(), 100 " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(),
101 InsertPosition::After(it.syntax().clone().into()), 101 InsertPosition::After(it.into()),
102 ), 102 ),
103 None => return self.clone(), 103 None => return self.clone(),
104 }, 104 },
@@ -142,7 +142,7 @@ impl ast::RecordFieldList {
142 macro_rules! after_l_curly { 142 macro_rules! after_l_curly {
143 () => {{ 143 () => {{
144 let anchor = match self.l_curly_token() { 144 let anchor = match self.l_curly_token() {
145 Some(it) => it.syntax().clone().into(), 145 Some(it) => it.into(),
146 None => return self.clone(), 146 None => return self.clone(),
147 }; 147 };
148 InsertPosition::After(anchor) 148 InsertPosition::After(anchor)
@@ -189,15 +189,15 @@ impl ast::RecordFieldList {
189impl ast::TypeParam { 189impl ast::TypeParam {
190 #[must_use] 190 #[must_use]
191 pub fn remove_bounds(&self) -> ast::TypeParam { 191 pub fn remove_bounds(&self) -> ast::TypeParam {
192 let colon = match self.colon() { 192 let colon = match self.colon_token() {
193 Some(it) => it, 193 Some(it) => it,
194 None => return self.clone(), 194 None => return self.clone(),
195 }; 195 };
196 let end = match self.type_bound_list() { 196 let end = match self.type_bound_list() {
197 Some(it) => it.syntax().clone().into(), 197 Some(it) => it.syntax().clone().into(),
198 None => colon.syntax().clone().into(), 198 None => colon.clone().into(),
199 }; 199 };
200 self.replace_children(colon.syntax().clone().into()..=end, iter::empty()) 200 self.replace_children(colon.into()..=end, iter::empty())
201 } 201 }
202} 202}
203 203
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index 11ec70bc0..63e272fbf 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -5,7 +5,7 @@ use itertools::Itertools;
5use ra_parser::SyntaxKind; 5use ra_parser::SyntaxKind;
6 6
7use crate::{ 7use crate::{
8 ast::{self, support, AstNode, AstToken, AttrInput, NameOwner, SyntaxNode}, 8 ast::{self, support, AstNode, AttrInput, NameOwner, SyntaxNode},
9 SmolStr, SyntaxElement, SyntaxToken, T, 9 SmolStr, SyntaxElement, SyntaxToken, T,
10}; 10};
11 11
@@ -21,11 +21,7 @@ impl ast::NameRef {
21 } 21 }
22 22
23 pub fn as_tuple_field(&self) -> Option<usize> { 23 pub fn as_tuple_field(&self) -> Option<usize> {
24 if let Some(ast::NameRefToken::IntNumber(token)) = self.name_ref_token_token() { 24 self.text().parse().ok()
25 token.text().as_str().parse().ok()
26 } else {
27 None
28 }
29 } 25 }
30} 26}
31 27
@@ -81,7 +77,7 @@ impl ast::Attr {
81 first_token.and_then(|token| token.next_token()).as_ref().map(SyntaxToken::kind); 77 first_token.and_then(|token| token.next_token()).as_ref().map(SyntaxToken::kind);
82 78
83 match (first_token_kind, second_token_kind) { 79 match (first_token_kind, second_token_kind) {
84 (Some(SyntaxKind::POUND), Some(SyntaxKind::EXCL)) => AttrKind::Inner, 80 (Some(SyntaxKind::POUND), Some(T![!])) => AttrKind::Inner,
85 _ => AttrKind::Outer, 81 _ => AttrKind::Outer,
86 } 82 }
87 } 83 }
@@ -191,6 +187,36 @@ impl ast::StructDef {
191 } 187 }
192} 188}
193 189
190impl ast::RecordField {
191 pub fn for_field_name(field_name: &ast::NameRef) -> Option<ast::RecordField> {
192 let candidate =
193 field_name.syntax().parent().and_then(ast::RecordField::cast).or_else(|| {
194 field_name.syntax().ancestors().nth(4).and_then(ast::RecordField::cast)
195 })?;
196 if candidate.field_name().as_ref() == Some(field_name) {
197 Some(candidate)
198 } else {
199 None
200 }
201 }
202
203 /// Deals with field init shorthand
204 pub fn field_name(&self) -> Option<ast::NameRef> {
205 if let Some(name_ref) = self.name_ref() {
206 return Some(name_ref);
207 }
208 if let Some(ast::Expr::PathExpr(expr)) = self.expr() {
209 let path = expr.path()?;
210 let segment = path.segment()?;
211 let name_ref = segment.name_ref()?;
212 if path.qualifier().is_none() {
213 return Some(name_ref);
214 }
215 }
216 None
217 }
218}
219
194impl ast::EnumVariant { 220impl ast::EnumVariant {
195 pub fn parent_enum(&self) -> ast::EnumDef { 221 pub fn parent_enum(&self) -> ast::EnumDef {
196 self.syntax() 222 self.syntax()
@@ -279,7 +305,7 @@ pub enum SelfParamKind {
279impl ast::SelfParam { 305impl ast::SelfParam {
280 pub fn kind(&self) -> SelfParamKind { 306 pub fn kind(&self) -> SelfParamKind {
281 if self.amp_token().is_some() { 307 if self.amp_token().is_some() {
282 if self.amp_mut_token().is_some() { 308 if self.mut_token().is_some() {
283 SelfParamKind::MutRef 309 SelfParamKind::MutRef
284 } else { 310 } else {
285 SelfParamKind::Ref 311 SelfParamKind::Ref
@@ -288,24 +314,6 @@ impl ast::SelfParam {
288 SelfParamKind::Owned 314 SelfParamKind::Owned
289 } 315 }
290 } 316 }
291
292 /// the "mut" in "mut self", not the one in "&mut self"
293 pub fn mut_token(&self) -> Option<SyntaxToken> {
294 self.syntax()
295 .children_with_tokens()
296 .filter_map(|it| it.into_token())
297 .take_while(|it| it.kind() != T![&])
298 .find(|it| it.kind() == T![mut])
299 }
300
301 /// the "mut" in "&mut self", not the one in "mut self"
302 pub fn amp_mut_token(&self) -> Option<SyntaxToken> {
303 self.syntax()
304 .children_with_tokens()
305 .filter_map(|it| it.into_token())
306 .skip_while(|it| it.kind() != T![&])
307 .find(|it| it.kind() == T![mut])
308 }
309} 317}
310 318
311#[derive(Clone, Debug, PartialEq, Eq, Hash)] 319#[derive(Clone, Debug, PartialEq, Eq, Hash)]
@@ -315,7 +323,7 @@ pub enum TypeBoundKind {
315 /// for<'a> ... 323 /// for<'a> ...
316 ForType(ast::ForType), 324 ForType(ast::ForType),
317 /// 'a 325 /// 'a
318 Lifetime(ast::Lifetime), 326 Lifetime(SyntaxToken),
319} 327}
320 328
321impl ast::TypeBound { 329impl ast::TypeBound {
@@ -331,23 +339,23 @@ impl ast::TypeBound {
331 } 339 }
332 } 340 }
333 341
334 pub fn const_question_token(&self) -> Option<ast::Question> { 342 pub fn const_question_token(&self) -> Option<SyntaxToken> {
335 self.syntax() 343 self.syntax()
336 .children_with_tokens() 344 .children_with_tokens()
337 .filter_map(|it| it.into_token()) 345 .filter_map(|it| it.into_token())
338 .take_while(|it| it.kind() != T![const]) 346 .take_while(|it| it.kind() != T![const])
339 .find_map(ast::Question::cast) 347 .find(|it| it.kind() == T![?])
340 } 348 }
341 349
342 pub fn question_token(&self) -> Option<ast::Question> { 350 pub fn question_token(&self) -> Option<SyntaxToken> {
343 if self.const_token().is_some() { 351 if self.const_token().is_some() {
344 self.syntax() 352 self.syntax()
345 .children_with_tokens() 353 .children_with_tokens()
346 .filter_map(|it| it.into_token()) 354 .filter_map(|it| it.into_token())
347 .skip_while(|it| it.kind() != T![const]) 355 .skip_while(|it| it.kind() != T![const])
348 .find_map(ast::Question::cast) 356 .find(|it| it.kind() == T![?])
349 } else { 357 } else {
350 support::token(&self.syntax) 358 support::token(&self.syntax, T![?])
351 } 359 }
352 } 360 }
353} 361}
@@ -388,12 +396,12 @@ impl ast::MacroCall {
388} 396}
389 397
390impl ast::LifetimeParam { 398impl ast::LifetimeParam {
391 pub fn lifetime_bounds(&self) -> impl Iterator<Item = ast::Lifetime> { 399 pub fn lifetime_bounds(&self) -> impl Iterator<Item = SyntaxToken> {
392 self.syntax() 400 self.syntax()
393 .children_with_tokens() 401 .children_with_tokens()
394 .filter_map(|it| it.into_token()) 402 .filter_map(|it| it.into_token())
395 .skip_while(|x| x.kind() != T![:]) 403 .skip_while(|x| x.kind() != T![:])
396 .filter_map(ast::Lifetime::cast) 404 .filter(|it| it.kind() == T![lifetime])
397 } 405 }
398} 406}
399 407
@@ -401,7 +409,7 @@ impl ast::RangePat {
401 pub fn start(&self) -> Option<ast::Pat> { 409 pub fn start(&self) -> Option<ast::Pat> {
402 self.syntax() 410 self.syntax()
403 .children_with_tokens() 411 .children_with_tokens()
404 .take_while(|it| !ast::RangeSeparator::can_cast(it.kind())) 412 .take_while(|it| !(it.kind() == T![..] || it.kind() == T![..=]))
405 .filter_map(|it| it.into_node()) 413 .filter_map(|it| it.into_node())
406 .find_map(ast::Pat::cast) 414 .find_map(ast::Pat::cast)
407 } 415 }
@@ -409,18 +417,24 @@ impl ast::RangePat {
409 pub fn end(&self) -> Option<ast::Pat> { 417 pub fn end(&self) -> Option<ast::Pat> {
410 self.syntax() 418 self.syntax()
411 .children_with_tokens() 419 .children_with_tokens()
412 .skip_while(|it| !ast::RangeSeparator::can_cast(it.kind())) 420 .skip_while(|it| !(it.kind() == T![..] || it.kind() == T![..=]))
413 .filter_map(|it| it.into_node()) 421 .filter_map(|it| it.into_node())
414 .find_map(ast::Pat::cast) 422 .find_map(ast::Pat::cast)
415 } 423 }
416} 424}
417 425
418impl ast::TokenTree { 426impl ast::TokenTree {
419 pub fn left_delimiter(&self) -> Option<ast::LeftDelimiter> { 427 pub fn left_delimiter_token(&self) -> Option<SyntaxToken> {
420 self.syntax().first_child_or_token()?.into_token().and_then(ast::LeftDelimiter::cast) 428 self.syntax().first_child_or_token()?.into_token().filter(|it| match it.kind() {
421 } 429 T!['{'] | T!['('] | T!['['] => true,
422 430 _ => false,
423 pub fn right_delimiter(&self) -> Option<ast::RightDelimiter> { 431 })
424 self.syntax().last_child_or_token()?.into_token().and_then(ast::RightDelimiter::cast) 432 }
433
434 pub fn right_delimiter_token(&self) -> Option<SyntaxToken> {
435 self.syntax().last_child_or_token()?.into_token().filter(|it| match it.kind() {
436 T!['{'] | T!['('] | T!['['] => true,
437 _ => false,
438 })
425 } 439 }
426} 440}
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 20f663046..f1098755b 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -1,11 +1,11 @@
1//! Generated file, do not edit by hand, see `xtask/src/codegen` 1//! Generated file, do not edit by hand, see `xtask/src/codegen`
2 2
3use super::tokens::*;
4use crate::{ 3use crate::{
5 ast::{self, support, AstChildren, AstNode}, 4 ast::{self, support, AstChildren, AstNode},
6 SyntaxKind::{self, *}, 5 SyntaxKind::{self, *},
7 SyntaxNode, SyntaxToken, 6 SyntaxNode, SyntaxToken, T,
8}; 7};
8
9#[derive(Debug, Clone, PartialEq, Eq, Hash)] 9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
10pub struct SourceFile { 10pub struct SourceFile {
11 pub(crate) syntax: SyntaxNode, 11 pub(crate) syntax: SyntaxNode,
@@ -26,6 +26,7 @@ impl ast::AttrsOwner for SourceFile {}
26impl SourceFile { 26impl SourceFile {
27 pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) } 27 pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) }
28} 28}
29
29#[derive(Debug, Clone, PartialEq, Eq, Hash)] 30#[derive(Debug, Clone, PartialEq, Eq, Hash)]
30pub struct FnDef { 31pub struct FnDef {
31 pub(crate) syntax: SyntaxNode, 32 pub(crate) syntax: SyntaxNode,
@@ -48,16 +49,17 @@ impl ast::DocCommentsOwner for FnDef {}
48impl ast::AttrsOwner for FnDef {} 49impl ast::AttrsOwner for FnDef {}
49impl FnDef { 50impl FnDef {
50 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } 51 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
51 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) } 52 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
52 pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) } 53 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
53 pub fn async_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, ASYNC_KW) } 54 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
54 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) } 55 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
55 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FN_KW) } 56 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
56 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } 57 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
57 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } 58 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
58 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 59 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
59 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 60 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
60} 61}
62
61#[derive(Debug, Clone, PartialEq, Eq, Hash)] 63#[derive(Debug, Clone, PartialEq, Eq, Hash)]
62pub struct RetType { 64pub struct RetType {
63 pub(crate) syntax: SyntaxNode, 65 pub(crate) syntax: SyntaxNode,
@@ -74,9 +76,10 @@ impl AstNode for RetType {
74 fn syntax(&self) -> &SyntaxNode { &self.syntax } 76 fn syntax(&self) -> &SyntaxNode { &self.syntax }
75} 77}
76impl RetType { 78impl RetType {
77 pub fn thin_arrow_token(&self) -> Option<ThinArrow> { support::token(&self.syntax) } 79 pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) }
78 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 80 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
79} 81}
82
80#[derive(Debug, Clone, PartialEq, Eq, Hash)] 83#[derive(Debug, Clone, PartialEq, Eq, Hash)]
81pub struct StructDef { 84pub struct StructDef {
82 pub(crate) syntax: SyntaxNode, 85 pub(crate) syntax: SyntaxNode,
@@ -98,10 +101,11 @@ impl ast::TypeParamsOwner for StructDef {}
98impl ast::AttrsOwner for StructDef {} 101impl ast::AttrsOwner for StructDef {}
99impl ast::DocCommentsOwner for StructDef {} 102impl ast::DocCommentsOwner for StructDef {}
100impl StructDef { 103impl StructDef {
101 pub fn struct_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, STRUCT_KW) } 104 pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) }
102 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } 105 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) }
103 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 106 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
104} 107}
108
105#[derive(Debug, Clone, PartialEq, Eq, Hash)] 109#[derive(Debug, Clone, PartialEq, Eq, Hash)]
106pub struct UnionDef { 110pub struct UnionDef {
107 pub(crate) syntax: SyntaxNode, 111 pub(crate) syntax: SyntaxNode,
@@ -123,11 +127,12 @@ impl ast::TypeParamsOwner for UnionDef {}
123impl ast::AttrsOwner for UnionDef {} 127impl ast::AttrsOwner for UnionDef {}
124impl ast::DocCommentsOwner for UnionDef {} 128impl ast::DocCommentsOwner for UnionDef {}
125impl UnionDef { 129impl UnionDef {
126 pub fn union_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNION_KW) } 130 pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) }
127 pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { 131 pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> {
128 support::child(&self.syntax) 132 support::child(&self.syntax)
129 } 133 }
130} 134}
135
131#[derive(Debug, Clone, PartialEq, Eq, Hash)] 136#[derive(Debug, Clone, PartialEq, Eq, Hash)]
132pub struct RecordFieldDefList { 137pub struct RecordFieldDefList {
133 pub(crate) syntax: SyntaxNode, 138 pub(crate) syntax: SyntaxNode,
@@ -144,10 +149,11 @@ impl AstNode for RecordFieldDefList {
144 fn syntax(&self) -> &SyntaxNode { &self.syntax } 149 fn syntax(&self) -> &SyntaxNode { &self.syntax }
145} 150}
146impl RecordFieldDefList { 151impl RecordFieldDefList {
147 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } 152 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
148 pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } 153 pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) }
149 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } 154 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
150} 155}
156
151#[derive(Debug, Clone, PartialEq, Eq, Hash)] 157#[derive(Debug, Clone, PartialEq, Eq, Hash)]
152pub struct RecordFieldDef { 158pub struct RecordFieldDef {
153 pub(crate) syntax: SyntaxNode, 159 pub(crate) syntax: SyntaxNode,
@@ -169,6 +175,7 @@ impl ast::AttrsOwner for RecordFieldDef {}
169impl ast::DocCommentsOwner for RecordFieldDef {} 175impl ast::DocCommentsOwner for RecordFieldDef {}
170impl ast::TypeAscriptionOwner for RecordFieldDef {} 176impl ast::TypeAscriptionOwner for RecordFieldDef {}
171impl RecordFieldDef {} 177impl RecordFieldDef {}
178
172#[derive(Debug, Clone, PartialEq, Eq, Hash)] 179#[derive(Debug, Clone, PartialEq, Eq, Hash)]
173pub struct TupleFieldDefList { 180pub struct TupleFieldDefList {
174 pub(crate) syntax: SyntaxNode, 181 pub(crate) syntax: SyntaxNode,
@@ -185,10 +192,11 @@ impl AstNode for TupleFieldDefList {
185 fn syntax(&self) -> &SyntaxNode { &self.syntax } 192 fn syntax(&self) -> &SyntaxNode { &self.syntax }
186} 193}
187impl TupleFieldDefList { 194impl TupleFieldDefList {
188 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } 195 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
189 pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) } 196 pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) }
190 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } 197 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
191} 198}
199
192#[derive(Debug, Clone, PartialEq, Eq, Hash)] 200#[derive(Debug, Clone, PartialEq, Eq, Hash)]
193pub struct TupleFieldDef { 201pub struct TupleFieldDef {
194 pub(crate) syntax: SyntaxNode, 202 pub(crate) syntax: SyntaxNode,
@@ -209,6 +217,7 @@ impl ast::AttrsOwner for TupleFieldDef {}
209impl TupleFieldDef { 217impl TupleFieldDef {
210 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 218 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
211} 219}
220
212#[derive(Debug, Clone, PartialEq, Eq, Hash)] 221#[derive(Debug, Clone, PartialEq, Eq, Hash)]
213pub struct EnumDef { 222pub struct EnumDef {
214 pub(crate) syntax: SyntaxNode, 223 pub(crate) syntax: SyntaxNode,
@@ -230,9 +239,10 @@ impl ast::TypeParamsOwner for EnumDef {}
230impl ast::AttrsOwner for EnumDef {} 239impl ast::AttrsOwner for EnumDef {}
231impl ast::DocCommentsOwner for EnumDef {} 240impl ast::DocCommentsOwner for EnumDef {}
232impl EnumDef { 241impl EnumDef {
233 pub fn enum_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, ENUM_KW) } 242 pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) }
234 pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } 243 pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) }
235} 244}
245
236#[derive(Debug, Clone, PartialEq, Eq, Hash)] 246#[derive(Debug, Clone, PartialEq, Eq, Hash)]
237pub struct EnumVariantList { 247pub struct EnumVariantList {
238 pub(crate) syntax: SyntaxNode, 248 pub(crate) syntax: SyntaxNode,
@@ -249,10 +259,11 @@ impl AstNode for EnumVariantList {
249 fn syntax(&self) -> &SyntaxNode { &self.syntax } 259 fn syntax(&self) -> &SyntaxNode { &self.syntax }
250} 260}
251impl EnumVariantList { 261impl EnumVariantList {
252 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } 262 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
253 pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } 263 pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) }
254 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } 264 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
255} 265}
266
256#[derive(Debug, Clone, PartialEq, Eq, Hash)] 267#[derive(Debug, Clone, PartialEq, Eq, Hash)]
257pub struct EnumVariant { 268pub struct EnumVariant {
258 pub(crate) syntax: SyntaxNode, 269 pub(crate) syntax: SyntaxNode,
@@ -274,9 +285,10 @@ impl ast::DocCommentsOwner for EnumVariant {}
274impl ast::AttrsOwner for EnumVariant {} 285impl ast::AttrsOwner for EnumVariant {}
275impl EnumVariant { 286impl EnumVariant {
276 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } 287 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) }
277 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 288 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
278 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 289 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
279} 290}
291
280#[derive(Debug, Clone, PartialEq, Eq, Hash)] 292#[derive(Debug, Clone, PartialEq, Eq, Hash)]
281pub struct TraitDef { 293pub struct TraitDef {
282 pub(crate) syntax: SyntaxNode, 294 pub(crate) syntax: SyntaxNode,
@@ -299,11 +311,12 @@ impl ast::DocCommentsOwner for TraitDef {}
299impl ast::TypeParamsOwner for TraitDef {} 311impl ast::TypeParamsOwner for TraitDef {}
300impl ast::TypeBoundsOwner for TraitDef {} 312impl ast::TypeBoundsOwner for TraitDef {}
301impl TraitDef { 313impl TraitDef {
302 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) } 314 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
303 pub fn auto_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AUTO_KW) } 315 pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) }
304 pub fn trait_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TRAIT_KW) } 316 pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) }
305 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } 317 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
306} 318}
319
307#[derive(Debug, Clone, PartialEq, Eq, Hash)] 320#[derive(Debug, Clone, PartialEq, Eq, Hash)]
308pub struct Module { 321pub struct Module {
309 pub(crate) syntax: SyntaxNode, 322 pub(crate) syntax: SyntaxNode,
@@ -324,10 +337,11 @@ impl ast::NameOwner for Module {}
324impl ast::AttrsOwner for Module {} 337impl ast::AttrsOwner for Module {}
325impl ast::DocCommentsOwner for Module {} 338impl ast::DocCommentsOwner for Module {}
326impl Module { 339impl Module {
327 pub fn mod_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MOD_KW) } 340 pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) }
328 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } 341 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
329 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 342 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
330} 343}
344
331#[derive(Debug, Clone, PartialEq, Eq, Hash)] 345#[derive(Debug, Clone, PartialEq, Eq, Hash)]
332pub struct ItemList { 346pub struct ItemList {
333 pub(crate) syntax: SyntaxNode, 347 pub(crate) syntax: SyntaxNode,
@@ -345,10 +359,11 @@ impl AstNode for ItemList {
345} 359}
346impl ast::ModuleItemOwner for ItemList {} 360impl ast::ModuleItemOwner for ItemList {}
347impl ItemList { 361impl ItemList {
348 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } 362 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
349 pub fn impl_items(&self) -> AstChildren<ImplItem> { support::children(&self.syntax) } 363 pub fn impl_items(&self) -> AstChildren<ImplItem> { support::children(&self.syntax) }
350 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } 364 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
351} 365}
366
352#[derive(Debug, Clone, PartialEq, Eq, Hash)] 367#[derive(Debug, Clone, PartialEq, Eq, Hash)]
353pub struct ConstDef { 368pub struct ConstDef {
354 pub(crate) syntax: SyntaxNode, 369 pub(crate) syntax: SyntaxNode,
@@ -371,12 +386,13 @@ impl ast::AttrsOwner for ConstDef {}
371impl ast::DocCommentsOwner for ConstDef {} 386impl ast::DocCommentsOwner for ConstDef {}
372impl ast::TypeAscriptionOwner for ConstDef {} 387impl ast::TypeAscriptionOwner for ConstDef {}
373impl ConstDef { 388impl ConstDef {
374 pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) } 389 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
375 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) } 390 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
376 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 391 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
377 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 392 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
378 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 393 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
379} 394}
395
380#[derive(Debug, Clone, PartialEq, Eq, Hash)] 396#[derive(Debug, Clone, PartialEq, Eq, Hash)]
381pub struct StaticDef { 397pub struct StaticDef {
382 pub(crate) syntax: SyntaxNode, 398 pub(crate) syntax: SyntaxNode,
@@ -399,12 +415,13 @@ impl ast::AttrsOwner for StaticDef {}
399impl ast::DocCommentsOwner for StaticDef {} 415impl ast::DocCommentsOwner for StaticDef {}
400impl ast::TypeAscriptionOwner for StaticDef {} 416impl ast::TypeAscriptionOwner for StaticDef {}
401impl StaticDef { 417impl StaticDef {
402 pub fn static_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, STATIC_KW) } 418 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
403 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } 419 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
404 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 420 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
405 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 421 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
406 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 422 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
407} 423}
424
408#[derive(Debug, Clone, PartialEq, Eq, Hash)] 425#[derive(Debug, Clone, PartialEq, Eq, Hash)]
409pub struct TypeAliasDef { 426pub struct TypeAliasDef {
410 pub(crate) syntax: SyntaxNode, 427 pub(crate) syntax: SyntaxNode,
@@ -427,12 +444,13 @@ impl ast::AttrsOwner for TypeAliasDef {}
427impl ast::DocCommentsOwner for TypeAliasDef {} 444impl ast::DocCommentsOwner for TypeAliasDef {}
428impl ast::TypeBoundsOwner for TypeAliasDef {} 445impl ast::TypeBoundsOwner for TypeAliasDef {}
429impl TypeAliasDef { 446impl TypeAliasDef {
430 pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) } 447 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
431 pub fn type_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TYPE_KW) } 448 pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) }
432 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 449 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
433 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 450 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
434 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 451 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
435} 452}
453
436#[derive(Debug, Clone, PartialEq, Eq, Hash)] 454#[derive(Debug, Clone, PartialEq, Eq, Hash)]
437pub struct ImplDef { 455pub struct ImplDef {
438 pub(crate) syntax: SyntaxNode, 456 pub(crate) syntax: SyntaxNode,
@@ -451,14 +469,15 @@ impl AstNode for ImplDef {
451impl ast::TypeParamsOwner for ImplDef {} 469impl ast::TypeParamsOwner for ImplDef {}
452impl ast::AttrsOwner for ImplDef {} 470impl ast::AttrsOwner for ImplDef {}
453impl ImplDef { 471impl ImplDef {
454 pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) } 472 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
455 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) } 473 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
456 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) } 474 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
457 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IMPL_KW) } 475 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
458 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } 476 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
459 pub fn for_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FOR_KW) } 477 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
460 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } 478 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
461} 479}
480
462#[derive(Debug, Clone, PartialEq, Eq, Hash)] 481#[derive(Debug, Clone, PartialEq, Eq, Hash)]
463pub struct ParenType { 482pub struct ParenType {
464 pub(crate) syntax: SyntaxNode, 483 pub(crate) syntax: SyntaxNode,
@@ -475,10 +494,11 @@ impl AstNode for ParenType {
475 fn syntax(&self) -> &SyntaxNode { &self.syntax } 494 fn syntax(&self) -> &SyntaxNode { &self.syntax }
476} 495}
477impl ParenType { 496impl ParenType {
478 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } 497 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
479 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 498 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
480 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } 499 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
481} 500}
501
482#[derive(Debug, Clone, PartialEq, Eq, Hash)] 502#[derive(Debug, Clone, PartialEq, Eq, Hash)]
483pub struct TupleType { 503pub struct TupleType {
484 pub(crate) syntax: SyntaxNode, 504 pub(crate) syntax: SyntaxNode,
@@ -495,10 +515,11 @@ impl AstNode for TupleType {
495 fn syntax(&self) -> &SyntaxNode { &self.syntax } 515 fn syntax(&self) -> &SyntaxNode { &self.syntax }
496} 516}
497impl TupleType { 517impl TupleType {
498 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } 518 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
499 pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) } 519 pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) }
500 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } 520 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
501} 521}
522
502#[derive(Debug, Clone, PartialEq, Eq, Hash)] 523#[derive(Debug, Clone, PartialEq, Eq, Hash)]
503pub struct NeverType { 524pub struct NeverType {
504 pub(crate) syntax: SyntaxNode, 525 pub(crate) syntax: SyntaxNode,
@@ -515,8 +536,9 @@ impl AstNode for NeverType {
515 fn syntax(&self) -> &SyntaxNode { &self.syntax } 536 fn syntax(&self) -> &SyntaxNode { &self.syntax }
516} 537}
517impl NeverType { 538impl NeverType {
518 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } 539 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
519} 540}
541
520#[derive(Debug, Clone, PartialEq, Eq, Hash)] 542#[derive(Debug, Clone, PartialEq, Eq, Hash)]
521pub struct PathType { 543pub struct PathType {
522 pub(crate) syntax: SyntaxNode, 544 pub(crate) syntax: SyntaxNode,
@@ -535,6 +557,7 @@ impl AstNode for PathType {
535impl PathType { 557impl PathType {
536 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 558 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
537} 559}
560
538#[derive(Debug, Clone, PartialEq, Eq, Hash)] 561#[derive(Debug, Clone, PartialEq, Eq, Hash)]
539pub struct PointerType { 562pub struct PointerType {
540 pub(crate) syntax: SyntaxNode, 563 pub(crate) syntax: SyntaxNode,
@@ -551,11 +574,12 @@ impl AstNode for PointerType {
551 fn syntax(&self) -> &SyntaxNode { &self.syntax } 574 fn syntax(&self) -> &SyntaxNode { &self.syntax }
552} 575}
553impl PointerType { 576impl PointerType {
554 pub fn star_token(&self) -> Option<Star> { support::token(&self.syntax) } 577 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
555 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) } 578 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
556 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } 579 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
557 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 580 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
558} 581}
582
559#[derive(Debug, Clone, PartialEq, Eq, Hash)] 583#[derive(Debug, Clone, PartialEq, Eq, Hash)]
560pub struct ArrayType { 584pub struct ArrayType {
561 pub(crate) syntax: SyntaxNode, 585 pub(crate) syntax: SyntaxNode,
@@ -572,12 +596,13 @@ impl AstNode for ArrayType {
572 fn syntax(&self) -> &SyntaxNode { &self.syntax } 596 fn syntax(&self) -> &SyntaxNode { &self.syntax }
573} 597}
574impl ArrayType { 598impl ArrayType {
575 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } 599 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
576 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 600 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
577 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 601 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
578 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 602 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
579 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } 603 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
580} 604}
605
581#[derive(Debug, Clone, PartialEq, Eq, Hash)] 606#[derive(Debug, Clone, PartialEq, Eq, Hash)]
582pub struct SliceType { 607pub struct SliceType {
583 pub(crate) syntax: SyntaxNode, 608 pub(crate) syntax: SyntaxNode,
@@ -594,10 +619,11 @@ impl AstNode for SliceType {
594 fn syntax(&self) -> &SyntaxNode { &self.syntax } 619 fn syntax(&self) -> &SyntaxNode { &self.syntax }
595} 620}
596impl SliceType { 621impl SliceType {
597 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } 622 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
598 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 623 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
599 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } 624 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
600} 625}
626
601#[derive(Debug, Clone, PartialEq, Eq, Hash)] 627#[derive(Debug, Clone, PartialEq, Eq, Hash)]
602pub struct ReferenceType { 628pub struct ReferenceType {
603 pub(crate) syntax: SyntaxNode, 629 pub(crate) syntax: SyntaxNode,
@@ -614,11 +640,14 @@ impl AstNode for ReferenceType {
614 fn syntax(&self) -> &SyntaxNode { &self.syntax } 640 fn syntax(&self) -> &SyntaxNode { &self.syntax }
615} 641}
616impl ReferenceType { 642impl ReferenceType {
617 pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) } 643 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
618 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } 644 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
619 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } 645 support::token(&self.syntax, T![lifetime])
646 }
647 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
620 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 648 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
621} 649}
650
622#[derive(Debug, Clone, PartialEq, Eq, Hash)] 651#[derive(Debug, Clone, PartialEq, Eq, Hash)]
623pub struct PlaceholderType { 652pub struct PlaceholderType {
624 pub(crate) syntax: SyntaxNode, 653 pub(crate) syntax: SyntaxNode,
@@ -635,8 +664,9 @@ impl AstNode for PlaceholderType {
635 fn syntax(&self) -> &SyntaxNode { &self.syntax } 664 fn syntax(&self) -> &SyntaxNode { &self.syntax }
636} 665}
637impl PlaceholderType { 666impl PlaceholderType {
638 pub fn underscore_token(&self) -> Option<Underscore> { support::token(&self.syntax) } 667 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
639} 668}
669
640#[derive(Debug, Clone, PartialEq, Eq, Hash)] 670#[derive(Debug, Clone, PartialEq, Eq, Hash)]
641pub struct FnPointerType { 671pub struct FnPointerType {
642 pub(crate) syntax: SyntaxNode, 672 pub(crate) syntax: SyntaxNode,
@@ -654,11 +684,12 @@ impl AstNode for FnPointerType {
654} 684}
655impl FnPointerType { 685impl FnPointerType {
656 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } 686 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
657 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) } 687 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
658 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FN_KW) } 688 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
659 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } 689 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
660 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } 690 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
661} 691}
692
662#[derive(Debug, Clone, PartialEq, Eq, Hash)] 693#[derive(Debug, Clone, PartialEq, Eq, Hash)]
663pub struct ForType { 694pub struct ForType {
664 pub(crate) syntax: SyntaxNode, 695 pub(crate) syntax: SyntaxNode,
@@ -675,10 +706,11 @@ impl AstNode for ForType {
675 fn syntax(&self) -> &SyntaxNode { &self.syntax } 706 fn syntax(&self) -> &SyntaxNode { &self.syntax }
676} 707}
677impl ForType { 708impl ForType {
678 pub fn for_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FOR_KW) } 709 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
679 pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } 710 pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) }
680 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 711 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
681} 712}
713
682#[derive(Debug, Clone, PartialEq, Eq, Hash)] 714#[derive(Debug, Clone, PartialEq, Eq, Hash)]
683pub struct ImplTraitType { 715pub struct ImplTraitType {
684 pub(crate) syntax: SyntaxNode, 716 pub(crate) syntax: SyntaxNode,
@@ -696,8 +728,9 @@ impl AstNode for ImplTraitType {
696} 728}
697impl ast::TypeBoundsOwner for ImplTraitType {} 729impl ast::TypeBoundsOwner for ImplTraitType {}
698impl ImplTraitType { 730impl ImplTraitType {
699 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IMPL_KW) } 731 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
700} 732}
733
701#[derive(Debug, Clone, PartialEq, Eq, Hash)] 734#[derive(Debug, Clone, PartialEq, Eq, Hash)]
702pub struct DynTraitType { 735pub struct DynTraitType {
703 pub(crate) syntax: SyntaxNode, 736 pub(crate) syntax: SyntaxNode,
@@ -715,8 +748,9 @@ impl AstNode for DynTraitType {
715} 748}
716impl ast::TypeBoundsOwner for DynTraitType {} 749impl ast::TypeBoundsOwner for DynTraitType {}
717impl DynTraitType { 750impl DynTraitType {
718 pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DYN_KW) } 751 pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) }
719} 752}
753
720#[derive(Debug, Clone, PartialEq, Eq, Hash)] 754#[derive(Debug, Clone, PartialEq, Eq, Hash)]
721pub struct TupleExpr { 755pub struct TupleExpr {
722 pub(crate) syntax: SyntaxNode, 756 pub(crate) syntax: SyntaxNode,
@@ -734,10 +768,11 @@ impl AstNode for TupleExpr {
734} 768}
735impl ast::AttrsOwner for TupleExpr {} 769impl ast::AttrsOwner for TupleExpr {}
736impl TupleExpr { 770impl TupleExpr {
737 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } 771 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
738 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } 772 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
739 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } 773 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
740} 774}
775
741#[derive(Debug, Clone, PartialEq, Eq, Hash)] 776#[derive(Debug, Clone, PartialEq, Eq, Hash)]
742pub struct ArrayExpr { 777pub struct ArrayExpr {
743 pub(crate) syntax: SyntaxNode, 778 pub(crate) syntax: SyntaxNode,
@@ -755,11 +790,12 @@ impl AstNode for ArrayExpr {
755} 790}
756impl ast::AttrsOwner for ArrayExpr {} 791impl ast::AttrsOwner for ArrayExpr {}
757impl ArrayExpr { 792impl ArrayExpr {
758 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } 793 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
759 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } 794 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
760 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 795 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
761 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } 796 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
762} 797}
798
763#[derive(Debug, Clone, PartialEq, Eq, Hash)] 799#[derive(Debug, Clone, PartialEq, Eq, Hash)]
764pub struct ParenExpr { 800pub struct ParenExpr {
765 pub(crate) syntax: SyntaxNode, 801 pub(crate) syntax: SyntaxNode,
@@ -777,10 +813,11 @@ impl AstNode for ParenExpr {
777} 813}
778impl ast::AttrsOwner for ParenExpr {} 814impl ast::AttrsOwner for ParenExpr {}
779impl ParenExpr { 815impl ParenExpr {
780 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } 816 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
781 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 817 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
782 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } 818 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
783} 819}
820
784#[derive(Debug, Clone, PartialEq, Eq, Hash)] 821#[derive(Debug, Clone, PartialEq, Eq, Hash)]
785pub struct PathExpr { 822pub struct PathExpr {
786 pub(crate) syntax: SyntaxNode, 823 pub(crate) syntax: SyntaxNode,
@@ -799,6 +836,7 @@ impl AstNode for PathExpr {
799impl PathExpr { 836impl PathExpr {
800 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 837 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
801} 838}
839
802#[derive(Debug, Clone, PartialEq, Eq, Hash)] 840#[derive(Debug, Clone, PartialEq, Eq, Hash)]
803pub struct LambdaExpr { 841pub struct LambdaExpr {
804 pub(crate) syntax: SyntaxNode, 842 pub(crate) syntax: SyntaxNode,
@@ -816,13 +854,14 @@ impl AstNode for LambdaExpr {
816} 854}
817impl ast::AttrsOwner for LambdaExpr {} 855impl ast::AttrsOwner for LambdaExpr {}
818impl LambdaExpr { 856impl LambdaExpr {
819 pub fn static_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, STATIC_KW) } 857 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
820 pub fn async_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, ASYNC_KW) } 858 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
821 pub fn move_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MOVE_KW) } 859 pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) }
822 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } 860 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
823 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } 861 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
824 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 862 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
825} 863}
864
826#[derive(Debug, Clone, PartialEq, Eq, Hash)] 865#[derive(Debug, Clone, PartialEq, Eq, Hash)]
827pub struct IfExpr { 866pub struct IfExpr {
828 pub(crate) syntax: SyntaxNode, 867 pub(crate) syntax: SyntaxNode,
@@ -840,9 +879,10 @@ impl AstNode for IfExpr {
840} 879}
841impl ast::AttrsOwner for IfExpr {} 880impl ast::AttrsOwner for IfExpr {}
842impl IfExpr { 881impl IfExpr {
843 pub fn if_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IF_KW) } 882 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
844 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } 883 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
845} 884}
885
846#[derive(Debug, Clone, PartialEq, Eq, Hash)] 886#[derive(Debug, Clone, PartialEq, Eq, Hash)]
847pub struct LoopExpr { 887pub struct LoopExpr {
848 pub(crate) syntax: SyntaxNode, 888 pub(crate) syntax: SyntaxNode,
@@ -861,8 +901,9 @@ impl AstNode for LoopExpr {
861impl ast::AttrsOwner for LoopExpr {} 901impl ast::AttrsOwner for LoopExpr {}
862impl ast::LoopBodyOwner for LoopExpr {} 902impl ast::LoopBodyOwner for LoopExpr {}
863impl LoopExpr { 903impl LoopExpr {
864 pub fn loop_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, LOOP_KW) } 904 pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) }
865} 905}
906
866#[derive(Debug, Clone, PartialEq, Eq, Hash)] 907#[derive(Debug, Clone, PartialEq, Eq, Hash)]
867pub struct TryBlockExpr { 908pub struct TryBlockExpr {
868 pub(crate) syntax: SyntaxNode, 909 pub(crate) syntax: SyntaxNode,
@@ -880,9 +921,10 @@ impl AstNode for TryBlockExpr {
880} 921}
881impl ast::AttrsOwner for TryBlockExpr {} 922impl ast::AttrsOwner for TryBlockExpr {}
882impl TryBlockExpr { 923impl TryBlockExpr {
883 pub fn try_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TRY_KW) } 924 pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) }
884 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 925 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
885} 926}
927
886#[derive(Debug, Clone, PartialEq, Eq, Hash)] 928#[derive(Debug, Clone, PartialEq, Eq, Hash)]
887pub struct ForExpr { 929pub struct ForExpr {
888 pub(crate) syntax: SyntaxNode, 930 pub(crate) syntax: SyntaxNode,
@@ -901,11 +943,12 @@ impl AstNode for ForExpr {
901impl ast::AttrsOwner for ForExpr {} 943impl ast::AttrsOwner for ForExpr {}
902impl ast::LoopBodyOwner for ForExpr {} 944impl ast::LoopBodyOwner for ForExpr {}
903impl ForExpr { 945impl ForExpr {
904 pub fn for_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FOR_KW) } 946 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
905 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 947 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
906 pub fn in_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IN_KW) } 948 pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) }
907 pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } 949 pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) }
908} 950}
951
909#[derive(Debug, Clone, PartialEq, Eq, Hash)] 952#[derive(Debug, Clone, PartialEq, Eq, Hash)]
910pub struct WhileExpr { 953pub struct WhileExpr {
911 pub(crate) syntax: SyntaxNode, 954 pub(crate) syntax: SyntaxNode,
@@ -924,9 +967,10 @@ impl AstNode for WhileExpr {
924impl ast::AttrsOwner for WhileExpr {} 967impl ast::AttrsOwner for WhileExpr {}
925impl ast::LoopBodyOwner for WhileExpr {} 968impl ast::LoopBodyOwner for WhileExpr {}
926impl WhileExpr { 969impl WhileExpr {
927 pub fn while_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, WHILE_KW) } 970 pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) }
928 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } 971 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
929} 972}
973
930#[derive(Debug, Clone, PartialEq, Eq, Hash)] 974#[derive(Debug, Clone, PartialEq, Eq, Hash)]
931pub struct ContinueExpr { 975pub struct ContinueExpr {
932 pub(crate) syntax: SyntaxNode, 976 pub(crate) syntax: SyntaxNode,
@@ -945,10 +989,13 @@ impl AstNode for ContinueExpr {
945impl ast::AttrsOwner for ContinueExpr {} 989impl ast::AttrsOwner for ContinueExpr {}
946impl ContinueExpr { 990impl ContinueExpr {
947 pub fn continue_token(&self) -> Option<SyntaxToken> { 991 pub fn continue_token(&self) -> Option<SyntaxToken> {
948 support::token2(&self.syntax, CONTINUE_KW) 992 support::token(&self.syntax, T![continue])
993 }
994 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
995 support::token(&self.syntax, T![lifetime])
949 } 996 }
950 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
951} 997}
998
952#[derive(Debug, Clone, PartialEq, Eq, Hash)] 999#[derive(Debug, Clone, PartialEq, Eq, Hash)]
953pub struct BreakExpr { 1000pub struct BreakExpr {
954 pub(crate) syntax: SyntaxNode, 1001 pub(crate) syntax: SyntaxNode,
@@ -966,10 +1013,13 @@ impl AstNode for BreakExpr {
966} 1013}
967impl ast::AttrsOwner for BreakExpr {} 1014impl ast::AttrsOwner for BreakExpr {}
968impl BreakExpr { 1015impl BreakExpr {
969 pub fn break_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, BREAK_KW) } 1016 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) }
970 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } 1017 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1018 support::token(&self.syntax, T![lifetime])
1019 }
971 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1020 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
972} 1021}
1022
973#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1023#[derive(Debug, Clone, PartialEq, Eq, Hash)]
974pub struct Label { 1024pub struct Label {
975 pub(crate) syntax: SyntaxNode, 1025 pub(crate) syntax: SyntaxNode,
@@ -986,8 +1036,11 @@ impl AstNode for Label {
986 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1036 fn syntax(&self) -> &SyntaxNode { &self.syntax }
987} 1037}
988impl Label { 1038impl Label {
989 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } 1039 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1040 support::token(&self.syntax, T![lifetime])
1041 }
990} 1042}
1043
991#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1044#[derive(Debug, Clone, PartialEq, Eq, Hash)]
992pub struct BlockExpr { 1045pub struct BlockExpr {
993 pub(crate) syntax: SyntaxNode, 1046 pub(crate) syntax: SyntaxNode,
@@ -1006,9 +1059,10 @@ impl AstNode for BlockExpr {
1006impl ast::AttrsOwner for BlockExpr {} 1059impl ast::AttrsOwner for BlockExpr {}
1007impl BlockExpr { 1060impl BlockExpr {
1008 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } 1061 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
1009 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) } 1062 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
1010 pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } 1063 pub fn block(&self) -> Option<Block> { support::child(&self.syntax) }
1011} 1064}
1065
1012#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1066#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1013pub struct ReturnExpr { 1067pub struct ReturnExpr {
1014 pub(crate) syntax: SyntaxNode, 1068 pub(crate) syntax: SyntaxNode,
@@ -1028,6 +1082,7 @@ impl ast::AttrsOwner for ReturnExpr {}
1028impl ReturnExpr { 1082impl ReturnExpr {
1029 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1083 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1030} 1084}
1085
1031#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1086#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1032pub struct CallExpr { 1087pub struct CallExpr {
1033 pub(crate) syntax: SyntaxNode, 1088 pub(crate) syntax: SyntaxNode,
@@ -1047,6 +1102,7 @@ impl ast::ArgListOwner for CallExpr {}
1047impl CallExpr { 1102impl CallExpr {
1048 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1103 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1049} 1104}
1105
1050#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1106#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1051pub struct MethodCallExpr { 1107pub struct MethodCallExpr {
1052 pub(crate) syntax: SyntaxNode, 1108 pub(crate) syntax: SyntaxNode,
@@ -1066,10 +1122,11 @@ impl ast::AttrsOwner for MethodCallExpr {}
1066impl ast::ArgListOwner for MethodCallExpr {} 1122impl ast::ArgListOwner for MethodCallExpr {}
1067impl MethodCallExpr { 1123impl MethodCallExpr {
1068 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1124 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1069 pub fn dot_token(&self) -> Option<Dot> { support::token(&self.syntax) } 1125 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
1070 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 1126 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1071 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } 1127 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
1072} 1128}
1129
1073#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1130#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1074pub struct IndexExpr { 1131pub struct IndexExpr {
1075 pub(crate) syntax: SyntaxNode, 1132 pub(crate) syntax: SyntaxNode,
@@ -1087,9 +1144,10 @@ impl AstNode for IndexExpr {
1087} 1144}
1088impl ast::AttrsOwner for IndexExpr {} 1145impl ast::AttrsOwner for IndexExpr {}
1089impl IndexExpr { 1146impl IndexExpr {
1090 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } 1147 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1091 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } 1148 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1092} 1149}
1150
1093#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1151#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1094pub struct FieldExpr { 1152pub struct FieldExpr {
1095 pub(crate) syntax: SyntaxNode, 1153 pub(crate) syntax: SyntaxNode,
@@ -1108,9 +1166,10 @@ impl AstNode for FieldExpr {
1108impl ast::AttrsOwner for FieldExpr {} 1166impl ast::AttrsOwner for FieldExpr {}
1109impl FieldExpr { 1167impl FieldExpr {
1110 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1168 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1111 pub fn dot_token(&self) -> Option<Dot> { support::token(&self.syntax) } 1169 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
1112 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 1170 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1113} 1171}
1172
1114#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1173#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1115pub struct AwaitExpr { 1174pub struct AwaitExpr {
1116 pub(crate) syntax: SyntaxNode, 1175 pub(crate) syntax: SyntaxNode,
@@ -1129,9 +1188,10 @@ impl AstNode for AwaitExpr {
1129impl ast::AttrsOwner for AwaitExpr {} 1188impl ast::AttrsOwner for AwaitExpr {}
1130impl AwaitExpr { 1189impl AwaitExpr {
1131 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1190 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1132 pub fn dot_token(&self) -> Option<Dot> { support::token(&self.syntax) } 1191 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
1133 pub fn await_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AWAIT_KW) } 1192 pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) }
1134} 1193}
1194
1135#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1195#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1136pub struct TryExpr { 1196pub struct TryExpr {
1137 pub(crate) syntax: SyntaxNode, 1197 pub(crate) syntax: SyntaxNode,
@@ -1149,9 +1209,10 @@ impl AstNode for TryExpr {
1149} 1209}
1150impl ast::AttrsOwner for TryExpr {} 1210impl ast::AttrsOwner for TryExpr {}
1151impl TryExpr { 1211impl TryExpr {
1152 pub fn try_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TRY_KW) } 1212 pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) }
1153 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1213 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1154} 1214}
1215
1155#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1216#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1156pub struct CastExpr { 1217pub struct CastExpr {
1157 pub(crate) syntax: SyntaxNode, 1218 pub(crate) syntax: SyntaxNode,
@@ -1170,9 +1231,10 @@ impl AstNode for CastExpr {
1170impl ast::AttrsOwner for CastExpr {} 1231impl ast::AttrsOwner for CastExpr {}
1171impl CastExpr { 1232impl CastExpr {
1172 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1233 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1173 pub fn as_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AS_KW) } 1234 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
1174 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 1235 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1175} 1236}
1237
1176#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1238#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1177pub struct RefExpr { 1239pub struct RefExpr {
1178 pub(crate) syntax: SyntaxNode, 1240 pub(crate) syntax: SyntaxNode,
@@ -1190,11 +1252,12 @@ impl AstNode for RefExpr {
1190} 1252}
1191impl ast::AttrsOwner for RefExpr {} 1253impl ast::AttrsOwner for RefExpr {}
1192impl RefExpr { 1254impl RefExpr {
1193 pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) } 1255 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1194 pub fn raw_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, RAW_KW) } 1256 pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) }
1195 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } 1257 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1196 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1258 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1197} 1259}
1260
1198#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1261#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1199pub struct PrefixExpr { 1262pub struct PrefixExpr {
1200 pub(crate) syntax: SyntaxNode, 1263 pub(crate) syntax: SyntaxNode,
@@ -1212,9 +1275,9 @@ impl AstNode for PrefixExpr {
1212} 1275}
1213impl ast::AttrsOwner for PrefixExpr {} 1276impl ast::AttrsOwner for PrefixExpr {}
1214impl PrefixExpr { 1277impl PrefixExpr {
1215 pub fn prefix_op_token(&self) -> Option<PrefixOp> { support::token(&self.syntax) }
1216 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1278 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1217} 1279}
1280
1218#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1281#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1219pub struct BoxExpr { 1282pub struct BoxExpr {
1220 pub(crate) syntax: SyntaxNode, 1283 pub(crate) syntax: SyntaxNode,
@@ -1232,9 +1295,10 @@ impl AstNode for BoxExpr {
1232} 1295}
1233impl ast::AttrsOwner for BoxExpr {} 1296impl ast::AttrsOwner for BoxExpr {}
1234impl BoxExpr { 1297impl BoxExpr {
1235 pub fn box_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, BOX_KW) } 1298 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
1236 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1299 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1237} 1300}
1301
1238#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1302#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1239pub struct RangeExpr { 1303pub struct RangeExpr {
1240 pub(crate) syntax: SyntaxNode, 1304 pub(crate) syntax: SyntaxNode,
@@ -1251,9 +1315,8 @@ impl AstNode for RangeExpr {
1251 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1315 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1252} 1316}
1253impl ast::AttrsOwner for RangeExpr {} 1317impl ast::AttrsOwner for RangeExpr {}
1254impl RangeExpr { 1318impl RangeExpr {}
1255 pub fn range_op_token(&self) -> Option<RangeOp> { support::token(&self.syntax) } 1319
1256}
1257#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1320#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1258pub struct BinExpr { 1321pub struct BinExpr {
1259 pub(crate) syntax: SyntaxNode, 1322 pub(crate) syntax: SyntaxNode,
@@ -1270,9 +1333,8 @@ impl AstNode for BinExpr {
1270 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1333 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1271} 1334}
1272impl ast::AttrsOwner for BinExpr {} 1335impl ast::AttrsOwner for BinExpr {}
1273impl BinExpr { 1336impl BinExpr {}
1274 pub fn bin_op_token(&self) -> Option<BinOp> { support::token(&self.syntax) } 1337
1275}
1276#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1338#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1277pub struct Literal { 1339pub struct Literal {
1278 pub(crate) syntax: SyntaxNode, 1340 pub(crate) syntax: SyntaxNode,
@@ -1288,9 +1350,8 @@ impl AstNode for Literal {
1288 } 1350 }
1289 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1351 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1290} 1352}
1291impl Literal { 1353impl Literal {}
1292 pub fn literal_token_token(&self) -> Option<LiteralToken> { support::token(&self.syntax) } 1354
1293}
1294#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1355#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1295pub struct MatchExpr { 1356pub struct MatchExpr {
1296 pub(crate) syntax: SyntaxNode, 1357 pub(crate) syntax: SyntaxNode,
@@ -1308,10 +1369,11 @@ impl AstNode for MatchExpr {
1308} 1369}
1309impl ast::AttrsOwner for MatchExpr {} 1370impl ast::AttrsOwner for MatchExpr {}
1310impl MatchExpr { 1371impl MatchExpr {
1311 pub fn match_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MATCH_KW) } 1372 pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) }
1312 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1373 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1313 pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } 1374 pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) }
1314} 1375}
1376
1315#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1377#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1316pub struct MatchArmList { 1378pub struct MatchArmList {
1317 pub(crate) syntax: SyntaxNode, 1379 pub(crate) syntax: SyntaxNode,
@@ -1329,10 +1391,11 @@ impl AstNode for MatchArmList {
1329} 1391}
1330impl ast::AttrsOwner for MatchArmList {} 1392impl ast::AttrsOwner for MatchArmList {}
1331impl MatchArmList { 1393impl MatchArmList {
1332 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } 1394 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1333 pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } 1395 pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) }
1334 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } 1396 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1335} 1397}
1398
1336#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1399#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1337pub struct MatchArm { 1400pub struct MatchArm {
1338 pub(crate) syntax: SyntaxNode, 1401 pub(crate) syntax: SyntaxNode,
@@ -1352,9 +1415,10 @@ impl ast::AttrsOwner for MatchArm {}
1352impl MatchArm { 1415impl MatchArm {
1353 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1416 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1354 pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } 1417 pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) }
1355 pub fn fat_arrow_token(&self) -> Option<FatArrow> { support::token(&self.syntax) } 1418 pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) }
1356 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1419 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1357} 1420}
1421
1358#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1422#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1359pub struct MatchGuard { 1423pub struct MatchGuard {
1360 pub(crate) syntax: SyntaxNode, 1424 pub(crate) syntax: SyntaxNode,
@@ -1371,9 +1435,10 @@ impl AstNode for MatchGuard {
1371 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1435 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1372} 1436}
1373impl MatchGuard { 1437impl MatchGuard {
1374 pub fn if_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IF_KW) } 1438 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
1375 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1439 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1376} 1440}
1441
1377#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1442#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1378pub struct RecordLit { 1443pub struct RecordLit {
1379 pub(crate) syntax: SyntaxNode, 1444 pub(crate) syntax: SyntaxNode,
@@ -1393,6 +1458,7 @@ impl RecordLit {
1393 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1458 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1394 pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } 1459 pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) }
1395} 1460}
1461
1396#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1462#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1397pub struct RecordFieldList { 1463pub struct RecordFieldList {
1398 pub(crate) syntax: SyntaxNode, 1464 pub(crate) syntax: SyntaxNode,
@@ -1409,12 +1475,13 @@ impl AstNode for RecordFieldList {
1409 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1475 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1410} 1476}
1411impl RecordFieldList { 1477impl RecordFieldList {
1412 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } 1478 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1413 pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } 1479 pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) }
1414 pub fn dotdot_token(&self) -> Option<Dotdot> { support::token(&self.syntax) } 1480 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1415 pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } 1481 pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) }
1416 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } 1482 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1417} 1483}
1484
1418#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1485#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1419pub struct RecordField { 1486pub struct RecordField {
1420 pub(crate) syntax: SyntaxNode, 1487 pub(crate) syntax: SyntaxNode,
@@ -1433,9 +1500,10 @@ impl AstNode for RecordField {
1433impl ast::AttrsOwner for RecordField {} 1500impl ast::AttrsOwner for RecordField {}
1434impl RecordField { 1501impl RecordField {
1435 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 1502 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1436 pub fn colon_token(&self) -> Option<Colon> { support::token(&self.syntax) } 1503 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1437 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1504 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1438} 1505}
1506
1439#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1507#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1440pub struct OrPat { 1508pub struct OrPat {
1441 pub(crate) syntax: SyntaxNode, 1509 pub(crate) syntax: SyntaxNode,
@@ -1454,6 +1522,7 @@ impl AstNode for OrPat {
1454impl OrPat { 1522impl OrPat {
1455 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } 1523 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1456} 1524}
1525
1457#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1526#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1458pub struct ParenPat { 1527pub struct ParenPat {
1459 pub(crate) syntax: SyntaxNode, 1528 pub(crate) syntax: SyntaxNode,
@@ -1470,10 +1539,11 @@ impl AstNode for ParenPat {
1470 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1539 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1471} 1540}
1472impl ParenPat { 1541impl ParenPat {
1473 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } 1542 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1474 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1543 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1475 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } 1544 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1476} 1545}
1546
1477#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1547#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1478pub struct RefPat { 1548pub struct RefPat {
1479 pub(crate) syntax: SyntaxNode, 1549 pub(crate) syntax: SyntaxNode,
@@ -1490,10 +1560,11 @@ impl AstNode for RefPat {
1490 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1560 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1491} 1561}
1492impl RefPat { 1562impl RefPat {
1493 pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) } 1563 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1494 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } 1564 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1495 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1565 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1496} 1566}
1567
1497#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1568#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1498pub struct BoxPat { 1569pub struct BoxPat {
1499 pub(crate) syntax: SyntaxNode, 1570 pub(crate) syntax: SyntaxNode,
@@ -1510,9 +1581,10 @@ impl AstNode for BoxPat {
1510 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1581 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1511} 1582}
1512impl BoxPat { 1583impl BoxPat {
1513 pub fn box_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, BOX_KW) } 1584 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
1514 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1585 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1515} 1586}
1587
1516#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1588#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1517pub struct BindPat { 1589pub struct BindPat {
1518 pub(crate) syntax: SyntaxNode, 1590 pub(crate) syntax: SyntaxNode,
@@ -1531,11 +1603,12 @@ impl AstNode for BindPat {
1531impl ast::AttrsOwner for BindPat {} 1603impl ast::AttrsOwner for BindPat {}
1532impl ast::NameOwner for BindPat {} 1604impl ast::NameOwner for BindPat {}
1533impl BindPat { 1605impl BindPat {
1534 pub fn ref_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, REF_KW) } 1606 pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) }
1535 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } 1607 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1536 pub fn at_token(&self) -> Option<At> { support::token(&self.syntax) } 1608 pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) }
1537 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1609 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1538} 1610}
1611
1539#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1612#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1540pub struct PlaceholderPat { 1613pub struct PlaceholderPat {
1541 pub(crate) syntax: SyntaxNode, 1614 pub(crate) syntax: SyntaxNode,
@@ -1552,8 +1625,9 @@ impl AstNode for PlaceholderPat {
1552 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1625 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1553} 1626}
1554impl PlaceholderPat { 1627impl PlaceholderPat {
1555 pub fn underscore_token(&self) -> Option<Underscore> { support::token(&self.syntax) } 1628 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
1556} 1629}
1630
1557#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1631#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1558pub struct DotDotPat { 1632pub struct DotDotPat {
1559 pub(crate) syntax: SyntaxNode, 1633 pub(crate) syntax: SyntaxNode,
@@ -1570,8 +1644,9 @@ impl AstNode for DotDotPat {
1570 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1644 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1571} 1645}
1572impl DotDotPat { 1646impl DotDotPat {
1573 pub fn dotdot_token(&self) -> Option<Dotdot> { support::token(&self.syntax) } 1647 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1574} 1648}
1649
1575#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1650#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1576pub struct PathPat { 1651pub struct PathPat {
1577 pub(crate) syntax: SyntaxNode, 1652 pub(crate) syntax: SyntaxNode,
@@ -1590,6 +1665,7 @@ impl AstNode for PathPat {
1590impl PathPat { 1665impl PathPat {
1591 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1666 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1592} 1667}
1668
1593#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1669#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1594pub struct SlicePat { 1670pub struct SlicePat {
1595 pub(crate) syntax: SyntaxNode, 1671 pub(crate) syntax: SyntaxNode,
@@ -1606,10 +1682,11 @@ impl AstNode for SlicePat {
1606 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1682 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1607} 1683}
1608impl SlicePat { 1684impl SlicePat {
1609 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } 1685 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1610 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } 1686 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1611 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } 1687 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1612} 1688}
1689
1613#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1690#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1614pub struct RangePat { 1691pub struct RangePat {
1615 pub(crate) syntax: SyntaxNode, 1692 pub(crate) syntax: SyntaxNode,
@@ -1625,9 +1702,8 @@ impl AstNode for RangePat {
1625 } 1702 }
1626 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1703 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1627} 1704}
1628impl RangePat { 1705impl RangePat {}
1629 pub fn range_separator_token(&self) -> Option<RangeSeparator> { support::token(&self.syntax) } 1706
1630}
1631#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1707#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1632pub struct LiteralPat { 1708pub struct LiteralPat {
1633 pub(crate) syntax: SyntaxNode, 1709 pub(crate) syntax: SyntaxNode,
@@ -1646,6 +1722,7 @@ impl AstNode for LiteralPat {
1646impl LiteralPat { 1722impl LiteralPat {
1647 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } 1723 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
1648} 1724}
1725
1649#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1726#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1650pub struct MacroPat { 1727pub struct MacroPat {
1651 pub(crate) syntax: SyntaxNode, 1728 pub(crate) syntax: SyntaxNode,
@@ -1664,6 +1741,7 @@ impl AstNode for MacroPat {
1664impl MacroPat { 1741impl MacroPat {
1665 pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } 1742 pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) }
1666} 1743}
1744
1667#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1745#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1668pub struct RecordPat { 1746pub struct RecordPat {
1669 pub(crate) syntax: SyntaxNode, 1747 pub(crate) syntax: SyntaxNode,
@@ -1685,6 +1763,7 @@ impl RecordPat {
1685 } 1763 }
1686 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1764 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1687} 1765}
1766
1688#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1767#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1689pub struct RecordFieldPatList { 1768pub struct RecordFieldPatList {
1690 pub(crate) syntax: SyntaxNode, 1769 pub(crate) syntax: SyntaxNode,
@@ -1701,15 +1780,16 @@ impl AstNode for RecordFieldPatList {
1701 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1780 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1702} 1781}
1703impl RecordFieldPatList { 1782impl RecordFieldPatList {
1704 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } 1783 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1705 pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) } 1784 pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) }
1706 pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { 1785 pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> {
1707 support::children(&self.syntax) 1786 support::children(&self.syntax)
1708 } 1787 }
1709 pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) } 1788 pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) }
1710 pub fn dotdot_token(&self) -> Option<Dotdot> { support::token(&self.syntax) } 1789 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1711 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } 1790 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1712} 1791}
1792
1713#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1793#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1714pub struct RecordFieldPat { 1794pub struct RecordFieldPat {
1715 pub(crate) syntax: SyntaxNode, 1795 pub(crate) syntax: SyntaxNode,
@@ -1728,9 +1808,10 @@ impl AstNode for RecordFieldPat {
1728impl ast::AttrsOwner for RecordFieldPat {} 1808impl ast::AttrsOwner for RecordFieldPat {}
1729impl ast::NameOwner for RecordFieldPat {} 1809impl ast::NameOwner for RecordFieldPat {}
1730impl RecordFieldPat { 1810impl RecordFieldPat {
1731 pub fn colon_token(&self) -> Option<Colon> { support::token(&self.syntax) } 1811 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1732 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1812 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1733} 1813}
1814
1734#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1815#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1735pub struct TupleStructPat { 1816pub struct TupleStructPat {
1736 pub(crate) syntax: SyntaxNode, 1817 pub(crate) syntax: SyntaxNode,
@@ -1748,10 +1829,11 @@ impl AstNode for TupleStructPat {
1748} 1829}
1749impl TupleStructPat { 1830impl TupleStructPat {
1750 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1831 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1751 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } 1832 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1752 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } 1833 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1753 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } 1834 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1754} 1835}
1836
1755#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1837#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1756pub struct TuplePat { 1838pub struct TuplePat {
1757 pub(crate) syntax: SyntaxNode, 1839 pub(crate) syntax: SyntaxNode,
@@ -1768,10 +1850,11 @@ impl AstNode for TuplePat {
1768 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1850 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1769} 1851}
1770impl TuplePat { 1852impl TuplePat {
1771 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } 1853 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1772 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } 1854 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1773 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } 1855 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1774} 1856}
1857
1775#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1858#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1776pub struct Visibility { 1859pub struct Visibility {
1777 pub(crate) syntax: SyntaxNode, 1860 pub(crate) syntax: SyntaxNode,
@@ -1788,11 +1871,12 @@ impl AstNode for Visibility {
1788 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1871 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1789} 1872}
1790impl Visibility { 1873impl Visibility {
1791 pub fn pub_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, PUB_KW) } 1874 pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) }
1792 pub fn super_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, SUPER_KW) } 1875 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
1793 pub fn self_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, SELF_KW) } 1876 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
1794 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CRATE_KW) } 1877 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
1795} 1878}
1879
1796#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1880#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1797pub struct Name { 1881pub struct Name {
1798 pub(crate) syntax: SyntaxNode, 1882 pub(crate) syntax: SyntaxNode,
@@ -1809,8 +1893,9 @@ impl AstNode for Name {
1809 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1893 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1810} 1894}
1811impl Name { 1895impl Name {
1812 pub fn ident_token(&self) -> Option<Ident> { support::token(&self.syntax) } 1896 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
1813} 1897}
1898
1814#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1899#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1815pub struct NameRef { 1900pub struct NameRef {
1816 pub(crate) syntax: SyntaxNode, 1901 pub(crate) syntax: SyntaxNode,
@@ -1826,9 +1911,8 @@ impl AstNode for NameRef {
1826 } 1911 }
1827 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1912 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1828} 1913}
1829impl NameRef { 1914impl NameRef {}
1830 pub fn name_ref_token_token(&self) -> Option<NameRefToken> { support::token(&self.syntax) } 1915
1831}
1832#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1916#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1833pub struct MacroCall { 1917pub struct MacroCall {
1834 pub(crate) syntax: SyntaxNode, 1918 pub(crate) syntax: SyntaxNode,
@@ -1849,10 +1933,11 @@ impl ast::AttrsOwner for MacroCall {}
1849impl ast::DocCommentsOwner for MacroCall {} 1933impl ast::DocCommentsOwner for MacroCall {}
1850impl MacroCall { 1934impl MacroCall {
1851 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1935 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1852 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } 1936 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
1853 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } 1937 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
1854 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 1938 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
1855} 1939}
1940
1856#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1941#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1857pub struct Attr { 1942pub struct Attr {
1858 pub(crate) syntax: SyntaxNode, 1943 pub(crate) syntax: SyntaxNode,
@@ -1869,14 +1954,15 @@ impl AstNode for Attr {
1869 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1954 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1870} 1955}
1871impl Attr { 1956impl Attr {
1872 pub fn pound_token(&self) -> Option<Pound> { support::token(&self.syntax) } 1957 pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) }
1873 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } 1958 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
1874 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } 1959 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1875 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1960 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1876 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 1961 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1877 pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) } 1962 pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) }
1878 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } 1963 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1879} 1964}
1965
1880#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1966#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1881pub struct TokenTree { 1967pub struct TokenTree {
1882 pub(crate) syntax: SyntaxNode, 1968 pub(crate) syntax: SyntaxNode,
@@ -1893,6 +1979,7 @@ impl AstNode for TokenTree {
1893 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1979 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1894} 1980}
1895impl TokenTree {} 1981impl TokenTree {}
1982
1896#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1983#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1897pub struct TypeParamList { 1984pub struct TypeParamList {
1898 pub(crate) syntax: SyntaxNode, 1985 pub(crate) syntax: SyntaxNode,
@@ -1909,13 +1996,14 @@ impl AstNode for TypeParamList {
1909 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1996 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1910} 1997}
1911impl TypeParamList { 1998impl TypeParamList {
1912 pub fn l_angle_token(&self) -> Option<LAngle> { support::token(&self.syntax) } 1999 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
1913 pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } 2000 pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) }
1914 pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) } 2001 pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) }
1915 pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) } 2002 pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) }
1916 pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) } 2003 pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) }
1917 pub fn r_angle_token(&self) -> Option<RAngle> { support::token(&self.syntax) } 2004 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
1918} 2005}
2006
1919#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2007#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1920pub struct TypeParam { 2008pub struct TypeParam {
1921 pub(crate) syntax: SyntaxNode, 2009 pub(crate) syntax: SyntaxNode,
@@ -1935,9 +2023,10 @@ impl ast::NameOwner for TypeParam {}
1935impl ast::AttrsOwner for TypeParam {} 2023impl ast::AttrsOwner for TypeParam {}
1936impl ast::TypeBoundsOwner for TypeParam {} 2024impl ast::TypeBoundsOwner for TypeParam {}
1937impl TypeParam { 2025impl TypeParam {
1938 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2026 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1939 pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } 2027 pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1940} 2028}
2029
1941#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2030#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1942pub struct ConstParam { 2031pub struct ConstParam {
1943 pub(crate) syntax: SyntaxNode, 2032 pub(crate) syntax: SyntaxNode,
@@ -1957,9 +2046,10 @@ impl ast::NameOwner for ConstParam {}
1957impl ast::AttrsOwner for ConstParam {} 2046impl ast::AttrsOwner for ConstParam {}
1958impl ast::TypeAscriptionOwner for ConstParam {} 2047impl ast::TypeAscriptionOwner for ConstParam {}
1959impl ConstParam { 2048impl ConstParam {
1960 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2049 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1961 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } 2050 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
1962} 2051}
2052
1963#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2053#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1964pub struct LifetimeParam { 2054pub struct LifetimeParam {
1965 pub(crate) syntax: SyntaxNode, 2055 pub(crate) syntax: SyntaxNode,
@@ -1977,8 +2067,11 @@ impl AstNode for LifetimeParam {
1977} 2067}
1978impl ast::AttrsOwner for LifetimeParam {} 2068impl ast::AttrsOwner for LifetimeParam {}
1979impl LifetimeParam { 2069impl LifetimeParam {
1980 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } 2070 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2071 support::token(&self.syntax, T![lifetime])
2072 }
1981} 2073}
2074
1982#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2075#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1983pub struct TypeBound { 2076pub struct TypeBound {
1984 pub(crate) syntax: SyntaxNode, 2077 pub(crate) syntax: SyntaxNode,
@@ -1995,10 +2088,13 @@ impl AstNode for TypeBound {
1995 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2088 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1996} 2089}
1997impl TypeBound { 2090impl TypeBound {
1998 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } 2091 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1999 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) } 2092 support::token(&self.syntax, T![lifetime])
2093 }
2094 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
2000 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 2095 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2001} 2096}
2097
2002#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2098#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2003pub struct TypeBoundList { 2099pub struct TypeBoundList {
2004 pub(crate) syntax: SyntaxNode, 2100 pub(crate) syntax: SyntaxNode,
@@ -2017,6 +2113,7 @@ impl AstNode for TypeBoundList {
2017impl TypeBoundList { 2113impl TypeBoundList {
2018 pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } 2114 pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
2019} 2115}
2116
2020#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2117#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2021pub struct WherePred { 2118pub struct WherePred {
2022 pub(crate) syntax: SyntaxNode, 2119 pub(crate) syntax: SyntaxNode,
@@ -2034,9 +2131,12 @@ impl AstNode for WherePred {
2034} 2131}
2035impl ast::TypeBoundsOwner for WherePred {} 2132impl ast::TypeBoundsOwner for WherePred {}
2036impl WherePred { 2133impl WherePred {
2037 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } 2134 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2135 support::token(&self.syntax, T![lifetime])
2136 }
2038 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 2137 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2039} 2138}
2139
2040#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2140#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2041pub struct WhereClause { 2141pub struct WhereClause {
2042 pub(crate) syntax: SyntaxNode, 2142 pub(crate) syntax: SyntaxNode,
@@ -2053,9 +2153,10 @@ impl AstNode for WhereClause {
2053 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2153 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2054} 2154}
2055impl WhereClause { 2155impl WhereClause {
2056 pub fn where_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, WHERE_KW) } 2156 pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) }
2057 pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) } 2157 pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) }
2058} 2158}
2159
2059#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2160#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2060pub struct Abi { 2161pub struct Abi {
2061 pub(crate) syntax: SyntaxNode, 2162 pub(crate) syntax: SyntaxNode,
@@ -2071,9 +2172,8 @@ impl AstNode for Abi {
2071 } 2172 }
2072 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2173 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2073} 2174}
2074impl Abi { 2175impl Abi {}
2075 pub fn string_token(&self) -> Option<String> { support::token(&self.syntax) } 2176
2076}
2077#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2177#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2078pub struct ExprStmt { 2178pub struct ExprStmt {
2079 pub(crate) syntax: SyntaxNode, 2179 pub(crate) syntax: SyntaxNode,
@@ -2092,8 +2192,9 @@ impl AstNode for ExprStmt {
2092impl ast::AttrsOwner for ExprStmt {} 2192impl ast::AttrsOwner for ExprStmt {}
2093impl ExprStmt { 2193impl ExprStmt {
2094 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 2194 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2095 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 2195 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
2096} 2196}
2197
2097#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2198#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2098pub struct LetStmt { 2199pub struct LetStmt {
2099 pub(crate) syntax: SyntaxNode, 2200 pub(crate) syntax: SyntaxNode,
@@ -2112,12 +2213,13 @@ impl AstNode for LetStmt {
2112impl ast::AttrsOwner for LetStmt {} 2213impl ast::AttrsOwner for LetStmt {}
2113impl ast::TypeAscriptionOwner for LetStmt {} 2214impl ast::TypeAscriptionOwner for LetStmt {}
2114impl LetStmt { 2215impl LetStmt {
2115 pub fn let_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, LET_KW) } 2216 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
2116 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 2217 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2117 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2218 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2118 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } 2219 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
2119 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 2220 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
2120} 2221}
2222
2121#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2223#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2122pub struct Condition { 2224pub struct Condition {
2123 pub(crate) syntax: SyntaxNode, 2225 pub(crate) syntax: SyntaxNode,
@@ -2134,11 +2236,12 @@ impl AstNode for Condition {
2134 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2236 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2135} 2237}
2136impl Condition { 2238impl Condition {
2137 pub fn let_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, LET_KW) } 2239 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
2138 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 2240 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2139 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2241 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2140 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 2242 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2141} 2243}
2244
2142#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2245#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2143pub struct Block { 2246pub struct Block {
2144 pub(crate) syntax: SyntaxNode, 2247 pub(crate) syntax: SyntaxNode,
@@ -2157,11 +2260,12 @@ impl AstNode for Block {
2157impl ast::AttrsOwner for Block {} 2260impl ast::AttrsOwner for Block {}
2158impl ast::ModuleItemOwner for Block {} 2261impl ast::ModuleItemOwner for Block {}
2159impl Block { 2262impl Block {
2160 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } 2263 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
2161 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } 2264 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
2162 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 2265 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2163 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } 2266 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
2164} 2267}
2268
2165#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2269#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2166pub struct ParamList { 2270pub struct ParamList {
2167 pub(crate) syntax: SyntaxNode, 2271 pub(crate) syntax: SyntaxNode,
@@ -2178,11 +2282,12 @@ impl AstNode for ParamList {
2178 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2282 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2179} 2283}
2180impl ParamList { 2284impl ParamList {
2181 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } 2285 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
2182 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } 2286 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
2183 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } 2287 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
2184 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } 2288 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
2185} 2289}
2290
2186#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2291#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2187pub struct SelfParam { 2292pub struct SelfParam {
2188 pub(crate) syntax: SyntaxNode, 2293 pub(crate) syntax: SyntaxNode,
@@ -2201,10 +2306,14 @@ impl AstNode for SelfParam {
2201impl ast::TypeAscriptionOwner for SelfParam {} 2306impl ast::TypeAscriptionOwner for SelfParam {}
2202impl ast::AttrsOwner for SelfParam {} 2307impl ast::AttrsOwner for SelfParam {}
2203impl SelfParam { 2308impl SelfParam {
2204 pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) } 2309 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
2205 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } 2310 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
2206 pub fn self_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, SELF_KW) } 2311 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2312 support::token(&self.syntax, T![lifetime])
2313 }
2314 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
2207} 2315}
2316
2208#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2317#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2209pub struct Param { 2318pub struct Param {
2210 pub(crate) syntax: SyntaxNode, 2319 pub(crate) syntax: SyntaxNode,
@@ -2224,8 +2333,9 @@ impl ast::TypeAscriptionOwner for Param {}
2224impl ast::AttrsOwner for Param {} 2333impl ast::AttrsOwner for Param {}
2225impl Param { 2334impl Param {
2226 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 2335 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2227 pub fn dotdotdot_token(&self) -> Option<Dotdotdot> { support::token(&self.syntax) } 2336 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
2228} 2337}
2338
2229#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2339#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2230pub struct UseItem { 2340pub struct UseItem {
2231 pub(crate) syntax: SyntaxNode, 2341 pub(crate) syntax: SyntaxNode,
@@ -2244,9 +2354,10 @@ impl AstNode for UseItem {
2244impl ast::AttrsOwner for UseItem {} 2354impl ast::AttrsOwner for UseItem {}
2245impl ast::VisibilityOwner for UseItem {} 2355impl ast::VisibilityOwner for UseItem {}
2246impl UseItem { 2356impl UseItem {
2247 pub fn use_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, USE_KW) } 2357 pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) }
2248 pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } 2358 pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) }
2249} 2359}
2360
2250#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2361#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2251pub struct UseTree { 2362pub struct UseTree {
2252 pub(crate) syntax: SyntaxNode, 2363 pub(crate) syntax: SyntaxNode,
@@ -2264,10 +2375,11 @@ impl AstNode for UseTree {
2264} 2375}
2265impl UseTree { 2376impl UseTree {
2266 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 2377 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2267 pub fn star_token(&self) -> Option<Star> { support::token(&self.syntax) } 2378 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
2268 pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } 2379 pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) }
2269 pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } 2380 pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) }
2270} 2381}
2382
2271#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2383#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2272pub struct Alias { 2384pub struct Alias {
2273 pub(crate) syntax: SyntaxNode, 2385 pub(crate) syntax: SyntaxNode,
@@ -2285,8 +2397,9 @@ impl AstNode for Alias {
2285} 2397}
2286impl ast::NameOwner for Alias {} 2398impl ast::NameOwner for Alias {}
2287impl Alias { 2399impl Alias {
2288 pub fn as_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AS_KW) } 2400 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
2289} 2401}
2402
2290#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2403#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2291pub struct UseTreeList { 2404pub struct UseTreeList {
2292 pub(crate) syntax: SyntaxNode, 2405 pub(crate) syntax: SyntaxNode,
@@ -2303,10 +2416,11 @@ impl AstNode for UseTreeList {
2303 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2416 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2304} 2417}
2305impl UseTreeList { 2418impl UseTreeList {
2306 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } 2419 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
2307 pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } 2420 pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) }
2308 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } 2421 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
2309} 2422}
2423
2310#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2424#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2311pub struct ExternCrateItem { 2425pub struct ExternCrateItem {
2312 pub(crate) syntax: SyntaxNode, 2426 pub(crate) syntax: SyntaxNode,
@@ -2325,11 +2439,12 @@ impl AstNode for ExternCrateItem {
2325impl ast::AttrsOwner for ExternCrateItem {} 2439impl ast::AttrsOwner for ExternCrateItem {}
2326impl ast::VisibilityOwner for ExternCrateItem {} 2440impl ast::VisibilityOwner for ExternCrateItem {}
2327impl ExternCrateItem { 2441impl ExternCrateItem {
2328 pub fn extern_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, EXTERN_KW) } 2442 pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) }
2329 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CRATE_KW) } 2443 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
2330 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 2444 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2331 pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } 2445 pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) }
2332} 2446}
2447
2333#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2448#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2334pub struct ArgList { 2449pub struct ArgList {
2335 pub(crate) syntax: SyntaxNode, 2450 pub(crate) syntax: SyntaxNode,
@@ -2346,10 +2461,11 @@ impl AstNode for ArgList {
2346 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2461 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2347} 2462}
2348impl ArgList { 2463impl ArgList {
2349 pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } 2464 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
2350 pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } 2465 pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
2351 pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } 2466 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
2352} 2467}
2468
2353#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2469#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2354pub struct Path { 2470pub struct Path {
2355 pub(crate) syntax: SyntaxNode, 2471 pub(crate) syntax: SyntaxNode,
@@ -2369,6 +2485,7 @@ impl Path {
2369 pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } 2485 pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) }
2370 pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } 2486 pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
2371} 2487}
2488
2372#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2489#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2373pub struct PathSegment { 2490pub struct PathSegment {
2374 pub(crate) syntax: SyntaxNode, 2491 pub(crate) syntax: SyntaxNode,
@@ -2385,15 +2502,16 @@ impl AstNode for PathSegment {
2385 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2502 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2386} 2503}
2387impl PathSegment { 2504impl PathSegment {
2388 pub fn coloncolon_token(&self) -> Option<Coloncolon> { support::token(&self.syntax) } 2505 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
2389 pub fn l_angle_token(&self) -> Option<LAngle> { support::token(&self.syntax) } 2506 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
2390 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 2507 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2391 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } 2508 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
2392 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } 2509 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
2393 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } 2510 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
2394 pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } 2511 pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) }
2395 pub fn r_angle_token(&self) -> Option<RAngle> { support::token(&self.syntax) } 2512 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
2396} 2513}
2514
2397#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2515#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2398pub struct TypeArgList { 2516pub struct TypeArgList {
2399 pub(crate) syntax: SyntaxNode, 2517 pub(crate) syntax: SyntaxNode,
@@ -2410,15 +2528,16 @@ impl AstNode for TypeArgList {
2410 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2528 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2411} 2529}
2412impl TypeArgList { 2530impl TypeArgList {
2413 pub fn coloncolon_token(&self) -> Option<Coloncolon> { support::token(&self.syntax) } 2531 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
2414 pub fn l_angle_token(&self) -> Option<LAngle> { support::token(&self.syntax) } 2532 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
2415 pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) } 2533 pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) }
2416 pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) } 2534 pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) }
2417 pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) } 2535 pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) }
2418 pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) } 2536 pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) }
2419 pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) } 2537 pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) }
2420 pub fn r_angle_token(&self) -> Option<RAngle> { support::token(&self.syntax) } 2538 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
2421} 2539}
2540
2422#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2541#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2423pub struct TypeArg { 2542pub struct TypeArg {
2424 pub(crate) syntax: SyntaxNode, 2543 pub(crate) syntax: SyntaxNode,
@@ -2437,6 +2556,7 @@ impl AstNode for TypeArg {
2437impl TypeArg { 2556impl TypeArg {
2438 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 2557 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2439} 2558}
2559
2440#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2560#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2441pub struct AssocTypeArg { 2561pub struct AssocTypeArg {
2442 pub(crate) syntax: SyntaxNode, 2562 pub(crate) syntax: SyntaxNode,
@@ -2455,9 +2575,10 @@ impl AstNode for AssocTypeArg {
2455impl ast::TypeBoundsOwner for AssocTypeArg {} 2575impl ast::TypeBoundsOwner for AssocTypeArg {}
2456impl AssocTypeArg { 2576impl AssocTypeArg {
2457 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 2577 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2458 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2578 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2459 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 2579 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2460} 2580}
2581
2461#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2582#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2462pub struct LifetimeArg { 2583pub struct LifetimeArg {
2463 pub(crate) syntax: SyntaxNode, 2584 pub(crate) syntax: SyntaxNode,
@@ -2474,8 +2595,11 @@ impl AstNode for LifetimeArg {
2474 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2595 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2475} 2596}
2476impl LifetimeArg { 2597impl LifetimeArg {
2477 pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } 2598 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2599 support::token(&self.syntax, T![lifetime])
2600 }
2478} 2601}
2602
2479#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2603#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2480pub struct ConstArg { 2604pub struct ConstArg {
2481 pub(crate) syntax: SyntaxNode, 2605 pub(crate) syntax: SyntaxNode,
@@ -2493,9 +2617,10 @@ impl AstNode for ConstArg {
2493} 2617}
2494impl ConstArg { 2618impl ConstArg {
2495 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } 2619 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
2496 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2620 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2497 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 2621 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
2498} 2622}
2623
2499#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2624#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2500pub struct MacroItems { 2625pub struct MacroItems {
2501 pub(crate) syntax: SyntaxNode, 2626 pub(crate) syntax: SyntaxNode,
@@ -2513,6 +2638,7 @@ impl AstNode for MacroItems {
2513} 2638}
2514impl ast::ModuleItemOwner for MacroItems {} 2639impl ast::ModuleItemOwner for MacroItems {}
2515impl MacroItems {} 2640impl MacroItems {}
2641
2516#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2642#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2517pub struct MacroStmts { 2643pub struct MacroStmts {
2518 pub(crate) syntax: SyntaxNode, 2644 pub(crate) syntax: SyntaxNode,
@@ -2532,6 +2658,7 @@ impl MacroStmts {
2532 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } 2658 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
2533 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 2659 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2534} 2660}
2661
2535#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2662#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2536pub struct ExternItemList { 2663pub struct ExternItemList {
2537 pub(crate) syntax: SyntaxNode, 2664 pub(crate) syntax: SyntaxNode,
@@ -2549,10 +2676,11 @@ impl AstNode for ExternItemList {
2549} 2676}
2550impl ast::ModuleItemOwner for ExternItemList {} 2677impl ast::ModuleItemOwner for ExternItemList {}
2551impl ExternItemList { 2678impl ExternItemList {
2552 pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } 2679 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
2553 pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } 2680 pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) }
2554 pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } 2681 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
2555} 2682}
2683
2556#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2684#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2557pub struct ExternBlock { 2685pub struct ExternBlock {
2558 pub(crate) syntax: SyntaxNode, 2686 pub(crate) syntax: SyntaxNode,
@@ -2572,6 +2700,7 @@ impl ExternBlock {
2572 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } 2700 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
2573 pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } 2701 pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) }
2574} 2702}
2703
2575#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2704#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2576pub struct MetaItem { 2705pub struct MetaItem {
2577 pub(crate) syntax: SyntaxNode, 2706 pub(crate) syntax: SyntaxNode,
@@ -2589,10 +2718,11 @@ impl AstNode for MetaItem {
2589} 2718}
2590impl MetaItem { 2719impl MetaItem {
2591 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 2720 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2592 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2721 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2593 pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) } 2722 pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) }
2594 pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } 2723 pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) }
2595} 2724}
2725
2596#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2726#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2597pub struct MacroDef { 2727pub struct MacroDef {
2598 pub(crate) syntax: SyntaxNode, 2728 pub(crate) syntax: SyntaxNode,
@@ -2612,6 +2742,7 @@ impl MacroDef {
2612 pub fn name(&self) -> Option<Name> { support::child(&self.syntax) } 2742 pub fn name(&self) -> Option<Name> { support::child(&self.syntax) }
2613 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } 2743 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
2614} 2744}
2745
2615#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2746#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2616pub enum NominalDef { 2747pub enum NominalDef {
2617 StructDef(StructDef), 2748 StructDef(StructDef),
@@ -2654,6 +2785,7 @@ impl AstNode for NominalDef {
2654impl ast::NameOwner for NominalDef {} 2785impl ast::NameOwner for NominalDef {}
2655impl ast::TypeParamsOwner for NominalDef {} 2786impl ast::TypeParamsOwner for NominalDef {}
2656impl ast::AttrsOwner for NominalDef {} 2787impl ast::AttrsOwner for NominalDef {}
2788
2657#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2789#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2658pub enum GenericParam { 2790pub enum GenericParam {
2659 LifetimeParam(LifetimeParam), 2791 LifetimeParam(LifetimeParam),
@@ -2693,6 +2825,7 @@ impl AstNode for GenericParam {
2693 } 2825 }
2694 } 2826 }
2695} 2827}
2828
2696#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2829#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2697pub enum GenericArg { 2830pub enum GenericArg {
2698 LifetimeArg(LifetimeArg), 2831 LifetimeArg(LifetimeArg),
@@ -2738,6 +2871,7 @@ impl AstNode for GenericArg {
2738 } 2871 }
2739 } 2872 }
2740} 2873}
2874
2741#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2875#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2742pub enum TypeRef { 2876pub enum TypeRef {
2743 ParenType(ParenType), 2877 ParenType(ParenType),
@@ -2839,6 +2973,7 @@ impl AstNode for TypeRef {
2839 } 2973 }
2840 } 2974 }
2841} 2975}
2976
2842#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2977#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2843pub enum ModuleItem { 2978pub enum ModuleItem {
2844 StructDef(StructDef), 2979 StructDef(StructDef),
@@ -2949,6 +3084,7 @@ impl AstNode for ModuleItem {
2949impl ast::NameOwner for ModuleItem {} 3084impl ast::NameOwner for ModuleItem {}
2950impl ast::AttrsOwner for ModuleItem {} 3085impl ast::AttrsOwner for ModuleItem {}
2951impl ast::VisibilityOwner for ModuleItem {} 3086impl ast::VisibilityOwner for ModuleItem {}
3087
2952#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3088#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2953pub enum ImplItem { 3089pub enum ImplItem {
2954 FnDef(FnDef), 3090 FnDef(FnDef),
@@ -2990,6 +3126,7 @@ impl AstNode for ImplItem {
2990} 3126}
2991impl ast::NameOwner for ImplItem {} 3127impl ast::NameOwner for ImplItem {}
2992impl ast::AttrsOwner for ImplItem {} 3128impl ast::AttrsOwner for ImplItem {}
3129
2993#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3130#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2994pub enum ExternItem { 3131pub enum ExternItem {
2995 FnDef(FnDef), 3132 FnDef(FnDef),
@@ -3026,6 +3163,7 @@ impl AstNode for ExternItem {
3026impl ast::NameOwner for ExternItem {} 3163impl ast::NameOwner for ExternItem {}
3027impl ast::AttrsOwner for ExternItem {} 3164impl ast::AttrsOwner for ExternItem {}
3028impl ast::VisibilityOwner for ExternItem {} 3165impl ast::VisibilityOwner for ExternItem {}
3166
3029#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3167#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3030pub enum Expr { 3168pub enum Expr {
3031 TupleExpr(TupleExpr), 3169 TupleExpr(TupleExpr),
@@ -3239,6 +3377,7 @@ impl AstNode for Expr {
3239 } 3377 }
3240} 3378}
3241impl ast::AttrsOwner for Expr {} 3379impl ast::AttrsOwner for Expr {}
3380
3242#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3381#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3243pub enum Pat { 3382pub enum Pat {
3244 OrPat(OrPat), 3383 OrPat(OrPat),
@@ -3352,6 +3491,7 @@ impl AstNode for Pat {
3352 } 3491 }
3353 } 3492 }
3354} 3493}
3494
3355#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3495#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3356pub enum RecordInnerPat { 3496pub enum RecordInnerPat {
3357 RecordFieldPat(RecordFieldPat), 3497 RecordFieldPat(RecordFieldPat),
@@ -3385,6 +3525,7 @@ impl AstNode for RecordInnerPat {
3385 } 3525 }
3386 } 3526 }
3387} 3527}
3528
3388#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3529#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3389pub enum AttrInput { 3530pub enum AttrInput {
3390 Literal(Literal), 3531 Literal(Literal),
@@ -3418,6 +3559,7 @@ impl AstNode for AttrInput {
3418 } 3559 }
3419 } 3560 }
3420} 3561}
3562
3421#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3563#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3422pub enum Stmt { 3564pub enum Stmt {
3423 LetStmt(LetStmt), 3565 LetStmt(LetStmt),
@@ -3451,6 +3593,7 @@ impl AstNode for Stmt {
3451 } 3593 }
3452 } 3594 }
3453} 3595}
3596
3454#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3597#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3455pub enum FieldDefList { 3598pub enum FieldDefList {
3456 RecordFieldDefList(RecordFieldDefList), 3599 RecordFieldDefList(RecordFieldDefList),
diff --git a/crates/ra_syntax/src/ast/generated/tokens.rs b/crates/ra_syntax/src/ast/generated/tokens.rs
index 7344b0e49..f91befaac 100644
--- a/crates/ra_syntax/src/ast/generated/tokens.rs
+++ b/crates/ra_syntax/src/ast/generated/tokens.rs
@@ -5,1246 +5,7 @@ use crate::{
5 SyntaxKind::{self, *}, 5 SyntaxKind::{self, *},
6 SyntaxToken, 6 SyntaxToken,
7}; 7};
8#[derive(Debug, Clone, PartialEq, Eq, Hash)] 8
9pub struct Semi {
10 pub(crate) syntax: SyntaxToken,
11}
12impl std::fmt::Display for Semi {
13 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
14 std::fmt::Display::fmt(&self.syntax, f)
15 }
16}
17impl AstToken for Semi {
18 fn can_cast(kind: SyntaxKind) -> bool { kind == SEMI }
19 fn cast(syntax: SyntaxToken) -> Option<Self> {
20 if Self::can_cast(syntax.kind()) {
21 Some(Self { syntax })
22 } else {
23 None
24 }
25 }
26 fn syntax(&self) -> &SyntaxToken { &self.syntax }
27}
28#[derive(Debug, Clone, PartialEq, Eq, Hash)]
29pub struct Comma {
30 pub(crate) syntax: SyntaxToken,
31}
32impl std::fmt::Display for Comma {
33 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
34 std::fmt::Display::fmt(&self.syntax, f)
35 }
36}
37impl AstToken for Comma {
38 fn can_cast(kind: SyntaxKind) -> bool { kind == COMMA }
39 fn cast(syntax: SyntaxToken) -> Option<Self> {
40 if Self::can_cast(syntax.kind()) {
41 Some(Self { syntax })
42 } else {
43 None
44 }
45 }
46 fn syntax(&self) -> &SyntaxToken { &self.syntax }
47}
48#[derive(Debug, Clone, PartialEq, Eq, Hash)]
49pub struct LParen {
50 pub(crate) syntax: SyntaxToken,
51}
52impl std::fmt::Display for LParen {
53 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
54 std::fmt::Display::fmt(&self.syntax, f)
55 }
56}
57impl AstToken for LParen {
58 fn can_cast(kind: SyntaxKind) -> bool { kind == L_PAREN }
59 fn cast(syntax: SyntaxToken) -> Option<Self> {
60 if Self::can_cast(syntax.kind()) {
61 Some(Self { syntax })
62 } else {
63 None
64 }
65 }
66 fn syntax(&self) -> &SyntaxToken { &self.syntax }
67}
68#[derive(Debug, Clone, PartialEq, Eq, Hash)]
69pub struct RParen {
70 pub(crate) syntax: SyntaxToken,
71}
72impl std::fmt::Display for RParen {
73 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
74 std::fmt::Display::fmt(&self.syntax, f)
75 }
76}
77impl AstToken for RParen {
78 fn can_cast(kind: SyntaxKind) -> bool { kind == R_PAREN }
79 fn cast(syntax: SyntaxToken) -> Option<Self> {
80 if Self::can_cast(syntax.kind()) {
81 Some(Self { syntax })
82 } else {
83 None
84 }
85 }
86 fn syntax(&self) -> &SyntaxToken { &self.syntax }
87}
88#[derive(Debug, Clone, PartialEq, Eq, Hash)]
89pub struct LCurly {
90 pub(crate) syntax: SyntaxToken,
91}
92impl std::fmt::Display for LCurly {
93 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
94 std::fmt::Display::fmt(&self.syntax, f)
95 }
96}
97impl AstToken for LCurly {
98 fn can_cast(kind: SyntaxKind) -> bool { kind == L_CURLY }
99 fn cast(syntax: SyntaxToken) -> Option<Self> {
100 if Self::can_cast(syntax.kind()) {
101 Some(Self { syntax })
102 } else {
103 None
104 }
105 }
106 fn syntax(&self) -> &SyntaxToken { &self.syntax }
107}
108#[derive(Debug, Clone, PartialEq, Eq, Hash)]
109pub struct RCurly {
110 pub(crate) syntax: SyntaxToken,
111}
112impl std::fmt::Display for RCurly {
113 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
114 std::fmt::Display::fmt(&self.syntax, f)
115 }
116}
117impl AstToken for RCurly {
118 fn can_cast(kind: SyntaxKind) -> bool { kind == R_CURLY }
119 fn cast(syntax: SyntaxToken) -> Option<Self> {
120 if Self::can_cast(syntax.kind()) {
121 Some(Self { syntax })
122 } else {
123 None
124 }
125 }
126 fn syntax(&self) -> &SyntaxToken { &self.syntax }
127}
128#[derive(Debug, Clone, PartialEq, Eq, Hash)]
129pub struct LBrack {
130 pub(crate) syntax: SyntaxToken,
131}
132impl std::fmt::Display for LBrack {
133 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
134 std::fmt::Display::fmt(&self.syntax, f)
135 }
136}
137impl AstToken for LBrack {
138 fn can_cast(kind: SyntaxKind) -> bool { kind == L_BRACK }
139 fn cast(syntax: SyntaxToken) -> Option<Self> {
140 if Self::can_cast(syntax.kind()) {
141 Some(Self { syntax })
142 } else {
143 None
144 }
145 }
146 fn syntax(&self) -> &SyntaxToken { &self.syntax }
147}
148#[derive(Debug, Clone, PartialEq, Eq, Hash)]
149pub struct RBrack {
150 pub(crate) syntax: SyntaxToken,
151}
152impl std::fmt::Display for RBrack {
153 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
154 std::fmt::Display::fmt(&self.syntax, f)
155 }
156}
157impl AstToken for RBrack {
158 fn can_cast(kind: SyntaxKind) -> bool { kind == R_BRACK }
159 fn cast(syntax: SyntaxToken) -> Option<Self> {
160 if Self::can_cast(syntax.kind()) {
161 Some(Self { syntax })
162 } else {
163 None
164 }
165 }
166 fn syntax(&self) -> &SyntaxToken { &self.syntax }
167}
168#[derive(Debug, Clone, PartialEq, Eq, Hash)]
169pub struct LAngle {
170 pub(crate) syntax: SyntaxToken,
171}
172impl std::fmt::Display for LAngle {
173 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
174 std::fmt::Display::fmt(&self.syntax, f)
175 }
176}
177impl AstToken for LAngle {
178 fn can_cast(kind: SyntaxKind) -> bool { kind == L_ANGLE }
179 fn cast(syntax: SyntaxToken) -> Option<Self> {
180 if Self::can_cast(syntax.kind()) {
181 Some(Self { syntax })
182 } else {
183 None
184 }
185 }
186 fn syntax(&self) -> &SyntaxToken { &self.syntax }
187}
188#[derive(Debug, Clone, PartialEq, Eq, Hash)]
189pub struct RAngle {
190 pub(crate) syntax: SyntaxToken,
191}
192impl std::fmt::Display for RAngle {
193 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
194 std::fmt::Display::fmt(&self.syntax, f)
195 }
196}
197impl AstToken for RAngle {
198 fn can_cast(kind: SyntaxKind) -> bool { kind == R_ANGLE }
199 fn cast(syntax: SyntaxToken) -> Option<Self> {
200 if Self::can_cast(syntax.kind()) {
201 Some(Self { syntax })
202 } else {
203 None
204 }
205 }
206 fn syntax(&self) -> &SyntaxToken { &self.syntax }
207}
208#[derive(Debug, Clone, PartialEq, Eq, Hash)]
209pub struct At {
210 pub(crate) syntax: SyntaxToken,
211}
212impl std::fmt::Display for At {
213 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
214 std::fmt::Display::fmt(&self.syntax, f)
215 }
216}
217impl AstToken for At {
218 fn can_cast(kind: SyntaxKind) -> bool { kind == AT }
219 fn cast(syntax: SyntaxToken) -> Option<Self> {
220 if Self::can_cast(syntax.kind()) {
221 Some(Self { syntax })
222 } else {
223 None
224 }
225 }
226 fn syntax(&self) -> &SyntaxToken { &self.syntax }
227}
228#[derive(Debug, Clone, PartialEq, Eq, Hash)]
229pub struct Pound {
230 pub(crate) syntax: SyntaxToken,
231}
232impl std::fmt::Display for Pound {
233 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
234 std::fmt::Display::fmt(&self.syntax, f)
235 }
236}
237impl AstToken for Pound {
238 fn can_cast(kind: SyntaxKind) -> bool { kind == POUND }
239 fn cast(syntax: SyntaxToken) -> Option<Self> {
240 if Self::can_cast(syntax.kind()) {
241 Some(Self { syntax })
242 } else {
243 None
244 }
245 }
246 fn syntax(&self) -> &SyntaxToken { &self.syntax }
247}
248#[derive(Debug, Clone, PartialEq, Eq, Hash)]
249pub struct Tilde {
250 pub(crate) syntax: SyntaxToken,
251}
252impl std::fmt::Display for Tilde {
253 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
254 std::fmt::Display::fmt(&self.syntax, f)
255 }
256}
257impl AstToken for Tilde {
258 fn can_cast(kind: SyntaxKind) -> bool { kind == TILDE }
259 fn cast(syntax: SyntaxToken) -> Option<Self> {
260 if Self::can_cast(syntax.kind()) {
261 Some(Self { syntax })
262 } else {
263 None
264 }
265 }
266 fn syntax(&self) -> &SyntaxToken { &self.syntax }
267}
268#[derive(Debug, Clone, PartialEq, Eq, Hash)]
269pub struct Question {
270 pub(crate) syntax: SyntaxToken,
271}
272impl std::fmt::Display for Question {
273 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
274 std::fmt::Display::fmt(&self.syntax, f)
275 }
276}
277impl AstToken for Question {
278 fn can_cast(kind: SyntaxKind) -> bool { kind == QUESTION }
279 fn cast(syntax: SyntaxToken) -> Option<Self> {
280 if Self::can_cast(syntax.kind()) {
281 Some(Self { syntax })
282 } else {
283 None
284 }
285 }
286 fn syntax(&self) -> &SyntaxToken { &self.syntax }
287}
288#[derive(Debug, Clone, PartialEq, Eq, Hash)]
289pub struct Dollar {
290 pub(crate) syntax: SyntaxToken,
291}
292impl std::fmt::Display for Dollar {
293 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
294 std::fmt::Display::fmt(&self.syntax, f)
295 }
296}
297impl AstToken for Dollar {
298 fn can_cast(kind: SyntaxKind) -> bool { kind == DOLLAR }
299 fn cast(syntax: SyntaxToken) -> Option<Self> {
300 if Self::can_cast(syntax.kind()) {
301 Some(Self { syntax })
302 } else {
303 None
304 }
305 }
306 fn syntax(&self) -> &SyntaxToken { &self.syntax }
307}
308#[derive(Debug, Clone, PartialEq, Eq, Hash)]
309pub struct Amp {
310 pub(crate) syntax: SyntaxToken,
311}
312impl std::fmt::Display for Amp {
313 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
314 std::fmt::Display::fmt(&self.syntax, f)
315 }
316}
317impl AstToken for Amp {
318 fn can_cast(kind: SyntaxKind) -> bool { kind == AMP }
319 fn cast(syntax: SyntaxToken) -> Option<Self> {
320 if Self::can_cast(syntax.kind()) {
321 Some(Self { syntax })
322 } else {
323 None
324 }
325 }
326 fn syntax(&self) -> &SyntaxToken { &self.syntax }
327}
328#[derive(Debug, Clone, PartialEq, Eq, Hash)]
329pub struct Pipe {
330 pub(crate) syntax: SyntaxToken,
331}
332impl std::fmt::Display for Pipe {
333 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
334 std::fmt::Display::fmt(&self.syntax, f)
335 }
336}
337impl AstToken for Pipe {
338 fn can_cast(kind: SyntaxKind) -> bool { kind == PIPE }
339 fn cast(syntax: SyntaxToken) -> Option<Self> {
340 if Self::can_cast(syntax.kind()) {
341 Some(Self { syntax })
342 } else {
343 None
344 }
345 }
346 fn syntax(&self) -> &SyntaxToken { &self.syntax }
347}
348#[derive(Debug, Clone, PartialEq, Eq, Hash)]
349pub struct Plus {
350 pub(crate) syntax: SyntaxToken,
351}
352impl std::fmt::Display for Plus {
353 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
354 std::fmt::Display::fmt(&self.syntax, f)
355 }
356}
357impl AstToken for Plus {
358 fn can_cast(kind: SyntaxKind) -> bool { kind == PLUS }
359 fn cast(syntax: SyntaxToken) -> Option<Self> {
360 if Self::can_cast(syntax.kind()) {
361 Some(Self { syntax })
362 } else {
363 None
364 }
365 }
366 fn syntax(&self) -> &SyntaxToken { &self.syntax }
367}
368#[derive(Debug, Clone, PartialEq, Eq, Hash)]
369pub struct Star {
370 pub(crate) syntax: SyntaxToken,
371}
372impl std::fmt::Display for Star {
373 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
374 std::fmt::Display::fmt(&self.syntax, f)
375 }
376}
377impl AstToken for Star {
378 fn can_cast(kind: SyntaxKind) -> bool { kind == STAR }
379 fn cast(syntax: SyntaxToken) -> Option<Self> {
380 if Self::can_cast(syntax.kind()) {
381 Some(Self { syntax })
382 } else {
383 None
384 }
385 }
386 fn syntax(&self) -> &SyntaxToken { &self.syntax }
387}
388#[derive(Debug, Clone, PartialEq, Eq, Hash)]
389pub struct Slash {
390 pub(crate) syntax: SyntaxToken,
391}
392impl std::fmt::Display for Slash {
393 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
394 std::fmt::Display::fmt(&self.syntax, f)
395 }
396}
397impl AstToken for Slash {
398 fn can_cast(kind: SyntaxKind) -> bool { kind == SLASH }
399 fn cast(syntax: SyntaxToken) -> Option<Self> {
400 if Self::can_cast(syntax.kind()) {
401 Some(Self { syntax })
402 } else {
403 None
404 }
405 }
406 fn syntax(&self) -> &SyntaxToken { &self.syntax }
407}
408#[derive(Debug, Clone, PartialEq, Eq, Hash)]
409pub struct Caret {
410 pub(crate) syntax: SyntaxToken,
411}
412impl std::fmt::Display for Caret {
413 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
414 std::fmt::Display::fmt(&self.syntax, f)
415 }
416}
417impl AstToken for Caret {
418 fn can_cast(kind: SyntaxKind) -> bool { kind == CARET }
419 fn cast(syntax: SyntaxToken) -> Option<Self> {
420 if Self::can_cast(syntax.kind()) {
421 Some(Self { syntax })
422 } else {
423 None
424 }
425 }
426 fn syntax(&self) -> &SyntaxToken { &self.syntax }
427}
428#[derive(Debug, Clone, PartialEq, Eq, Hash)]
429pub struct Percent {
430 pub(crate) syntax: SyntaxToken,
431}
432impl std::fmt::Display for Percent {
433 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
434 std::fmt::Display::fmt(&self.syntax, f)
435 }
436}
437impl AstToken for Percent {
438 fn can_cast(kind: SyntaxKind) -> bool { kind == PERCENT }
439 fn cast(syntax: SyntaxToken) -> Option<Self> {
440 if Self::can_cast(syntax.kind()) {
441 Some(Self { syntax })
442 } else {
443 None
444 }
445 }
446 fn syntax(&self) -> &SyntaxToken { &self.syntax }
447}
448#[derive(Debug, Clone, PartialEq, Eq, Hash)]
449pub struct Underscore {
450 pub(crate) syntax: SyntaxToken,
451}
452impl std::fmt::Display for Underscore {
453 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
454 std::fmt::Display::fmt(&self.syntax, f)
455 }
456}
457impl AstToken for Underscore {
458 fn can_cast(kind: SyntaxKind) -> bool { kind == UNDERSCORE }
459 fn cast(syntax: SyntaxToken) -> Option<Self> {
460 if Self::can_cast(syntax.kind()) {
461 Some(Self { syntax })
462 } else {
463 None
464 }
465 }
466 fn syntax(&self) -> &SyntaxToken { &self.syntax }
467}
468#[derive(Debug, Clone, PartialEq, Eq, Hash)]
469pub struct Dot {
470 pub(crate) syntax: SyntaxToken,
471}
472impl std::fmt::Display for Dot {
473 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
474 std::fmt::Display::fmt(&self.syntax, f)
475 }
476}
477impl AstToken for Dot {
478 fn can_cast(kind: SyntaxKind) -> bool { kind == DOT }
479 fn cast(syntax: SyntaxToken) -> Option<Self> {
480 if Self::can_cast(syntax.kind()) {
481 Some(Self { syntax })
482 } else {
483 None
484 }
485 }
486 fn syntax(&self) -> &SyntaxToken { &self.syntax }
487}
488#[derive(Debug, Clone, PartialEq, Eq, Hash)]
489pub struct Dotdot {
490 pub(crate) syntax: SyntaxToken,
491}
492impl std::fmt::Display for Dotdot {
493 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
494 std::fmt::Display::fmt(&self.syntax, f)
495 }
496}
497impl AstToken for Dotdot {
498 fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOT }
499 fn cast(syntax: SyntaxToken) -> Option<Self> {
500 if Self::can_cast(syntax.kind()) {
501 Some(Self { syntax })
502 } else {
503 None
504 }
505 }
506 fn syntax(&self) -> &SyntaxToken { &self.syntax }
507}
508#[derive(Debug, Clone, PartialEq, Eq, Hash)]
509pub struct Dotdotdot {
510 pub(crate) syntax: SyntaxToken,
511}
512impl std::fmt::Display for Dotdotdot {
513 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
514 std::fmt::Display::fmt(&self.syntax, f)
515 }
516}
517impl AstToken for Dotdotdot {
518 fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOTDOT }
519 fn cast(syntax: SyntaxToken) -> Option<Self> {
520 if Self::can_cast(syntax.kind()) {
521 Some(Self { syntax })
522 } else {
523 None
524 }
525 }
526 fn syntax(&self) -> &SyntaxToken { &self.syntax }
527}
528#[derive(Debug, Clone, PartialEq, Eq, Hash)]
529pub struct Dotdoteq {
530 pub(crate) syntax: SyntaxToken,
531}
532impl std::fmt::Display for Dotdoteq {
533 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
534 std::fmt::Display::fmt(&self.syntax, f)
535 }
536}
537impl AstToken for Dotdoteq {
538 fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOTEQ }
539 fn cast(syntax: SyntaxToken) -> Option<Self> {
540 if Self::can_cast(syntax.kind()) {
541 Some(Self { syntax })
542 } else {
543 None
544 }
545 }
546 fn syntax(&self) -> &SyntaxToken { &self.syntax }
547}
548#[derive(Debug, Clone, PartialEq, Eq, Hash)]
549pub struct Colon {
550 pub(crate) syntax: SyntaxToken,
551}
552impl std::fmt::Display for Colon {
553 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
554 std::fmt::Display::fmt(&self.syntax, f)
555 }
556}
557impl AstToken for Colon {
558 fn can_cast(kind: SyntaxKind) -> bool { kind == COLON }
559 fn cast(syntax: SyntaxToken) -> Option<Self> {
560 if Self::can_cast(syntax.kind()) {
561 Some(Self { syntax })
562 } else {
563 None
564 }
565 }
566 fn syntax(&self) -> &SyntaxToken { &self.syntax }
567}
568#[derive(Debug, Clone, PartialEq, Eq, Hash)]
569pub struct Coloncolon {
570 pub(crate) syntax: SyntaxToken,
571}
572impl std::fmt::Display for Coloncolon {
573 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
574 std::fmt::Display::fmt(&self.syntax, f)
575 }
576}
577impl AstToken for Coloncolon {
578 fn can_cast(kind: SyntaxKind) -> bool { kind == COLONCOLON }
579 fn cast(syntax: SyntaxToken) -> Option<Self> {
580 if Self::can_cast(syntax.kind()) {
581 Some(Self { syntax })
582 } else {
583 None
584 }
585 }
586 fn syntax(&self) -> &SyntaxToken { &self.syntax }
587}
588#[derive(Debug, Clone, PartialEq, Eq, Hash)]
589pub struct Eq {
590 pub(crate) syntax: SyntaxToken,
591}
592impl std::fmt::Display for Eq {
593 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
594 std::fmt::Display::fmt(&self.syntax, f)
595 }
596}
597impl AstToken for Eq {
598 fn can_cast(kind: SyntaxKind) -> bool { kind == EQ }
599 fn cast(syntax: SyntaxToken) -> Option<Self> {
600 if Self::can_cast(syntax.kind()) {
601 Some(Self { syntax })
602 } else {
603 None
604 }
605 }
606 fn syntax(&self) -> &SyntaxToken { &self.syntax }
607}
608#[derive(Debug, Clone, PartialEq, Eq, Hash)]
609pub struct Eqeq {
610 pub(crate) syntax: SyntaxToken,
611}
612impl std::fmt::Display for Eqeq {
613 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
614 std::fmt::Display::fmt(&self.syntax, f)
615 }
616}
617impl AstToken for Eqeq {
618 fn can_cast(kind: SyntaxKind) -> bool { kind == EQEQ }
619 fn cast(syntax: SyntaxToken) -> Option<Self> {
620 if Self::can_cast(syntax.kind()) {
621 Some(Self { syntax })
622 } else {
623 None
624 }
625 }
626 fn syntax(&self) -> &SyntaxToken { &self.syntax }
627}
628#[derive(Debug, Clone, PartialEq, Eq, Hash)]
629pub struct FatArrow {
630 pub(crate) syntax: SyntaxToken,
631}
632impl std::fmt::Display for FatArrow {
633 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
634 std::fmt::Display::fmt(&self.syntax, f)
635 }
636}
637impl AstToken for FatArrow {
638 fn can_cast(kind: SyntaxKind) -> bool { kind == FAT_ARROW }
639 fn cast(syntax: SyntaxToken) -> Option<Self> {
640 if Self::can_cast(syntax.kind()) {
641 Some(Self { syntax })
642 } else {
643 None
644 }
645 }
646 fn syntax(&self) -> &SyntaxToken { &self.syntax }
647}
648#[derive(Debug, Clone, PartialEq, Eq, Hash)]
649pub struct Excl {
650 pub(crate) syntax: SyntaxToken,
651}
652impl std::fmt::Display for Excl {
653 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
654 std::fmt::Display::fmt(&self.syntax, f)
655 }
656}
657impl AstToken for Excl {
658 fn can_cast(kind: SyntaxKind) -> bool { kind == EXCL }
659 fn cast(syntax: SyntaxToken) -> Option<Self> {
660 if Self::can_cast(syntax.kind()) {
661 Some(Self { syntax })
662 } else {
663 None
664 }
665 }
666 fn syntax(&self) -> &SyntaxToken { &self.syntax }
667}
668#[derive(Debug, Clone, PartialEq, Eq, Hash)]
669pub struct Neq {
670 pub(crate) syntax: SyntaxToken,
671}
672impl std::fmt::Display for Neq {
673 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
674 std::fmt::Display::fmt(&self.syntax, f)
675 }
676}
677impl AstToken for Neq {
678 fn can_cast(kind: SyntaxKind) -> bool { kind == NEQ }
679 fn cast(syntax: SyntaxToken) -> Option<Self> {
680 if Self::can_cast(syntax.kind()) {
681 Some(Self { syntax })
682 } else {
683 None
684 }
685 }
686 fn syntax(&self) -> &SyntaxToken { &self.syntax }
687}
688#[derive(Debug, Clone, PartialEq, Eq, Hash)]
689pub struct Minus {
690 pub(crate) syntax: SyntaxToken,
691}
692impl std::fmt::Display for Minus {
693 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
694 std::fmt::Display::fmt(&self.syntax, f)
695 }
696}
697impl AstToken for Minus {
698 fn can_cast(kind: SyntaxKind) -> bool { kind == MINUS }
699 fn cast(syntax: SyntaxToken) -> Option<Self> {
700 if Self::can_cast(syntax.kind()) {
701 Some(Self { syntax })
702 } else {
703 None
704 }
705 }
706 fn syntax(&self) -> &SyntaxToken { &self.syntax }
707}
708#[derive(Debug, Clone, PartialEq, Eq, Hash)]
709pub struct ThinArrow {
710 pub(crate) syntax: SyntaxToken,
711}
712impl std::fmt::Display for ThinArrow {
713 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
714 std::fmt::Display::fmt(&self.syntax, f)
715 }
716}
717impl AstToken for ThinArrow {
718 fn can_cast(kind: SyntaxKind) -> bool { kind == THIN_ARROW }
719 fn cast(syntax: SyntaxToken) -> Option<Self> {
720 if Self::can_cast(syntax.kind()) {
721 Some(Self { syntax })
722 } else {
723 None
724 }
725 }
726 fn syntax(&self) -> &SyntaxToken { &self.syntax }
727}
728#[derive(Debug, Clone, PartialEq, Eq, Hash)]
729pub struct Lteq {
730 pub(crate) syntax: SyntaxToken,
731}
732impl std::fmt::Display for Lteq {
733 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
734 std::fmt::Display::fmt(&self.syntax, f)
735 }
736}
737impl AstToken for Lteq {
738 fn can_cast(kind: SyntaxKind) -> bool { kind == LTEQ }
739 fn cast(syntax: SyntaxToken) -> Option<Self> {
740 if Self::can_cast(syntax.kind()) {
741 Some(Self { syntax })
742 } else {
743 None
744 }
745 }
746 fn syntax(&self) -> &SyntaxToken { &self.syntax }
747}
748#[derive(Debug, Clone, PartialEq, Eq, Hash)]
749pub struct Gteq {
750 pub(crate) syntax: SyntaxToken,
751}
752impl std::fmt::Display for Gteq {
753 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
754 std::fmt::Display::fmt(&self.syntax, f)
755 }
756}
757impl AstToken for Gteq {
758 fn can_cast(kind: SyntaxKind) -> bool { kind == GTEQ }
759 fn cast(syntax: SyntaxToken) -> Option<Self> {
760 if Self::can_cast(syntax.kind()) {
761 Some(Self { syntax })
762 } else {
763 None
764 }
765 }
766 fn syntax(&self) -> &SyntaxToken { &self.syntax }
767}
768#[derive(Debug, Clone, PartialEq, Eq, Hash)]
769pub struct Pluseq {
770 pub(crate) syntax: SyntaxToken,
771}
772impl std::fmt::Display for Pluseq {
773 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
774 std::fmt::Display::fmt(&self.syntax, f)
775 }
776}
777impl AstToken for Pluseq {
778 fn can_cast(kind: SyntaxKind) -> bool { kind == PLUSEQ }
779 fn cast(syntax: SyntaxToken) -> Option<Self> {
780 if Self::can_cast(syntax.kind()) {
781 Some(Self { syntax })
782 } else {
783 None
784 }
785 }
786 fn syntax(&self) -> &SyntaxToken { &self.syntax }
787}
788#[derive(Debug, Clone, PartialEq, Eq, Hash)]
789pub struct Minuseq {
790 pub(crate) syntax: SyntaxToken,
791}
792impl std::fmt::Display for Minuseq {
793 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
794 std::fmt::Display::fmt(&self.syntax, f)
795 }
796}
797impl AstToken for Minuseq {
798 fn can_cast(kind: SyntaxKind) -> bool { kind == MINUSEQ }
799 fn cast(syntax: SyntaxToken) -> Option<Self> {
800 if Self::can_cast(syntax.kind()) {
801 Some(Self { syntax })
802 } else {
803 None
804 }
805 }
806 fn syntax(&self) -> &SyntaxToken { &self.syntax }
807}
808#[derive(Debug, Clone, PartialEq, Eq, Hash)]
809pub struct Pipeeq {
810 pub(crate) syntax: SyntaxToken,
811}
812impl std::fmt::Display for Pipeeq {
813 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
814 std::fmt::Display::fmt(&self.syntax, f)
815 }
816}
817impl AstToken for Pipeeq {
818 fn can_cast(kind: SyntaxKind) -> bool { kind == PIPEEQ }
819 fn cast(syntax: SyntaxToken) -> Option<Self> {
820 if Self::can_cast(syntax.kind()) {
821 Some(Self { syntax })
822 } else {
823 None
824 }
825 }
826 fn syntax(&self) -> &SyntaxToken { &self.syntax }
827}
828#[derive(Debug, Clone, PartialEq, Eq, Hash)]
829pub struct Ampeq {
830 pub(crate) syntax: SyntaxToken,
831}
832impl std::fmt::Display for Ampeq {
833 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
834 std::fmt::Display::fmt(&self.syntax, f)
835 }
836}
837impl AstToken for Ampeq {
838 fn can_cast(kind: SyntaxKind) -> bool { kind == AMPEQ }
839 fn cast(syntax: SyntaxToken) -> Option<Self> {
840 if Self::can_cast(syntax.kind()) {
841 Some(Self { syntax })
842 } else {
843 None
844 }
845 }
846 fn syntax(&self) -> &SyntaxToken { &self.syntax }
847}
848#[derive(Debug, Clone, PartialEq, Eq, Hash)]
849pub struct Careteq {
850 pub(crate) syntax: SyntaxToken,
851}
852impl std::fmt::Display for Careteq {
853 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
854 std::fmt::Display::fmt(&self.syntax, f)
855 }
856}
857impl AstToken for Careteq {
858 fn can_cast(kind: SyntaxKind) -> bool { kind == CARETEQ }
859 fn cast(syntax: SyntaxToken) -> Option<Self> {
860 if Self::can_cast(syntax.kind()) {
861 Some(Self { syntax })
862 } else {
863 None
864 }
865 }
866 fn syntax(&self) -> &SyntaxToken { &self.syntax }
867}
868#[derive(Debug, Clone, PartialEq, Eq, Hash)]
869pub struct Slasheq {
870 pub(crate) syntax: SyntaxToken,
871}
872impl std::fmt::Display for Slasheq {
873 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
874 std::fmt::Display::fmt(&self.syntax, f)
875 }
876}
877impl AstToken for Slasheq {
878 fn can_cast(kind: SyntaxKind) -> bool { kind == SLASHEQ }
879 fn cast(syntax: SyntaxToken) -> Option<Self> {
880 if Self::can_cast(syntax.kind()) {
881 Some(Self { syntax })
882 } else {
883 None
884 }
885 }
886 fn syntax(&self) -> &SyntaxToken { &self.syntax }
887}
888#[derive(Debug, Clone, PartialEq, Eq, Hash)]
889pub struct Stareq {
890 pub(crate) syntax: SyntaxToken,
891}
892impl std::fmt::Display for Stareq {
893 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
894 std::fmt::Display::fmt(&self.syntax, f)
895 }
896}
897impl AstToken for Stareq {
898 fn can_cast(kind: SyntaxKind) -> bool { kind == STAREQ }
899 fn cast(syntax: SyntaxToken) -> Option<Self> {
900 if Self::can_cast(syntax.kind()) {
901 Some(Self { syntax })
902 } else {
903 None
904 }
905 }
906 fn syntax(&self) -> &SyntaxToken { &self.syntax }
907}
908#[derive(Debug, Clone, PartialEq, Eq, Hash)]
909pub struct Percenteq {
910 pub(crate) syntax: SyntaxToken,
911}
912impl std::fmt::Display for Percenteq {
913 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
914 std::fmt::Display::fmt(&self.syntax, f)
915 }
916}
917impl AstToken for Percenteq {
918 fn can_cast(kind: SyntaxKind) -> bool { kind == PERCENTEQ }
919 fn cast(syntax: SyntaxToken) -> Option<Self> {
920 if Self::can_cast(syntax.kind()) {
921 Some(Self { syntax })
922 } else {
923 None
924 }
925 }
926 fn syntax(&self) -> &SyntaxToken { &self.syntax }
927}
928#[derive(Debug, Clone, PartialEq, Eq, Hash)]
929pub struct Ampamp {
930 pub(crate) syntax: SyntaxToken,
931}
932impl std::fmt::Display for Ampamp {
933 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
934 std::fmt::Display::fmt(&self.syntax, f)
935 }
936}
937impl AstToken for Ampamp {
938 fn can_cast(kind: SyntaxKind) -> bool { kind == AMPAMP }
939 fn cast(syntax: SyntaxToken) -> Option<Self> {
940 if Self::can_cast(syntax.kind()) {
941 Some(Self { syntax })
942 } else {
943 None
944 }
945 }
946 fn syntax(&self) -> &SyntaxToken { &self.syntax }
947}
948#[derive(Debug, Clone, PartialEq, Eq, Hash)]
949pub struct Pipepipe {
950 pub(crate) syntax: SyntaxToken,
951}
952impl std::fmt::Display for Pipepipe {
953 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
954 std::fmt::Display::fmt(&self.syntax, f)
955 }
956}
957impl AstToken for Pipepipe {
958 fn can_cast(kind: SyntaxKind) -> bool { kind == PIPEPIPE }
959 fn cast(syntax: SyntaxToken) -> Option<Self> {
960 if Self::can_cast(syntax.kind()) {
961 Some(Self { syntax })
962 } else {
963 None
964 }
965 }
966 fn syntax(&self) -> &SyntaxToken { &self.syntax }
967}
968#[derive(Debug, Clone, PartialEq, Eq, Hash)]
969pub struct Shl {
970 pub(crate) syntax: SyntaxToken,
971}
972impl std::fmt::Display for Shl {
973 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
974 std::fmt::Display::fmt(&self.syntax, f)
975 }
976}
977impl AstToken for Shl {
978 fn can_cast(kind: SyntaxKind) -> bool { kind == SHL }
979 fn cast(syntax: SyntaxToken) -> Option<Self> {
980 if Self::can_cast(syntax.kind()) {
981 Some(Self { syntax })
982 } else {
983 None
984 }
985 }
986 fn syntax(&self) -> &SyntaxToken { &self.syntax }
987}
988#[derive(Debug, Clone, PartialEq, Eq, Hash)]
989pub struct Shr {
990 pub(crate) syntax: SyntaxToken,
991}
992impl std::fmt::Display for Shr {
993 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
994 std::fmt::Display::fmt(&self.syntax, f)
995 }
996}
997impl AstToken for Shr {
998 fn can_cast(kind: SyntaxKind) -> bool { kind == SHR }
999 fn cast(syntax: SyntaxToken) -> Option<Self> {
1000 if Self::can_cast(syntax.kind()) {
1001 Some(Self { syntax })
1002 } else {
1003 None
1004 }
1005 }
1006 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1007}
1008#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1009pub struct Shleq {
1010 pub(crate) syntax: SyntaxToken,
1011}
1012impl std::fmt::Display for Shleq {
1013 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1014 std::fmt::Display::fmt(&self.syntax, f)
1015 }
1016}
1017impl AstToken for Shleq {
1018 fn can_cast(kind: SyntaxKind) -> bool { kind == SHLEQ }
1019 fn cast(syntax: SyntaxToken) -> Option<Self> {
1020 if Self::can_cast(syntax.kind()) {
1021 Some(Self { syntax })
1022 } else {
1023 None
1024 }
1025 }
1026 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1027}
1028#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1029pub struct Shreq {
1030 pub(crate) syntax: SyntaxToken,
1031}
1032impl std::fmt::Display for Shreq {
1033 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1034 std::fmt::Display::fmt(&self.syntax, f)
1035 }
1036}
1037impl AstToken for Shreq {
1038 fn can_cast(kind: SyntaxKind) -> bool { kind == SHREQ }
1039 fn cast(syntax: SyntaxToken) -> Option<Self> {
1040 if Self::can_cast(syntax.kind()) {
1041 Some(Self { syntax })
1042 } else {
1043 None
1044 }
1045 }
1046 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1047}
1048#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1049pub struct IntNumber {
1050 pub(crate) syntax: SyntaxToken,
1051}
1052impl std::fmt::Display for IntNumber {
1053 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1054 std::fmt::Display::fmt(&self.syntax, f)
1055 }
1056}
1057impl AstToken for IntNumber {
1058 fn can_cast(kind: SyntaxKind) -> bool { kind == INT_NUMBER }
1059 fn cast(syntax: SyntaxToken) -> Option<Self> {
1060 if Self::can_cast(syntax.kind()) {
1061 Some(Self { syntax })
1062 } else {
1063 None
1064 }
1065 }
1066 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1067}
1068#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1069pub struct FloatNumber {
1070 pub(crate) syntax: SyntaxToken,
1071}
1072impl std::fmt::Display for FloatNumber {
1073 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1074 std::fmt::Display::fmt(&self.syntax, f)
1075 }
1076}
1077impl AstToken for FloatNumber {
1078 fn can_cast(kind: SyntaxKind) -> bool { kind == FLOAT_NUMBER }
1079 fn cast(syntax: SyntaxToken) -> Option<Self> {
1080 if Self::can_cast(syntax.kind()) {
1081 Some(Self { syntax })
1082 } else {
1083 None
1084 }
1085 }
1086 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1087}
1088#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1089pub struct Char {
1090 pub(crate) syntax: SyntaxToken,
1091}
1092impl std::fmt::Display for Char {
1093 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1094 std::fmt::Display::fmt(&self.syntax, f)
1095 }
1096}
1097impl AstToken for Char {
1098 fn can_cast(kind: SyntaxKind) -> bool { kind == CHAR }
1099 fn cast(syntax: SyntaxToken) -> Option<Self> {
1100 if Self::can_cast(syntax.kind()) {
1101 Some(Self { syntax })
1102 } else {
1103 None
1104 }
1105 }
1106 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1107}
1108#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1109pub struct Byte {
1110 pub(crate) syntax: SyntaxToken,
1111}
1112impl std::fmt::Display for Byte {
1113 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1114 std::fmt::Display::fmt(&self.syntax, f)
1115 }
1116}
1117impl AstToken for Byte {
1118 fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE }
1119 fn cast(syntax: SyntaxToken) -> Option<Self> {
1120 if Self::can_cast(syntax.kind()) {
1121 Some(Self { syntax })
1122 } else {
1123 None
1124 }
1125 }
1126 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1127}
1128#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1129pub struct String {
1130 pub(crate) syntax: SyntaxToken,
1131}
1132impl std::fmt::Display for String {
1133 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1134 std::fmt::Display::fmt(&self.syntax, f)
1135 }
1136}
1137impl AstToken for String {
1138 fn can_cast(kind: SyntaxKind) -> bool { kind == STRING }
1139 fn cast(syntax: SyntaxToken) -> Option<Self> {
1140 if Self::can_cast(syntax.kind()) {
1141 Some(Self { syntax })
1142 } else {
1143 None
1144 }
1145 }
1146 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1147}
1148#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1149pub struct RawString {
1150 pub(crate) syntax: SyntaxToken,
1151}
1152impl std::fmt::Display for RawString {
1153 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1154 std::fmt::Display::fmt(&self.syntax, f)
1155 }
1156}
1157impl AstToken for RawString {
1158 fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING }
1159 fn cast(syntax: SyntaxToken) -> Option<Self> {
1160 if Self::can_cast(syntax.kind()) {
1161 Some(Self { syntax })
1162 } else {
1163 None
1164 }
1165 }
1166 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1167}
1168#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1169pub struct ByteString {
1170 pub(crate) syntax: SyntaxToken,
1171}
1172impl std::fmt::Display for ByteString {
1173 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1174 std::fmt::Display::fmt(&self.syntax, f)
1175 }
1176}
1177impl AstToken for ByteString {
1178 fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE_STRING }
1179 fn cast(syntax: SyntaxToken) -> Option<Self> {
1180 if Self::can_cast(syntax.kind()) {
1181 Some(Self { syntax })
1182 } else {
1183 None
1184 }
1185 }
1186 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1187}
1188#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1189pub struct RawByteString {
1190 pub(crate) syntax: SyntaxToken,
1191}
1192impl std::fmt::Display for RawByteString {
1193 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1194 std::fmt::Display::fmt(&self.syntax, f)
1195 }
1196}
1197impl AstToken for RawByteString {
1198 fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_BYTE_STRING }
1199 fn cast(syntax: SyntaxToken) -> Option<Self> {
1200 if Self::can_cast(syntax.kind()) {
1201 Some(Self { syntax })
1202 } else {
1203 None
1204 }
1205 }
1206 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1207}
1208#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1209pub struct Error {
1210 pub(crate) syntax: SyntaxToken,
1211}
1212impl std::fmt::Display for Error {
1213 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1214 std::fmt::Display::fmt(&self.syntax, f)
1215 }
1216}
1217impl AstToken for Error {
1218 fn can_cast(kind: SyntaxKind) -> bool { kind == ERROR }
1219 fn cast(syntax: SyntaxToken) -> Option<Self> {
1220 if Self::can_cast(syntax.kind()) {
1221 Some(Self { syntax })
1222 } else {
1223 None
1224 }
1225 }
1226 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1227}
1228#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1229pub struct Ident {
1230 pub(crate) syntax: SyntaxToken,
1231}
1232impl std::fmt::Display for Ident {
1233 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1234 std::fmt::Display::fmt(&self.syntax, f)
1235 }
1236}
1237impl AstToken for Ident {
1238 fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT }
1239 fn cast(syntax: SyntaxToken) -> Option<Self> {
1240 if Self::can_cast(syntax.kind()) {
1241 Some(Self { syntax })
1242 } else {
1243 None
1244 }
1245 }
1246 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1247}
1248#[derive(Debug, Clone, PartialEq, Eq, Hash)] 9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1249pub struct Whitespace { 10pub struct Whitespace {
1250 pub(crate) syntax: SyntaxToken, 11 pub(crate) syntax: SyntaxToken,
@@ -1265,26 +26,7 @@ impl AstToken for Whitespace {
1265 } 26 }
1266 fn syntax(&self) -> &SyntaxToken { &self.syntax } 27 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1267} 28}
1268#[derive(Debug, Clone, PartialEq, Eq, Hash)] 29
1269pub struct Lifetime {
1270 pub(crate) syntax: SyntaxToken,
1271}
1272impl std::fmt::Display for Lifetime {
1273 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1274 std::fmt::Display::fmt(&self.syntax, f)
1275 }
1276}
1277impl AstToken for Lifetime {
1278 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME }
1279 fn cast(syntax: SyntaxToken) -> Option<Self> {
1280 if Self::can_cast(syntax.kind()) {
1281 Some(Self { syntax })
1282 } else {
1283 None
1284 }
1285 }
1286 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1287}
1288#[derive(Debug, Clone, PartialEq, Eq, Hash)] 30#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1289pub struct Comment { 31pub struct Comment {
1290 pub(crate) syntax: SyntaxToken, 32 pub(crate) syntax: SyntaxToken,
@@ -1305,37 +47,18 @@ impl AstToken for Comment {
1305 } 47 }
1306 fn syntax(&self) -> &SyntaxToken { &self.syntax } 48 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1307} 49}
50
1308#[derive(Debug, Clone, PartialEq, Eq, Hash)] 51#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1309pub struct Shebang { 52pub struct String {
1310 pub(crate) syntax: SyntaxToken,
1311}
1312impl std::fmt::Display for Shebang {
1313 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1314 std::fmt::Display::fmt(&self.syntax, f)
1315 }
1316}
1317impl AstToken for Shebang {
1318 fn can_cast(kind: SyntaxKind) -> bool { kind == SHEBANG }
1319 fn cast(syntax: SyntaxToken) -> Option<Self> {
1320 if Self::can_cast(syntax.kind()) {
1321 Some(Self { syntax })
1322 } else {
1323 None
1324 }
1325 }
1326 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1327}
1328#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1329pub struct LDollar {
1330 pub(crate) syntax: SyntaxToken, 53 pub(crate) syntax: SyntaxToken,
1331} 54}
1332impl std::fmt::Display for LDollar { 55impl std::fmt::Display for String {
1333 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 56 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1334 std::fmt::Display::fmt(&self.syntax, f) 57 std::fmt::Display::fmt(&self.syntax, f)
1335 } 58 }
1336} 59}
1337impl AstToken for LDollar { 60impl AstToken for String {
1338 fn can_cast(kind: SyntaxKind) -> bool { kind == L_DOLLAR } 61 fn can_cast(kind: SyntaxKind) -> bool { kind == STRING }
1339 fn cast(syntax: SyntaxToken) -> Option<Self> { 62 fn cast(syntax: SyntaxToken) -> Option<Self> {
1340 if Self::can_cast(syntax.kind()) { 63 if Self::can_cast(syntax.kind()) {
1341 Some(Self { syntax }) 64 Some(Self { syntax })
@@ -1345,17 +68,18 @@ impl AstToken for LDollar {
1345 } 68 }
1346 fn syntax(&self) -> &SyntaxToken { &self.syntax } 69 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1347} 70}
71
1348#[derive(Debug, Clone, PartialEq, Eq, Hash)] 72#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1349pub struct RDollar { 73pub struct RawString {
1350 pub(crate) syntax: SyntaxToken, 74 pub(crate) syntax: SyntaxToken,
1351} 75}
1352impl std::fmt::Display for RDollar { 76impl std::fmt::Display for RawString {
1353 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 77 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1354 std::fmt::Display::fmt(&self.syntax, f) 78 std::fmt::Display::fmt(&self.syntax, f)
1355 } 79 }
1356} 80}
1357impl AstToken for RDollar { 81impl AstToken for RawString {
1358 fn can_cast(kind: SyntaxKind) -> bool { kind == R_DOLLAR } 82 fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING }
1359 fn cast(syntax: SyntaxToken) -> Option<Self> { 83 fn cast(syntax: SyntaxToken) -> Option<Self> {
1360 if Self::can_cast(syntax.kind()) { 84 if Self::can_cast(syntax.kind()) {
1361 Some(Self { syntax }) 85 Some(Self { syntax })
@@ -1365,532 +89,3 @@ impl AstToken for RDollar {
1365 } 89 }
1366 fn syntax(&self) -> &SyntaxToken { &self.syntax } 90 fn syntax(&self) -> &SyntaxToken { &self.syntax }
1367} 91}
1368#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1369pub enum LeftDelimiter {
1370 LParen(LParen),
1371 LBrack(LBrack),
1372 LCurly(LCurly),
1373}
1374impl From<LParen> for LeftDelimiter {
1375 fn from(node: LParen) -> LeftDelimiter { LeftDelimiter::LParen(node) }
1376}
1377impl From<LBrack> for LeftDelimiter {
1378 fn from(node: LBrack) -> LeftDelimiter { LeftDelimiter::LBrack(node) }
1379}
1380impl From<LCurly> for LeftDelimiter {
1381 fn from(node: LCurly) -> LeftDelimiter { LeftDelimiter::LCurly(node) }
1382}
1383impl std::fmt::Display for LeftDelimiter {
1384 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1385 std::fmt::Display::fmt(self.syntax(), f)
1386 }
1387}
1388impl AstToken for LeftDelimiter {
1389 fn can_cast(kind: SyntaxKind) -> bool {
1390 match kind {
1391 L_PAREN | L_BRACK | L_CURLY => true,
1392 _ => false,
1393 }
1394 }
1395 fn cast(syntax: SyntaxToken) -> Option<Self> {
1396 let res = match syntax.kind() {
1397 L_PAREN => LeftDelimiter::LParen(LParen { syntax }),
1398 L_BRACK => LeftDelimiter::LBrack(LBrack { syntax }),
1399 L_CURLY => LeftDelimiter::LCurly(LCurly { syntax }),
1400 _ => return None,
1401 };
1402 Some(res)
1403 }
1404 fn syntax(&self) -> &SyntaxToken {
1405 match self {
1406 LeftDelimiter::LParen(it) => &it.syntax,
1407 LeftDelimiter::LBrack(it) => &it.syntax,
1408 LeftDelimiter::LCurly(it) => &it.syntax,
1409 }
1410 }
1411}
1412#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1413pub enum RightDelimiter {
1414 RParen(RParen),
1415 RBrack(RBrack),
1416 RCurly(RCurly),
1417}
1418impl From<RParen> for RightDelimiter {
1419 fn from(node: RParen) -> RightDelimiter { RightDelimiter::RParen(node) }
1420}
1421impl From<RBrack> for RightDelimiter {
1422 fn from(node: RBrack) -> RightDelimiter { RightDelimiter::RBrack(node) }
1423}
1424impl From<RCurly> for RightDelimiter {
1425 fn from(node: RCurly) -> RightDelimiter { RightDelimiter::RCurly(node) }
1426}
1427impl std::fmt::Display for RightDelimiter {
1428 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1429 std::fmt::Display::fmt(self.syntax(), f)
1430 }
1431}
1432impl AstToken for RightDelimiter {
1433 fn can_cast(kind: SyntaxKind) -> bool {
1434 match kind {
1435 R_PAREN | R_BRACK | R_CURLY => true,
1436 _ => false,
1437 }
1438 }
1439 fn cast(syntax: SyntaxToken) -> Option<Self> {
1440 let res = match syntax.kind() {
1441 R_PAREN => RightDelimiter::RParen(RParen { syntax }),
1442 R_BRACK => RightDelimiter::RBrack(RBrack { syntax }),
1443 R_CURLY => RightDelimiter::RCurly(RCurly { syntax }),
1444 _ => return None,
1445 };
1446 Some(res)
1447 }
1448 fn syntax(&self) -> &SyntaxToken {
1449 match self {
1450 RightDelimiter::RParen(it) => &it.syntax,
1451 RightDelimiter::RBrack(it) => &it.syntax,
1452 RightDelimiter::RCurly(it) => &it.syntax,
1453 }
1454 }
1455}
1456#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1457pub enum RangeSeparator {
1458 Dotdot(Dotdot),
1459 Dotdotdot(Dotdotdot),
1460 Dotdoteq(Dotdoteq),
1461}
1462impl From<Dotdot> for RangeSeparator {
1463 fn from(node: Dotdot) -> RangeSeparator { RangeSeparator::Dotdot(node) }
1464}
1465impl From<Dotdotdot> for RangeSeparator {
1466 fn from(node: Dotdotdot) -> RangeSeparator { RangeSeparator::Dotdotdot(node) }
1467}
1468impl From<Dotdoteq> for RangeSeparator {
1469 fn from(node: Dotdoteq) -> RangeSeparator { RangeSeparator::Dotdoteq(node) }
1470}
1471impl std::fmt::Display for RangeSeparator {
1472 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1473 std::fmt::Display::fmt(self.syntax(), f)
1474 }
1475}
1476impl AstToken for RangeSeparator {
1477 fn can_cast(kind: SyntaxKind) -> bool {
1478 match kind {
1479 DOTDOT | DOTDOTDOT | DOTDOTEQ => true,
1480 _ => false,
1481 }
1482 }
1483 fn cast(syntax: SyntaxToken) -> Option<Self> {
1484 let res = match syntax.kind() {
1485 DOTDOT => RangeSeparator::Dotdot(Dotdot { syntax }),
1486 DOTDOTDOT => RangeSeparator::Dotdotdot(Dotdotdot { syntax }),
1487 DOTDOTEQ => RangeSeparator::Dotdoteq(Dotdoteq { syntax }),
1488 _ => return None,
1489 };
1490 Some(res)
1491 }
1492 fn syntax(&self) -> &SyntaxToken {
1493 match self {
1494 RangeSeparator::Dotdot(it) => &it.syntax,
1495 RangeSeparator::Dotdotdot(it) => &it.syntax,
1496 RangeSeparator::Dotdoteq(it) => &it.syntax,
1497 }
1498 }
1499}
1500#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1501pub enum BinOp {
1502 Pipepipe(Pipepipe),
1503 Ampamp(Ampamp),
1504 Eqeq(Eqeq),
1505 Neq(Neq),
1506 Lteq(Lteq),
1507 Gteq(Gteq),
1508 LAngle(LAngle),
1509 RAngle(RAngle),
1510 Plus(Plus),
1511 Star(Star),
1512 Minus(Minus),
1513 Slash(Slash),
1514 Percent(Percent),
1515 Shl(Shl),
1516 Shr(Shr),
1517 Caret(Caret),
1518 Pipe(Pipe),
1519 Amp(Amp),
1520 Eq(Eq),
1521 Pluseq(Pluseq),
1522 Slasheq(Slasheq),
1523 Stareq(Stareq),
1524 Percenteq(Percenteq),
1525 Shreq(Shreq),
1526 Shleq(Shleq),
1527 Minuseq(Minuseq),
1528 Pipeeq(Pipeeq),
1529 Ampeq(Ampeq),
1530 Careteq(Careteq),
1531}
1532impl From<Pipepipe> for BinOp {
1533 fn from(node: Pipepipe) -> BinOp { BinOp::Pipepipe(node) }
1534}
1535impl From<Ampamp> for BinOp {
1536 fn from(node: Ampamp) -> BinOp { BinOp::Ampamp(node) }
1537}
1538impl From<Eqeq> for BinOp {
1539 fn from(node: Eqeq) -> BinOp { BinOp::Eqeq(node) }
1540}
1541impl From<Neq> for BinOp {
1542 fn from(node: Neq) -> BinOp { BinOp::Neq(node) }
1543}
1544impl From<Lteq> for BinOp {
1545 fn from(node: Lteq) -> BinOp { BinOp::Lteq(node) }
1546}
1547impl From<Gteq> for BinOp {
1548 fn from(node: Gteq) -> BinOp { BinOp::Gteq(node) }
1549}
1550impl From<LAngle> for BinOp {
1551 fn from(node: LAngle) -> BinOp { BinOp::LAngle(node) }
1552}
1553impl From<RAngle> for BinOp {
1554 fn from(node: RAngle) -> BinOp { BinOp::RAngle(node) }
1555}
1556impl From<Plus> for BinOp {
1557 fn from(node: Plus) -> BinOp { BinOp::Plus(node) }
1558}
1559impl From<Star> for BinOp {
1560 fn from(node: Star) -> BinOp { BinOp::Star(node) }
1561}
1562impl From<Minus> for BinOp {
1563 fn from(node: Minus) -> BinOp { BinOp::Minus(node) }
1564}
1565impl From<Slash> for BinOp {
1566 fn from(node: Slash) -> BinOp { BinOp::Slash(node) }
1567}
1568impl From<Percent> for BinOp {
1569 fn from(node: Percent) -> BinOp { BinOp::Percent(node) }
1570}
1571impl From<Shl> for BinOp {
1572 fn from(node: Shl) -> BinOp { BinOp::Shl(node) }
1573}
1574impl From<Shr> for BinOp {
1575 fn from(node: Shr) -> BinOp { BinOp::Shr(node) }
1576}
1577impl From<Caret> for BinOp {
1578 fn from(node: Caret) -> BinOp { BinOp::Caret(node) }
1579}
1580impl From<Pipe> for BinOp {
1581 fn from(node: Pipe) -> BinOp { BinOp::Pipe(node) }
1582}
1583impl From<Amp> for BinOp {
1584 fn from(node: Amp) -> BinOp { BinOp::Amp(node) }
1585}
1586impl From<Eq> for BinOp {
1587 fn from(node: Eq) -> BinOp { BinOp::Eq(node) }
1588}
1589impl From<Pluseq> for BinOp {
1590 fn from(node: Pluseq) -> BinOp { BinOp::Pluseq(node) }
1591}
1592impl From<Slasheq> for BinOp {
1593 fn from(node: Slasheq) -> BinOp { BinOp::Slasheq(node) }
1594}
1595impl From<Stareq> for BinOp {
1596 fn from(node: Stareq) -> BinOp { BinOp::Stareq(node) }
1597}
1598impl From<Percenteq> for BinOp {
1599 fn from(node: Percenteq) -> BinOp { BinOp::Percenteq(node) }
1600}
1601impl From<Shreq> for BinOp {
1602 fn from(node: Shreq) -> BinOp { BinOp::Shreq(node) }
1603}
1604impl From<Shleq> for BinOp {
1605 fn from(node: Shleq) -> BinOp { BinOp::Shleq(node) }
1606}
1607impl From<Minuseq> for BinOp {
1608 fn from(node: Minuseq) -> BinOp { BinOp::Minuseq(node) }
1609}
1610impl From<Pipeeq> for BinOp {
1611 fn from(node: Pipeeq) -> BinOp { BinOp::Pipeeq(node) }
1612}
1613impl From<Ampeq> for BinOp {
1614 fn from(node: Ampeq) -> BinOp { BinOp::Ampeq(node) }
1615}
1616impl From<Careteq> for BinOp {
1617 fn from(node: Careteq) -> BinOp { BinOp::Careteq(node) }
1618}
1619impl std::fmt::Display for BinOp {
1620 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1621 std::fmt::Display::fmt(self.syntax(), f)
1622 }
1623}
1624impl AstToken for BinOp {
1625 fn can_cast(kind: SyntaxKind) -> bool {
1626 match kind {
1627 PIPEPIPE | AMPAMP | EQEQ | NEQ | LTEQ | GTEQ | L_ANGLE | R_ANGLE | PLUS | STAR
1628 | MINUS | SLASH | PERCENT | SHL | SHR | CARET | PIPE | AMP | EQ | PLUSEQ | SLASHEQ
1629 | STAREQ | PERCENTEQ | SHREQ | SHLEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ => true,
1630 _ => false,
1631 }
1632 }
1633 fn cast(syntax: SyntaxToken) -> Option<Self> {
1634 let res = match syntax.kind() {
1635 PIPEPIPE => BinOp::Pipepipe(Pipepipe { syntax }),
1636 AMPAMP => BinOp::Ampamp(Ampamp { syntax }),
1637 EQEQ => BinOp::Eqeq(Eqeq { syntax }),
1638 NEQ => BinOp::Neq(Neq { syntax }),
1639 LTEQ => BinOp::Lteq(Lteq { syntax }),
1640 GTEQ => BinOp::Gteq(Gteq { syntax }),
1641 L_ANGLE => BinOp::LAngle(LAngle { syntax }),
1642 R_ANGLE => BinOp::RAngle(RAngle { syntax }),
1643 PLUS => BinOp::Plus(Plus { syntax }),
1644 STAR => BinOp::Star(Star { syntax }),
1645 MINUS => BinOp::Minus(Minus { syntax }),
1646 SLASH => BinOp::Slash(Slash { syntax }),
1647 PERCENT => BinOp::Percent(Percent { syntax }),
1648 SHL => BinOp::Shl(Shl { syntax }),
1649 SHR => BinOp::Shr(Shr { syntax }),
1650 CARET => BinOp::Caret(Caret { syntax }),
1651 PIPE => BinOp::Pipe(Pipe { syntax }),
1652 AMP => BinOp::Amp(Amp { syntax }),
1653 EQ => BinOp::Eq(Eq { syntax }),
1654 PLUSEQ => BinOp::Pluseq(Pluseq { syntax }),
1655 SLASHEQ => BinOp::Slasheq(Slasheq { syntax }),
1656 STAREQ => BinOp::Stareq(Stareq { syntax }),
1657 PERCENTEQ => BinOp::Percenteq(Percenteq { syntax }),
1658 SHREQ => BinOp::Shreq(Shreq { syntax }),
1659 SHLEQ => BinOp::Shleq(Shleq { syntax }),
1660 MINUSEQ => BinOp::Minuseq(Minuseq { syntax }),
1661 PIPEEQ => BinOp::Pipeeq(Pipeeq { syntax }),
1662 AMPEQ => BinOp::Ampeq(Ampeq { syntax }),
1663 CARETEQ => BinOp::Careteq(Careteq { syntax }),
1664 _ => return None,
1665 };
1666 Some(res)
1667 }
1668 fn syntax(&self) -> &SyntaxToken {
1669 match self {
1670 BinOp::Pipepipe(it) => &it.syntax,
1671 BinOp::Ampamp(it) => &it.syntax,
1672 BinOp::Eqeq(it) => &it.syntax,
1673 BinOp::Neq(it) => &it.syntax,
1674 BinOp::Lteq(it) => &it.syntax,
1675 BinOp::Gteq(it) => &it.syntax,
1676 BinOp::LAngle(it) => &it.syntax,
1677 BinOp::RAngle(it) => &it.syntax,
1678 BinOp::Plus(it) => &it.syntax,
1679 BinOp::Star(it) => &it.syntax,
1680 BinOp::Minus(it) => &it.syntax,
1681 BinOp::Slash(it) => &it.syntax,
1682 BinOp::Percent(it) => &it.syntax,
1683 BinOp::Shl(it) => &it.syntax,
1684 BinOp::Shr(it) => &it.syntax,
1685 BinOp::Caret(it) => &it.syntax,
1686 BinOp::Pipe(it) => &it.syntax,
1687 BinOp::Amp(it) => &it.syntax,
1688 BinOp::Eq(it) => &it.syntax,
1689 BinOp::Pluseq(it) => &it.syntax,
1690 BinOp::Slasheq(it) => &it.syntax,
1691 BinOp::Stareq(it) => &it.syntax,
1692 BinOp::Percenteq(it) => &it.syntax,
1693 BinOp::Shreq(it) => &it.syntax,
1694 BinOp::Shleq(it) => &it.syntax,
1695 BinOp::Minuseq(it) => &it.syntax,
1696 BinOp::Pipeeq(it) => &it.syntax,
1697 BinOp::Ampeq(it) => &it.syntax,
1698 BinOp::Careteq(it) => &it.syntax,
1699 }
1700 }
1701}
1702#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1703pub enum PrefixOp {
1704 Minus(Minus),
1705 Excl(Excl),
1706 Star(Star),
1707}
1708impl From<Minus> for PrefixOp {
1709 fn from(node: Minus) -> PrefixOp { PrefixOp::Minus(node) }
1710}
1711impl From<Excl> for PrefixOp {
1712 fn from(node: Excl) -> PrefixOp { PrefixOp::Excl(node) }
1713}
1714impl From<Star> for PrefixOp {
1715 fn from(node: Star) -> PrefixOp { PrefixOp::Star(node) }
1716}
1717impl std::fmt::Display for PrefixOp {
1718 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1719 std::fmt::Display::fmt(self.syntax(), f)
1720 }
1721}
1722impl AstToken for PrefixOp {
1723 fn can_cast(kind: SyntaxKind) -> bool {
1724 match kind {
1725 MINUS | EXCL | STAR => true,
1726 _ => false,
1727 }
1728 }
1729 fn cast(syntax: SyntaxToken) -> Option<Self> {
1730 let res = match syntax.kind() {
1731 MINUS => PrefixOp::Minus(Minus { syntax }),
1732 EXCL => PrefixOp::Excl(Excl { syntax }),
1733 STAR => PrefixOp::Star(Star { syntax }),
1734 _ => return None,
1735 };
1736 Some(res)
1737 }
1738 fn syntax(&self) -> &SyntaxToken {
1739 match self {
1740 PrefixOp::Minus(it) => &it.syntax,
1741 PrefixOp::Excl(it) => &it.syntax,
1742 PrefixOp::Star(it) => &it.syntax,
1743 }
1744 }
1745}
1746#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1747pub enum RangeOp {
1748 Dotdot(Dotdot),
1749 Dotdoteq(Dotdoteq),
1750}
1751impl From<Dotdot> for RangeOp {
1752 fn from(node: Dotdot) -> RangeOp { RangeOp::Dotdot(node) }
1753}
1754impl From<Dotdoteq> for RangeOp {
1755 fn from(node: Dotdoteq) -> RangeOp { RangeOp::Dotdoteq(node) }
1756}
1757impl std::fmt::Display for RangeOp {
1758 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1759 std::fmt::Display::fmt(self.syntax(), f)
1760 }
1761}
1762impl AstToken for RangeOp {
1763 fn can_cast(kind: SyntaxKind) -> bool {
1764 match kind {
1765 DOTDOT | DOTDOTEQ => true,
1766 _ => false,
1767 }
1768 }
1769 fn cast(syntax: SyntaxToken) -> Option<Self> {
1770 let res = match syntax.kind() {
1771 DOTDOT => RangeOp::Dotdot(Dotdot { syntax }),
1772 DOTDOTEQ => RangeOp::Dotdoteq(Dotdoteq { syntax }),
1773 _ => return None,
1774 };
1775 Some(res)
1776 }
1777 fn syntax(&self) -> &SyntaxToken {
1778 match self {
1779 RangeOp::Dotdot(it) => &it.syntax,
1780 RangeOp::Dotdoteq(it) => &it.syntax,
1781 }
1782 }
1783}
1784#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1785pub enum LiteralToken {
1786 IntNumber(IntNumber),
1787 FloatNumber(FloatNumber),
1788 String(String),
1789 RawString(RawString),
1790 ByteString(ByteString),
1791 RawByteString(RawByteString),
1792 Char(Char),
1793 Byte(Byte),
1794}
1795impl From<IntNumber> for LiteralToken {
1796 fn from(node: IntNumber) -> LiteralToken { LiteralToken::IntNumber(node) }
1797}
1798impl From<FloatNumber> for LiteralToken {
1799 fn from(node: FloatNumber) -> LiteralToken { LiteralToken::FloatNumber(node) }
1800}
1801impl From<String> for LiteralToken {
1802 fn from(node: String) -> LiteralToken { LiteralToken::String(node) }
1803}
1804impl From<RawString> for LiteralToken {
1805 fn from(node: RawString) -> LiteralToken { LiteralToken::RawString(node) }
1806}
1807impl From<ByteString> for LiteralToken {
1808 fn from(node: ByteString) -> LiteralToken { LiteralToken::ByteString(node) }
1809}
1810impl From<RawByteString> for LiteralToken {
1811 fn from(node: RawByteString) -> LiteralToken { LiteralToken::RawByteString(node) }
1812}
1813impl From<Char> for LiteralToken {
1814 fn from(node: Char) -> LiteralToken { LiteralToken::Char(node) }
1815}
1816impl From<Byte> for LiteralToken {
1817 fn from(node: Byte) -> LiteralToken { LiteralToken::Byte(node) }
1818}
1819impl std::fmt::Display for LiteralToken {
1820 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1821 std::fmt::Display::fmt(self.syntax(), f)
1822 }
1823}
1824impl AstToken for LiteralToken {
1825 fn can_cast(kind: SyntaxKind) -> bool {
1826 match kind {
1827 INT_NUMBER | FLOAT_NUMBER | STRING | RAW_STRING | BYTE_STRING | RAW_BYTE_STRING
1828 | CHAR | BYTE => true,
1829 _ => false,
1830 }
1831 }
1832 fn cast(syntax: SyntaxToken) -> Option<Self> {
1833 let res = match syntax.kind() {
1834 INT_NUMBER => LiteralToken::IntNumber(IntNumber { syntax }),
1835 FLOAT_NUMBER => LiteralToken::FloatNumber(FloatNumber { syntax }),
1836 STRING => LiteralToken::String(String { syntax }),
1837 RAW_STRING => LiteralToken::RawString(RawString { syntax }),
1838 BYTE_STRING => LiteralToken::ByteString(ByteString { syntax }),
1839 RAW_BYTE_STRING => LiteralToken::RawByteString(RawByteString { syntax }),
1840 CHAR => LiteralToken::Char(Char { syntax }),
1841 BYTE => LiteralToken::Byte(Byte { syntax }),
1842 _ => return None,
1843 };
1844 Some(res)
1845 }
1846 fn syntax(&self) -> &SyntaxToken {
1847 match self {
1848 LiteralToken::IntNumber(it) => &it.syntax,
1849 LiteralToken::FloatNumber(it) => &it.syntax,
1850 LiteralToken::String(it) => &it.syntax,
1851 LiteralToken::RawString(it) => &it.syntax,
1852 LiteralToken::ByteString(it) => &it.syntax,
1853 LiteralToken::RawByteString(it) => &it.syntax,
1854 LiteralToken::Char(it) => &it.syntax,
1855 LiteralToken::Byte(it) => &it.syntax,
1856 }
1857 }
1858}
1859#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1860pub enum NameRefToken {
1861 Ident(Ident),
1862 IntNumber(IntNumber),
1863}
1864impl From<Ident> for NameRefToken {
1865 fn from(node: Ident) -> NameRefToken { NameRefToken::Ident(node) }
1866}
1867impl From<IntNumber> for NameRefToken {
1868 fn from(node: IntNumber) -> NameRefToken { NameRefToken::IntNumber(node) }
1869}
1870impl std::fmt::Display for NameRefToken {
1871 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1872 std::fmt::Display::fmt(self.syntax(), f)
1873 }
1874}
1875impl AstToken for NameRefToken {
1876 fn can_cast(kind: SyntaxKind) -> bool {
1877 match kind {
1878 IDENT | INT_NUMBER => true,
1879 _ => false,
1880 }
1881 }
1882 fn cast(syntax: SyntaxToken) -> Option<Self> {
1883 let res = match syntax.kind() {
1884 IDENT => NameRefToken::Ident(Ident { syntax }),
1885 INT_NUMBER => NameRefToken::IntNumber(IntNumber { syntax }),
1886 _ => return None,
1887 };
1888 Some(res)
1889 }
1890 fn syntax(&self) -> &SyntaxToken {
1891 match self {
1892 NameRefToken::Ident(it) => &it.syntax,
1893 NameRefToken::IntNumber(it) => &it.syntax,
1894 }
1895 }
1896}
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index f39559e9e..0f4a50be4 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -100,6 +100,9 @@ pub fn expr_empty_block() -> ast::Expr {
100pub fn expr_unimplemented() -> ast::Expr { 100pub fn expr_unimplemented() -> ast::Expr {
101 expr_from_text("unimplemented!()") 101 expr_from_text("unimplemented!()")
102} 102}
103pub fn expr_todo() -> ast::Expr {
104 expr_from_text("todo!()")
105}
103pub fn expr_path(path: ast::Path) -> ast::Expr { 106pub fn expr_path(path: ast::Path) -> ast::Expr {
104 expr_from_text(&path.to_string()) 107 expr_from_text(&path.to_string())
105} 108}
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs
index 4ed7cf73b..bfc05e08b 100644
--- a/crates/ra_syntax/src/ast/traits.rs
+++ b/crates/ra_syntax/src/ast/traits.rs
@@ -6,6 +6,7 @@ use stdx::SepBy;
6use crate::{ 6use crate::{
7 ast::{self, support, AstChildren, AstNode, AstToken}, 7 ast::{self, support, AstChildren, AstNode, AstToken},
8 syntax_node::SyntaxElementChildren, 8 syntax_node::SyntaxElementChildren,
9 SyntaxToken, T,
9}; 10};
10 11
11pub trait TypeAscriptionOwner: AstNode { 12pub trait TypeAscriptionOwner: AstNode {
@@ -63,8 +64,8 @@ pub trait TypeBoundsOwner: AstNode {
63 support::child(self.syntax()) 64 support::child(self.syntax())
64 } 65 }
65 66
66 fn colon(&self) -> Option<ast::Colon> { 67 fn colon_token(&self) -> Option<SyntaxToken> {
67 support::token(self.syntax()) 68 support::token(self.syntax(), T![:])
68 } 69 }
69} 70}
70 71
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs
index f0e16dc2b..a796e78b1 100644
--- a/crates/ra_syntax/src/lib.rs
+++ b/crates/ra_syntax/src/lib.rs
@@ -19,6 +19,11 @@
19//! [RFC]: <https://github.com/rust-lang/rfcs/pull/2256> 19//! [RFC]: <https://github.com/rust-lang/rfcs/pull/2256>
20//! [Swift]: <https://github.com/apple/swift/blob/13d593df6f359d0cb2fc81cfaac273297c539455/lib/Syntax/README.md> 20//! [Swift]: <https://github.com/apple/swift/blob/13d593df6f359d0cb2fc81cfaac273297c539455/lib/Syntax/README.md>
21 21
22#[allow(unused)]
23macro_rules! eprintln {
24 ($($tt:tt)*) => { stdx::eprintln!($($tt)*) };
25}
26
22mod syntax_node; 27mod syntax_node;
23mod syntax_error; 28mod syntax_error;
24mod parsing; 29mod parsing;
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs
index d1baaa607..67c1f1b48 100644
--- a/crates/ra_syntax/src/parsing/lexer.rs
+++ b/crates/ra_syntax/src/parsing/lexer.rs
@@ -4,7 +4,7 @@
4use crate::{ 4use crate::{
5 SyntaxError, 5 SyntaxError,
6 SyntaxKind::{self, *}, 6 SyntaxKind::{self, *},
7 TextRange, TextUnit, 7 TextRange, TextUnit, T,
8}; 8};
9 9
10/// A token of Rust source. 10/// A token of Rust source.
@@ -115,21 +115,20 @@ fn rustc_token_kind_to_syntax_kind(
115 // being `u16` that come from `rowan::SyntaxKind`. 115 // being `u16` that come from `rowan::SyntaxKind`.
116 116
117 let syntax_kind = { 117 let syntax_kind = {
118 use rustc_lexer::TokenKind as TK;
119 match rustc_token_kind { 118 match rustc_token_kind {
120 TK::LineComment => COMMENT, 119 rustc_lexer::TokenKind::LineComment => COMMENT,
121 120
122 TK::BlockComment { terminated: true } => COMMENT, 121 rustc_lexer::TokenKind::BlockComment { terminated: true } => COMMENT,
123 TK::BlockComment { terminated: false } => { 122 rustc_lexer::TokenKind::BlockComment { terminated: false } => {
124 return ( 123 return (
125 COMMENT, 124 COMMENT,
126 Some("Missing trailing `*/` symbols to terminate the block comment"), 125 Some("Missing trailing `*/` symbols to terminate the block comment"),
127 ); 126 );
128 } 127 }
129 128
130 TK::Whitespace => WHITESPACE, 129 rustc_lexer::TokenKind::Whitespace => WHITESPACE,
131 130
132 TK::Ident => { 131 rustc_lexer::TokenKind::Ident => {
133 if token_text == "_" { 132 if token_text == "_" {
134 UNDERSCORE 133 UNDERSCORE
135 } else { 134 } else {
@@ -137,42 +136,42 @@ fn rustc_token_kind_to_syntax_kind(
137 } 136 }
138 } 137 }
139 138
140 TK::RawIdent => IDENT, 139 rustc_lexer::TokenKind::RawIdent => IDENT,
141 TK::Literal { kind, .. } => return match_literal_kind(&kind), 140 rustc_lexer::TokenKind::Literal { kind, .. } => return match_literal_kind(&kind),
142 141
143 TK::Lifetime { starts_with_number: false } => LIFETIME, 142 rustc_lexer::TokenKind::Lifetime { starts_with_number: false } => LIFETIME,
144 TK::Lifetime { starts_with_number: true } => { 143 rustc_lexer::TokenKind::Lifetime { starts_with_number: true } => {
145 return (LIFETIME, Some("Lifetime name cannot start with a number")) 144 return (LIFETIME, Some("Lifetime name cannot start with a number"))
146 } 145 }
147 146
148 TK::Semi => SEMI, 147 rustc_lexer::TokenKind::Semi => T![;],
149 TK::Comma => COMMA, 148 rustc_lexer::TokenKind::Comma => T![,],
150 TK::Dot => DOT, 149 rustc_lexer::TokenKind::Dot => T![.],
151 TK::OpenParen => L_PAREN, 150 rustc_lexer::TokenKind::OpenParen => T!['('],
152 TK::CloseParen => R_PAREN, 151 rustc_lexer::TokenKind::CloseParen => T![')'],
153 TK::OpenBrace => L_CURLY, 152 rustc_lexer::TokenKind::OpenBrace => T!['{'],
154 TK::CloseBrace => R_CURLY, 153 rustc_lexer::TokenKind::CloseBrace => T!['}'],
155 TK::OpenBracket => L_BRACK, 154 rustc_lexer::TokenKind::OpenBracket => T!['['],
156 TK::CloseBracket => R_BRACK, 155 rustc_lexer::TokenKind::CloseBracket => T![']'],
157 TK::At => AT, 156 rustc_lexer::TokenKind::At => T![@],
158 TK::Pound => POUND, 157 rustc_lexer::TokenKind::Pound => T![#],
159 TK::Tilde => TILDE, 158 rustc_lexer::TokenKind::Tilde => T![~],
160 TK::Question => QUESTION, 159 rustc_lexer::TokenKind::Question => T![?],
161 TK::Colon => COLON, 160 rustc_lexer::TokenKind::Colon => T![:],
162 TK::Dollar => DOLLAR, 161 rustc_lexer::TokenKind::Dollar => T![$],
163 TK::Eq => EQ, 162 rustc_lexer::TokenKind::Eq => T![=],
164 TK::Not => EXCL, 163 rustc_lexer::TokenKind::Not => T![!],
165 TK::Lt => L_ANGLE, 164 rustc_lexer::TokenKind::Lt => T![<],
166 TK::Gt => R_ANGLE, 165 rustc_lexer::TokenKind::Gt => T![>],
167 TK::Minus => MINUS, 166 rustc_lexer::TokenKind::Minus => T![-],
168 TK::And => AMP, 167 rustc_lexer::TokenKind::And => T![&],
169 TK::Or => PIPE, 168 rustc_lexer::TokenKind::Or => T![|],
170 TK::Plus => PLUS, 169 rustc_lexer::TokenKind::Plus => T![+],
171 TK::Star => STAR, 170 rustc_lexer::TokenKind::Star => T![*],
172 TK::Slash => SLASH, 171 rustc_lexer::TokenKind::Slash => T![/],
173 TK::Caret => CARET, 172 rustc_lexer::TokenKind::Caret => T![^],
174 TK::Percent => PERCENT, 173 rustc_lexer::TokenKind::Percent => T![%],
175 TK::Unknown => ERROR, 174 rustc_lexer::TokenKind::Unknown => ERROR,
176 } 175 }
177 }; 176 };
178 177
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs
index db6230aab..bc48a2e71 100644
--- a/crates/ra_syntax/src/ptr.rs
+++ b/crates/ra_syntax/src/ptr.rs
@@ -10,7 +10,7 @@ use crate::{AstNode, SyntaxKind, SyntaxNode, TextRange};
10 10
11/// A pointer to a syntax node inside a file. It can be used to remember a 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. 12/// specific node across reparses of the same file.
13#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 13#[derive(Debug, Clone, PartialEq, Eq, Hash)]
14pub struct SyntaxNodePtr { 14pub struct SyntaxNodePtr {
15 pub(crate) range: TextRange, 15 pub(crate) range: TextRange,
16 kind: SyntaxKind, 16 kind: SyntaxKind,
@@ -21,7 +21,7 @@ impl SyntaxNodePtr {
21 SyntaxNodePtr { range: node.text_range(), kind: node.kind() } 21 SyntaxNodePtr { range: node.text_range(), kind: node.kind() }
22 } 22 }
23 23
24 pub fn to_node(self, root: &SyntaxNode) -> SyntaxNode { 24 pub fn to_node(&self, root: &SyntaxNode) -> SyntaxNode {
25 assert!(root.parent().is_none()); 25 assert!(root.parent().is_none());
26 successors(Some(root.clone()), |node| { 26 successors(Some(root.clone()), |node| {
27 node.children().find(|it| self.range.is_subrange(&it.text_range())) 27 node.children().find(|it| self.range.is_subrange(&it.text_range()))
@@ -30,11 +30,11 @@ impl SyntaxNodePtr {
30 .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) 30 .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self))
31 } 31 }
32 32
33 pub fn range(self) -> TextRange { 33 pub fn range(&self) -> TextRange {
34 self.range 34 self.range
35 } 35 }
36 36
37 pub fn kind(self) -> SyntaxKind { 37 pub fn kind(&self) -> SyntaxKind {
38 self.kind 38 self.kind
39 } 39 }
40 40
@@ -53,10 +53,9 @@ pub struct AstPtr<N: AstNode> {
53 _ty: PhantomData<fn() -> N>, 53 _ty: PhantomData<fn() -> N>,
54} 54}
55 55
56impl<N: AstNode> Copy for AstPtr<N> {}
57impl<N: AstNode> Clone for AstPtr<N> { 56impl<N: AstNode> Clone for AstPtr<N> {
58 fn clone(&self) -> AstPtr<N> { 57 fn clone(&self) -> AstPtr<N> {
59 *self 58 AstPtr { raw: self.raw.clone(), _ty: PhantomData }
60 } 59 }
61} 60}
62 61
@@ -79,13 +78,13 @@ impl<N: AstNode> AstPtr<N> {
79 AstPtr { raw: SyntaxNodePtr::new(node.syntax()), _ty: PhantomData } 78 AstPtr { raw: SyntaxNodePtr::new(node.syntax()), _ty: PhantomData }
80 } 79 }
81 80
82 pub fn to_node(self, root: &SyntaxNode) -> N { 81 pub fn to_node(&self, root: &SyntaxNode) -> N {
83 let syntax_node = self.raw.to_node(root); 82 let syntax_node = self.raw.to_node(root);
84 N::cast(syntax_node).unwrap() 83 N::cast(syntax_node).unwrap()
85 } 84 }
86 85
87 pub fn syntax_node_ptr(self) -> SyntaxNodePtr { 86 pub fn syntax_node_ptr(&self) -> SyntaxNodePtr {
88 self.raw 87 self.raw.clone()
89 } 88 }
90 89
91 pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>> { 90 pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>> {
diff --git a/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt b/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt
index 782dfd974..290e0bd7c 100644
--- a/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt
+++ b/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt
@@ -6,5 +6,5 @@ WHITESPACE 1 " "
6IDENT 1 "a" 6IDENT 1 "a"
7WHITESPACE 1 " " 7WHITESPACE 1 " "
8IDENT 5 "quote" 8IDENT 5 "quote"
9EXCL 1 "!" 9BANG 1 "!"
10> error[0; 4) token("r## ") msg(Missing `"` symbol after `#` symbols to begin the raw string literal) 10> error[0; 4) token("r## ") msg(Missing `"` symbol after `#` symbols to begin the raw string literal)
diff --git a/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt b/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt
index 59c40cd65..5c492906d 100644
--- a/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt
+++ b/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt
@@ -6,5 +6,5 @@ WHITESPACE 1 " "
6IDENT 1 "a" 6IDENT 1 "a"
7WHITESPACE 1 " " 7WHITESPACE 1 " "
8IDENT 5 "quote" 8IDENT 5 "quote"
9EXCL 1 "!" 9BANG 1 "!"
10> error[0; 5) token("br## ") msg(Missing `"` symbol after `#` symbols to begin the raw byte string literal) 10> error[0; 5) token("br## ") msg(Missing `"` symbol after `#` symbols to begin the raw byte string literal)
diff --git a/crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt b/crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt
index 469a90e42..2049c2f1d 100644
--- a/crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt
+++ b/crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt
@@ -1,4 +1,4 @@
1SEMI 1 ";" 1SEMICOLON 1 ";"
2WHITESPACE 1 " " 2WHITESPACE 1 " "
3COMMA 1 "," 3COMMA 1 ","
4WHITESPACE 1 " " 4WHITESPACE 1 " "
@@ -65,9 +65,9 @@ WHITESPACE 1 " "
65EQ 1 "=" 65EQ 1 "="
66R_ANGLE 1 ">" 66R_ANGLE 1 ">"
67WHITESPACE 1 "\n" 67WHITESPACE 1 "\n"
68EXCL 1 "!" 68BANG 1 "!"
69WHITESPACE 1 " " 69WHITESPACE 1 " "
70EXCL 1 "!" 70BANG 1 "!"
71EQ 1 "=" 71EQ 1 "="
72WHITESPACE 1 "\n" 72WHITESPACE 1 "\n"
73MINUS 1 "-" 73MINUS 1 "-"
diff --git a/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rast b/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rast
index 002680583..831bbf83f 100644
--- a/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rast
+++ b/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rast
@@ -3,7 +3,7 @@ SOURCE_FILE@[0; 42)
3 WHITESPACE@[20; 21) "\n" 3 WHITESPACE@[20; 21) "\n"
4 ATTR@[21; 23) 4 ATTR@[21; 23)
5 POUND@[21; 22) "#" 5 POUND@[21; 22) "#"
6 EXCL@[22; 23) "!" 6 BANG@[22; 23) "!"
7 ERROR@[23; 24) 7 ERROR@[23; 24)
8 SLASH@[23; 24) "/" 8 SLASH@[23; 24) "/"
9 USE_ITEM@[24; 28) 9 USE_ITEM@[24; 28)
@@ -29,11 +29,11 @@ SOURCE_FILE@[0; 42)
29error [23; 23): expected `[` 29error [23; 23): expected `[`
30error [23; 23): expected an item 30error [23; 23): expected an item
31error [27; 27): expected one of `*`, `::`, `{`, `self`, `super` or an identifier 31error [27; 27): expected one of `*`, `::`, `{`, `self`, `super` or an identifier
32error [28; 28): expected SEMI 32error [28; 28): expected SEMICOLON
33error [31; 31): expected EXCL 33error [31; 31): expected BANG
34error [31; 31): expected `{`, `[`, `(` 34error [31; 31): expected `{`, `[`, `(`
35error [31; 31): expected SEMI 35error [31; 31): expected SEMICOLON
36error [31; 31): expected an item 36error [31; 31): expected an item
37error [35; 35): expected EXCL 37error [35; 35): expected BANG
38error [41; 41): expected `{`, `[`, `(` 38error [41; 41): expected `{`, `[`, `(`
39error [41; 41): expected SEMI 39error [41; 41): expected SEMICOLON
diff --git a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast
index 8039a8913..6b89e7572 100644
--- a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast
+++ b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast
@@ -34,6 +34,6 @@ SOURCE_FILE@[0; 40)
34 WHITESPACE@[37; 38) "\n" 34 WHITESPACE@[37; 38) "\n"
35 R_CURLY@[38; 39) "}" 35 R_CURLY@[38; 39) "}"
36 ERROR@[39; 40) 36 ERROR@[39; 40)
37 SEMI@[39; 40) ";" 37 SEMICOLON@[39; 40) ";"
38error [39; 39): expected item, found `;` 38error [39; 39): expected item, found `;`
39consider removing this semicolon 39consider removing this semicolon
diff --git a/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rast b/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rast
index 5f6e10986..1d27d4cd6 100644
--- a/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rast
+++ b/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rast
@@ -8,9 +8,9 @@ SOURCE_FILE@[0; 12)
8 PATH_SEGMENT@[4; 7) 8 PATH_SEGMENT@[4; 7)
9 NAME_REF@[4; 7) 9 NAME_REF@[4; 7)
10 IDENT@[4; 7) "foo" 10 IDENT@[4; 7) "foo"
11 COLONCOLON@[7; 9) "::" 11 COLON2@[7; 9) "::"
12 PATH_SEGMENT@[9; 11) 12 PATH_SEGMENT@[9; 11)
13 ERROR@[9; 11) 13 ERROR@[9; 11)
14 INT_NUMBER@[9; 11) "92" 14 INT_NUMBER@[9; 11) "92"
15 SEMI@[11; 12) ";" 15 SEMICOLON@[11; 12) ";"
16error [9; 9): expected identifier 16error [9; 9): expected identifier
diff --git a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast
index 1978f30fa..c24e478f3 100644
--- a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast
+++ b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast
@@ -7,7 +7,7 @@ SOURCE_FILE@[0; 31)
7 WHITESPACE@[9; 10) " " 7 WHITESPACE@[9; 10) " "
8 NAME@[10; 11) 8 NAME@[10; 11)
9 IDENT@[10; 11) "S" 9 IDENT@[10; 11) "S"
10 SEMI@[11; 12) ";" 10 SEMICOLON@[11; 12) ";"
11 WHITESPACE@[12; 14) "\n\n" 11 WHITESPACE@[12; 14) "\n\n"
12 ERROR@[14; 15) 12 ERROR@[14; 15)
13 R_CURLY@[14; 15) "}" 13 R_CURLY@[14; 15) "}"
diff --git a/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast
index 98248227d..9f5041ae4 100644
--- a/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast
+++ b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast
@@ -76,6 +76,6 @@ SOURCE_FILE@[0; 95)
76 WHITESPACE@[92; 93) "\n" 76 WHITESPACE@[92; 93) "\n"
77 R_CURLY@[93; 94) "}" 77 R_CURLY@[93; 94) "}"
78 WHITESPACE@[94; 95) "\n" 78 WHITESPACE@[94; 95) "\n"
79error [17; 17): expected EXCL 79error [17; 17): expected BANG
80error [19; 19): expected SEMI 80error [19; 19): expected SEMICOLON
81error [20; 20): expected an item 81error [20; 20): expected an item
diff --git a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast
index ca508ac7c..7ed80477d 100644
--- a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast
+++ b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast
@@ -43,7 +43,7 @@ SOURCE_FILE@[0; 43)
43 WHITESPACE@[39; 40) " " 43 WHITESPACE@[39; 40) " "
44 NAME@[40; 41) 44 NAME@[40; 41)
45 IDENT@[40; 41) "T" 45 IDENT@[40; 41) "T"
46 SEMI@[41; 42) ";" 46 SEMICOLON@[41; 42) ";"
47 WHITESPACE@[42; 43) "\n" 47 WHITESPACE@[42; 43) "\n"
48error [9; 9): expected type parameter 48error [9; 9): expected type parameter
49error [11; 11): expected COMMA 49error [11; 11): expected COMMA
@@ -53,6 +53,6 @@ error [12; 12): expected an item
53error [14; 14): expected an item 53error [14; 14): expected an item
54error [15; 15): expected an item 54error [15; 15): expected an item
55error [17; 17): expected an item 55error [17; 17): expected an item
56error [24; 24): expected SEMI 56error [24; 24): expected SEMICOLON
57error [24; 24): expected expression 57error [24; 24): expected expression
58error [25; 25): expected SEMI 58error [25; 25): expected SEMICOLON
diff --git a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
index 0ffbd25aa..5559c3297 100644
--- a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
+++ b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
@@ -37,9 +37,9 @@ SOURCE_FILE@[0; 42)
37 R_PAREN@[35; 36) ")" 37 R_PAREN@[35; 36) ")"
38 WHITESPACE@[36; 37) " " 38 WHITESPACE@[36; 37) " "
39 R_CURLY@[37; 38) "}" 39 R_CURLY@[37; 38) "}"
40 SEMI@[38; 39) ";" 40 SEMICOLON@[38; 39) ";"
41 WHITESPACE@[39; 40) "\n" 41 WHITESPACE@[39; 40) "\n"
42 R_CURLY@[40; 41) "}" 42 R_CURLY@[40; 41) "}"
43 WHITESPACE@[41; 42) "\n" 43 WHITESPACE@[41; 42) "\n"
44error [24; 24): expected `{` 44error [24; 24): expected `{`
45error [24; 24): expected SEMI 45error [24; 24): expected SEMICOLON
diff --git a/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast
index 900894dcf..99c212fd6 100644
--- a/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast
+++ b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast
@@ -8,6 +8,6 @@ SOURCE_FILE@[0; 19)
8 WHITESPACE@[13; 14) " " 8 WHITESPACE@[13; 14) " "
9 NAME@[14; 17) 9 NAME@[14; 17)
10 IDENT@[14; 17) "Foo" 10 IDENT@[14; 17) "Foo"
11 SEMI@[17; 18) ";" 11 SEMICOLON@[17; 18) ";"
12 WHITESPACE@[18; 19) "\n" 12 WHITESPACE@[18; 19) "\n"
13error [6; 6): expected existential, fn, trait or impl 13error [6; 6): expected existential, fn, trait or impl
diff --git a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
index 12ebc2a3a..0a3c0313d 100644
--- a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
+++ b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
@@ -106,7 +106,7 @@ SOURCE_FILE@[0; 389)
106 WHITESPACE@[122; 123) 106 WHITESPACE@[122; 123)
107 LITERAL@[123; 124) 107 LITERAL@[123; 124)
108 INT_NUMBER@[123; 124) "0" 108 INT_NUMBER@[123; 124) "0"
109 SEMI@[124; 125) 109 SEMICOLON@[124; 125)
110 WHITESPACE@[125; 130) 110 WHITESPACE@[125; 130)
111 LET_STMT@[130; 389) 111 LET_STMT@[130; 389)
112 LET_KW@[130; 133) 112 LET_KW@[130; 133)
@@ -226,7 +226,7 @@ SOURCE_FILE@[0; 389)
226 err: `expected pattern` 226 err: `expected pattern`
227 PARAM@[236; 237) 227 PARAM@[236; 237)
228 ERROR@[236; 237) 228 ERROR@[236; 237)
229 EXCL@[236; 237) 229 BANG@[236; 237)
230 err: `expected COMMA` 230 err: `expected COMMA`
231 PARAM@[237; 242) 231 PARAM@[237; 242)
232 BIND_PAT@[237; 242) 232 BIND_PAT@[237; 242)
@@ -272,7 +272,7 @@ SOURCE_FILE@[0; 389)
272 err: `expected pattern` 272 err: `expected pattern`
273 PARAM@[283; 284) 273 PARAM@[283; 284)
274 ERROR@[283; 284) 274 ERROR@[283; 284)
275 SEMI@[283; 284) 275 SEMICOLON@[283; 284)
276 err: `expected COMMA` 276 err: `expected COMMA`
277 WHITESPACE@[284; 297) 277 WHITESPACE@[284; 297)
278 err: `expected pattern` 278 err: `expected pattern`
@@ -327,7 +327,7 @@ SOURCE_FILE@[0; 389)
327 err: `expected pattern` 327 err: `expected pattern`
328 PARAM@[346; 347) 328 PARAM@[346; 347)
329 ERROR@[346; 347) 329 ERROR@[346; 347)
330 SEMI@[346; 347) 330 SEMICOLON@[346; 347)
331 err: `expected COMMA` 331 err: `expected COMMA`
332 WHITESPACE@[347; 360) 332 WHITESPACE@[347; 360)
333 err: `expected pattern` 333 err: `expected pattern`
@@ -371,7 +371,7 @@ SOURCE_FILE@[0; 389)
371 err: `expected pattern` 371 err: `expected pattern`
372 PARAM@[385; 386) 372 PARAM@[385; 386)
373 ERROR@[385; 386) 373 ERROR@[385; 386)
374 SEMI@[385; 386) 374 SEMICOLON@[385; 386)
375 err: `expected COMMA` 375 err: `expected COMMA`
376 WHITESPACE@[386; 387) 376 WHITESPACE@[386; 387)
377 err: `expected pattern` 377 err: `expected pattern`
diff --git a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast
index 7a934cf66..cb570dc1c 100644
--- a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast
+++ b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast
@@ -67,7 +67,7 @@ SOURCE_FILE@[0; 86)
67 ERROR@[82; 83) 67 ERROR@[82; 83)
68 R_PAREN@[82; 83) ")" 68 R_PAREN@[82; 83) ")"
69 ERROR@[83; 84) 69 ERROR@[83; 84)
70 SEMI@[83; 84) ";" 70 SEMICOLON@[83; 84) ";"
71 WHITESPACE@[84; 86) "\n\n" 71 WHITESPACE@[84; 86) "\n\n"
72error [67; 67): expected type 72error [67; 67): expected type
73error [68; 68): expected COMMA 73error [68; 68): expected COMMA
@@ -80,7 +80,7 @@ error [68; 68): expected COMMA
80error [72; 72): expected COMMA 80error [72; 72): expected COMMA
81error [72; 72): expected a type 81error [72; 72): expected a type
82error [72; 72): expected R_PAREN 82error [72; 72): expected R_PAREN
83error [72; 72): expected SEMI 83error [72; 72): expected SEMICOLON
84error [72; 72): expected an item 84error [72; 72): expected an item
85error [73; 73): expected an item 85error [73; 73): expected an item
86error [79; 79): expected an item 86error [79; 79): expected an item
diff --git a/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast
index 6343580e0..aca5a3ada 100644
--- a/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast
+++ b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast
@@ -37,8 +37,8 @@ SOURCE_FILE@[0; 56)
37 WHITESPACE@[49; 50) " " 37 WHITESPACE@[49; 50) " "
38 LITERAL@[50; 52) 38 LITERAL@[50; 52)
39 INT_NUMBER@[50; 52) "92" 39 INT_NUMBER@[50; 52) "92"
40 SEMI@[52; 53) ";" 40 SEMICOLON@[52; 53) ";"
41 WHITESPACE@[53; 54) "\n" 41 WHITESPACE@[53; 54) "\n"
42 R_CURLY@[54; 55) "}" 42 R_CURLY@[54; 55) "}"
43 WHITESPACE@[55; 56) "\n" 43 WHITESPACE@[55; 56) "\n"
44error [38; 38): expected SEMI 44error [38; 38): expected SEMICOLON
diff --git a/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast
index 59480e999..f9f4b9bc2 100644
--- a/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast
+++ b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 47)
34 WHITESPACE@[32; 33) " " 34 WHITESPACE@[32; 33) " "
35 LITERAL@[33; 35) 35 LITERAL@[33; 35)
36 INT_NUMBER@[33; 35) "92" 36 INT_NUMBER@[33; 35) "92"
37 SEMI@[35; 36) ";" 37 SEMICOLON@[35; 36) ";"
38 WHITESPACE@[36; 41) "\n " 38 WHITESPACE@[36; 41) "\n "
39 BIN_EXPR@[41; 44) 39 BIN_EXPR@[41; 44)
40 LITERAL@[41; 42) 40 LITERAL@[41; 42)
diff --git a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast
index 4b13a7236..9a8f76673 100644
--- a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast
+++ b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast
@@ -60,7 +60,7 @@ SOURCE_FILE@[0; 183)
60 ARG_LIST@[82; 84) 60 ARG_LIST@[82; 84)
61 L_PAREN@[82; 83) "(" 61 L_PAREN@[82; 83) "("
62 R_PAREN@[83; 84) ")" 62 R_PAREN@[83; 84) ")"
63 SEMI@[84; 85) ";" 63 SEMICOLON@[84; 85) ";"
64 WHITESPACE@[85; 94) "\n " 64 WHITESPACE@[85; 94) "\n "
65 METHOD_CALL_EXPR@[94; 155) 65 METHOD_CALL_EXPR@[94; 155)
66 FIELD_EXPR@[94; 105) 66 FIELD_EXPR@[94; 105)
@@ -107,7 +107,7 @@ SOURCE_FILE@[0; 183)
107 PATH_SEGMENT@[146; 149) 107 PATH_SEGMENT@[146; 149)
108 NAME_REF@[146; 149) 108 NAME_REF@[146; 149)
109 IDENT@[146; 149) "vec" 109 IDENT@[146; 149) "vec"
110 EXCL@[149; 150) "!" 110 BANG@[149; 150) "!"
111 TOKEN_TREE@[150; 152) 111 TOKEN_TREE@[150; 152)
112 L_BRACK@[150; 151) "[" 112 L_BRACK@[150; 151) "["
113 R_BRACK@[151; 152) "]" 113 R_BRACK@[151; 152) "]"
diff --git a/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast b/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast
index 97e91a94f..e283091e1 100644
--- a/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast
+++ b/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 139)
32 WHITESPACE@[38; 39) " " 32 WHITESPACE@[38; 39) " "
33 LITERAL@[39; 40) 33 LITERAL@[39; 40)
34 INT_NUMBER@[39; 40) "1" 34 INT_NUMBER@[39; 40) "1"
35 SEMI@[40; 41) ";" 35 SEMICOLON@[40; 41) ";"
36 WHITESPACE@[41; 46) "\n " 36 WHITESPACE@[41; 46) "\n "
37 LET_STMT@[46; 49) 37 LET_STMT@[46; 49)
38 LET_KW@[46; 49) "let" 38 LET_KW@[46; 49) "let"
@@ -48,7 +48,7 @@ SOURCE_FILE@[0; 139)
48 WHITESPACE@[63; 64) " " 48 WHITESPACE@[63; 64) " "
49 LITERAL@[64; 66) 49 LITERAL@[64; 66)
50 INT_NUMBER@[64; 66) "92" 50 INT_NUMBER@[64; 66) "92"
51 SEMI@[66; 67) ";" 51 SEMICOLON@[66; 67) ";"
52 WHITESPACE@[67; 72) "\n " 52 WHITESPACE@[67; 72) "\n "
53 LET_STMT@[72; 75) 53 LET_STMT@[72; 75)
54 LET_KW@[72; 75) "let" 54 LET_KW@[72; 75) "let"
@@ -96,12 +96,12 @@ SOURCE_FILE@[0; 139)
96 R_CURLY@[137; 138) "}" 96 R_CURLY@[137; 138) "}"
97 WHITESPACE@[138; 139) "\n" 97 WHITESPACE@[138; 139) "\n"
98error [24; 24): expected expression 98error [24; 24): expected expression
99error [24; 24): expected SEMI 99error [24; 24): expected SEMICOLON
100error [49; 49): expected pattern 100error [49; 49): expected pattern
101error [49; 49): expected SEMI 101error [49; 49): expected SEMICOLON
102error [75; 75): expected pattern 102error [75; 75): expected pattern
103error [75; 75): expected SEMI 103error [75; 75): expected SEMICOLON
104error [98; 98): expected pattern 104error [98; 98): expected pattern
105error [98; 98): expected SEMI 105error [98; 98): expected SEMICOLON
106error [124; 124): expected pattern 106error [124; 124): expected pattern
107error [124; 124): expected SEMI 107error [124; 124): expected SEMICOLON
diff --git a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast
index 9f50c85e5..465749f95 100644
--- a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast
+++ b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast
@@ -150,34 +150,34 @@ SOURCE_FILE@[0; 112)
150 WHITESPACE@[111; 112) "\n" 150 WHITESPACE@[111; 112) "\n"
151error [16; 16): expected expression 151error [16; 16): expected expression
152error [17; 17): expected R_BRACK 152error [17; 17): expected R_BRACK
153error [17; 17): expected SEMI 153error [17; 17): expected SEMICOLON
154error [17; 17): expected expression 154error [17; 17): expected expression
155error [18; 18): expected SEMI 155error [18; 18): expected SEMICOLON
156error [25; 25): expected a name 156error [25; 25): expected a name
157error [26; 26): expected `;`, `{`, or `(` 157error [26; 26): expected `;`, `{`, or `(`
158error [30; 30): expected pattern 158error [30; 30): expected pattern
159error [31; 31): expected SEMI 159error [31; 31): expected SEMICOLON
160error [53; 53): expected expression 160error [53; 53): expected expression
161error [54; 54): expected SEMI 161error [54; 54): expected SEMICOLON
162error [54; 54): expected expression 162error [54; 54): expected expression
163error [55; 55): expected SEMI 163error [55; 55): expected SEMICOLON
164error [60; 60): expected type 164error [60; 60): expected type
165error [60; 60): expected `{` 165error [60; 60): expected `{`
166error [60; 60): expected expression 166error [60; 60): expected expression
167error [61; 61): expected SEMI 167error [61; 61): expected SEMICOLON
168error [65; 65): expected pattern 168error [65; 65): expected pattern
169error [65; 65): expected SEMI 169error [65; 65): expected SEMICOLON
170error [65; 65): expected expression 170error [65; 65): expected expression
171error [92; 92): expected expression 171error [92; 92): expected expression
172error [93; 93): expected SEMI 172error [93; 93): expected SEMICOLON
173error [93; 93): expected expression 173error [93; 93): expected expression
174error [94; 94): expected SEMI 174error [94; 94): expected SEMICOLON
175error [95; 95): expected expression 175error [95; 95): expected expression
176error [96; 96): expected SEMI 176error [96; 96): expected SEMICOLON
177error [96; 96): expected expression 177error [96; 96): expected expression
178error [97; 97): expected SEMI 178error [97; 97): expected SEMICOLON
179error [103; 103): expected a name 179error [103; 103): expected a name
180error [104; 104): expected `{` 180error [104; 104): expected `{`
181error [108; 108): expected pattern 181error [108; 108): expected pattern
182error [108; 108): expected SEMI 182error [108; 108): expected SEMICOLON
183error [108; 108): expected expression 183error [108; 108): expected expression
diff --git a/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast
index 775e4b0da..97abe9510 100644
--- a/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast
+++ b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast
@@ -17,7 +17,7 @@ SOURCE_FILE@[0; 94)
17 PATH_SEGMENT@[16; 19) 17 PATH_SEGMENT@[16; 19)
18 NAME_REF@[16; 19) 18 NAME_REF@[16; 19)
19 IDENT@[16; 19) "foo" 19 IDENT@[16; 19) "foo"
20 EXCL@[19; 20) "!" 20 BANG@[19; 20) "!"
21 WHITESPACE@[20; 21) " " 21 WHITESPACE@[20; 21) " "
22 TOKEN_TREE@[21; 49) 22 TOKEN_TREE@[21; 49)
23 L_PAREN@[21; 22) "(" 23 L_PAREN@[21; 22) "("
diff --git a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast
index c5c8a29ba..a3cf3e60a 100644
--- a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast
+++ b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast
@@ -144,7 +144,7 @@ SOURCE_FILE@[0; 240)
144 EXPR_STMT@[121; 123) 144 EXPR_STMT@[121; 123)
145 ERROR@[121; 122) 145 ERROR@[121; 122)
146 R_ANGLE@[121; 122) ">" 146 R_ANGLE@[121; 122) ">"
147 SEMI@[122; 123) ";" 147 SEMICOLON@[122; 123) ";"
148 WHITESPACE@[123; 128) "\n " 148 WHITESPACE@[123; 128) "\n "
149 LET_STMT@[128; 141) 149 LET_STMT@[128; 141)
150 LET_KW@[128; 131) "let" 150 LET_KW@[128; 131) "let"
@@ -219,7 +219,7 @@ SOURCE_FILE@[0; 240)
219 R_PAREN@[177; 178) ")" 219 R_PAREN@[177; 178) ")"
220 R_ANGLE@[178; 179) ">" 220 R_ANGLE@[178; 179) ">"
221 ERROR@[179; 180) 221 ERROR@[179; 180)
222 SEMI@[179; 180) ";" 222 SEMICOLON@[179; 180) ";"
223 WHITESPACE@[180; 185) "\n " 223 WHITESPACE@[180; 185) "\n "
224 LET_STMT@[185; 235) 224 LET_STMT@[185; 235)
225 LET_KW@[185; 188) "let" 225 LET_KW@[185; 188) "let"
@@ -286,24 +286,24 @@ SOURCE_FILE@[0; 240)
286 EXPR_STMT@[235; 237) 286 EXPR_STMT@[235; 237)
287 ERROR@[235; 236) 287 ERROR@[235; 236)
288 R_ANGLE@[235; 236) ">" 288 R_ANGLE@[235; 236) ">"
289 SEMI@[236; 237) ";" 289 SEMICOLON@[236; 237) ";"
290 WHITESPACE@[237; 238) "\n" 290 WHITESPACE@[237; 238) "\n"
291 R_CURLY@[238; 239) "}" 291 R_CURLY@[238; 239) "}"
292 WHITESPACE@[239; 240) "\n" 292 WHITESPACE@[239; 240) "\n"
293error [88; 88): expected COMMA 293error [88; 88): expected COMMA
294error [88; 88): expected R_ANGLE 294error [88; 88): expected R_ANGLE
295error [121; 121): expected SEMI 295error [121; 121): expected SEMICOLON
296error [121; 121): expected expression 296error [121; 121): expected expression
297error [140; 140): expected type 297error [140; 140): expected type
298error [141; 141): expected R_PAREN 298error [141; 141): expected R_PAREN
299error [141; 141): expected COMMA 299error [141; 141): expected COMMA
300error [141; 141): expected R_ANGLE 300error [141; 141): expected R_ANGLE
301error [141; 141): expected SEMI 301error [141; 141): expected SEMICOLON
302error [146; 146): expected SEMI 302error [146; 146): expected SEMICOLON
303error [146; 146): expected expression 303error [146; 146): expected expression
304error [147; 147): expected SEMI 304error [147; 147): expected SEMICOLON
305error [148; 148): expected expression 305error [148; 148): expected expression
306error [149; 149): expected SEMI 306error [149; 149): expected SEMICOLON
307error [154; 154): expected pattern 307error [154; 154): expected pattern
308error [155; 155): expected IN_KW 308error [155; 155): expected IN_KW
309error [155; 155): expected expression 309error [155; 155): expected expression
@@ -314,8 +314,8 @@ error [179; 179): expected expression
314error [180; 180): expected COMMA 314error [180; 180): expected COMMA
315error [180; 180): expected expression 315error [180; 180): expected expression
316error [180; 180): expected R_PAREN 316error [180; 180): expected R_PAREN
317error [180; 180): expected SEMI 317error [180; 180): expected SEMICOLON
318error [215; 215): expected COMMA 318error [215; 215): expected COMMA
319error [215; 215): expected R_ANGLE 319error [215; 215): expected R_ANGLE
320error [235; 235): expected SEMI 320error [235; 235): expected SEMICOLON
321error [235; 235): expected expression 321error [235; 235): expected expression
diff --git a/crates/ra_syntax/test_data/parser/err/0025_nope.rast b/crates/ra_syntax/test_data/parser/err/0025_nope.rast
index ca7f2d255..2b37ce94d 100644
--- a/crates/ra_syntax/test_data/parser/err/0025_nope.rast
+++ b/crates/ra_syntax/test_data/parser/err/0025_nope.rast
@@ -78,7 +78,7 @@ SOURCE_FILE@[0; 575)
78 WHITESPACE@[183; 184) " " 78 WHITESPACE@[183; 184) " "
79 LITERAL@[184; 185) 79 LITERAL@[184; 185)
80 INT_NUMBER@[184; 185) "1" 80 INT_NUMBER@[184; 185) "1"
81 SEMI@[185; 186) ";" 81 SEMICOLON@[185; 186) ";"
82 WHITESPACE@[186; 191) "\n " 82 WHITESPACE@[186; 191) "\n "
83 ENUM_DEF@[191; 223) 83 ENUM_DEF@[191; 223)
84 ENUM_KW@[191; 195) "enum" 84 ENUM_KW@[191; 195) "enum"
@@ -185,7 +185,7 @@ SOURCE_FILE@[0; 575)
185 WHITESPACE@[507; 508) " " 185 WHITESPACE@[507; 508) " "
186 ERROR@[508; 509) 186 ERROR@[508; 509)
187 UNDERSCORE@[508; 509) "_" 187 UNDERSCORE@[508; 509) "_"
188 SEMI@[509; 510) ";" 188 SEMICOLON@[509; 510) ";"
189 WHITESPACE@[510; 511) " " 189 WHITESPACE@[510; 511) " "
190 COMMENT@[511; 572) "//~ ERROR: expected e ..." 190 COMMENT@[511; 572) "//~ ERROR: expected e ..."
191 WHITESPACE@[572; 573) "\n" 191 WHITESPACE@[572; 573) "\n"
diff --git a/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast
index 522a0d0e0..00d9fd511 100644
--- a/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast
+++ b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 350)
27 WHITESPACE@[30; 39) "\n " 27 WHITESPACE@[30; 39) "\n "
28 ATTR@[39; 83) 28 ATTR@[39; 83)
29 POUND@[39; 40) "#" 29 POUND@[39; 40) "#"
30 EXCL@[40; 41) "!" 30 BANG@[40; 41) "!"
31 L_BRACK@[41; 42) "[" 31 L_BRACK@[41; 42) "["
32 PATH@[42; 45) 32 PATH@[42; 45)
33 PATH_SEGMENT@[42; 45) 33 PATH_SEGMENT@[42; 45)
@@ -42,7 +42,7 @@ SOURCE_FILE@[0; 350)
42 COMMENT@[92; 122) "//! Nor are ModuleDoc ..." 42 COMMENT@[92; 122) "//! Nor are ModuleDoc ..."
43 WHITESPACE@[122; 127) "\n " 43 WHITESPACE@[122; 127) "\n "
44 R_CURLY@[127; 128) "}" 44 R_CURLY@[127; 128) "}"
45 SEMI@[128; 129) ";" 45 SEMICOLON@[128; 129) ";"
46 WHITESPACE@[129; 134) "\n " 46 WHITESPACE@[129; 134) "\n "
47 EXPR_STMT@[134; 257) 47 EXPR_STMT@[134; 257)
48 IF_EXPR@[134; 257) 48 IF_EXPR@[134; 257)
@@ -58,7 +58,7 @@ SOURCE_FILE@[0; 350)
58 WHITESPACE@[143; 152) "\n " 58 WHITESPACE@[143; 152) "\n "
59 ATTR@[152; 171) 59 ATTR@[152; 171)
60 POUND@[152; 153) "#" 60 POUND@[152; 153) "#"
61 EXCL@[153; 154) "!" 61 BANG@[153; 154) "!"
62 L_BRACK@[154; 155) "[" 62 L_BRACK@[154; 155) "["
63 PATH@[155; 158) 63 PATH@[155; 158)
64 PATH_SEGMENT@[155; 158) 64 PATH_SEGMENT@[155; 158)
@@ -72,7 +72,7 @@ SOURCE_FILE@[0; 350)
72 WHITESPACE@[171; 180) "\n " 72 WHITESPACE@[171; 180) "\n "
73 ATTR@[180; 212) 73 ATTR@[180; 212)
74 POUND@[180; 181) "#" 74 POUND@[180; 181) "#"
75 EXCL@[181; 182) "!" 75 BANG@[181; 182) "!"
76 L_BRACK@[182; 183) "[" 76 L_BRACK@[182; 183) "["
77 PATH@[183; 186) 77 PATH@[183; 186)
78 PATH_SEGMENT@[183; 186) 78 PATH_SEGMENT@[183; 186)
@@ -101,7 +101,7 @@ SOURCE_FILE@[0; 350)
101 WHITESPACE@[274; 283) "\n " 101 WHITESPACE@[274; 283) "\n "
102 ATTR@[283; 302) 102 ATTR@[283; 302)
103 POUND@[283; 284) "#" 103 POUND@[283; 284) "#"
104 EXCL@[284; 285) "!" 104 BANG@[284; 285) "!"
105 L_BRACK@[285; 286) "[" 105 L_BRACK@[285; 286) "["
106 PATH@[286; 289) 106 PATH@[286; 289)
107 PATH_SEGMENT@[286; 289) 107 PATH_SEGMENT@[286; 289)
diff --git a/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast
index c36e2f770..b80101e60 100644
--- a/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast
+++ b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 293)
38 ATTR@[51; 52) 38 ATTR@[51; 52)
39 POUND@[51; 52) "#" 39 POUND@[51; 52) "#"
40 ERROR@[52; 53) 40 ERROR@[52; 53)
41 EXCL@[52; 53) "!" 41 BANG@[52; 53) "!"
42 ARRAY_EXPR@[53; 78) 42 ARRAY_EXPR@[53; 78)
43 L_BRACK@[53; 54) "[" 43 L_BRACK@[53; 54) "["
44 CALL_EXPR@[54; 77) 44 CALL_EXPR@[54; 77)
@@ -104,7 +104,7 @@ SOURCE_FILE@[0; 293)
104 ATTR@[160; 161) 104 ATTR@[160; 161)
105 POUND@[160; 161) "#" 105 POUND@[160; 161) "#"
106 ERROR@[161; 162) 106 ERROR@[161; 162)
107 EXCL@[161; 162) "!" 107 BANG@[161; 162) "!"
108 ARRAY_EXPR@[162; 179) 108 ARRAY_EXPR@[162; 179)
109 L_BRACK@[162; 163) "[" 109 L_BRACK@[162; 163) "["
110 CALL_EXPR@[163; 178) 110 CALL_EXPR@[163; 178)
@@ -149,7 +149,7 @@ SOURCE_FILE@[0; 293)
149 ATTR@[231; 232) 149 ATTR@[231; 232)
150 POUND@[231; 232) "#" 150 POUND@[231; 232) "#"
151 ERROR@[232; 233) 151 ERROR@[232; 233)
152 EXCL@[232; 233) "!" 152 BANG@[232; 233) "!"
153 ARRAY_EXPR@[233; 250) 153 ARRAY_EXPR@[233; 250)
154 L_BRACK@[233; 234) "[" 154 L_BRACK@[233; 234) "["
155 CALL_EXPR@[234; 249) 155 CALL_EXPR@[234; 249)
diff --git a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast
index 2c91b6841..2ab9ee56f 100644
--- a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast
+++ b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 91)
34 TUPLE_EXPR@[32; 34) 34 TUPLE_EXPR@[32; 34)
35 L_PAREN@[32; 33) "(" 35 L_PAREN@[32; 33) "("
36 R_PAREN@[33; 34) ")" 36 R_PAREN@[33; 34) ")"
37 SEMI@[34; 35) ";" 37 SEMICOLON@[34; 35) ";"
38 WHITESPACE@[35; 40) "\n " 38 WHITESPACE@[35; 40) "\n "
39 LET_STMT@[40; 51) 39 LET_STMT@[40; 51)
40 LET_KW@[40; 43) "let" 40 LET_KW@[40; 43) "let"
@@ -58,7 +58,7 @@ SOURCE_FILE@[0; 91)
58 TUPLE_EXPR@[56; 58) 58 TUPLE_EXPR@[56; 58)
59 L_PAREN@[56; 57) "(" 59 L_PAREN@[56; 57) "("
60 R_PAREN@[57; 58) ")" 60 R_PAREN@[57; 58) ")"
61 SEMI@[58; 59) ";" 61 SEMICOLON@[58; 59) ";"
62 WHITESPACE@[59; 64) "\n " 62 WHITESPACE@[59; 64) "\n "
63 LET_STMT@[64; 79) 63 LET_STMT@[64; 79)
64 LET_KW@[64; 67) "let" 64 LET_KW@[64; 67) "let"
@@ -84,13 +84,13 @@ SOURCE_FILE@[0; 91)
84 TUPLE_EXPR@[84; 86) 84 TUPLE_EXPR@[84; 86)
85 L_PAREN@[84; 85) "(" 85 L_PAREN@[84; 85) "("
86 R_PAREN@[85; 86) ")" 86 R_PAREN@[85; 86) ")"
87 SEMI@[86; 87) ";" 87 SEMICOLON@[86; 87) ";"
88 WHITESPACE@[87; 88) "\n" 88 WHITESPACE@[87; 88) "\n"
89 R_CURLY@[88; 89) "}" 89 R_CURLY@[88; 89) "}"
90 WHITESPACE@[89; 91) "\n\n" 90 WHITESPACE@[89; 91) "\n\n"
91error [24; 24): expected a name 91error [24; 24): expected a name
92error [27; 27): expected SEMI 92error [27; 27): expected SEMICOLON
93error [48; 48): expected a name 93error [48; 48): expected a name
94error [51; 51): expected SEMI 94error [51; 51): expected SEMICOLON
95error [76; 76): expected a name 95error [76; 76): expected a name
96error [79; 79): expected SEMI 96error [79; 79): expected SEMICOLON
diff --git a/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast b/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast
index 8cb4ea796..f255b0a6b 100644
--- a/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast
+++ b/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast
@@ -8,11 +8,11 @@ SOURCE_FILE@[0; 48)
8 PATH_SEGMENT@[4; 7) 8 PATH_SEGMENT@[4; 7)
9 NAME_REF@[4; 7) 9 NAME_REF@[4; 7)
10 IDENT@[4; 7) "foo" 10 IDENT@[4; 7) "foo"
11 COLONCOLON@[7; 9) "::" 11 COLON2@[7; 9) "::"
12 PATH_SEGMENT@[9; 12) 12 PATH_SEGMENT@[9; 12)
13 NAME_REF@[9; 12) 13 NAME_REF@[9; 12)
14 IDENT@[9; 12) "bar" 14 IDENT@[9; 12) "bar"
15 SEMI@[12; 13) ";" 15 SEMICOLON@[12; 13) ";"
16 WHITESPACE@[13; 14) "\n" 16 WHITESPACE@[13; 14) "\n"
17 USE_ITEM@[14; 17) 17 USE_ITEM@[14; 17)
18 USE_KW@[14; 17) "use" 18 USE_KW@[14; 17) "use"
@@ -25,11 +25,11 @@ SOURCE_FILE@[0; 48)
25 PATH@[22; 27) 25 PATH@[22; 27)
26 PATH_SEGMENT@[22; 27) 26 PATH_SEGMENT@[22; 27)
27 CRATE_KW@[22; 27) "crate" 27 CRATE_KW@[22; 27) "crate"
28 COLONCOLON@[27; 29) "::" 28 COLON2@[27; 29) "::"
29 PATH_SEGMENT@[29; 32) 29 PATH_SEGMENT@[29; 32)
30 NAME_REF@[29; 32) 30 NAME_REF@[29; 32)
31 IDENT@[29; 32) "baz" 31 IDENT@[29; 32) "baz"
32 SEMI@[32; 33) ";" 32 SEMICOLON@[32; 33) ";"
33 WHITESPACE@[33; 34) "\n" 33 WHITESPACE@[33; 34) "\n"
34 USE_ITEM@[34; 37) 34 USE_ITEM@[34; 37)
35 USE_KW@[34; 37) "use" 35 USE_KW@[34; 37) "use"
@@ -49,6 +49,6 @@ SOURCE_FILE@[0; 48)
49 R_CURLY@[46; 47) "}" 49 R_CURLY@[46; 47) "}"
50 WHITESPACE@[47; 48) "\n" 50 WHITESPACE@[47; 48) "\n"
51error [17; 17): expected one of `*`, `::`, `{`, `self`, `super` or an identifier 51error [17; 17): expected one of `*`, `::`, `{`, `self`, `super` or an identifier
52error [17; 17): expected SEMI 52error [17; 17): expected SEMICOLON
53error [37; 37): expected one of `*`, `::`, `{`, `self`, `super` or an identifier 53error [37; 37): expected one of `*`, `::`, `{`, `self`, `super` or an identifier
54error [37; 37): expected SEMI 54error [37; 37): expected SEMICOLON
diff --git a/crates/ra_syntax/test_data/parser/err/0036_partial_use.rast b/crates/ra_syntax/test_data/parser/err/0036_partial_use.rast
index f5490fbe8..1f2b4f6d9 100644
--- a/crates/ra_syntax/test_data/parser/err/0036_partial_use.rast
+++ b/crates/ra_syntax/test_data/parser/err/0036_partial_use.rast
@@ -7,7 +7,7 @@ SOURCE_FILE@[0; 37)
7 PATH_SEGMENT@[4; 7) 7 PATH_SEGMENT@[4; 7)
8 NAME_REF@[4; 7) 8 NAME_REF@[4; 7)
9 IDENT@[4; 7) "std" 9 IDENT@[4; 7) "std"
10 COLONCOLON@[7; 9) "::" 10 COLON2@[7; 9) "::"
11 USE_TREE_LIST@[9; 36) 11 USE_TREE_LIST@[9; 36)
12 L_CURLY@[9; 10) "{" 12 L_CURLY@[9; 10) "{"
13 USE_TREE@[10; 22) 13 USE_TREE@[10; 22)
@@ -16,12 +16,12 @@ SOURCE_FILE@[0; 37)
16 PATH_SEGMENT@[10; 15) 16 PATH_SEGMENT@[10; 15)
17 NAME_REF@[10; 15) 17 NAME_REF@[10; 15)
18 IDENT@[10; 15) "error" 18 IDENT@[10; 15) "error"
19 COLONCOLON@[15; 17) "::" 19 COLON2@[15; 17) "::"
20 PATH_SEGMENT@[17; 22) 20 PATH_SEGMENT@[17; 22)
21 NAME_REF@[17; 22) 21 NAME_REF@[17; 22)
22 IDENT@[17; 22) "Error" 22 IDENT@[17; 22) "Error"
23 ERROR@[22; 23) 23 ERROR@[22; 23)
24 SEMI@[22; 23) ";" 24 SEMICOLON@[22; 23) ";"
25 WHITESPACE@[23; 24) "\n" 25 WHITESPACE@[23; 24) "\n"
26 ERROR@[24; 27) 26 ERROR@[24; 27)
27 USE_KW@[24; 27) "use" 27 USE_KW@[24; 27) "use"
@@ -32,12 +32,12 @@ SOURCE_FILE@[0; 37)
32 PATH_SEGMENT@[28; 31) 32 PATH_SEGMENT@[28; 31)
33 NAME_REF@[28; 31) 33 NAME_REF@[28; 31)
34 IDENT@[28; 31) "std" 34 IDENT@[28; 31) "std"
35 COLONCOLON@[31; 33) "::" 35 COLON2@[31; 33) "::"
36 PATH_SEGMENT@[33; 35) 36 PATH_SEGMENT@[33; 35)
37 NAME_REF@[33; 35) 37 NAME_REF@[33; 35)
38 IDENT@[33; 35) "io" 38 IDENT@[33; 35) "io"
39 ERROR@[35; 36) 39 ERROR@[35; 36)
40 SEMI@[35; 36) ";" 40 SEMICOLON@[35; 36) ";"
41 WHITESPACE@[36; 37) "\n" 41 WHITESPACE@[36; 37) "\n"
42error [22; 22): expected COMMA 42error [22; 22): expected COMMA
43error [22; 22): expected one of `*`, `::`, `{`, `self`, `super` or an identifier 43error [22; 22): expected one of `*`, `::`, `{`, `self`, `super` or an identifier
@@ -48,4 +48,4 @@ error [35; 35): expected COMMA
48error [35; 35): expected one of `*`, `::`, `{`, `self`, `super` or an identifier 48error [35; 35): expected one of `*`, `::`, `{`, `self`, `super` or an identifier
49error [36; 36): expected COMMA 49error [36; 36): expected COMMA
50error [36; 36): expected R_CURLY 50error [36; 36): expected R_CURLY
51error [36; 36): expected SEMI 51error [36; 36): expected SEMICOLON
diff --git a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast
index d8622d45f..5319bf936 100644
--- a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast
+++ b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast
@@ -65,7 +65,7 @@ SOURCE_FILE@[0; 118)
65 TUPLE_TYPE@[78; 80) 65 TUPLE_TYPE@[78; 80)
66 L_PAREN@[78; 79) "(" 66 L_PAREN@[78; 79) "("
67 R_PAREN@[79; 80) ")" 67 R_PAREN@[79; 80) ")"
68 SEMI@[80; 81) ";" 68 SEMICOLON@[80; 81) ";"
69 WHITESPACE@[81; 86) "\n " 69 WHITESPACE@[81; 86) "\n "
70 CONST_DEF@[86; 115) 70 CONST_DEF@[86; 115)
71 VISIBILITY@[86; 96) 71 VISIBILITY@[86; 96)
@@ -90,7 +90,7 @@ SOURCE_FILE@[0; 118)
90 WHITESPACE@[111; 112) " " 90 WHITESPACE@[111; 112) " "
91 LITERAL@[112; 114) 91 LITERAL@[112; 114)
92 INT_NUMBER@[112; 114) "92" 92 INT_NUMBER@[112; 114) "92"
93 SEMI@[114; 115) ";" 93 SEMICOLON@[114; 115) ";"
94 WHITESPACE@[115; 116) "\n" 94 WHITESPACE@[115; 116) "\n"
95 R_CURLY@[116; 117) "}" 95 R_CURLY@[116; 117) "}"
96 WHITESPACE@[117; 118) "\n" 96 WHITESPACE@[117; 118) "\n"
diff --git a/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast
index 3810b9680..9efdf7ef4 100644
--- a/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast
+++ b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast
@@ -16,13 +16,13 @@ SOURCE_FILE@[0; 33)
16 RANGE_EXPR@[16; 20) 16 RANGE_EXPR@[16; 20)
17 LITERAL@[16; 17) 17 LITERAL@[16; 17)
18 INT_NUMBER@[16; 17) "0" 18 INT_NUMBER@[16; 17) "0"
19 DOTDOTEQ@[17; 20) "..=" 19 DOT2EQ@[17; 20) "..="
20 SEMI@[20; 21) ";" 20 SEMICOLON@[20; 21) ";"
21 WHITESPACE@[21; 26) "\n " 21 WHITESPACE@[21; 26) "\n "
22 EXPR_STMT@[26; 30) 22 EXPR_STMT@[26; 30)
23 RANGE_EXPR@[26; 29) 23 RANGE_EXPR@[26; 29)
24 DOTDOTEQ@[26; 29) "..=" 24 DOT2EQ@[26; 29) "..="
25 SEMI@[29; 30) ";" 25 SEMICOLON@[29; 30) ";"
26 WHITESPACE@[30; 31) "\n" 26 WHITESPACE@[30; 31) "\n"
27 R_CURLY@[31; 32) "}" 27 R_CURLY@[31; 32) "}"
28 WHITESPACE@[32; 33) "\n" 28 WHITESPACE@[32; 33) "\n"
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
index 4a2f0a696..edf9c3247 100644
--- a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
+++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 83)
64 NAME_REF@[67; 70) 64 NAME_REF@[67; 70)
65 IDENT@[67; 70) "max" 65 IDENT@[67; 70) "max"
66 TYPE_ARG_LIST@[70; 77) 66 TYPE_ARG_LIST@[70; 77)
67 COLONCOLON@[70; 72) "::" 67 COLON2@[70; 72) "::"
68 L_ANGLE@[72; 73) "<" 68 L_ANGLE@[72; 73) "<"
69 TYPE_ARG@[73; 76) 69 TYPE_ARG@[73; 76)
70 PATH_TYPE@[73; 76) 70 PATH_TYPE@[73; 76)
@@ -76,7 +76,7 @@ SOURCE_FILE@[0; 83)
76 ARG_LIST@[77; 79) 76 ARG_LIST@[77; 79)
77 L_PAREN@[77; 78) "(" 77 L_PAREN@[77; 78) "("
78 R_PAREN@[78; 79) ")" 78 R_PAREN@[78; 79) ")"
79 SEMI@[79; 80) ";" 79 SEMICOLON@[79; 80) ";"
80 WHITESPACE@[80; 81) "\n" 80 WHITESPACE@[80; 81) "\n"
81 R_CURLY@[81; 82) "}" 81 R_CURLY@[81; 82) "}"
82 WHITESPACE@[82; 83) "\n" 82 WHITESPACE@[82; 83) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast
index 530533b71..9d807c84f 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast
@@ -18,10 +18,10 @@ SOURCE_FILE@[0; 18)
18 ERROR@[15; 16) 18 ERROR@[15; 16)
19 R_BRACK@[15; 16) "]" 19 R_BRACK@[15; 16) "]"
20 ERROR@[16; 17) 20 ERROR@[16; 17)
21 SEMI@[16; 17) ";" 21 SEMICOLON@[16; 17) ";"
22 WHITESPACE@[17; 18) "\n" 22 WHITESPACE@[17; 18) "\n"
23error [12; 12): expected `;` or `]` 23error [12; 12): expected `;` or `]`
24error [12; 12): expected SEMI 24error [12; 12): expected SEMICOLON
25error [13; 13): expected an item 25error [13; 13): expected an item
26error [15; 15): expected an item 26error [15; 15): expected an item
27error [16; 16): expected an item 27error [16; 16): expected an item
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
index 01a853d63..a85855f8c 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
@@ -24,6 +24,6 @@ SOURCE_FILE@[0; 30)
24 R_CURLY@[28; 29) "}" 24 R_CURLY@[28; 29) "}"
25 WHITESPACE@[29; 30) "\n" 25 WHITESPACE@[29; 30) "\n"
26error [22; 22): expected a loop 26error [22; 22): expected a loop
27error [22; 22): expected SEMI 27error [22; 22): expected SEMICOLON
28error [27; 27): expected type 28error [27; 27): expected type
29error [27; 27): expected `{` 29error [27; 27): expected `{`
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast
index 2ab29eecc..e9efad674 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast
@@ -12,6 +12,6 @@ SOURCE_FILE@[0; 14)
12 TUPLE_TYPE@[10; 12) 12 TUPLE_TYPE@[10; 12)
13 L_PAREN@[10; 11) "(" 13 L_PAREN@[10; 11) "("
14 R_PAREN@[11; 12) ")" 14 R_PAREN@[11; 12) ")"
15 SEMI@[12; 13) ";" 15 SEMICOLON@[12; 13) ";"
16 WHITESPACE@[13; 14) "\n" 16 WHITESPACE@[13; 14) "\n"
17error [10; 10): expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate) 17error [10; 10): expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate)
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast
index 9e9186ad4..b8a494085 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast
@@ -14,10 +14,10 @@ SOURCE_FILE@[0; 20)
14 ERROR@[17; 18) 14 ERROR@[17; 18)
15 R_PAREN@[17; 18) ")" 15 R_PAREN@[17; 18) ")"
16 ERROR@[18; 19) 16 ERROR@[18; 19)
17 SEMI@[18; 19) ";" 17 SEMICOLON@[18; 19) ";"
18 WHITESPACE@[19; 20) "\n" 18 WHITESPACE@[19; 20) "\n"
19error [15; 15): expected `fn` 19error [15; 15): expected `fn`
20error [15; 15): expected SEMI 20error [15; 15): expected SEMICOLON
21error [16; 16): expected an item 21error [16; 16): expected an item
22error [17; 17): expected an item 22error [17; 17): expected an item
23error [18; 18): expected an item 23error [18; 18): expected an item
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast
index a4002a998..c3f7eb477 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast
@@ -29,4 +29,4 @@ SOURCE_FILE@[0; 30)
29 WHITESPACE@[27; 28) " " 29 WHITESPACE@[27; 28) " "
30 R_CURLY@[28; 29) "}" 30 R_CURLY@[28; 29) "}"
31 WHITESPACE@[29; 30) "\n" 31 WHITESPACE@[29; 30) "\n"
32error [27; 27): expected SEMI 32error [27; 27): expected SEMICOLON
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast
index 6f45a4fa6..a345f8488 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast
@@ -19,7 +19,7 @@ SOURCE_FILE@[0; 21)
19 EXPR_STMT@[15; 18) 19 EXPR_STMT@[15; 18)
20 LITERAL@[15; 17) 20 LITERAL@[15; 17)
21 INT_NUMBER@[15; 17) "92" 21 INT_NUMBER@[15; 17) "92"
22 SEMI@[17; 18) ";" 22 SEMICOLON@[17; 18) ";"
23 WHITESPACE@[18; 19) " " 23 WHITESPACE@[18; 19) " "
24 R_CURLY@[19; 20) "}" 24 R_CURLY@[19; 20) "}"
25 WHITESPACE@[20; 21) "\n" 25 WHITESPACE@[20; 21) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast
index e6d3a5c95..c3a70147a 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast
@@ -30,7 +30,7 @@ SOURCE_FILE@[0; 48)
30 WHITESPACE@[22; 23) " " 30 WHITESPACE@[22; 23) " "
31 LITERAL@[23; 24) 31 LITERAL@[23; 24)
32 INT_NUMBER@[23; 24) "2" 32 INT_NUMBER@[23; 24) "2"
33 SEMI@[24; 25) ";" 33 SEMICOLON@[24; 25) ";"
34 WHITESPACE@[25; 29) "\n " 34 WHITESPACE@[25; 29) "\n "
35 EXPR_STMT@[29; 45) 35 EXPR_STMT@[29; 45)
36 ATTR@[29; 33) 36 ATTR@[29; 33)
@@ -53,7 +53,7 @@ SOURCE_FILE@[0; 48)
53 BLOCK@[42; 44) 53 BLOCK@[42; 44)
54 L_CURLY@[42; 43) "{" 54 L_CURLY@[42; 43) "{"
55 R_CURLY@[43; 44) "}" 55 R_CURLY@[43; 44) "}"
56 SEMI@[44; 45) ";" 56 SEMICOLON@[44; 45) ";"
57 WHITESPACE@[45; 46) "\n" 57 WHITESPACE@[45; 46) "\n"
58 R_CURLY@[46; 47) "}" 58 R_CURLY@[46; 47) "}"
59 WHITESPACE@[47; 48) "\n" 59 WHITESPACE@[47; 48) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast
index 8ad2a588f..61d737abe 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 47)
21 IDENT@[15; 16) "x" 21 IDENT@[15; 16) "x"
22 DOT@[16; 17) "." 22 DOT@[16; 17) "."
23 FLOAT_NUMBER@[17; 19) "0." 23 FLOAT_NUMBER@[17; 19) "0."
24 SEMI@[19; 20) ";" 24 SEMICOLON@[19; 20) ";"
25 WHITESPACE@[20; 25) "\n " 25 WHITESPACE@[20; 25) "\n "
26 EXPR_STMT@[25; 32) 26 EXPR_STMT@[25; 32)
27 FIELD_EXPR@[25; 31) 27 FIELD_EXPR@[25; 31)
@@ -33,7 +33,7 @@ SOURCE_FILE@[0; 47)
33 DOT@[26; 27) "." 33 DOT@[26; 27) "."
34 NAME_REF@[27; 31) 34 NAME_REF@[27; 31)
35 INT_NUMBER@[27; 31) "1i32" 35 INT_NUMBER@[27; 31) "1i32"
36 SEMI@[31; 32) ";" 36 SEMICOLON@[31; 32) ";"
37 WHITESPACE@[32; 37) "\n " 37 WHITESPACE@[32; 37) "\n "
38 EXPR_STMT@[37; 44) 38 EXPR_STMT@[37; 44)
39 FIELD_EXPR@[37; 43) 39 FIELD_EXPR@[37; 43)
@@ -45,7 +45,7 @@ SOURCE_FILE@[0; 47)
45 DOT@[38; 39) "." 45 DOT@[38; 39) "."
46 NAME_REF@[39; 43) 46 NAME_REF@[39; 43)
47 INT_NUMBER@[39; 43) "0x01" 47 INT_NUMBER@[39; 43) "0x01"
48 SEMI@[43; 44) ";" 48 SEMICOLON@[43; 44) ";"
49 WHITESPACE@[44; 45) "\n" 49 WHITESPACE@[44; 45) "\n"
50 R_CURLY@[45; 46) "}" 50 R_CURLY@[45; 46) "}"
51 WHITESPACE@[46; 47) "\n" 51 WHITESPACE@[46; 47) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast b/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast
index 5b3dc5af2..62fca0a39 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast
@@ -16,6 +16,6 @@ SOURCE_FILE@[0; 19)
16 WHITESPACE@[15; 16) " " 16 WHITESPACE@[15; 16) " "
17 LITERAL@[16; 17) 17 LITERAL@[16; 17)
18 INT_NUMBER@[16; 17) "5" 18 INT_NUMBER@[16; 17) "5"
19 SEMI@[17; 18) ";" 19 SEMICOLON@[17; 18) ";"
20 WHITESPACE@[18; 19) "\n" 20 WHITESPACE@[18; 19) "\n"
21error [7; 7): expected a name 21error [7; 7): expected a name
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast
index 25d80be1d..aa960d3ef 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 62)
27 PATH_SEGMENT@[31; 34) 27 PATH_SEGMENT@[31; 34)
28 NAME_REF@[31; 34) 28 NAME_REF@[31; 34)
29 IDENT@[31; 34) "Bar" 29 IDENT@[31; 34) "Bar"
30 SEMI@[34; 35) ";" 30 SEMICOLON@[34; 35) ";"
31 WHITESPACE@[35; 40) "\n " 31 WHITESPACE@[35; 40) "\n "
32 MACRO_CALL@[40; 47) 32 MACRO_CALL@[40; 47)
33 PATH@[40; 47) 33 PATH@[40; 47)
@@ -51,9 +51,9 @@ SOURCE_FILE@[0; 62)
51 WHITESPACE@[59; 60) "\n" 51 WHITESPACE@[59; 60) "\n"
52 R_CURLY@[60; 61) "}" 52 R_CURLY@[60; 61) "}"
53 WHITESPACE@[61; 62) "\n" 53 WHITESPACE@[61; 62) "\n"
54error [21; 21): expected EXCL 54error [21; 21): expected BANG
55error [21; 21): expected `{`, `[`, `(` 55error [21; 21): expected `{`, `[`, `(`
56error [21; 21): expected SEMI 56error [21; 21): expected SEMICOLON
57error [47; 47): expected EXCL 57error [47; 47): expected BANG
58error [47; 47): expected `{`, `[`, `(` 58error [47; 47): expected `{`, `[`, `(`
59error [47; 47): expected SEMI 59error [47; 47): expected SEMICOLON
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast
new file mode 100644
index 000000000..75043c9c0
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast
@@ -0,0 +1,49 @@
1SOURCE_FILE@[0; 45)
2 FN_DEF@[0; 44)
3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " "
5 NAME@[3; 7)
6 IDENT@[3; 7) "main"
7 PARAM_LIST@[7; 9)
8 L_PAREN@[7; 8) "("
9 R_PAREN@[8; 9) ")"
10 WHITESPACE@[9; 10) " "
11 BLOCK_EXPR@[10; 44)
12 BLOCK@[10; 44)
13 L_CURLY@[10; 11) "{"
14 WHITESPACE@[11; 16) "\n "
15 RECORD_LIT@[16; 42)
16 PATH@[16; 17)
17 PATH_SEGMENT@[16; 17)
18 NAME_REF@[16; 17)
19 IDENT@[16; 17) "S"
20 WHITESPACE@[17; 18) " "
21 RECORD_FIELD_LIST@[18; 42)
22 L_CURLY@[18; 19) "{"
23 WHITESPACE@[19; 20) " "
24 RECORD_FIELD@[20; 40)
25 NAME_REF@[20; 25)
26 IDENT@[20; 25) "field"
27 WHITESPACE@[25; 26) " "
28 RANGE_EXPR@[26; 40)
29 DOT2@[26; 28) ".."
30 CALL_EXPR@[28; 40)
31 PATH_EXPR@[28; 38)
32 PATH@[28; 38)
33 PATH@[28; 29)
34 PATH_SEGMENT@[28; 29)
35 NAME_REF@[28; 29)
36 IDENT@[28; 29) "S"
37 COLON2@[29; 31) "::"
38 PATH_SEGMENT@[31; 38)
39 NAME_REF@[31; 38)
40 IDENT@[31; 38) "default"
41 ARG_LIST@[38; 40)
42 L_PAREN@[38; 39) "("
43 R_PAREN@[39; 40) ")"
44 WHITESPACE@[40; 41) " "
45 R_CURLY@[41; 42) "}"
46 WHITESPACE@[42; 43) "\n"
47 R_CURLY@[43; 44) "}"
48 WHITESPACE@[44; 45) "\n"
49error [25; 25): expected COLON
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs
new file mode 100644
index 000000000..a4e5b2f69
--- /dev/null
+++ b/crates/ra_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/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast
index ad9f0965e..25c6ef7e3 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 83)
25 PATH_SEGMENT@[21; 26) 25 PATH_SEGMENT@[21; 26)
26 NAME_REF@[21; 26) 26 NAME_REF@[21; 26)
27 IDENT@[21; 26) "Clone" 27 IDENT@[21; 26) "Clone"
28 SEMI@[26; 27) ";" 28 SEMICOLON@[26; 27) ";"
29 WHITESPACE@[27; 32) "\n " 29 WHITESPACE@[27; 32) "\n "
30 CONST_DEF@[32; 45) 30 CONST_DEF@[32; 45)
31 CONST_KW@[32; 37) "const" 31 CONST_KW@[32; 37) "const"
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 83)
39 PATH_SEGMENT@[41; 44) 39 PATH_SEGMENT@[41; 44)
40 NAME_REF@[41; 44) 40 NAME_REF@[41; 44)
41 IDENT@[41; 44) "i32" 41 IDENT@[41; 44) "i32"
42 SEMI@[44; 45) ";" 42 SEMICOLON@[44; 45) ";"
43 WHITESPACE@[45; 50) "\n " 43 WHITESPACE@[45; 50) "\n "
44 FN_DEF@[50; 61) 44 FN_DEF@[50; 61)
45 FN_KW@[50; 52) "fn" 45 FN_KW@[50; 52) "fn"
@@ -66,7 +66,7 @@ SOURCE_FILE@[0; 83)
66 AMP@[73; 74) "&" 66 AMP@[73; 74) "&"
67 SELF_KW@[74; 78) "self" 67 SELF_KW@[74; 78) "self"
68 R_PAREN@[78; 79) ")" 68 R_PAREN@[78; 79) ")"
69 SEMI@[79; 80) ";" 69 SEMICOLON@[79; 80) ";"
70 WHITESPACE@[80; 81) "\n" 70 WHITESPACE@[80; 81) "\n"
71 R_CURLY@[81; 82) "}" 71 R_CURLY@[81; 82) "}"
72 WHITESPACE@[82; 83) "\n" 72 WHITESPACE@[82; 83) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0002_use_tree_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0002_use_tree_list.rast
index 1b318dfb9..69c459daf 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0002_use_tree_list.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0002_use_tree_list.rast
@@ -12,15 +12,15 @@ SOURCE_FILE@[0; 250)
12 PATH@[5; 10) 12 PATH@[5; 10)
13 PATH_SEGMENT@[5; 10) 13 PATH_SEGMENT@[5; 10)
14 CRATE_KW@[5; 10) "crate" 14 CRATE_KW@[5; 10) "crate"
15 COLONCOLON@[10; 12) "::" 15 COLON2@[10; 12) "::"
16 PATH_SEGMENT@[12; 16) 16 PATH_SEGMENT@[12; 16)
17 NAME_REF@[12; 16) 17 NAME_REF@[12; 16)
18 IDENT@[12; 16) "path" 18 IDENT@[12; 16) "path"
19 COLONCOLON@[16; 18) "::" 19 COLON2@[16; 18) "::"
20 PATH_SEGMENT@[18; 22) 20 PATH_SEGMENT@[18; 22)
21 NAME_REF@[18; 22) 21 NAME_REF@[18; 22)
22 IDENT@[18; 22) "from" 22 IDENT@[18; 22) "from"
23 COLONCOLON@[22; 24) "::" 23 COLON2@[22; 24) "::"
24 PATH_SEGMENT@[24; 28) 24 PATH_SEGMENT@[24; 28)
25 NAME_REF@[24; 28) 25 NAME_REF@[24; 28)
26 IDENT@[24; 28) "root" 26 IDENT@[24; 28) "root"
@@ -34,20 +34,20 @@ SOURCE_FILE@[0; 250)
34 PATH_SEGMENT@[30; 32) 34 PATH_SEGMENT@[30; 32)
35 NAME_REF@[30; 32) 35 NAME_REF@[30; 32)
36 IDENT@[30; 32) "or" 36 IDENT@[30; 32) "or"
37 COLONCOLON@[32; 34) "::" 37 COLON2@[32; 34) "::"
38 PATH_SEGMENT@[34; 38) 38 PATH_SEGMENT@[34; 38)
39 NAME_REF@[34; 38) 39 NAME_REF@[34; 38)
40 IDENT@[34; 38) "path" 40 IDENT@[34; 38) "path"
41 COLONCOLON@[38; 40) "::" 41 COLON2@[38; 40) "::"
42 PATH_SEGMENT@[40; 44) 42 PATH_SEGMENT@[40; 44)
43 NAME_REF@[40; 44) 43 NAME_REF@[40; 44)
44 IDENT@[40; 44) "from" 44 IDENT@[40; 44) "from"
45 COLONCOLON@[44; 46) "::" 45 COLON2@[44; 46) "::"
46 PATH_SEGMENT@[46; 56) 46 PATH_SEGMENT@[46; 56)
47 NAME_REF@[46; 56) 47 NAME_REF@[46; 56)
48 IDENT@[46; 56) "crate_name" 48 IDENT@[46; 56) "crate_name"
49 R_CURLY@[56; 57) "}" 49 R_CURLY@[56; 57) "}"
50 SEMI@[57; 58) ";" 50 SEMICOLON@[57; 58) ";"
51 WHITESPACE@[58; 59) " " 51 WHITESPACE@[58; 59) " "
52 COMMENT@[59; 97) "// Rust 2018 (with a ..." 52 COMMENT@[59; 97) "// Rust 2018 (with a ..."
53 WHITESPACE@[97; 98) "\n" 53 WHITESPACE@[97; 98) "\n"
@@ -64,16 +64,16 @@ SOURCE_FILE@[0; 250)
64 PATH_SEGMENT@[103; 107) 64 PATH_SEGMENT@[103; 107)
65 NAME_REF@[103; 107) 65 NAME_REF@[103; 107)
66 IDENT@[103; 107) "path" 66 IDENT@[103; 107) "path"
67 COLONCOLON@[107; 109) "::" 67 COLON2@[107; 109) "::"
68 PATH_SEGMENT@[109; 113) 68 PATH_SEGMENT@[109; 113)
69 NAME_REF@[109; 113) 69 NAME_REF@[109; 113)
70 IDENT@[109; 113) "from" 70 IDENT@[109; 113) "from"
71 COLONCOLON@[113; 115) "::" 71 COLON2@[113; 115) "::"
72 PATH_SEGMENT@[115; 119) 72 PATH_SEGMENT@[115; 119)
73 NAME_REF@[115; 119) 73 NAME_REF@[115; 119)
74 IDENT@[115; 119) "root" 74 IDENT@[115; 119) "root"
75 R_CURLY@[119; 120) "}" 75 R_CURLY@[119; 120) "}"
76 SEMI@[120; 121) ";" 76 SEMICOLON@[120; 121) ";"
77 WHITESPACE@[121; 122) " " 77 WHITESPACE@[121; 122) " "
78 COMMENT@[122; 134) "// Rust 2015" 78 COMMENT@[122; 134) "// Rust 2015"
79 WHITESPACE@[134; 135) "\n" 79 WHITESPACE@[134; 135) "\n"
@@ -81,7 +81,7 @@ SOURCE_FILE@[0; 250)
81 USE_KW@[135; 138) "use" 81 USE_KW@[135; 138) "use"
82 WHITESPACE@[138; 139) " " 82 WHITESPACE@[138; 139) " "
83 USE_TREE@[139; 165) 83 USE_TREE@[139; 165)
84 COLONCOLON@[139; 141) "::" 84 COLON2@[139; 141) "::"
85 USE_TREE_LIST@[141; 165) 85 USE_TREE_LIST@[141; 165)
86 L_CURLY@[141; 142) "{" 86 L_CURLY@[141; 142) "{"
87 USE_TREE@[142; 164) 87 USE_TREE@[142; 164)
@@ -91,16 +91,16 @@ SOURCE_FILE@[0; 250)
91 PATH_SEGMENT@[142; 146) 91 PATH_SEGMENT@[142; 146)
92 NAME_REF@[142; 146) 92 NAME_REF@[142; 146)
93 IDENT@[142; 146) "some" 93 IDENT@[142; 146) "some"
94 COLONCOLON@[146; 148) "::" 94 COLON2@[146; 148) "::"
95 PATH_SEGMENT@[148; 158) 95 PATH_SEGMENT@[148; 158)
96 NAME_REF@[148; 158) 96 NAME_REF@[148; 158)
97 IDENT@[148; 158) "arbritrary" 97 IDENT@[148; 158) "arbritrary"
98 COLONCOLON@[158; 160) "::" 98 COLON2@[158; 160) "::"
99 PATH_SEGMENT@[160; 164) 99 PATH_SEGMENT@[160; 164)
100 NAME_REF@[160; 164) 100 NAME_REF@[160; 164)
101 IDENT@[160; 164) "path" 101 IDENT@[160; 164) "path"
102 R_CURLY@[164; 165) "}" 102 R_CURLY@[164; 165) "}"
103 SEMI@[165; 166) ";" 103 SEMICOLON@[165; 166) ";"
104 WHITESPACE@[166; 167) " " 104 WHITESPACE@[166; 167) " "
105 COMMENT@[167; 179) "// Rust 2015" 105 COMMENT@[167; 179) "// Rust 2015"
106 WHITESPACE@[179; 180) "\n" 106 WHITESPACE@[179; 180) "\n"
@@ -108,7 +108,7 @@ SOURCE_FILE@[0; 250)
108 USE_KW@[180; 183) "use" 108 USE_KW@[180; 183) "use"
109 WHITESPACE@[183; 184) " " 109 WHITESPACE@[183; 184) " "
110 USE_TREE@[184; 205) 110 USE_TREE@[184; 205)
111 COLONCOLON@[184; 186) "::" 111 COLON2@[184; 186) "::"
112 USE_TREE_LIST@[186; 205) 112 USE_TREE_LIST@[186; 205)
113 L_CURLY@[186; 187) "{" 113 L_CURLY@[186; 187) "{"
114 USE_TREE@[187; 204) 114 USE_TREE@[187; 204)
@@ -122,14 +122,14 @@ SOURCE_FILE@[0; 250)
122 PATH@[189; 194) 122 PATH@[189; 194)
123 PATH_SEGMENT@[189; 194) 123 PATH_SEGMENT@[189; 194)
124 CRATE_KW@[189; 194) "crate" 124 CRATE_KW@[189; 194) "crate"
125 COLONCOLON@[194; 196) "::" 125 COLON2@[194; 196) "::"
126 PATH_SEGMENT@[196; 202) 126 PATH_SEGMENT@[196; 202)
127 NAME_REF@[196; 202) 127 NAME_REF@[196; 202)
128 IDENT@[196; 202) "export" 128 IDENT@[196; 202) "export"
129 R_CURLY@[202; 203) "}" 129 R_CURLY@[202; 203) "}"
130 R_CURLY@[203; 204) "}" 130 R_CURLY@[203; 204) "}"
131 R_CURLY@[204; 205) "}" 131 R_CURLY@[204; 205) "}"
132 SEMI@[205; 206) ";" 132 SEMICOLON@[205; 206) ";"
133 WHITESPACE@[206; 207) " " 133 WHITESPACE@[206; 207) " "
134 COMMENT@[207; 249) "// Nonsensical but pe ..." 134 COMMENT@[207; 249) "// Nonsensical but pe ..."
135 WHITESPACE@[249; 250) "\n" 135 WHITESPACE@[249; 250) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast b/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast
index 9241f6fb2..a0cf1e4f6 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast
@@ -56,5 +56,5 @@ SOURCE_FILE@[0; 39)
56 R_PAREN@[34; 35) ")" 56 R_PAREN@[34; 35) ")"
57 R_PAREN@[35; 36) ")" 57 R_PAREN@[35; 36) ")"
58 R_ANGLE@[36; 37) ">" 58 R_ANGLE@[36; 37) ">"
59 SEMI@[37; 38) ";" 59 SEMICOLON@[37; 38) ";"
60 WHITESPACE@[38; 39) "\n" 60 WHITESPACE@[38; 39) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
index a7186c7a8..027abf179 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
@@ -36,5 +36,5 @@ SOURCE_FILE@[0; 35)
36 IDENT@[27; 31) "Copy" 36 IDENT@[27; 31) "Copy"
37 R_PAREN@[31; 32) ")" 37 R_PAREN@[31; 32) ")"
38 R_ANGLE@[32; 33) ">" 38 R_ANGLE@[32; 33) ">"
39 SEMI@[33; 34) ";" 39 SEMICOLON@[33; 34) ";"
40 WHITESPACE@[34; 35) "\n" 40 WHITESPACE@[34; 35) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast
index 3812adc9e..f4697fed6 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 103)
21 PATH_SEGMENT@[19; 22) 21 PATH_SEGMENT@[19; 22)
22 NAME_REF@[19; 22) 22 NAME_REF@[19; 22)
23 IDENT@[19; 22) "foo" 23 IDENT@[19; 22) "foo"
24 COLONCOLON@[22; 24) "::" 24 COLON2@[22; 24) "::"
25 PATH_SEGMENT@[24; 27) 25 PATH_SEGMENT@[24; 27)
26 NAME_REF@[24; 27) 26 NAME_REF@[24; 27)
27 IDENT@[24; 27) "Bar" 27 IDENT@[24; 27) "Bar"
@@ -31,7 +31,7 @@ SOURCE_FILE@[0; 103)
31 TUPLE_EXPR@[30; 32) 31 TUPLE_EXPR@[30; 32)
32 L_PAREN@[30; 31) "(" 32 L_PAREN@[30; 31) "("
33 R_PAREN@[31; 32) ")" 33 R_PAREN@[31; 32) ")"
34 SEMI@[32; 33) ";" 34 SEMICOLON@[32; 33) ";"
35 WHITESPACE@[33; 38) "\n " 35 WHITESPACE@[33; 38) "\n "
36 LET_STMT@[38; 53) 36 LET_STMT@[38; 53)
37 LET_KW@[38; 41) "let" 37 LET_KW@[38; 41) "let"
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 103)
39 PATH_PAT@[42; 47) 39 PATH_PAT@[42; 47)
40 PATH@[42; 47) 40 PATH@[42; 47)
41 PATH_SEGMENT@[42; 47) 41 PATH_SEGMENT@[42; 47)
42 COLONCOLON@[42; 44) "::" 42 COLON2@[42; 44) "::"
43 NAME_REF@[44; 47) 43 NAME_REF@[44; 47)
44 IDENT@[44; 47) "Bar" 44 IDENT@[44; 47) "Bar"
45 WHITESPACE@[47; 48) " " 45 WHITESPACE@[47; 48) " "
@@ -48,7 +48,7 @@ SOURCE_FILE@[0; 103)
48 TUPLE_EXPR@[50; 52) 48 TUPLE_EXPR@[50; 52)
49 L_PAREN@[50; 51) "(" 49 L_PAREN@[50; 51) "("
50 R_PAREN@[51; 52) ")" 50 R_PAREN@[51; 52) ")"
51 SEMI@[52; 53) ";" 51 SEMICOLON@[52; 53) ";"
52 WHITESPACE@[53; 58) "\n " 52 WHITESPACE@[53; 58) "\n "
53 LET_STMT@[58; 78) 53 LET_STMT@[58; 78)
54 LET_KW@[58; 61) "let" 54 LET_KW@[58; 61) "let"
@@ -62,7 +62,7 @@ SOURCE_FILE@[0; 103)
62 RECORD_FIELD_PAT_LIST@[66; 72) 62 RECORD_FIELD_PAT_LIST@[66; 72)
63 L_CURLY@[66; 67) "{" 63 L_CURLY@[66; 67) "{"
64 WHITESPACE@[67; 68) " " 64 WHITESPACE@[67; 68) " "
65 DOTDOT@[68; 70) ".." 65 DOT2@[68; 70) ".."
66 WHITESPACE@[70; 71) " " 66 WHITESPACE@[70; 71) " "
67 R_CURLY@[71; 72) "}" 67 R_CURLY@[71; 72) "}"
68 WHITESPACE@[72; 73) " " 68 WHITESPACE@[72; 73) " "
@@ -71,7 +71,7 @@ SOURCE_FILE@[0; 103)
71 TUPLE_EXPR@[75; 77) 71 TUPLE_EXPR@[75; 77)
72 L_PAREN@[75; 76) "(" 72 L_PAREN@[75; 76) "("
73 R_PAREN@[76; 77) ")" 73 R_PAREN@[76; 77) ")"
74 SEMI@[77; 78) ";" 74 SEMICOLON@[77; 78) ";"
75 WHITESPACE@[78; 83) "\n " 75 WHITESPACE@[78; 83) "\n "
76 LET_STMT@[83; 100) 76 LET_STMT@[83; 100)
77 LET_KW@[83; 86) "let" 77 LET_KW@[83; 86) "let"
@@ -83,7 +83,7 @@ SOURCE_FILE@[0; 103)
83 IDENT@[87; 90) "Bar" 83 IDENT@[87; 90) "Bar"
84 L_PAREN@[90; 91) "(" 84 L_PAREN@[90; 91) "("
85 DOT_DOT_PAT@[91; 93) 85 DOT_DOT_PAT@[91; 93)
86 DOTDOT@[91; 93) ".." 86 DOT2@[91; 93) ".."
87 R_PAREN@[93; 94) ")" 87 R_PAREN@[93; 94) ")"
88 WHITESPACE@[94; 95) " " 88 WHITESPACE@[94; 95) " "
89 EQ@[95; 96) "=" 89 EQ@[95; 96) "="
@@ -91,7 +91,7 @@ SOURCE_FILE@[0; 103)
91 TUPLE_EXPR@[97; 99) 91 TUPLE_EXPR@[97; 99)
92 L_PAREN@[97; 98) "(" 92 L_PAREN@[97; 98) "("
93 R_PAREN@[98; 99) ")" 93 R_PAREN@[98; 99) ")"
94 SEMI@[99; 100) ";" 94 SEMICOLON@[99; 100) ";"
95 WHITESPACE@[100; 101) "\n" 95 WHITESPACE@[100; 101) "\n"
96 R_CURLY@[101; 102) "}" 96 R_CURLY@[101; 102) "}"
97 WHITESPACE@[102; 103) "\n" 97 WHITESPACE@[102; 103) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast
index 2d8872022..cc759310a 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast
@@ -20,7 +20,7 @@ SOURCE_FILE@[0; 26)
20 BLOCK@[20; 22) 20 BLOCK@[20; 22)
21 L_CURLY@[20; 21) "{" 21 L_CURLY@[20; 21) "{"
22 R_CURLY@[21; 22) "}" 22 R_CURLY@[21; 22) "}"
23 SEMI@[22; 23) ";" 23 SEMICOLON@[22; 23) ";"
24 WHITESPACE@[23; 24) "\n" 24 WHITESPACE@[23; 24) "\n"
25 R_CURLY@[24; 25) "}" 25 R_CURLY@[24; 25) "}"
26 WHITESPACE@[25; 26) "\n" 26 WHITESPACE@[25; 26) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast
index 29b268b55..c2fafe472 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast
@@ -22,7 +22,7 @@ SOURCE_FILE@[0; 48)
22 DOT@[16; 17) "." 22 DOT@[16; 17) "."
23 NAME_REF@[17; 20) 23 NAME_REF@[17; 20)
24 IDENT@[17; 20) "foo" 24 IDENT@[17; 20) "foo"
25 SEMI@[20; 21) ";" 25 SEMICOLON@[20; 21) ";"
26 WHITESPACE@[21; 26) "\n " 26 WHITESPACE@[21; 26) "\n "
27 EXPR_STMT@[26; 34) 27 EXPR_STMT@[26; 34)
28 FIELD_EXPR@[26; 33) 28 FIELD_EXPR@[26; 33)
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 48)
38 DOT@[29; 30) "." 38 DOT@[29; 30) "."
39 NAME_REF@[30; 33) 39 NAME_REF@[30; 33)
40 IDENT@[30; 33) "bar" 40 IDENT@[30; 33) "bar"
41 SEMI@[33; 34) ";" 41 SEMICOLON@[33; 34) ";"
42 WHITESPACE@[34; 39) "\n " 42 WHITESPACE@[34; 39) "\n "
43 EXPR_STMT@[39; 45) 43 EXPR_STMT@[39; 45)
44 CALL_EXPR@[39; 44) 44 CALL_EXPR@[39; 44)
@@ -54,7 +54,7 @@ SOURCE_FILE@[0; 48)
54 ARG_LIST@[42; 44) 54 ARG_LIST@[42; 44)
55 L_PAREN@[42; 43) "(" 55 L_PAREN@[42; 43) "("
56 R_PAREN@[43; 44) ")" 56 R_PAREN@[43; 44) ")"
57 SEMI@[44; 45) ";" 57 SEMICOLON@[44; 45) ";"
58 WHITESPACE@[45; 46) "\n" 58 WHITESPACE@[45; 46) "\n"
59 R_CURLY@[46; 47) "}" 59 R_CURLY@[46; 47) "}"
60 WHITESPACE@[47; 48) "\n" 60 WHITESPACE@[47; 48) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast b/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast
index da04dac5c..15d8c736d 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast
@@ -29,5 +29,5 @@ SOURCE_FILE@[0; 31)
29 TUPLE_TYPE@[27; 29) 29 TUPLE_TYPE@[27; 29)
30 L_PAREN@[27; 28) "(" 30 L_PAREN@[27; 28) "("
31 R_PAREN@[28; 29) ")" 31 R_PAREN@[28; 29) ")"
32 SEMI@[29; 30) ";" 32 SEMICOLON@[29; 30) ";"
33 WHITESPACE@[30; 31) "\n" 33 WHITESPACE@[30; 31) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast b/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast
index c05f873d6..a72d56495 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast
@@ -14,7 +14,7 @@ SOURCE_FILE@[0; 36)
14 TUPLE_TYPE@[14; 16) 14 TUPLE_TYPE@[14; 16)
15 L_PAREN@[14; 15) "(" 15 L_PAREN@[14; 15) "("
16 R_PAREN@[15; 16) ")" 16 R_PAREN@[15; 16) ")"
17 SEMI@[16; 17) ";" 17 SEMICOLON@[16; 17) ";"
18 WHITESPACE@[17; 18) "\n" 18 WHITESPACE@[17; 18) "\n"
19 TYPE_ALIAS_DEF@[18; 35) 19 TYPE_ALIAS_DEF@[18; 35)
20 TYPE_KW@[18; 22) "type" 20 TYPE_KW@[18; 22) "type"
@@ -31,5 +31,5 @@ SOURCE_FILE@[0; 36)
31 TUPLE_TYPE@[32; 34) 31 TUPLE_TYPE@[32; 34)
32 L_PAREN@[32; 33) "(" 32 L_PAREN@[32; 33) "("
33 R_PAREN@[33; 34) ")" 33 R_PAREN@[33; 34) ")"
34 SEMI@[34; 35) ";" 34 SEMICOLON@[34; 35) ";"
35 WHITESPACE@[35; 36) "\n" 35 WHITESPACE@[35; 36) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast
index ac53e4fd3..3c98467c7 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast
@@ -8,6 +8,6 @@ SOURCE_FILE@[0; 16)
8 EQ@[11; 12) "=" 8 EQ@[11; 12) "="
9 WHITESPACE@[12; 13) " " 9 WHITESPACE@[12; 13) " "
10 NEVER_TYPE@[13; 14) 10 NEVER_TYPE@[13; 14)
11 EXCL@[13; 14) "!" 11 BANG@[13; 14) "!"
12 SEMI@[14; 15) ";" 12 SEMICOLON@[14; 15) ";"
13 WHITESPACE@[15; 16) "\n" 13 WHITESPACE@[15; 16) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast
index c051c1c86..adaece119 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast
@@ -22,14 +22,14 @@ SOURCE_FILE@[0; 69)
22 EXPR_STMT@[30; 39) 22 EXPR_STMT@[30; 39)
23 CONTINUE_EXPR@[30; 38) 23 CONTINUE_EXPR@[30; 38)
24 CONTINUE_KW@[30; 38) "continue" 24 CONTINUE_KW@[30; 38) "continue"
25 SEMI@[38; 39) ";" 25 SEMICOLON@[38; 39) ";"
26 WHITESPACE@[39; 48) "\n " 26 WHITESPACE@[39; 48) "\n "
27 EXPR_STMT@[48; 60) 27 EXPR_STMT@[48; 60)
28 CONTINUE_EXPR@[48; 59) 28 CONTINUE_EXPR@[48; 59)
29 CONTINUE_KW@[48; 56) "continue" 29 CONTINUE_KW@[48; 56) "continue"
30 WHITESPACE@[56; 57) " " 30 WHITESPACE@[56; 57) " "
31 LIFETIME@[57; 59) "\'l" 31 LIFETIME@[57; 59) "\'l"
32 SEMI@[59; 60) ";" 32 SEMICOLON@[59; 60) ";"
33 WHITESPACE@[60; 65) "\n " 33 WHITESPACE@[60; 65) "\n "
34 R_CURLY@[65; 66) "}" 34 R_CURLY@[65; 66) "}"
35 WHITESPACE@[66; 67) "\n" 35 WHITESPACE@[66; 67) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast
index b4055c9f0..f4c86a05f 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast
@@ -12,10 +12,10 @@ SOURCE_FILE@[0; 19)
12 TUPLE_TYPE@[10; 12) 12 TUPLE_TYPE@[10; 12)
13 L_PAREN@[10; 11) "(" 13 L_PAREN@[10; 11) "("
14 R_PAREN@[11; 12) ")" 14 R_PAREN@[11; 12) ")"
15 SEMI@[12; 13) ";" 15 SEMICOLON@[12; 13) ";"
16 WHITESPACE@[13; 14) " " 16 WHITESPACE@[13; 14) " "
17 LITERAL@[14; 16) 17 LITERAL@[14; 16)
18 INT_NUMBER@[14; 16) "92" 18 INT_NUMBER@[14; 16) "92"
19 R_BRACK@[16; 17) "]" 19 R_BRACK@[16; 17) "]"
20 SEMI@[17; 18) ";" 20 SEMICOLON@[17; 18) ";"
21 WHITESPACE@[18; 19) "\n" 21 WHITESPACE@[18; 19) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast
index 2d71efd86..5a42f360c 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast
@@ -21,16 +21,16 @@ SOURCE_FILE@[0; 44)
21 AMP@[17; 18) "&" 21 AMP@[17; 18) "&"
22 LITERAL@[18; 19) 22 LITERAL@[18; 19)
23 INT_NUMBER@[18; 19) "1" 23 INT_NUMBER@[18; 19) "1"
24 SEMI@[19; 20) ";" 24 SEMICOLON@[19; 20) ";"
25 WHITESPACE@[20; 25) "\n " 25 WHITESPACE@[20; 25) "\n "
26 EXPR_STMT@[25; 32) 26 EXPR_STMT@[25; 32)
27 PREFIX_EXPR@[25; 31) 27 PREFIX_EXPR@[25; 31)
28 EXCL@[25; 26) "!" 28 BANG@[25; 26) "!"
29 PREFIX_EXPR@[26; 31) 29 PREFIX_EXPR@[26; 31)
30 EXCL@[26; 27) "!" 30 BANG@[26; 27) "!"
31 LITERAL@[27; 31) 31 LITERAL@[27; 31)
32 TRUE_KW@[27; 31) "true" 32 TRUE_KW@[27; 31) "true"
33 SEMI@[31; 32) ";" 33 SEMICOLON@[31; 32) ";"
34 WHITESPACE@[32; 37) "\n " 34 WHITESPACE@[32; 37) "\n "
35 EXPR_STMT@[37; 41) 35 EXPR_STMT@[37; 41)
36 PREFIX_EXPR@[37; 40) 36 PREFIX_EXPR@[37; 40)
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 44)
39 MINUS@[38; 39) "-" 39 MINUS@[38; 39) "-"
40 LITERAL@[39; 40) 40 LITERAL@[39; 40)
41 INT_NUMBER@[39; 40) "1" 41 INT_NUMBER@[39; 40) "1"
42 SEMI@[40; 41) ";" 42 SEMICOLON@[40; 41) ";"
43 WHITESPACE@[41; 42) "\n" 43 WHITESPACE@[41; 42) "\n"
44 R_CURLY@[42; 43) "}" 44 R_CURLY@[42; 43) "}"
45 WHITESPACE@[43; 44) "\n" 45 WHITESPACE@[43; 44) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0020_use_star.rast b/crates/ra_syntax/test_data/parser/inline/ok/0020_use_star.rast
index dd2095d90..c1bedb37c 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0020_use_star.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0020_use_star.rast
@@ -4,15 +4,15 @@ SOURCE_FILE@[0; 60)
4 WHITESPACE@[3; 4) " " 4 WHITESPACE@[3; 4) " "
5 USE_TREE@[4; 5) 5 USE_TREE@[4; 5)
6 STAR@[4; 5) "*" 6 STAR@[4; 5) "*"
7 SEMI@[5; 6) ";" 7 SEMICOLON@[5; 6) ";"
8 WHITESPACE@[6; 7) "\n" 8 WHITESPACE@[6; 7) "\n"
9 USE_ITEM@[7; 15) 9 USE_ITEM@[7; 15)
10 USE_KW@[7; 10) "use" 10 USE_KW@[7; 10) "use"
11 WHITESPACE@[10; 11) " " 11 WHITESPACE@[10; 11) " "
12 USE_TREE@[11; 14) 12 USE_TREE@[11; 14)
13 COLONCOLON@[11; 13) "::" 13 COLON2@[11; 13) "::"
14 STAR@[13; 14) "*" 14 STAR@[13; 14) "*"
15 SEMI@[14; 15) ";" 15 SEMICOLON@[14; 15) ";"
16 WHITESPACE@[15; 16) "\n" 16 WHITESPACE@[15; 16) "\n"
17 USE_ITEM@[16; 36) 17 USE_ITEM@[16; 36)
18 USE_KW@[16; 19) "use" 18 USE_KW@[16; 19) "use"
@@ -23,17 +23,17 @@ SOURCE_FILE@[0; 60)
23 PATH_SEGMENT@[20; 24) 23 PATH_SEGMENT@[20; 24)
24 NAME_REF@[20; 24) 24 NAME_REF@[20; 24)
25 IDENT@[20; 24) "some" 25 IDENT@[20; 24) "some"
26 COLONCOLON@[24; 26) "::" 26 COLON2@[24; 26) "::"
27 PATH_SEGMENT@[26; 30) 27 PATH_SEGMENT@[26; 30)
28 NAME_REF@[26; 30) 28 NAME_REF@[26; 30)
29 IDENT@[26; 30) "path" 29 IDENT@[26; 30) "path"
30 COLONCOLON@[30; 32) "::" 30 COLON2@[30; 32) "::"
31 USE_TREE_LIST@[32; 35) 31 USE_TREE_LIST@[32; 35)
32 L_CURLY@[32; 33) "{" 32 L_CURLY@[32; 33) "{"
33 USE_TREE@[33; 34) 33 USE_TREE@[33; 34)
34 STAR@[33; 34) "*" 34 STAR@[33; 34) "*"
35 R_CURLY@[34; 35) "}" 35 R_CURLY@[34; 35) "}"
36 SEMI@[35; 36) ";" 36 SEMICOLON@[35; 36) ";"
37 WHITESPACE@[36; 37) "\n" 37 WHITESPACE@[36; 37) "\n"
38 USE_ITEM@[37; 59) 38 USE_ITEM@[37; 59)
39 USE_KW@[37; 40) "use" 39 USE_KW@[37; 40) "use"
@@ -44,16 +44,16 @@ SOURCE_FILE@[0; 60)
44 PATH_SEGMENT@[41; 45) 44 PATH_SEGMENT@[41; 45)
45 NAME_REF@[41; 45) 45 NAME_REF@[41; 45)
46 IDENT@[41; 45) "some" 46 IDENT@[41; 45) "some"
47 COLONCOLON@[45; 47) "::" 47 COLON2@[45; 47) "::"
48 PATH_SEGMENT@[47; 51) 48 PATH_SEGMENT@[47; 51)
49 NAME_REF@[47; 51) 49 NAME_REF@[47; 51)
50 IDENT@[47; 51) "path" 50 IDENT@[47; 51) "path"
51 COLONCOLON@[51; 53) "::" 51 COLON2@[51; 53) "::"
52 USE_TREE_LIST@[53; 58) 52 USE_TREE_LIST@[53; 58)
53 L_CURLY@[53; 54) "{" 53 L_CURLY@[53; 54) "{"
54 USE_TREE@[54; 57) 54 USE_TREE@[54; 57)
55 COLONCOLON@[54; 56) "::" 55 COLON2@[54; 56) "::"
56 STAR@[56; 57) "*" 56 STAR@[56; 57) "*"
57 R_CURLY@[57; 58) "}" 57 R_CURLY@[57; 58) "}"
58 SEMI@[58; 59) ";" 58 SEMICOLON@[58; 59) ";"
59 WHITESPACE@[59; 60) "\n" 59 WHITESPACE@[59; 60) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast
index b1af67976..767a49ce6 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 89)
24 PATH_SEGMENT@[22; 25) 24 PATH_SEGMENT@[22; 25)
25 NAME_REF@[22; 25) 25 NAME_REF@[22; 25)
26 IDENT@[22; 25) "i32" 26 IDENT@[22; 25) "i32"
27 SEMI@[25; 26) ";" 27 SEMICOLON@[25; 26) ";"
28 WHITESPACE@[26; 31) "\n " 28 WHITESPACE@[26; 31) "\n "
29 CONST_DEF@[31; 49) 29 CONST_DEF@[31; 49)
30 CONST_KW@[31; 36) "const" 30 CONST_KW@[31; 36) "const"
@@ -43,7 +43,7 @@ SOURCE_FILE@[0; 89)
43 WHITESPACE@[45; 46) " " 43 WHITESPACE@[45; 46) " "
44 LITERAL@[46; 48) 44 LITERAL@[46; 48)
45 INT_NUMBER@[46; 48) "92" 45 INT_NUMBER@[46; 48) "92"
46 SEMI@[48; 49) ";" 46 SEMICOLON@[48; 49) ";"
47 WHITESPACE@[49; 54) "\n " 47 WHITESPACE@[49; 54) "\n "
48 FN_DEF@[54; 65) 48 FN_DEF@[54; 65)
49 FN_KW@[54; 56) "fn" 49 FN_KW@[54; 56) "fn"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast b/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast
index 891943f6e..e0fc96d33 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast
@@ -10,7 +10,7 @@ SOURCE_FILE@[0; 81)
10 WHITESPACE@[17; 18) " " 10 WHITESPACE@[17; 18) " "
11 NAME@[18; 19) 11 NAME@[18; 19)
12 IDENT@[18; 19) "S" 12 IDENT@[18; 19) "S"
13 SEMI@[19; 20) ";" 13 SEMICOLON@[19; 20) ";"
14 WHITESPACE@[20; 21) "\n" 14 WHITESPACE@[20; 21) "\n"
15 STRUCT_DEF@[21; 40) 15 STRUCT_DEF@[21; 40)
16 VISIBILITY@[21; 30) 16 VISIBILITY@[21; 30)
@@ -23,7 +23,7 @@ SOURCE_FILE@[0; 81)
23 WHITESPACE@[37; 38) " " 23 WHITESPACE@[37; 38) " "
24 NAME@[38; 39) 24 NAME@[38; 39)
25 IDENT@[38; 39) "S" 25 IDENT@[38; 39) "S"
26 SEMI@[39; 40) ";" 26 SEMICOLON@[39; 40) ";"
27 WHITESPACE@[40; 41) "\n" 27 WHITESPACE@[40; 41) "\n"
28 STRUCT_DEF@[41; 60) 28 STRUCT_DEF@[41; 60)
29 VISIBILITY@[41; 50) 29 VISIBILITY@[41; 50)
@@ -36,7 +36,7 @@ SOURCE_FILE@[0; 81)
36 WHITESPACE@[57; 58) " " 36 WHITESPACE@[57; 58) " "
37 NAME@[58; 59) 37 NAME@[58; 59)
38 IDENT@[58; 59) "S" 38 IDENT@[58; 59) "S"
39 SEMI@[59; 60) ";" 39 SEMICOLON@[59; 60) ";"
40 WHITESPACE@[60; 61) "\n" 40 WHITESPACE@[60; 61) "\n"
41 STRUCT_DEF@[61; 80) 41 STRUCT_DEF@[61; 80)
42 VISIBILITY@[61; 70) 42 VISIBILITY@[61; 70)
@@ -49,5 +49,5 @@ SOURCE_FILE@[0; 81)
49 WHITESPACE@[77; 78) " " 49 WHITESPACE@[77; 78) " "
50 NAME@[78; 79) 50 NAME@[78; 79)
51 IDENT@[78; 79) "S" 51 IDENT@[78; 79) "S"
52 SEMI@[79; 80) ";" 52 SEMICOLON@[79; 80) ";"
53 WHITESPACE@[80; 81) "\n" 53 WHITESPACE@[80; 81) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast
index 0f32aec9e..b7acc3f07 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast
@@ -9,5 +9,5 @@ SOURCE_FILE@[0; 22)
9 WHITESPACE@[18; 19) " " 9 WHITESPACE@[18; 19) " "
10 PLACEHOLDER_TYPE@[19; 20) 10 PLACEHOLDER_TYPE@[19; 20)
11 UNDERSCORE@[19; 20) "_" 11 UNDERSCORE@[19; 20) "_"
12 SEMI@[20; 21) ";" 12 SEMICOLON@[20; 21) ";"
13 WHITESPACE@[21; 22) "\n" 13 WHITESPACE@[21; 22) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast
index 48aaeaf07..430e4a999 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 39)
28 COMMA@[25; 26) "," 28 COMMA@[25; 26) ","
29 WHITESPACE@[26; 27) " " 29 WHITESPACE@[26; 27) " "
30 DOT_DOT_PAT@[27; 29) 30 DOT_DOT_PAT@[27; 29)
31 DOTDOT@[27; 29) ".." 31 DOT2@[27; 29) ".."
32 R_BRACK@[29; 30) "]" 32 R_BRACK@[29; 30) "]"
33 WHITESPACE@[30; 31) " " 33 WHITESPACE@[30; 31) " "
34 EQ@[31; 32) "=" 34 EQ@[31; 32) "="
@@ -36,7 +36,7 @@ SOURCE_FILE@[0; 39)
36 ARRAY_EXPR@[33; 35) 36 ARRAY_EXPR@[33; 35)
37 L_BRACK@[33; 34) "[" 37 L_BRACK@[33; 34) "["
38 R_BRACK@[34; 35) "]" 38 R_BRACK@[34; 35) "]"
39 SEMI@[35; 36) ";" 39 SEMICOLON@[35; 36) ";"
40 WHITESPACE@[36; 37) "\n" 40 WHITESPACE@[36; 37) "\n"
41 R_CURLY@[37; 38) "}" 41 R_CURLY@[37; 38) "}"
42 WHITESPACE@[38; 39) "\n" 42 WHITESPACE@[38; 39) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast
index b3a24281e..4eee1e7f1 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast
@@ -13,5 +13,5 @@ SOURCE_FILE@[0; 15)
13 L_PAREN@[10; 11) "(" 13 L_PAREN@[10; 11) "("
14 R_PAREN@[11; 12) ")" 14 R_PAREN@[11; 12) ")"
15 R_BRACK@[12; 13) "]" 15 R_BRACK@[12; 13) "]"
16 SEMI@[13; 14) ";" 16 SEMICOLON@[13; 14) ";"
17 WHITESPACE@[14; 15) "\n" 17 WHITESPACE@[14; 15) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast b/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast
index 666386d31..d8d82dacc 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 97)
28 TUPLE_EXPR@[25; 27) 28 TUPLE_EXPR@[25; 27)
29 L_PAREN@[25; 26) "(" 29 L_PAREN@[25; 26) "("
30 R_PAREN@[26; 27) ")" 30 R_PAREN@[26; 27) ")"
31 SEMI@[27; 28) ";" 31 SEMICOLON@[27; 28) ";"
32 WHITESPACE@[28; 33) "\n " 32 WHITESPACE@[28; 33) "\n "
33 LET_STMT@[33; 47) 33 LET_STMT@[33; 47)
34 LET_KW@[33; 36) "let" 34 LET_KW@[33; 36) "let"
@@ -48,7 +48,7 @@ SOURCE_FILE@[0; 97)
48 TUPLE_EXPR@[44; 46) 48 TUPLE_EXPR@[44; 46)
49 L_PAREN@[44; 45) "(" 49 L_PAREN@[44; 45) "("
50 R_PAREN@[45; 46) ")" 50 R_PAREN@[45; 46) ")"
51 SEMI@[46; 47) ";" 51 SEMICOLON@[46; 47) ";"
52 WHITESPACE@[47; 52) "\n " 52 WHITESPACE@[47; 52) "\n "
53 LET_STMT@[52; 67) 53 LET_STMT@[52; 67)
54 LET_KW@[52; 55) "let" 54 LET_KW@[52; 55) "let"
@@ -69,7 +69,7 @@ SOURCE_FILE@[0; 97)
69 TUPLE_EXPR@[64; 66) 69 TUPLE_EXPR@[64; 66)
70 L_PAREN@[64; 65) "(" 70 L_PAREN@[64; 65) "("
71 R_PAREN@[65; 66) ")" 71 R_PAREN@[65; 66) ")"
72 SEMI@[66; 67) ";" 72 SEMICOLON@[66; 67) ";"
73 WHITESPACE@[67; 72) "\n " 73 WHITESPACE@[67; 72) "\n "
74 LET_STMT@[72; 94) 74 LET_STMT@[72; 94)
75 LET_KW@[72; 75) "let" 75 LET_KW@[72; 75) "let"
@@ -85,7 +85,7 @@ SOURCE_FILE@[0; 97)
85 COMMA@[79; 80) "," 85 COMMA@[79; 80) ","
86 WHITESPACE@[80; 81) " " 86 WHITESPACE@[80; 81) " "
87 DOT_DOT_PAT@[81; 83) 87 DOT_DOT_PAT@[81; 83)
88 DOTDOT@[81; 83) ".." 88 DOT2@[81; 83) ".."
89 WHITESPACE@[83; 84) " " 89 WHITESPACE@[83; 84) " "
90 COMMA@[84; 85) "," 90 COMMA@[84; 85) ","
91 WHITESPACE@[85; 86) " " 91 WHITESPACE@[85; 86) " "
@@ -99,7 +99,7 @@ SOURCE_FILE@[0; 97)
99 TUPLE_EXPR@[91; 93) 99 TUPLE_EXPR@[91; 93)
100 L_PAREN@[91; 92) "(" 100 L_PAREN@[91; 92) "("
101 R_PAREN@[92; 93) ")" 101 R_PAREN@[92; 93) ")"
102 SEMI@[93; 94) ";" 102 SEMICOLON@[93; 94) ";"
103 WHITESPACE@[94; 95) "\n" 103 WHITESPACE@[94; 95) "\n"
104 R_CURLY@[95; 96) "}" 104 R_CURLY@[95; 96) "}"
105 WHITESPACE@[96; 97) "\n" 105 WHITESPACE@[96; 97) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast
index 0f1a367f7..ac6ab31f2 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast
@@ -26,7 +26,7 @@ SOURCE_FILE@[0; 52)
26 TUPLE_EXPR@[25; 27) 26 TUPLE_EXPR@[25; 27)
27 L_PAREN@[25; 26) "(" 27 L_PAREN@[25; 26) "("
28 R_PAREN@[26; 27) ")" 28 R_PAREN@[26; 27) ")"
29 SEMI@[27; 28) ";" 29 SEMICOLON@[27; 28) ";"
30 WHITESPACE@[28; 33) "\n " 30 WHITESPACE@[28; 33) "\n "
31 LET_STMT@[33; 49) 31 LET_STMT@[33; 49)
32 LET_KW@[33; 36) "let" 32 LET_KW@[33; 36) "let"
@@ -44,7 +44,7 @@ SOURCE_FILE@[0; 52)
44 TUPLE_EXPR@[46; 48) 44 TUPLE_EXPR@[46; 48)
45 L_PAREN@[46; 47) "(" 45 L_PAREN@[46; 47) "("
46 R_PAREN@[47; 48) ")" 46 R_PAREN@[47; 48) ")"
47 SEMI@[48; 49) ";" 47 SEMICOLON@[48; 49) ";"
48 WHITESPACE@[49; 50) "\n" 48 WHITESPACE@[49; 50) "\n"
49 R_CURLY@[50; 51) "}" 49 R_CURLY@[50; 51) "}"
50 WHITESPACE@[51; 52) "\n" 50 WHITESPACE@[51; 52) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
index f07027fa7..3371cab82 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
@@ -39,5 +39,5 @@ SOURCE_FILE@[0; 43)
39 WHITESPACE@[38; 39) " " 39 WHITESPACE@[38; 39) " "
40 TYPE_BOUND@[39; 41) 40 TYPE_BOUND@[39; 41)
41 LIFETIME@[39; 41) "\'a" 41 LIFETIME@[39; 41) "\'a"
42 SEMI@[41; 42) ";" 42 SEMICOLON@[41; 42) ";"
43 WHITESPACE@[42; 43) "\n" 43 WHITESPACE@[42; 43) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast
index b17a2c257..e9ca214bb 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 89)
24 PATH_SEGMENT@[21; 24) 24 PATH_SEGMENT@[21; 24)
25 NAME_REF@[21; 24) 25 NAME_REF@[21; 24)
26 IDENT@[21; 24) "i32" 26 IDENT@[21; 24) "i32"
27 SEMI@[24; 25) ";" 27 SEMICOLON@[24; 25) ";"
28 WHITESPACE@[25; 30) "\n " 28 WHITESPACE@[25; 30) "\n "
29 EXPR_STMT@[30; 43) 29 EXPR_STMT@[30; 43)
30 BIN_EXPR@[30; 42) 30 BIN_EXPR@[30; 42)
@@ -44,7 +44,7 @@ SOURCE_FILE@[0; 89)
44 WHITESPACE@[40; 41) " " 44 WHITESPACE@[40; 41) " "
45 LITERAL@[41; 42) 45 LITERAL@[41; 42)
46 INT_NUMBER@[41; 42) "1" 46 INT_NUMBER@[41; 42) "1"
47 SEMI@[42; 43) ";" 47 SEMICOLON@[42; 43) ";"
48 WHITESPACE@[43; 48) "\n " 48 WHITESPACE@[43; 48) "\n "
49 EXPR_STMT@[48; 62) 49 EXPR_STMT@[48; 62)
50 BIN_EXPR@[48; 61) 50 BIN_EXPR@[48; 61)
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 89)
64 WHITESPACE@[59; 60) " " 64 WHITESPACE@[59; 60) " "
65 LITERAL@[60; 61) 65 LITERAL@[60; 61)
66 INT_NUMBER@[60; 61) "1" 66 INT_NUMBER@[60; 61) "1"
67 SEMI@[61; 62) ";" 67 SEMICOLON@[61; 62) ";"
68 WHITESPACE@[62; 67) "\n " 68 WHITESPACE@[62; 67) "\n "
69 EXPR_STMT@[67; 86) 69 EXPR_STMT@[67; 86)
70 BIN_EXPR@[67; 85) 70 BIN_EXPR@[67; 85)
@@ -84,7 +84,7 @@ SOURCE_FILE@[0; 89)
84 WHITESPACE@[80; 81) " " 84 WHITESPACE@[80; 81) " "
85 LITERAL@[81; 85) 85 LITERAL@[81; 85)
86 INT_NUMBER@[81; 85) "0x37" 86 INT_NUMBER@[81; 85) "0x37"
87 SEMI@[85; 86) ";" 87 SEMICOLON@[85; 86) ";"
88 WHITESPACE@[86; 87) "\n" 88 WHITESPACE@[86; 87) "\n"
89 R_CURLY@[87; 88) "}" 89 R_CURLY@[87; 88) "}"
90 WHITESPACE@[88; 89) "\n" 90 WHITESPACE@[88; 89) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast
index a6e14a114..aaef408cc 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 93)
24 BLOCK@[26; 28) 24 BLOCK@[26; 28)
25 L_CURLY@[26; 27) "{" 25 L_CURLY@[26; 27) "{"
26 R_CURLY@[27; 28) "}" 26 R_CURLY@[27; 28) "}"
27 SEMI@[28; 29) ";" 27 SEMICOLON@[28; 29) ";"
28 WHITESPACE@[29; 34) "\n " 28 WHITESPACE@[29; 34) "\n "
29 EXPR_STMT@[34; 67) 29 EXPR_STMT@[34; 67)
30 WHILE_EXPR@[34; 66) 30 WHILE_EXPR@[34; 66)
@@ -63,7 +63,7 @@ SOURCE_FILE@[0; 93)
63 BLOCK@[64; 66) 63 BLOCK@[64; 66)
64 L_CURLY@[64; 65) "{" 64 L_CURLY@[64; 65) "{"
65 R_CURLY@[65; 66) "}" 65 R_CURLY@[65; 66) "}"
66 SEMI@[66; 67) ";" 66 SEMICOLON@[66; 67) ";"
67 WHITESPACE@[67; 72) "\n " 67 WHITESPACE@[67; 72) "\n "
68 EXPR_STMT@[72; 90) 68 EXPR_STMT@[72; 90)
69 WHILE_EXPR@[72; 89) 69 WHILE_EXPR@[72; 89)
@@ -83,7 +83,7 @@ SOURCE_FILE@[0; 93)
83 BLOCK@[87; 89) 83 BLOCK@[87; 89)
84 L_CURLY@[87; 88) "{" 84 L_CURLY@[87; 88) "{"
85 R_CURLY@[88; 89) "}" 85 R_CURLY@[88; 89) "}"
86 SEMI@[89; 90) ";" 86 SEMICOLON@[89; 90) ";"
87 WHITESPACE@[90; 91) "\n" 87 WHITESPACE@[90; 91) "\n"
88 R_CURLY@[91; 92) "}" 88 R_CURLY@[91; 92) "}"
89 WHITESPACE@[92; 93) "\n" 89 WHITESPACE@[92; 93) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast
index 4c17f0db8..bad769850 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 113)
12 PARAM_LIST@[11; 13) 12 PARAM_LIST@[11; 13)
13 L_PAREN@[11; 12) "(" 13 L_PAREN@[11; 12) "("
14 R_PAREN@[12; 13) ")" 14 R_PAREN@[12; 13) ")"
15 SEMI@[13; 14) ";" 15 SEMICOLON@[13; 14) ";"
16 WHITESPACE@[14; 15) "\n" 16 WHITESPACE@[14; 15) "\n"
17 TYPE_ALIAS_DEF@[15; 36) 17 TYPE_ALIAS_DEF@[15; 36)
18 TYPE_KW@[15; 19) "type" 18 TYPE_KW@[15; 19) "type"
@@ -29,7 +29,7 @@ SOURCE_FILE@[0; 113)
29 PARAM_LIST@[33; 35) 29 PARAM_LIST@[33; 35)
30 L_PAREN@[33; 34) "(" 30 L_PAREN@[33; 34) "("
31 R_PAREN@[34; 35) ")" 31 R_PAREN@[34; 35) ")"
32 SEMI@[35; 36) ";" 32 SEMICOLON@[35; 36) ";"
33 WHITESPACE@[36; 37) "\n" 33 WHITESPACE@[36; 37) "\n"
34 TYPE_ALIAS_DEF@[37; 69) 34 TYPE_ALIAS_DEF@[37; 69)
35 TYPE_KW@[37; 41) "type" 35 TYPE_KW@[37; 41) "type"
@@ -51,7 +51,7 @@ SOURCE_FILE@[0; 113)
51 PARAM_LIST@[66; 68) 51 PARAM_LIST@[66; 68)
52 L_PAREN@[66; 67) "(" 52 L_PAREN@[66; 67) "("
53 R_PAREN@[67; 68) ")" 53 R_PAREN@[67; 68) ")"
54 SEMI@[68; 69) ";" 54 SEMICOLON@[68; 69) ";"
55 WHITESPACE@[69; 70) "\n" 55 WHITESPACE@[69; 70) "\n"
56 TYPE_ALIAS_DEF@[70; 112) 56 TYPE_ALIAS_DEF@[70; 112)
57 TYPE_KW@[70; 74) "type" 57 TYPE_KW@[70; 74) "type"
@@ -82,7 +82,7 @@ SOURCE_FILE@[0; 113)
82 COMMA@[98; 99) "," 82 COMMA@[98; 99) ","
83 WHITESPACE@[99; 100) " " 83 WHITESPACE@[99; 100) " "
84 PARAM@[100; 103) 84 PARAM@[100; 103)
85 DOTDOTDOT@[100; 103) "..." 85 DOT3@[100; 103) "..."
86 WHITESPACE@[103; 104) " " 86 WHITESPACE@[103; 104) " "
87 R_PAREN@[104; 105) ")" 87 R_PAREN@[104; 105) ")"
88 WHITESPACE@[105; 106) " " 88 WHITESPACE@[105; 106) " "
@@ -94,5 +94,5 @@ SOURCE_FILE@[0; 113)
94 PATH_SEGMENT@[109; 111) 94 PATH_SEGMENT@[109; 111)
95 NAME_REF@[109; 111) 95 NAME_REF@[109; 111)
96 IDENT@[109; 111) "u8" 96 IDENT@[109; 111) "u8"
97 SEMI@[111; 112) ";" 97 SEMICOLON@[111; 112) ";"
98 WHITESPACE@[112; 113) "\n" 98 WHITESPACE@[112; 113) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast b/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast
index 7642ea659..e6ee20b9a 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 54)
12 TUPLE_TYPE@[10; 12) 12 TUPLE_TYPE@[10; 12)
13 L_PAREN@[10; 11) "(" 13 L_PAREN@[10; 11) "("
14 R_PAREN@[11; 12) ")" 14 R_PAREN@[11; 12) ")"
15 SEMI@[12; 13) ";" 15 SEMICOLON@[12; 13) ";"
16 WHITESPACE@[13; 14) "\n" 16 WHITESPACE@[13; 14) "\n"
17 TYPE_ALIAS_DEF@[14; 35) 17 TYPE_ALIAS_DEF@[14; 35)
18 TYPE_KW@[14; 18) "type" 18 TYPE_KW@[14; 18) "type"
@@ -29,7 +29,7 @@ SOURCE_FILE@[0; 54)
29 TUPLE_TYPE@[32; 34) 29 TUPLE_TYPE@[32; 34)
30 L_PAREN@[32; 33) "(" 30 L_PAREN@[32; 33) "("
31 R_PAREN@[33; 34) ")" 31 R_PAREN@[33; 34) ")"
32 SEMI@[34; 35) ";" 32 SEMICOLON@[34; 35) ";"
33 WHITESPACE@[35; 36) "\n" 33 WHITESPACE@[35; 36) "\n"
34 TYPE_ALIAS_DEF@[36; 53) 34 TYPE_ALIAS_DEF@[36; 53)
35 TYPE_KW@[36; 40) "type" 35 TYPE_KW@[36; 40) "type"
@@ -46,5 +46,5 @@ SOURCE_FILE@[0; 54)
46 TUPLE_TYPE@[50; 52) 46 TUPLE_TYPE@[50; 52)
47 L_PAREN@[50; 51) "(" 47 L_PAREN@[50; 51) "("
48 R_PAREN@[51; 52) ")" 48 R_PAREN@[51; 52) ")"
49 SEMI@[52; 53) ";" 49 SEMICOLON@[52; 53) ";"
50 WHITESPACE@[53; 54) "\n" 50 WHITESPACE@[53; 54) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast
index 67ffdfd67..4bb95314f 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast
@@ -22,14 +22,14 @@ SOURCE_FILE@[0; 102)
22 EXPR_STMT@[30; 36) 22 EXPR_STMT@[30; 36)
23 BREAK_EXPR@[30; 35) 23 BREAK_EXPR@[30; 35)
24 BREAK_KW@[30; 35) "break" 24 BREAK_KW@[30; 35) "break"
25 SEMI@[35; 36) ";" 25 SEMICOLON@[35; 36) ";"
26 WHITESPACE@[36; 45) "\n " 26 WHITESPACE@[36; 45) "\n "
27 EXPR_STMT@[45; 54) 27 EXPR_STMT@[45; 54)
28 BREAK_EXPR@[45; 53) 28 BREAK_EXPR@[45; 53)
29 BREAK_KW@[45; 50) "break" 29 BREAK_KW@[45; 50) "break"
30 WHITESPACE@[50; 51) " " 30 WHITESPACE@[50; 51) " "
31 LIFETIME@[51; 53) "\'l" 31 LIFETIME@[51; 53) "\'l"
32 SEMI@[53; 54) ";" 32 SEMICOLON@[53; 54) ";"
33 WHITESPACE@[54; 63) "\n " 33 WHITESPACE@[54; 63) "\n "
34 EXPR_STMT@[63; 72) 34 EXPR_STMT@[63; 72)
35 BREAK_EXPR@[63; 71) 35 BREAK_EXPR@[63; 71)
@@ -37,7 +37,7 @@ SOURCE_FILE@[0; 102)
37 WHITESPACE@[68; 69) " " 37 WHITESPACE@[68; 69) " "
38 LITERAL@[69; 71) 38 LITERAL@[69; 71)
39 INT_NUMBER@[69; 71) "92" 39 INT_NUMBER@[69; 71) "92"
40 SEMI@[71; 72) ";" 40 SEMICOLON@[71; 72) ";"
41 WHITESPACE@[72; 81) "\n " 41 WHITESPACE@[72; 81) "\n "
42 EXPR_STMT@[81; 93) 42 EXPR_STMT@[81; 93)
43 BREAK_EXPR@[81; 92) 43 BREAK_EXPR@[81; 92)
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 102)
47 WHITESPACE@[89; 90) " " 47 WHITESPACE@[89; 90) " "
48 LITERAL@[90; 92) 48 LITERAL@[90; 92)
49 INT_NUMBER@[90; 92) "92" 49 INT_NUMBER@[90; 92) "92"
50 SEMI@[92; 93) ";" 50 SEMICOLON@[92; 93) ";"
51 WHITESPACE@[93; 98) "\n " 51 WHITESPACE@[93; 98) "\n "
52 R_CURLY@[98; 99) "}" 52 R_CURLY@[98; 99) "}"
53 WHITESPACE@[99; 100) "\n" 53 WHITESPACE@[99; 100) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast b/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast
index 6e226de4b..1cd7a443f 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast
@@ -26,11 +26,11 @@ SOURCE_FILE@[0; 71)
26 NAME_REF@[15; 16) 26 NAME_REF@[15; 16)
27 IDENT@[15; 16) "B" 27 IDENT@[15; 16) "B"
28 R_ANGLE@[16; 17) ">" 28 R_ANGLE@[16; 17) ">"
29 COLONCOLON@[17; 19) "::" 29 COLON2@[17; 19) "::"
30 PATH_SEGMENT@[19; 25) 30 PATH_SEGMENT@[19; 25)
31 NAME_REF@[19; 25) 31 NAME_REF@[19; 25)
32 IDENT@[19; 25) "Output" 32 IDENT@[19; 25) "Output"
33 SEMI@[25; 26) ";" 33 SEMICOLON@[25; 26) ";"
34 WHITESPACE@[26; 27) "\n" 34 WHITESPACE@[26; 27) "\n"
35 FN_DEF@[27; 70) 35 FN_DEF@[27; 70)
36 FN_KW@[27; 29) "fn" 36 FN_KW@[27; 29) "fn"
@@ -66,14 +66,14 @@ SOURCE_FILE@[0; 71)
66 NAME_REF@[48; 55) 66 NAME_REF@[48; 55)
67 IDENT@[48; 55) "Default" 67 IDENT@[48; 55) "Default"
68 R_ANGLE@[55; 56) ">" 68 R_ANGLE@[55; 56) ">"
69 COLONCOLON@[56; 58) "::" 69 COLON2@[56; 58) "::"
70 PATH_SEGMENT@[58; 65) 70 PATH_SEGMENT@[58; 65)
71 NAME_REF@[58; 65) 71 NAME_REF@[58; 65)
72 IDENT@[58; 65) "default" 72 IDENT@[58; 65) "default"
73 ARG_LIST@[65; 67) 73 ARG_LIST@[65; 67)
74 L_PAREN@[65; 66) "(" 74 L_PAREN@[65; 66) "("
75 R_PAREN@[66; 67) ")" 75 R_PAREN@[66; 67) ")"
76 SEMI@[67; 68) ";" 76 SEMICOLON@[67; 68) ";"
77 WHITESPACE@[68; 69) " " 77 WHITESPACE@[68; 69) " "
78 R_CURLY@[69; 70) "}" 78 R_CURLY@[69; 70) "}"
79 WHITESPACE@[70; 71) "\n" 79 WHITESPACE@[70; 71) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast
index 042cee879..f5db5a9e6 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast
@@ -21,9 +21,9 @@ SOURCE_FILE@[0; 21)
21 IDENT@[11; 13) "xs" 21 IDENT@[11; 13) "xs"
22 L_BRACK@[13; 14) "[" 22 L_BRACK@[13; 14) "["
23 RANGE_EXPR@[14; 16) 23 RANGE_EXPR@[14; 16)
24 DOTDOT@[14; 16) ".." 24 DOT2@[14; 16) ".."
25 R_BRACK@[16; 17) "]" 25 R_BRACK@[16; 17) "]"
26 SEMI@[17; 18) ";" 26 SEMICOLON@[17; 18) ";"
27 WHITESPACE@[18; 19) " " 27 WHITESPACE@[18; 19) " "
28 R_CURLY@[19; 20) "}" 28 R_CURLY@[19; 20) "}"
29 WHITESPACE@[20; 21) "\n" 29 WHITESPACE@[20; 21) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast
index 025faf5ca..2d9db61b3 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast
@@ -51,5 +51,5 @@ SOURCE_FILE@[0; 46)
51 NAME_REF@[40; 43) 51 NAME_REF@[40; 43)
52 IDENT@[40; 43) "u64" 52 IDENT@[40; 43) "u64"
53 R_ANGLE@[43; 44) ">" 53 R_ANGLE@[43; 44) ">"
54 SEMI@[44; 45) ";" 54 SEMICOLON@[44; 45) ";"
55 WHITESPACE@[45; 46) "\n" 55 WHITESPACE@[45; 46) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast b/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast
index d180fcf20..4c175e210 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast
@@ -59,5 +59,5 @@ SOURCE_FILE@[0; 71)
59 NAME_REF@[65; 68) 59 NAME_REF@[65; 68)
60 IDENT@[65; 68) "u32" 60 IDENT@[65; 68) "u32"
61 R_PAREN@[68; 69) ")" 61 R_PAREN@[68; 69) ")"
62 SEMI@[69; 70) ";" 62 SEMICOLON@[69; 70) ";"
63 WHITESPACE@[70; 71) "\n" 63 WHITESPACE@[70; 71) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast
index e8003bf91..f9e677a03 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast
@@ -29,7 +29,7 @@ SOURCE_FILE@[0; 118)
29 ARG_LIST@[24; 26) 29 ARG_LIST@[24; 26)
30 L_PAREN@[24; 25) "(" 30 L_PAREN@[24; 25) "("
31 R_PAREN@[25; 26) ")" 31 R_PAREN@[25; 26) ")"
32 SEMI@[26; 27) ";" 32 SEMICOLON@[26; 27) ";"
33 WHITESPACE@[27; 32) "\n " 33 WHITESPACE@[27; 32) "\n "
34 LET_STMT@[32; 54) 34 LET_STMT@[32; 54)
35 LET_KW@[32; 35) "let" 35 LET_KW@[32; 35) "let"
@@ -65,7 +65,7 @@ SOURCE_FILE@[0; 118)
65 INT_NUMBER@[50; 51) "2" 65 INT_NUMBER@[50; 51) "2"
66 COMMA@[51; 52) "," 66 COMMA@[51; 52) ","
67 R_PAREN@[52; 53) ")" 67 R_PAREN@[52; 53) ")"
68 SEMI@[53; 54) ";" 68 SEMICOLON@[53; 54) ";"
69 WHITESPACE@[54; 59) "\n " 69 WHITESPACE@[54; 59) "\n "
70 LET_STMT@[59; 84) 70 LET_STMT@[59; 84)
71 LET_KW@[59; 62) "let" 71 LET_KW@[59; 62) "let"
@@ -95,7 +95,7 @@ SOURCE_FILE@[0; 118)
95 NAME_REF@[70; 73) 95 NAME_REF@[70; 73)
96 IDENT@[70; 73) "Foo" 96 IDENT@[70; 73) "Foo"
97 R_ANGLE@[73; 74) ">" 97 R_ANGLE@[73; 74) ">"
98 COLONCOLON@[74; 76) "::" 98 COLON2@[74; 76) "::"
99 PATH_SEGMENT@[76; 80) 99 PATH_SEGMENT@[76; 80)
100 NAME_REF@[76; 80) 100 NAME_REF@[76; 80)
101 IDENT@[76; 80) "func" 101 IDENT@[76; 80) "func"
@@ -103,7 +103,7 @@ SOURCE_FILE@[0; 118)
103 L_PAREN@[80; 81) "(" 103 L_PAREN@[80; 81) "("
104 R_PAREN@[81; 82) ")" 104 R_PAREN@[81; 82) ")"
105 R_PAREN@[82; 83) ")" 105 R_PAREN@[82; 83) ")"
106 SEMI@[83; 84) ";" 106 SEMICOLON@[83; 84) ";"
107 WHITESPACE@[84; 89) "\n " 107 WHITESPACE@[84; 89) "\n "
108 EXPR_STMT@[89; 115) 108 EXPR_STMT@[89; 115)
109 CALL_EXPR@[89; 114) 109 CALL_EXPR@[89; 114)
@@ -134,7 +134,7 @@ SOURCE_FILE@[0; 118)
134 NAME_REF@[99; 104) 134 NAME_REF@[99; 104)
135 IDENT@[99; 104) "Trait" 135 IDENT@[99; 104) "Trait"
136 R_ANGLE@[104; 105) ">" 136 R_ANGLE@[104; 105) ">"
137 COLONCOLON@[105; 107) "::" 137 COLON2@[105; 107) "::"
138 PATH_SEGMENT@[107; 111) 138 PATH_SEGMENT@[107; 111)
139 NAME_REF@[107; 111) 139 NAME_REF@[107; 111)
140 IDENT@[107; 111) "func" 140 IDENT@[107; 111) "func"
@@ -142,7 +142,7 @@ SOURCE_FILE@[0; 118)
142 L_PAREN@[111; 112) "(" 142 L_PAREN@[111; 112) "("
143 R_PAREN@[112; 113) ")" 143 R_PAREN@[112; 113) ")"
144 R_PAREN@[113; 114) ")" 144 R_PAREN@[113; 114) ")"
145 SEMI@[114; 115) ";" 145 SEMICOLON@[114; 115) ";"
146 WHITESPACE@[115; 116) "\n" 146 WHITESPACE@[115; 116) "\n"
147 R_CURLY@[116; 117) "}" 147 R_CURLY@[116; 117) "}"
148 WHITESPACE@[117; 118) "\n" 148 WHITESPACE@[117; 118) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast b/crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast
index 18d8a151f..580f29cfb 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 198)
8 PATH_SEGMENT@[4; 8) 8 PATH_SEGMENT@[4; 8)
9 NAME_REF@[4; 8) 9 NAME_REF@[4; 8)
10 IDENT@[4; 8) "some" 10 IDENT@[4; 8) "some"
11 COLONCOLON@[8; 10) "::" 11 COLON2@[8; 10) "::"
12 PATH_SEGMENT@[10; 14) 12 PATH_SEGMENT@[10; 14)
13 NAME_REF@[10; 14) 13 NAME_REF@[10; 14)
14 IDENT@[10; 14) "path" 14 IDENT@[10; 14) "path"
@@ -18,7 +18,7 @@ SOURCE_FILE@[0; 198)
18 WHITESPACE@[17; 18) " " 18 WHITESPACE@[17; 18) " "
19 NAME@[18; 27) 19 NAME@[18; 27)
20 IDENT@[18; 27) "some_name" 20 IDENT@[18; 27) "some_name"
21 SEMI@[27; 28) ";" 21 SEMICOLON@[27; 28) ";"
22 WHITESPACE@[28; 29) "\n" 22 WHITESPACE@[28; 29) "\n"
23 USE_ITEM@[29; 181) 23 USE_ITEM@[29; 181)
24 USE_KW@[29; 32) "use" 24 USE_KW@[29; 32) "use"
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 198)
28 PATH_SEGMENT@[33; 37) 28 PATH_SEGMENT@[33; 37)
29 NAME_REF@[33; 37) 29 NAME_REF@[33; 37)
30 IDENT@[33; 37) "some" 30 IDENT@[33; 37) "some"
31 COLONCOLON@[37; 39) "::" 31 COLON2@[37; 39) "::"
32 USE_TREE_LIST@[39; 180) 32 USE_TREE_LIST@[39; 180)
33 L_CURLY@[39; 40) "{" 33 L_CURLY@[39; 40) "{"
34 WHITESPACE@[40; 42) "\n " 34 WHITESPACE@[40; 42) "\n "
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 198)
38 PATH_SEGMENT@[42; 47) 38 PATH_SEGMENT@[42; 47)
39 NAME_REF@[42; 47) 39 NAME_REF@[42; 47)
40 IDENT@[42; 47) "other" 40 IDENT@[42; 47) "other"
41 COLONCOLON@[47; 49) "::" 41 COLON2@[47; 49) "::"
42 PATH_SEGMENT@[49; 53) 42 PATH_SEGMENT@[49; 53)
43 NAME_REF@[49; 53) 43 NAME_REF@[49; 53)
44 IDENT@[49; 53) "path" 44 IDENT@[49; 53) "path"
@@ -56,7 +56,7 @@ SOURCE_FILE@[0; 198)
56 PATH_SEGMENT@[75; 84) 56 PATH_SEGMENT@[75; 84)
57 NAME_REF@[75; 84) 57 NAME_REF@[75; 84)
58 IDENT@[75; 84) "different" 58 IDENT@[75; 84) "different"
59 COLONCOLON@[84; 86) "::" 59 COLON2@[84; 86) "::"
60 PATH_SEGMENT@[86; 90) 60 PATH_SEGMENT@[86; 90)
61 NAME_REF@[86; 90) 61 NAME_REF@[86; 90)
62 IDENT@[86; 90) "path" 62 IDENT@[86; 90) "path"
@@ -75,11 +75,11 @@ SOURCE_FILE@[0; 198)
75 PATH_SEGMENT@[111; 114) 75 PATH_SEGMENT@[111; 114)
76 NAME_REF@[111; 114) 76 NAME_REF@[111; 114)
77 IDENT@[111; 114) "yet" 77 IDENT@[111; 114) "yet"
78 COLONCOLON@[114; 116) "::" 78 COLON2@[114; 116) "::"
79 PATH_SEGMENT@[116; 123) 79 PATH_SEGMENT@[116; 123)
80 NAME_REF@[116; 123) 80 NAME_REF@[116; 123)
81 IDENT@[116; 123) "another" 81 IDENT@[116; 123) "another"
82 COLONCOLON@[123; 125) "::" 82 COLON2@[123; 125) "::"
83 PATH_SEGMENT@[125; 129) 83 PATH_SEGMENT@[125; 129)
84 NAME_REF@[125; 129) 84 NAME_REF@[125; 129)
85 IDENT@[125; 129) "path" 85 IDENT@[125; 129) "path"
@@ -95,31 +95,31 @@ SOURCE_FILE@[0; 198)
95 PATH_SEGMENT@[132; 139) 95 PATH_SEGMENT@[132; 139)
96 NAME_REF@[132; 139) 96 NAME_REF@[132; 139)
97 IDENT@[132; 139) "running" 97 IDENT@[132; 139) "running"
98 COLONCOLON@[139; 141) "::" 98 COLON2@[139; 141) "::"
99 PATH_SEGMENT@[141; 144) 99 PATH_SEGMENT@[141; 144)
100 NAME_REF@[141; 144) 100 NAME_REF@[141; 144)
101 IDENT@[141; 144) "out" 101 IDENT@[141; 144) "out"
102 COLONCOLON@[144; 146) "::" 102 COLON2@[144; 146) "::"
103 PATH_SEGMENT@[146; 148) 103 PATH_SEGMENT@[146; 148)
104 NAME_REF@[146; 148) 104 NAME_REF@[146; 148)
105 IDENT@[146; 148) "of" 105 IDENT@[146; 148) "of"
106 COLONCOLON@[148; 150) "::" 106 COLON2@[148; 150) "::"
107 PATH_SEGMENT@[150; 158) 107 PATH_SEGMENT@[150; 158)
108 NAME_REF@[150; 158) 108 NAME_REF@[150; 158)
109 IDENT@[150; 158) "synonyms" 109 IDENT@[150; 158) "synonyms"
110 COLONCOLON@[158; 160) "::" 110 COLON2@[158; 160) "::"
111 PATH_SEGMENT@[160; 164) 111 PATH_SEGMENT@[160; 164)
112 NAME_REF@[160; 164) 112 NAME_REF@[160; 164)
113 IDENT@[160; 164) "for_" 113 IDENT@[160; 164) "for_"
114 COLONCOLON@[164; 166) "::" 114 COLON2@[164; 166) "::"
115 PATH_SEGMENT@[166; 175) 115 PATH_SEGMENT@[166; 175)
116 NAME_REF@[166; 175) 116 NAME_REF@[166; 175)
117 IDENT@[166; 175) "different" 117 IDENT@[166; 175) "different"
118 COLONCOLON@[175; 177) "::" 118 COLON2@[175; 177) "::"
119 STAR@[177; 178) "*" 119 STAR@[177; 178) "*"
120 WHITESPACE@[178; 179) "\n" 120 WHITESPACE@[178; 179) "\n"
121 R_CURLY@[179; 180) "}" 121 R_CURLY@[179; 180) "}"
122 SEMI@[180; 181) ";" 122 SEMICOLON@[180; 181) ";"
123 WHITESPACE@[181; 182) "\n" 123 WHITESPACE@[181; 182) "\n"
124 USE_ITEM@[182; 197) 124 USE_ITEM@[182; 197)
125 USE_KW@[182; 185) "use" 125 USE_KW@[182; 185) "use"
@@ -134,5 +134,5 @@ SOURCE_FILE@[0; 198)
134 AS_KW@[192; 194) "as" 134 AS_KW@[192; 194) "as"
135 WHITESPACE@[194; 195) " " 135 WHITESPACE@[194; 195) " "
136 UNDERSCORE@[195; 196) "_" 136 UNDERSCORE@[195; 196) "_"
137 SEMI@[196; 197) ";" 137 SEMICOLON@[196; 197) ";"
138 WHITESPACE@[197; 198) "\n" 138 WHITESPACE@[197; 198) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast
index c7b4e614d..988b58d82 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast
@@ -16,5 +16,5 @@ SOURCE_FILE@[0; 17)
16 IDENT@[10; 13) "i32" 16 IDENT@[10; 13) "i32"
17 COMMA@[13; 14) "," 17 COMMA@[13; 14) ","
18 R_PAREN@[14; 15) ")" 18 R_PAREN@[14; 15) ")"
19 SEMI@[15; 16) ";" 19 SEMICOLON@[15; 16) ";"
20 WHITESPACE@[16; 17) "\n" 20 WHITESPACE@[16; 17) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast
index 19f961e29..036035f6c 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast
@@ -16,7 +16,7 @@ SOURCE_FILE@[0; 22)
16 PARAM_LIST@[16; 18) 16 PARAM_LIST@[16; 18)
17 L_PAREN@[16; 17) "(" 17 L_PAREN@[16; 17) "("
18 R_PAREN@[17; 18) ")" 18 R_PAREN@[17; 18) ")"
19 SEMI@[18; 19) ";" 19 SEMICOLON@[18; 19) ";"
20 WHITESPACE@[19; 20) " " 20 WHITESPACE@[19; 20) " "
21 R_CURLY@[20; 21) "}" 21 R_CURLY@[20; 21) "}"
22 WHITESPACE@[21; 22) "\n" 22 WHITESPACE@[21; 22) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast
index 6a469f8aa..d9fc5eb8a 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast
@@ -10,5 +10,5 @@ SOURCE_FILE@[0; 13)
10 TUPLE_TYPE@[9; 11) 10 TUPLE_TYPE@[9; 11)
11 L_PAREN@[9; 10) "(" 11 L_PAREN@[9; 10) "("
12 R_PAREN@[10; 11) ")" 12 R_PAREN@[10; 11) ")"
13 SEMI@[11; 12) ";" 13 SEMICOLON@[11; 12) ";"
14 WHITESPACE@[12; 13) "\n" 14 WHITESPACE@[12; 13) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast
index ee55ee219..8647c23bf 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 71)
12 PATH_SEGMENT@[9; 12) 12 PATH_SEGMENT@[9; 12)
13 NAME_REF@[9; 12) 13 NAME_REF@[9; 12)
14 IDENT@[9; 12) "Foo" 14 IDENT@[9; 12) "Foo"
15 SEMI@[12; 13) ";" 15 SEMICOLON@[12; 13) ";"
16 WHITESPACE@[13; 14) "\n" 16 WHITESPACE@[13; 14) "\n"
17 TYPE_ALIAS_DEF@[14; 29) 17 TYPE_ALIAS_DEF@[14; 29)
18 TYPE_KW@[14; 18) "type" 18 TYPE_KW@[14; 18) "type"
@@ -25,10 +25,10 @@ SOURCE_FILE@[0; 71)
25 PATH_TYPE@[23; 28) 25 PATH_TYPE@[23; 28)
26 PATH@[23; 28) 26 PATH@[23; 28)
27 PATH_SEGMENT@[23; 28) 27 PATH_SEGMENT@[23; 28)
28 COLONCOLON@[23; 25) "::" 28 COLON2@[23; 25) "::"
29 NAME_REF@[25; 28) 29 NAME_REF@[25; 28)
30 IDENT@[25; 28) "Foo" 30 IDENT@[25; 28) "Foo"
31 SEMI@[28; 29) ";" 31 SEMICOLON@[28; 29) ";"
32 WHITESPACE@[29; 30) "\n" 32 WHITESPACE@[29; 30) "\n"
33 TYPE_ALIAS_DEF@[30; 49) 33 TYPE_ALIAS_DEF@[30; 49)
34 TYPE_KW@[30; 34) "type" 34 TYPE_KW@[30; 34) "type"
@@ -43,11 +43,11 @@ SOURCE_FILE@[0; 71)
43 PATH@[39; 43) 43 PATH@[39; 43)
44 PATH_SEGMENT@[39; 43) 44 PATH_SEGMENT@[39; 43)
45 SELF_KW@[39; 43) "self" 45 SELF_KW@[39; 43) "self"
46 COLONCOLON@[43; 45) "::" 46 COLON2@[43; 45) "::"
47 PATH_SEGMENT@[45; 48) 47 PATH_SEGMENT@[45; 48)
48 NAME_REF@[45; 48) 48 NAME_REF@[45; 48)
49 IDENT@[45; 48) "Foo" 49 IDENT@[45; 48) "Foo"
50 SEMI@[48; 49) ";" 50 SEMICOLON@[48; 49) ";"
51 WHITESPACE@[49; 50) "\n" 51 WHITESPACE@[49; 50) "\n"
52 TYPE_ALIAS_DEF@[50; 70) 52 TYPE_ALIAS_DEF@[50; 70)
53 TYPE_KW@[50; 54) "type" 53 TYPE_KW@[50; 54) "type"
@@ -62,9 +62,9 @@ SOURCE_FILE@[0; 71)
62 PATH@[59; 64) 62 PATH@[59; 64)
63 PATH_SEGMENT@[59; 64) 63 PATH_SEGMENT@[59; 64)
64 SUPER_KW@[59; 64) "super" 64 SUPER_KW@[59; 64) "super"
65 COLONCOLON@[64; 66) "::" 65 COLON2@[64; 66) "::"
66 PATH_SEGMENT@[66; 69) 66 PATH_SEGMENT@[66; 69)
67 NAME_REF@[66; 69) 67 NAME_REF@[66; 69)
68 IDENT@[66; 69) "Foo" 68 IDENT@[66; 69) "Foo"
69 SEMI@[69; 70) ";" 69 SEMICOLON@[69; 70) ";"
70 WHITESPACE@[70; 71) "\n" 70 WHITESPACE@[70; 71) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast
index f1018fcab..690d8504e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 91)
25 PATH_SEGMENT@[23; 24) 25 PATH_SEGMENT@[23; 24)
26 NAME_REF@[23; 24) 26 NAME_REF@[23; 24)
27 IDENT@[23; 24) "a" 27 IDENT@[23; 24) "a"
28 SEMI@[24; 25) ";" 28 SEMICOLON@[24; 25) ";"
29 WHITESPACE@[25; 30) "\n " 29 WHITESPACE@[25; 30) "\n "
30 LET_STMT@[30; 43) 30 LET_STMT@[30; 43)
31 LET_KW@[30; 33) "let" 31 LET_KW@[30; 33) "let"
@@ -41,11 +41,11 @@ SOURCE_FILE@[0; 91)
41 PATH_SEGMENT@[38; 39) 41 PATH_SEGMENT@[38; 39)
42 NAME_REF@[38; 39) 42 NAME_REF@[38; 39)
43 IDENT@[38; 39) "a" 43 IDENT@[38; 39) "a"
44 COLONCOLON@[39; 41) "::" 44 COLON2@[39; 41) "::"
45 PATH_SEGMENT@[41; 42) 45 PATH_SEGMENT@[41; 42)
46 NAME_REF@[41; 42) 46 NAME_REF@[41; 42)
47 IDENT@[41; 42) "b" 47 IDENT@[41; 42) "b"
48 SEMI@[42; 43) ";" 48 SEMICOLON@[42; 43) ";"
49 WHITESPACE@[43; 48) "\n " 49 WHITESPACE@[43; 48) "\n "
50 LET_STMT@[48; 65) 50 LET_STMT@[48; 65)
51 LET_KW@[48; 51) "let" 51 LET_KW@[48; 51) "let"
@@ -58,11 +58,11 @@ SOURCE_FILE@[0; 91)
58 PATH_EXPR@[56; 64) 58 PATH_EXPR@[56; 64)
59 PATH@[56; 64) 59 PATH@[56; 64)
60 PATH_SEGMENT@[56; 64) 60 PATH_SEGMENT@[56; 64)
61 COLONCOLON@[56; 58) "::" 61 COLON2@[56; 58) "::"
62 NAME_REF@[58; 59) 62 NAME_REF@[58; 59)
63 IDENT@[58; 59) "a" 63 IDENT@[58; 59) "a"
64 TYPE_ARG_LIST@[59; 64) 64 TYPE_ARG_LIST@[59; 64)
65 COLONCOLON@[59; 61) "::" 65 COLON2@[59; 61) "::"
66 L_ANGLE@[61; 62) "<" 66 L_ANGLE@[61; 62) "<"
67 TYPE_ARG@[62; 63) 67 TYPE_ARG@[62; 63)
68 PATH_TYPE@[62; 63) 68 PATH_TYPE@[62; 63)
@@ -71,7 +71,7 @@ SOURCE_FILE@[0; 91)
71 NAME_REF@[62; 63) 71 NAME_REF@[62; 63)
72 IDENT@[62; 63) "b" 72 IDENT@[62; 63) "b"
73 R_ANGLE@[63; 64) ">" 73 R_ANGLE@[63; 64) ">"
74 SEMI@[64; 65) ";" 74 SEMICOLON@[64; 65) ";"
75 WHITESPACE@[65; 70) "\n " 75 WHITESPACE@[65; 70) "\n "
76 LET_STMT@[70; 88) 76 LET_STMT@[70; 88)
77 LET_KW@[70; 73) "let" 77 LET_KW@[70; 73) "let"
@@ -86,11 +86,11 @@ SOURCE_FILE@[0; 91)
86 PATH_SEGMENT@[78; 84) 86 PATH_SEGMENT@[78; 84)
87 NAME_REF@[78; 84) 87 NAME_REF@[78; 84)
88 IDENT@[78; 84) "format" 88 IDENT@[78; 84) "format"
89 EXCL@[84; 85) "!" 89 BANG@[84; 85) "!"
90 TOKEN_TREE@[85; 87) 90 TOKEN_TREE@[85; 87)
91 L_PAREN@[85; 86) "(" 91 L_PAREN@[85; 86) "("
92 R_PAREN@[86; 87) ")" 92 R_PAREN@[86; 87) ")"
93 SEMI@[87; 88) ";" 93 SEMICOLON@[87; 88) ";"
94 WHITESPACE@[88; 89) "\n" 94 WHITESPACE@[88; 89) "\n"
95 R_CURLY@[89; 90) "}" 95 R_CURLY@[89; 90) "}"
96 WHITESPACE@[90; 91) "\n" 96 WHITESPACE@[90; 91) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast b/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast
index 9a9a13370..c6082791a 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast
@@ -63,7 +63,7 @@ SOURCE_FILE@[0; 116)
63 PATH_SEGMENT@[64; 72) 63 PATH_SEGMENT@[64; 72)
64 NAME_REF@[64; 72) 64 NAME_REF@[64; 72)
65 IDENT@[64; 72) "Iterator" 65 IDENT@[64; 72) "Iterator"
66 COLONCOLON@[72; 74) "::" 66 COLON2@[72; 74) "::"
67 PATH_SEGMENT@[74; 78) 67 PATH_SEGMENT@[74; 78)
68 NAME_REF@[74; 78) 68 NAME_REF@[74; 78)
69 IDENT@[74; 78) "Item" 69 IDENT@[74; 78) "Item"
@@ -94,7 +94,7 @@ SOURCE_FILE@[0; 116)
94 NAME_REF@[93; 101) 94 NAME_REF@[93; 101)
95 IDENT@[93; 101) "Iterator" 95 IDENT@[93; 101) "Iterator"
96 R_ANGLE@[101; 102) ">" 96 R_ANGLE@[101; 102) ">"
97 COLONCOLON@[102; 104) "::" 97 COLON2@[102; 104) "::"
98 PATH_SEGMENT@[104; 108) 98 PATH_SEGMENT@[104; 108)
99 NAME_REF@[104; 108) 99 NAME_REF@[104; 108)
100 IDENT@[104; 108) "Item" 100 IDENT@[104; 108) "Item"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast
index 3d659ce10..8d7083e97 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 112)
27 LITERAL@[35; 36) 27 LITERAL@[35; 36)
28 INT_NUMBER@[35; 36) "0" 28 INT_NUMBER@[35; 36) "0"
29 WHITESPACE@[36; 37) " " 29 WHITESPACE@[36; 37) " "
30 DOTDOTDOT@[37; 40) "..." 30 DOT3@[37; 40) "..."
31 WHITESPACE@[40; 41) " " 31 WHITESPACE@[40; 41) " "
32 LITERAL_PAT@[41; 44) 32 LITERAL_PAT@[41; 44)
33 LITERAL@[41; 44) 33 LITERAL@[41; 44)
@@ -46,7 +46,7 @@ SOURCE_FILE@[0; 112)
46 LITERAL@[60; 63) 46 LITERAL@[60; 63)
47 INT_NUMBER@[60; 63) "101" 47 INT_NUMBER@[60; 63) "101"
48 WHITESPACE@[63; 64) " " 48 WHITESPACE@[63; 64) " "
49 DOTDOTEQ@[64; 67) "..=" 49 DOT2EQ@[64; 67) "..="
50 WHITESPACE@[67; 68) " " 50 WHITESPACE@[67; 68) " "
51 LITERAL_PAT@[68; 71) 51 LITERAL_PAT@[68; 71)
52 LITERAL@[68; 71) 52 LITERAL@[68; 71)
@@ -65,7 +65,7 @@ SOURCE_FILE@[0; 112)
65 LITERAL@[87; 90) 65 LITERAL@[87; 90)
66 INT_NUMBER@[87; 90) "200" 66 INT_NUMBER@[87; 90) "200"
67 WHITESPACE@[90; 91) " " 67 WHITESPACE@[90; 91) " "
68 DOTDOT@[91; 93) ".." 68 DOT2@[91; 93) ".."
69 WHITESPACE@[93; 94) " " 69 WHITESPACE@[93; 94) " "
70 LITERAL_PAT@[94; 97) 70 LITERAL_PAT@[94; 97)
71 LITERAL@[94; 97) 71 LITERAL@[94; 97)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0060_extern_crate.rast b/crates/ra_syntax/test_data/parser/inline/ok/0060_extern_crate.rast
index 7667201ba..c6e4ee532 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0060_extern_crate.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0060_extern_crate.rast
@@ -6,5 +6,5 @@ SOURCE_FILE@[0; 18)
6 WHITESPACE@[12; 13) " " 6 WHITESPACE@[12; 13) " "
7 NAME_REF@[13; 16) 7 NAME_REF@[13; 16)
8 IDENT@[13; 16) "foo" 8 IDENT@[13; 16) "foo"
9 SEMI@[16; 17) ";" 9 SEMICOLON@[16; 17) ";"
10 WHITESPACE@[17; 18) "\n" 10 WHITESPACE@[17; 18) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast
index dcf527639..89a611799 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast
@@ -22,7 +22,7 @@ SOURCE_FILE@[0; 112)
22 RECORD_FIELD_LIST@[17; 19) 22 RECORD_FIELD_LIST@[17; 19)
23 L_CURLY@[17; 18) "{" 23 L_CURLY@[17; 18) "{"
24 R_CURLY@[18; 19) "}" 24 R_CURLY@[18; 19) "}"
25 SEMI@[19; 20) ";" 25 SEMICOLON@[19; 20) ";"
26 WHITESPACE@[20; 25) "\n " 26 WHITESPACE@[20; 25) "\n "
27 EXPR_STMT@[25; 41) 27 EXPR_STMT@[25; 41)
28 RECORD_LIT@[25; 40) 28 RECORD_LIT@[25; 40)
@@ -35,8 +35,11 @@ SOURCE_FILE@[0; 112)
35 L_CURLY@[27; 28) "{" 35 L_CURLY@[27; 28) "{"
36 WHITESPACE@[28; 29) " " 36 WHITESPACE@[28; 29) " "
37 RECORD_FIELD@[29; 30) 37 RECORD_FIELD@[29; 30)
38 NAME_REF@[29; 30) 38 PATH_EXPR@[29; 30)
39 IDENT@[29; 30) "x" 39 PATH@[29; 30)
40 PATH_SEGMENT@[29; 30)
41 NAME_REF@[29; 30)
42 IDENT@[29; 30) "x"
40 COMMA@[30; 31) "," 43 COMMA@[30; 31) ","
41 WHITESPACE@[31; 32) " " 44 WHITESPACE@[31; 32) " "
42 RECORD_FIELD@[32; 37) 45 RECORD_FIELD@[32; 37)
@@ -49,7 +52,7 @@ SOURCE_FILE@[0; 112)
49 COMMA@[37; 38) "," 52 COMMA@[37; 38) ","
50 WHITESPACE@[38; 39) " " 53 WHITESPACE@[38; 39) " "
51 R_CURLY@[39; 40) "}" 54 R_CURLY@[39; 40) "}"
52 SEMI@[40; 41) ";" 55 SEMICOLON@[40; 41) ";"
53 WHITESPACE@[41; 46) "\n " 56 WHITESPACE@[41; 46) "\n "
54 EXPR_STMT@[46; 83) 57 EXPR_STMT@[46; 83)
55 RECORD_LIT@[46; 82) 58 RECORD_LIT@[46; 82)
@@ -62,8 +65,11 @@ SOURCE_FILE@[0; 112)
62 L_CURLY@[48; 49) "{" 65 L_CURLY@[48; 49) "{"
63 WHITESPACE@[49; 50) " " 66 WHITESPACE@[49; 50) " "
64 RECORD_FIELD@[50; 51) 67 RECORD_FIELD@[50; 51)
65 NAME_REF@[50; 51) 68 PATH_EXPR@[50; 51)
66 IDENT@[50; 51) "x" 69 PATH@[50; 51)
70 PATH_SEGMENT@[50; 51)
71 NAME_REF@[50; 51)
72 IDENT@[50; 51) "x"
67 COMMA@[51; 52) "," 73 COMMA@[51; 52) ","
68 WHITESPACE@[52; 53) " " 74 WHITESPACE@[52; 53) " "
69 RECORD_FIELD@[53; 58) 75 RECORD_FIELD@[53; 58)
@@ -75,7 +81,7 @@ SOURCE_FILE@[0; 112)
75 INT_NUMBER@[56; 58) "32" 81 INT_NUMBER@[56; 58) "32"
76 COMMA@[58; 59) "," 82 COMMA@[58; 59) ","
77 WHITESPACE@[59; 60) " " 83 WHITESPACE@[59; 60) " "
78 DOTDOT@[60; 62) ".." 84 DOT2@[60; 62) ".."
79 CALL_EXPR@[62; 80) 85 CALL_EXPR@[62; 80)
80 PATH_EXPR@[62; 78) 86 PATH_EXPR@[62; 78)
81 PATH@[62; 78) 87 PATH@[62; 78)
@@ -83,7 +89,7 @@ SOURCE_FILE@[0; 112)
83 PATH_SEGMENT@[62; 69) 89 PATH_SEGMENT@[62; 69)
84 NAME_REF@[62; 69) 90 NAME_REF@[62; 69)
85 IDENT@[62; 69) "Default" 91 IDENT@[62; 69) "Default"
86 COLONCOLON@[69; 71) "::" 92 COLON2@[69; 71) "::"
87 PATH_SEGMENT@[71; 78) 93 PATH_SEGMENT@[71; 78)
88 NAME_REF@[71; 78) 94 NAME_REF@[71; 78)
89 IDENT@[71; 78) "default" 95 IDENT@[71; 78) "default"
@@ -92,7 +98,7 @@ SOURCE_FILE@[0; 112)
92 R_PAREN@[79; 80) ")" 98 R_PAREN@[79; 80) ")"
93 WHITESPACE@[80; 81) " " 99 WHITESPACE@[80; 81) " "
94 R_CURLY@[81; 82) "}" 100 R_CURLY@[81; 82) "}"
95 SEMI@[82; 83) ";" 101 SEMICOLON@[82; 83) ";"
96 WHITESPACE@[83; 88) "\n " 102 WHITESPACE@[83; 88) "\n "
97 EXPR_STMT@[88; 109) 103 EXPR_STMT@[88; 109)
98 RECORD_LIT@[88; 108) 104 RECORD_LIT@[88; 108)
@@ -113,7 +119,7 @@ SOURCE_FILE@[0; 112)
113 INT_NUMBER@[105; 106) "1" 119 INT_NUMBER@[105; 106) "1"
114 WHITESPACE@[106; 107) " " 120 WHITESPACE@[106; 107) " "
115 R_CURLY@[107; 108) "}" 121 R_CURLY@[107; 108) "}"
116 SEMI@[108; 109) ";" 122 SEMICOLON@[108; 109) ";"
117 WHITESPACE@[109; 110) "\n" 123 WHITESPACE@[109; 110) "\n"
118 R_CURLY@[110; 111) "}" 124 R_CURLY@[110; 111) "}"
119 WHITESPACE@[111; 112) "\n" 125 WHITESPACE@[111; 112) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast b/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast
index 6b528c252..99e0a0bec 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast
@@ -18,7 +18,7 @@ SOURCE_FILE@[0; 70)
18 PATH_SEGMENT@[12; 23) 18 PATH_SEGMENT@[12; 23)
19 NAME_REF@[12; 23) 19 NAME_REF@[12; 23)
20 IDENT@[12; 23) "macro_rules" 20 IDENT@[12; 23) "macro_rules"
21 EXCL@[23; 24) "!" 21 BANG@[23; 24) "!"
22 WHITESPACE@[24; 25) " " 22 WHITESPACE@[24; 25) " "
23 NAME@[25; 28) 23 NAME@[25; 28)
24 IDENT@[25; 28) "foo" 24 IDENT@[25; 28) "foo"
@@ -33,26 +33,26 @@ SOURCE_FILE@[0; 70)
33 PATH_SEGMENT@[32; 35) 33 PATH_SEGMENT@[32; 35)
34 NAME_REF@[32; 35) 34 NAME_REF@[32; 35)
35 IDENT@[32; 35) "foo" 35 IDENT@[32; 35) "foo"
36 COLONCOLON@[35; 37) "::" 36 COLON2@[35; 37) "::"
37 PATH_SEGMENT@[37; 40) 37 PATH_SEGMENT@[37; 40)
38 NAME_REF@[37; 40) 38 NAME_REF@[37; 40)
39 IDENT@[37; 40) "bar" 39 IDENT@[37; 40) "bar"
40 EXCL@[40; 41) "!" 40 BANG@[40; 41) "!"
41 TOKEN_TREE@[41; 43) 41 TOKEN_TREE@[41; 43)
42 L_PAREN@[41; 42) "(" 42 L_PAREN@[41; 42) "("
43 R_PAREN@[42; 43) ")" 43 R_PAREN@[42; 43) ")"
44 SEMI@[43; 44) ";" 44 SEMICOLON@[43; 44) ";"
45 WHITESPACE@[44; 45) "\n" 45 WHITESPACE@[44; 45) "\n"
46 MACRO_CALL@[45; 59) 46 MACRO_CALL@[45; 59)
47 PATH@[45; 55) 47 PATH@[45; 55)
48 PATH@[45; 50) 48 PATH@[45; 50)
49 PATH_SEGMENT@[45; 50) 49 PATH_SEGMENT@[45; 50)
50 SUPER_KW@[45; 50) "super" 50 SUPER_KW@[45; 50) "super"
51 COLONCOLON@[50; 52) "::" 51 COLON2@[50; 52) "::"
52 PATH_SEGMENT@[52; 55) 52 PATH_SEGMENT@[52; 55)
53 NAME_REF@[52; 55) 53 NAME_REF@[52; 55)
54 IDENT@[52; 55) "baz" 54 IDENT@[52; 55) "baz"
55 EXCL@[55; 56) "!" 55 BANG@[55; 56) "!"
56 WHITESPACE@[56; 57) " " 56 WHITESPACE@[56; 57) " "
57 TOKEN_TREE@[57; 59) 57 TOKEN_TREE@[57; 59)
58 L_CURLY@[57; 58) "{" 58 L_CURLY@[57; 58) "{"
@@ -63,5 +63,5 @@ SOURCE_FILE@[0; 70)
63 WHITESPACE@[66; 67) " " 63 WHITESPACE@[66; 67) " "
64 NAME@[67; 68) 64 NAME@[67; 68)
65 IDENT@[67; 68) "S" 65 IDENT@[67; 68) "S"
66 SEMI@[68; 69) ";" 66 SEMICOLON@[68; 69) ";"
67 WHITESPACE@[69; 70) "\n" 67 WHITESPACE@[69; 70) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast
index 0cc3ac085..278549a46 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast
@@ -2,7 +2,7 @@ SOURCE_FILE@[0; 20)
2 IMPL_DEF@[0; 19) 2 IMPL_DEF@[0; 19)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 EXCL@[5; 6) "!" 5 BANG@[5; 6) "!"
6 PATH_TYPE@[6; 10) 6 PATH_TYPE@[6; 10)
7 PATH@[6; 10) 7 PATH@[6; 10)
8 PATH_SEGMENT@[6; 10) 8 PATH_SEGMENT@[6; 10)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast
index 2ace3c8ee..df24ae189 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 137)
24 BLOCK@[23; 25) 24 BLOCK@[23; 25)
25 L_CURLY@[23; 24) "{" 25 L_CURLY@[23; 24) "{"
26 R_CURLY@[24; 25) "}" 26 R_CURLY@[24; 25) "}"
27 SEMI@[25; 26) ";" 27 SEMICOLON@[25; 26) ";"
28 WHITESPACE@[26; 31) "\n " 28 WHITESPACE@[26; 31) "\n "
29 EXPR_STMT@[31; 50) 29 EXPR_STMT@[31; 50)
30 IF_EXPR@[31; 49) 30 IF_EXPR@[31; 49)
@@ -45,7 +45,7 @@ SOURCE_FILE@[0; 137)
45 BLOCK@[47; 49) 45 BLOCK@[47; 49)
46 L_CURLY@[47; 48) "{" 46 L_CURLY@[47; 48) "{"
47 R_CURLY@[48; 49) "}" 47 R_CURLY@[48; 49) "}"
48 SEMI@[49; 50) ";" 48 SEMICOLON@[49; 50) ";"
49 WHITESPACE@[50; 55) "\n " 49 WHITESPACE@[50; 55) "\n "
50 EXPR_STMT@[55; 91) 50 EXPR_STMT@[55; 91)
51 IF_EXPR@[55; 90) 51 IF_EXPR@[55; 90)
@@ -80,7 +80,7 @@ SOURCE_FILE@[0; 137)
80 BLOCK@[88; 90) 80 BLOCK@[88; 90)
81 L_CURLY@[88; 89) "{" 81 L_CURLY@[88; 89) "{"
82 R_CURLY@[89; 90) "}" 82 R_CURLY@[89; 90) "}"
83 SEMI@[90; 91) ";" 83 SEMICOLON@[90; 91) ";"
84 WHITESPACE@[91; 96) "\n " 84 WHITESPACE@[91; 96) "\n "
85 EXPR_STMT@[96; 104) 85 EXPR_STMT@[96; 104)
86 IF_EXPR@[96; 103) 86 IF_EXPR@[96; 103)
@@ -97,7 +97,7 @@ SOURCE_FILE@[0; 137)
97 BLOCK@[101; 103) 97 BLOCK@[101; 103)
98 L_CURLY@[101; 102) "{" 98 L_CURLY@[101; 102) "{"
99 R_CURLY@[102; 103) "}" 99 R_CURLY@[102; 103) "}"
100 SEMI@[103; 104) ";" 100 SEMICOLON@[103; 104) ";"
101 WHITESPACE@[104; 109) "\n " 101 WHITESPACE@[104; 109) "\n "
102 EXPR_STMT@[109; 134) 102 EXPR_STMT@[109; 134)
103 IF_EXPR@[109; 133) 103 IF_EXPR@[109; 133)
@@ -126,7 +126,7 @@ SOURCE_FILE@[0; 137)
126 L_CURLY@[130; 131) "{" 126 L_CURLY@[130; 131) "{"
127 WHITESPACE@[131; 132) " " 127 WHITESPACE@[131; 132) " "
128 R_CURLY@[132; 133) "}" 128 R_CURLY@[132; 133) "}"
129 SEMI@[133; 134) ";" 129 SEMICOLON@[133; 134) ";"
130 WHITESPACE@[134; 135) "\n" 130 WHITESPACE@[134; 135) "\n"
131 R_CURLY@[135; 136) "}" 131 R_CURLY@[135; 136) "}"
132 WHITESPACE@[136; 137) "\n" 132 WHITESPACE@[136; 137) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
index 2ee0dc199..bbf347580 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
@@ -39,5 +39,5 @@ SOURCE_FILE@[0; 42)
39 WHITESPACE@[37; 38) " " 39 WHITESPACE@[37; 38) " "
40 TYPE_BOUND@[38; 40) 40 TYPE_BOUND@[38; 40)
41 LIFETIME@[38; 40) "\'a" 41 LIFETIME@[38; 40) "\'a"
42 SEMI@[40; 41) ";" 42 SEMICOLON@[40; 41) ";"
43 WHITESPACE@[41; 42) "\n" 43 WHITESPACE@[41; 42) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast
index 2f07af4e1..85edd0845 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast
@@ -146,7 +146,7 @@ SOURCE_FILE@[0; 167)
146 COMMA@[156; 157) "," 146 COMMA@[156; 157) ","
147 WHITESPACE@[157; 162) "\n " 147 WHITESPACE@[157; 162) "\n "
148 R_CURLY@[162; 163) "}" 148 R_CURLY@[162; 163) "}"
149 SEMI@[163; 164) ";" 149 SEMICOLON@[163; 164) ";"
150 WHITESPACE@[164; 165) "\n" 150 WHITESPACE@[164; 165) "\n"
151 R_CURLY@[165; 166) "}" 151 R_CURLY@[165; 166) "}"
152 WHITESPACE@[166; 167) "\n" 152 WHITESPACE@[166; 167) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0067_crate_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0067_crate_path.rast
index f2ba4e909..35994e3fd 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0067_crate_path.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0067_crate_path.rast
@@ -7,9 +7,9 @@ SOURCE_FILE@[0; 16)
7 PATH@[4; 9) 7 PATH@[4; 9)
8 PATH_SEGMENT@[4; 9) 8 PATH_SEGMENT@[4; 9)
9 CRATE_KW@[4; 9) "crate" 9 CRATE_KW@[4; 9) "crate"
10 COLONCOLON@[9; 11) "::" 10 COLON2@[9; 11) "::"
11 PATH_SEGMENT@[11; 14) 11 PATH_SEGMENT@[11; 14)
12 NAME_REF@[11; 14) 12 NAME_REF@[11; 14)
13 IDENT@[11; 14) "foo" 13 IDENT@[11; 14) "foo"
14 SEMI@[14; 15) ";" 14 SEMICOLON@[14; 15) ";"
15 WHITESPACE@[15; 16) "\n" 15 WHITESPACE@[15; 16) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast
index 86afc9362..e24247890 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast
@@ -6,7 +6,7 @@ SOURCE_FILE@[0; 37)
6 PATH@[4; 9) 6 PATH@[4; 9)
7 PATH_SEGMENT@[4; 9) 7 PATH_SEGMENT@[4; 9)
8 CRATE_KW@[4; 9) "crate" 8 CRATE_KW@[4; 9) "crate"
9 COLONCOLON@[9; 11) "::" 9 COLON2@[9; 11) "::"
10 USE_TREE_LIST@[11; 17) 10 USE_TREE_LIST@[11; 17)
11 L_CURLY@[11; 12) "{" 11 L_CURLY@[11; 12) "{"
12 USE_TREE@[12; 16) 12 USE_TREE@[12; 16)
@@ -15,7 +15,7 @@ SOURCE_FILE@[0; 37)
15 NAME_REF@[12; 16) 15 NAME_REF@[12; 16)
16 IDENT@[12; 16) "Item" 16 IDENT@[12; 16) "Item"
17 R_CURLY@[16; 17) "}" 17 R_CURLY@[16; 17) "}"
18 SEMI@[17; 18) ";" 18 SEMICOLON@[17; 18) ";"
19 WHITESPACE@[18; 19) "\n" 19 WHITESPACE@[18; 19) "\n"
20 USE_ITEM@[19; 36) 20 USE_ITEM@[19; 36)
21 USE_KW@[19; 22) "use" 21 USE_KW@[19; 22) "use"
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 37)
24 PATH@[23; 27) 24 PATH@[23; 27)
25 PATH_SEGMENT@[23; 27) 25 PATH_SEGMENT@[23; 27)
26 SELF_KW@[23; 27) "self" 26 SELF_KW@[23; 27) "self"
27 COLONCOLON@[27; 29) "::" 27 COLON2@[27; 29) "::"
28 USE_TREE_LIST@[29; 35) 28 USE_TREE_LIST@[29; 35)
29 L_CURLY@[29; 30) "{" 29 L_CURLY@[29; 30) "{"
30 USE_TREE@[30; 34) 30 USE_TREE@[30; 34)
@@ -33,5 +33,5 @@ SOURCE_FILE@[0; 37)
33 NAME_REF@[30; 34) 33 NAME_REF@[30; 34)
34 IDENT@[30; 34) "Item" 34 IDENT@[30; 34) "Item"
35 R_CURLY@[34; 35) "}" 35 R_CURLY@[34; 35) "}"
36 SEMI@[35; 36) ";" 36 SEMICOLON@[35; 36) ";"
37 WHITESPACE@[36; 37) "\n" 37 WHITESPACE@[36; 37) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast b/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast
index cd63d10f7..4b075569a 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 46)
32 WHITESPACE@[28; 29) " " 32 WHITESPACE@[28; 29) " "
33 LITERAL@[29; 30) 33 LITERAL@[29; 30)
34 INT_NUMBER@[29; 30) "2" 34 INT_NUMBER@[29; 30) "2"
35 SEMI@[30; 31) ";" 35 SEMICOLON@[30; 31) ";"
36 WHITESPACE@[31; 36) "\n " 36 WHITESPACE@[31; 36) "\n "
37 EXPR_STMT@[36; 39) 37 EXPR_STMT@[36; 39)
38 BLOCK_EXPR@[36; 39) 38 BLOCK_EXPR@[36; 39)
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 46)
47 AMP@[40; 41) "&" 47 AMP@[40; 41) "&"
48 LITERAL@[41; 42) 48 LITERAL@[41; 42)
49 INT_NUMBER@[41; 42) "2" 49 INT_NUMBER@[41; 42) "2"
50 SEMI@[42; 43) ";" 50 SEMICOLON@[42; 43) ";"
51 WHITESPACE@[43; 44) "\n" 51 WHITESPACE@[43; 44) "\n"
52 R_CURLY@[44; 45) "}" 52 R_CURLY@[44; 45) "}"
53 WHITESPACE@[45; 46) "\n" 53 WHITESPACE@[45; 46) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast
index 0af668056..559ffb578 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 97)
24 L_CURLY@[24; 25) "{" 24 L_CURLY@[24; 25) "{"
25 WHITESPACE@[25; 26) " " 25 WHITESPACE@[25; 26) " "
26 R_CURLY@[26; 27) "}" 26 R_CURLY@[26; 27) "}"
27 SEMI@[27; 28) ";" 27 SEMICOLON@[27; 28) ";"
28 WHITESPACE@[28; 33) "\n " 28 WHITESPACE@[28; 33) "\n "
29 EXPR_STMT@[33; 44) 29 EXPR_STMT@[33; 44)
30 MATCH_EXPR@[33; 43) 30 MATCH_EXPR@[33; 43)
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 97)
39 MATCH_ARM_LIST@[41; 43) 39 MATCH_ARM_LIST@[41; 43)
40 L_CURLY@[41; 42) "{" 40 L_CURLY@[41; 42) "{"
41 R_CURLY@[42; 43) "}" 41 R_CURLY@[42; 43) "}"
42 SEMI@[43; 44) ";" 42 SEMICOLON@[43; 44) ";"
43 WHITESPACE@[44; 49) "\n " 43 WHITESPACE@[44; 49) "\n "
44 EXPR_STMT@[49; 71) 44 EXPR_STMT@[49; 71)
45 MATCH_EXPR@[49; 70) 45 MATCH_EXPR@[49; 70)
@@ -65,7 +65,7 @@ SOURCE_FILE@[0; 97)
65 R_PAREN@[67; 68) ")" 65 R_PAREN@[67; 68) ")"
66 WHITESPACE@[68; 69) " " 66 WHITESPACE@[68; 69) " "
67 R_CURLY@[69; 70) "}" 67 R_CURLY@[69; 70) "}"
68 SEMI@[70; 71) ";" 68 SEMICOLON@[70; 71) ";"
69 WHITESPACE@[71; 76) "\n " 69 WHITESPACE@[71; 76) "\n "
70 EXPR_STMT@[76; 94) 70 EXPR_STMT@[76; 94)
71 MATCH_EXPR@[76; 93) 71 MATCH_EXPR@[76; 93)
@@ -90,7 +90,7 @@ SOURCE_FILE@[0; 97)
90 MATCH_ARM_LIST@[91; 93) 90 MATCH_ARM_LIST@[91; 93)
91 L_CURLY@[91; 92) "{" 91 L_CURLY@[91; 92) "{"
92 R_CURLY@[92; 93) "}" 92 R_CURLY@[92; 93) "}"
93 SEMI@[93; 94) ";" 93 SEMICOLON@[93; 94) ";"
94 WHITESPACE@[94; 95) "\n" 94 WHITESPACE@[94; 95) "\n"
95 R_CURLY@[95; 96) "}" 95 R_CURLY@[95; 96) "}"
96 WHITESPACE@[96; 97) "\n" 96 WHITESPACE@[96; 97) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast
index 4a83a7200..084efaee2 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast
@@ -15,7 +15,7 @@ SOURCE_FILE@[0; 40)
15 EXPR_STMT@[15; 22) 15 EXPR_STMT@[15; 22)
16 RETURN_EXPR@[15; 21) 16 RETURN_EXPR@[15; 21)
17 RETURN_KW@[15; 21) "return" 17 RETURN_KW@[15; 21) "return"
18 SEMI@[21; 22) ";" 18 SEMICOLON@[21; 22) ";"
19 WHITESPACE@[22; 27) "\n " 19 WHITESPACE@[22; 27) "\n "
20 EXPR_STMT@[27; 37) 20 EXPR_STMT@[27; 37)
21 RETURN_EXPR@[27; 36) 21 RETURN_EXPR@[27; 36)
@@ -23,7 +23,7 @@ SOURCE_FILE@[0; 40)
23 WHITESPACE@[33; 34) " " 23 WHITESPACE@[33; 34) " "
24 LITERAL@[34; 36) 24 LITERAL@[34; 36)
25 INT_NUMBER@[34; 36) "92" 25 INT_NUMBER@[34; 36) "92"
26 SEMI@[36; 37) ";" 26 SEMICOLON@[36; 37) ";"
27 WHITESPACE@[37; 38) "\n" 27 WHITESPACE@[37; 38) "\n"
28 R_CURLY@[38; 39) "}" 28 R_CURLY@[38; 39) "}"
29 WHITESPACE@[39; 40) "\n" 29 WHITESPACE@[39; 40) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast
index 2dd6db28f..64150b774 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast
@@ -16,5 +16,5 @@ SOURCE_FILE@[0; 21)
16 TUPLE_TYPE@[17; 19) 16 TUPLE_TYPE@[17; 19)
17 L_PAREN@[17; 18) "(" 17 L_PAREN@[17; 18) "("
18 R_PAREN@[18; 19) ")" 18 R_PAREN@[18; 19) ")"
19 SEMI@[19; 20) ";" 19 SEMICOLON@[19; 20) ";"
20 WHITESPACE@[20; 21) "\n" 20 WHITESPACE@[20; 21) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast
index 28d1bad97..5c7cb4a88 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast
@@ -36,7 +36,7 @@ SOURCE_FILE@[0; 65)
36 WHITESPACE@[26; 27) " " 36 WHITESPACE@[26; 27) " "
37 LITERAL@[27; 28) 37 LITERAL@[27; 28)
38 INT_NUMBER@[27; 28) "1" 38 INT_NUMBER@[27; 28) "1"
39 SEMI@[28; 29) ";" 39 SEMICOLON@[28; 29) ";"
40 WHITESPACE@[29; 30) " " 40 WHITESPACE@[29; 30) " "
41 R_CURLY@[30; 31) "}" 41 R_CURLY@[30; 31) "}"
42 WHITESPACE@[31; 32) "\n" 42 WHITESPACE@[31; 32) "\n"
@@ -56,12 +56,12 @@ SOURCE_FILE@[0; 65)
56 EXPR_STMT@[41; 43) 56 EXPR_STMT@[41; 43)
57 LITERAL@[41; 42) 57 LITERAL@[41; 42)
58 INT_NUMBER@[41; 42) "1" 58 INT_NUMBER@[41; 42) "1"
59 SEMI@[42; 43) ";" 59 SEMICOLON@[42; 43) ";"
60 WHITESPACE@[43; 44) " " 60 WHITESPACE@[43; 44) " "
61 EXPR_STMT@[44; 46) 61 EXPR_STMT@[44; 46)
62 LITERAL@[44; 45) 62 LITERAL@[44; 45)
63 INT_NUMBER@[44; 45) "2" 63 INT_NUMBER@[44; 45) "2"
64 SEMI@[45; 46) ";" 64 SEMICOLON@[45; 46) ";"
65 WHITESPACE@[46; 47) " " 65 WHITESPACE@[46; 47) " "
66 R_CURLY@[47; 48) "}" 66 R_CURLY@[47; 48) "}"
67 WHITESPACE@[48; 49) "\n" 67 WHITESPACE@[48; 49) "\n"
@@ -81,7 +81,7 @@ SOURCE_FILE@[0; 65)
81 EXPR_STMT@[58; 60) 81 EXPR_STMT@[58; 60)
82 LITERAL@[58; 59) 82 LITERAL@[58; 59)
83 INT_NUMBER@[58; 59) "1" 83 INT_NUMBER@[58; 59) "1"
84 SEMI@[59; 60) ";" 84 SEMICOLON@[59; 60) ";"
85 WHITESPACE@[60; 61) " " 85 WHITESPACE@[60; 61) " "
86 LITERAL@[61; 62) 86 LITERAL@[61; 62)
87 INT_NUMBER@[61; 62) "2" 87 INT_NUMBER@[61; 62) "2"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast
index 18ccfe9ef..bb9f674e1 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast
@@ -20,7 +20,7 @@ SOURCE_FILE@[0; 21)
20 NAME_REF@[15; 16) 20 NAME_REF@[15; 16)
21 IDENT@[15; 16) "x" 21 IDENT@[15; 16) "x"
22 QUESTION@[16; 17) "?" 22 QUESTION@[16; 17) "?"
23 SEMI@[17; 18) ";" 23 SEMICOLON@[17; 18) ";"
24 WHITESPACE@[18; 19) "\n" 24 WHITESPACE@[18; 19) "\n"
25 R_CURLY@[19; 20) "}" 25 R_CURLY@[19; 20) "}"
26 WHITESPACE@[20; 21) "\n" 26 WHITESPACE@[20; 21) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast
index 4bc0b1858..9a38192d9 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast
@@ -12,5 +12,5 @@ SOURCE_FILE@[0; 16)
12 PATH_SEGMENT@[11; 14) 12 PATH_SEGMENT@[11; 14)
13 NAME_REF@[11; 14) 13 NAME_REF@[11; 14)
14 IDENT@[11; 14) "Bar" 14 IDENT@[11; 14) "Bar"
15 SEMI@[14; 15) ";" 15 SEMICOLON@[14; 15) ";"
16 WHITESPACE@[15; 16) "\n" 16 WHITESPACE@[15; 16) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast b/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast
index 9f8a6b0f6..b8bafc220 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast
@@ -24,8 +24,8 @@ SOURCE_FILE@[0; 89)
24 RANGE_EXPR@[23; 26) 24 RANGE_EXPR@[23; 26)
25 LITERAL@[23; 24) 25 LITERAL@[23; 24)
26 INT_NUMBER@[23; 24) "1" 26 INT_NUMBER@[23; 24) "1"
27 DOTDOT@[24; 26) ".." 27 DOT2@[24; 26) ".."
28 SEMI@[26; 27) ";" 28 SEMICOLON@[26; 27) ";"
29 WHITESPACE@[27; 32) "\n " 29 WHITESPACE@[27; 32) "\n "
30 EXPR_STMT@[32; 54) 30 EXPR_STMT@[32; 54)
31 MATCH_EXPR@[32; 53) 31 MATCH_EXPR@[32; 53)
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 89)
34 RANGE_EXPR@[38; 41) 34 RANGE_EXPR@[38; 41)
35 LITERAL@[38; 39) 35 LITERAL@[38; 39)
36 INT_NUMBER@[38; 39) "1" 36 INT_NUMBER@[38; 39) "1"
37 DOTDOT@[39; 41) ".." 37 DOT2@[39; 41) ".."
38 WHITESPACE@[41; 42) " " 38 WHITESPACE@[41; 42) " "
39 MATCH_ARM_LIST@[42; 53) 39 MATCH_ARM_LIST@[42; 53)
40 L_CURLY@[42; 43) "{" 40 L_CURLY@[42; 43) "{"
@@ -50,7 +50,7 @@ SOURCE_FILE@[0; 89)
50 R_PAREN@[50; 51) ")" 50 R_PAREN@[50; 51) ")"
51 WHITESPACE@[51; 52) " " 51 WHITESPACE@[51; 52) " "
52 R_CURLY@[52; 53) "}" 52 R_CURLY@[52; 53) "}"
53 SEMI@[53; 54) ";" 53 SEMICOLON@[53; 54) ";"
54 WHITESPACE@[54; 59) "\n " 54 WHITESPACE@[54; 59) "\n "
55 EXPR_STMT@[59; 86) 55 EXPR_STMT@[59; 86)
56 MATCH_EXPR@[59; 85) 56 MATCH_EXPR@[59; 85)
@@ -69,7 +69,7 @@ SOURCE_FILE@[0; 89)
69 ARG_LIST@[68; 70) 69 ARG_LIST@[68; 70)
70 L_PAREN@[68; 69) "(" 70 L_PAREN@[68; 69) "("
71 R_PAREN@[69; 70) ")" 71 R_PAREN@[69; 70) ")"
72 DOTDOT@[70; 72) ".." 72 DOT2@[70; 72) ".."
73 PATH_EXPR@[72; 73) 73 PATH_EXPR@[72; 73)
74 PATH@[72; 73) 74 PATH@[72; 73)
75 PATH_SEGMENT@[72; 73) 75 PATH_SEGMENT@[72; 73)
@@ -90,7 +90,7 @@ SOURCE_FILE@[0; 89)
90 R_PAREN@[82; 83) ")" 90 R_PAREN@[82; 83) ")"
91 WHITESPACE@[83; 84) " " 91 WHITESPACE@[83; 84) " "
92 R_CURLY@[84; 85) "}" 92 R_CURLY@[84; 85) "}"
93 SEMI@[85; 86) ";" 93 SEMICOLON@[85; 86) ";"
94 WHITESPACE@[86; 87) "\n" 94 WHITESPACE@[86; 87) "\n"
95 R_CURLY@[87; 88) "}" 95 R_CURLY@[87; 88) "}"
96 WHITESPACE@[88; 89) "\n" 96 WHITESPACE@[88; 89) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast
index b1353c2c6..00c4e4220 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 200)
27 TUPLE_TYPE@[25; 27) 27 TUPLE_TYPE@[25; 27)
28 L_PAREN@[25; 26) "(" 28 L_PAREN@[25; 26) "("
29 R_PAREN@[26; 27) ")" 29 R_PAREN@[26; 27) ")"
30 SEMI@[27; 28) ";" 30 SEMICOLON@[27; 28) ";"
31 WHITESPACE@[28; 29) "\n" 31 WHITESPACE@[28; 29) "\n"
32 FN_DEF@[29; 79) 32 FN_DEF@[29; 79)
33 FN_KW@[29; 31) "fn" 33 FN_KW@[29; 31) "fn"
@@ -222,7 +222,7 @@ SOURCE_FILE@[0; 200)
222 NAME_REF@[177; 180) 222 NAME_REF@[177; 180)
223 IDENT@[177; 180) "Baz" 223 IDENT@[177; 180) "Baz"
224 R_ANGLE@[180; 181) ">" 224 R_ANGLE@[180; 181) ">"
225 COLONCOLON@[181; 183) "::" 225 COLON2@[181; 183) "::"
226 PATH_SEGMENT@[183; 186) 226 PATH_SEGMENT@[183; 186)
227 NAME_REF@[183; 186) 227 NAME_REF@[183; 186)
228 IDENT@[183; 186) "Foo" 228 IDENT@[183; 186) "Foo"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast
index 8f34afe76..2999977fc 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 52)
24 AMP@[23; 24) "&" 24 AMP@[23; 24) "&"
25 LITERAL@[24; 25) 25 LITERAL@[24; 25)
26 INT_NUMBER@[24; 25) "1" 26 INT_NUMBER@[24; 25) "1"
27 SEMI@[25; 26) ";" 27 SEMICOLON@[25; 26) ";"
28 WHITESPACE@[26; 31) "\n " 28 WHITESPACE@[26; 31) "\n "
29 LET_STMT@[31; 49) 29 LET_STMT@[31; 49)
30 LET_KW@[31; 34) "let" 30 LET_KW@[31; 34) "let"
@@ -49,7 +49,7 @@ SOURCE_FILE@[0; 52)
49 ARG_LIST@[46; 48) 49 ARG_LIST@[46; 48)
50 L_PAREN@[46; 47) "(" 50 L_PAREN@[46; 47) "("
51 R_PAREN@[47; 48) ")" 51 R_PAREN@[47; 48) ")"
52 SEMI@[48; 49) ";" 52 SEMICOLON@[48; 49) ";"
53 WHITESPACE@[49; 50) "\n" 53 WHITESPACE@[49; 50) "\n"
54 R_CURLY@[50; 51) "}" 54 R_CURLY@[50; 51) "}"
55 WHITESPACE@[51; 52) "\n" 55 WHITESPACE@[51; 52) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast b/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast
index e909f2b78..13393e4b8 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast
@@ -4,7 +4,7 @@ SOURCE_FILE@[0; 106)
4 WHITESPACE@[6; 7) " " 4 WHITESPACE@[6; 7) " "
5 NAME@[7; 10) 5 NAME@[7; 10)
6 IDENT@[7; 10) "Foo" 6 IDENT@[7; 10) "Foo"
7 SEMI@[10; 11) ";" 7 SEMICOLON@[10; 11) ";"
8 WHITESPACE@[11; 12) "\n" 8 WHITESPACE@[11; 12) "\n"
9 STRUCT_DEF@[12; 25) 9 STRUCT_DEF@[12; 25)
10 STRUCT_KW@[12; 18) "struct" 10 STRUCT_KW@[12; 18) "struct"
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 106)
24 TUPLE_FIELD_DEF_LIST@[36; 38) 24 TUPLE_FIELD_DEF_LIST@[36; 38)
25 L_PAREN@[36; 37) "(" 25 L_PAREN@[36; 37) "("
26 R_PAREN@[37; 38) ")" 26 R_PAREN@[37; 38) ")"
27 SEMI@[38; 39) ";" 27 SEMICOLON@[38; 39) ";"
28 WHITESPACE@[39; 40) "\n" 28 WHITESPACE@[39; 40) "\n"
29 STRUCT_DEF@[40; 66) 29 STRUCT_DEF@[40; 66)
30 STRUCT_KW@[40; 46) "struct" 30 STRUCT_KW@[40; 46) "struct"
@@ -48,7 +48,7 @@ SOURCE_FILE@[0; 106)
48 NAME_REF@[59; 64) 48 NAME_REF@[59; 64)
49 IDENT@[59; 64) "usize" 49 IDENT@[59; 64) "usize"
50 R_PAREN@[64; 65) ")" 50 R_PAREN@[64; 65) ")"
51 SEMI@[65; 66) ";" 51 SEMICOLON@[65; 66) ";"
52 WHITESPACE@[66; 67) "\n" 52 WHITESPACE@[66; 67) "\n"
53 STRUCT_DEF@[67; 105) 53 STRUCT_DEF@[67; 105)
54 STRUCT_KW@[67; 73) "struct" 54 STRUCT_KW@[67; 73) "struct"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast
index c0cf48af5..79d193616 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast
@@ -15,5 +15,5 @@ SOURCE_FILE@[0; 16)
15 NAME_REF@[10; 13) 15 NAME_REF@[10; 13)
16 IDENT@[10; 13) "i32" 16 IDENT@[10; 13) "i32"
17 R_PAREN@[13; 14) ")" 17 R_PAREN@[13; 14) ")"
18 SEMI@[14; 15) ";" 18 SEMICOLON@[14; 15) ";"
19 WHITESPACE@[15; 16) "\n" 19 WHITESPACE@[15; 16) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast b/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast
index 2903c6f9a..c2cec89b4 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast
@@ -22,7 +22,7 @@ SOURCE_FILE@[0; 189)
22 WHITESPACE@[22; 23) " " 22 WHITESPACE@[22; 23) " "
23 LITERAL@[23; 27) 23 LITERAL@[23; 27)
24 TRUE_KW@[23; 27) "true" 24 TRUE_KW@[23; 27) "true"
25 SEMI@[27; 28) ";" 25 SEMICOLON@[27; 28) ";"
26 WHITESPACE@[28; 33) "\n " 26 WHITESPACE@[28; 33) "\n "
27 LET_STMT@[33; 47) 27 LET_STMT@[33; 47)
28 LET_KW@[33; 36) "let" 28 LET_KW@[33; 36) "let"
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 189)
34 WHITESPACE@[40; 41) " " 34 WHITESPACE@[40; 41) " "
35 LITERAL@[41; 46) 35 LITERAL@[41; 46)
36 FALSE_KW@[41; 46) "false" 36 FALSE_KW@[41; 46) "false"
37 SEMI@[46; 47) ";" 37 SEMICOLON@[46; 47) ";"
38 WHITESPACE@[47; 52) "\n " 38 WHITESPACE@[47; 52) "\n "
39 LET_STMT@[52; 62) 39 LET_STMT@[52; 62)
40 LET_KW@[52; 55) "let" 40 LET_KW@[52; 55) "let"
@@ -46,7 +46,7 @@ SOURCE_FILE@[0; 189)
46 WHITESPACE@[59; 60) " " 46 WHITESPACE@[59; 60) " "
47 LITERAL@[60; 61) 47 LITERAL@[60; 61)
48 INT_NUMBER@[60; 61) "1" 48 INT_NUMBER@[60; 61) "1"
49 SEMI@[61; 62) ";" 49 SEMICOLON@[61; 62) ";"
50 WHITESPACE@[62; 67) "\n " 50 WHITESPACE@[62; 67) "\n "
51 LET_STMT@[67; 79) 51 LET_STMT@[67; 79)
52 LET_KW@[67; 70) "let" 52 LET_KW@[67; 70) "let"
@@ -58,7 +58,7 @@ SOURCE_FILE@[0; 189)
58 WHITESPACE@[74; 75) " " 58 WHITESPACE@[74; 75) " "
59 LITERAL@[75; 78) 59 LITERAL@[75; 78)
60 FLOAT_NUMBER@[75; 78) "2.0" 60 FLOAT_NUMBER@[75; 78) "2.0"
61 SEMI@[78; 79) ";" 61 SEMICOLON@[78; 79) ";"
62 WHITESPACE@[79; 84) "\n " 62 WHITESPACE@[79; 84) "\n "
63 LET_STMT@[84; 97) 63 LET_STMT@[84; 97)
64 LET_KW@[84; 87) "let" 64 LET_KW@[84; 87) "let"
@@ -70,7 +70,7 @@ SOURCE_FILE@[0; 189)
70 WHITESPACE@[91; 92) " " 70 WHITESPACE@[91; 92) " "
71 LITERAL@[92; 96) 71 LITERAL@[92; 96)
72 BYTE@[92; 96) "b\'a\'" 72 BYTE@[92; 96) "b\'a\'"
73 SEMI@[96; 97) ";" 73 SEMICOLON@[96; 97) ";"
74 WHITESPACE@[97; 102) "\n " 74 WHITESPACE@[97; 102) "\n "
75 LET_STMT@[102; 114) 75 LET_STMT@[102; 114)
76 LET_KW@[102; 105) "let" 76 LET_KW@[102; 105) "let"
@@ -82,7 +82,7 @@ SOURCE_FILE@[0; 189)
82 WHITESPACE@[109; 110) " " 82 WHITESPACE@[109; 110) " "
83 LITERAL@[110; 113) 83 LITERAL@[110; 113)
84 CHAR@[110; 113) "\'b\'" 84 CHAR@[110; 113) "\'b\'"
85 SEMI@[113; 114) ";" 85 SEMICOLON@[113; 114) ";"
86 WHITESPACE@[114; 119) "\n " 86 WHITESPACE@[114; 119) "\n "
87 LET_STMT@[119; 131) 87 LET_STMT@[119; 131)
88 LET_KW@[119; 122) "let" 88 LET_KW@[119; 122) "let"
@@ -94,7 +94,7 @@ SOURCE_FILE@[0; 189)
94 WHITESPACE@[126; 127) " " 94 WHITESPACE@[126; 127) " "
95 LITERAL@[127; 130) 95 LITERAL@[127; 130)
96 STRING@[127; 130) "\"c\"" 96 STRING@[127; 130) "\"c\""
97 SEMI@[130; 131) ";" 97 SEMICOLON@[130; 131) ";"
98 WHITESPACE@[131; 136) "\n " 98 WHITESPACE@[131; 136) "\n "
99 LET_STMT@[136; 149) 99 LET_STMT@[136; 149)
100 LET_KW@[136; 139) "let" 100 LET_KW@[136; 139) "let"
@@ -106,7 +106,7 @@ SOURCE_FILE@[0; 189)
106 WHITESPACE@[143; 144) " " 106 WHITESPACE@[143; 144) " "
107 LITERAL@[144; 148) 107 LITERAL@[144; 148)
108 RAW_STRING@[144; 148) "r\"d\"" 108 RAW_STRING@[144; 148) "r\"d\""
109 SEMI@[148; 149) ";" 109 SEMICOLON@[148; 149) ";"
110 WHITESPACE@[149; 154) "\n " 110 WHITESPACE@[149; 154) "\n "
111 LET_STMT@[154; 167) 111 LET_STMT@[154; 167)
112 LET_KW@[154; 157) "let" 112 LET_KW@[154; 157) "let"
@@ -118,7 +118,7 @@ SOURCE_FILE@[0; 189)
118 WHITESPACE@[161; 162) " " 118 WHITESPACE@[161; 162) " "
119 LITERAL@[162; 166) 119 LITERAL@[162; 166)
120 BYTE_STRING@[162; 166) "b\"e\"" 120 BYTE_STRING@[162; 166) "b\"e\""
121 SEMI@[166; 167) ";" 121 SEMICOLON@[166; 167) ";"
122 WHITESPACE@[167; 172) "\n " 122 WHITESPACE@[167; 172) "\n "
123 LET_STMT@[172; 186) 123 LET_STMT@[172; 186)
124 LET_KW@[172; 175) "let" 124 LET_KW@[172; 175) "let"
@@ -130,7 +130,7 @@ SOURCE_FILE@[0; 189)
130 WHITESPACE@[179; 180) " " 130 WHITESPACE@[179; 180) " "
131 LITERAL@[180; 185) 131 LITERAL@[180; 185)
132 RAW_BYTE_STRING@[180; 185) "br\"f\"" 132 RAW_BYTE_STRING@[180; 185) "br\"f\""
133 SEMI@[185; 186) ";" 133 SEMICOLON@[185; 186) ";"
134 WHITESPACE@[186; 187) "\n" 134 WHITESPACE@[186; 187) "\n"
135 R_CURLY@[187; 188) "}" 135 R_CURLY@[187; 188) "}"
136 WHITESPACE@[188; 189) "\n" 136 WHITESPACE@[188; 189) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast b/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast
index 8d2579cd6..1d7796449 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast
@@ -18,5 +18,5 @@ SOURCE_FILE@[0; 19)
18 NAME_REF@[13; 16) 18 NAME_REF@[13; 16)
19 IDENT@[13; 16) "i32" 19 IDENT@[13; 16) "i32"
20 R_ANGLE@[16; 17) ">" 20 R_ANGLE@[16; 17) ">"
21 SEMI@[17; 18) ";" 21 SEMICOLON@[17; 18) ";"
22 WHITESPACE@[18; 19) "\n" 22 WHITESPACE@[18; 19) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast b/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast
index fae822367..db6013c6f 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast
@@ -19,5 +19,5 @@ SOURCE_FILE@[0; 21)
19 TUPLE_TYPE@[17; 19) 19 TUPLE_TYPE@[17; 19)
20 L_PAREN@[17; 18) "(" 20 L_PAREN@[17; 18) "("
21 R_PAREN@[18; 19) ")" 21 R_PAREN@[18; 19) ")"
22 SEMI@[19; 20) ";" 22 SEMICOLON@[19; 20) ";"
23 WHITESPACE@[20; 21) "\n" 23 WHITESPACE@[20; 21) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast
index 1a979e597..118cfc096 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 26)
28 LITERAL@[20; 21) 28 LITERAL@[20; 21)
29 INT_NUMBER@[20; 21) "2" 29 INT_NUMBER@[20; 21) "2"
30 R_BRACK@[21; 22) "]" 30 R_BRACK@[21; 22) "]"
31 SEMI@[22; 23) ";" 31 SEMICOLON@[22; 23) ";"
32 WHITESPACE@[23; 24) "\n" 32 WHITESPACE@[23; 24) "\n"
33 R_CURLY@[24; 25) "}" 33 R_CURLY@[24; 25) "}"
34 WHITESPACE@[25; 26) "\n" 34 WHITESPACE@[25; 26) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast
index fe86894a9..ebe7816a4 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast
@@ -23,7 +23,7 @@ SOURCE_FILE@[0; 26)
23 TUPLE_EXPR@[20; 22) 23 TUPLE_EXPR@[20; 22)
24 L_PAREN@[20; 21) "(" 24 L_PAREN@[20; 21) "("
25 R_PAREN@[21; 22) ")" 25 R_PAREN@[21; 22) ")"
26 SEMI@[22; 23) ";" 26 SEMICOLON@[22; 23) ";"
27 WHITESPACE@[23; 24) " " 27 WHITESPACE@[23; 24) " "
28 R_CURLY@[24; 25) "}" 28 R_CURLY@[24; 25) "}"
29 WHITESPACE@[25; 26) "\n" 29 WHITESPACE@[25; 26) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast
index 157aa29f5..6bd6f5a6b 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast
@@ -95,7 +95,7 @@ SOURCE_FILE@[0; 167)
95 PATH_SEGMENT@[109; 120) 95 PATH_SEGMENT@[109; 120)
96 NAME_REF@[109; 120) 96 NAME_REF@[109; 120)
97 IDENT@[109; 120) "macro_rules" 97 IDENT@[109; 120) "macro_rules"
98 EXCL@[120; 121) "!" 98 BANG@[120; 121) "!"
99 WHITESPACE@[121; 122) " " 99 WHITESPACE@[121; 122) " "
100 NAME@[122; 126) 100 NAME@[122; 126)
101 IDENT@[122; 126) "test" 101 IDENT@[122; 126) "test"
@@ -121,7 +121,7 @@ SOURCE_FILE@[0; 167)
121 PATH_SEGMENT@[157; 161) 121 PATH_SEGMENT@[157; 161)
122 NAME_REF@[157; 161) 122 NAME_REF@[157; 161)
123 IDENT@[157; 161) "test" 123 IDENT@[157; 161) "test"
124 EXCL@[161; 162) "!" 124 BANG@[161; 162) "!"
125 TOKEN_TREE@[162; 164) 125 TOKEN_TREE@[162; 164)
126 L_CURLY@[162; 163) "{" 126 L_CURLY@[162; 163) "{"
127 R_CURLY@[163; 164) "}" 127 R_CURLY@[163; 164) "}"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast
index 83c58d25f..d25f087a5 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast
@@ -30,7 +30,7 @@ SOURCE_FILE@[0; 33)
30 BLOCK@[27; 29) 30 BLOCK@[27; 29)
31 L_CURLY@[27; 28) "{" 31 L_CURLY@[27; 28) "{"
32 R_CURLY@[28; 29) "}" 32 R_CURLY@[28; 29) "}"
33 SEMI@[29; 30) ";" 33 SEMICOLON@[29; 30) ";"
34 WHITESPACE@[30; 31) "\n" 34 WHITESPACE@[30; 31) "\n"
35 R_CURLY@[31; 32) "}" 35 R_CURLY@[31; 32) "}"
36 WHITESPACE@[32; 33) "\n" 36 WHITESPACE@[32; 33) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
index d8e04bd90..c2614543c 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
@@ -30,7 +30,7 @@ SOURCE_FILE@[0; 119)
30 TUPLE_EXPR@[26; 28) 30 TUPLE_EXPR@[26; 28)
31 L_PAREN@[26; 27) "(" 31 L_PAREN@[26; 27) "("
32 R_PAREN@[27; 28) ")" 32 R_PAREN@[27; 28) ")"
33 SEMI@[28; 29) ";" 33 SEMICOLON@[28; 29) ";"
34 WHITESPACE@[29; 34) "\n " 34 WHITESPACE@[29; 34) "\n "
35 LET_STMT@[34; 62) 35 LET_STMT@[34; 62)
36 LET_KW@[34; 37) "let" 36 LET_KW@[34; 37) "let"
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 119)
64 TUPLE_EXPR@[59; 61) 64 TUPLE_EXPR@[59; 61)
65 L_PAREN@[59; 60) "(" 65 L_PAREN@[59; 60) "("
66 R_PAREN@[60; 61) ")" 66 R_PAREN@[60; 61) ")"
67 SEMI@[61; 62) ";" 67 SEMICOLON@[61; 62) ";"
68 WHITESPACE@[62; 67) "\n " 68 WHITESPACE@[62; 67) "\n "
69 LET_STMT@[67; 90) 69 LET_STMT@[67; 90)
70 LET_KW@[67; 70) "let" 70 LET_KW@[67; 70) "let"
@@ -87,7 +87,7 @@ SOURCE_FILE@[0; 119)
87 UNDERSCORE@[78; 79) "_" 87 UNDERSCORE@[78; 79) "_"
88 COMMA@[79; 80) "," 88 COMMA@[79; 80) ","
89 WHITESPACE@[80; 81) " " 89 WHITESPACE@[80; 81) " "
90 DOTDOT@[81; 83) ".." 90 DOT2@[81; 83) ".."
91 R_CURLY@[83; 84) "}" 91 R_CURLY@[83; 84) "}"
92 WHITESPACE@[84; 85) " " 92 WHITESPACE@[84; 85) " "
93 EQ@[85; 86) "=" 93 EQ@[85; 86) "="
@@ -95,7 +95,7 @@ SOURCE_FILE@[0; 119)
95 TUPLE_EXPR@[87; 89) 95 TUPLE_EXPR@[87; 89)
96 L_PAREN@[87; 88) "(" 96 L_PAREN@[87; 88) "("
97 R_PAREN@[88; 89) ")" 97 R_PAREN@[88; 89) ")"
98 SEMI@[89; 90) ";" 98 SEMICOLON@[89; 90) ";"
99 WHITESPACE@[90; 95) "\n " 99 WHITESPACE@[90; 95) "\n "
100 LET_STMT@[95; 116) 100 LET_STMT@[95; 116)
101 LET_KW@[95; 98) "let" 101 LET_KW@[95; 98) "let"
@@ -125,7 +125,7 @@ SOURCE_FILE@[0; 119)
125 TUPLE_EXPR@[113; 115) 125 TUPLE_EXPR@[113; 115)
126 L_PAREN@[113; 114) "(" 126 L_PAREN@[113; 114) "("
127 R_PAREN@[114; 115) ")" 127 R_PAREN@[114; 115) ")"
128 SEMI@[115; 116) ";" 128 SEMICOLON@[115; 116) ";"
129 WHITESPACE@[116; 117) "\n" 129 WHITESPACE@[116; 117) "\n"
130 R_CURLY@[117; 118) "}" 130 R_CURLY@[117; 118) "}"
131 WHITESPACE@[118; 119) "\n" 131 WHITESPACE@[118; 119) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast
index 0db62a1f5..60fbf2771 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast
@@ -16,7 +16,7 @@ SOURCE_FILE@[0; 55)
16 ARRAY_EXPR@[15; 17) 16 ARRAY_EXPR@[15; 17)
17 L_BRACK@[15; 16) "[" 17 L_BRACK@[15; 16) "["
18 R_BRACK@[16; 17) "]" 18 R_BRACK@[16; 17) "]"
19 SEMI@[17; 18) ";" 19 SEMICOLON@[17; 18) ";"
20 WHITESPACE@[18; 23) "\n " 20 WHITESPACE@[18; 23) "\n "
21 EXPR_STMT@[23; 27) 21 EXPR_STMT@[23; 27)
22 ARRAY_EXPR@[23; 26) 22 ARRAY_EXPR@[23; 26)
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 55)
24 LITERAL@[24; 25) 24 LITERAL@[24; 25)
25 INT_NUMBER@[24; 25) "1" 25 INT_NUMBER@[24; 25) "1"
26 R_BRACK@[25; 26) "]" 26 R_BRACK@[25; 26) "]"
27 SEMI@[26; 27) ";" 27 SEMICOLON@[26; 27) ";"
28 WHITESPACE@[27; 32) "\n " 28 WHITESPACE@[27; 32) "\n "
29 EXPR_STMT@[32; 40) 29 EXPR_STMT@[32; 40)
30 ARRAY_EXPR@[32; 39) 30 ARRAY_EXPR@[32; 39)
@@ -37,19 +37,19 @@ SOURCE_FILE@[0; 55)
37 INT_NUMBER@[36; 37) "2" 37 INT_NUMBER@[36; 37) "2"
38 COMMA@[37; 38) "," 38 COMMA@[37; 38) ","
39 R_BRACK@[38; 39) "]" 39 R_BRACK@[38; 39) "]"
40 SEMI@[39; 40) ";" 40 SEMICOLON@[39; 40) ";"
41 WHITESPACE@[40; 45) "\n " 41 WHITESPACE@[40; 45) "\n "
42 EXPR_STMT@[45; 52) 42 EXPR_STMT@[45; 52)
43 ARRAY_EXPR@[45; 51) 43 ARRAY_EXPR@[45; 51)
44 L_BRACK@[45; 46) "[" 44 L_BRACK@[45; 46) "["
45 LITERAL@[46; 47) 45 LITERAL@[46; 47)
46 INT_NUMBER@[46; 47) "1" 46 INT_NUMBER@[46; 47) "1"
47 SEMI@[47; 48) ";" 47 SEMICOLON@[47; 48) ";"
48 WHITESPACE@[48; 49) " " 48 WHITESPACE@[48; 49) " "
49 LITERAL@[49; 50) 49 LITERAL@[49; 50)
50 INT_NUMBER@[49; 50) "2" 50 INT_NUMBER@[49; 50) "2"
51 R_BRACK@[50; 51) "]" 51 R_BRACK@[50; 51) "]"
52 SEMI@[51; 52) ";" 52 SEMICOLON@[51; 52) ";"
53 WHITESPACE@[52; 53) "\n" 53 WHITESPACE@[52; 53) "\n"
54 R_CURLY@[53; 54) "}" 54 R_CURLY@[53; 54) "}"
55 WHITESPACE@[54; 55) "\n" 55 WHITESPACE@[54; 55) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast b/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast
index a983d5954..d65c75c65 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast
@@ -37,5 +37,5 @@ SOURCE_FILE@[0; 29)
37 L_PAREN@[24; 25) "(" 37 L_PAREN@[24; 25) "("
38 R_PAREN@[25; 26) ")" 38 R_PAREN@[25; 26) ")"
39 R_ANGLE@[26; 27) ">" 39 R_ANGLE@[26; 27) ">"
40 SEMI@[27; 28) ";" 40 SEMICOLON@[27; 28) ";"
41 WHITESPACE@[28; 29) "\n" 41 WHITESPACE@[28; 29) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast
index 6bce37a4f..5635cba9b 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast
@@ -17,7 +17,7 @@ SOURCE_FILE@[0; 52)
17 BLOCK@[15; 17) 17 BLOCK@[15; 17)
18 L_CURLY@[15; 16) "{" 18 L_CURLY@[15; 16) "{"
19 R_CURLY@[16; 17) "}" 19 R_CURLY@[16; 17) "}"
20 SEMI@[17; 18) ";" 20 SEMICOLON@[17; 18) ";"
21 WHITESPACE@[18; 23) "\n " 21 WHITESPACE@[18; 23) "\n "
22 EXPR_STMT@[23; 33) 22 EXPR_STMT@[23; 33)
23 BLOCK_EXPR@[23; 32) 23 BLOCK_EXPR@[23; 32)
@@ -26,7 +26,7 @@ SOURCE_FILE@[0; 52)
26 BLOCK@[30; 32) 26 BLOCK@[30; 32)
27 L_CURLY@[30; 31) "{" 27 L_CURLY@[30; 31) "{"
28 R_CURLY@[31; 32) "}" 28 R_CURLY@[31; 32) "}"
29 SEMI@[32; 33) ";" 29 SEMICOLON@[32; 33) ";"
30 WHITESPACE@[33; 38) "\n " 30 WHITESPACE@[33; 38) "\n "
31 EXPR_STMT@[38; 49) 31 EXPR_STMT@[38; 49)
32 BLOCK_EXPR@[38; 48) 32 BLOCK_EXPR@[38; 48)
@@ -37,7 +37,7 @@ SOURCE_FILE@[0; 52)
37 BLOCK@[46; 48) 37 BLOCK@[46; 48)
38 L_CURLY@[46; 47) "{" 38 L_CURLY@[46; 47) "{"
39 R_CURLY@[47; 48) "}" 39 R_CURLY@[47; 48) "}"
40 SEMI@[48; 49) ";" 40 SEMICOLON@[48; 49) ";"
41 WHITESPACE@[49; 50) "\n" 41 WHITESPACE@[49; 50) "\n"
42 R_CURLY@[50; 51) "}" 42 R_CURLY@[50; 51) "}"
43 WHITESPACE@[51; 52) "\n" 43 WHITESPACE@[51; 52) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
index 0216123f0..157dfcdb8 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 134)
21 TUPLE_EXPR@[18; 20) 21 TUPLE_EXPR@[18; 20)
22 L_PAREN@[18; 19) "(" 22 L_PAREN@[18; 19) "("
23 R_PAREN@[19; 20) ")" 23 R_PAREN@[19; 20) ")"
24 SEMI@[20; 21) ";" 24 SEMICOLON@[20; 21) ";"
25 WHITESPACE@[21; 26) "\n " 25 WHITESPACE@[21; 26) "\n "
26 EXPR_STMT@[26; 43) 26 EXPR_STMT@[26; 43)
27 LAMBDA_EXPR@[26; 42) 27 LAMBDA_EXPR@[26; 42)
@@ -46,7 +46,7 @@ SOURCE_FILE@[0; 134)
46 INT_NUMBER@[38; 40) "92" 46 INT_NUMBER@[38; 40) "92"
47 WHITESPACE@[40; 41) " " 47 WHITESPACE@[40; 41) " "
48 R_CURLY@[41; 42) "}" 48 R_CURLY@[41; 42) "}"
49 SEMI@[42; 43) ";" 49 SEMICOLON@[42; 43) ";"
50 WHITESPACE@[43; 48) "\n " 50 WHITESPACE@[43; 48) "\n "
51 EXPR_STMT@[48; 54) 51 EXPR_STMT@[48; 54)
52 LAMBDA_EXPR@[48; 53) 52 LAMBDA_EXPR@[48; 53)
@@ -63,7 +63,7 @@ SOURCE_FILE@[0; 134)
63 PATH_SEGMENT@[52; 53) 63 PATH_SEGMENT@[52; 53)
64 NAME_REF@[52; 53) 64 NAME_REF@[52; 53)
65 IDENT@[52; 53) "x" 65 IDENT@[52; 53) "x"
66 SEMI@[53; 54) ";" 66 SEMICOLON@[53; 54) ";"
67 WHITESPACE@[54; 59) "\n " 67 WHITESPACE@[54; 59) "\n "
68 EXPR_STMT@[59; 76) 68 EXPR_STMT@[59; 76)
69 LAMBDA_EXPR@[59; 75) 69 LAMBDA_EXPR@[59; 75)
@@ -90,7 +90,7 @@ SOURCE_FILE@[0; 134)
90 PATH_SEGMENT@[74; 75) 90 PATH_SEGMENT@[74; 75)
91 NAME_REF@[74; 75) 91 NAME_REF@[74; 75)
92 IDENT@[74; 75) "x" 92 IDENT@[74; 75) "x"
93 SEMI@[75; 76) ";" 93 SEMICOLON@[75; 76) ";"
94 WHITESPACE@[76; 81) "\n " 94 WHITESPACE@[76; 81) "\n "
95 EXPR_STMT@[81; 93) 95 EXPR_STMT@[81; 93)
96 LAMBDA_EXPR@[81; 92) 96 LAMBDA_EXPR@[81; 92)
@@ -104,7 +104,7 @@ SOURCE_FILE@[0; 134)
104 BLOCK@[90; 92) 104 BLOCK@[90; 92)
105 L_CURLY@[90; 91) "{" 105 L_CURLY@[90; 91) "{"
106 R_CURLY@[91; 92) "}" 106 R_CURLY@[91; 92) "}"
107 SEMI@[92; 93) ";" 107 SEMICOLON@[92; 93) ";"
108 WHITESPACE@[93; 98) "\n " 108 WHITESPACE@[93; 98) "\n "
109 EXPR_STMT@[98; 109) 109 EXPR_STMT@[98; 109)
110 LAMBDA_EXPR@[98; 108) 110 LAMBDA_EXPR@[98; 108)
@@ -118,7 +118,7 @@ SOURCE_FILE@[0; 134)
118 BLOCK@[106; 108) 118 BLOCK@[106; 108)
119 L_CURLY@[106; 107) "{" 119 L_CURLY@[106; 107) "{"
120 R_CURLY@[107; 108) "}" 120 R_CURLY@[107; 108) "}"
121 SEMI@[108; 109) ";" 121 SEMICOLON@[108; 109) ";"
122 WHITESPACE@[109; 114) "\n " 122 WHITESPACE@[109; 114) "\n "
123 EXPR_STMT@[114; 131) 123 EXPR_STMT@[114; 131)
124 LAMBDA_EXPR@[114; 130) 124 LAMBDA_EXPR@[114; 130)
@@ -134,7 +134,7 @@ SOURCE_FILE@[0; 134)
134 BLOCK@[128; 130) 134 BLOCK@[128; 130)
135 L_CURLY@[128; 129) "{" 135 L_CURLY@[128; 129) "{"
136 R_CURLY@[129; 130) "}" 136 R_CURLY@[129; 130) "}"
137 SEMI@[130; 131) ";" 137 SEMICOLON@[130; 131) ";"
138 WHITESPACE@[131; 132) "\n" 138 WHITESPACE@[131; 132) "\n"
139 R_CURLY@[132; 133) "}" 139 R_CURLY@[132; 133) "}"
140 WHITESPACE@[133; 134) "\n" 140 WHITESPACE@[133; 134) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast
index ba478528c..cc813038c 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 49)
25 ARG_LIST@[20; 22) 25 ARG_LIST@[20; 22)
26 L_PAREN@[20; 21) "(" 26 L_PAREN@[20; 21) "("
27 R_PAREN@[21; 22) ")" 27 R_PAREN@[21; 22) ")"
28 SEMI@[22; 23) ";" 28 SEMICOLON@[22; 23) ";"
29 WHITESPACE@[23; 28) "\n " 29 WHITESPACE@[23; 28) "\n "
30 EXPR_STMT@[28; 46) 30 EXPR_STMT@[28; 46)
31 METHOD_CALL_EXPR@[28; 45) 31 METHOD_CALL_EXPR@[28; 45)
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 49)
38 NAME_REF@[30; 33) 38 NAME_REF@[30; 33)
39 IDENT@[30; 33) "bar" 39 IDENT@[30; 33) "bar"
40 TYPE_ARG_LIST@[33; 38) 40 TYPE_ARG_LIST@[33; 38)
41 COLONCOLON@[33; 35) "::" 41 COLON2@[33; 35) "::"
42 L_ANGLE@[35; 36) "<" 42 L_ANGLE@[35; 36) "<"
43 TYPE_ARG@[36; 37) 43 TYPE_ARG@[36; 37)
44 PATH_TYPE@[36; 37) 44 PATH_TYPE@[36; 37)
@@ -57,7 +57,7 @@ SOURCE_FILE@[0; 49)
57 INT_NUMBER@[42; 43) "2" 57 INT_NUMBER@[42; 43) "2"
58 COMMA@[43; 44) "," 58 COMMA@[43; 44) ","
59 R_PAREN@[44; 45) ")" 59 R_PAREN@[44; 45) ")"
60 SEMI@[45; 46) ";" 60 SEMICOLON@[45; 46) ";"
61 WHITESPACE@[46; 47) "\n" 61 WHITESPACE@[46; 47) "\n"
62 R_CURLY@[47; 48) "}" 62 R_CURLY@[47; 48) "}"
63 WHITESPACE@[48; 49) "\n" 63 WHITESPACE@[48; 49) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast
index 6f685ca8d..27c3f398e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast
@@ -16,7 +16,7 @@ SOURCE_FILE@[0; 40)
16 TUPLE_EXPR@[15; 17) 16 TUPLE_EXPR@[15; 17)
17 L_PAREN@[15; 16) "(" 17 L_PAREN@[15; 16) "("
18 R_PAREN@[16; 17) ")" 18 R_PAREN@[16; 17) ")"
19 SEMI@[17; 18) ";" 19 SEMICOLON@[17; 18) ";"
20 WHITESPACE@[18; 23) "\n " 20 WHITESPACE@[18; 23) "\n "
21 EXPR_STMT@[23; 27) 21 EXPR_STMT@[23; 27)
22 PAREN_EXPR@[23; 26) 22 PAREN_EXPR@[23; 26)
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 40)
24 LITERAL@[24; 25) 24 LITERAL@[24; 25)
25 INT_NUMBER@[24; 25) "1" 25 INT_NUMBER@[24; 25) "1"
26 R_PAREN@[25; 26) ")" 26 R_PAREN@[25; 26) ")"
27 SEMI@[26; 27) ";" 27 SEMICOLON@[26; 27) ";"
28 WHITESPACE@[27; 32) "\n " 28 WHITESPACE@[27; 32) "\n "
29 EXPR_STMT@[32; 37) 29 EXPR_STMT@[32; 37)
30 TUPLE_EXPR@[32; 36) 30 TUPLE_EXPR@[32; 36)
@@ -33,7 +33,7 @@ SOURCE_FILE@[0; 40)
33 INT_NUMBER@[33; 34) "1" 33 INT_NUMBER@[33; 34) "1"
34 COMMA@[34; 35) "," 34 COMMA@[34; 35) ","
35 R_PAREN@[35; 36) ")" 35 R_PAREN@[35; 36) ")"
36 SEMI@[36; 37) ";" 36 SEMICOLON@[36; 37) ";"
37 WHITESPACE@[37; 38) "\n" 37 WHITESPACE@[37; 38) "\n"
38 R_CURLY@[38; 39) "}" 38 R_CURLY@[38; 39) "}"
39 WHITESPACE@[39; 40) "\n" 39 WHITESPACE@[39; 40) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0110_use_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0110_use_path.rast
index 7dbcd3927..d4f5737d5 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0110_use_path.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0110_use_path.rast
@@ -5,10 +5,10 @@ SOURCE_FILE@[0; 154)
5 USE_TREE@[4; 16) 5 USE_TREE@[4; 16)
6 PATH@[4; 16) 6 PATH@[4; 16)
7 PATH_SEGMENT@[4; 16) 7 PATH_SEGMENT@[4; 16)
8 COLONCOLON@[4; 6) "::" 8 COLON2@[4; 6) "::"
9 NAME_REF@[6; 16) 9 NAME_REF@[6; 16)
10 IDENT@[6; 16) "crate_name" 10 IDENT@[6; 16) "crate_name"
11 SEMI@[16; 17) ";" 11 SEMICOLON@[16; 17) ";"
12 WHITESPACE@[17; 18) " " 12 WHITESPACE@[17; 18) " "
13 COMMENT@[18; 45) "// Rust 2018 - All fl ..." 13 COMMENT@[18; 45) "// Rust 2018 - All fl ..."
14 WHITESPACE@[45; 46) "\n" 14 WHITESPACE@[45; 46) "\n"
@@ -20,7 +20,7 @@ SOURCE_FILE@[0; 154)
20 PATH_SEGMENT@[50; 60) 20 PATH_SEGMENT@[50; 60)
21 NAME_REF@[50; 60) 21 NAME_REF@[50; 60)
22 IDENT@[50; 60) "crate_name" 22 IDENT@[50; 60) "crate_name"
23 SEMI@[60; 61) ";" 23 SEMICOLON@[60; 61) ";"
24 WHITESPACE@[61; 62) " " 24 WHITESPACE@[61; 62) " "
25 COMMENT@[62; 91) "// Rust 2018 - Anchor ..." 25 COMMENT@[62; 91) "// Rust 2018 - Anchor ..."
26 WHITESPACE@[91; 92) "\n" 26 WHITESPACE@[91; 92) "\n"
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 154)
32 PATH_SEGMENT@[96; 123) 32 PATH_SEGMENT@[96; 123)
33 NAME_REF@[96; 123) 33 NAME_REF@[96; 123)
34 IDENT@[96; 123) "item_in_scope_or_crat ..." 34 IDENT@[96; 123) "item_in_scope_or_crat ..."
35 SEMI@[123; 124) ";" 35 SEMICOLON@[123; 124) ";"
36 WHITESPACE@[124; 125) " " 36 WHITESPACE@[124; 125) " "
37 COMMENT@[125; 153) "// Rust 2018 - Unifor ..." 37 COMMENT@[125; 153) "// Rust 2018 - Unifor ..."
38 WHITESPACE@[153; 154) "\n" 38 WHITESPACE@[153; 154) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast
index 4680c267e..88e72d057 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 94)
28 COMMA@[25; 26) "," 28 COMMA@[25; 26) ","
29 WHITESPACE@[26; 27) " " 29 WHITESPACE@[26; 27) " "
30 DOT_DOT_PAT@[27; 29) 30 DOT_DOT_PAT@[27; 29)
31 DOTDOT@[27; 29) ".." 31 DOT2@[27; 29) ".."
32 R_PAREN@[29; 30) ")" 32 R_PAREN@[29; 30) ")"
33 WHITESPACE@[30; 31) " " 33 WHITESPACE@[30; 31) " "
34 EQ@[31; 32) "=" 34 EQ@[31; 32) "="
@@ -36,7 +36,7 @@ SOURCE_FILE@[0; 94)
36 TUPLE_EXPR@[33; 35) 36 TUPLE_EXPR@[33; 35)
37 L_PAREN@[33; 34) "(" 37 L_PAREN@[33; 34) "("
38 R_PAREN@[34; 35) ")" 38 R_PAREN@[34; 35) ")"
39 SEMI@[35; 36) ";" 39 SEMICOLON@[35; 36) ";"
40 WHITESPACE@[36; 41) "\n " 40 WHITESPACE@[36; 41) "\n "
41 LET_STMT@[41; 55) 41 LET_STMT@[41; 55)
42 LET_KW@[41; 44) "let" 42 LET_KW@[41; 44) "let"
@@ -54,7 +54,7 @@ SOURCE_FILE@[0; 94)
54 TUPLE_EXPR@[52; 54) 54 TUPLE_EXPR@[52; 54)
55 L_PAREN@[52; 53) "(" 55 L_PAREN@[52; 53) "("
56 R_PAREN@[53; 54) ")" 56 R_PAREN@[53; 54) ")"
57 SEMI@[54; 55) ";" 57 SEMICOLON@[54; 55) ";"
58 WHITESPACE@[55; 60) "\n " 58 WHITESPACE@[55; 60) "\n "
59 LET_STMT@[60; 74) 59 LET_STMT@[60; 74)
60 LET_KW@[60; 63) "let" 60 LET_KW@[60; 63) "let"
@@ -62,7 +62,7 @@ SOURCE_FILE@[0; 94)
62 TUPLE_PAT@[64; 68) 62 TUPLE_PAT@[64; 68)
63 L_PAREN@[64; 65) "(" 63 L_PAREN@[64; 65) "("
64 DOT_DOT_PAT@[65; 67) 64 DOT_DOT_PAT@[65; 67)
65 DOTDOT@[65; 67) ".." 65 DOT2@[65; 67) ".."
66 R_PAREN@[67; 68) ")" 66 R_PAREN@[67; 68) ")"
67 WHITESPACE@[68; 69) " " 67 WHITESPACE@[68; 69) " "
68 EQ@[69; 70) "=" 68 EQ@[69; 70) "="
@@ -70,7 +70,7 @@ SOURCE_FILE@[0; 94)
70 TUPLE_EXPR@[71; 73) 70 TUPLE_EXPR@[71; 73)
71 L_PAREN@[71; 72) "(" 71 L_PAREN@[71; 72) "("
72 R_PAREN@[72; 73) ")" 72 R_PAREN@[72; 73) ")"
73 SEMI@[73; 74) ";" 73 SEMICOLON@[73; 74) ";"
74 WHITESPACE@[74; 79) "\n " 74 WHITESPACE@[74; 79) "\n "
75 LET_STMT@[79; 91) 75 LET_STMT@[79; 91)
76 LET_KW@[79; 82) "let" 76 LET_KW@[79; 82) "let"
@@ -84,7 +84,7 @@ SOURCE_FILE@[0; 94)
84 TUPLE_EXPR@[88; 90) 84 TUPLE_EXPR@[88; 90)
85 L_PAREN@[88; 89) "(" 85 L_PAREN@[88; 89) "("
86 R_PAREN@[89; 90) ")" 86 R_PAREN@[89; 90) ")"
87 SEMI@[90; 91) ";" 87 SEMICOLON@[90; 91) ";"
88 WHITESPACE@[91; 92) "\n" 88 WHITESPACE@[91; 92) "\n"
89 R_CURLY@[92; 93) "}" 89 R_CURLY@[92; 93) "}"
90 WHITESPACE@[93; 94) "\n" 90 WHITESPACE@[93; 94) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast
index ad1d47b0e..5e8f625dc 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 146)
24 TUPLE_EXPR@[24; 26) 24 TUPLE_EXPR@[24; 26)
25 L_PAREN@[24; 25) "(" 25 L_PAREN@[24; 25) "("
26 R_PAREN@[25; 26) ")" 26 R_PAREN@[25; 26) ")"
27 SEMI@[26; 27) ";" 27 SEMICOLON@[26; 27) ";"
28 WHITESPACE@[27; 32) "\n " 28 WHITESPACE@[27; 32) "\n "
29 LET_STMT@[32; 47) 29 LET_STMT@[32; 47)
30 LET_KW@[32; 35) "let" 30 LET_KW@[32; 35) "let"
@@ -40,7 +40,7 @@ SOURCE_FILE@[0; 146)
40 TUPLE_EXPR@[44; 46) 40 TUPLE_EXPR@[44; 46)
41 L_PAREN@[44; 45) "(" 41 L_PAREN@[44; 45) "("
42 R_PAREN@[45; 46) ")" 42 R_PAREN@[45; 46) ")"
43 SEMI@[46; 47) ";" 43 SEMICOLON@[46; 47) ";"
44 WHITESPACE@[47; 52) "\n " 44 WHITESPACE@[47; 52) "\n "
45 LET_STMT@[52; 67) 45 LET_STMT@[52; 67)
46 LET_KW@[52; 55) "let" 46 LET_KW@[52; 55) "let"
@@ -56,7 +56,7 @@ SOURCE_FILE@[0; 146)
56 TUPLE_EXPR@[64; 66) 56 TUPLE_EXPR@[64; 66)
57 L_PAREN@[64; 65) "(" 57 L_PAREN@[64; 65) "("
58 R_PAREN@[65; 66) ")" 58 R_PAREN@[65; 66) ")"
59 SEMI@[66; 67) ";" 59 SEMICOLON@[66; 67) ";"
60 WHITESPACE@[67; 72) "\n " 60 WHITESPACE@[67; 72) "\n "
61 LET_STMT@[72; 91) 61 LET_STMT@[72; 91)
62 LET_KW@[72; 75) "let" 62 LET_KW@[72; 75) "let"
@@ -74,7 +74,7 @@ SOURCE_FILE@[0; 146)
74 TUPLE_EXPR@[88; 90) 74 TUPLE_EXPR@[88; 90)
75 L_PAREN@[88; 89) "(" 75 L_PAREN@[88; 89) "("
76 R_PAREN@[89; 90) ")" 76 R_PAREN@[89; 90) ")"
77 SEMI@[90; 91) ";" 77 SEMICOLON@[90; 91) ";"
78 WHITESPACE@[91; 96) "\n " 78 WHITESPACE@[91; 96) "\n "
79 LET_STMT@[96; 111) 79 LET_STMT@[96; 111)
80 LET_KW@[96; 99) "let" 80 LET_KW@[96; 99) "let"
@@ -93,7 +93,7 @@ SOURCE_FILE@[0; 146)
93 TUPLE_EXPR@[108; 110) 93 TUPLE_EXPR@[108; 110)
94 L_PAREN@[108; 109) "(" 94 L_PAREN@[108; 109) "("
95 R_PAREN@[109; 110) ")" 95 R_PAREN@[109; 110) ")"
96 SEMI@[110; 111) ";" 96 SEMICOLON@[110; 111) ";"
97 WHITESPACE@[111; 116) "\n " 97 WHITESPACE@[111; 116) "\n "
98 LET_STMT@[116; 143) 98 LET_STMT@[116; 143)
99 LET_KW@[116; 119) "let" 99 LET_KW@[116; 119) "let"
@@ -122,7 +122,7 @@ SOURCE_FILE@[0; 146)
122 TUPLE_EXPR@[140; 142) 122 TUPLE_EXPR@[140; 142)
123 L_PAREN@[140; 141) "(" 123 L_PAREN@[140; 141) "("
124 R_PAREN@[141; 142) ")" 124 R_PAREN@[141; 142) ")"
125 SEMI@[142; 143) ";" 125 SEMICOLON@[142; 143) ";"
126 WHITESPACE@[143; 144) "\n" 126 WHITESPACE@[143; 144) "\n"
127 R_CURLY@[144; 145) "}" 127 R_CURLY@[144; 145) "}"
128 WHITESPACE@[145; 146) "\n" 128 WHITESPACE@[145; 146) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast
index 5db1ff2af..f2f649410 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast
@@ -11,9 +11,9 @@ SOURCE_FILE@[0; 50)
11 BLOCK@[8; 49) 11 BLOCK@[8; 49)
12 L_CURLY@[8; 9) "{" 12 L_CURLY@[8; 9) "{"
13 WHITESPACE@[9; 14) "\n " 13 WHITESPACE@[9; 14) "\n "
14 SEMI@[14; 15) ";" 14 SEMICOLON@[14; 15) ";"
15 SEMI@[15; 16) ";" 15 SEMICOLON@[15; 16) ";"
16 SEMI@[16; 17) ";" 16 SEMICOLON@[16; 17) ";"
17 EXPR_STMT@[17; 29) 17 EXPR_STMT@[17; 29)
18 CALL_EXPR@[17; 28) 18 CALL_EXPR@[17; 28)
19 PATH_EXPR@[17; 26) 19 PATH_EXPR@[17; 26)
@@ -24,22 +24,22 @@ SOURCE_FILE@[0; 50)
24 ARG_LIST@[26; 28) 24 ARG_LIST@[26; 28)
25 L_PAREN@[26; 27) "(" 25 L_PAREN@[26; 27) "("
26 R_PAREN@[27; 28) ")" 26 R_PAREN@[27; 28) ")"
27 SEMI@[28; 29) ";" 27 SEMICOLON@[28; 29) ";"
28 SEMI@[29; 30) ";" 28 SEMICOLON@[29; 30) ";"
29 SEMI@[30; 31) ";" 29 SEMICOLON@[30; 31) ";"
30 SEMI@[31; 32) ";" 30 SEMICOLON@[31; 32) ";"
31 EXPR_STMT@[32; 38) 31 EXPR_STMT@[32; 38)
32 BLOCK_EXPR@[32; 37) 32 BLOCK_EXPR@[32; 37)
33 BLOCK@[32; 37) 33 BLOCK@[32; 37)
34 L_CURLY@[32; 33) "{" 34 L_CURLY@[32; 33) "{"
35 SEMI@[33; 34) ";" 35 SEMICOLON@[33; 34) ";"
36 SEMI@[34; 35) ";" 36 SEMICOLON@[34; 35) ";"
37 SEMI@[35; 36) ";" 37 SEMICOLON@[35; 36) ";"
38 R_CURLY@[36; 37) "}" 38 R_CURLY@[36; 37) "}"
39 SEMI@[37; 38) ";" 39 SEMICOLON@[37; 38) ";"
40 SEMI@[38; 39) ";" 40 SEMICOLON@[38; 39) ";"
41 SEMI@[39; 40) ";" 41 SEMICOLON@[39; 40) ";"
42 SEMI@[40; 41) ";" 42 SEMICOLON@[40; 41) ";"
43 CALL_EXPR@[41; 47) 43 CALL_EXPR@[41; 47)
44 PATH_EXPR@[41; 43) 44 PATH_EXPR@[41; 43)
45 PATH@[41; 43) 45 PATH@[41; 43)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast
index f5de01405..457c82e74 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 53)
38 PATH_SEGMENT@[27; 32) 38 PATH_SEGMENT@[27; 32)
39 NAME_REF@[27; 32) 39 NAME_REF@[27; 32)
40 IDENT@[27; 32) "Clone" 40 IDENT@[27; 32) "Clone"
41 SEMI@[32; 33) ";" 41 SEMICOLON@[32; 33) ";"
42 WHITESPACE@[33; 34) "\n" 42 WHITESPACE@[33; 34) "\n"
43 STRUCT_DEF@[34; 52) 43 STRUCT_DEF@[34; 52)
44 STRUCT_KW@[34; 40) "struct" 44 STRUCT_KW@[34; 40) "struct"
@@ -60,5 +60,5 @@ SOURCE_FILE@[0; 53)
60 NAME_REF@[49; 50) 60 NAME_REF@[49; 50)
61 IDENT@[49; 50) "T" 61 IDENT@[49; 50) "T"
62 R_PAREN@[50; 51) ")" 62 R_PAREN@[50; 51) ")"
63 SEMI@[51; 52) ";" 63 SEMICOLON@[51; 52) ";"
64 WHITESPACE@[52; 53) "\n" 64 WHITESPACE@[52; 53) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast
index 8fe15d8e2..0b1552a9d 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast
@@ -37,5 +37,5 @@ SOURCE_FILE@[0; 60)
37 COMMA@[55; 56) "," 37 COMMA@[55; 56) ","
38 WHITESPACE@[56; 57) "\n" 38 WHITESPACE@[56; 57) "\n"
39 R_PAREN@[57; 58) ")" 39 R_PAREN@[57; 58) ")"
40 SEMI@[58; 59) ";" 40 SEMICOLON@[58; 59) ";"
41 WHITESPACE@[59; 60) "\n" 41 WHITESPACE@[59; 60) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast
index 892dc813a..4f9e80e2e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast
@@ -12,11 +12,11 @@ SOURCE_FILE@[0; 41)
12 PATH_SEGMENT@[9; 12) 12 PATH_SEGMENT@[9; 12)
13 NAME_REF@[9; 12) 13 NAME_REF@[9; 12)
14 IDENT@[9; 12) "foo" 14 IDENT@[9; 12) "foo"
15 EXCL@[12; 13) "!" 15 BANG@[12; 13) "!"
16 TOKEN_TREE@[13; 15) 16 TOKEN_TREE@[13; 15)
17 L_PAREN@[13; 14) "(" 17 L_PAREN@[13; 14) "("
18 R_PAREN@[14; 15) ")" 18 R_PAREN@[14; 15) ")"
19 SEMI@[15; 16) ";" 19 SEMICOLON@[15; 16) ";"
20 WHITESPACE@[16; 17) "\n" 20 WHITESPACE@[16; 17) "\n"
21 TYPE_ALIAS_DEF@[17; 40) 21 TYPE_ALIAS_DEF@[17; 40)
22 TYPE_KW@[17; 21) "type" 22 TYPE_KW@[17; 21) "type"
@@ -31,13 +31,13 @@ SOURCE_FILE@[0; 41)
31 PATH@[26; 31) 31 PATH@[26; 31)
32 PATH_SEGMENT@[26; 31) 32 PATH_SEGMENT@[26; 31)
33 CRATE_KW@[26; 31) "crate" 33 CRATE_KW@[26; 31) "crate"
34 COLONCOLON@[31; 33) "::" 34 COLON2@[31; 33) "::"
35 PATH_SEGMENT@[33; 36) 35 PATH_SEGMENT@[33; 36)
36 NAME_REF@[33; 36) 36 NAME_REF@[33; 36)
37 IDENT@[33; 36) "foo" 37 IDENT@[33; 36) "foo"
38 EXCL@[36; 37) "!" 38 BANG@[36; 37) "!"
39 TOKEN_TREE@[37; 39) 39 TOKEN_TREE@[37; 39)
40 L_PAREN@[37; 38) "(" 40 L_PAREN@[37; 38) "("
41 R_PAREN@[38; 39) ")" 41 R_PAREN@[38; 39) ")"
42 SEMI@[39; 40) ";" 42 SEMICOLON@[39; 40) ";"
43 WHITESPACE@[40; 41) "\n" 43 WHITESPACE@[40; 41) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
index 5053ebde7..f9a4bc81b 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 94)
24 WHITESPACE@[48; 54) "\n " 24 WHITESPACE@[48; 54) "\n "
25 ATTR@[54; 91) 25 ATTR@[54; 91)
26 POUND@[54; 55) "#" 26 POUND@[54; 55) "#"
27 EXCL@[55; 56) "!" 27 BANG@[55; 56) "!"
28 L_BRACK@[56; 57) "[" 28 L_BRACK@[56; 57) "["
29 PATH@[57; 60) 29 PATH@[57; 60)
30 PATH_SEGMENT@[57; 60) 30 PATH_SEGMENT@[57; 60)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast b/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast
index 640e0640f..7eec92e1b 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 139)
24 WHITESPACE@[25; 34) "\n " 24 WHITESPACE@[25; 34) "\n "
25 ATTR@[34; 60) 25 ATTR@[34; 60)
26 POUND@[34; 35) "#" 26 POUND@[34; 35) "#"
27 EXCL@[35; 36) "!" 27 BANG@[35; 36) "!"
28 L_BRACK@[36; 37) "[" 28 L_BRACK@[36; 37) "["
29 PATH@[37; 40) 29 PATH@[37; 40)
30 PATH_SEGMENT@[37; 40) 30 PATH_SEGMENT@[37; 40)
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 139)
38 WHITESPACE@[60; 69) "\n " 38 WHITESPACE@[60; 69) "\n "
39 ATTR@[69; 86) 39 ATTR@[69; 86)
40 POUND@[69; 70) "#" 40 POUND@[69; 70) "#"
41 EXCL@[70; 71) "!" 41 BANG@[70; 71) "!"
42 L_BRACK@[71; 72) "[" 42 L_BRACK@[71; 72) "["
43 PATH@[72; 75) 43 PATH@[72; 75)
44 PATH_SEGMENT@[72; 75) 44 PATH_SEGMENT@[72; 75)
@@ -52,7 +52,7 @@ SOURCE_FILE@[0; 139)
52 WHITESPACE@[86; 95) "\n " 52 WHITESPACE@[86; 95) "\n "
53 ATTR@[95; 113) 53 ATTR@[95; 113)
54 POUND@[95; 96) "#" 54 POUND@[95; 96) "#"
55 EXCL@[96; 97) "!" 55 BANG@[96; 97) "!"
56 L_BRACK@[97; 98) "[" 56 L_BRACK@[97; 98) "["
57 PATH@[98; 101) 57 PATH@[98; 101)
58 PATH_SEGMENT@[98; 101) 58 PATH_SEGMENT@[98; 101)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast
index 6c3b17868..af8067b12 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast
@@ -33,7 +33,7 @@ SOURCE_FILE@[0; 57)
33 COMMA@[40; 41) "," 33 COMMA@[40; 41) ","
34 WHITESPACE@[41; 42) " " 34 WHITESPACE@[41; 42) " "
35 PARAM@[42; 45) 35 PARAM@[42; 45)
36 DOTDOTDOT@[42; 45) "..." 36 DOT3@[42; 45) "..."
37 R_PAREN@[45; 46) ")" 37 R_PAREN@[45; 46) ")"
38 WHITESPACE@[46; 47) " " 38 WHITESPACE@[46; 47) " "
39 RET_TYPE@[47; 53) 39 RET_TYPE@[47; 53)
@@ -44,7 +44,7 @@ SOURCE_FILE@[0; 57)
44 PATH_SEGMENT@[50; 53) 44 PATH_SEGMENT@[50; 53)
45 NAME_REF@[50; 53) 45 NAME_REF@[50; 53)
46 IDENT@[50; 53) "i32" 46 IDENT@[50; 53) "i32"
47 SEMI@[53; 54) ";" 47 SEMICOLON@[53; 54) ";"
48 WHITESPACE@[54; 55) " " 48 WHITESPACE@[54; 55) " "
49 R_CURLY@[55; 56) "}" 49 R_CURLY@[55; 56) "}"
50 WHITESPACE@[56; 57) "\n" 50 WHITESPACE@[56; 57) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast
index 6a9f3bf72..f1f4de976 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast
@@ -19,14 +19,14 @@ SOURCE_FILE@[0; 27)
19 PATH@[11; 16) 19 PATH@[11; 16)
20 PATH_SEGMENT@[11; 16) 20 PATH_SEGMENT@[11; 16)
21 CRATE_KW@[11; 16) "crate" 21 CRATE_KW@[11; 16) "crate"
22 COLONCOLON@[16; 18) "::" 22 COLON2@[16; 18) "::"
23 PATH_SEGMENT@[18; 21) 23 PATH_SEGMENT@[18; 21)
24 NAME_REF@[18; 21) 24 NAME_REF@[18; 21)
25 IDENT@[18; 21) "foo" 25 IDENT@[18; 21) "foo"
26 ARG_LIST@[21; 23) 26 ARG_LIST@[21; 23)
27 L_PAREN@[21; 22) "(" 27 L_PAREN@[21; 22) "("
28 R_PAREN@[22; 23) ")" 28 R_PAREN@[22; 23) ")"
29 SEMI@[23; 24) ";" 29 SEMICOLON@[23; 24) ";"
30 WHITESPACE@[24; 25) " " 30 WHITESPACE@[24; 25) " "
31 R_CURLY@[25; 26) "}" 31 R_CURLY@[25; 26) "}"
32 WHITESPACE@[26; 27) "\n" 32 WHITESPACE@[26; 27) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast b/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast
index 5c311d18a..3b462871a 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast
@@ -31,7 +31,7 @@ SOURCE_FILE@[0; 82)
31 ARG_LIST@[23; 25) 31 ARG_LIST@[23; 25)
32 L_PAREN@[23; 24) "(" 32 L_PAREN@[23; 24) "("
33 R_PAREN@[24; 25) ")" 33 R_PAREN@[24; 25) ")"
34 SEMI@[25; 26) ";" 34 SEMICOLON@[25; 26) ";"
35 WHITESPACE@[26; 31) "\n " 35 WHITESPACE@[26; 31) "\n "
36 EXPR_STMT@[31; 42) 36 EXPR_STMT@[31; 42)
37 ATTR@[31; 35) 37 ATTR@[31; 35)
@@ -48,7 +48,7 @@ SOURCE_FILE@[0; 82)
48 PATH_SEGMENT@[36; 39) 48 PATH_SEGMENT@[36; 39)
49 NAME_REF@[36; 39) 49 NAME_REF@[36; 39)
50 IDENT@[36; 39) "bar" 50 IDENT@[36; 39) "bar"
51 EXCL@[39; 40) "!" 51 BANG@[39; 40) "!"
52 TOKEN_TREE@[40; 42) 52 TOKEN_TREE@[40; 42)
53 L_CURLY@[40; 41) "{" 53 L_CURLY@[40; 41) "{"
54 R_CURLY@[41; 42) "}" 54 R_CURLY@[41; 42) "}"
@@ -93,7 +93,7 @@ SOURCE_FILE@[0; 82)
93 TUPLE_EXPR@[76; 78) 93 TUPLE_EXPR@[76; 78)
94 L_PAREN@[76; 77) "(" 94 L_PAREN@[76; 77) "("
95 R_PAREN@[77; 78) ")" 95 R_PAREN@[77; 78) ")"
96 SEMI@[78; 79) ";" 96 SEMICOLON@[78; 79) ";"
97 WHITESPACE@[79; 80) "\n" 97 WHITESPACE@[79; 80) "\n"
98 R_CURLY@[80; 81) "}" 98 R_CURLY@[80; 81) "}"
99 WHITESPACE@[81; 82) "\n" 99 WHITESPACE@[81; 82) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast
index 21f49690a..9bc6be62d 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 47)
32 PATH_SEGMENT@[22; 25) 32 PATH_SEGMENT@[22; 25)
33 NAME_REF@[22; 25) 33 NAME_REF@[22; 25)
34 IDENT@[22; 25) "bar" 34 IDENT@[22; 25) "bar"
35 EXCL@[25; 26) "!" 35 BANG@[25; 26) "!"
36 TOKEN_TREE@[26; 28) 36 TOKEN_TREE@[26; 28)
37 L_PAREN@[26; 27) "(" 37 L_PAREN@[26; 27) "("
38 R_PAREN@[27; 28) ")" 38 R_PAREN@[27; 28) ")"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast
index 36d8f4a5f..31481d2f9 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 33)
21 PATH_SEGMENT@[20; 21) 21 PATH_SEGMENT@[20; 21)
22 NAME_REF@[20; 21) 22 NAME_REF@[20; 21)
23 IDENT@[20; 21) "m" 23 IDENT@[20; 21) "m"
24 EXCL@[21; 22) "!" 24 BANG@[21; 22) "!"
25 TOKEN_TREE@[22; 25) 25 TOKEN_TREE@[22; 25)
26 L_PAREN@[22; 23) "(" 26 L_PAREN@[22; 23) "("
27 IDENT@[23; 24) "x" 27 IDENT@[23; 24) "x"
@@ -31,7 +31,7 @@ SOURCE_FILE@[0; 33)
31 WHITESPACE@[27; 28) " " 31 WHITESPACE@[27; 28) " "
32 LITERAL@[28; 29) 32 LITERAL@[28; 29)
33 INT_NUMBER@[28; 29) "0" 33 INT_NUMBER@[28; 29) "0"
34 SEMI@[29; 30) ";" 34 SEMICOLON@[29; 30) ";"
35 WHITESPACE@[30; 31) "\n" 35 WHITESPACE@[30; 31) "\n"
36 R_CURLY@[31; 32) "}" 36 R_CURLY@[31; 32) "}"
37 WHITESPACE@[32; 33) "\n" 37 WHITESPACE@[32; 33) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast
index 17739dfbd..1f2690c00 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast
@@ -18,7 +18,7 @@ SOURCE_FILE@[0; 135)
18 BIND_PAT@[19; 20) 18 BIND_PAT@[19; 20)
19 NAME@[19; 20) 19 NAME@[19; 20)
20 IDENT@[19; 20) "a" 20 IDENT@[19; 20) "a"
21 SEMI@[20; 21) ";" 21 SEMICOLON@[20; 21) ";"
22 WHITESPACE@[21; 26) "\n " 22 WHITESPACE@[21; 26) "\n "
23 LET_STMT@[26; 37) 23 LET_STMT@[26; 37)
24 LET_KW@[26; 29) "let" 24 LET_KW@[26; 29) "let"
@@ -33,7 +33,7 @@ SOURCE_FILE@[0; 135)
33 PATH_SEGMENT@[33; 36) 33 PATH_SEGMENT@[33; 36)
34 NAME_REF@[33; 36) 34 NAME_REF@[33; 36)
35 IDENT@[33; 36) "i32" 35 IDENT@[33; 36) "i32"
36 SEMI@[36; 37) ";" 36 SEMICOLON@[36; 37) ";"
37 WHITESPACE@[37; 42) "\n " 37 WHITESPACE@[37; 42) "\n "
38 LET_STMT@[42; 53) 38 LET_STMT@[42; 53)
39 LET_KW@[42; 45) "let" 39 LET_KW@[42; 45) "let"
@@ -46,7 +46,7 @@ SOURCE_FILE@[0; 135)
46 WHITESPACE@[49; 50) " " 46 WHITESPACE@[49; 50) " "
47 LITERAL@[50; 52) 47 LITERAL@[50; 52)
48 INT_NUMBER@[50; 52) "92" 48 INT_NUMBER@[50; 52) "92"
49 SEMI@[52; 53) ";" 49 SEMICOLON@[52; 53) ";"
50 WHITESPACE@[53; 58) "\n " 50 WHITESPACE@[53; 58) "\n "
51 LET_STMT@[58; 74) 51 LET_STMT@[58; 74)
52 LET_KW@[58; 61) "let" 52 LET_KW@[58; 61) "let"
@@ -66,7 +66,7 @@ SOURCE_FILE@[0; 135)
66 WHITESPACE@[70; 71) " " 66 WHITESPACE@[70; 71) " "
67 LITERAL@[71; 73) 67 LITERAL@[71; 73)
68 INT_NUMBER@[71; 73) "92" 68 INT_NUMBER@[71; 73) "92"
69 SEMI@[73; 74) ";" 69 SEMICOLON@[73; 74) ";"
70 WHITESPACE@[74; 79) "\n " 70 WHITESPACE@[74; 79) "\n "
71 LET_STMT@[79; 88) 71 LET_STMT@[79; 88)
72 LET_KW@[79; 82) "let" 72 LET_KW@[79; 82) "let"
@@ -77,8 +77,8 @@ SOURCE_FILE@[0; 135)
77 COLON@[84; 85) ":" 77 COLON@[84; 85) ":"
78 WHITESPACE@[85; 86) " " 78 WHITESPACE@[85; 86) " "
79 NEVER_TYPE@[86; 87) 79 NEVER_TYPE@[86; 87)
80 EXCL@[86; 87) "!" 80 BANG@[86; 87) "!"
81 SEMI@[87; 88) ";" 81 SEMICOLON@[87; 88) ";"
82 WHITESPACE@[88; 93) "\n " 82 WHITESPACE@[88; 93) "\n "
83 LET_STMT@[93; 107) 83 LET_STMT@[93; 107)
84 LET_KW@[93; 96) "let" 84 LET_KW@[93; 96) "let"
@@ -88,7 +88,7 @@ SOURCE_FILE@[0; 135)
88 COLON@[98; 99) ":" 88 COLON@[98; 99) ":"
89 WHITESPACE@[99; 100) " " 89 WHITESPACE@[99; 100) " "
90 NEVER_TYPE@[100; 101) 90 NEVER_TYPE@[100; 101)
91 EXCL@[100; 101) "!" 91 BANG@[100; 101) "!"
92 WHITESPACE@[101; 102) " " 92 WHITESPACE@[101; 102) " "
93 EQ@[102; 103) "=" 93 EQ@[102; 103) "="
94 WHITESPACE@[103; 104) " " 94 WHITESPACE@[103; 104) " "
@@ -96,7 +96,7 @@ SOURCE_FILE@[0; 135)
96 BLOCK@[104; 106) 96 BLOCK@[104; 106)
97 L_CURLY@[104; 105) "{" 97 L_CURLY@[104; 105) "{"
98 R_CURLY@[105; 106) "}" 98 R_CURLY@[105; 106) "}"
99 SEMI@[106; 107) ";" 99 SEMICOLON@[106; 107) ";"
100 WHITESPACE@[107; 112) "\n " 100 WHITESPACE@[107; 112) "\n "
101 LET_STMT@[112; 132) 101 LET_STMT@[112; 132)
102 LET_KW@[112; 115) "let" 102 LET_KW@[112; 115) "let"
@@ -123,7 +123,7 @@ SOURCE_FILE@[0; 135)
123 BLOCK@[129; 131) 123 BLOCK@[129; 131)
124 L_CURLY@[129; 130) "{" 124 L_CURLY@[129; 130) "{"
125 R_CURLY@[130; 131) "}" 125 R_CURLY@[130; 131) "}"
126 SEMI@[131; 132) ";" 126 SEMICOLON@[131; 132) ";"
127 WHITESPACE@[132; 133) "\n" 127 WHITESPACE@[132; 133) "\n"
128 R_CURLY@[133; 134) "}" 128 R_CURLY@[133; 134) "}"
129 WHITESPACE@[134; 135) "\n" 129 WHITESPACE@[134; 135) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast
index d6df1aba2..b96991035 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 33)
27 BLOCK@[27; 29) 27 BLOCK@[27; 29)
28 L_CURLY@[27; 28) "{" 28 L_CURLY@[27; 28) "{"
29 R_CURLY@[28; 29) "}" 29 R_CURLY@[28; 29) "}"
30 SEMI@[29; 30) ";" 30 SEMICOLON@[29; 30) ";"
31 WHITESPACE@[30; 31) "\n" 31 WHITESPACE@[30; 31) "\n"
32 R_CURLY@[31; 32) "}" 32 R_CURLY@[31; 32) "}"
33 WHITESPACE@[32; 33) "\n" 33 WHITESPACE@[32; 33) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast
index 6bfac985a..ed3d8fb0b 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast
@@ -27,5 +27,5 @@ SOURCE_FILE@[0; 37)
27 PATH_SEGMENT@[30; 35) 27 PATH_SEGMENT@[30; 35)
28 NAME_REF@[30; 35) 28 NAME_REF@[30; 35)
29 IDENT@[30; 35) "usize" 29 IDENT@[30; 35) "usize"
30 SEMI@[35; 36) ";" 30 SEMICOLON@[35; 36) ";"
31 WHITESPACE@[36; 37) "\n" 31 WHITESPACE@[36; 37) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast
index 12294210e..c392a7d84 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast
@@ -26,7 +26,7 @@ SOURCE_FILE@[0; 106)
26 WHITESPACE@[26; 27) " " 26 WHITESPACE@[26; 27) " "
27 LITERAL@[27; 31) 27 LITERAL@[27; 31)
28 INT_NUMBER@[27; 31) "1i32" 28 INT_NUMBER@[27; 31) "1i32"
29 SEMI@[31; 32) ";" 29 SEMICOLON@[31; 32) ";"
30 WHITESPACE@[32; 37) "\n " 30 WHITESPACE@[32; 37) "\n "
31 LET_STMT@[37; 66) 31 LET_STMT@[37; 66)
32 LET_KW@[37; 40) "let" 32 LET_KW@[37; 40) "let"
@@ -52,7 +52,7 @@ SOURCE_FILE@[0; 106)
52 LITERAL@[60; 64) 52 LITERAL@[60; 64)
53 INT_NUMBER@[60; 64) "2i32" 53 INT_NUMBER@[60; 64) "2i32"
54 R_PAREN@[64; 65) ")" 54 R_PAREN@[64; 65) ")"
55 SEMI@[65; 66) ";" 55 SEMICOLON@[65; 66) ";"
56 WHITESPACE@[66; 71) "\n " 56 WHITESPACE@[66; 71) "\n "
57 LET_STMT@[71; 103) 57 LET_STMT@[71; 103)
58 LET_KW@[71; 74) "let" 58 LET_KW@[71; 74) "let"
@@ -84,7 +84,7 @@ SOURCE_FILE@[0; 106)
84 LITERAL@[97; 101) 84 LITERAL@[97; 101)
85 INT_NUMBER@[97; 101) "2i32" 85 INT_NUMBER@[97; 101) "2i32"
86 R_PAREN@[101; 102) ")" 86 R_PAREN@[101; 102) ")"
87 SEMI@[102; 103) ";" 87 SEMICOLON@[102; 103) ";"
88 WHITESPACE@[103; 104) "\n" 88 WHITESPACE@[103; 104) "\n"
89 R_CURLY@[104; 105) "}" 89 R_CURLY@[104; 105) "}"
90 WHITESPACE@[105; 106) "\n" 90 WHITESPACE@[105; 106) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast
index e1734224b..cff03fcf3 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 69)
34 PATH_SEGMENT@[38; 41) 34 PATH_SEGMENT@[38; 41)
35 NAME_REF@[38; 41) 35 NAME_REF@[38; 41)
36 IDENT@[38; 41) "Bar" 36 IDENT@[38; 41) "Bar"
37 SEMI@[41; 42) ";" 37 SEMICOLON@[41; 42) ";"
38 WHITESPACE@[42; 47) "\n " 38 WHITESPACE@[42; 47) "\n "
39 FN_DEF@[47; 66) 39 FN_DEF@[47; 66)
40 DEFAULT_KW@[47; 54) "default" 40 DEFAULT_KW@[47; 54) "default"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
index 14655d332..f66f32370 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 111)
32 COMMA@[68; 69) "," 32 COMMA@[68; 69) ","
33 WHITESPACE@[69; 74) "\n " 33 WHITESPACE@[69; 74) "\n "
34 R_CURLY@[74; 75) "}" 34 R_CURLY@[74; 75) "}"
35 SEMI@[75; 76) ";" 35 SEMICOLON@[75; 76) ";"
36 WHITESPACE@[76; 81) "\n " 36 WHITESPACE@[76; 81) "\n "
37 FN_DEF@[81; 90) 37 FN_DEF@[81; 90)
38 FN_KW@[81; 83) "fn" 38 FN_KW@[81; 83) "fn"
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 111)
47 BLOCK@[88; 90) 47 BLOCK@[88; 90)
48 L_CURLY@[88; 89) "{" 48 L_CURLY@[88; 89) "{"
49 R_CURLY@[89; 90) "}" 49 R_CURLY@[89; 90) "}"
50 SEMI@[90; 91) ";" 50 SEMICOLON@[90; 91) ";"
51 WHITESPACE@[91; 96) "\n " 51 WHITESPACE@[91; 96) "\n "
52 STRUCT_DEF@[96; 107) 52 STRUCT_DEF@[96; 107)
53 STRUCT_KW@[96; 102) "struct" 53 STRUCT_KW@[96; 102) "struct"
@@ -58,7 +58,7 @@ SOURCE_FILE@[0; 111)
58 RECORD_FIELD_DEF_LIST@[105; 107) 58 RECORD_FIELD_DEF_LIST@[105; 107)
59 L_CURLY@[105; 106) "{" 59 L_CURLY@[105; 106) "{"
60 R_CURLY@[106; 107) "}" 60 R_CURLY@[106; 107) "}"
61 SEMI@[107; 108) ";" 61 SEMICOLON@[107; 108) ";"
62 WHITESPACE@[108; 109) "\n" 62 WHITESPACE@[108; 109) "\n"
63 R_CURLY@[109; 110) "}" 63 R_CURLY@[109; 110) "}"
64 WHITESPACE@[110; 111) "\n" 64 WHITESPACE@[110; 111) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast
index a6ac0dbd8..4946e6325 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 67)
21 IDENT@[15; 16) "x" 21 IDENT@[15; 16) "x"
22 DOT@[16; 17) "." 22 DOT@[16; 17) "."
23 AWAIT_KW@[17; 22) "await" 23 AWAIT_KW@[17; 22) "await"
24 SEMI@[22; 23) ";" 24 SEMICOLON@[22; 23) ";"
25 WHITESPACE@[23; 28) "\n " 25 WHITESPACE@[23; 28) "\n "
26 EXPR_STMT@[28; 38) 26 EXPR_STMT@[28; 38)
27 AWAIT_EXPR@[28; 37) 27 AWAIT_EXPR@[28; 37)
@@ -36,7 +36,7 @@ SOURCE_FILE@[0; 67)
36 INT_NUMBER@[30; 31) "0" 36 INT_NUMBER@[30; 31) "0"
37 DOT@[31; 32) "." 37 DOT@[31; 32) "."
38 AWAIT_KW@[32; 37) "await" 38 AWAIT_KW@[32; 37) "await"
39 SEMI@[37; 38) ";" 39 SEMICOLON@[37; 38) ";"
40 WHITESPACE@[38; 43) "\n " 40 WHITESPACE@[38; 43) "\n "
41 EXPR_STMT@[43; 64) 41 EXPR_STMT@[43; 64)
42 METHOD_CALL_EXPR@[43; 63) 42 METHOD_CALL_EXPR@[43; 63)
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 67)
64 ARG_LIST@[61; 63) 64 ARG_LIST@[61; 63)
65 L_PAREN@[61; 62) "(" 65 L_PAREN@[61; 62) "("
66 R_PAREN@[62; 63) ")" 66 R_PAREN@[62; 63) ")"
67 SEMI@[63; 64) ";" 67 SEMICOLON@[63; 64) ";"
68 WHITESPACE@[64; 65) "\n" 68 WHITESPACE@[64; 65) "\n"
69 R_CURLY@[65; 66) "}" 69 R_CURLY@[65; 66) "}"
70 WHITESPACE@[66; 67) "\n" 70 WHITESPACE@[66; 67) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast
index df4c04149..ca1d69f64 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 52)
38 LITERAL@[31; 32) 38 LITERAL@[31; 32)
39 INT_NUMBER@[31; 32) "5" 39 INT_NUMBER@[31; 32) "5"
40 R_CURLY@[32; 33) "}" 40 R_CURLY@[32; 33) "}"
41 SEMI@[33; 34) ";" 41 SEMICOLON@[33; 34) ";"
42 WHITESPACE@[34; 38) "\n " 42 WHITESPACE@[34; 38) "\n "
43 EXPR_STMT@[38; 49) 43 EXPR_STMT@[38; 49)
44 BIN_EXPR@[38; 48) 44 BIN_EXPR@[38; 48)
@@ -60,7 +60,7 @@ SOURCE_FILE@[0; 52)
60 WHITESPACE@[45; 46) " " 60 WHITESPACE@[45; 46) " "
61 LITERAL@[46; 48) 61 LITERAL@[46; 48)
62 INT_NUMBER@[46; 48) "10" 62 INT_NUMBER@[46; 48) "10"
63 SEMI@[48; 49) ";" 63 SEMICOLON@[48; 49) ";"
64 WHITESPACE@[49; 50) "\n" 64 WHITESPACE@[49; 50) "\n"
65 R_CURLY@[50; 51) "}" 65 R_CURLY@[50; 51) "}"
66 WHITESPACE@[51; 52) "\n" 66 WHITESPACE@[51; 52) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast
index eec1cba1e..6d01140d2 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 51)
25 LITERAL@[23; 24) 25 LITERAL@[23; 24)
26 INT_NUMBER@[23; 24) "0" 26 INT_NUMBER@[23; 24) "0"
27 WHITESPACE@[24; 25) " " 27 WHITESPACE@[24; 25) " "
28 DOTDOT@[25; 27) ".." 28 DOT2@[25; 27) ".."
29 WHITESPACE@[27; 28) " " 29 WHITESPACE@[27; 28) " "
30 BLOCK_EXPR@[28; 48) 30 BLOCK_EXPR@[28; 48)
31 BLOCK@[28; 48) 31 BLOCK@[28; 48)
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 51)
34 EXPR_STMT@[37; 43) 34 EXPR_STMT@[37; 43)
35 BREAK_EXPR@[37; 42) 35 BREAK_EXPR@[37; 42)
36 BREAK_KW@[37; 42) "break" 36 BREAK_KW@[37; 42) "break"
37 SEMI@[42; 43) ";" 37 SEMICOLON@[42; 43) ";"
38 WHITESPACE@[43; 47) "\n " 38 WHITESPACE@[43; 47) "\n "
39 R_CURLY@[47; 48) "}" 39 R_CURLY@[47; 48) "}"
40 WHITESPACE@[48; 49) "\n" 40 WHITESPACE@[48; 49) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast
index 4d2048711..f75673070 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 118)
27 TUPLE_EXPR@[28; 30) 27 TUPLE_EXPR@[28; 30)
28 L_PAREN@[28; 29) "(" 28 L_PAREN@[28; 29) "("
29 R_PAREN@[29; 30) ")" 29 R_PAREN@[29; 30) ")"
30 SEMI@[30; 31) ";" 30 SEMICOLON@[30; 31) ";"
31 WHITESPACE@[31; 36) "\n " 31 WHITESPACE@[31; 36) "\n "
32 LET_STMT@[36; 87) 32 LET_STMT@[36; 87)
33 LET_KW@[36; 39) "let" 33 LET_KW@[36; 39) "let"
@@ -83,7 +83,7 @@ SOURCE_FILE@[0; 118)
83 TUPLE_EXPR@[84; 86) 83 TUPLE_EXPR@[84; 86)
84 L_PAREN@[84; 85) "(" 84 L_PAREN@[84; 85) "("
85 R_PAREN@[85; 86) ")" 85 R_PAREN@[85; 86) ")"
86 SEMI@[86; 87) ";" 86 SEMICOLON@[86; 87) ";"
87 WHITESPACE@[87; 92) "\n " 87 WHITESPACE@[87; 92) "\n "
88 LET_STMT@[92; 115) 88 LET_STMT@[92; 115)
89 LET_KW@[92; 95) "let" 89 LET_KW@[92; 95) "let"
@@ -104,7 +104,7 @@ SOURCE_FILE@[0; 118)
104 TUPLE_EXPR@[112; 114) 104 TUPLE_EXPR@[112; 114)
105 L_PAREN@[112; 113) "(" 105 L_PAREN@[112; 113) "("
106 R_PAREN@[113; 114) ")" 106 R_PAREN@[113; 114) ")"
107 SEMI@[114; 115) ";" 107 SEMICOLON@[114; 115) ";"
108 WHITESPACE@[115; 116) "\n" 108 WHITESPACE@[115; 116) "\n"
109 R_CURLY@[116; 117) "}" 109 R_CURLY@[116; 117) "}"
110 WHITESPACE@[117; 118) "\n" 110 WHITESPACE@[117; 118) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast
index 325b1bd08..60186a992 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast
@@ -16,14 +16,14 @@ SOURCE_FILE@[0; 555)
16 LET_KW@[16; 19) "let" 16 LET_KW@[16; 19) "let"
17 WHITESPACE@[19; 20) " " 17 WHITESPACE@[19; 20) " "
18 DOT_DOT_PAT@[20; 22) 18 DOT_DOT_PAT@[20; 22)
19 DOTDOT@[20; 22) ".." 19 DOT2@[20; 22) ".."
20 WHITESPACE@[22; 23) " " 20 WHITESPACE@[22; 23) " "
21 EQ@[23; 24) "=" 21 EQ@[23; 24) "="
22 WHITESPACE@[24; 25) " " 22 WHITESPACE@[24; 25) " "
23 TUPLE_EXPR@[25; 27) 23 TUPLE_EXPR@[25; 27)
24 L_PAREN@[25; 26) "(" 24 L_PAREN@[25; 26) "("
25 R_PAREN@[26; 27) ")" 25 R_PAREN@[26; 27) ")"
26 SEMI@[27; 28) ";" 26 SEMICOLON@[27; 28) ";"
27 WHITESPACE@[28; 33) "\n " 27 WHITESPACE@[28; 33) "\n "
28 COMMENT@[33; 35) "//" 28 COMMENT@[33; 35) "//"
29 WHITESPACE@[35; 40) "\n " 29 WHITESPACE@[35; 40) "\n "
@@ -42,7 +42,7 @@ SOURCE_FILE@[0; 555)
42 COMMA@[67; 68) "," 42 COMMA@[67; 68) ","
43 WHITESPACE@[68; 69) " " 43 WHITESPACE@[68; 69) " "
44 DOT_DOT_PAT@[69; 71) 44 DOT_DOT_PAT@[69; 71)
45 DOTDOT@[69; 71) ".." 45 DOT2@[69; 71) ".."
46 R_PAREN@[71; 72) ")" 46 R_PAREN@[71; 72) ")"
47 WHITESPACE@[72; 73) " " 47 WHITESPACE@[72; 73) " "
48 EQ@[73; 74) "=" 48 EQ@[73; 74) "="
@@ -50,7 +50,7 @@ SOURCE_FILE@[0; 555)
50 TUPLE_EXPR@[75; 77) 50 TUPLE_EXPR@[75; 77)
51 L_PAREN@[75; 76) "(" 51 L_PAREN@[75; 76) "("
52 R_PAREN@[76; 77) ")" 52 R_PAREN@[76; 77) ")"
53 SEMI@[77; 78) ";" 53 SEMICOLON@[77; 78) ";"
54 WHITESPACE@[78; 83) "\n " 54 WHITESPACE@[78; 83) "\n "
55 LET_STMT@[83; 101) 55 LET_STMT@[83; 101)
56 LET_KW@[83; 86) "let" 56 LET_KW@[83; 86) "let"
@@ -63,7 +63,7 @@ SOURCE_FILE@[0; 555)
63 COMMA@[89; 90) "," 63 COMMA@[89; 90) ","
64 WHITESPACE@[90; 91) " " 64 WHITESPACE@[90; 91) " "
65 DOT_DOT_PAT@[91; 93) 65 DOT_DOT_PAT@[91; 93)
66 DOTDOT@[91; 93) ".." 66 DOT2@[91; 93) ".."
67 COMMA@[93; 94) "," 67 COMMA@[93; 94) ","
68 R_PAREN@[94; 95) ")" 68 R_PAREN@[94; 95) ")"
69 WHITESPACE@[95; 96) " " 69 WHITESPACE@[95; 96) " "
@@ -72,7 +72,7 @@ SOURCE_FILE@[0; 555)
72 TUPLE_EXPR@[98; 100) 72 TUPLE_EXPR@[98; 100)
73 L_PAREN@[98; 99) "(" 73 L_PAREN@[98; 99) "("
74 R_PAREN@[99; 100) ")" 74 R_PAREN@[99; 100) ")"
75 SEMI@[100; 101) ";" 75 SEMICOLON@[100; 101) ";"
76 WHITESPACE@[101; 106) "\n " 76 WHITESPACE@[101; 106) "\n "
77 LET_STMT@[106; 128) 77 LET_STMT@[106; 128)
78 LET_KW@[106; 109) "let" 78 LET_KW@[106; 109) "let"
@@ -89,7 +89,7 @@ SOURCE_FILE@[0; 555)
89 COMMA@[117; 118) "," 89 COMMA@[117; 118) ","
90 WHITESPACE@[118; 119) " " 90 WHITESPACE@[118; 119) " "
91 DOT_DOT_PAT@[119; 121) 91 DOT_DOT_PAT@[119; 121)
92 DOTDOT@[119; 121) ".." 92 DOT2@[119; 121) ".."
93 R_PAREN@[121; 122) ")" 93 R_PAREN@[121; 122) ")"
94 WHITESPACE@[122; 123) " " 94 WHITESPACE@[122; 123) " "
95 EQ@[123; 124) "=" 95 EQ@[123; 124) "="
@@ -97,7 +97,7 @@ SOURCE_FILE@[0; 555)
97 TUPLE_EXPR@[125; 127) 97 TUPLE_EXPR@[125; 127)
98 L_PAREN@[125; 126) "(" 98 L_PAREN@[125; 126) "("
99 R_PAREN@[126; 127) ")" 99 R_PAREN@[126; 127) ")"
100 SEMI@[127; 128) ";" 100 SEMICOLON@[127; 128) ";"
101 WHITESPACE@[128; 133) "\n " 101 WHITESPACE@[128; 133) "\n "
102 LET_STMT@[133; 156) 102 LET_STMT@[133; 156)
103 LET_KW@[133; 136) "let" 103 LET_KW@[133; 136) "let"
@@ -114,7 +114,7 @@ SOURCE_FILE@[0; 555)
114 COMMA@[144; 145) "," 114 COMMA@[144; 145) ","
115 WHITESPACE@[145; 146) " " 115 WHITESPACE@[145; 146) " "
116 DOT_DOT_PAT@[146; 148) 116 DOT_DOT_PAT@[146; 148)
117 DOTDOT@[146; 148) ".." 117 DOT2@[146; 148) ".."
118 COMMA@[148; 149) "," 118 COMMA@[148; 149) ","
119 R_PAREN@[149; 150) ")" 119 R_PAREN@[149; 150) ")"
120 WHITESPACE@[150; 151) " " 120 WHITESPACE@[150; 151) " "
@@ -123,7 +123,7 @@ SOURCE_FILE@[0; 555)
123 TUPLE_EXPR@[153; 155) 123 TUPLE_EXPR@[153; 155)
124 L_PAREN@[153; 154) "(" 124 L_PAREN@[153; 154) "("
125 R_PAREN@[154; 155) ")" 125 R_PAREN@[154; 155) ")"
126 SEMI@[155; 156) ";" 126 SEMICOLON@[155; 156) ";"
127 WHITESPACE@[156; 161) "\n " 127 WHITESPACE@[156; 161) "\n "
128 LET_STMT@[161; 179) 128 LET_STMT@[161; 179)
129 LET_KW@[161; 164) "let" 129 LET_KW@[161; 164) "let"
@@ -131,11 +131,11 @@ SOURCE_FILE@[0; 555)
131 TUPLE_PAT@[165; 173) 131 TUPLE_PAT@[165; 173)
132 L_PAREN@[165; 166) "(" 132 L_PAREN@[165; 166) "("
133 DOT_DOT_PAT@[166; 168) 133 DOT_DOT_PAT@[166; 168)
134 DOTDOT@[166; 168) ".." 134 DOT2@[166; 168) ".."
135 COMMA@[168; 169) "," 135 COMMA@[168; 169) ","
136 WHITESPACE@[169; 170) " " 136 WHITESPACE@[169; 170) " "
137 DOT_DOT_PAT@[170; 172) 137 DOT_DOT_PAT@[170; 172)
138 DOTDOT@[170; 172) ".." 138 DOT2@[170; 172) ".."
139 R_PAREN@[172; 173) ")" 139 R_PAREN@[172; 173) ")"
140 WHITESPACE@[173; 174) " " 140 WHITESPACE@[173; 174) " "
141 EQ@[174; 175) "=" 141 EQ@[174; 175) "="
@@ -143,7 +143,7 @@ SOURCE_FILE@[0; 555)
143 TUPLE_EXPR@[176; 178) 143 TUPLE_EXPR@[176; 178)
144 L_PAREN@[176; 177) "(" 144 L_PAREN@[176; 177) "("
145 R_PAREN@[177; 178) ")" 145 R_PAREN@[177; 178) ")"
146 SEMI@[178; 179) ";" 146 SEMICOLON@[178; 179) ";"
147 WHITESPACE@[179; 184) "\n " 147 WHITESPACE@[179; 184) "\n "
148 LET_STMT@[184; 207) 148 LET_STMT@[184; 207)
149 LET_KW@[184; 187) "let" 149 LET_KW@[184; 187) "let"
@@ -155,11 +155,11 @@ SOURCE_FILE@[0; 555)
155 IDENT@[188; 193) "Tuple" 155 IDENT@[188; 193) "Tuple"
156 L_PAREN@[193; 194) "(" 156 L_PAREN@[193; 194) "("
157 DOT_DOT_PAT@[194; 196) 157 DOT_DOT_PAT@[194; 196)
158 DOTDOT@[194; 196) ".." 158 DOT2@[194; 196) ".."
159 COMMA@[196; 197) "," 159 COMMA@[196; 197) ","
160 WHITESPACE@[197; 198) " " 160 WHITESPACE@[197; 198) " "
161 DOT_DOT_PAT@[198; 200) 161 DOT_DOT_PAT@[198; 200)
162 DOTDOT@[198; 200) ".." 162 DOT2@[198; 200) ".."
163 R_PAREN@[200; 201) ")" 163 R_PAREN@[200; 201) ")"
164 WHITESPACE@[201; 202) " " 164 WHITESPACE@[201; 202) " "
165 EQ@[202; 203) "=" 165 EQ@[202; 203) "="
@@ -167,7 +167,7 @@ SOURCE_FILE@[0; 555)
167 TUPLE_EXPR@[204; 206) 167 TUPLE_EXPR@[204; 206)
168 L_PAREN@[204; 205) "(" 168 L_PAREN@[204; 205) "("
169 R_PAREN@[205; 206) ")" 169 R_PAREN@[205; 206) ")"
170 SEMI@[206; 207) ";" 170 SEMICOLON@[206; 207) ";"
171 WHITESPACE@[207; 212) "\n " 171 WHITESPACE@[207; 212) "\n "
172 LET_STMT@[212; 233) 172 LET_STMT@[212; 233)
173 LET_KW@[212; 215) "let" 173 LET_KW@[212; 215) "let"
@@ -175,7 +175,7 @@ SOURCE_FILE@[0; 555)
175 TUPLE_PAT@[216; 227) 175 TUPLE_PAT@[216; 227)
176 L_PAREN@[216; 217) "(" 176 L_PAREN@[216; 217) "("
177 DOT_DOT_PAT@[217; 219) 177 DOT_DOT_PAT@[217; 219)
178 DOTDOT@[217; 219) ".." 178 DOT2@[217; 219) ".."
179 COMMA@[219; 220) "," 179 COMMA@[219; 220) ","
180 WHITESPACE@[220; 221) " " 180 WHITESPACE@[220; 221) " "
181 BIND_PAT@[221; 222) 181 BIND_PAT@[221; 222)
@@ -184,7 +184,7 @@ SOURCE_FILE@[0; 555)
184 COMMA@[222; 223) "," 184 COMMA@[222; 223) ","
185 WHITESPACE@[223; 224) " " 185 WHITESPACE@[223; 224) " "
186 DOT_DOT_PAT@[224; 226) 186 DOT_DOT_PAT@[224; 226)
187 DOTDOT@[224; 226) ".." 187 DOT2@[224; 226) ".."
188 R_PAREN@[226; 227) ")" 188 R_PAREN@[226; 227) ")"
189 WHITESPACE@[227; 228) " " 189 WHITESPACE@[227; 228) " "
190 EQ@[228; 229) "=" 190 EQ@[228; 229) "="
@@ -192,7 +192,7 @@ SOURCE_FILE@[0; 555)
192 TUPLE_EXPR@[230; 232) 192 TUPLE_EXPR@[230; 232)
193 L_PAREN@[230; 231) "(" 193 L_PAREN@[230; 231) "("
194 R_PAREN@[231; 232) ")" 194 R_PAREN@[231; 232) ")"
195 SEMI@[232; 233) ";" 195 SEMICOLON@[232; 233) ";"
196 WHITESPACE@[233; 238) "\n " 196 WHITESPACE@[233; 238) "\n "
197 LET_STMT@[238; 264) 197 LET_STMT@[238; 264)
198 LET_KW@[238; 241) "let" 198 LET_KW@[238; 241) "let"
@@ -204,7 +204,7 @@ SOURCE_FILE@[0; 555)
204 IDENT@[242; 247) "Tuple" 204 IDENT@[242; 247) "Tuple"
205 L_PAREN@[247; 248) "(" 205 L_PAREN@[247; 248) "("
206 DOT_DOT_PAT@[248; 250) 206 DOT_DOT_PAT@[248; 250)
207 DOTDOT@[248; 250) ".." 207 DOT2@[248; 250) ".."
208 COMMA@[250; 251) "," 208 COMMA@[250; 251) ","
209 WHITESPACE@[251; 252) " " 209 WHITESPACE@[251; 252) " "
210 BIND_PAT@[252; 253) 210 BIND_PAT@[252; 253)
@@ -213,7 +213,7 @@ SOURCE_FILE@[0; 555)
213 COMMA@[253; 254) "," 213 COMMA@[253; 254) ","
214 WHITESPACE@[254; 255) " " 214 WHITESPACE@[254; 255) " "
215 DOT_DOT_PAT@[255; 257) 215 DOT_DOT_PAT@[255; 257)
216 DOTDOT@[255; 257) ".." 216 DOT2@[255; 257) ".."
217 R_PAREN@[257; 258) ")" 217 R_PAREN@[257; 258) ")"
218 WHITESPACE@[258; 259) " " 218 WHITESPACE@[258; 259) " "
219 EQ@[259; 260) "=" 219 EQ@[259; 260) "="
@@ -221,7 +221,7 @@ SOURCE_FILE@[0; 555)
221 TUPLE_EXPR@[261; 263) 221 TUPLE_EXPR@[261; 263)
222 L_PAREN@[261; 262) "(" 222 L_PAREN@[261; 262) "("
223 R_PAREN@[262; 263) ")" 223 R_PAREN@[262; 263) ")"
224 SEMI@[263; 264) ";" 224 SEMICOLON@[263; 264) ";"
225 WHITESPACE@[264; 269) "\n " 225 WHITESPACE@[264; 269) "\n "
226 COMMENT@[269; 271) "//" 226 COMMENT@[269; 271) "//"
227 WHITESPACE@[271; 276) "\n " 227 WHITESPACE@[271; 276) "\n "
@@ -235,7 +235,7 @@ SOURCE_FILE@[0; 555)
235 SLICE_PAT@[301; 305) 235 SLICE_PAT@[301; 305)
236 L_BRACK@[301; 302) "[" 236 L_BRACK@[301; 302) "["
237 DOT_DOT_PAT@[302; 304) 237 DOT_DOT_PAT@[302; 304)
238 DOTDOT@[302; 304) ".." 238 DOT2@[302; 304) ".."
239 R_BRACK@[304; 305) "]" 239 R_BRACK@[304; 305) "]"
240 WHITESPACE@[305; 306) " " 240 WHITESPACE@[305; 306) " "
241 EQ@[306; 307) "=" 241 EQ@[306; 307) "="
@@ -243,7 +243,7 @@ SOURCE_FILE@[0; 555)
243 TUPLE_EXPR@[308; 310) 243 TUPLE_EXPR@[308; 310)
244 L_PAREN@[308; 309) "(" 244 L_PAREN@[308; 309) "("
245 R_PAREN@[309; 310) ")" 245 R_PAREN@[309; 310) ")"
246 SEMI@[310; 311) ";" 246 SEMICOLON@[310; 311) ";"
247 WHITESPACE@[311; 316) "\n " 247 WHITESPACE@[311; 316) "\n "
248 LET_STMT@[316; 336) 248 LET_STMT@[316; 336)
249 LET_KW@[316; 319) "let" 249 LET_KW@[316; 319) "let"
@@ -256,7 +256,7 @@ SOURCE_FILE@[0; 555)
256 COMMA@[325; 326) "," 256 COMMA@[325; 326) ","
257 WHITESPACE@[326; 327) " " 257 WHITESPACE@[326; 327) " "
258 DOT_DOT_PAT@[327; 329) 258 DOT_DOT_PAT@[327; 329)
259 DOTDOT@[327; 329) ".." 259 DOT2@[327; 329) ".."
260 R_BRACK@[329; 330) "]" 260 R_BRACK@[329; 330) "]"
261 WHITESPACE@[330; 331) " " 261 WHITESPACE@[330; 331) " "
262 EQ@[331; 332) "=" 262 EQ@[331; 332) "="
@@ -264,7 +264,7 @@ SOURCE_FILE@[0; 555)
264 TUPLE_EXPR@[333; 335) 264 TUPLE_EXPR@[333; 335)
265 L_PAREN@[333; 334) "(" 265 L_PAREN@[333; 334) "("
266 R_PAREN@[334; 335) ")" 266 R_PAREN@[334; 335) ")"
267 SEMI@[335; 336) ";" 267 SEMICOLON@[335; 336) ";"
268 WHITESPACE@[336; 341) "\n " 268 WHITESPACE@[336; 341) "\n "
269 LET_STMT@[341; 368) 269 LET_STMT@[341; 368)
270 LET_KW@[341; 344) "let" 270 LET_KW@[341; 344) "let"
@@ -283,7 +283,7 @@ SOURCE_FILE@[0; 555)
283 AT@[357; 358) "@" 283 AT@[357; 358) "@"
284 WHITESPACE@[358; 359) " " 284 WHITESPACE@[358; 359) " "
285 DOT_DOT_PAT@[359; 361) 285 DOT_DOT_PAT@[359; 361)
286 DOTDOT@[359; 361) ".." 286 DOT2@[359; 361) ".."
287 R_BRACK@[361; 362) "]" 287 R_BRACK@[361; 362) "]"
288 WHITESPACE@[362; 363) " " 288 WHITESPACE@[362; 363) " "
289 EQ@[363; 364) "=" 289 EQ@[363; 364) "="
@@ -291,7 +291,7 @@ SOURCE_FILE@[0; 555)
291 TUPLE_EXPR@[365; 367) 291 TUPLE_EXPR@[365; 367)
292 L_PAREN@[365; 366) "(" 292 L_PAREN@[365; 366) "("
293 R_PAREN@[366; 367) ")" 293 R_PAREN@[366; 367) ")"
294 SEMI@[367; 368) ";" 294 SEMICOLON@[367; 368) ";"
295 WHITESPACE@[368; 373) "\n " 295 WHITESPACE@[368; 373) "\n "
296 LET_STMT@[373; 399) 296 LET_STMT@[373; 399)
297 LET_KW@[373; 376) "let" 297 LET_KW@[373; 376) "let"
@@ -304,7 +304,7 @@ SOURCE_FILE@[0; 555)
304 COMMA@[382; 383) "," 304 COMMA@[382; 383) ","
305 WHITESPACE@[383; 384) " " 305 WHITESPACE@[383; 384) " "
306 DOT_DOT_PAT@[384; 386) 306 DOT_DOT_PAT@[384; 386)
307 DOTDOT@[384; 386) ".." 307 DOT2@[384; 386) ".."
308 COMMA@[386; 387) "," 308 COMMA@[386; 387) ","
309 WHITESPACE@[387; 388) " " 309 WHITESPACE@[387; 388) " "
310 BIND_PAT@[388; 392) 310 BIND_PAT@[388; 392)
@@ -317,7 +317,7 @@ SOURCE_FILE@[0; 555)
317 TUPLE_EXPR@[396; 398) 317 TUPLE_EXPR@[396; 398)
318 L_PAREN@[396; 397) "(" 318 L_PAREN@[396; 397) "("
319 R_PAREN@[397; 398) ")" 319 R_PAREN@[397; 398) ")"
320 SEMI@[398; 399) ";" 320 SEMICOLON@[398; 399) ";"
321 WHITESPACE@[399; 404) "\n " 321 WHITESPACE@[399; 404) "\n "
322 LET_STMT@[404; 436) 322 LET_STMT@[404; 436)
323 LET_KW@[404; 407) "let" 323 LET_KW@[404; 407) "let"
@@ -336,7 +336,7 @@ SOURCE_FILE@[0; 555)
336 AT@[419; 420) "@" 336 AT@[419; 420) "@"
337 WHITESPACE@[420; 421) " " 337 WHITESPACE@[420; 421) " "
338 DOT_DOT_PAT@[421; 423) 338 DOT_DOT_PAT@[421; 423)
339 DOTDOT@[421; 423) ".." 339 DOT2@[421; 423) ".."
340 COMMA@[423; 424) "," 340 COMMA@[423; 424) ","
341 WHITESPACE@[424; 425) " " 341 WHITESPACE@[424; 425) " "
342 BIND_PAT@[425; 429) 342 BIND_PAT@[425; 429)
@@ -349,7 +349,7 @@ SOURCE_FILE@[0; 555)
349 TUPLE_EXPR@[433; 435) 349 TUPLE_EXPR@[433; 435)
350 L_PAREN@[433; 434) "(" 350 L_PAREN@[433; 434) "("
351 R_PAREN@[434; 435) ")" 351 R_PAREN@[434; 435) ")"
352 SEMI@[435; 436) ";" 352 SEMICOLON@[435; 436) ";"
353 WHITESPACE@[436; 441) "\n " 353 WHITESPACE@[436; 441) "\n "
354 LET_STMT@[441; 471) 354 LET_STMT@[441; 471)
355 LET_KW@[441; 444) "let" 355 LET_KW@[441; 444) "let"
@@ -362,11 +362,11 @@ SOURCE_FILE@[0; 555)
362 COMMA@[450; 451) "," 362 COMMA@[450; 451) ","
363 WHITESPACE@[451; 452) " " 363 WHITESPACE@[451; 452) " "
364 DOT_DOT_PAT@[452; 454) 364 DOT_DOT_PAT@[452; 454)
365 DOTDOT@[452; 454) ".." 365 DOT2@[452; 454) ".."
366 COMMA@[454; 455) "," 366 COMMA@[454; 455) ","
367 WHITESPACE@[455; 456) " " 367 WHITESPACE@[455; 456) " "
368 DOT_DOT_PAT@[456; 458) 368 DOT_DOT_PAT@[456; 458)
369 DOTDOT@[456; 458) ".." 369 DOT2@[456; 458) ".."
370 COMMA@[458; 459) "," 370 COMMA@[458; 459) ","
371 WHITESPACE@[459; 460) " " 371 WHITESPACE@[459; 460) " "
372 BIND_PAT@[460; 464) 372 BIND_PAT@[460; 464)
@@ -379,7 +379,7 @@ SOURCE_FILE@[0; 555)
379 TUPLE_EXPR@[468; 470) 379 TUPLE_EXPR@[468; 470)
380 L_PAREN@[468; 469) "(" 380 L_PAREN@[468; 469) "("
381 R_PAREN@[469; 470) ")" 381 R_PAREN@[469; 470) ")"
382 SEMI@[470; 471) ";" 382 SEMICOLON@[470; 471) ";"
383 WHITESPACE@[471; 476) "\n " 383 WHITESPACE@[471; 476) "\n "
384 LET_STMT@[476; 512) 384 LET_STMT@[476; 512)
385 LET_KW@[476; 479) "let" 385 LET_KW@[476; 479) "let"
@@ -392,7 +392,7 @@ SOURCE_FILE@[0; 555)
392 COMMA@[485; 486) "," 392 COMMA@[485; 486) ","
393 WHITESPACE@[486; 487) " " 393 WHITESPACE@[486; 487) " "
394 DOT_DOT_PAT@[487; 489) 394 DOT_DOT_PAT@[487; 489)
395 DOTDOT@[487; 489) ".." 395 DOT2@[487; 489) ".."
396 COMMA@[489; 490) "," 396 COMMA@[489; 490) ","
397 WHITESPACE@[490; 491) " " 397 WHITESPACE@[490; 491) " "
398 BIND_PAT@[491; 494) 398 BIND_PAT@[491; 494)
@@ -407,7 +407,7 @@ SOURCE_FILE@[0; 555)
407 AT@[501; 502) "@" 407 AT@[501; 502) "@"
408 WHITESPACE@[502; 503) " " 408 WHITESPACE@[502; 503) " "
409 DOT_DOT_PAT@[503; 505) 409 DOT_DOT_PAT@[503; 505)
410 DOTDOT@[503; 505) ".." 410 DOT2@[503; 505) ".."
411 R_BRACK@[505; 506) "]" 411 R_BRACK@[505; 506) "]"
412 WHITESPACE@[506; 507) " " 412 WHITESPACE@[506; 507) " "
413 EQ@[507; 508) "=" 413 EQ@[507; 508) "="
@@ -415,7 +415,7 @@ SOURCE_FILE@[0; 555)
415 TUPLE_EXPR@[509; 511) 415 TUPLE_EXPR@[509; 511)
416 L_PAREN@[509; 510) "(" 416 L_PAREN@[509; 510) "("
417 R_PAREN@[510; 511) ")" 417 R_PAREN@[510; 511) ")"
418 SEMI@[511; 512) ";" 418 SEMICOLON@[511; 512) ";"
419 WHITESPACE@[512; 517) "\n " 419 WHITESPACE@[512; 517) "\n "
420 LET_STMT@[517; 552) 420 LET_STMT@[517; 552)
421 LET_KW@[517; 520) "let" 421 LET_KW@[517; 520) "let"
@@ -428,7 +428,7 @@ SOURCE_FILE@[0; 555)
428 COMMA@[526; 527) "," 428 COMMA@[526; 527) ","
429 WHITESPACE@[527; 528) " " 429 WHITESPACE@[527; 528) " "
430 DOT_DOT_PAT@[528; 530) 430 DOT_DOT_PAT@[528; 530)
431 DOTDOT@[528; 530) ".." 431 DOT2@[528; 530) ".."
432 COMMA@[530; 531) "," 432 COMMA@[530; 531) ","
433 WHITESPACE@[531; 532) " " 433 WHITESPACE@[531; 532) " "
434 BIND_PAT@[532; 535) 434 BIND_PAT@[532; 535)
@@ -437,7 +437,7 @@ SOURCE_FILE@[0; 555)
437 COMMA@[535; 536) "," 437 COMMA@[535; 536) ","
438 WHITESPACE@[536; 537) " " 438 WHITESPACE@[536; 537) " "
439 DOT_DOT_PAT@[537; 539) 439 DOT_DOT_PAT@[537; 539)
440 DOTDOT@[537; 539) ".." 440 DOT2@[537; 539) ".."
441 COMMA@[539; 540) "," 441 COMMA@[539; 540) ","
442 WHITESPACE@[540; 541) " " 442 WHITESPACE@[540; 541) " "
443 BIND_PAT@[541; 545) 443 BIND_PAT@[541; 545)
@@ -450,7 +450,7 @@ SOURCE_FILE@[0; 555)
450 TUPLE_EXPR@[549; 551) 450 TUPLE_EXPR@[549; 551)
451 L_PAREN@[549; 550) "(" 451 L_PAREN@[549; 550) "("
452 R_PAREN@[550; 551) ")" 452 R_PAREN@[550; 551) ")"
453 SEMI@[551; 552) ";" 453 SEMICOLON@[551; 552) ";"
454 WHITESPACE@[552; 553) "\n" 454 WHITESPACE@[552; 553) "\n"
455 R_CURLY@[553; 554) "}" 455 R_CURLY@[553; 554) "}"
456 WHITESPACE@[554; 555) "\n" 456 WHITESPACE@[554; 555) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
index 06fbdfabf..0d786f597 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 63)
39 TUPLE_EXPR@[32; 34) 39 TUPLE_EXPR@[32; 34)
40 L_PAREN@[32; 33) "(" 40 L_PAREN@[32; 33) "("
41 R_PAREN@[33; 34) ")" 41 R_PAREN@[33; 34) ")"
42 SEMI@[34; 35) ";" 42 SEMICOLON@[34; 35) ";"
43 WHITESPACE@[35; 40) "\n " 43 WHITESPACE@[35; 40) "\n "
44 LET_STMT@[40; 60) 44 LET_STMT@[40; 60)
45 LET_KW@[40; 43) "let" 45 LET_KW@[40; 43) "let"
@@ -69,7 +69,7 @@ SOURCE_FILE@[0; 63)
69 TUPLE_EXPR@[57; 59) 69 TUPLE_EXPR@[57; 59)
70 L_PAREN@[57; 58) "(" 70 L_PAREN@[57; 58) "("
71 R_PAREN@[58; 59) ")" 71 R_PAREN@[58; 59) ")"
72 SEMI@[59; 60) ";" 72 SEMICOLON@[59; 60) ";"
73 WHITESPACE@[60; 61) "\n" 73 WHITESPACE@[60; 61) "\n"
74 R_CURLY@[61; 62) "}" 74 R_CURLY@[61; 62) "}"
75 WHITESPACE@[62; 63) "\n" 75 WHITESPACE@[62; 63) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast b/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast
index 9e3767fb7..d2f6d8fde 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast
@@ -37,7 +37,7 @@ SOURCE_FILE@[0; 43)
37 PATH_SEGMENT@[36; 39) 37 PATH_SEGMENT@[36; 39)
38 NAME_REF@[36; 39) 38 NAME_REF@[36; 39)
39 IDENT@[36; 39) "i32" 39 IDENT@[36; 39) "i32"
40 SEMI@[39; 40) ";" 40 SEMICOLON@[39; 40) ";"
41 WHITESPACE@[40; 41) "\n" 41 WHITESPACE@[40; 41) "\n"
42 R_CURLY@[41; 42) "}" 42 R_CURLY@[41; 42) "}"
43 WHITESPACE@[42; 43) "\n" 43 WHITESPACE@[42; 43) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast
index f81de7bac..21161f7bf 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast
@@ -19,5 +19,5 @@ SOURCE_FILE@[0; 24)
19 NAME_REF@[18; 21) 19 NAME_REF@[18; 21)
20 IDENT@[18; 21) "u32" 20 IDENT@[18; 21) "u32"
21 R_ANGLE@[21; 22) ">" 21 R_ANGLE@[21; 22) ">"
22 SEMI@[22; 23) ";" 22 SEMICOLON@[22; 23) ";"
23 WHITESPACE@[23; 24) "\n" 23 WHITESPACE@[23; 24) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast
index 78e296f88..1f297e479 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast
@@ -43,5 +43,5 @@ SOURCE_FILE@[0; 40)
43 WHITESPACE@[35; 36) " " 43 WHITESPACE@[35; 36) " "
44 INT_NUMBER@[36; 37) "2" 44 INT_NUMBER@[36; 37) "2"
45 R_BRACK@[37; 38) "]" 45 R_BRACK@[37; 38) "]"
46 SEMI@[38; 39) ";" 46 SEMICOLON@[38; 39) ";"
47 WHITESPACE@[39; 40) "\n" 47 WHITESPACE@[39; 40) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast
index de1536ef0..167c0fffa 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast
@@ -29,7 +29,7 @@ SOURCE_FILE@[0; 83)
29 NAME_REF@[15; 16) 29 NAME_REF@[15; 16)
30 IDENT@[15; 16) "U" 30 IDENT@[15; 16) "U"
31 R_ANGLE@[16; 17) ">" 31 R_ANGLE@[16; 17) ">"
32 SEMI@[17; 18) ";" 32 SEMICOLON@[17; 18) ";"
33 WHITESPACE@[18; 19) "\n" 33 WHITESPACE@[18; 19) "\n"
34 TRAIT_DEF@[19; 51) 34 TRAIT_DEF@[19; 51)
35 TRAIT_KW@[19; 24) "trait" 35 TRAIT_KW@[19; 24) "trait"
@@ -80,7 +80,7 @@ SOURCE_FILE@[0; 83)
80 PATH_SEGMENT@[46; 50) 80 PATH_SEGMENT@[46; 50)
81 NAME_REF@[46; 50) 81 NAME_REF@[46; 50)
82 IDENT@[46; 50) "Copy" 82 IDENT@[46; 50) "Copy"
83 SEMI@[50; 51) ";" 83 SEMICOLON@[50; 51) ";"
84 WHITESPACE@[51; 52) "\n" 84 WHITESPACE@[51; 52) "\n"
85 TRAIT_DEF@[52; 82) 85 TRAIT_DEF@[52; 82)
86 TRAIT_KW@[52; 57) "trait" 86 TRAIT_KW@[52; 57) "trait"
@@ -124,5 +124,5 @@ SOURCE_FILE@[0; 83)
124 NAME_REF@[79; 80) 124 NAME_REF@[79; 80)
125 IDENT@[79; 80) "U" 125 IDENT@[79; 80) "U"
126 R_ANGLE@[80; 81) ">" 126 R_ANGLE@[80; 81) ">"
127 SEMI@[81; 82) ";" 127 SEMICOLON@[81; 82) ";"
128 WHITESPACE@[82; 83) "\n" 128 WHITESPACE@[82; 83) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast
index cb686854a..ee1bd361d 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast
@@ -18,12 +18,12 @@ SOURCE_FILE@[0; 55)
18 PATH_SEGMENT@[14; 17) 18 PATH_SEGMENT@[14; 17)
19 NAME_REF@[14; 17) 19 NAME_REF@[14; 17)
20 IDENT@[14; 17) "Bar" 20 IDENT@[14; 17) "Bar"
21 COLONCOLON@[17; 19) "::" 21 COLON2@[17; 19) "::"
22 PATH_SEGMENT@[19; 22) 22 PATH_SEGMENT@[19; 22)
23 NAME_REF@[19; 22) 23 NAME_REF@[19; 22)
24 IDENT@[19; 22) "Baz" 24 IDENT@[19; 22) "Baz"
25 R_PAREN@[22; 23) ")" 25 R_PAREN@[22; 23) ")"
26 SEMI@[23; 24) ";" 26 SEMICOLON@[23; 24) ";"
27 WHITESPACE@[24; 25) "\n" 27 WHITESPACE@[24; 25) "\n"
28 TYPE_ALIAS_DEF@[25; 54) 28 TYPE_ALIAS_DEF@[25; 54)
29 TYPE_KW@[25; 29) "type" 29 TYPE_KW@[25; 29) "type"
@@ -49,10 +49,10 @@ SOURCE_FILE@[0; 55)
49 PATH_SEGMENT@[44; 47) 49 PATH_SEGMENT@[44; 47)
50 NAME_REF@[44; 47) 50 NAME_REF@[44; 47)
51 IDENT@[44; 47) "Bar" 51 IDENT@[44; 47) "Bar"
52 COLONCOLON@[47; 49) "::" 52 COLON2@[47; 49) "::"
53 PATH_SEGMENT@[49; 52) 53 PATH_SEGMENT@[49; 52)
54 NAME_REF@[49; 52) 54 NAME_REF@[49; 52)
55 IDENT@[49; 52) "Baz" 55 IDENT@[49; 52) "Baz"
56 R_PAREN@[52; 53) ")" 56 R_PAREN@[52; 53) ")"
57 SEMI@[53; 54) ";" 57 SEMICOLON@[53; 54) ";"
58 WHITESPACE@[54; 55) "\n" 58 WHITESPACE@[54; 55) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast
index 98727ae98..a5f8b6480 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast
@@ -55,7 +55,7 @@ SOURCE_FILE@[0; 63)
55 PATH_SEGMENT@[46; 49) 55 PATH_SEGMENT@[46; 49)
56 NAME_REF@[46; 49) 56 NAME_REF@[46; 49)
57 IDENT@[46; 49) "Qux" 57 IDENT@[46; 49) "Qux"
58 COLONCOLON@[49; 51) "::" 58 COLON2@[49; 51) "::"
59 PATH_SEGMENT@[51; 55) 59 PATH_SEGMENT@[51; 55)
60 NAME_REF@[51; 55) 60 NAME_REF@[51; 55)
61 IDENT@[51; 55) "Quux" 61 IDENT@[51; 55) "Quux"
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 63)
64 TUPLE_EXPR@[57; 59) 64 TUPLE_EXPR@[57; 59)
65 L_PAREN@[57; 58) "(" 65 L_PAREN@[57; 58) "("
66 R_PAREN@[58; 59) ")" 66 R_PAREN@[58; 59) ")"
67 SEMI@[59; 60) ";" 67 SEMICOLON@[59; 60) ";"
68 WHITESPACE@[60; 61) "\n" 68 WHITESPACE@[60; 61) "\n"
69 R_CURLY@[61; 62) "}" 69 R_CURLY@[61; 62) "}"
70 WHITESPACE@[62; 63) "\n" 70 WHITESPACE@[62; 63) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast
index 52d8f21a4..e0081a9f2 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast
@@ -22,5 +22,5 @@ SOURCE_FILE@[0; 23)
22 NAME_REF@[17; 20) 22 NAME_REF@[17; 20)
23 IDENT@[17; 20) "bar" 23 IDENT@[17; 20) "bar"
24 R_PAREN@[20; 21) ")" 24 R_PAREN@[20; 21) ")"
25 SEMI@[21; 22) ";" 25 SEMICOLON@[21; 22) ";"
26 WHITESPACE@[22; 23) "\n" 26 WHITESPACE@[22; 23) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast b/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast
index d568a1d45..548be2698 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 28)
32 AMP@[22; 23) "&" 32 AMP@[22; 23) "&"
33 LITERAL@[23; 24) 33 LITERAL@[23; 24)
34 INT_NUMBER@[23; 24) "2" 34 INT_NUMBER@[23; 24) "2"
35 SEMI@[24; 25) ";" 35 SEMICOLON@[24; 25) ";"
36 WHITESPACE@[25; 26) "\n" 36 WHITESPACE@[25; 26) "\n"
37 R_CURLY@[26; 27) "}" 37 R_CURLY@[26; 27) "}"
38 WHITESPACE@[27; 28) "\n" 38 WHITESPACE@[27; 28) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
index ba8779094..a7a547fce 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 34)
39 ARG_LIST@[28; 30) 39 ARG_LIST@[28; 30)
40 L_PAREN@[28; 29) "(" 40 L_PAREN@[28; 29) "("
41 R_PAREN@[29; 30) ")" 41 R_PAREN@[29; 30) ")"
42 SEMI@[30; 31) ";" 42 SEMICOLON@[30; 31) ";"
43 WHITESPACE@[31; 32) " " 43 WHITESPACE@[31; 32) " "
44 R_CURLY@[32; 33) "}" 44 R_CURLY@[32; 33) "}"
45 WHITESPACE@[33; 34) "\n" 45 WHITESPACE@[33; 34) "\n"
diff --git a/crates/ra_syntax/test_data/parser/ok/0006_inner_attributes.rast b/crates/ra_syntax/test_data/parser/ok/0006_inner_attributes.rast
index d72b72561..308b5680f 100644
--- a/crates/ra_syntax/test_data/parser/ok/0006_inner_attributes.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0006_inner_attributes.rast
@@ -1,7 +1,7 @@
1SOURCE_FILE@[0; 236) 1SOURCE_FILE@[0; 236)
2 ATTR@[0; 8) 2 ATTR@[0; 8)
3 POUND@[0; 1) "#" 3 POUND@[0; 1) "#"
4 EXCL@[1; 2) "!" 4 BANG@[1; 2) "!"
5 L_BRACK@[2; 3) "[" 5 L_BRACK@[2; 3) "["
6 PATH@[3; 7) 6 PATH@[3; 7)
7 PATH_SEGMENT@[3; 7) 7 PATH_SEGMENT@[3; 7)
@@ -11,7 +11,7 @@ SOURCE_FILE@[0; 236)
11 WHITESPACE@[8; 9) "\n" 11 WHITESPACE@[8; 9) "\n"
12 ATTR@[9; 23) 12 ATTR@[9; 23)
13 POUND@[9; 10) "#" 13 POUND@[9; 10) "#"
14 EXCL@[10; 11) "!" 14 BANG@[10; 11) "!"
15 L_BRACK@[11; 12) "[" 15 L_BRACK@[11; 12) "["
16 PATH@[12; 16) 16 PATH@[12; 16)
17 PATH_SEGMENT@[12; 16) 17 PATH_SEGMENT@[12; 16)
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 236)
25 WHITESPACE@[23; 24) "\n" 25 WHITESPACE@[23; 24) "\n"
26 ATTR@[24; 39) 26 ATTR@[24; 39)
27 POUND@[24; 25) "#" 27 POUND@[24; 25) "#"
28 EXCL@[25; 26) "!" 28 BANG@[25; 26) "!"
29 L_BRACK@[26; 27) "[" 29 L_BRACK@[26; 27) "["
30 PATH@[27; 31) 30 PATH@[27; 31)
31