aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock16
-rw-r--r--crates/ra_assists/src/assist_ctx.rs16
-rw-r--r--crates/ra_assists/src/doc_tests/generated.rs4
-rw-r--r--crates/ra_assists/src/handlers/add_custom_impl.rs10
-rw-r--r--crates/ra_assists/src/handlers/add_derive.rs8
-rw-r--r--crates/ra_assists/src/handlers/add_explicit_type.rs4
-rw-r--r--crates/ra_assists/src/handlers/add_from_impl_for_enum.rs4
-rw-r--r--crates/ra_assists/src/handlers/add_function.rs242
-rw-r--r--crates/ra_assists/src/handlers/add_impl.rs4
-rw-r--r--crates/ra_assists/src/handlers/add_new.rs8
-rw-r--r--crates/ra_assists/src/handlers/apply_demorgan.rs2
-rw-r--r--crates/ra_assists/src/handlers/change_visibility.rs4
-rw-r--r--crates/ra_assists/src/handlers/flip_binexpr.rs2
-rw-r--r--crates/ra_assists/src/handlers/inline_local_variable.rs2
-rw-r--r--crates/ra_assists/src/handlers/introduce_variable.rs6
-rw-r--r--crates/ra_assists/src/handlers/invert_if.rs2
-rw-r--r--crates/ra_assists/src/handlers/merge_match_arms.rs10
-rw-r--r--crates/ra_assists/src/handlers/move_guard.rs10
-rw-r--r--crates/ra_assists/src/handlers/raw_string.rs4
-rw-r--r--crates/ra_assists/src/handlers/remove_dbg.rs8
-rw-r--r--crates/ra_assists/src/handlers/remove_mut.rs2
-rw-r--r--crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs2
-rw-r--r--crates/ra_assists/src/lib.rs34
-rw-r--r--crates/ra_db/src/lib.rs4
-rw-r--r--crates/ra_hir/src/semantics.rs18
-rw-r--r--crates/ra_hir/src/source_analyzer.rs18
-rw-r--r--crates/ra_hir_def/src/body/scope.rs2
-rw-r--r--crates/ra_hir_expand/src/builtin_macro.rs4
-rw-r--r--crates/ra_hir_expand/src/lib.rs4
-rw-r--r--crates/ra_hir_ty/src/tests.rs4
-rw-r--r--crates/ra_hir_ty/src/tests/coercion.rs582
-rw-r--r--crates/ra_hir_ty/src/tests/macros.rs202
-rw-r--r--crates/ra_hir_ty/src/tests/method_resolution.rs376
-rw-r--r--crates/ra_hir_ty/src/tests/patterns.rs480
-rw-r--r--crates/ra_hir_ty/src/tests/regression.rs278
-rw-r--r--crates/ra_hir_ty/src/tests/simple.rs1360
-rw-r--r--crates/ra_hir_ty/src/tests/traits.rs1106
-rw-r--r--crates/ra_ide/src/assists.rs4
-rw-r--r--crates/ra_ide/src/call_hierarchy.rs36
-rw-r--r--crates/ra_ide/src/call_info.rs2
-rw-r--r--crates/ra_ide/src/completion/complete_attribute.rs240
-rw-r--r--crates/ra_ide/src/completion/complete_dot.rs112
-rw-r--r--crates/ra_ide/src/completion/complete_fn_param.rs12
-rw-r--r--crates/ra_ide/src/completion/complete_keyword.rs254
-rw-r--r--crates/ra_ide/src/completion/complete_macro_in_item_position.rs16
-rw-r--r--crates/ra_ide/src/completion/complete_pattern.rs28
-rw-r--r--crates/ra_ide/src/completion/complete_postfix.rs134
-rw-r--r--crates/ra_ide/src/completion/complete_qualified_path.rs196
-rw-r--r--crates/ra_ide/src/completion/complete_record.rs60
-rw-r--r--crates/ra_ide/src/completion/complete_snippet.rs20
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs53
-rw-r--r--crates/ra_ide/src/completion/complete_unqualified_path.rs361
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs13
-rw-r--r--crates/ra_ide/src/completion/presentation.rs200
-rw-r--r--crates/ra_ide/src/diagnostics.rs10
-rw-r--r--crates/ra_ide/src/display/structure.rs76
-rw-r--r--crates/ra_ide/src/extend_selection.rs44
-rw-r--r--crates/ra_ide/src/folding_ranges.rs7
-rw-r--r--crates/ra_ide/src/goto_definition.rs90
-rw-r--r--crates/ra_ide/src/goto_type_definition.rs10
-rw-r--r--crates/ra_ide/src/hover.rs2
-rw-r--r--crates/ra_ide/src/impls.rs20
-rw-r--r--crates/ra_ide/src/inlay_hints.rs166
-rw-r--r--crates/ra_ide/src/join_lines.rs40
-rw-r--r--crates/ra_ide/src/lib.rs4
-rw-r--r--crates/ra_ide/src/matching_brace.rs4
-rw-r--r--crates/ra_ide/src/parent_module.rs6
-rw-r--r--crates/ra_ide/src/references.rs90
-rw-r--r--crates/ra_ide/src/references/rename.rs21
-rw-r--r--crates/ra_ide/src/runnables.rs18
-rw-r--r--crates/ra_ide/src/snapshots/highlight_strings.html82
-rw-r--r--crates/ra_ide/src/source_change.rs4
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs228
-rw-r--r--crates/ra_ide/src/syntax_highlighting/html.rs14
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tests.rs72
-rw-r--r--crates/ra_ide/src/syntax_tree.rs277
-rw-r--r--crates/ra_ide/src/test_utils.rs4
-rw-r--r--crates/ra_ide/src/typing.rs25
-rw-r--r--crates/ra_ide/src/typing/on_enter.rs6
-rw-r--r--crates/ra_ide_db/src/line_index.rs66
-rw-r--r--crates/ra_ide_db/src/line_index_utils.rs51
-rw-r--r--crates/ra_ide_db/src/search.rs10
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs69
-rw-r--r--crates/ra_mbe/src/tests.rs408
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs5
-rw-r--r--crates/ra_syntax/Cargo.toml2
-rw-r--r--crates/ra_syntax/src/algo.rs12
-rw-r--r--crates/ra_syntax/src/ast/make.rs11
-rw-r--r--crates/ra_syntax/src/ast/tokens.rs369
-rw-r--r--crates/ra_syntax/src/fuzz.rs15
-rw-r--r--crates/ra_syntax/src/lib.rs4
-rw-r--r--crates/ra_syntax/src/parsing/lexer.rs32
-rw-r--r--crates/ra_syntax/src/parsing/reparsing.rs4
-rw-r--r--crates/ra_syntax/src/parsing/text_token_source.rs8
-rw-r--r--crates/ra_syntax/src/parsing/text_tree_sink.rs14
-rw-r--r--crates/ra_syntax/src/ptr.rs2
-rw-r--r--crates/ra_syntax/src/syntax_error.rs6
-rw-r--r--crates/ra_syntax/src/syntax_node.rs4
-rw-r--r--crates/ra_syntax/src/tests.rs8
-rw-r--r--crates/ra_syntax/src/validation.rs6
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0017_unclosed_string_at_eof.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0021_unclosed_string_with_space.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0022_unclosed_string_with_slash.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt2
-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/err/0051_unclosed_block_comment_at_eof.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.txt2
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0055_empty_int.txt26
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0056_empty_exponent.txt28
-rw-r--r--crates/ra_syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rast68
-rw-r--r--crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rast36
-rw-r--r--crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rast78
-rw-r--r--crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast76
-rw-r--r--crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rast32
-rw-r--r--crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rast120
-rw-r--r--crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rast148
-rw-r--r--crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast66
-rw-r--r--crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast162
-rw-r--r--crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast116
-rw-r--r--crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast90
-rw-r--r--crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast636
-rw-r--r--crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast178
-rw-r--r--crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast64
-rw-r--r--crates/ra_syntax/test_data/parser/err/0015_curly_in_params.rast48
-rw-r--r--crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast88
-rw-r--r--crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast94
-rw-r--r--crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast264
-rw-r--r--crates/ra_syntax/test_data/parser/err/0019_let_recover.rast214
-rw-r--r--crates/ra_syntax/test_data/parser/err/0020_fn_recover.rast42
-rw-r--r--crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rast70
-rw-r--r--crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast366
-rw-r--r--crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast88
-rw-r--r--crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast642
-rw-r--r--crates/ra_syntax/test_data/parser/err/0025_nope.rast408
-rw-r--r--crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast98
-rw-r--r--crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast58
-rw-r--r--crates/ra_syntax/test_data/parser/err/0029_field_completion.rast72
-rw-r--r--crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast250
-rw-r--r--crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast408
-rw-r--r--crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast134
-rw-r--r--crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast192
-rw-r--r--crates/ra_syntax/test_data/parser/err/0035_use_recover.rast108
-rw-r--r--crates/ra_syntax/test_data/parser/err/0036_partial_use.rast102
-rw-r--r--crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast198
-rw-r--r--crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast60
-rw-r--r--crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast166
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast54
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast58
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast34
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rast158
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast46
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast74
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast64
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast52
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast122
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast106
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast82
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast42
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast118
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast98
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast144
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0002_use_tree_list.rast270
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast124
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast120
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0005_function_type_params.rast76
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast242
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast80
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast194
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast52
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0010_extern_block.rast18
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast120
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast66
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast70
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast74
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0016_unsafe_trait.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast42
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast148
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast90
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0020_use_star.rast118
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast160
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast106
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast84
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast34
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast210
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast100
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast86
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast180
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0030_cond.rast418
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast178
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast196
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast100
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast110
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0036_unsafe_extern_fn.rast44
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast158
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast58
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast110
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast126
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast250
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast296
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast276
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0044_block_items.rast60
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast94
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast40
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.rast36
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast166
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast44
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast28
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast140
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast192
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast88
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0055_literal_pattern.rast154
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast222
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0057_const_fn.rast34
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast166
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0059_match_arms_commas.rast120
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0060_extern_crate.rast20
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast250
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast134
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast46
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast264
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast86
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast304
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0067_crate_path.rast30
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast92
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast74
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast106
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast192
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast58
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast40
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast126
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast180
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0076_function_where_clause.rast80
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast52
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast32
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rast28
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast192
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast486
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast110
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast174
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast38
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast272
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0086_function_ret_type.rast72
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.rast32
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0088_break_ambiguity.rast138
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0089_extern_fn.rast36
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast44
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0091_auto_trait.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast46
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast68
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0094_unsafe_auto_trait.rast30
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast58
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast260
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.rast32
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0098_const_unsafe_fn.rast38
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.rast206
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast72
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0101_unsafe_fn.rast34
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast266
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast110
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast82
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast86
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast280
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast126
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast78
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0109_label.rast136
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0110_use_path.rast76
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast180
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast256
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast114
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast128
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast82
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast86
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast80
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0118_match_guard.rast96
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast162
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast292
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast132
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast100
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0124_async_fn.rast34
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast64
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast96
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast198
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast118
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0128_combined_fns.rast74
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast74
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast258
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast66
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast62
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast180
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast112
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast128
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast140
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast112
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast132
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast52
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast70
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast84
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast222
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast912
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast152
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast86
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast46
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rast90
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rast42
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast94
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast76
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast256
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast74
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast116
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast140
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.rast88
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0156_or_pattern.rast224
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast52
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast60
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast76
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast90
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0000_empty.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast78
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.rast44
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0004_file_shebang.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0005_fn_item.rast32
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0006_inner_attributes.rast368
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast80
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast186
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0009_use_item.rast42
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0010_use_path_segments.rast84
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0011_outer_attribute.rast116
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0012_visibility.rast214
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0013_use_path_self_super.rast114
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0014_use_tree.rast190
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0015_use_tree.rast130
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast186
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0017_attr_trailing_comma.rast58
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast514
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0019_enums.rast310
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast536
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0021_extern_fn.rast118
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0022_empty_extern_block.rast42
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0023_static_items.rast82
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0024_const_item.rast118
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0025_extern_fn_in_block.rast66
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0026_const_fn_in_block.rast64
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rast86
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast372
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast304
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast128
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0030_traits.rast122
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0031_extern.rast1946
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0032_where_for.rast182
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0033_label_break.rast440
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0034_crate_path_in_call.rast84
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast4658
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast186
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0037_mod.rast32
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0038_where_pred_type.rast86
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0039_raw_fn_item.rast32
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.rast44
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast100
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast252
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast220
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast152
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast362
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0046_extern_inner_attributes.rast56
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast646
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast402
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0049_async_block.rast72
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast184
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast1038
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast162
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast78
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast252
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast100
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0056_neq_in_type.rast132
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast118
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0058_unary_expr_precedence.rast194
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast202
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0060_as_range.rast112
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0061_match_full_range.rast54
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rast352
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast396
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast266
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast332
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0065_comment_newline.rast34
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast122
-rw-r--r--crates/ra_text_edit/Cargo.toml3
-rw-r--r--crates/ra_text_edit/src/lib.rs10
-rw-r--r--crates/ra_text_edit/src/text_edit.rs25
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs2
-rw-r--r--crates/rust-analyzer/src/conv.rs18
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs18
-rw-r--r--crates/test_utils/Cargo.toml2
-rw-r--r--crates/test_utils/src/lib.rs26
-rw-r--r--docs/dev/syntax.md154
-rw-r--r--docs/user/assists.md4
-rw-r--r--editors/code/src/source_change.ts8
446 files changed, 27963 insertions, 27072 deletions
diff --git a/Cargo.lock b/Cargo.lock
index d966ebe61..20e6cd540 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1180,7 +1180,7 @@ dependencies = [
1180name = "ra_text_edit" 1180name = "ra_text_edit"
1181version = "0.1.0" 1181version = "0.1.0"
1182dependencies = [ 1182dependencies = [
1183 "text_unit", 1183 "text-size",
1184] 1184]
1185 1185
1186[[package]] 1186[[package]]
@@ -1322,13 +1322,13 @@ dependencies = [
1322 1322
1323[[package]] 1323[[package]]
1324name = "rowan" 1324name = "rowan"
1325version = "0.9.1" 1325version = "0.10.0"
1326source = "registry+https://github.com/rust-lang/crates.io-index" 1326source = "registry+https://github.com/rust-lang/crates.io-index"
1327checksum = "1ea7cadf87a9d8432e85cb4eb86bd2e765ace60c24ef86e79084dcae5d1c5a19" 1327checksum = "1e081ed6eacce09e243b619ab90f069c27b0cff8a6d0eb8ad2ec935b65853798"
1328dependencies = [ 1328dependencies = [
1329 "rustc-hash", 1329 "rustc-hash",
1330 "smol_str", 1330 "smol_str",
1331 "text_unit", 1331 "text-size",
1332 "thin-dst", 1332 "thin-dst",
1333] 1333]
1334 1334
@@ -1620,14 +1620,14 @@ version = "0.1.0"
1620dependencies = [ 1620dependencies = [
1621 "difference", 1621 "difference",
1622 "serde_json", 1622 "serde_json",
1623 "text_unit", 1623 "text-size",
1624] 1624]
1625 1625
1626[[package]] 1626[[package]]
1627name = "text_unit" 1627name = "text-size"
1628version = "0.1.10" 1628version = "1.0.0"
1629source = "registry+https://github.com/rust-lang/crates.io-index" 1629source = "registry+https://github.com/rust-lang/crates.io-index"
1630checksum = "20431e104bfecc1a40872578dbc390e10290a0e9c35fffe3ce6f73c15a9dbfc2" 1630checksum = "f03e7efdedc3bc78cb2337f1e2785c39e45f5ef762d9e4ebb137fff7380a6d8a"
1631 1631
1632[[package]] 1632[[package]]
1633name = "thin-dst" 1633name = "thin-dst"
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs
index c3e653299..2fe7c3de3 100644
--- a/crates/ra_assists/src/assist_ctx.rs
+++ b/crates/ra_assists/src/assist_ctx.rs
@@ -5,12 +5,12 @@ use ra_fmt::{leading_indent, reindent};
5use ra_ide_db::RootDatabase; 5use ra_ide_db::RootDatabase;
6use ra_syntax::{ 6use ra_syntax::{
7 algo::{self, find_covering_element, find_node_at_offset}, 7 algo::{self, find_covering_element, find_node_at_offset},
8 AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextUnit, 8 AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize,
9 TokenAtOffset, 9 TokenAtOffset,
10}; 10};
11use ra_text_edit::TextEditBuilder; 11use ra_text_edit::TextEditBuilder;
12 12
13use crate::{AssistAction, AssistId, AssistLabel, GroupLabel, ResolvedAssist}; 13use crate::{AssistAction, AssistFile, AssistId, AssistLabel, GroupLabel, ResolvedAssist};
14use algo::SyntaxRewriter; 14use algo::SyntaxRewriter;
15 15
16#[derive(Clone, Debug)] 16#[derive(Clone, Debug)]
@@ -178,8 +178,9 @@ impl<'a> AssistGroup<'a> {
178#[derive(Default)] 178#[derive(Default)]
179pub(crate) struct ActionBuilder { 179pub(crate) struct ActionBuilder {
180 edit: TextEditBuilder, 180 edit: TextEditBuilder,
181 cursor_position: Option<TextUnit>, 181 cursor_position: Option<TextSize>,
182 target: Option<TextRange>, 182 target: Option<TextRange>,
183 file: AssistFile,
183} 184}
184 185
185impl ActionBuilder { 186impl ActionBuilder {
@@ -210,12 +211,12 @@ impl ActionBuilder {
210 } 211 }
211 212
212 /// Append specified `text` at the given `offset` 213 /// Append specified `text` at the given `offset`
213 pub(crate) fn insert(&mut self, offset: TextUnit, text: impl Into<String>) { 214 pub(crate) fn insert(&mut self, offset: TextSize, text: impl Into<String>) {
214 self.edit.insert(offset, text.into()) 215 self.edit.insert(offset, text.into())
215 } 216 }
216 217
217 /// Specify desired position of the cursor after the assist is applied. 218 /// Specify desired position of the cursor after the assist is applied.
218 pub(crate) fn set_cursor(&mut self, offset: TextUnit) { 219 pub(crate) fn set_cursor(&mut self, offset: TextSize) {
219 self.cursor_position = Some(offset) 220 self.cursor_position = Some(offset)
220 } 221 }
221 222
@@ -241,11 +242,16 @@ impl ActionBuilder {
241 algo::diff(&node, &new).into_text_edit(&mut self.edit) 242 algo::diff(&node, &new).into_text_edit(&mut self.edit)
242 } 243 }
243 244
245 pub(crate) fn set_file(&mut self, assist_file: AssistFile) {
246 self.file = assist_file
247 }
248
244 fn build(self) -> AssistAction { 249 fn build(self) -> AssistAction {
245 AssistAction { 250 AssistAction {
246 edit: self.edit.finish(), 251 edit: self.edit.finish(),
247 cursor_position: self.cursor_position, 252 cursor_position: self.cursor_position,
248 target: self.target, 253 target: self.target,
254 file: self.file,
249 } 255 }
250 } 256 }
251} 257}
diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs
index b39e60870..e4fa9ee36 100644
--- a/crates/ra_assists/src/doc_tests/generated.rs
+++ b/crates/ra_assists/src/doc_tests/generated.rs
@@ -66,7 +66,7 @@ fn doctest_add_function() {
66struct Baz; 66struct Baz;
67fn baz() -> Baz { Baz } 67fn baz() -> Baz { Baz }
68fn foo() { 68fn foo() {
69 bar<|>("", baz()); 69 bar<|>("", baz());
70} 70}
71 71
72"#####, 72"#####,
@@ -74,7 +74,7 @@ fn foo() {
74struct Baz; 74struct Baz;
75fn baz() -> Baz { Baz } 75fn baz() -> Baz { Baz }
76fn foo() { 76fn foo() {
77 bar("", baz()); 77 bar("", baz());
78} 78}
79 79
80fn bar(arg: &str, baz: Baz) { 80fn bar(arg: &str, baz: Baz) {
diff --git a/crates/ra_assists/src/handlers/add_custom_impl.rs b/crates/ra_assists/src/handlers/add_custom_impl.rs
index 15f9b216b..4ea26a550 100644
--- a/crates/ra_assists/src/handlers/add_custom_impl.rs
+++ b/crates/ra_assists/src/handlers/add_custom_impl.rs
@@ -2,7 +2,7 @@ use ra_syntax::{
2 ast::{self, AstNode}, 2 ast::{self, AstNode},
3 Direction, SmolStr, 3 Direction, SmolStr,
4 SyntaxKind::{IDENT, WHITESPACE}, 4 SyntaxKind::{IDENT, WHITESPACE},
5 TextRange, TextUnit, 5 TextRange, TextSize,
6}; 6};
7use stdx::SepBy; 7use stdx::SepBy;
8 8
@@ -60,7 +60,6 @@ pub(crate) fn add_custom_impl(ctx: AssistCtx) -> Option<Assist> {
60 .collect::<Vec<SmolStr>>(); 60 .collect::<Vec<SmolStr>>();
61 let has_more_derives = !new_attr_input.is_empty(); 61 let has_more_derives = !new_attr_input.is_empty();
62 let new_attr_input = new_attr_input.iter().sep_by(", ").surround_with("(", ")").to_string(); 62 let new_attr_input = new_attr_input.iter().sep_by(", ").surround_with("(", ")").to_string();
63 let new_attr_input_len = new_attr_input.len();
64 63
65 let mut buf = String::new(); 64 let mut buf = String::new();
66 buf.push_str("\n\nimpl "); 65 buf.push_str("\n\nimpl ");
@@ -70,8 +69,9 @@ pub(crate) fn add_custom_impl(ctx: AssistCtx) -> Option<Assist> {
70 buf.push_str(" {\n"); 69 buf.push_str(" {\n");
71 70
72 let cursor_delta = if has_more_derives { 71 let cursor_delta = if has_more_derives {
72 let delta = input.syntax().text_range().len() - TextSize::of(&new_attr_input);
73 edit.replace(input.syntax().text_range(), new_attr_input); 73 edit.replace(input.syntax().text_range(), new_attr_input);
74 input.syntax().text_range().len() - TextUnit::from_usize(new_attr_input_len) 74 delta
75 } else { 75 } else {
76 let attr_range = attr.syntax().text_range(); 76 let attr_range = attr.syntax().text_range();
77 edit.delete(attr_range); 77 edit.delete(attr_range);
@@ -81,13 +81,13 @@ pub(crate) fn add_custom_impl(ctx: AssistCtx) -> Option<Assist> {
81 .next_sibling_or_token() 81 .next_sibling_or_token()
82 .filter(|t| t.kind() == WHITESPACE) 82 .filter(|t| t.kind() == WHITESPACE)
83 .map(|t| t.text_range()) 83 .map(|t| t.text_range())
84 .unwrap_or_else(|| TextRange::from_to(TextUnit::from(0), TextUnit::from(0))); 84 .unwrap_or_else(|| TextRange::new(TextSize::from(0), TextSize::from(0)));
85 edit.delete(line_break_range); 85 edit.delete(line_break_range);
86 86
87 attr_range.len() + line_break_range.len() 87 attr_range.len() + line_break_range.len()
88 }; 88 };
89 89
90 edit.set_cursor(start_offset + TextUnit::of_str(&buf) - cursor_delta); 90 edit.set_cursor(start_offset + TextSize::of(&buf) - cursor_delta);
91 buf.push_str("\n}"); 91 buf.push_str("\n}");
92 edit.insert(start_offset, buf); 92 edit.insert(start_offset, buf);
93 }) 93 })
diff --git a/crates/ra_assists/src/handlers/add_derive.rs b/crates/ra_assists/src/handlers/add_derive.rs
index b0d1a0a80..6254eb7c4 100644
--- a/crates/ra_assists/src/handlers/add_derive.rs
+++ b/crates/ra_assists/src/handlers/add_derive.rs
@@ -1,7 +1,7 @@
1use ra_syntax::{ 1use ra_syntax::{
2 ast::{self, AstNode, AttrsOwner}, 2 ast::{self, AstNode, AttrsOwner},
3 SyntaxKind::{COMMENT, WHITESPACE}, 3 SyntaxKind::{COMMENT, WHITESPACE},
4 TextUnit, 4 TextSize,
5}; 5};
6 6
7use crate::{Assist, AssistCtx, AssistId}; 7use crate::{Assist, AssistCtx, AssistId};
@@ -37,9 +37,9 @@ pub(crate) fn add_derive(ctx: AssistCtx) -> Option<Assist> {
37 let offset = match derive_attr { 37 let offset = match derive_attr {
38 None => { 38 None => {
39 edit.insert(node_start, "#[derive()]\n"); 39 edit.insert(node_start, "#[derive()]\n");
40 node_start + TextUnit::of_str("#[derive(") 40 node_start + TextSize::of("#[derive(")
41 } 41 }
42 Some(tt) => tt.syntax().text_range().end() - TextUnit::of_char(')'), 42 Some(tt) => tt.syntax().text_range().end() - TextSize::of(')'),
43 }; 43 };
44 edit.target(nominal.syntax().text_range()); 44 edit.target(nominal.syntax().text_range());
45 edit.set_cursor(offset) 45 edit.set_cursor(offset)
@@ -47,7 +47,7 @@ pub(crate) fn add_derive(ctx: AssistCtx) -> Option<Assist> {
47} 47}
48 48
49// Insert `derive` after doc comments. 49// Insert `derive` after doc comments.
50fn derive_insertion_offset(nominal: &ast::NominalDef) -> Option<TextUnit> { 50fn derive_insertion_offset(nominal: &ast::NominalDef) -> Option<TextSize> {
51 let non_ws_child = nominal 51 let non_ws_child = nominal
52 .syntax() 52 .syntax()
53 .children_with_tokens() 53 .children_with_tokens()
diff --git a/crates/ra_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs
index 6c56d93d8..bc313782b 100644
--- a/crates/ra_assists/src/handlers/add_explicit_type.rs
+++ b/crates/ra_assists/src/handlers/add_explicit_type.rs
@@ -37,8 +37,8 @@ pub(crate) fn add_explicit_type(ctx: AssistCtx) -> Option<Assist> {
37 let stmt_range = stmt.syntax().text_range(); 37 let stmt_range = stmt.syntax().text_range();
38 let eq_range = stmt.eq_token()?.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::new(stmt_range.start(), eq_range.start());
41 let cursor_in_range = ctx.frange.range.is_subrange(&let_range); 41 let cursor_in_range = let_range.contains_range(ctx.frange.range);
42 if !cursor_in_range { 42 if !cursor_in_range {
43 return None; 43 return None;
44 } 44 }
diff --git a/crates/ra_assists/src/handlers/add_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/add_from_impl_for_enum.rs
index 0621487e8..03806724a 100644
--- a/crates/ra_assists/src/handlers/add_from_impl_for_enum.rs
+++ b/crates/ra_assists/src/handlers/add_from_impl_for_enum.rs
@@ -1,6 +1,6 @@
1use ra_syntax::{ 1use ra_syntax::{
2 ast::{self, AstNode, NameOwner}, 2 ast::{self, AstNode, NameOwner},
3 TextUnit, 3 TextSize,
4}; 4};
5use stdx::format_to; 5use stdx::format_to;
6 6
@@ -65,7 +65,7 @@ impl From<{0}> for {1} {{
65 variant_name 65 variant_name
66 ); 66 );
67 edit.insert(start_offset, buf); 67 edit.insert(start_offset, buf);
68 edit.set_cursor(start_offset + TextUnit::of_str("\n\n")); 68 edit.set_cursor(start_offset + TextSize::of("\n\n"));
69 }, 69 },
70 ) 70 )
71} 71}
diff --git a/crates/ra_assists/src/handlers/add_function.rs b/crates/ra_assists/src/handlers/add_function.rs
index ad4ab66ed..6c7456579 100644
--- a/crates/ra_assists/src/handlers/add_function.rs
+++ b/crates/ra_assists/src/handlers/add_function.rs
@@ -1,10 +1,10 @@
1use ra_syntax::{ 1use ra_syntax::{
2 ast::{self, AstNode}, 2 ast::{self, AstNode},
3 SyntaxKind, SyntaxNode, TextUnit, 3 SyntaxKind, SyntaxNode, TextSize,
4}; 4};
5 5
6use crate::{Assist, AssistCtx, AssistId}; 6use crate::{Assist, AssistCtx, AssistFile, AssistId};
7use ast::{edit::IndentLevel, ArgListOwner, CallExpr, Expr}; 7use ast::{edit::IndentLevel, ArgListOwner, ModuleItemOwner};
8use hir::HirDisplay; 8use hir::HirDisplay;
9use rustc_hash::{FxHashMap, FxHashSet}; 9use rustc_hash::{FxHashMap, FxHashSet};
10 10
@@ -16,7 +16,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
16// struct Baz; 16// struct Baz;
17// fn baz() -> Baz { Baz } 17// fn baz() -> Baz { Baz }
18// fn foo() { 18// fn foo() {
19// bar<|>("", baz()); 19// bar<|>("", baz());
20// } 20// }
21// 21//
22// ``` 22// ```
@@ -25,7 +25,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
25// struct Baz; 25// struct Baz;
26// fn baz() -> Baz { Baz } 26// fn baz() -> Baz { Baz }
27// fn foo() { 27// fn foo() {
28// bar("", baz()); 28// bar("", baz());
29// } 29// }
30// 30//
31// fn bar(arg: &str, baz: Baz) { 31// fn bar(arg: &str, baz: Baz) {
@@ -38,21 +38,30 @@ pub(crate) fn add_function(ctx: AssistCtx) -> Option<Assist> {
38 let call = path_expr.syntax().parent().and_then(ast::CallExpr::cast)?; 38 let call = path_expr.syntax().parent().and_then(ast::CallExpr::cast)?;
39 let path = path_expr.path()?; 39 let path = path_expr.path()?;
40 40
41 if path.qualifier().is_some() {
42 return None;
43 }
44
45 if ctx.sema.resolve_path(&path).is_some() { 41 if ctx.sema.resolve_path(&path).is_some() {
46 // The function call already resolves, no need to add a function 42 // The function call already resolves, no need to add a function
47 return None; 43 return None;
48 } 44 }
49 45
50 let function_builder = FunctionBuilder::from_call(&ctx, &call)?; 46 let target_module = if let Some(qualifier) = path.qualifier() {
47 if let Some(hir::PathResolution::Def(hir::ModuleDef::Module(module))) =
48 ctx.sema.resolve_path(&qualifier)
49 {
50 Some(module.definition_source(ctx.sema.db))
51 } else {
52 return None;
53 }
54 } else {
55 None
56 };
57
58 let function_builder = FunctionBuilder::from_call(&ctx, &call, &path, target_module)?;
51 59
52 ctx.add_assist(AssistId("add_function"), "Add function", |edit| { 60 ctx.add_assist(AssistId("add_function"), "Add function", |edit| {
53 edit.target(call.syntax().text_range()); 61 edit.target(call.syntax().text_range());
54 62
55 if let Some(function_template) = function_builder.render() { 63 if let Some(function_template) = function_builder.render() {
64 edit.set_file(function_template.file);
56 edit.set_cursor(function_template.cursor_offset); 65 edit.set_cursor(function_template.cursor_offset);
57 edit.insert(function_template.insert_offset, function_template.fn_def.to_string()); 66 edit.insert(function_template.insert_offset, function_template.fn_def.to_string());
58 } 67 }
@@ -60,32 +69,70 @@ pub(crate) fn add_function(ctx: AssistCtx) -> Option<Assist> {
60} 69}
61 70
62struct FunctionTemplate { 71struct FunctionTemplate {
63 insert_offset: TextUnit, 72 insert_offset: TextSize,
64 cursor_offset: TextUnit, 73 cursor_offset: TextSize,
65 fn_def: ast::SourceFile, 74 fn_def: ast::SourceFile,
75 file: AssistFile,
66} 76}
67 77
68struct FunctionBuilder { 78struct FunctionBuilder {
69 append_fn_at: SyntaxNode, 79 target: GeneratedFunctionTarget,
70 fn_name: ast::Name, 80 fn_name: ast::Name,
71 type_params: Option<ast::TypeParamList>, 81 type_params: Option<ast::TypeParamList>,
72 params: ast::ParamList, 82 params: ast::ParamList,
83 file: AssistFile,
84 needs_pub: bool,
73} 85}
74 86
75impl FunctionBuilder { 87impl FunctionBuilder {
76 fn from_call(ctx: &AssistCtx, call: &ast::CallExpr) -> Option<Self> { 88 /// Prepares a generated function that matches `call` in `generate_in`
77 let append_fn_at = next_space_for_fn(&call)?; 89 /// (or as close to `call` as possible, if `generate_in` is `None`)
78 let fn_name = fn_name(&call)?; 90 fn from_call(
91 ctx: &AssistCtx,
92 call: &ast::CallExpr,
93 path: &ast::Path,
94 target_module: Option<hir::InFile<hir::ModuleSource>>,
95 ) -> Option<Self> {
96 let needs_pub = target_module.is_some();
97 let mut file = AssistFile::default();
98 let target = if let Some(target_module) = target_module {
99 let (in_file, target) = next_space_for_fn_in_module(ctx.sema.db, target_module)?;
100 file = in_file;
101 target
102 } else {
103 next_space_for_fn_after_call_site(&call)?
104 };
105 let fn_name = fn_name(&path)?;
79 let (type_params, params) = fn_args(ctx, &call)?; 106 let (type_params, params) = fn_args(ctx, &call)?;
80 Some(Self { append_fn_at, fn_name, type_params, params }) 107 Some(Self { target, fn_name, type_params, params, file, needs_pub })
81 } 108 }
109
82 fn render(self) -> Option<FunctionTemplate> { 110 fn render(self) -> Option<FunctionTemplate> {
83 let placeholder_expr = ast::make::expr_todo(); 111 let placeholder_expr = ast::make::expr_todo();
84 let fn_body = ast::make::block_expr(vec![], Some(placeholder_expr)); 112 let fn_body = ast::make::block_expr(vec![], Some(placeholder_expr));
85 let fn_def = ast::make::fn_def(self.fn_name, self.type_params, self.params, fn_body); 113 let mut fn_def = ast::make::fn_def(self.fn_name, self.type_params, self.params, fn_body);
86 let fn_def = ast::make::add_newlines(2, fn_def); 114 if self.needs_pub {
87 let fn_def = IndentLevel::from_node(&self.append_fn_at).increase_indent(fn_def); 115 fn_def = ast::make::add_pub_crate_modifier(fn_def);
88 let insert_offset = self.append_fn_at.text_range().end(); 116 }
117
118 let (fn_def, insert_offset) = match self.target {
119 GeneratedFunctionTarget::BehindItem(it) => {
120 let with_leading_blank_line = ast::make::add_leading_newlines(2, fn_def);
121 let indented = IndentLevel::from_node(&it).increase_indent(with_leading_blank_line);
122 (indented, it.text_range().end())
123 }
124 GeneratedFunctionTarget::InEmptyItemList(it) => {
125 let indent_once = IndentLevel(1);
126 let indent = IndentLevel::from_node(it.syntax());
127
128 let fn_def = ast::make::add_leading_newlines(1, fn_def);
129 let fn_def = indent_once.increase_indent(fn_def);
130 let fn_def = ast::make::add_trailing_newlines(1, fn_def);
131 let fn_def = indent.increase_indent(fn_def);
132 (fn_def, it.syntax().text_range().start() + TextSize::of('{'))
133 }
134 };
135
89 let cursor_offset_from_fn_start = fn_def 136 let cursor_offset_from_fn_start = fn_def
90 .syntax() 137 .syntax()
91 .descendants() 138 .descendants()
@@ -94,19 +141,24 @@ impl FunctionBuilder {
94 .text_range() 141 .text_range()
95 .start(); 142 .start();
96 let cursor_offset = insert_offset + cursor_offset_from_fn_start; 143 let cursor_offset = insert_offset + cursor_offset_from_fn_start;
97 Some(FunctionTemplate { insert_offset, cursor_offset, fn_def }) 144 Some(FunctionTemplate { insert_offset, cursor_offset, fn_def, file: self.file })
98 } 145 }
99} 146}
100 147
101fn fn_name(call: &CallExpr) -> Option<ast::Name> { 148enum GeneratedFunctionTarget {
102 let name = call.expr()?.syntax().to_string(); 149 BehindItem(SyntaxNode),
150 InEmptyItemList(ast::ItemList),
151}
152
153fn fn_name(call: &ast::Path) -> Option<ast::Name> {
154 let name = call.segment()?.syntax().to_string();
103 Some(ast::make::name(&name)) 155 Some(ast::make::name(&name))
104} 156}
105 157
106/// Computes the type variables and arguments required for the generated function 158/// Computes the type variables and arguments required for the generated function
107fn fn_args( 159fn fn_args(
108 ctx: &AssistCtx, 160 ctx: &AssistCtx,
109 call: &CallExpr, 161 call: &ast::CallExpr,
110) -> Option<(Option<ast::TypeParamList>, ast::ParamList)> { 162) -> Option<(Option<ast::TypeParamList>, ast::ParamList)> {
111 let mut arg_names = Vec::new(); 163 let mut arg_names = Vec::new();
112 let mut arg_types = Vec::new(); 164 let mut arg_types = Vec::new();
@@ -158,9 +210,9 @@ fn deduplicate_arg_names(arg_names: &mut Vec<String>) {
158 } 210 }
159} 211}
160 212
161fn fn_arg_name(fn_arg: &Expr) -> Option<String> { 213fn fn_arg_name(fn_arg: &ast::Expr) -> Option<String> {
162 match fn_arg { 214 match fn_arg {
163 Expr::CastExpr(cast_expr) => fn_arg_name(&cast_expr.expr()?), 215 ast::Expr::CastExpr(cast_expr) => fn_arg_name(&cast_expr.expr()?),
164 _ => Some( 216 _ => Some(
165 fn_arg 217 fn_arg
166 .syntax() 218 .syntax()
@@ -172,7 +224,7 @@ fn fn_arg_name(fn_arg: &Expr) -> Option<String> {
172 } 224 }
173} 225}
174 226
175fn fn_arg_type(ctx: &AssistCtx, fn_arg: &Expr) -> Option<String> { 227fn fn_arg_type(ctx: &AssistCtx, fn_arg: &ast::Expr) -> Option<String> {
176 let ty = ctx.sema.type_of_expr(fn_arg)?; 228 let ty = ctx.sema.type_of_expr(fn_arg)?;
177 if ty.is_unknown() { 229 if ty.is_unknown() {
178 return None; 230 return None;
@@ -184,7 +236,7 @@ fn fn_arg_type(ctx: &AssistCtx, fn_arg: &Expr) -> Option<String> {
184/// directly after the current block 236/// directly after the current block
185/// We want to write the generated function directly after 237/// We want to write the generated function directly after
186/// fns, impls or macro calls, but inside mods 238/// fns, impls or macro calls, but inside mods
187fn next_space_for_fn(expr: &CallExpr) -> Option<SyntaxNode> { 239fn next_space_for_fn_after_call_site(expr: &ast::CallExpr) -> Option<GeneratedFunctionTarget> {
188 let mut ancestors = expr.syntax().ancestors().peekable(); 240 let mut ancestors = expr.syntax().ancestors().peekable();
189 let mut last_ancestor: Option<SyntaxNode> = None; 241 let mut last_ancestor: Option<SyntaxNode> = None;
190 while let Some(next_ancestor) = ancestors.next() { 242 while let Some(next_ancestor) = ancestors.next() {
@@ -201,7 +253,32 @@ fn next_space_for_fn(expr: &CallExpr) -> Option<SyntaxNode> {
201 } 253 }
202 last_ancestor = Some(next_ancestor); 254 last_ancestor = Some(next_ancestor);
203 } 255 }
204 last_ancestor 256 last_ancestor.map(GeneratedFunctionTarget::BehindItem)
257}
258
259fn next_space_for_fn_in_module(
260 db: &dyn hir::db::AstDatabase,
261 module: hir::InFile<hir::ModuleSource>,
262) -> Option<(AssistFile, GeneratedFunctionTarget)> {
263 let file = module.file_id.original_file(db);
264 let assist_file = AssistFile::TargetFile(file);
265 let assist_item = match module.value {
266 hir::ModuleSource::SourceFile(it) => {
267 if let Some(last_item) = it.items().last() {
268 GeneratedFunctionTarget::BehindItem(last_item.syntax().clone())
269 } else {
270 GeneratedFunctionTarget::BehindItem(it.syntax().clone())
271 }
272 }
273 hir::ModuleSource::Module(it) => {
274 if let Some(last_item) = it.item_list().and_then(|it| it.items().last()) {
275 GeneratedFunctionTarget::BehindItem(last_item.syntax().clone())
276 } else {
277 GeneratedFunctionTarget::InEmptyItemList(it.item_list()?)
278 }
279 }
280 };
281 Some((assist_file, assist_item))
205} 282}
206 283
207#[cfg(test)] 284#[cfg(test)]
@@ -714,6 +791,111 @@ fn bar(baz_1: Baz, baz_2: Baz, arg_1: &str, arg_2: &str) {
714 } 791 }
715 792
716 #[test] 793 #[test]
794 fn add_function_in_module() {
795 check_assist(
796 add_function,
797 r"
798mod bar {}
799
800fn foo() {
801 bar::my_fn<|>()
802}
803",
804 r"
805mod bar {
806 pub(crate) fn my_fn() {
807 <|>todo!()
808 }
809}
810
811fn foo() {
812 bar::my_fn()
813}
814",
815 )
816 }
817
818 #[test]
819 fn add_function_in_module_containing_other_items() {
820 check_assist(
821 add_function,
822 r"
823mod bar {
824 fn something_else() {}
825}
826
827fn foo() {
828 bar::my_fn<|>()
829}
830",
831 r"
832mod bar {
833 fn something_else() {}
834
835 pub(crate) fn my_fn() {
836 <|>todo!()
837 }
838}
839
840fn foo() {
841 bar::my_fn()
842}
843",
844 )
845 }
846
847 #[test]
848 fn add_function_in_nested_module() {
849 check_assist(
850 add_function,
851 r"
852mod bar {
853 mod baz {}
854}
855
856fn foo() {
857 bar::baz::my_fn<|>()
858}
859",
860 r"
861mod bar {
862 mod baz {
863 pub(crate) fn my_fn() {
864 <|>todo!()
865 }
866 }
867}
868
869fn foo() {
870 bar::baz::my_fn()
871}
872",
873 )
874 }
875
876 #[test]
877 fn add_function_in_another_file() {
878 check_assist(
879 add_function,
880 r"
881//- /main.rs
882mod foo;
883
884fn main() {
885 foo::bar<|>()
886}
887//- /foo.rs
888",
889 r"
890
891
892pub(crate) fn bar() {
893 <|>todo!()
894}",
895 )
896 }
897
898 #[test]
717 fn add_function_not_applicable_if_function_already_exists() { 899 fn add_function_not_applicable_if_function_already_exists() {
718 check_assist_not_applicable( 900 check_assist_not_applicable(
719 add_function, 901 add_function,
diff --git a/crates/ra_assists/src/handlers/add_impl.rs b/crates/ra_assists/src/handlers/add_impl.rs
index 6622eadb2..d26f8b93d 100644
--- a/crates/ra_assists/src/handlers/add_impl.rs
+++ b/crates/ra_assists/src/handlers/add_impl.rs
@@ -1,6 +1,6 @@
1use ra_syntax::{ 1use ra_syntax::{
2 ast::{self, AstNode, NameOwner, TypeParamsOwner}, 2 ast::{self, AstNode, NameOwner, TypeParamsOwner},
3 TextUnit, 3 TextSize,
4}; 4};
5use stdx::{format_to, SepBy}; 5use stdx::{format_to, SepBy};
6 6
@@ -51,7 +51,7 @@ pub(crate) fn add_impl(ctx: AssistCtx) -> Option<Assist> {
51 format_to!(buf, "<{}>", generic_params) 51 format_to!(buf, "<{}>", generic_params)
52 } 52 }
53 buf.push_str(" {\n"); 53 buf.push_str(" {\n");
54 edit.set_cursor(start_offset + TextUnit::of_str(&buf)); 54 edit.set_cursor(start_offset + TextSize::of(&buf));
55 buf.push_str("\n}"); 55 buf.push_str("\n}");
56 edit.insert(start_offset, buf); 56 edit.insert(start_offset, buf);
57 }) 57 })
diff --git a/crates/ra_assists/src/handlers/add_new.rs b/crates/ra_assists/src/handlers/add_new.rs
index 240b19fa3..0f9174a29 100644
--- a/crates/ra_assists/src/handlers/add_new.rs
+++ b/crates/ra_assists/src/handlers/add_new.rs
@@ -3,7 +3,7 @@ use ra_syntax::{
3 ast::{ 3 ast::{
4 self, AstNode, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, VisibilityOwner, 4 self, AstNode, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, VisibilityOwner,
5 }, 5 },
6 TextUnit, T, 6 TextSize, T,
7}; 7};
8use stdx::{format_to, SepBy}; 8use stdx::{format_to, SepBy};
9 9
@@ -77,16 +77,16 @@ pub(crate) fn add_new(ctx: AssistCtx) -> Option<Assist> {
77 .text_range() 77 .text_range()
78 .end(); 78 .end();
79 79
80 Some((start, TextUnit::from_usize(1))) 80 Some((start, TextSize::of("\n")))
81 }) 81 })
82 .unwrap_or_else(|| { 82 .unwrap_or_else(|| {
83 buf = generate_impl_text(&strukt, &buf); 83 buf = generate_impl_text(&strukt, &buf);
84 let start = strukt.syntax().text_range().end(); 84 let start = strukt.syntax().text_range().end();
85 85
86 (start, TextUnit::from_usize(3)) 86 (start, TextSize::of("\n}\n"))
87 }); 87 });
88 88
89 edit.set_cursor(start_offset + TextUnit::of_str(&buf) - end_offset); 89 edit.set_cursor(start_offset + TextSize::of(&buf) - end_offset);
90 edit.insert(start_offset, buf); 90 edit.insert(start_offset, buf);
91 }) 91 })
92} 92}
diff --git a/crates/ra_assists/src/handlers/apply_demorgan.rs b/crates/ra_assists/src/handlers/apply_demorgan.rs
index 239807e24..260b9e073 100644
--- a/crates/ra_assists/src/handlers/apply_demorgan.rs
+++ b/crates/ra_assists/src/handlers/apply_demorgan.rs
@@ -26,7 +26,7 @@ pub(crate) fn apply_demorgan(ctx: AssistCtx) -> Option<Assist> {
26 let op = expr.op_kind()?; 26 let op = expr.op_kind()?;
27 let op_range = expr.op_token()?.text_range(); 27 let op_range = expr.op_token()?.text_range();
28 let opposite_op = opposite_logic_op(op)?; 28 let opposite_op = opposite_logic_op(op)?;
29 let cursor_in_range = ctx.frange.range.is_subrange(&op_range); 29 let cursor_in_range = op_range.contains_range(ctx.frange.range);
30 if !cursor_in_range { 30 if !cursor_in_range {
31 return None; 31 return None;
32 } 32 }
diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs
index cd6d1ee6c..44f6a1dae 100644
--- a/crates/ra_assists/src/handlers/change_visibility.rs
+++ b/crates/ra_assists/src/handlers/change_visibility.rs
@@ -5,7 +5,7 @@ use ra_syntax::{
5 ATTR, COMMENT, CONST_DEF, ENUM_DEF, FN_DEF, MODULE, STRUCT_DEF, TRAIT_DEF, VISIBILITY, 5 ATTR, COMMENT, CONST_DEF, ENUM_DEF, FN_DEF, MODULE, STRUCT_DEF, TRAIT_DEF, VISIBILITY,
6 WHITESPACE, 6 WHITESPACE,
7 }, 7 },
8 SyntaxNode, TextUnit, T, 8 SyntaxNode, TextSize, T,
9}; 9};
10 10
11use crate::{Assist, AssistCtx, AssistId}; 11use crate::{Assist, AssistCtx, AssistId};
@@ -67,7 +67,7 @@ fn add_vis(ctx: AssistCtx) -> Option<Assist> {
67 }) 67 })
68} 68}
69 69
70fn vis_offset(node: &SyntaxNode) -> TextUnit { 70fn vis_offset(node: &SyntaxNode) -> TextSize {
71 node.children_with_tokens() 71 node.children_with_tokens()
72 .skip_while(|it| match it.kind() { 72 .skip_while(|it| match it.kind() {
73 WHITESPACE | COMMENT | ATTR => true, 73 WHITESPACE | COMMENT | ATTR => true,
diff --git a/crates/ra_assists/src/handlers/flip_binexpr.rs b/crates/ra_assists/src/handlers/flip_binexpr.rs
index bfcc09e90..8030efb35 100644
--- a/crates/ra_assists/src/handlers/flip_binexpr.rs
+++ b/crates/ra_assists/src/handlers/flip_binexpr.rs
@@ -23,7 +23,7 @@ pub(crate) fn flip_binexpr(ctx: AssistCtx) -> Option<Assist> {
23 let rhs = expr.rhs()?.syntax().clone(); 23 let rhs = expr.rhs()?.syntax().clone();
24 let op_range = expr.op_token()?.text_range(); 24 let op_range = expr.op_token()?.text_range();
25 // The assist should be applied only if the cursor is on the operator 25 // The assist should be applied only if the cursor is on the operator
26 let cursor_in_range = ctx.frange.range.is_subrange(&op_range); 26 let cursor_in_range = op_range.contains_range(ctx.frange.range);
27 if !cursor_in_range { 27 if !cursor_in_range {
28 return None; 28 return None;
29 } 29 }
diff --git a/crates/ra_assists/src/handlers/inline_local_variable.rs b/crates/ra_assists/src/handlers/inline_local_variable.rs
index c4fb425b0..f5702f6e0 100644
--- a/crates/ra_assists/src/handlers/inline_local_variable.rs
+++ b/crates/ra_assists/src/handlers/inline_local_variable.rs
@@ -52,7 +52,7 @@ pub(crate) fn inline_local_variable(ctx: AssistCtx) -> Option<Assist> {
52 .next_sibling_or_token() 52 .next_sibling_or_token()
53 .and_then(|it| ast::Whitespace::cast(it.as_token()?.clone())) 53 .and_then(|it| ast::Whitespace::cast(it.as_token()?.clone()))
54 { 54 {
55 TextRange::from_to( 55 TextRange::new(
56 let_stmt.syntax().text_range().start(), 56 let_stmt.syntax().text_range().start(),
57 whitespace.syntax().text_range().end(), 57 whitespace.syntax().text_range().end(),
58 ) 58 )
diff --git a/crates/ra_assists/src/handlers/introduce_variable.rs b/crates/ra_assists/src/handlers/introduce_variable.rs
index 8c09e6bcd..eda9ac296 100644
--- a/crates/ra_assists/src/handlers/introduce_variable.rs
+++ b/crates/ra_assists/src/handlers/introduce_variable.rs
@@ -4,7 +4,7 @@ use ra_syntax::{
4 BLOCK_EXPR, BREAK_EXPR, COMMENT, LAMBDA_EXPR, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR, 4 BLOCK_EXPR, BREAK_EXPR, COMMENT, LAMBDA_EXPR, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR,
5 WHITESPACE, 5 WHITESPACE,
6 }, 6 },
7 SyntaxNode, TextUnit, 7 SyntaxNode, TextSize,
8}; 8};
9use stdx::format_to; 9use stdx::format_to;
10use test_utils::tested_by; 10use test_utils::tested_by;
@@ -47,10 +47,10 @@ pub(crate) fn introduce_variable(ctx: AssistCtx) -> Option<Assist> {
47 47
48 let cursor_offset = if wrap_in_block { 48 let cursor_offset = if wrap_in_block {
49 buf.push_str("{ let var_name = "); 49 buf.push_str("{ let var_name = ");
50 TextUnit::of_str("{ let ") 50 TextSize::of("{ let ")
51 } else { 51 } else {
52 buf.push_str("let var_name = "); 52 buf.push_str("let var_name = ");
53 TextUnit::of_str("let ") 53 TextSize::of("let ")
54 }; 54 };
55 format_to!(buf, "{}", expr.syntax()); 55 format_to!(buf, "{}", expr.syntax());
56 let full_stmt = ast::ExprStmt::cast(anchor_stmt.clone()); 56 let full_stmt = ast::ExprStmt::cast(anchor_stmt.clone());
diff --git a/crates/ra_assists/src/handlers/invert_if.rs b/crates/ra_assists/src/handlers/invert_if.rs
index 4c5716868..682e08512 100644
--- a/crates/ra_assists/src/handlers/invert_if.rs
+++ b/crates/ra_assists/src/handlers/invert_if.rs
@@ -28,7 +28,7 @@ pub(crate) fn invert_if(ctx: AssistCtx) -> Option<Assist> {
28 let if_keyword = ctx.find_token_at_offset(T![if])?; 28 let if_keyword = ctx.find_token_at_offset(T![if])?;
29 let expr = ast::IfExpr::cast(if_keyword.parent())?; 29 let expr = ast::IfExpr::cast(if_keyword.parent())?;
30 let if_range = if_keyword.text_range(); 30 let if_range = if_keyword.text_range();
31 let cursor_in_range = ctx.frange.range.is_subrange(&if_range); 31 let cursor_in_range = if_range.contains_range(ctx.frange.range);
32 if !cursor_in_range { 32 if !cursor_in_range {
33 return None; 33 return None;
34 } 34 }
diff --git a/crates/ra_assists/src/handlers/merge_match_arms.rs b/crates/ra_assists/src/handlers/merge_match_arms.rs
index eb967ab92..5a77d3dbc 100644
--- a/crates/ra_assists/src/handlers/merge_match_arms.rs
+++ b/crates/ra_assists/src/handlers/merge_match_arms.rs
@@ -3,7 +3,7 @@ use std::iter::successors;
3use ra_syntax::{ 3use ra_syntax::{
4 algo::neighbor, 4 algo::neighbor,
5 ast::{self, AstNode}, 5 ast::{self, AstNode},
6 Direction, TextUnit, 6 Direction, TextSize,
7}; 7};
8 8
9use crate::{Assist, AssistCtx, AssistId, TextRange}; 9use crate::{Assist, AssistCtx, AssistId, TextRange};
@@ -42,8 +42,8 @@ pub(crate) fn merge_match_arms(ctx: AssistCtx) -> Option<Assist> {
42 let current_text_range = current_arm.syntax().text_range(); 42 let current_text_range = current_arm.syntax().text_range();
43 43
44 enum CursorPos { 44 enum CursorPos {
45 InExpr(TextUnit), 45 InExpr(TextSize),
46 InPat(TextUnit), 46 InPat(TextSize),
47 } 47 }
48 let cursor_pos = ctx.frange.range.start(); 48 let cursor_pos = ctx.frange.range.start();
49 let cursor_pos = if current_expr.syntax().text_range().contains(cursor_pos) { 49 let cursor_pos = if current_expr.syntax().text_range().contains(cursor_pos) {
@@ -89,10 +89,10 @@ pub(crate) fn merge_match_arms(ctx: AssistCtx) -> Option<Assist> {
89 89
90 edit.target(current_text_range); 90 edit.target(current_text_range);
91 edit.set_cursor(match cursor_pos { 91 edit.set_cursor(match cursor_pos {
92 CursorPos::InExpr(back_offset) => start + TextUnit::from_usize(arm.len()) - back_offset, 92 CursorPos::InExpr(back_offset) => start + TextSize::of(&arm) - back_offset,
93 CursorPos::InPat(offset) => offset, 93 CursorPos::InPat(offset) => offset,
94 }); 94 });
95 edit.replace(TextRange::from_to(start, end), arm); 95 edit.replace(TextRange::new(start, end), arm);
96 }) 96 })
97} 97}
98 98
diff --git a/crates/ra_assists/src/handlers/move_guard.rs b/crates/ra_assists/src/handlers/move_guard.rs
index 1cc498638..d5ccdd91c 100644
--- a/crates/ra_assists/src/handlers/move_guard.rs
+++ b/crates/ra_assists/src/handlers/move_guard.rs
@@ -1,7 +1,7 @@
1use ra_syntax::{ 1use ra_syntax::{
2 ast, 2 ast,
3 ast::{AstNode, AstToken, IfExpr, MatchArm}, 3 ast::{AstNode, AstToken, IfExpr, MatchArm},
4 TextUnit, 4 TextSize,
5}; 5};
6 6
7use crate::{Assist, AssistCtx, AssistId}; 7use crate::{Assist, AssistCtx, AssistId};
@@ -49,16 +49,16 @@ pub(crate) fn move_guard_to_arm_body(ctx: AssistCtx) -> Option<Assist> {
49 edit.delete(ele); 49 edit.delete(ele);
50 ele.len() 50 ele.len()
51 } else { 51 } else {
52 TextUnit::from(0) 52 TextSize::from(0)
53 } 53 }
54 } 54 }
55 _ => TextUnit::from(0), 55 _ => TextSize::from(0),
56 }; 56 };
57 57
58 edit.delete(guard.syntax().text_range()); 58 edit.delete(guard.syntax().text_range());
59 edit.replace_node_and_indent(arm_expr.syntax(), buf); 59 edit.replace_node_and_indent(arm_expr.syntax(), buf);
60 edit.set_cursor( 60 edit.set_cursor(
61 arm_expr.syntax().text_range().start() + TextUnit::from(3) - offseting_amount, 61 arm_expr.syntax().text_range().start() + TextSize::from(3) - offseting_amount,
62 ); 62 );
63 }) 63 })
64} 64}
@@ -123,7 +123,7 @@ pub(crate) fn move_arm_cond_to_match_guard(ctx: AssistCtx) -> Option<Assist> {
123 } 123 }
124 124
125 edit.insert(match_pat.syntax().text_range().end(), buf); 125 edit.insert(match_pat.syntax().text_range().end(), buf);
126 edit.set_cursor(match_pat.syntax().text_range().end() + TextUnit::from(1)); 126 edit.set_cursor(match_pat.syntax().text_range().end() + TextSize::from(1));
127 }, 127 },
128 ) 128 )
129} 129}
diff --git a/crates/ra_assists/src/handlers/raw_string.rs b/crates/ra_assists/src/handlers/raw_string.rs
index 7e4b83f13..567400b9c 100644
--- a/crates/ra_assists/src/handlers/raw_string.rs
+++ b/crates/ra_assists/src/handlers/raw_string.rs
@@ -2,7 +2,7 @@ use ra_syntax::{
2 ast::{self, HasStringValue}, 2 ast::{self, HasStringValue},
3 AstToken, 3 AstToken,
4 SyntaxKind::{RAW_STRING, STRING}, 4 SyntaxKind::{RAW_STRING, STRING},
5 TextUnit, 5 TextSize,
6}; 6};
7 7
8use crate::{Assist, AssistCtx, AssistId}; 8use crate::{Assist, AssistCtx, AssistId};
@@ -81,7 +81,7 @@ pub(crate) fn add_hash(ctx: AssistCtx) -> Option<Assist> {
81 let token = ctx.find_token_at_offset(RAW_STRING)?; 81 let token = ctx.find_token_at_offset(RAW_STRING)?;
82 ctx.add_assist(AssistId("add_hash"), "Add # to raw string", |edit| { 82 ctx.add_assist(AssistId("add_hash"), "Add # to raw string", |edit| {
83 edit.target(token.text_range()); 83 edit.target(token.text_range());
84 edit.insert(token.text_range().start() + TextUnit::of_char('r'), "#"); 84 edit.insert(token.text_range().start() + TextSize::of('r'), "#");
85 edit.insert(token.text_range().end(), "#"); 85 edit.insert(token.text_range().end(), "#");
86 }) 86 })
87} 87}
diff --git a/crates/ra_assists/src/handlers/remove_dbg.rs b/crates/ra_assists/src/handlers/remove_dbg.rs
index 5085649b4..4e5eb4350 100644
--- a/crates/ra_assists/src/handlers/remove_dbg.rs
+++ b/crates/ra_assists/src/handlers/remove_dbg.rs
@@ -1,6 +1,6 @@
1use ra_syntax::{ 1use ra_syntax::{
2 ast::{self, AstNode}, 2 ast::{self, AstNode},
3 TextUnit, T, 3 TextSize, T,
4}; 4};
5 5
6use crate::{Assist, AssistCtx, AssistId}; 6use crate::{Assist, AssistCtx, AssistId};
@@ -38,9 +38,9 @@ pub(crate) fn remove_dbg(ctx: AssistCtx) -> Option<Assist> {
38 let offset_start = file_range 38 let offset_start = file_range
39 .start() 39 .start()
40 .checked_sub(macro_range.start()) 40 .checked_sub(macro_range.start())
41 .unwrap_or_else(|| TextUnit::from(0)); 41 .unwrap_or_else(|| TextSize::from(0));
42 42
43 let dbg_size = TextUnit::of_str("dbg!("); 43 let dbg_size = TextSize::of("dbg!(");
44 44
45 if offset_start > dbg_size { 45 if offset_start > dbg_size {
46 file_range.start() - dbg_size 46 file_range.start() - dbg_size
@@ -53,7 +53,7 @@ pub(crate) fn remove_dbg(ctx: AssistCtx) -> Option<Assist> {
53 let macro_args = macro_call.token_tree()?.syntax().clone(); 53 let macro_args = macro_call.token_tree()?.syntax().clone();
54 54
55 let text = macro_args.text(); 55 let text = macro_args.text();
56 let without_parens = TextUnit::of_char('(')..text.len() - TextUnit::of_char(')'); 56 let without_parens = TextSize::of('(')..text.len() - TextSize::of(')');
57 text.slice(without_parens).to_string() 57 text.slice(without_parens).to_string()
58 }; 58 };
59 59
diff --git a/crates/ra_assists/src/handlers/remove_mut.rs b/crates/ra_assists/src/handlers/remove_mut.rs
index 6884830eb..e598023b2 100644
--- a/crates/ra_assists/src/handlers/remove_mut.rs
+++ b/crates/ra_assists/src/handlers/remove_mut.rs
@@ -27,6 +27,6 @@ pub(crate) fn remove_mut(ctx: AssistCtx) -> Option<Assist> {
27 27
28 ctx.add_assist(AssistId("remove_mut"), "Remove `mut` keyword", |edit| { 28 ctx.add_assist(AssistId("remove_mut"), "Remove `mut` keyword", |edit| {
29 edit.set_cursor(delete_from); 29 edit.set_cursor(delete_from);
30 edit.delete(TextRange::from_to(delete_from, delete_to)); 30 edit.delete(TextRange::new(delete_from, delete_to));
31 }) 31 })
32} 32}
diff --git a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs
index 94f5d6c50..2f02df303 100644
--- a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs
+++ b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs
@@ -43,7 +43,7 @@ pub(crate) fn replace_qualified_name_with_use(ctx: AssistCtx) -> Option<Assist>
43 if let Some(last) = path.segment() { 43 if let Some(last) = path.segment() {
44 // Here we are assuming the assist will provide a correct use statement 44 // Here we are assuming the assist will provide a correct use statement
45 // so we can delete the path qualifier 45 // so we can delete the path qualifier
46 edit.delete(TextRange::from_to( 46 edit.delete(TextRange::new(
47 path.syntax().text_range().start(), 47 path.syntax().text_range().start(),
48 last.syntax().text_range().start(), 48 last.syntax().text_range().start(),
49 )); 49 ));
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index a00136da1..64bd87afb 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -17,9 +17,9 @@ mod doc_tests;
17pub mod utils; 17pub mod utils;
18pub mod ast_transform; 18pub mod ast_transform;
19 19
20use ra_db::FileRange; 20use ra_db::{FileId, FileRange};
21use ra_ide_db::RootDatabase; 21use ra_ide_db::RootDatabase;
22use ra_syntax::{TextRange, TextUnit}; 22use ra_syntax::{TextRange, TextSize};
23use ra_text_edit::TextEdit; 23use ra_text_edit::TextEdit;
24 24
25pub(crate) use crate::assist_ctx::{Assist, AssistCtx, AssistHandler}; 25pub(crate) use crate::assist_ctx::{Assist, AssistCtx, AssistHandler};
@@ -51,9 +51,10 @@ impl AssistLabel {
51#[derive(Debug, Clone)] 51#[derive(Debug, Clone)]
52pub struct AssistAction { 52pub struct AssistAction {
53 pub edit: TextEdit, 53 pub edit: TextEdit,
54 pub cursor_position: Option<TextUnit>, 54 pub cursor_position: Option<TextSize>,
55 // FIXME: This belongs to `AssistLabel` 55 // FIXME: This belongs to `AssistLabel`
56 pub target: Option<TextRange>, 56 pub target: Option<TextRange>,
57 pub file: AssistFile,
57} 58}
58 59
59#[derive(Debug, Clone)] 60#[derive(Debug, Clone)]
@@ -63,6 +64,18 @@ pub struct ResolvedAssist {
63 pub action: AssistAction, 64 pub action: AssistAction,
64} 65}
65 66
67#[derive(Debug, Clone, Copy)]
68pub enum AssistFile {
69 CurrentFile,
70 TargetFile(FileId),
71}
72
73impl Default for AssistFile {
74 fn default() -> Self {
75 Self::CurrentFile
76 }
77}
78
66/// Return all the assists applicable at the given position. 79/// Return all the assists applicable at the given position.
67/// 80///
68/// Assists are returned in the "unresolved" state, that is only labels are 81/// Assists are returned in the "unresolved" state, that is only labels are
@@ -91,7 +104,7 @@ pub fn resolved_assists(db: &RootDatabase, range: FileRange) -> Vec<ResolvedAssi
91 .flat_map(|it| it.0) 104 .flat_map(|it| it.0)
92 .map(|it| it.into_resolved().unwrap()) 105 .map(|it| it.into_resolved().unwrap())
93 .collect::<Vec<_>>(); 106 .collect::<Vec<_>>();
94 a.sort_by_key(|it| it.action.target.map_or(TextUnit::from(!0u32), |it| it.len())); 107 a.sort_by_key(|it| it.action.target.map_or(TextSize::from(!0u32), |it| it.len()));
95 a 108 a
96} 109}
97 110
@@ -184,7 +197,7 @@ mod helpers {
184 use ra_ide_db::{symbol_index::SymbolsDatabase, RootDatabase}; 197 use ra_ide_db::{symbol_index::SymbolsDatabase, RootDatabase};
185 use test_utils::{add_cursor, assert_eq_text, extract_range_or_offset, RangeOrOffset}; 198 use test_utils::{add_cursor, assert_eq_text, extract_range_or_offset, RangeOrOffset};
186 199
187 use crate::{AssistCtx, AssistHandler}; 200 use crate::{AssistCtx, AssistFile, AssistHandler};
188 use hir::Semantics; 201 use hir::Semantics;
189 202
190 pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) { 203 pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) {
@@ -246,7 +259,13 @@ mod helpers {
246 (Some(assist), ExpectedResult::After(after)) => { 259 (Some(assist), ExpectedResult::After(after)) => {
247 let action = assist.0[0].action.clone().unwrap(); 260 let action = assist.0[0].action.clone().unwrap();
248 261
249 let mut actual = action.edit.apply(&text_without_caret); 262 let assisted_file_text = if let AssistFile::TargetFile(file_id) = action.file {
263 db.file_text(file_id).as_ref().to_owned()
264 } else {
265 text_without_caret
266 };
267
268 let mut actual = action.edit.apply(&assisted_file_text);
250 match action.cursor_position { 269 match action.cursor_position {
251 None => { 270 None => {
252 if let RangeOrOffset::Offset(before_cursor_pos) = range_or_offset { 271 if let RangeOrOffset::Offset(before_cursor_pos) = range_or_offset {
@@ -289,8 +308,7 @@ mod tests {
289 let before = "struct Foo { <|>bar: u32 }"; 308 let before = "struct Foo { <|>bar: u32 }";
290 let (before_cursor_pos, before) = extract_offset(before); 309 let (before_cursor_pos, before) = extract_offset(before);
291 let (db, file_id) = helpers::with_single_file(&before); 310 let (db, file_id) = helpers::with_single_file(&before);
292 let frange = 311 let frange = FileRange { file_id, range: TextRange::empty(before_cursor_pos) };
293 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) };
294 let assists = resolved_assists(&db, frange); 312 let assists = resolved_assists(&db, frange);
295 let mut assists = assists.iter(); 313 let mut assists = assists.iter();
296 314
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs
index a06f59c14..fd4280de2 100644
--- a/crates/ra_db/src/lib.rs
+++ b/crates/ra_db/src/lib.rs
@@ -6,7 +6,7 @@ pub mod fixture;
6use std::{panic, sync::Arc}; 6use std::{panic, sync::Arc};
7 7
8use ra_prof::profile; 8use ra_prof::profile;
9use ra_syntax::{ast, Parse, SourceFile, TextRange, TextUnit}; 9use ra_syntax::{ast, Parse, SourceFile, TextRange, TextSize};
10 10
11pub use crate::{ 11pub use crate::{
12 cancellation::Canceled, 12 cancellation::Canceled,
@@ -75,7 +75,7 @@ impl<T: salsa::Database> CheckCanceled for T {
75#[derive(Clone, Copy, Debug)] 75#[derive(Clone, Copy, Debug)]
76pub struct FilePosition { 76pub struct FilePosition {
77 pub file_id: FileId, 77 pub file_id: FileId,
78 pub offset: TextUnit, 78 pub offset: TextSize,
79} 79}
80 80
81#[derive(Clone, Copy, Debug)] 81#[derive(Clone, Copy, Debug)]
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 5d6edc45c..e09cf3185 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -14,7 +14,7 @@ use ra_db::{FileId, FileRange};
14use ra_prof::profile; 14use ra_prof::profile;
15use ra_syntax::{ 15use ra_syntax::{
16 algo::{find_node_at_offset, skip_trivia_token}, 16 algo::{find_node_at_offset, skip_trivia_token},
17 ast, AstNode, Direction, SyntaxNode, SyntaxToken, TextRange, TextUnit, 17 ast, AstNode, Direction, SyntaxNode, SyntaxToken, TextRange, TextSize,
18}; 18};
19use rustc_hash::{FxHashMap, FxHashSet}; 19use rustc_hash::{FxHashMap, FxHashSet};
20 20
@@ -95,7 +95,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
95 let token = successors(Some(parent.with_value(token)), |token| { 95 let token = successors(Some(parent.with_value(token)), |token| {
96 let macro_call = token.value.ancestors().find_map(ast::MacroCall::cast)?; 96 let macro_call = token.value.ancestors().find_map(ast::MacroCall::cast)?;
97 let tt = macro_call.token_tree()?; 97 let tt = macro_call.token_tree()?;
98 if !token.value.text_range().is_subrange(&tt.syntax().text_range()) { 98 if !tt.syntax().text_range().contains_range(token.value.text_range()) {
99 return None; 99 return None;
100 } 100 }
101 let file_id = sa.expand(self.db, token.with_value(&macro_call))?; 101 let file_id = sa.expand(self.db, token.with_value(&macro_call))?;
@@ -114,7 +114,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
114 pub fn descend_node_at_offset<N: ast::AstNode>( 114 pub fn descend_node_at_offset<N: ast::AstNode>(
115 &self, 115 &self,
116 node: &SyntaxNode, 116 node: &SyntaxNode,
117 offset: TextUnit, 117 offset: TextSize,
118 ) -> Option<N> { 118 ) -> Option<N> {
119 // Handle macro token cases 119 // Handle macro token cases
120 node.token_at_offset(offset) 120 node.token_at_offset(offset)
@@ -142,7 +142,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
142 pub fn ancestors_at_offset_with_macros( 142 pub fn ancestors_at_offset_with_macros(
143 &self, 143 &self,
144 node: &SyntaxNode, 144 node: &SyntaxNode,
145 offset: TextUnit, 145 offset: TextSize,
146 ) -> impl Iterator<Item = SyntaxNode> + '_ { 146 ) -> impl Iterator<Item = SyntaxNode> + '_ {
147 node.token_at_offset(offset) 147 node.token_at_offset(offset)
148 .map(|token| self.ancestors_with_macros(token.parent())) 148 .map(|token| self.ancestors_with_macros(token.parent()))
@@ -154,7 +154,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
154 pub fn find_node_at_offset_with_macros<N: AstNode>( 154 pub fn find_node_at_offset_with_macros<N: AstNode>(
155 &self, 155 &self,
156 node: &SyntaxNode, 156 node: &SyntaxNode,
157 offset: TextUnit, 157 offset: TextSize,
158 ) -> Option<N> { 158 ) -> Option<N> {
159 self.ancestors_at_offset_with_macros(node, offset).find_map(N::cast) 159 self.ancestors_at_offset_with_macros(node, offset).find_map(N::cast)
160 } 160 }
@@ -164,7 +164,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
164 pub fn find_node_at_offset_with_descend<N: AstNode>( 164 pub fn find_node_at_offset_with_descend<N: AstNode>(
165 &self, 165 &self,
166 node: &SyntaxNode, 166 node: &SyntaxNode,
167 offset: TextUnit, 167 offset: TextSize,
168 ) -> Option<N> { 168 ) -> Option<N> {
169 if let Some(it) = find_node_at_offset(&node, offset) { 169 if let Some(it) = find_node_at_offset(&node, offset) {
170 return Some(it); 170 return Some(it);
@@ -255,7 +255,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
255 SemanticsScope { db: self.db, resolver } 255 SemanticsScope { db: self.db, resolver }
256 } 256 }
257 257
258 pub fn scope_at_offset(&self, node: &SyntaxNode, offset: TextUnit) -> SemanticsScope<'db, DB> { 258 pub fn scope_at_offset(&self, node: &SyntaxNode, offset: TextSize) -> SemanticsScope<'db, DB> {
259 let node = self.find_file(node.clone()); 259 let node = self.find_file(node.clone());
260 let resolver = self.analyze2(node.as_ref(), Some(offset)).resolver; 260 let resolver = self.analyze2(node.as_ref(), Some(offset)).resolver;
261 SemanticsScope { db: self.db, resolver } 261 SemanticsScope { db: self.db, resolver }
@@ -271,7 +271,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
271 self.analyze2(src.as_ref(), None) 271 self.analyze2(src.as_ref(), None)
272 } 272 }
273 273
274 fn analyze2(&self, src: InFile<&SyntaxNode>, offset: Option<TextUnit>) -> SourceAnalyzer { 274 fn analyze2(&self, src: InFile<&SyntaxNode>, offset: Option<TextSize>) -> SourceAnalyzer {
275 let _p = profile("Semantics::analyze2"); 275 let _p = profile("Semantics::analyze2");
276 276
277 let container = match self.with_ctx(|ctx| ctx.find_container(src)) { 277 let container = match self.with_ctx(|ctx| ctx.find_container(src)) {
@@ -463,7 +463,7 @@ fn original_range_opt(
463 return None; 463 return None;
464 } 464 }
465 465
466 Some(first.with_value(first.value.text_range().extend_to(&last.value.text_range()))) 466 Some(first.with_value(first.value.text_range().cover(last.value.text_range())))
467 })?) 467 })?)
468} 468}
469 469
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs
index 0ed6d0958..59a3a17d2 100644
--- a/crates/ra_hir/src/source_analyzer.rs
+++ b/crates/ra_hir/src/source_analyzer.rs
@@ -23,7 +23,7 @@ use hir_ty::{
23}; 23};
24use ra_syntax::{ 24use ra_syntax::{
25 ast::{self, AstNode}, 25 ast::{self, AstNode},
26 SyntaxNode, TextRange, TextUnit, 26 SyntaxNode, TextRange, TextSize,
27}; 27};
28 28
29use crate::{ 29use crate::{
@@ -50,7 +50,7 @@ impl SourceAnalyzer {
50 db: &dyn HirDatabase, 50 db: &dyn HirDatabase,
51 def: DefWithBodyId, 51 def: DefWithBodyId,
52 node: InFile<&SyntaxNode>, 52 node: InFile<&SyntaxNode>,
53 offset: Option<TextUnit>, 53 offset: Option<TextSize>,
54 ) -> SourceAnalyzer { 54 ) -> SourceAnalyzer {
55 let (body, source_map) = db.body_with_source_map(def); 55 let (body, source_map) = db.body_with_source_map(def);
56 let scopes = db.expr_scopes(def); 56 let scopes = db.expr_scopes(def);
@@ -318,7 +318,7 @@ fn scope_for_offset(
318 db: &dyn HirDatabase, 318 db: &dyn HirDatabase,
319 scopes: &ExprScopes, 319 scopes: &ExprScopes,
320 source_map: &BodySourceMap, 320 source_map: &BodySourceMap,
321 offset: InFile<TextUnit>, 321 offset: InFile<TextSize>,
322) -> Option<ScopeId> { 322) -> Option<ScopeId> {
323 scopes 323 scopes
324 .scope_by_expr() 324 .scope_by_expr()
@@ -354,7 +354,7 @@ fn adjust(
354 source_map: &BodySourceMap, 354 source_map: &BodySourceMap,
355 expr_range: TextRange, 355 expr_range: TextRange,
356 file_id: HirFileId, 356 file_id: HirFileId,
357 offset: TextUnit, 357 offset: TextSize,
358) -> Option<ScopeId> { 358) -> Option<ScopeId> {
359 let child_scopes = scopes 359 let child_scopes = scopes
360 .scope_by_expr() 360 .scope_by_expr()
@@ -369,15 +369,15 @@ fn adjust(
369 let node = source.value.to_node(&root); 369 let node = source.value.to_node(&root);
370 Some((node.syntax().text_range(), scope)) 370 Some((node.syntax().text_range(), scope))
371 }) 371 })
372 .filter(|(range, _)| { 372 .filter(|&(range, _)| {
373 range.start() <= offset && range.is_subrange(&expr_range) && *range != expr_range 373 range.start() <= offset && expr_range.contains_range(range) && range != expr_range
374 }); 374 });
375 375
376 child_scopes 376 child_scopes
377 .max_by(|(r1, _), (r2, _)| { 377 .max_by(|&(r1, _), &(r2, _)| {
378 if r2.is_subrange(&r1) { 378 if r1.contains_range(r2) {
379 std::cmp::Ordering::Greater 379 std::cmp::Ordering::Greater
380 } else if r1.is_subrange(&r2) { 380 } else if r2.contains_range(r1) {
381 std::cmp::Ordering::Less 381 std::cmp::Ordering::Less
382 } else { 382 } else {
383 r1.start().cmp(&r2.start()) 383 r1.start().cmp(&r2.start())
diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs
index 5b36a7cc1..86f953c80 100644
--- a/crates/ra_hir_def/src/body/scope.rs
+++ b/crates/ra_hir_def/src/body/scope.rs
@@ -194,7 +194,7 @@ mod tests {
194 let (off, code) = extract_offset(code); 194 let (off, code) = extract_offset(code);
195 let code = { 195 let code = {
196 let mut buf = String::new(); 196 let mut buf = String::new();
197 let off = off.to_usize(); 197 let off: usize = off.into();
198 buf.push_str(&code[..off]); 198 buf.push_str(&code[..off]);
199 buf.push_str("marker"); 199 buf.push_str("marker");
200 buf.push_str(&code[off..]); 200 buf.push_str(&code[off..]);
diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs
index 493cda2c4..e0fef613d 100644
--- a/crates/ra_hir_expand/src/builtin_macro.rs
+++ b/crates/ra_hir_expand/src/builtin_macro.rs
@@ -2,7 +2,7 @@
2use crate::db::AstDatabase; 2use crate::db::AstDatabase;
3use crate::{ 3use crate::{
4 ast::{self, AstToken, HasStringValue}, 4 ast::{self, AstToken, HasStringValue},
5 name, AstId, CrateId, MacroDefId, MacroDefKind, TextUnit, 5 name, AstId, CrateId, MacroDefId, MacroDefKind, TextSize,
6}; 6};
7 7
8use crate::{quote, EagerMacroId, LazyMacroId, MacroCallId}; 8use crate::{quote, EagerMacroId, LazyMacroId, MacroCallId};
@@ -127,7 +127,7 @@ fn stringify_expand(
127 let arg = loc.kind.arg(db).ok_or_else(|| mbe::ExpandError::UnexpectedToken)?; 127 let arg = loc.kind.arg(db).ok_or_else(|| mbe::ExpandError::UnexpectedToken)?;
128 let macro_args = arg; 128 let macro_args = arg;
129 let text = macro_args.text(); 129 let text = macro_args.text();
130 let without_parens = TextUnit::of_char('(')..text.len() - TextUnit::of_char(')'); 130 let without_parens = TextSize::of('(')..text.len() - TextSize::of(')');
131 text.slice(without_parens).to_string() 131 text.slice(without_parens).to_string()
132 }; 132 };
133 133
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs
index 86299459f..754a0f005 100644
--- a/crates/ra_hir_expand/src/lib.rs
+++ b/crates/ra_hir_expand/src/lib.rs
@@ -22,7 +22,7 @@ use ra_db::{impl_intern_key, salsa, CrateId, FileId};
22use ra_syntax::{ 22use ra_syntax::{
23 algo, 23 algo,
24 ast::{self, AstNode}, 24 ast::{self, AstNode},
25 SyntaxNode, SyntaxToken, TextUnit, 25 SyntaxNode, SyntaxToken, TextSize,
26}; 26};
27 27
28use crate::ast_id_map::FileAstId; 28use crate::ast_id_map::FileAstId;
@@ -348,7 +348,7 @@ impl<N: AstNode> AstId<N> {
348/// 348///
349/// * `InFile<SyntaxNode>` -- syntax node in a file 349/// * `InFile<SyntaxNode>` -- syntax node in a file
350/// * `InFile<ast::FnDef>` -- ast node in a file 350/// * `InFile<ast::FnDef>` -- ast node in a file
351/// * `InFile<TextUnit>` -- offset in a file 351/// * `InFile<TextSize>` -- offset in a file
352#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] 352#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
353pub struct InFile<T> { 353pub struct InFile<T> {
354 pub file_id: HirFileId, 354 pub file_id: HirFileId,
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index 846005baa..b6a96bb5c 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -117,7 +117,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
117 let macro_prefix = if node.file_id != file_id.into() { "!" } else { "" }; 117 let macro_prefix = if node.file_id != file_id.into() { "!" } else { "" };
118 format_to!( 118 format_to!(
119 buf, 119 buf,
120 "{}{} '{}': {}\n", 120 "{}{:?} '{}': {}\n",
121 macro_prefix, 121 macro_prefix,
122 range, 122 range,
123 ellipsize(text, 15), 123 ellipsize(text, 15),
@@ -134,7 +134,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
134 let macro_prefix = if src_ptr.file_id != file_id.into() { "!" } else { "" }; 134 let macro_prefix = if src_ptr.file_id != file_id.into() { "!" } else { "" };
135 format_to!( 135 format_to!(
136 buf, 136 buf,
137 "{}{}: expected {}, got {}\n", 137 "{}{:?}: expected {}, got {}\n",
138 macro_prefix, 138 macro_prefix,
139 range, 139 range,
140 mismatch.expected.display(&db), 140 mismatch.expected.display(&db),
diff --git a/crates/ra_hir_ty/src/tests/coercion.rs b/crates/ra_hir_ty/src/tests/coercion.rs
index b2c971f02..e6fb3e123 100644
--- a/crates/ra_hir_ty/src/tests/coercion.rs
+++ b/crates/ra_hir_ty/src/tests/coercion.rs
@@ -29,10 +29,10 @@ fn test() {
29} 29}
30"#), 30"#),
31 @r###" 31 @r###"
32 [11; 41) '{ ...4 }; }': () 32 11..41 '{ ...4 }; }': ()
33 [21; 22) 'a': i32 33 21..22 'a': i32
34 [30; 38) '{ 1i64 }': i64 34 30..38 '{ 1i64 }': i64
35 [32; 36) '1i64': i64 35 32..36 '1i64': i64
36 "###); 36 "###);
37} 37}
38 38
@@ -63,50 +63,50 @@ fn test2() {
63} 63}
64"#), 64"#),
65 @r###" 65 @r###"
66 [31; 32) '_': &[T] 66 31..32 '_': &[T]
67 [45; 56) '{ loop {} }': T 67 45..56 '{ loop {} }': T
68 [47; 54) 'loop {}': ! 68 47..54 'loop {}': !
69 [52; 54) '{}': () 69 52..54 '{}': ()
70 [65; 66) '_': S<&[T]> 70 65..66 '_': S<&[T]>
71 [82; 93) '{ loop {} }': T 71 82..93 '{ loop {} }': T
72 [84; 91) 'loop {}': ! 72 84..91 'loop {}': !
73 [89; 91) '{}': () 73 89..91 '{}': ()
74 [122; 133) '{ loop {} }': *mut [T; _] 74 122..133 '{ loop {} }': *mut [T; _]
75 [124; 131) 'loop {}': ! 75 124..131 'loop {}': !
76 [129; 131) '{}': () 76 129..131 '{}': ()
77 [160; 173) '{ gen() }': *mut [U] 77 160..173 '{ gen() }': *mut [U]
78 [166; 169) 'gen': fn gen<U>() -> *mut [U; _] 78 166..169 'gen': fn gen<U>() -> *mut [U; _]
79 [166; 171) 'gen()': *mut [U; _] 79 166..171 'gen()': *mut [U; _]
80 [186; 420) '{ ...rr); }': () 80 186..420 '{ ...rr); }': ()
81 [196; 199) 'arr': &[u8; _] 81 196..199 'arr': &[u8; _]
82 [212; 216) '&[1]': &[u8; _] 82 212..216 '&[1]': &[u8; _]
83 [213; 216) '[1]': [u8; _] 83 213..216 '[1]': [u8; _]
84 [214; 215) '1': u8 84 214..215 '1': u8
85 [227; 228) 'a': &[u8] 85 227..228 'a': &[u8]
86 [237; 240) 'arr': &[u8; _] 86 237..240 'arr': &[u8; _]
87 [250; 251) 'b': u8 87 250..251 'b': u8
88 [254; 255) 'f': fn f<u8>(&[u8]) -> u8 88 254..255 'f': fn f<u8>(&[u8]) -> u8
89 [254; 260) 'f(arr)': u8 89 254..260 'f(arr)': u8
90 [256; 259) 'arr': &[u8; _] 90 256..259 'arr': &[u8; _]
91 [270; 271) 'c': &[u8] 91 270..271 'c': &[u8]
92 [280; 287) '{ arr }': &[u8] 92 280..287 '{ arr }': &[u8]
93 [282; 285) 'arr': &[u8; _] 93 282..285 'arr': &[u8; _]
94 [297; 298) 'd': u8 94 297..298 'd': u8
95 [301; 302) 'g': fn g<u8>(S<&[u8]>) -> u8 95 301..302 'g': fn g<u8>(S<&[u8]>) -> u8
96 [301; 316) 'g(S { a: arr })': u8 96 301..316 'g(S { a: arr })': u8
97 [303; 315) 'S { a: arr }': S<&[u8]> 97 303..315 'S { a: arr }': S<&[u8]>
98 [310; 313) 'arr': &[u8; _] 98 310..313 'arr': &[u8; _]
99 [326; 327) 'e': [&[u8]; _] 99 326..327 'e': [&[u8]; _]
100 [341; 346) '[arr]': [&[u8]; _] 100 341..346 '[arr]': [&[u8]; _]
101 [342; 345) 'arr': &[u8; _] 101 342..345 'arr': &[u8; _]
102 [356; 357) 'f': [&[u8]; _] 102 356..357 'f': [&[u8]; _]
103 [371; 379) '[arr; 2]': [&[u8]; _] 103 371..379 '[arr; 2]': [&[u8]; _]
104 [372; 375) 'arr': &[u8; _] 104 372..375 'arr': &[u8; _]
105 [377; 378) '2': usize 105 377..378 '2': usize
106 [389; 390) 'g': (&[u8], &[u8]) 106 389..390 'g': (&[u8], &[u8])
107 [407; 417) '(arr, arr)': (&[u8], &[u8]) 107 407..417 '(arr, arr)': (&[u8], &[u8])
108 [408; 411) 'arr': &[u8; _] 108 408..411 'arr': &[u8; _]
109 [413; 416) 'arr': &[u8; _] 109 413..416 'arr': &[u8; _]
110 "### 110 "###
111 ); 111 );
112} 112}
@@ -120,11 +120,11 @@ fn test() {
120} 120}
121"#), 121"#),
122 @r###" 122 @r###"
123 [11; 40) '{ ...[1]; }': () 123 11..40 '{ ...[1]; }': ()
124 [21; 22) 'x': &[i32] 124 21..22 'x': &[i32]
125 [33; 37) '&[1]': &[i32; _] 125 33..37 '&[1]': &[i32; _]
126 [34; 37) '[1]': [i32; _] 126 34..37 '[1]': [i32; _]
127 [35; 36) '1': i32 127 35..36 '1': i32
128 "###); 128 "###);
129} 129}
130 130
@@ -150,31 +150,31 @@ fn test(a: A<[u8; 2]>, b: B<[u8; 2]>, c: C<[u8; 2]>) {
150} 150}
151"#), 151"#),
152 @r###" 152 @r###"
153 [258; 259) 'x': A<[T]> 153 258..259 'x': A<[T]>
154 [279; 284) '{ x }': A<[T]> 154 279..284 '{ x }': A<[T]>
155 [281; 282) 'x': A<[T]> 155 281..282 'x': A<[T]>
156 [296; 297) 'x': B<[T]> 156 296..297 'x': B<[T]>
157 [317; 322) '{ x }': B<[T]> 157 317..322 '{ x }': B<[T]>
158 [319; 320) 'x': B<[T]> 158 319..320 'x': B<[T]>
159 [334; 335) 'x': C<[T]> 159 334..335 'x': C<[T]>
160 [355; 360) '{ x }': C<[T]> 160 355..360 '{ x }': C<[T]>
161 [357; 358) 'x': C<[T]> 161 357..358 'x': C<[T]>
162 [370; 371) 'a': A<[u8; _]> 162 370..371 'a': A<[u8; _]>
163 [385; 386) 'b': B<[u8; _]> 163 385..386 'b': B<[u8; _]>
164 [400; 401) 'c': C<[u8; _]> 164 400..401 'c': C<[u8; _]>
165 [415; 481) '{ ...(c); }': () 165 415..481 '{ ...(c); }': ()
166 [425; 426) 'd': A<[{unknown}]> 166 425..426 'd': A<[{unknown}]>
167 [429; 433) 'foo1': fn foo1<{unknown}>(A<[{unknown}]>) -> A<[{unknown}]> 167 429..433 'foo1': fn foo1<{unknown}>(A<[{unknown}]>) -> A<[{unknown}]>
168 [429; 436) 'foo1(a)': A<[{unknown}]> 168 429..436 'foo1(a)': A<[{unknown}]>
169 [434; 435) 'a': A<[u8; _]> 169 434..435 'a': A<[u8; _]>
170 [446; 447) 'e': B<[u8]> 170 446..447 'e': B<[u8]>
171 [450; 454) 'foo2': fn foo2<u8>(B<[u8]>) -> B<[u8]> 171 450..454 'foo2': fn foo2<u8>(B<[u8]>) -> B<[u8]>
172 [450; 457) 'foo2(b)': B<[u8]> 172 450..457 'foo2(b)': B<[u8]>
173 [455; 456) 'b': B<[u8; _]> 173 455..456 'b': B<[u8; _]>
174 [467; 468) 'f': C<[u8]> 174 467..468 'f': C<[u8]>
175 [471; 475) 'foo3': fn foo3<u8>(C<[u8]>) -> C<[u8]> 175 471..475 'foo3': fn foo3<u8>(C<[u8]>) -> C<[u8]>
176 [471; 478) 'foo3(c)': C<[u8]> 176 471..478 'foo3(c)': C<[u8]>
177 [476; 477) 'c': C<[u8; _]> 177 476..477 'c': C<[u8; _]>
178 "### 178 "###
179 ); 179 );
180} 180}
@@ -193,24 +193,24 @@ fn test() {
193} 193}
194"#), 194"#),
195 @r###" 195 @r###"
196 [11; 12) 'x': &[T] 196 11..12 'x': &[T]
197 [28; 39) '{ loop {} }': &[T] 197 28..39 '{ loop {} }': &[T]
198 [30; 37) 'loop {}': ! 198 30..37 'loop {}': !
199 [35; 37) '{}': () 199 35..37 '{}': ()
200 [50; 126) '{ ... }; }': () 200 50..126 '{ ... }; }': ()
201 [60; 61) 'x': &[i32] 201 60..61 'x': &[i32]
202 [64; 123) 'if tru... }': &[i32] 202 64..123 'if tru... }': &[i32]
203 [67; 71) 'true': bool 203 67..71 'true': bool
204 [72; 97) '{ ... }': &[i32] 204 72..97 '{ ... }': &[i32]
205 [82; 85) 'foo': fn foo<i32>(&[i32]) -> &[i32] 205 82..85 'foo': fn foo<i32>(&[i32]) -> &[i32]
206 [82; 91) 'foo(&[1])': &[i32] 206 82..91 'foo(&[1])': &[i32]
207 [86; 90) '&[1]': &[i32; _] 207 86..90 '&[1]': &[i32; _]
208 [87; 90) '[1]': [i32; _] 208 87..90 '[1]': [i32; _]
209 [88; 89) '1': i32 209 88..89 '1': i32
210 [103; 123) '{ ... }': &[i32; _] 210 103..123 '{ ... }': &[i32; _]
211 [113; 117) '&[1]': &[i32; _] 211 113..117 '&[1]': &[i32; _]
212 [114; 117) '[1]': [i32; _] 212 114..117 '[1]': [i32; _]
213 [115; 116) '1': i32 213 115..116 '1': i32
214 "### 214 "###
215 ); 215 );
216} 216}
@@ -229,24 +229,24 @@ fn test() {
229} 229}
230"#), 230"#),
231 @r###" 231 @r###"
232 [11; 12) 'x': &[T] 232 11..12 'x': &[T]
233 [28; 39) '{ loop {} }': &[T] 233 28..39 '{ loop {} }': &[T]
234 [30; 37) 'loop {}': ! 234 30..37 'loop {}': !
235 [35; 37) '{}': () 235 35..37 '{}': ()
236 [50; 126) '{ ... }; }': () 236 50..126 '{ ... }; }': ()
237 [60; 61) 'x': &[i32] 237 60..61 'x': &[i32]
238 [64; 123) 'if tru... }': &[i32] 238 64..123 'if tru... }': &[i32]
239 [67; 71) 'true': bool 239 67..71 'true': bool
240 [72; 92) '{ ... }': &[i32; _] 240 72..92 '{ ... }': &[i32; _]
241 [82; 86) '&[1]': &[i32; _] 241 82..86 '&[1]': &[i32; _]
242 [83; 86) '[1]': [i32; _] 242 83..86 '[1]': [i32; _]
243 [84; 85) '1': i32 243 84..85 '1': i32
244 [98; 123) '{ ... }': &[i32] 244 98..123 '{ ... }': &[i32]
245 [108; 111) 'foo': fn foo<i32>(&[i32]) -> &[i32] 245 108..111 'foo': fn foo<i32>(&[i32]) -> &[i32]
246 [108; 117) 'foo(&[1])': &[i32] 246 108..117 'foo(&[1])': &[i32]
247 [112; 116) '&[1]': &[i32; _] 247 112..116 '&[1]': &[i32; _]
248 [113; 116) '[1]': [i32; _] 248 113..116 '[1]': [i32; _]
249 [114; 115) '1': i32 249 114..115 '1': i32
250 "### 250 "###
251 ); 251 );
252} 252}
@@ -265,31 +265,31 @@ fn test(i: i32) {
265} 265}
266"#), 266"#),
267 @r###" 267 @r###"
268 [11; 12) 'x': &[T] 268 11..12 'x': &[T]
269 [28; 39) '{ loop {} }': &[T] 269 28..39 '{ loop {} }': &[T]
270 [30; 37) 'loop {}': ! 270 30..37 'loop {}': !
271 [35; 37) '{}': () 271 35..37 '{}': ()
272 [48; 49) 'i': i32 272 48..49 'i': i32
273 [56; 150) '{ ... }; }': () 273 56..150 '{ ... }; }': ()
274 [66; 67) 'x': &[i32] 274 66..67 'x': &[i32]
275 [70; 147) 'match ... }': &[i32] 275 70..147 'match ... }': &[i32]
276 [76; 77) 'i': i32 276 76..77 'i': i32
277 [88; 89) '2': i32 277 88..89 '2': i32
278 [88; 89) '2': i32 278 88..89 '2': i32
279 [93; 96) 'foo': fn foo<i32>(&[i32]) -> &[i32] 279 93..96 'foo': fn foo<i32>(&[i32]) -> &[i32]
280 [93; 102) 'foo(&[2])': &[i32] 280 93..102 'foo(&[2])': &[i32]
281 [97; 101) '&[2]': &[i32; _] 281 97..101 '&[2]': &[i32; _]
282 [98; 101) '[2]': [i32; _] 282 98..101 '[2]': [i32; _]
283 [99; 100) '2': i32 283 99..100 '2': i32
284 [112; 113) '1': i32 284 112..113 '1': i32
285 [112; 113) '1': i32 285 112..113 '1': i32
286 [117; 121) '&[1]': &[i32; _] 286 117..121 '&[1]': &[i32; _]
287 [118; 121) '[1]': [i32; _] 287 118..121 '[1]': [i32; _]
288 [119; 120) '1': i32 288 119..120 '1': i32
289 [131; 132) '_': i32 289 131..132 '_': i32
290 [136; 140) '&[3]': &[i32; _] 290 136..140 '&[3]': &[i32; _]
291 [137; 140) '[3]': [i32; _] 291 137..140 '[3]': [i32; _]
292 [138; 139) '3': i32 292 138..139 '3': i32
293 "### 293 "###
294 ); 294 );
295} 295}
@@ -308,31 +308,31 @@ fn test(i: i32) {
308} 308}
309"#), 309"#),
310 @r###" 310 @r###"
311 [11; 12) 'x': &[T] 311 11..12 'x': &[T]
312 [28; 39) '{ loop {} }': &[T] 312 28..39 '{ loop {} }': &[T]
313 [30; 37) 'loop {}': ! 313 30..37 'loop {}': !
314 [35; 37) '{}': () 314 35..37 '{}': ()
315 [48; 49) 'i': i32 315 48..49 'i': i32
316 [56; 150) '{ ... }; }': () 316 56..150 '{ ... }; }': ()
317 [66; 67) 'x': &[i32] 317 66..67 'x': &[i32]
318 [70; 147) 'match ... }': &[i32] 318 70..147 'match ... }': &[i32]
319 [76; 77) 'i': i32 319 76..77 'i': i32
320 [88; 89) '1': i32 320 88..89 '1': i32
321 [88; 89) '1': i32 321 88..89 '1': i32
322 [93; 97) '&[1]': &[i32; _] 322 93..97 '&[1]': &[i32; _]
323 [94; 97) '[1]': [i32; _] 323 94..97 '[1]': [i32; _]
324 [95; 96) '1': i32 324 95..96 '1': i32
325 [107; 108) '2': i32 325 107..108 '2': i32
326 [107; 108) '2': i32 326 107..108 '2': i32
327 [112; 115) 'foo': fn foo<i32>(&[i32]) -> &[i32] 327 112..115 'foo': fn foo<i32>(&[i32]) -> &[i32]
328 [112; 121) 'foo(&[2])': &[i32] 328 112..121 'foo(&[2])': &[i32]
329 [116; 120) '&[2]': &[i32; _] 329 116..120 '&[2]': &[i32; _]
330 [117; 120) '[2]': [i32; _] 330 117..120 '[2]': [i32; _]
331 [118; 119) '2': i32 331 118..119 '2': i32
332 [131; 132) '_': i32 332 131..132 '_': i32
333 [136; 140) '&[3]': &[i32; _] 333 136..140 '&[3]': &[i32; _]
334 [137; 140) '[3]': [i32; _] 334 137..140 '[3]': [i32; _]
335 [138; 139) '3': i32 335 138..139 '3': i32
336 "### 336 "###
337 ); 337 );
338} 338}
@@ -353,24 +353,24 @@ fn test() {
353} 353}
354"#), 354"#),
355 @r###" 355 @r###"
356 [11; 145) '{ ... }; }': () 356 11..145 '{ ... }; }': ()
357 [21; 22) 't': &mut i32 357 21..22 't': &mut i32
358 [25; 31) '&mut 1': &mut i32 358 25..31 '&mut 1': &mut i32
359 [30; 31) '1': i32 359 30..31 '1': i32
360 [41; 42) 'x': *const i32 360 41..42 'x': *const i32
361 [45; 142) 'match ... }': *const i32 361 45..142 'match ... }': *const i32
362 [51; 52) '1': i32 362 51..52 '1': i32
363 [63; 64) '1': i32 363 63..64 '1': i32
364 [63; 64) '1': i32 364 63..64 '1': i32
365 [68; 69) 't': &mut i32 365 68..69 't': &mut i32
366 [68; 81) 't as *mut i32': *mut i32 366 68..81 't as *mut i32': *mut i32
367 [91; 92) '2': i32 367 91..92 '2': i32
368 [91; 92) '2': i32 368 91..92 '2': i32
369 [96; 97) 't': &mut i32 369 96..97 't': &mut i32
370 [96; 105) 't as &i32': &i32 370 96..105 't as &i32': &i32
371 [115; 116) '_': i32 371 115..116 '_': i32
372 [120; 121) 't': &mut i32 372 120..121 't': &mut i32
373 [120; 135) 't as *const i32': *const i32 373 120..135 't as *const i32': *const i32
374 "### 374 "###
375 ); 375 );
376} 376}
@@ -384,9 +384,9 @@ fn foo() -> u32 {
384} 384}
385"#, true), 385"#, true),
386 @r###" 386 @r###"
387 [17; 40) '{ ...own; }': ! 387 17..40 '{ ...own; }': !
388 [23; 37) 'return unknown': ! 388 23..37 'return unknown': !
389 [30; 37) 'unknown': u32 389 30..37 'unknown': u32
390 "### 390 "###
391 ); 391 );
392} 392}
@@ -404,24 +404,24 @@ fn test() {
404} 404}
405"#, true), 405"#, true),
406 @r###" 406 @r###"
407 [30; 31) 'x': &Foo 407 30..31 'x': &Foo
408 [39; 41) '{}': () 408 39..41 '{}': ()
409 [52; 133) '{ ...oo); }': () 409 52..133 '{ ...oo); }': ()
410 [58; 71) 'takes_ref_foo': fn takes_ref_foo(&Foo) 410 58..71 'takes_ref_foo': fn takes_ref_foo(&Foo)
411 [58; 77) 'takes_...(&Foo)': () 411 58..77 'takes_...(&Foo)': ()
412 [72; 76) '&Foo': &Foo 412 72..76 '&Foo': &Foo
413 [73; 76) 'Foo': Foo 413 73..76 'Foo': Foo
414 [83; 96) 'takes_ref_foo': fn takes_ref_foo(&Foo) 414 83..96 'takes_ref_foo': fn takes_ref_foo(&Foo)
415 [83; 103) 'takes_...&&Foo)': () 415 83..103 'takes_...&&Foo)': ()
416 [97; 102) '&&Foo': &&Foo 416 97..102 '&&Foo': &&Foo
417 [98; 102) '&Foo': &Foo 417 98..102 '&Foo': &Foo
418 [99; 102) 'Foo': Foo 418 99..102 'Foo': Foo
419 [109; 122) 'takes_ref_foo': fn takes_ref_foo(&Foo) 419 109..122 'takes_ref_foo': fn takes_ref_foo(&Foo)
420 [109; 130) 'takes_...&&Foo)': () 420 109..130 'takes_...&&Foo)': ()
421 [123; 129) '&&&Foo': &&&Foo 421 123..129 '&&&Foo': &&&Foo
422 [124; 129) '&&Foo': &&Foo 422 124..129 '&&Foo': &&Foo
423 [125; 129) '&Foo': &Foo 423 125..129 '&Foo': &Foo
424 [126; 129) 'Foo': Foo 424 126..129 'Foo': Foo
425 "### 425 "###
426 ); 426 );
427} 427}
@@ -439,26 +439,26 @@ fn test() {
439} 439}
440"#, true), 440"#, true),
441 @r###" 441 @r###"
442 [29; 30) 'x': &T 442 29..30 'x': &T
443 [41; 47) '{ *x }': T 443 41..47 '{ *x }': T
444 [43; 45) '*x': T 444 43..45 '*x': T
445 [44; 45) 'x': &T 445 44..45 'x': &T
446 [58; 127) '{ ...oo); }': () 446 58..127 '{ ...oo); }': ()
447 [64; 73) 'takes_ref': fn takes_ref<Foo>(&Foo) -> Foo 447 64..73 'takes_ref': fn takes_ref<Foo>(&Foo) -> Foo
448 [64; 79) 'takes_ref(&Foo)': Foo 448 64..79 'takes_ref(&Foo)': Foo
449 [74; 78) '&Foo': &Foo 449 74..78 '&Foo': &Foo
450 [75; 78) 'Foo': Foo 450 75..78 'Foo': Foo
451 [85; 94) 'takes_ref': fn takes_ref<&Foo>(&&Foo) -> &Foo 451 85..94 'takes_ref': fn takes_ref<&Foo>(&&Foo) -> &Foo
452 [85; 101) 'takes_...&&Foo)': &Foo 452 85..101 'takes_...&&Foo)': &Foo
453 [95; 100) '&&Foo': &&Foo 453 95..100 '&&Foo': &&Foo
454 [96; 100) '&Foo': &Foo 454 96..100 '&Foo': &Foo
455 [97; 100) 'Foo': Foo 455 97..100 'Foo': Foo
456 [107; 116) 'takes_ref': fn takes_ref<&&Foo>(&&&Foo) -> &&Foo 456 107..116 'takes_ref': fn takes_ref<&&Foo>(&&&Foo) -> &&Foo
457 [107; 124) 'takes_...&&Foo)': &&Foo 457 107..124 'takes_...&&Foo)': &&Foo
458 [117; 123) '&&&Foo': &&&Foo 458 117..123 '&&&Foo': &&&Foo
459 [118; 123) '&&Foo': &&Foo 459 118..123 '&&Foo': &&Foo
460 [119; 123) '&Foo': &Foo 460 119..123 '&Foo': &Foo
461 [120; 123) 'Foo': Foo 461 120..123 'Foo': Foo
462 "### 462 "###
463 ); 463 );
464} 464}
@@ -478,18 +478,18 @@ fn test() {
478} 478}
479"#, true), 479"#, true),
480 @r###" 480 @r###"
481 [127; 128) 'x': &str 481 127..128 'x': &str
482 [136; 138) '{}': () 482 136..138 '{}': ()
483 [169; 180) '{ loop {} }': String 483 169..180 '{ loop {} }': String
484 [171; 178) 'loop {}': ! 484 171..178 'loop {}': !
485 [176; 178) '{}': () 485 176..178 '{}': ()
486 [191; 236) '{ ... }); }': () 486 191..236 '{ ... }); }': ()
487 [197; 210) 'takes_ref_str': fn takes_ref_str(&str) 487 197..210 'takes_ref_str': fn takes_ref_str(&str)
488 [197; 233) 'takes_...g() })': () 488 197..233 'takes_...g() })': ()
489 [211; 232) '&{ ret...ng() }': &String 489 211..232 '&{ ret...ng() }': &String
490 [212; 232) '{ retu...ng() }': String 490 212..232 '{ retu...ng() }': String
491 [214; 228) 'returns_string': fn returns_string() -> String 491 214..228 'returns_string': fn returns_string() -> String
492 [214; 230) 'return...ring()': String 492 214..230 'return...ring()': String
493 "### 493 "###
494 ); 494 );
495} 495}
@@ -508,19 +508,19 @@ fn foo() {
508} 508}
509"#, true), 509"#, true),
510 @r###" 510 @r###"
511 [10; 106) '{ ... }; }': () 511 10..106 '{ ... }; }': ()
512 [20; 21) 'x': || -> &u32 512 20..21 'x': || -> &u32
513 [24; 103) '|| { ... }': || -> &u32 513 24..103 '|| { ... }': || -> &u32
514 [27; 103) '{ ... }': &u32 514 27..103 '{ ... }': &u32
515 [37; 82) 'if tru... }': () 515 37..82 'if tru... }': ()
516 [40; 44) 'true': bool 516 40..44 'true': bool
517 [45; 82) '{ ... }': ! 517 45..82 '{ ... }': !
518 [59; 71) 'return &1u32': ! 518 59..71 'return &1u32': !
519 [66; 71) '&1u32': &u32 519 66..71 '&1u32': &u32
520 [67; 71) '1u32': u32 520 67..71 '1u32': u32
521 [91; 97) '&&1u32': &&u32 521 91..97 '&&1u32': &&u32
522 [92; 97) '&1u32': &u32 522 92..97 '&1u32': &u32
523 [93; 97) '1u32': u32 523 93..97 '1u32': u32
524 "### 524 "###
525 ); 525 );
526} 526}
@@ -535,12 +535,12 @@ fn test() {
535} 535}
536"#, true), 536"#, true),
537 @r###" 537 @r###"
538 [8; 9) 'x': u32 538 8..9 'x': u32
539 [25; 30) '{ 1 }': isize 539 25..30 '{ 1 }': isize
540 [27; 28) '1': isize 540 27..28 '1': isize
541 [41; 79) '{ ...foo; }': () 541 41..79 '{ ...foo; }': ()
542 [51; 52) 'f': fn(u32) -> isize 542 51..52 'f': fn(u32) -> isize
543 [73; 76) 'foo': fn foo(u32) -> isize 543 73..76 'foo': fn foo(u32) -> isize
544 "### 544 "###
545 ); 545 );
546} 546}
@@ -554,12 +554,12 @@ fn test() {
554} 554}
555"#, true), 555"#, true),
556 @r###" 556 @r###"
557 [11; 55) '{ ...1 }; }': () 557 11..55 '{ ...1 }; }': ()
558 [21; 22) 'f': fn(u32) -> isize 558 21..22 'f': fn(u32) -> isize
559 [43; 52) '|x| { 1 }': |u32| -> isize 559 43..52 '|x| { 1 }': |u32| -> isize
560 [44; 45) 'x': u32 560 44..45 'x': u32
561 [47; 52) '{ 1 }': isize 561 47..52 '{ 1 }': isize
562 [49; 50) '1': isize 562 49..50 '1': isize
563 "### 563 "###
564 ); 564 );
565} 565}
@@ -577,11 +577,11 @@ impl<TT> S<TT> {
577} 577}
578"#, true), 578"#, true),
579 @r###" 579 @r###"
580 [51; 55) 'self': &S<TT> 580 51..55 'self': &S<TT>
581 [64; 87) '{ ... }': &TT 581 64..87 '{ ... }': &TT
582 [74; 81) '&self.t': &TT 582 74..81 '&self.t': &TT
583 [75; 79) 'self': &S<TT> 583 75..79 'self': &S<TT>
584 [75; 81) 'self.t': TT 584 75..81 'self.t': TT
585 "### 585 "###
586 ); 586 );
587} 587}
@@ -602,13 +602,13 @@ fn test() {
602} 602}
603"#, true), 603"#, true),
604 @r###" 604 @r###"
605 [162; 199) '{ ... 3]; }': () 605 162..199 '{ ... 3]; }': ()
606 [172; 173) 'f': &[usize] 606 172..173 'f': &[usize]
607 [186; 196) '&[1, 2, 3]': &[usize; _] 607 186..196 '&[1, 2, 3]': &[usize; _]
608 [187; 196) '[1, 2, 3]': [usize; _] 608 187..196 '[1, 2, 3]': [usize; _]
609 [188; 189) '1': usize 609 188..189 '1': usize
610 [191; 192) '2': usize 610 191..192 '2': usize
611 [194; 195) '3': usize 611 194..195 '3': usize
612 "### 612 "###
613 ); 613 );
614} 614}
@@ -642,19 +642,19 @@ fn test() {
642} 642}
643"#, true), 643"#, true),
644 @r###" 644 @r###"
645 [388; 573) '{ ...bj2; }': () 645 388..573 '{ ...bj2; }': ()
646 [398; 401) 'obj': &dyn Baz<i8, i16> 646 398..401 'obj': &dyn Baz<i8, i16>
647 [423; 425) '&S': &S<i8, i16> 647 423..425 '&S': &S<i8, i16>
648 [424; 425) 'S': S<i8, i16> 648 424..425 'S': S<i8, i16>
649 [435; 438) 'obj': &dyn Bar<usize, i8, i16> 649 435..438 'obj': &dyn Bar<usize, i8, i16>
650 [460; 463) 'obj': &dyn Baz<i8, i16> 650 460..463 'obj': &dyn Baz<i8, i16>
651 [473; 476) 'obj': &dyn Foo<i8, usize> 651 473..476 'obj': &dyn Foo<i8, usize>
652 [495; 498) 'obj': &dyn Bar<usize, i8, i16> 652 495..498 'obj': &dyn Bar<usize, i8, i16>
653 [508; 512) 'obj2': &dyn Baz<i8, i16> 653 508..512 'obj2': &dyn Baz<i8, i16>
654 [534; 536) '&S': &S<i8, i16> 654 534..536 '&S': &S<i8, i16>
655 [535; 536) 'S': S<i8, i16> 655 535..536 'S': S<i8, i16>
656 [546; 547) '_': &dyn Foo<i8, usize> 656 546..547 '_': &dyn Foo<i8, usize>
657 [566; 570) 'obj2': &dyn Baz<i8, i16> 657 566..570 'obj2': &dyn Baz<i8, i16>
658 "### 658 "###
659 ); 659 );
660} 660}
@@ -687,12 +687,12 @@ fn test() {
687} 687}
688"#, true), 688"#, true),
689 @r###" 689 @r###"
690 [292; 348) '{ ...obj; }': () 690 292..348 '{ ...obj; }': ()
691 [302; 305) 'obj': &dyn D 691 302..305 'obj': &dyn D
692 [316; 318) '&S': &S 692 316..318 '&S': &S
693 [317; 318) 'S': S 693 317..318 'S': S
694 [328; 331) 'obj': &dyn A 694 328..331 'obj': &dyn A
695 [342; 345) 'obj': &dyn D 695 342..345 'obj': &dyn D
696 "### 696 "###
697 ); 697 );
698} 698}
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs
index f2a9b1c40..6b5267232 100644
--- a/crates/ra_hir_ty/src/tests/macros.rs
+++ b/crates/ra_hir_ty/src/tests/macros.rs
@@ -67,12 +67,12 @@ fn main() {
67} 67}
68"#), 68"#),
69 @r###" 69 @r###"
70 ![0; 17) '{Foo(v...,2,])}': Foo 70 !0..17 '{Foo(v...,2,])}': Foo
71 ![1; 4) 'Foo': Foo({unknown}) -> Foo 71 !1..4 'Foo': Foo({unknown}) -> Foo
72 ![1; 16) 'Foo(vec![1,2,])': Foo 72 !1..16 'Foo(vec![1,2,])': Foo
73 ![5; 15) 'vec![1,2,]': {unknown} 73 !5..15 'vec![1,2,]': {unknown}
74 [156; 182) '{ ...,2); }': () 74 156..182 '{ ...,2); }': ()
75 [166; 167) 'x': Foo 75 166..167 'x': Foo
76 "### 76 "###
77 ); 77 );
78} 78}
@@ -100,14 +100,14 @@ fn main() {
100} 100}
101"#), 101"#),
102 @r###" 102 @r###"
103 ![0; 17) '{Foo(v...,2,])}': Foo 103 !0..17 '{Foo(v...,2,])}': Foo
104 ![1; 4) 'Foo': Foo({unknown}) -> Foo 104 !1..4 'Foo': Foo({unknown}) -> Foo
105 ![1; 16) 'Foo(vec![1,2,])': Foo 105 !1..16 'Foo(vec![1,2,])': Foo
106 ![5; 15) 'vec![1,2,]': {unknown} 106 !5..15 'vec![1,2,]': {unknown}
107 [195; 251) '{ ...,2); }': () 107 195..251 '{ ...,2); }': ()
108 [205; 206) 'x': Foo 108 205..206 'x': Foo
109 [228; 229) 'y': {unknown} 109 228..229 'y': {unknown}
110 [232; 248) 'crate:...!(1,2)': {unknown} 110 232..248 'crate:...!(1,2)': {unknown}
111 "### 111 "###
112 ); 112 );
113} 113}
@@ -131,11 +131,11 @@ fn main() {
131} 131}
132"#), 132"#),
133 @r###" 133 @r###"
134 ![0; 5) '42i32': i32 134 !0..5 '42i32': i32
135 ![0; 5) '42i32': i32 135 !0..5 '42i32': i32
136 [111; 164) '{ ...!(); }': () 136 111..164 '{ ...!(); }': ()
137 [121; 122) 'x': i32 137 121..122 'x': i32
138 [148; 149) 'y': i32 138 148..149 'y': i32
139 "### 139 "###
140 ); 140 );
141} 141}
@@ -172,51 +172,51 @@ fn spam() {
172} 172}
173"#), 173"#),
174 @r###" 174 @r###"
175 ![0; 6) '1isize': isize 175 !0..6 '1isize': isize
176 ![0; 6) '1isize': isize 176 !0..6 '1isize': isize
177 ![0; 6) '1isize': isize 177 !0..6 '1isize': isize
178 ![0; 6) '1isize': isize 178 !0..6 '1isize': isize
179 ![0; 6) '1isize': isize 179 !0..6 '1isize': isize
180 ![0; 6) '1isize': isize 180 !0..6 '1isize': isize
181 ![0; 6) '1isize': isize 181 !0..6 '1isize': isize
182 ![0; 6) '1isize': isize 182 !0..6 '1isize': isize
183 ![0; 6) '1isize': isize 183 !0..6 '1isize': isize
184 ![0; 6) '1isize': isize 184 !0..6 '1isize': isize
185 ![0; 6) '1isize': isize 185 !0..6 '1isize': isize
186 ![0; 6) '1isize': isize 186 !0..6 '1isize': isize
187 ![0; 6) '1isize': isize 187 !0..6 '1isize': isize
188 ![0; 6) '1isize': isize 188 !0..6 '1isize': isize
189 ![0; 6) '1isize': isize 189 !0..6 '1isize': isize
190 ![0; 6) '1isize': isize 190 !0..6 '1isize': isize
191 ![0; 6) '1isize': isize 191 !0..6 '1isize': isize
192 ![0; 6) '1isize': isize 192 !0..6 '1isize': isize
193 ![0; 6) '1isize': isize 193 !0..6 '1isize': isize
194 ![0; 6) '1isize': isize 194 !0..6 '1isize': isize
195 ![0; 6) '1isize': isize 195 !0..6 '1isize': isize
196 ![0; 6) '1isize': isize 196 !0..6 '1isize': isize
197 ![0; 6) '1isize': isize 197 !0..6 '1isize': isize
198 ![0; 6) '1isize': isize 198 !0..6 '1isize': isize
199 ![0; 6) '1isize': isize 199 !0..6 '1isize': isize
200 [54; 457) '{ ...!(); }': ! 200 54..457 '{ ...!(); }': !
201 [88; 109) 'spam!(...am!())': {unknown} 201 88..109 'spam!(...am!())': {unknown}
202 [115; 134) 'for _ ...!() {}': () 202 115..134 'for _ ...!() {}': ()
203 [119; 120) '_': {unknown} 203 119..120 '_': {unknown}
204 [132; 134) '{}': () 204 132..134 '{}': ()
205 [139; 149) '|| spam!()': || -> isize 205 139..149 '|| spam!()': || -> isize
206 [155; 171) 'while ...!() {}': () 206 155..171 'while ...!() {}': ()
207 [169; 171) '{}': () 207 169..171 '{}': ()
208 [176; 189) 'break spam!()': ! 208 176..189 'break spam!()': !
209 [195; 209) 'return spam!()': ! 209 195..209 'return spam!()': !
210 [215; 269) 'match ... }': isize 210 215..269 'match ... }': isize
211 [239; 240) '_': isize 211 239..240 '_': isize
212 [274; 290) 'spam!(...am!())': {unknown} 212 274..290 'spam!(...am!())': {unknown}
213 [296; 318) 'Spam {...m!() }': {unknown} 213 296..318 'Spam {...m!() }': {unknown}
214 [324; 340) 'spam!(...am!()]': {unknown} 214 324..340 'spam!(...am!()]': {unknown}
215 [365; 381) 'spam!(... usize': usize 215 365..381 'spam!(... usize': usize
216 [387; 395) '&spam!()': &isize 216 387..395 '&spam!()': &isize
217 [401; 409) '-spam!()': isize 217 401..409 '-spam!()': isize
218 [415; 431) 'spam!(...pam!()': {unknown} 218 415..431 'spam!(...pam!()': {unknown}
219 [437; 454) 'spam!(...pam!()': isize 219 437..454 'spam!(...pam!()': isize
220 "### 220 "###
221 ); 221 );
222} 222}
@@ -244,9 +244,9 @@ fn foo() {
244} 244}
245"#), 245"#),
246 @r###" 246 @r###"
247 ![0; 5) '42i32': i32 247 !0..5 '42i32': i32
248 [171; 206) '{ ...32); }': () 248 171..206 '{ ...32); }': ()
249 [181; 184) 'foo': i32 249 181..184 'foo': i32
250 "### 250 "###
251 ); 251 );
252} 252}
@@ -357,12 +357,12 @@ fn main() {
357} 357}
358"#), 358"#),
359 @r###" 359 @r###"
360 [159; 164) '{ 0 }': u64 360 159..164 '{ 0 }': u64
361 [161; 162) '0': u64 361 161..162 '0': u64
362 [175; 197) '{ ...f(); }': () 362 175..197 '{ ...f(); }': ()
363 [185; 187) '_a': u64 363 185..187 '_a': u64
364 [191; 192) 'f': fn f() -> u64 364 191..192 'f': fn f() -> u64
365 [191; 194) 'f()': u64 365 191..194 'f()': u64
366 "### 366 "###
367 ); 367 );
368} 368}
@@ -379,10 +379,10 @@ fn main() {
379} 379}
380"#), 380"#),
381 @r###" 381 @r###"
382 ![0; 6) '1usize': usize 382 !0..6 '1usize': usize
383 [11; 90) '{ ...!(); }': () 383 11..90 '{ ...!(); }': ()
384 [17; 66) 'macro_... }': {unknown} 384 17..66 'macro_... }': {unknown}
385 [75; 77) '_a': usize 385 75..77 '_a': usize
386 "### 386 "###
387 ); 387 );
388} 388}
@@ -399,9 +399,9 @@ fn main() {
399} 399}
400"#), 400"#),
401 @r###" 401 @r###"
402 ![0; 1) '0': i32 402 !0..1 '0': i32
403 [64; 88) '{ ...!(); }': () 403 64..88 '{ ...!(); }': ()
404 [74; 75) 'x': i32 404 74..75 'x': i32
405 "### 405 "###
406 ); 406 );
407} 407}
@@ -418,9 +418,9 @@ fn main() {
418} 418}
419"#), 419"#),
420 @r###" 420 @r###"
421 ![0; 2) '""': &str 421 !0..2 '""': &str
422 [64; 88) '{ ...!(); }': () 422 64..88 '{ ...!(); }': ()
423 [74; 75) 'x': &str 423 74..75 'x': &str
424 "### 424 "###
425 ); 425 );
426} 426}
@@ -437,9 +437,9 @@ fn main() {
437} 437}
438"#), 438"#),
439 @r###" 439 @r###"
440 ![0; 1) '0': i32 440 !0..1 '0': i32
441 [66; 92) '{ ...!(); }': () 441 66..92 '{ ...!(); }': ()
442 [76; 77) 'x': i32 442 76..77 'x': i32
443 "### 443 "###
444 ); 444 );
445} 445}
@@ -456,9 +456,9 @@ fn main() {
456} 456}
457"#), 457"#),
458 @r###" 458 @r###"
459 ![0; 13) '"helloworld!"': &str 459 !0..13 '"helloworld!"': &str
460 [66; 122) '{ ...")); }': () 460 66..122 '{ ...")); }': ()
461 [76; 77) 'x': &str 461 76..77 'x': &str
462 "### 462 "###
463 ); 463 );
464} 464}
@@ -591,9 +591,9 @@ fn main() {
591} 591}
592"#), 592"#),
593 @r###" 593 @r###"
594 ![0; 13) '"helloworld!"': &str 594 !0..13 '"helloworld!"': &str
595 [104; 161) '{ ...")); }': () 595 104..161 '{ ...")); }': ()
596 [114; 115) 'x': &str 596 114..115 'x': &str
597 "### 597 "###
598 ); 598 );
599} 599}
@@ -611,9 +611,9 @@ fn main() {
611} 611}
612"#), 612"#),
613 @r###" 613 @r###"
614 ![0; 5) '"bar"': &str 614 !0..5 '"bar"': &str
615 [88; 116) '{ ...o"); }': () 615 88..116 '{ ...o"); }': ()
616 [98; 99) 'x': &str 616 98..99 'x': &str
617 "### 617 "###
618 ); 618 );
619} 619}
@@ -703,12 +703,12 @@ fn main() {
703} 703}
704"#), 704"#),
705 @r###" 705 @r###"
706 [52; 111) '{ ... }; }': () 706 52..111 '{ ... }; }': ()
707 [62; 63) 'x': u32 707 62..63 'x': u32
708 [66; 108) 'match ... }': u32 708 66..108 'match ... }': u32
709 [72; 74) '()': () 709 72..74 '()': ()
710 [85; 92) 'unit!()': () 710 85..92 'unit!()': ()
711 [96; 101) '92u32': u32 711 96..101 '92u32': u32
712 "### 712 "###
713 ); 713 );
714} 714}
diff --git a/crates/ra_hir_ty/src/tests/method_resolution.rs b/crates/ra_hir_ty/src/tests/method_resolution.rs
index af3e5b12c..ab87f598a 100644
--- a/crates/ra_hir_ty/src/tests/method_resolution.rs
+++ b/crates/ra_hir_ty/src/tests/method_resolution.rs
@@ -22,14 +22,14 @@ fn test() {
22} 22}
23"#), 23"#),
24 @r###" 24 @r###"
25 [45; 49) 'self': &[T] 25 45..49 'self': &[T]
26 [56; 79) '{ ... }': T 26 56..79 '{ ... }': T
27 [66; 73) 'loop {}': ! 27 66..73 'loop {}': !
28 [71; 73) '{}': () 28 71..73 '{}': ()
29 [133; 160) '{ ...o"); }': () 29 133..160 '{ ...o"); }': ()
30 [139; 149) '<[_]>::foo': fn foo<u8>(&[u8]) -> u8 30 139..149 '<[_]>::foo': fn foo<u8>(&[u8]) -> u8
31 [139; 157) '<[_]>:..."foo")': u8 31 139..157 '<[_]>:..."foo")': u8
32 [150; 156) 'b"foo"': &[u8] 32 150..156 'b"foo"': &[u8]
33 "### 33 "###
34 ); 34 );
35} 35}
@@ -51,15 +51,15 @@ fn test() {
51} 51}
52"#), 52"#),
53 @r###" 53 @r###"
54 [49; 75) '{ ... }': A 54 49..75 '{ ... }': A
55 [59; 69) 'A { x: 0 }': A 55 59..69 'A { x: 0 }': A
56 [66; 67) '0': u32 56 66..67 '0': u32
57 [88; 122) '{ ...a.x; }': () 57 88..122 '{ ...a.x; }': ()
58 [98; 99) 'a': A 58 98..99 'a': A
59 [102; 108) 'A::new': fn new() -> A 59 102..108 'A::new': fn new() -> A
60 [102; 110) 'A::new()': A 60 102..110 'A::new()': A
61 [116; 117) 'a': A 61 116..117 'a': A
62 [116; 119) 'a.x': u32 62 116..119 'a.x': u32
63 "### 63 "###
64 ); 64 );
65} 65}
@@ -86,19 +86,19 @@ fn test() {
86} 86}
87"#), 87"#),
88 @r###" 88 @r###"
89 [47; 67) '{ ... }': A 89 47..67 '{ ... }': A
90 [57; 61) 'A::B': A 90 57..61 'A::B': A
91 [88; 108) '{ ... }': A 91 88..108 '{ ... }': A
92 [98; 102) 'A::C': A 92 98..102 'A::C': A
93 [121; 178) '{ ... c; }': () 93 121..178 '{ ... c; }': ()
94 [131; 132) 'a': A 94 131..132 'a': A
95 [135; 139) 'A::b': fn b() -> A 95 135..139 'A::b': fn b() -> A
96 [135; 141) 'A::b()': A 96 135..141 'A::b()': A
97 [147; 148) 'a': A 97 147..148 'a': A
98 [158; 159) 'c': A 98 158..159 'c': A
99 [162; 166) 'A::c': fn c() -> A 99 162..166 'A::c': fn c() -> A
100 [162; 168) 'A::c()': A 100 162..168 'A::c()': A
101 [174; 175) 'c': A 101 174..175 'c': A
102 "### 102 "###
103 ); 103 );
104} 104}
@@ -130,22 +130,22 @@ fn test() {
130} 130}
131"#), 131"#),
132 @r###" 132 @r###"
133 [56; 64) '{ A {} }': A 133 56..64 '{ A {} }': A
134 [58; 62) 'A {}': A 134 58..62 'A {}': A
135 [126; 132) '{ 99 }': u32 135 126..132 '{ 99 }': u32
136 [128; 130) '99': u32 136 128..130 '99': u32
137 [202; 210) '{ C {} }': C 137 202..210 '{ C {} }': C
138 [204; 208) 'C {}': C 138 204..208 'C {}': C
139 [241; 325) '{ ...g(); }': () 139 241..325 '{ ...g(); }': ()
140 [251; 252) 'x': A 140 251..252 'x': A
141 [255; 266) 'a::A::thing': fn thing() -> A 141 255..266 'a::A::thing': fn thing() -> A
142 [255; 268) 'a::A::thing()': A 142 255..268 'a::A::thing()': A
143 [278; 279) 'y': u32 143 278..279 'y': u32
144 [282; 293) 'b::B::thing': fn thing() -> u32 144 282..293 'b::B::thing': fn thing() -> u32
145 [282; 295) 'b::B::thing()': u32 145 282..295 'b::B::thing()': u32
146 [305; 306) 'z': C 146 305..306 'z': C
147 [309; 320) 'c::C::thing': fn thing() -> C 147 309..320 'c::C::thing': fn thing() -> C
148 [309; 322) 'c::C::thing()': C 148 309..322 'c::C::thing()': C
149 "### 149 "###
150 ); 150 );
151} 151}
@@ -169,15 +169,15 @@ fn test() {
169} 169}
170"#), 170"#),
171 @r###" 171 @r###"
172 [64; 67) 'val': T 172 64..67 'val': T
173 [82; 109) '{ ... }': Gen<T> 173 82..109 '{ ... }': Gen<T>
174 [92; 103) 'Gen { val }': Gen<T> 174 92..103 'Gen { val }': Gen<T>
175 [98; 101) 'val': T 175 98..101 'val': T
176 [123; 155) '{ ...32); }': () 176 123..155 '{ ...32); }': ()
177 [133; 134) 'a': Gen<u32> 177 133..134 'a': Gen<u32>
178 [137; 146) 'Gen::make': fn make<u32>(u32) -> Gen<u32> 178 137..146 'Gen::make': fn make<u32>(u32) -> Gen<u32>
179 [137; 152) 'Gen::make(0u32)': Gen<u32> 179 137..152 'Gen::make(0u32)': Gen<u32>
180 [147; 151) '0u32': u32 180 147..151 '0u32': u32
181 "### 181 "###
182 ); 182 );
183} 183}
@@ -201,13 +201,13 @@ fn test() {
201} 201}
202"#), 202"#),
203 @r###" 203 @r###"
204 [80; 104) '{ ... }': Gen<T> 204 80..104 '{ ... }': Gen<T>
205 [90; 98) 'loop { }': ! 205 90..98 'loop { }': !
206 [95; 98) '{ }': () 206 95..98 '{ }': ()
207 [118; 146) '{ ...e(); }': () 207 118..146 '{ ...e(); }': ()
208 [128; 129) 'a': Gen<u32> 208 128..129 'a': Gen<u32>
209 [132; 141) 'Gen::make': fn make<u32>() -> Gen<u32> 209 132..141 'Gen::make': fn make<u32>() -> Gen<u32>
210 [132; 143) 'Gen::make()': Gen<u32> 210 132..143 'Gen::make()': Gen<u32>
211 "### 211 "###
212 ); 212 );
213} 213}
@@ -255,13 +255,13 @@ fn test() {
255} 255}
256"#), 256"#),
257 @r###" 257 @r###"
258 [76; 100) '{ ... }': Gen<T> 258 76..100 '{ ... }': Gen<T>
259 [86; 94) 'loop { }': ! 259 86..94 'loop { }': !
260 [91; 94) '{ }': () 260 91..94 '{ }': ()
261 [114; 149) '{ ...e(); }': () 261 114..149 '{ ...e(); }': ()
262 [124; 125) 'a': Gen<u32> 262 124..125 'a': Gen<u32>
263 [128; 144) 'Gen::<...::make': fn make<u32>() -> Gen<u32> 263 128..144 'Gen::<...::make': fn make<u32>() -> Gen<u32>
264 [128; 146) 'Gen::<...make()': Gen<u32> 264 128..146 'Gen::<...make()': Gen<u32>
265 "### 265 "###
266 ); 266 );
267} 267}
@@ -286,13 +286,13 @@ fn test() {
286} 286}
287"#), 287"#),
288 @r###" 288 @r###"
289 [102; 126) '{ ... }': Gen<u32, T> 289 102..126 '{ ... }': Gen<u32, T>
290 [112; 120) 'loop { }': ! 290 112..120 'loop { }': !
291 [117; 120) '{ }': () 291 117..120 '{ }': ()
292 [140; 180) '{ ...e(); }': () 292 140..180 '{ ...e(); }': ()
293 [150; 151) 'a': Gen<u32, u64> 293 150..151 'a': Gen<u32, u64>
294 [154; 175) 'Gen::<...::make': fn make<u64>() -> Gen<u32, u64> 294 154..175 'Gen::<...::make': fn make<u64>() -> Gen<u32, u64>
295 [154; 177) 'Gen::<...make()': Gen<u32, u64> 295 154..177 'Gen::<...make()': Gen<u32, u64>
296 "### 296 "###
297 ); 297 );
298} 298}
@@ -340,13 +340,13 @@ fn test() {
340} 340}
341"#), 341"#),
342 @r###" 342 @r###"
343 [31; 35) 'self': &Self 343 31..35 'self': &Self
344 [110; 114) 'self': &Self 344 110..114 'self': &Self
345 [170; 228) '{ ...i128 }': () 345 170..228 '{ ...i128 }': ()
346 [176; 178) 'S1': S1 346 176..178 'S1': S1
347 [176; 187) 'S1.method()': u32 347 176..187 'S1.method()': u32
348 [203; 205) 'S2': S2 348 203..205 'S2': S2
349 [203; 214) 'S2.method()': i128 349 203..214 'S2.method()': i128
350 "### 350 "###
351 ); 351 );
352} 352}
@@ -387,14 +387,14 @@ mod bar_test {
387} 387}
388"#), 388"#),
389 @r###" 389 @r###"
390 [63; 67) 'self': &Self 390 63..67 'self': &Self
391 [169; 173) 'self': &Self 391 169..173 'self': &Self
392 [300; 337) '{ ... }': () 392 300..337 '{ ... }': ()
393 [310; 311) 'S': S 393 310..311 'S': S
394 [310; 320) 'S.method()': u32 394 310..320 'S.method()': u32
395 [416; 454) '{ ... }': () 395 416..454 '{ ... }': ()
396 [426; 427) 'S': S 396 426..427 'S': S
397 [426; 436) 'S.method()': i128 397 426..436 'S.method()': i128
398 "### 398 "###
399 ); 399 );
400} 400}
@@ -414,10 +414,10 @@ fn test() {
414} 414}
415"#), 415"#),
416 @r###" 416 @r###"
417 [33; 37) 'self': &Self 417 33..37 'self': &Self
418 [92; 111) '{ ...d(); }': () 418 92..111 '{ ...d(); }': ()
419 [98; 99) 'S': S 419 98..99 'S': S
420 [98; 108) 'S.method()': u32 420 98..108 'S.method()': u32
421 "### 421 "###
422 ); 422 );
423} 423}
@@ -443,17 +443,17 @@ fn test() {
443} 443}
444"#), 444"#),
445 @r###" 445 @r###"
446 [43; 47) 'self': &Self 446 43..47 'self': &Self
447 [82; 86) 'self': &Self 447 82..86 'self': &Self
448 [210; 361) '{ ..., i8 }': () 448 210..361 '{ ..., i8 }': ()
449 [216; 218) 'S1': S1 449 216..218 'S1': S1
450 [216; 228) 'S1.method1()': (u8, u16, u32) 450 216..228 'S1.method1()': (u8, u16, u32)
451 [250; 252) 'S1': S1 451 250..252 'S1': S1
452 [250; 262) 'S1.method2()': (u32, u16, u8) 452 250..262 'S1.method2()': (u32, u16, u8)
453 [284; 286) 'S2': S2 453 284..286 'S2': S2
454 [284; 296) 'S2.method1()': (i8, i16, {unknown}) 454 284..296 'S2.method1()': (i8, i16, {unknown})
455 [324; 326) 'S2': S2 455 324..326 'S2': S2
456 [324; 336) 'S2.method2()': ({unknown}, i16, i8) 456 324..336 'S2.method2()': ({unknown}, i16, i8)
457 "### 457 "###
458 ); 458 );
459} 459}
@@ -473,12 +473,12 @@ fn test() {
473} 473}
474"#), 474"#),
475 @r###" 475 @r###"
476 [33; 37) 'self': &Self 476 33..37 'self': &Self
477 [102; 127) '{ ...d(); }': () 477 102..127 '{ ...d(); }': ()
478 [108; 109) 'S': S<u32>(u32) -> S<u32> 478 108..109 'S': S<u32>(u32) -> S<u32>
479 [108; 115) 'S(1u32)': S<u32> 479 108..115 'S(1u32)': S<u32>
480 [108; 124) 'S(1u32...thod()': u32 480 108..124 'S(1u32...thod()': u32
481 [110; 114) '1u32': u32 481 110..114 '1u32': u32
482 "### 482 "###
483 ); 483 );
484} 484}
@@ -499,16 +499,16 @@ fn test() {
499} 499}
500"#), 500"#),
501 @r###" 501 @r###"
502 [87; 193) '{ ...t(); }': () 502 87..193 '{ ...t(); }': ()
503 [97; 99) 's1': S 503 97..99 's1': S
504 [105; 121) 'Defaul...efault': fn default<S>() -> S 504 105..121 'Defaul...efault': fn default<S>() -> S
505 [105; 123) 'Defaul...ault()': S 505 105..123 'Defaul...ault()': S
506 [133; 135) 's2': S 506 133..135 's2': S
507 [138; 148) 'S::default': fn default<S>() -> S 507 138..148 'S::default': fn default<S>() -> S
508 [138; 150) 'S::default()': S 508 138..150 'S::default()': S
509 [160; 162) 's3': S 509 160..162 's3': S
510 [165; 188) '<S as ...efault': fn default<S>() -> S 510 165..188 '<S as ...efault': fn default<S>() -> S
511 [165; 190) '<S as ...ault()': S 511 165..190 '<S as ...ault()': S
512 "### 512 "###
513 ); 513 );
514} 514}
@@ -531,16 +531,16 @@ fn test() {
531} 531}
532"#), 532"#),
533 @r###" 533 @r###"
534 [127; 211) '{ ...e(); }': () 534 127..211 '{ ...e(); }': ()
535 [137; 138) 'a': u32 535 137..138 'a': u32
536 [141; 148) 'S::make': fn make<S, u32>() -> u32 536 141..148 'S::make': fn make<S, u32>() -> u32
537 [141; 150) 'S::make()': u32 537 141..150 'S::make()': u32
538 [160; 161) 'b': u64 538 160..161 'b': u64
539 [164; 178) 'G::<u64>::make': fn make<G<u64>, u64>() -> u64 539 164..178 'G::<u64>::make': fn make<G<u64>, u64>() -> u64
540 [164; 180) 'G::<u6...make()': u64 540 164..180 'G::<u6...make()': u64
541 [190; 191) 'c': f64 541 190..191 'c': f64
542 [199; 206) 'G::make': fn make<G<f64>, f64>() -> f64 542 199..206 'G::make': fn make<G<f64>, f64>() -> f64
543 [199; 208) 'G::make()': f64 543 199..208 'G::make()': f64
544 "### 544 "###
545 ); 545 );
546} 546}
@@ -565,22 +565,22 @@ fn test() {
565} 565}
566"#), 566"#),
567 @r###" 567 @r###"
568 [135; 313) '{ ...e(); }': () 568 135..313 '{ ...e(); }': ()
569 [145; 146) 'a': (u32, i64) 569 145..146 'a': (u32, i64)
570 [149; 163) 'S::make::<i64>': fn make<S, u32, i64>() -> (u32, i64) 570 149..163 'S::make::<i64>': fn make<S, u32, i64>() -> (u32, i64)
571 [149; 165) 'S::mak...i64>()': (u32, i64) 571 149..165 'S::mak...i64>()': (u32, i64)
572 [175; 176) 'b': (u32, i64) 572 175..176 'b': (u32, i64)
573 [189; 196) 'S::make': fn make<S, u32, i64>() -> (u32, i64) 573 189..196 'S::make': fn make<S, u32, i64>() -> (u32, i64)
574 [189; 198) 'S::make()': (u32, i64) 574 189..198 'S::make()': (u32, i64)
575 [208; 209) 'c': (u32, i64) 575 208..209 'c': (u32, i64)
576 [212; 233) 'G::<u3...:<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64) 576 212..233 'G::<u3...:<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64)
577 [212; 235) 'G::<u3...i64>()': (u32, i64) 577 212..235 'G::<u3...i64>()': (u32, i64)
578 [245; 246) 'd': (u32, i64) 578 245..246 'd': (u32, i64)
579 [259; 273) 'G::make::<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64) 579 259..273 'G::make::<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64)
580 [259; 275) 'G::mak...i64>()': (u32, i64) 580 259..275 'G::mak...i64>()': (u32, i64)
581 [285; 286) 'e': (u32, i64) 581 285..286 'e': (u32, i64)
582 [301; 308) 'G::make': fn make<G<u32>, u32, i64>() -> (u32, i64) 582 301..308 'G::make': fn make<G<u32>, u32, i64>() -> (u32, i64)
583 [301; 310) 'G::make()': (u32, i64) 583 301..310 'G::make()': (u32, i64)
584 "### 584 "###
585 ); 585 );
586} 586}
@@ -599,10 +599,10 @@ fn test() {
599} 599}
600"#), 600"#),
601 @r###" 601 @r###"
602 [101; 127) '{ ...e(); }': () 602 101..127 '{ ...e(); }': ()
603 [111; 112) 'a': (S<i32>, i64) 603 111..112 'a': (S<i32>, i64)
604 [115; 122) 'S::make': fn make<S<i32>, i64>() -> (S<i32>, i64) 604 115..122 'S::make': fn make<S<i32>, i64>() -> (S<i32>, i64)
605 [115; 124) 'S::make()': (S<i32>, i64) 605 115..124 'S::make()': (S<i32>, i64)
606 "### 606 "###
607 ); 607 );
608} 608}
@@ -623,13 +623,13 @@ fn test() {
623} 623}
624"#), 624"#),
625 @r###" 625 @r###"
626 [131; 203) '{ ...e(); }': () 626 131..203 '{ ...e(); }': ()
627 [141; 142) 'a': (S<u64>, i64) 627 141..142 'a': (S<u64>, i64)
628 [158; 165) 'S::make': fn make<S<u64>, i64>() -> (S<u64>, i64) 628 158..165 'S::make': fn make<S<u64>, i64>() -> (S<u64>, i64)
629 [158; 167) 'S::make()': (S<u64>, i64) 629 158..167 'S::make()': (S<u64>, i64)
630 [177; 178) 'b': (S<u32>, i32) 630 177..178 'b': (S<u32>, i32)
631 [191; 198) 'S::make': fn make<S<u32>, i32>() -> (S<u32>, i32) 631 191..198 'S::make': fn make<S<u32>, i32>() -> (S<u32>, i32)
632 [191; 200) 'S::make()': (S<u32>, i32) 632 191..200 'S::make()': (S<u32>, i32)
633 "### 633 "###
634 ); 634 );
635} 635}
@@ -649,13 +649,13 @@ fn test() {
649} 649}
650"#), 650"#),
651 @r###" 651 @r###"
652 [107; 211) '{ ...>(); }': () 652 107..211 '{ ...>(); }': ()
653 [117; 118) 'a': (S<u64>, i64, u8) 653 117..118 'a': (S<u64>, i64, u8)
654 [121; 150) '<S as ...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8) 654 121..150 '<S as ...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8)
655 [121; 152) '<S as ...<u8>()': (S<u64>, i64, u8) 655 121..152 '<S as ...<u8>()': (S<u64>, i64, u8)
656 [162; 163) 'b': (S<u64>, i64, u8) 656 162..163 'b': (S<u64>, i64, u8)
657 [182; 206) 'Trait:...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8) 657 182..206 'Trait:...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8)
658 [182; 208) 'Trait:...<u8>()': (S<u64>, i64, u8) 658 182..208 'Trait:...<u8>()': (S<u64>, i64, u8)
659 "### 659 "###
660 ); 660 );
661} 661}
@@ -672,11 +672,11 @@ fn test<T: Trait>(t: T) {
672} 672}
673"#), 673"#),
674 @r###" 674 @r###"
675 [30; 34) 'self': &Self 675 30..34 'self': &Self
676 [64; 65) 't': T 676 64..65 't': T
677 [70; 89) '{ ...d(); }': () 677 70..89 '{ ...d(); }': ()
678 [76; 77) 't': T 678 76..77 't': T
679 [76; 86) 't.method()': u32 679 76..86 't.method()': u32
680 "### 680 "###
681 ); 681 );
682} 682}
@@ -693,11 +693,11 @@ fn test<U, T: Trait<U>>(t: T) {
693} 693}
694"#), 694"#),
695 @r###" 695 @r###"
696 [33; 37) 'self': &Self 696 33..37 'self': &Self
697 [71; 72) 't': T 697 71..72 't': T
698 [77; 96) '{ ...d(); }': () 698 77..96 '{ ...d(); }': ()
699 [83; 84) 't': T 699 83..84 't': T
700 [83; 93) 't.method()': U 700 83..93 't.method()': U
701 "### 701 "###
702 ); 702 );
703} 703}
@@ -719,18 +719,18 @@ fn test() {
719} 719}
720"#), 720"#),
721 @r###" 721 @r###"
722 [29; 33) 'self': Self 722 29..33 'self': Self
723 [111; 202) '{ ...(S); }': () 723 111..202 '{ ...(S); }': ()
724 [121; 122) 'x': u32 724 121..122 'x': u32
725 [130; 131) 'S': S 725 130..131 'S': S
726 [130; 138) 'S.into()': u32 726 130..138 'S.into()': u32
727 [148; 149) 'y': u64 727 148..149 'y': u64
728 [157; 158) 'S': S 728 157..158 'S': S
729 [157; 165) 'S.into()': u64 729 157..165 'S.into()': u64
730 [175; 176) 'z': u64 730 175..176 'z': u64
731 [179; 196) 'Into::...::into': fn into<S, u64>(S) -> u64 731 179..196 'Into::...::into': fn into<S, u64>(S) -> u64
732 [179; 199) 'Into::...nto(S)': u64 732 179..199 'Into::...nto(S)': u64
733 [197; 198) 'S': S 733 197..198 'S': S
734 "### 734 "###
735 ); 735 );
736} 736}
diff --git a/crates/ra_hir_ty/src/tests/patterns.rs b/crates/ra_hir_ty/src/tests/patterns.rs
index 6ea51d5d3..af291092d 100644
--- a/crates/ra_hir_ty/src/tests/patterns.rs
+++ b/crates/ra_hir_ty/src/tests/patterns.rs
@@ -30,54 +30,54 @@ fn test(x: &i32) {
30} 30}
31"#), 31"#),
32 @r###" 32 @r###"
33 [9; 10) 'x': &i32 33 9..10 'x': &i32
34 [18; 369) '{ ...o_x; }': () 34 18..369 '{ ...o_x; }': ()
35 [28; 29) 'y': &i32 35 28..29 'y': &i32
36 [32; 33) 'x': &i32 36 32..33 'x': &i32
37 [43; 45) '&z': &i32 37 43..45 '&z': &i32
38 [44; 45) 'z': i32 38 44..45 'z': i32
39 [48; 49) 'x': &i32 39 48..49 'x': &i32
40 [59; 60) 'a': i32 40 59..60 'a': i32
41 [63; 64) 'z': i32 41 63..64 'z': i32
42 [74; 80) '(c, d)': (i32, &str) 42 74..80 '(c, d)': (i32, &str)
43 [75; 76) 'c': i32 43 75..76 'c': i32
44 [78; 79) 'd': &str 44 78..79 'd': &str
45 [83; 95) '(1, "hello")': (i32, &str) 45 83..95 '(1, "hello")': (i32, &str)
46 [84; 85) '1': i32 46 84..85 '1': i32
47 [87; 94) '"hello"': &str 47 87..94 '"hello"': &str
48 [102; 152) 'for (e... }': () 48 102..152 'for (e... }': ()
49 [106; 112) '(e, f)': ({unknown}, {unknown}) 49 106..112 '(e, f)': ({unknown}, {unknown})
50 [107; 108) 'e': {unknown} 50 107..108 'e': {unknown}
51 [110; 111) 'f': {unknown} 51 110..111 'f': {unknown}
52 [116; 125) 'some_iter': {unknown} 52 116..125 'some_iter': {unknown}
53 [126; 152) '{ ... }': () 53 126..152 '{ ... }': ()
54 [140; 141) 'g': {unknown} 54 140..141 'g': {unknown}
55 [144; 145) 'e': {unknown} 55 144..145 'e': {unknown}
56 [158; 205) 'if let... }': () 56 158..205 'if let... }': ()
57 [165; 170) '[val]': [{unknown}] 57 165..170 '[val]': [{unknown}]
58 [166; 169) 'val': {unknown} 58 166..169 'val': {unknown}
59 [173; 176) 'opt': [{unknown}] 59 173..176 'opt': [{unknown}]
60 [177; 205) '{ ... }': () 60 177..205 '{ ... }': ()
61 [191; 192) 'h': {unknown} 61 191..192 'h': {unknown}
62 [195; 198) 'val': {unknown} 62 195..198 'val': {unknown}
63 [215; 221) 'lambda': |u64, u64, i32| -> i32 63 215..221 'lambda': |u64, u64, i32| -> i32
64 [224; 256) '|a: u6...b; c }': |u64, u64, i32| -> i32 64 224..256 '|a: u6...b; c }': |u64, u64, i32| -> i32
65 [225; 226) 'a': u64 65 225..226 'a': u64
66 [233; 234) 'b': u64 66 233..234 'b': u64
67 [236; 237) 'c': i32 67 236..237 'c': i32
68 [244; 256) '{ a + b; c }': i32 68 244..256 '{ a + b; c }': i32
69 [246; 247) 'a': u64 69 246..247 'a': u64
70 [246; 251) 'a + b': u64 70 246..251 'a + b': u64
71 [250; 251) 'b': u64 71 250..251 'b': u64
72 [253; 254) 'c': i32 72 253..254 'c': i32
73 [267; 279) 'ref ref_to_x': &&i32 73 267..279 'ref ref_to_x': &&i32
74 [282; 283) 'x': &i32 74 282..283 'x': &i32
75 [293; 302) 'mut mut_x': &i32 75 293..302 'mut mut_x': &i32
76 [305; 306) 'x': &i32 76 305..306 'x': &i32
77 [316; 336) 'ref mu...f_to_x': &mut &i32 77 316..336 'ref mu...f_to_x': &mut &i32
78 [339; 340) 'x': &i32 78 339..340 'x': &i32
79 [350; 351) 'k': &mut &i32 79 350..351 'k': &mut &i32
80 [354; 366) 'mut_ref_to_x': &mut &i32 80 354..366 'mut_ref_to_x': &mut &i32
81 "### 81 "###
82 ); 82 );
83} 83}
@@ -97,47 +97,47 @@ fn test(x: &i32) {
97} 97}
98"#, true), 98"#, true),
99 @r###" 99 @r###"
100 [18; 29) '{ loop {} }': T 100 18..29 '{ loop {} }': T
101 [20; 27) 'loop {}': ! 101 20..27 'loop {}': !
102 [25; 27) '{}': () 102 25..27 '{}': ()
103 [38; 39) 'x': &i32 103 38..39 'x': &i32
104 [47; 209) '{ ...) {} }': () 104 47..209 '{ ...) {} }': ()
105 [53; 76) 'if let...y() {}': () 105 53..76 'if let...y() {}': ()
106 [60; 65) '"foo"': &str 106 60..65 '"foo"': &str
107 [60; 65) '"foo"': &str 107 60..65 '"foo"': &str
108 [68; 71) 'any': fn any<&str>() -> &str 108 68..71 'any': fn any<&str>() -> &str
109 [68; 73) 'any()': &str 109 68..73 'any()': &str
110 [74; 76) '{}': () 110 74..76 '{}': ()
111 [81; 100) 'if let...y() {}': () 111 81..100 'if let...y() {}': ()
112 [88; 89) '1': i32 112 88..89 '1': i32
113 [88; 89) '1': i32 113 88..89 '1': i32
114 [92; 95) 'any': fn any<i32>() -> i32 114 92..95 'any': fn any<i32>() -> i32
115 [92; 97) 'any()': i32 115 92..97 'any()': i32
116 [98; 100) '{}': () 116 98..100 '{}': ()
117 [105; 127) 'if let...y() {}': () 117 105..127 'if let...y() {}': ()
118 [112; 116) '1u32': u32 118 112..116 '1u32': u32
119 [112; 116) '1u32': u32 119 112..116 '1u32': u32
120 [119; 122) 'any': fn any<u32>() -> u32 120 119..122 'any': fn any<u32>() -> u32
121 [119; 124) 'any()': u32 121 119..124 'any()': u32
122 [125; 127) '{}': () 122 125..127 '{}': ()
123 [132; 154) 'if let...y() {}': () 123 132..154 'if let...y() {}': ()
124 [139; 143) '1f32': f32 124 139..143 '1f32': f32
125 [139; 143) '1f32': f32 125 139..143 '1f32': f32
126 [146; 149) 'any': fn any<f32>() -> f32 126 146..149 'any': fn any<f32>() -> f32
127 [146; 151) 'any()': f32 127 146..151 'any()': f32
128 [152; 154) '{}': () 128 152..154 '{}': ()
129 [159; 180) 'if let...y() {}': () 129 159..180 'if let...y() {}': ()
130 [166; 169) '1.0': f64 130 166..169 '1.0': f64
131 [166; 169) '1.0': f64 131 166..169 '1.0': f64
132 [172; 175) 'any': fn any<f64>() -> f64 132 172..175 'any': fn any<f64>() -> f64
133 [172; 177) 'any()': f64 133 172..177 'any()': f64
134 [178; 180) '{}': () 134 178..180 '{}': ()
135 [185; 207) 'if let...y() {}': () 135 185..207 'if let...y() {}': ()
136 [192; 196) 'true': bool 136 192..196 'true': bool
137 [192; 196) 'true': bool 137 192..196 'true': bool
138 [199; 202) 'any': fn any<bool>() -> bool 138 199..202 'any': fn any<bool>() -> bool
139 [199; 204) 'any()': bool 139 199..204 'any()': bool
140 [205; 207) '{}': () 140 205..207 '{}': ()
141 "### 141 "###
142 ); 142 );
143} 143}
@@ -152,16 +152,16 @@ fn test(x: &i32) {
152} 152}
153"#, true), 153"#, true),
154 @r###" 154 @r###"
155 [9; 10) 'x': &i32 155 9..10 'x': &i32
156 [18; 76) '{ ...2 {} }': () 156 18..76 '{ ...2 {} }': ()
157 [24; 46) 'if let...u32 {}': () 157 24..46 'if let...u32 {}': ()
158 [31; 36) '1..76': u32 158 31..36 '1..76': u32
159 [39; 43) '2u32': u32 159 39..43 '2u32': u32
160 [44; 46) '{}': () 160 44..46 '{}': ()
161 [51; 74) 'if let...u32 {}': () 161 51..74 'if let...u32 {}': ()
162 [58; 64) '1..=76': u32 162 58..64 '1..=76': u32
163 [67; 71) '2u32': u32 163 67..71 '2u32': u32
164 [72; 74) '{}': () 164 72..74 '{}': ()
165 "### 165 "###
166 ); 166 );
167} 167}
@@ -178,19 +178,19 @@ fn test() {
178} 178}
179"#), 179"#),
180 @r###" 180 @r###"
181 [28; 79) '{ ...(1); }': () 181 28..79 '{ ...(1); }': ()
182 [38; 42) 'A(n)': A<i32> 182 38..42 'A(n)': A<i32>
183 [40; 41) 'n': &i32 183 40..41 'n': &i32
184 [45; 50) '&A(1)': &A<i32> 184 45..50 '&A(1)': &A<i32>
185 [46; 47) 'A': A<i32>(i32) -> A<i32> 185 46..47 'A': A<i32>(i32) -> A<i32>
186 [46; 50) 'A(1)': A<i32> 186 46..50 'A(1)': A<i32>
187 [48; 49) '1': i32 187 48..49 '1': i32
188 [60; 64) 'A(n)': A<i32> 188 60..64 'A(n)': A<i32>
189 [62; 63) 'n': &mut i32 189 62..63 'n': &mut i32
190 [67; 76) '&mut A(1)': &mut A<i32> 190 67..76 '&mut A(1)': &mut A<i32>
191 [72; 73) 'A': A<i32>(i32) -> A<i32> 191 72..73 'A': A<i32>(i32) -> A<i32>
192 [72; 76) 'A(1)': A<i32> 192 72..76 'A(1)': A<i32>
193 [74; 75) '1': i32 193 74..75 '1': i32
194 "### 194 "###
195 ); 195 );
196} 196}
@@ -206,18 +206,18 @@ fn test() {
206} 206}
207"#), 207"#),
208 @r###" 208 @r###"
209 [11; 57) '{ ...= v; }': () 209 11..57 '{ ...= v; }': ()
210 [21; 22) 'v': &(i32, &i32) 210 21..22 'v': &(i32, &i32)
211 [25; 33) '&(1, &2)': &(i32, &i32) 211 25..33 '&(1, &2)': &(i32, &i32)
212 [26; 33) '(1, &2)': (i32, &i32) 212 26..33 '(1, &2)': (i32, &i32)
213 [27; 28) '1': i32 213 27..28 '1': i32
214 [30; 32) '&2': &i32 214 30..32 '&2': &i32
215 [31; 32) '2': i32 215 31..32 '2': i32
216 [43; 50) '(_, &w)': (i32, &i32) 216 43..50 '(_, &w)': (i32, &i32)
217 [44; 45) '_': i32 217 44..45 '_': i32
218 [47; 49) '&w': &i32 218 47..49 '&w': &i32
219 [48; 49) 'w': i32 219 48..49 'w': i32
220 [53; 54) 'v': &(i32, &i32) 220 53..54 'v': &(i32, &i32)
221 "### 221 "###
222 ); 222 );
223} 223}
@@ -242,30 +242,30 @@ fn test() {
242} 242}
243"#), 243"#),
244 @r###" 244 @r###"
245 [11; 210) '{ ... } }': () 245 11..210 '{ ... } }': ()
246 [21; 26) 'slice': &[f64] 246 21..26 'slice': &[f64]
247 [37; 43) '&[0.0]': &[f64; _] 247 37..43 '&[0.0]': &[f64; _]
248 [38; 43) '[0.0]': [f64; _] 248 38..43 '[0.0]': [f64; _]
249 [39; 42) '0.0': f64 249 39..42 '0.0': f64
250 [49; 208) 'match ... }': () 250 49..208 'match ... }': ()
251 [55; 60) 'slice': &[f64] 251 55..60 'slice': &[f64]
252 [71; 74) '&[]': &[f64] 252 71..74 '&[]': &[f64]
253 [72; 74) '[]': [f64] 253 72..74 '[]': [f64]
254 [78; 80) '{}': () 254 78..80 '{}': ()
255 [90; 94) '&[a]': &[f64] 255 90..94 '&[a]': &[f64]
256 [91; 94) '[a]': [f64] 256 91..94 '[a]': [f64]
257 [92; 93) 'a': f64 257 92..93 'a': f64
258 [98; 124) '{ ... }': () 258 98..124 '{ ... }': ()
259 [112; 113) 'a': f64 259 112..113 'a': f64
260 [134; 141) '&[b, c]': &[f64] 260 134..141 '&[b, c]': &[f64]
261 [135; 141) '[b, c]': [f64] 261 135..141 '[b, c]': [f64]
262 [136; 137) 'b': f64 262 136..137 'b': f64
263 [139; 140) 'c': f64 263 139..140 'c': f64
264 [145; 186) '{ ... }': () 264 145..186 '{ ... }': ()
265 [159; 160) 'b': f64 265 159..160 'b': f64
266 [174; 175) 'c': f64 266 174..175 'c': f64
267 [195; 196) '_': &[f64] 267 195..196 '_': &[f64]
268 [200; 202) '{}': () 268 200..202 '{}': ()
269 "### 269 "###
270 ); 270 );
271} 271}
@@ -288,25 +288,25 @@ fn test() {
288} 288}
289"#), 289"#),
290 @r###" 290 @r###"
291 [11; 180) '{ ... } }': () 291 11..180 '{ ... } }': ()
292 [21; 24) 'arr': [f64; _] 292 21..24 'arr': [f64; _]
293 [37; 47) '[0.0, 1.0]': [f64; _] 293 37..47 '[0.0, 1.0]': [f64; _]
294 [38; 41) '0.0': f64 294 38..41 '0.0': f64
295 [43; 46) '1.0': f64 295 43..46 '1.0': f64
296 [53; 178) 'match ... }': () 296 53..178 'match ... }': ()
297 [59; 62) 'arr': [f64; _] 297 59..62 'arr': [f64; _]
298 [73; 81) '[1.0, a]': [f64; _] 298 73..81 '[1.0, a]': [f64; _]
299 [74; 77) '1.0': f64 299 74..77 '1.0': f64
300 [74; 77) '1.0': f64 300 74..77 '1.0': f64
301 [79; 80) 'a': f64 301 79..80 'a': f64
302 [85; 111) '{ ... }': () 302 85..111 '{ ... }': ()
303 [99; 100) 'a': f64 303 99..100 'a': f64
304 [121; 127) '[b, c]': [f64; _] 304 121..127 '[b, c]': [f64; _]
305 [122; 123) 'b': f64 305 122..123 'b': f64
306 [125; 126) 'c': f64 306 125..126 'c': f64
307 [131; 172) '{ ... }': () 307 131..172 '{ ... }': ()
308 [145; 146) 'b': f64 308 145..146 'b': f64
309 [160; 161) 'c': f64 309 160..161 'c': f64
310 "### 310 "###
311 ); 311 );
312} 312}
@@ -339,31 +339,31 @@ fn test() {
339} 339}
340"#), 340"#),
341 @r###" 341 @r###"
342 [68; 289) '{ ... d; }': () 342 68..289 '{ ... d; }': ()
343 [78; 79) 'e': E 343 78..79 'e': E
344 [82; 95) 'E::A { x: 3 }': E 344 82..95 'E::A { x: 3 }': E
345 [92; 93) '3': usize 345 92..93 '3': usize
346 [106; 113) 'S(y, z)': S 346 106..113 'S(y, z)': S
347 [108; 109) 'y': u32 347 108..109 'y': u32
348 [111; 112) 'z': E 348 111..112 'z': E
349 [116; 119) 'foo': S 349 116..119 'foo': S
350 [129; 148) 'E::A {..._var }': E 350 129..148 'E::A {..._var }': E
351 [139; 146) 'new_var': usize 351 139..146 'new_var': usize
352 [151; 152) 'e': E 352 151..152 'e': E
353 [159; 245) 'match ... }': usize 353 159..245 'match ... }': usize
354 [165; 166) 'e': E 354 165..166 'e': E
355 [177; 187) 'E::A { x }': E 355 177..187 'E::A { x }': E
356 [184; 185) 'x': usize 356 184..185 'x': usize
357 [191; 192) 'x': usize 357 191..192 'x': usize
358 [202; 206) 'E::B': E 358 202..206 'E::B': E
359 [210; 213) 'foo': bool 359 210..213 'foo': bool
360 [217; 218) '1': usize 360 217..218 '1': usize
361 [228; 232) 'E::B': E 361 228..232 'E::B': E
362 [236; 238) '10': usize 362 236..238 '10': usize
363 [256; 275) 'ref d ...{ .. }': &E 363 256..275 'ref d ...{ .. }': &E
364 [264; 275) 'E::A { .. }': E 364 264..275 'E::A { .. }': E
365 [278; 279) 'e': E 365 278..279 'e': E
366 [285; 286) 'd': &E 366 285..286 'd': &E
367 "### 367 "###
368 ); 368 );
369} 369}
@@ -391,23 +391,23 @@ fn test(a1: A<u32>, o: Option<u64>) {
391} 391}
392"#), 392"#),
393 @r###" 393 @r###"
394 [79; 81) 'a1': A<u32> 394 79..81 'a1': A<u32>
395 [91; 92) 'o': Option<u64> 395 91..92 'o': Option<u64>
396 [107; 244) '{ ... }; }': () 396 107..244 '{ ... }; }': ()
397 [117; 128) 'A { x: x2 }': A<u32> 397 117..128 'A { x: x2 }': A<u32>
398 [124; 126) 'x2': u32 398 124..126 'x2': u32
399 [131; 133) 'a1': A<u32> 399 131..133 'a1': A<u32>
400 [143; 161) 'A::<i6...: x3 }': A<i64> 400 143..161 'A::<i6...: x3 }': A<i64>
401 [157; 159) 'x3': i64 401 157..159 'x3': i64
402 [164; 174) 'A { x: 1 }': A<i64> 402 164..174 'A { x: 1 }': A<i64>
403 [171; 172) '1': i64 403 171..172 '1': i64
404 [180; 241) 'match ... }': u64 404 180..241 'match ... }': u64
405 [186; 187) 'o': Option<u64> 405 186..187 'o': Option<u64>
406 [198; 213) 'Option::Some(t)': Option<u64> 406 198..213 'Option::Some(t)': Option<u64>
407 [211; 212) 't': u64 407 211..212 't': u64
408 [217; 218) 't': u64 408 217..218 't': u64
409 [228; 229) '_': Option<u64> 409 228..229 '_': Option<u64>
410 [233; 234) '1': u64 410 233..234 '1': u64
411 "### 411 "###
412 ); 412 );
413} 413}
@@ -431,27 +431,27 @@ fn test() {
431} 431}
432"#, true), 432"#, true),
433 @r###" 433 @r###"
434 [74; 75) '1': usize 434 74..75 '1': usize
435 [88; 310) '{ ...atch }': () 435 88..310 '{ ...atch }': ()
436 [98; 99) 'a': Option<u32> 436 98..99 'a': Option<u32>
437 [115; 119) 'None': Option<u32> 437 115..119 'None': Option<u32>
438 [129; 130) 'b': Option<i64> 438 129..130 'b': Option<i64>
439 [146; 183) 'match ... }': Option<i64> 439 146..183 'match ... }': Option<i64>
440 [152; 153) 'a': Option<u32> 440 152..153 'a': Option<u32>
441 [164; 168) 'None': Option<u32> 441 164..168 'None': Option<u32>
442 [172; 176) 'None': Option<i64> 442 172..176 'None': Option<i64>
443 [193; 194) '_': () 443 193..194 '_': ()
444 [201; 224) 'match ... Foo }': Foo 444 201..224 'match ... Foo }': Foo
445 [207; 209) '()': () 445 207..209 '()': ()
446 [212; 215) 'Foo': Foo 446 212..215 'Foo': Foo
447 [219; 222) 'Foo': Foo 447 219..222 'Foo': Foo
448 [255; 256) '_': () 448 255..256 '_': ()
449 [263; 286) 'match ... Bar }': usize 449 263..286 'match ... Bar }': usize
450 [269; 271) '()': () 450 269..271 '()': ()
451 [274; 277) 'Bar': usize 451 274..277 'Bar': usize
452 [281; 284) 'Bar': usize 452 281..284 'Bar': usize
453 [201; 224): expected (), got Foo 453 201..224: expected (), got Foo
454 [263; 286): expected (), got usize 454 263..286: expected (), got usize
455 "### 455 "###
456 ); 456 );
457} 457}
@@ -469,15 +469,15 @@ fn main() {
469 } 469 }
470} 470}
471 "#), @" 471 "#), @"
472 [28; 32) 'self': &S 472 28..32 'self': &S
473 [42; 51) '{ false }': bool 473 42..51 '{ false }': bool
474 [44; 49) 'false': bool 474 44..49 'false': bool
475 [65; 116) '{ ... } }': () 475 65..116 '{ ... } }': ()
476 [71; 114) 'match ... }': () 476 71..114 'match ... }': ()
477 [77; 78) 'S': S 477 77..78 'S': S
478 [89; 90) 's': S 478 89..90 's': S
479 [94; 95) 's': S 479 94..95 's': S
480 [94; 101) 's.foo()': bool 480 94..101 's.foo()': bool
481 [105; 107) '()': () 481 105..107 '()': ()
482 ") 482 ")
483} 483}
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/ra_hir_ty/src/tests/regression.rs
index 61a6801fc..8a1292c7a 100644
--- a/crates/ra_hir_ty/src/tests/regression.rs
+++ b/crates/ra_hir_ty/src/tests/regression.rs
@@ -14,11 +14,11 @@ fn test() {
14} 14}
15"#), 15"#),
16 @r###" 16 @r###"
17 [11; 37) '{ l... {}; }': () 17 11..37 '{ l... {}; }': ()
18 [20; 21) 'x': () 18 20..21 'x': ()
19 [24; 34) 'if true {}': () 19 24..34 'if true {}': ()
20 [27; 31) 'true': bool 20 27..31 'true': bool
21 [32; 34) '{}': () 21 32..34 '{}': ()
22 "### 22 "###
23 ); 23 );
24} 24}
@@ -34,10 +34,10 @@ fn test(x: X) {
34} 34}
35"#), 35"#),
36 @r###" 36 @r###"
37 [20; 21) 'x': X 37 20..21 'x': X
38 [26; 47) '{ ...eld; }': () 38 26..47 '{ ...eld; }': ()
39 [32; 33) 'x': X 39 32..33 'x': X
40 [32; 44) 'x.some_field': {unknown} 40 32..44 'x.some_field': {unknown}
41 "### 41 "###
42 ); 42 );
43} 43}
@@ -55,14 +55,14 @@ fn test() {
55} 55}
56"#), 56"#),
57 @r###" 57 @r###"
58 [11; 89) '{ ... } }': () 58 11..89 '{ ... } }': ()
59 [17; 21) 'X {}': {unknown} 59 17..21 'X {}': {unknown}
60 [27; 87) 'match ... }': () 60 27..87 'match ... }': ()
61 [33; 34) 'x': {unknown} 61 33..34 'x': {unknown}
62 [45; 52) 'A::B {}': {unknown} 62 45..52 'A::B {}': {unknown}
63 [56; 58) '()': () 63 56..58 '()': ()
64 [68; 74) 'A::Y()': {unknown} 64 68..74 'A::Y()': {unknown}
65 [78; 80) '()': () 65 78..80 '()': ()
66 "### 66 "###
67 ); 67 );
68} 68}
@@ -77,12 +77,12 @@ fn quux() {
77} 77}
78"#), 78"#),
79 @r###" 79 @r###"
80 [11; 41) '{ ...+ y; }': () 80 11..41 '{ ...+ y; }': ()
81 [21; 22) 'y': i32 81 21..22 'y': i32
82 [25; 27) '92': i32 82 25..27 '92': i32
83 [33; 34) '1': i32 83 33..34 '1': i32
84 [33; 38) '1 + y': i32 84 33..38 '1 + y': i32
85 [37; 38) 'y': i32 85 37..38 'y': i32
86 "### 86 "###
87 ); 87 );
88} 88}
@@ -99,13 +99,13 @@ fn test() {
99} 99}
100"#), 100"#),
101 @r###" 101 @r###"
102 [11; 48) '{ ...&y]; }': () 102 11..48 '{ ...&y]; }': ()
103 [21; 22) 'y': &{unknown} 103 21..22 'y': &{unknown}
104 [25; 32) 'unknown': &{unknown} 104 25..32 'unknown': &{unknown}
105 [38; 45) '[y, &y]': [&&{unknown}; _] 105 38..45 '[y, &y]': [&&{unknown}; _]
106 [39; 40) 'y': &{unknown} 106 39..40 'y': &{unknown}
107 [42; 44) '&y': &&{unknown} 107 42..44 '&y': &&{unknown}
108 [43; 44) 'y': &{unknown} 108 43..44 'y': &{unknown}
109 "### 109 "###
110 ); 110 );
111} 111}
@@ -123,20 +123,20 @@ fn test() {
123} 123}
124"#), 124"#),
125 @r###" 125 @r###"
126 [11; 80) '{ ...x)]; }': () 126 11..80 '{ ...x)]; }': ()
127 [21; 22) 'x': &&{unknown} 127 21..22 'x': &&{unknown}
128 [25; 32) 'unknown': &&{unknown} 128 25..32 'unknown': &&{unknown}
129 [42; 43) 'y': &&{unknown} 129 42..43 'y': &&{unknown}
130 [46; 53) 'unknown': &&{unknown} 130 46..53 'unknown': &&{unknown}
131 [59; 77) '[(x, y..., &x)]': [(&&&{unknown}, &&&{unknown}); _] 131 59..77 '[(x, y..., &x)]': [(&&&{unknown}, &&&{unknown}); _]
132 [60; 66) '(x, y)': (&&&{unknown}, &&&{unknown}) 132 60..66 '(x, y)': (&&&{unknown}, &&&{unknown})
133 [61; 62) 'x': &&{unknown} 133 61..62 'x': &&{unknown}
134 [64; 65) 'y': &&{unknown} 134 64..65 'y': &&{unknown}
135 [68; 76) '(&y, &x)': (&&&{unknown}, &&&{unknown}) 135 68..76 '(&y, &x)': (&&&{unknown}, &&&{unknown})
136 [69; 71) '&y': &&&{unknown} 136 69..71 '&y': &&&{unknown}
137 [70; 71) 'y': &&{unknown} 137 70..71 'y': &&{unknown}
138 [73; 75) '&x': &&&{unknown} 138 73..75 '&x': &&&{unknown}
139 [74; 75) 'x': &&{unknown} 139 74..75 'x': &&{unknown}
140 "### 140 "###
141 ); 141 );
142} 142}
@@ -158,12 +158,12 @@ fn write() {
158} 158}
159"#), 159"#),
160 @r###" 160 @r###"
161 [54; 139) '{ ... } }': () 161 54..139 '{ ... } }': ()
162 [60; 137) 'match ... }': () 162 60..137 'match ... }': ()
163 [66; 83) 'someth...nknown': Maybe<{unknown}> 163 66..83 'someth...nknown': Maybe<{unknown}>
164 [94; 124) 'Maybe:...thing)': Maybe<{unknown}> 164 94..124 'Maybe:...thing)': Maybe<{unknown}>
165 [106; 123) 'ref mu...ething': &mut {unknown} 165 106..123 'ref mu...ething': &mut {unknown}
166 [128; 130) '()': () 166 128..130 '()': ()
167 "### 167 "###
168 ); 168 );
169} 169}
@@ -179,13 +179,13 @@ fn test_line_buffer() {
179} 179}
180"#), 180"#),
181 @r###" 181 @r###"
182 [23; 53) '{ ...n']; }': () 182 23..53 '{ ...n']; }': ()
183 [29; 50) '&[0, b...b'\n']': &[u8; _] 183 29..50 '&[0, b...b'\n']': &[u8; _]
184 [30; 50) '[0, b'...b'\n']': [u8; _] 184 30..50 '[0, b'...b'\n']': [u8; _]
185 [31; 32) '0': u8 185 31..32 '0': u8
186 [34; 39) 'b'\n'': u8 186 34..39 'b'\n'': u8
187 [41; 42) '1': u8 187 41..42 '1': u8
188 [44; 49) 'b'\n'': u8 188 44..49 'b'\n'': u8
189 "### 189 "###
190 ); 190 );
191} 191}
@@ -202,14 +202,14 @@ pub fn compute() {
202} 202}
203"#), 203"#),
204 @r###" 204 @r###"
205 [18; 108) '{ ... } }': () 205 18..108 '{ ... } }': ()
206 [24; 106) 'match ... }': () 206 24..106 'match ... }': ()
207 [30; 37) 'nope!()': {unknown} 207 30..37 'nope!()': {unknown}
208 [48; 94) 'SizeSk...tail }': {unknown} 208 48..94 'SizeSk...tail }': {unknown}
209 [82; 86) 'true': bool 209 82..86 'true': bool
210 [82; 86) 'true': bool 210 82..86 'true': bool
211 [88; 92) 'tail': {unknown} 211 88..92 'tail': {unknown}
212 [98; 100) '{}': () 212 98..100 '{}': ()
213 "### 213 "###
214 ); 214 );
215} 215}
@@ -226,14 +226,14 @@ pub fn primitive_type() {
226} 226}
227"#), 227"#),
228 @r###" 228 @r###"
229 [25; 106) '{ ... } }': () 229 25..106 '{ ... } }': ()
230 [31; 104) 'match ... }': () 230 31..104 'match ... }': ()
231 [37; 42) '*self': {unknown} 231 37..42 '*self': {unknown}
232 [38; 42) 'self': {unknown} 232 38..42 'self': {unknown}
233 [53; 91) 'Borrow...), ..}': {unknown} 233 53..91 'Borrow...), ..}': {unknown}
234 [74; 86) 'Primitive(p)': {unknown} 234 74..86 'Primitive(p)': {unknown}
235 [84; 85) 'p': {unknown} 235 84..85 'p': {unknown}
236 [95; 97) '{}': () 236 95..97 '{}': ()
237 "### 237 "###
238 ); 238 );
239} 239}
@@ -260,29 +260,29 @@ fn extra_compiler_flags() {
260} 260}
261"#), 261"#),
262 @r###" 262 @r###"
263 [27; 323) '{ ... } }': () 263 27..323 '{ ... } }': ()
264 [33; 321) 'for co... }': () 264 33..321 'for co... }': ()
265 [37; 44) 'content': &{unknown} 265 37..44 'content': &{unknown}
266 [48; 61) 'doesnt_matter': {unknown} 266 48..61 'doesnt_matter': {unknown}
267 [62; 321) '{ ... }': () 267 62..321 '{ ... }': ()
268 [76; 80) 'name': &&{unknown} 268 76..80 'name': &&{unknown}
269 [83; 167) 'if doe... }': &&{unknown} 269 83..167 'if doe... }': &&{unknown}
270 [86; 99) 'doesnt_matter': bool 270 86..99 'doesnt_matter': bool
271 [100; 129) '{ ... }': &&{unknown} 271 100..129 '{ ... }': &&{unknown}
272 [114; 119) 'first': &&{unknown} 272 114..119 'first': &&{unknown}
273 [135; 167) '{ ... }': &&{unknown} 273 135..167 '{ ... }': &&{unknown}
274 [149; 157) '&content': &&{unknown} 274 149..157 '&content': &&{unknown}
275 [150; 157) 'content': &{unknown} 275 150..157 'content': &{unknown}
276 [182; 189) 'content': &{unknown} 276 182..189 'content': &{unknown}
277 [192; 314) 'if ICE... }': &{unknown} 277 192..314 'if ICE... }': &{unknown}
278 [195; 232) 'ICE_RE..._VALUE': {unknown} 278 195..232 'ICE_RE..._VALUE': {unknown}
279 [195; 248) 'ICE_RE...&name)': bool 279 195..248 'ICE_RE...&name)': bool
280 [242; 247) '&name': &&&{unknown} 280 242..247 '&name': &&&{unknown}
281 [243; 247) 'name': &&{unknown} 281 243..247 'name': &&{unknown}
282 [249; 277) '{ ... }': &&{unknown} 282 249..277 '{ ... }': &&{unknown}
283 [263; 267) 'name': &&{unknown} 283 263..267 'name': &&{unknown}
284 [283; 314) '{ ... }': &{unknown} 284 283..314 '{ ... }': &{unknown}
285 [297; 304) 'content': &{unknown} 285 297..304 'content': &{unknown}
286 "### 286 "###
287 ); 287 );
288} 288}
@@ -303,11 +303,11 @@ fn test<R>(query_response: Canonical<QueryResponse<R>>) {
303} 303}
304"#), 304"#),
305 @r###" 305 @r###"
306 [92; 106) 'query_response': Canonical<QueryResponse<R>> 306 92..106 'query_response': Canonical<QueryResponse<R>>
307 [137; 167) '{ ...lue; }': () 307 137..167 '{ ...lue; }': ()
308 [143; 164) '&query....value': &QueryResponse<R> 308 143..164 '&query....value': &QueryResponse<R>
309 [144; 158) 'query_response': Canonical<QueryResponse<R>> 309 144..158 'query_response': Canonical<QueryResponse<R>>
310 [144; 164) 'query_....value': QueryResponse<R> 310 144..164 'query_....value': QueryResponse<R>
311 "### 311 "###
312 ); 312 );
313} 313}
@@ -322,9 +322,9 @@ fn test() {
322} 322}
323"#), 323"#),
324 @r###" 324 @r###"
325 ![0; 4) '0u32': u32 325 !0..4 '0u32': u32
326 [45; 70) '{ ...()); }': () 326 45..70 '{ ...()); }': ()
327 [55; 56) 'a': u32 327 55..56 'a': u32
328 "### 328 "###
329 ); 329 );
330} 330}
@@ -345,10 +345,10 @@ pub fn main_loop() {
345} 345}
346"#), 346"#),
347 @r###" 347 @r###"
348 [144; 146) '{}': () 348 144..146 '{}': ()
349 [169; 198) '{ ...t(); }': () 349 169..198 '{ ...t(); }': ()
350 [175; 193) 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<{unknown}, FxHasher> 350 175..193 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<{unknown}, FxHasher>
351 [175; 195) 'FxHash...ault()': HashSet<{unknown}, FxHasher> 351 175..195 'FxHash...ault()': HashSet<{unknown}, FxHasher>
352 "### 352 "###
353 ); 353 );
354} 354}
@@ -375,13 +375,13 @@ fn issue_2669() {
375 }"# 375 }"#
376 ), 376 ),
377 @r###" 377 @r###"
378 [147; 262) '{ ... }': () 378 147..262 '{ ... }': ()
379 [161; 164) 'end': fn end<{unknown}>() 379 161..164 'end': fn end<{unknown}>()
380 [161; 166) 'end()': () 380 161..166 'end()': ()
381 [199; 252) '{ ... }': () 381 199..252 '{ ... }': ()
382 [221; 223) '_x': ! 382 221..223 '_x': !
383 [230; 237) 'loop {}': ! 383 230..237 'loop {}': !
384 [235; 237) '{}': () 384 235..237 '{}': ()
385 "### 385 "###
386 ) 386 )
387} 387}
@@ -396,9 +396,9 @@ fn test() {
396} 396}
397"#), 397"#),
398 @r###" 398 @r###"
399 [26; 53) '{ ...oo() }': () 399 26..53 '{ ...oo() }': ()
400 [32; 49) '<Trait...>::foo': {unknown} 400 32..49 '<Trait...>::foo': {unknown}
401 [32; 51) '<Trait...:foo()': () 401 32..51 '<Trait...:foo()': ()
402 "### 402 "###
403 ); 403 );
404} 404}
@@ -496,13 +496,13 @@ fn foo(params: &[usize]) {
496} 496}
497"#), 497"#),
498 @r###" 498 @r###"
499 [8; 14) 'params': &[usize] 499 8..14 'params': &[usize]
500 [26; 81) '{ ... } }': () 500 26..81 '{ ... } }': ()
501 [32; 79) 'match ... }': () 501 32..79 'match ... }': ()
502 [38; 44) 'params': &[usize] 502 38..44 'params': &[usize]
503 [55; 67) '[ps @ .., _]': [usize] 503 55..67 '[ps @ .., _]': [usize]
504 [65; 66) '_': usize 504 65..66 '_': usize
505 [71; 73) '{}': () 505 71..73 '{}': ()
506 "### 506 "###
507 ); 507 );
508} 508}
@@ -523,13 +523,13 @@ fn foo(b: Bar) {
523} 523}
524"#), 524"#),
525 @r###" 525 @r###"
526 [36; 37) 'b': Bar 526 36..37 'b': Bar
527 [44; 96) '{ ... } }': () 527 44..96 '{ ... } }': ()
528 [50; 94) 'match ... }': () 528 50..94 'match ... }': ()
529 [56; 57) 'b': Bar 529 56..57 'b': Bar
530 [68; 81) 'Bar { a: .. }': Bar 530 68..81 'Bar { a: .. }': Bar
531 [77; 79) '..': bool 531 77..79 '..': bool
532 [85; 87) '{}': () 532 85..87 '{}': ()
533 "### 533 "###
534 ); 534 );
535} 535}
@@ -564,13 +564,13 @@ where
564} 564}
565"#), 565"#),
566 @r###" 566 @r###"
567 [66; 70) 'self': Self 567 66..70 'self': Self
568 [268; 272) 'self': Self 568 268..272 'self': Self
569 [467; 471) 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}> 569 467..471 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
570 [489; 523) '{ ... }': () 570 489..523 '{ ... }': ()
571 [499; 503) 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}> 571 499..503 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
572 [499; 509) 'self.order': O 572 499..509 'self.order': O
573 [499; 516) 'self.o...into()': dyn QueryFragment<DB> 573 499..516 'self.o...into()': dyn QueryFragment<DB>
574 "### 574 "###
575 ); 575 );
576} 576}
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs
index c2f1ded2f..56abc65b8 100644
--- a/crates/ra_hir_ty/src/tests/simple.rs
+++ b/crates/ra_hir_ty/src/tests/simple.rs
@@ -64,9 +64,9 @@ impl S<u32> {
64} 64}
65"#, 65"#,
66 ), @r###" 66 ), @r###"
67 [63; 93) '{ ... }': () 67 63..93 '{ ... }': ()
68 [73; 86) 'Self { x: 1 }': S<u32> 68 73..86 'Self { x: 1 }': S<u32>
69 [83; 84) '1': u32 69 83..84 '1': u32
70 "###); 70 "###);
71} 71}
72 72
@@ -85,9 +85,9 @@ fn foo() {
85 85
86"#, 86"#,
87 ), @r###" 87 ), @r###"
88 [64; 84) '{ ...1 }; }': () 88 64..84 '{ ...1 }; }': ()
89 [70; 81) 'SS { x: 1 }': S<u32> 89 70..81 'SS { x: 1 }': S<u32>
90 [78; 79) '1': u32 90 78..79 '1': u32
91 "###); 91 "###);
92} 92}
93 93
@@ -175,19 +175,19 @@ fn test(a: u32, b: isize, c: !, d: &str) {
175 1.0f32; 175 1.0f32;
176}"#), 176}"#),
177 @r###" 177 @r###"
178 [9; 10) 'a': u32 178 9..10 'a': u32
179 [17; 18) 'b': isize 179 17..18 'b': isize
180 [27; 28) 'c': ! 180 27..28 'c': !
181 [33; 34) 'd': &str 181 33..34 'd': &str
182 [42; 121) '{ ...f32; }': ! 182 42..121 '{ ...f32; }': !
183 [48; 49) 'a': u32 183 48..49 'a': u32
184 [55; 56) 'b': isize 184 55..56 'b': isize
185 [62; 63) 'c': ! 185 62..63 'c': !
186 [69; 70) 'd': &str 186 69..70 'd': &str
187 [76; 82) '1usize': usize 187 76..82 '1usize': usize
188 [88; 94) '1isize': isize 188 88..94 '1isize': isize
189 [100; 106) '"test"': &str 189 100..106 '"test"': &str
190 [112; 118) '1.0f32': f32 190 112..118 '1.0f32': f32
191 "### 191 "###
192 ); 192 );
193} 193}
@@ -206,17 +206,17 @@ fn test() {
206} 206}
207"#), 207"#),
208 @r###" 208 @r###"
209 [11; 118) '{ ...= e; }': () 209 11..118 '{ ...= e; }': ()
210 [21; 22) 'a': isize 210 21..22 'a': isize
211 [25; 31) '1isize': isize 211 25..31 '1isize': isize
212 [41; 42) 'b': usize 212 41..42 'b': usize
213 [52; 53) '1': usize 213 52..53 '1': usize
214 [63; 64) 'c': usize 214 63..64 'c': usize
215 [67; 68) 'b': usize 215 67..68 'b': usize
216 [78; 79) 'd': u32 216 78..79 'd': u32
217 [94; 95) 'e': i32 217 94..95 'e': i32
218 [105; 106) 'f': i32 218 105..106 'f': i32
219 [114; 115) 'e': i32 219 114..115 'e': i32
220 "### 220 "###
221 ); 221 );
222} 222}
@@ -237,15 +237,15 @@ fn test() {
237} 237}
238"#), 238"#),
239 @r###" 239 @r###"
240 [15; 20) '{ 1 }': u32 240 15..20 '{ 1 }': u32
241 [17; 18) '1': u32 241 17..18 '1': u32
242 [48; 53) '{ 1 }': u32 242 48..53 '{ 1 }': u32
243 [50; 51) '1': u32 243 50..51 '1': u32
244 [67; 91) '{ ...c(); }': () 244 67..91 '{ ...c(); }': ()
245 [73; 74) 'a': fn a() -> u32 245 73..74 'a': fn a() -> u32
246 [73; 76) 'a()': u32 246 73..76 'a()': u32
247 [82; 86) 'b::c': fn c() -> u32 247 82..86 'b::c': fn c() -> u32
248 [82; 88) 'b::c()': u32 248 82..88 'b::c()': u32
249 "### 249 "###
250 ); 250 );
251} 251}
@@ -266,13 +266,13 @@ fn test() {
266} 266}
267"#), 267"#),
268 @r###" 268 @r###"
269 [41; 46) '{ 1 }': i32 269 41..46 '{ 1 }': i32
270 [43; 44) '1': i32 270 43..44 '1': i32
271 [60; 93) '{ ...o(); }': () 271 60..93 '{ ...o(); }': ()
272 [66; 72) 'S::foo': fn foo() -> i32 272 66..72 'S::foo': fn foo() -> i32
273 [66; 74) 'S::foo()': i32 273 66..74 'S::foo()': i32
274 [80; 88) '<S>::foo': fn foo() -> i32 274 80..88 '<S>::foo': fn foo() -> i32
275 [80; 90) '<S>::foo()': i32 275 80..90 '<S>::foo()': i32
276 "### 276 "###
277 ); 277 );
278} 278}
@@ -297,22 +297,22 @@ fn test() {
297} 297}
298"#), 298"#),
299 @r###" 299 @r###"
300 [72; 154) '{ ...a.c; }': () 300 72..154 '{ ...a.c; }': ()
301 [82; 83) 'c': C 301 82..83 'c': C
302 [86; 87) 'C': C(usize) -> C 302 86..87 'C': C(usize) -> C
303 [86; 90) 'C(1)': C 303 86..90 'C(1)': C
304 [88; 89) '1': usize 304 88..89 '1': usize
305 [96; 97) 'B': B 305 96..97 'B': B
306 [107; 108) 'a': A 306 107..108 'a': A
307 [114; 133) 'A { b:...C(1) }': A 307 114..133 'A { b:...C(1) }': A
308 [121; 122) 'B': B 308 121..122 'B': B
309 [127; 128) 'C': C(usize) -> C 309 127..128 'C': C(usize) -> C
310 [127; 131) 'C(1)': C 310 127..131 'C(1)': C
311 [129; 130) '1': usize 311 129..130 '1': usize
312 [139; 140) 'a': A 312 139..140 'a': A
313 [139; 142) 'a.b': B 313 139..142 'a.b': B
314 [148; 149) 'a': A 314 148..149 'a': A
315 [148; 151) 'a.c': C 315 148..151 'a.c': C
316 "### 316 "###
317 ); 317 );
318} 318}
@@ -330,10 +330,10 @@ fn test() {
330 E::V2; 330 E::V2;
331}"#), 331}"#),
332 @r###" 332 @r###"
333 [48; 82) '{ E:...:V2; }': () 333 48..82 '{ E:...:V2; }': ()
334 [52; 70) 'E::V1 ...d: 1 }': E 334 52..70 'E::V1 ...d: 1 }': E
335 [67; 68) '1': u32 335 67..68 '1': u32
336 [74; 79) 'E::V2': E 336 74..79 'E::V2': E
337 "### 337 "###
338 ); 338 );
339} 339}
@@ -357,29 +357,29 @@ fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) {
357} 357}
358"#), 358"#),
359 @r###" 359 @r###"
360 [9; 10) 'a': &u32 360 9..10 'a': &u32
361 [18; 19) 'b': &mut u32 361 18..19 'b': &mut u32
362 [31; 32) 'c': *const u32 362 31..32 'c': *const u32
363 [46; 47) 'd': *mut u32 363 46..47 'd': *mut u32
364 [59; 150) '{ ... *d; }': () 364 59..150 '{ ... *d; }': ()
365 [65; 66) 'a': &u32 365 65..66 'a': &u32
366 [72; 74) '*a': u32 366 72..74 '*a': u32
367 [73; 74) 'a': &u32 367 73..74 'a': &u32
368 [80; 82) '&a': &&u32 368 80..82 '&a': &&u32
369 [81; 82) 'a': &u32 369 81..82 'a': &u32
370 [88; 94) '&mut a': &mut &u32 370 88..94 '&mut a': &mut &u32
371 [93; 94) 'a': &u32 371 93..94 'a': &u32
372 [100; 101) 'b': &mut u32 372 100..101 'b': &mut u32
373 [107; 109) '*b': u32 373 107..109 '*b': u32
374 [108; 109) 'b': &mut u32 374 108..109 'b': &mut u32
375 [115; 117) '&b': &&mut u32 375 115..117 '&b': &&mut u32
376 [116; 117) 'b': &mut u32 376 116..117 'b': &mut u32
377 [123; 124) 'c': *const u32 377 123..124 'c': *const u32
378 [130; 132) '*c': u32 378 130..132 '*c': u32
379 [131; 132) 'c': *const u32 379 131..132 'c': *const u32
380 [138; 139) 'd': *mut u32 380 138..139 'd': *mut u32
381 [145; 147) '*d': u32 381 145..147 '*d': u32
382 [146; 147) 'd': *mut u32 382 146..147 'd': *mut u32
383 "### 383 "###
384 ); 384 );
385} 385}
@@ -409,20 +409,20 @@ fn test() {
409} 409}
410"##), 410"##),
411 @r###" 411 @r###"
412 [11; 221) '{ ...o"#; }': () 412 11..221 '{ ...o"#; }': ()
413 [17; 21) '5i32': i32 413 17..21 '5i32': i32
414 [27; 31) '5f32': f32 414 27..31 '5f32': f32
415 [37; 41) '5f64': f64 415 37..41 '5f64': f64
416 [47; 54) '"hello"': &str 416 47..54 '"hello"': &str
417 [60; 68) 'b"bytes"': &[u8] 417 60..68 'b"bytes"': &[u8]
418 [74; 77) ''c'': char 418 74..77 ''c'': char
419 [83; 87) 'b'b'': u8 419 83..87 'b'b'': u8
420 [93; 97) '3.14': f64 420 93..97 '3.14': f64
421 [103; 107) '5000': i32 421 103..107 '5000': i32
422 [113; 118) 'false': bool 422 113..118 'false': bool
423 [124; 128) 'true': bool 423 124..128 'true': bool
424 [134; 202) 'r#" ... "#': &str 424 134..202 'r#" ... "#': &str
425 [208; 218) 'br#"yolo"#': &[u8] 425 208..218 'br#"yolo"#': &[u8]
426 "### 426 "###
427 ); 427 );
428} 428}
@@ -452,47 +452,47 @@ fn test(x: SomeType) {
452} 452}
453"#), 453"#),
454 @r###" 454 @r###"
455 [27; 28) 'x': SomeType 455 27..28 'x': SomeType
456 [40; 272) '{ ...lo"; }': () 456 40..272 '{ ...lo"; }': ()
457 [50; 51) 'b': bool 457 50..51 'b': bool
458 [54; 59) 'false': bool 458 54..59 'false': bool
459 [69; 70) 'c': bool 459 69..70 'c': bool
460 [73; 75) '!b': bool 460 73..75 '!b': bool
461 [74; 75) 'b': bool 461 74..75 'b': bool
462 [85; 86) 'a': i128 462 85..86 'a': i128
463 [89; 92) '100': i128 463 89..92 '100': i128
464 [102; 103) 'd': i128 464 102..103 'd': i128
465 [112; 114) '-a': i128 465 112..114 '-a': i128
466 [113; 114) 'a': i128 466 113..114 'a': i128
467 [124; 125) 'e': i32 467 124..125 'e': i32
468 [128; 132) '-100': i32 468 128..132 '-100': i32
469 [129; 132) '100': i32 469 129..132 '100': i32
470 [142; 143) 'f': bool 470 142..143 'f': bool
471 [146; 153) '!!!true': bool 471 146..153 '!!!true': bool
472 [147; 153) '!!true': bool 472 147..153 '!!true': bool
473 [148; 153) '!true': bool 473 148..153 '!true': bool
474 [149; 153) 'true': bool 474 149..153 'true': bool
475 [163; 164) 'g': i32 475 163..164 'g': i32
476 [167; 170) '!42': i32 476 167..170 '!42': i32
477 [168; 170) '42': i32 477 168..170 '42': i32
478 [180; 181) 'h': u32 478 180..181 'h': u32
479 [184; 190) '!10u32': u32 479 184..190 '!10u32': u32
480 [185; 190) '10u32': u32 480 185..190 '10u32': u32
481 [200; 201) 'j': i128 481 200..201 'j': i128
482 [204; 206) '!a': i128 482 204..206 '!a': i128
483 [205; 206) 'a': i128 483 205..206 'a': i128
484 [212; 217) '-3.14': f64 484 212..217 '-3.14': f64
485 [213; 217) '3.14': f64 485 213..217 '3.14': f64
486 [223; 225) '!3': i32 486 223..225 '!3': i32
487 [224; 225) '3': i32 487 224..225 '3': i32
488 [231; 233) '-x': {unknown} 488 231..233 '-x': {unknown}
489 [232; 233) 'x': SomeType 489 232..233 'x': SomeType
490 [239; 241) '!x': {unknown} 490 239..241 '!x': {unknown}
491 [240; 241) 'x': SomeType 491 240..241 'x': SomeType
492 [247; 255) '-"hello"': {unknown} 492 247..255 '-"hello"': {unknown}
493 [248; 255) '"hello"': &str 493 248..255 '"hello"': &str
494 [261; 269) '!"hello"': {unknown} 494 261..269 '!"hello"': {unknown}
495 [262; 269) '"hello"': &str 495 262..269 '"hello"': &str
496 "### 496 "###
497 ); 497 );
498} 498}
@@ -515,26 +515,26 @@ fn test() -> &mut &f64 {
515} 515}
516"#), 516"#),
517 @r###" 517 @r###"
518 [14; 15) 'x': u32 518 14..15 'x': u32
519 [22; 24) '{}': () 519 22..24 '{}': ()
520 [78; 231) '{ ...t &c }': &mut &f64 520 78..231 '{ ...t &c }': &mut &f64
521 [88; 89) 'a': u32 521 88..89 'a': u32
522 [92; 108) 'unknow...nction': {unknown} 522 92..108 'unknow...nction': {unknown}
523 [92; 110) 'unknow...tion()': u32 523 92..110 'unknow...tion()': u32
524 [116; 125) 'takes_u32': fn takes_u32(u32) 524 116..125 'takes_u32': fn takes_u32(u32)
525 [116; 128) 'takes_u32(a)': () 525 116..128 'takes_u32(a)': ()
526 [126; 127) 'a': u32 526 126..127 'a': u32
527 [138; 139) 'b': i32 527 138..139 'b': i32
528 [142; 158) 'unknow...nction': {unknown} 528 142..158 'unknow...nction': {unknown}
529 [142; 160) 'unknow...tion()': i32 529 142..160 'unknow...tion()': i32
530 [166; 184) 'S { i3...d: b }': S 530 166..184 'S { i3...d: b }': S
531 [181; 182) 'b': i32 531 181..182 'b': i32
532 [194; 195) 'c': f64 532 194..195 'c': f64
533 [198; 214) 'unknow...nction': {unknown} 533 198..214 'unknow...nction': {unknown}
534 [198; 216) 'unknow...tion()': f64 534 198..216 'unknow...tion()': f64
535 [222; 229) '&mut &c': &mut &f64 535 222..229 '&mut &c': &mut &f64
536 [227; 229) '&c': &f64 536 227..229 '&c': &f64
537 [228; 229) 'c': f64 537 228..229 'c': f64
538 "### 538 "###
539 ); 539 );
540} 540}
@@ -561,16 +561,16 @@ impl S {
561} 561}
562"#), 562"#),
563 @r###" 563 @r###"
564 [34; 38) 'self': &S 564 34..38 'self': &S
565 [40; 61) '{ ... }': () 565 40..61 '{ ... }': ()
566 [50; 54) 'self': &S 566 50..54 'self': &S
567 [75; 79) 'self': &S 567 75..79 'self': &S
568 [88; 109) '{ ... }': () 568 88..109 '{ ... }': ()
569 [98; 102) 'self': &S 569 98..102 'self': &S
570 [133; 153) '{ ... }': S 570 133..153 '{ ... }': S
571 [143; 147) 'S {}': S 571 143..147 'S {}': S
572 [177; 200) '{ ... }': S 572 177..200 '{ ... }': S
573 [187; 194) 'Self {}': S 573 187..194 'Self {}': S
574 "### 574 "###
575 ); 575 );
576} 576}
@@ -600,56 +600,56 @@ fn test() -> bool {
600} 600}
601"#), 601"#),
602 @r###" 602 @r###"
603 [6; 7) 'x': bool 603 6..7 'x': bool
604 [22; 34) '{ 0i32 }': i32 604 22..34 '{ 0i32 }': i32
605 [28; 32) '0i32': i32 605 28..32 '0i32': i32
606 [54; 370) '{ ... < 3 }': bool 606 54..370 '{ ... < 3 }': bool
607 [64; 65) 'x': bool 607 64..65 'x': bool
608 [68; 69) 'a': bool 608 68..69 'a': bool
609 [68; 74) 'a && b': bool 609 68..74 'a && b': bool
610 [73; 74) 'b': bool 610 73..74 'b': bool
611 [84; 85) 'y': bool 611 84..85 'y': bool
612 [88; 92) 'true': bool 612 88..92 'true': bool
613 [88; 101) 'true || false': bool 613 88..101 'true || false': bool
614 [96; 101) 'false': bool 614 96..101 'false': bool
615 [111; 112) 'z': bool 615 111..112 'z': bool
616 [115; 116) 'x': bool 616 115..116 'x': bool
617 [115; 121) 'x == y': bool 617 115..121 'x == y': bool
618 [120; 121) 'y': bool 618 120..121 'y': bool
619 [131; 132) 't': bool 619 131..132 't': bool
620 [135; 136) 'x': bool 620 135..136 'x': bool
621 [135; 141) 'x != y': bool 621 135..141 'x != y': bool
622 [140; 141) 'y': bool 622 140..141 'y': bool
623 [151; 162) 'minus_forty': isize 623 151..162 'minus_forty': isize
624 [172; 180) '-40isize': isize 624 172..180 '-40isize': isize
625 [173; 180) '40isize': isize 625 173..180 '40isize': isize
626 [190; 191) 'h': bool 626 190..191 'h': bool
627 [194; 205) 'minus_forty': isize 627 194..205 'minus_forty': isize
628 [194; 216) 'minus_...ONST_2': bool 628 194..216 'minus_...ONST_2': bool
629 [209; 216) 'CONST_2': isize 629 209..216 'CONST_2': isize
630 [226; 227) 'c': i32 630 226..227 'c': i32
631 [230; 231) 'f': fn f(bool) -> i32 631 230..231 'f': fn f(bool) -> i32
632 [230; 239) 'f(z || y)': i32 632 230..239 'f(z || y)': i32
633 [230; 243) 'f(z || y) + 5': i32 633 230..243 'f(z || y) + 5': i32
634 [232; 233) 'z': bool 634 232..233 'z': bool
635 [232; 238) 'z || y': bool 635 232..238 'z || y': bool
636 [237; 238) 'y': bool 636 237..238 'y': bool
637 [242; 243) '5': i32 637 242..243 '5': i32
638 [253; 254) 'd': {unknown} 638 253..254 'd': {unknown}
639 [257; 258) 'b': {unknown} 639 257..258 'b': {unknown}
640 [268; 269) 'g': () 640 268..269 'g': ()
641 [272; 283) 'minus_forty': isize 641 272..283 'minus_forty': isize
642 [272; 288) 'minus_...y ^= i': () 642 272..288 'minus_...y ^= i': ()
643 [287; 288) 'i': isize 643 287..288 'i': isize
644 [298; 301) 'ten': usize 644 298..301 'ten': usize
645 [311; 313) '10': usize 645 311..313 '10': usize
646 [323; 336) 'ten_is_eleven': bool 646 323..336 'ten_is_eleven': bool
647 [339; 342) 'ten': usize 647 339..342 'ten': usize
648 [339; 354) 'ten == some_num': bool 648 339..354 'ten == some_num': bool
649 [346; 354) 'some_num': usize 649 346..354 'some_num': usize
650 [361; 364) 'ten': usize 650 361..364 'ten': usize
651 [361; 368) 'ten < 3': bool 651 361..368 'ten < 3': bool
652 [367; 368) '3': usize 652 367..368 '3': usize
653 "### 653 "###
654 ); 654 );
655} 655}
@@ -664,13 +664,13 @@ fn test() {
664} 664}
665"#), 665"#),
666 @r###" 666 @r###"
667 [11; 48) '{ ...5u8; }': () 667 11..48 '{ ...5u8; }': ()
668 [17; 21) '1u32': u32 668 17..21 '1u32': u32
669 [17; 28) '1u32 << 5u8': u32 669 17..28 '1u32 << 5u8': u32
670 [25; 28) '5u8': u8 670 25..28 '5u8': u8
671 [34; 38) '1u32': u32 671 34..38 '1u32': u32
672 [34; 45) '1u32 >> 5u8': u32 672 34..45 '1u32 >> 5u8': u32
673 [42; 45) '5u8': u8 673 42..45 '5u8': u8
674 "### 674 "###
675 ); 675 );
676} 676}
@@ -703,49 +703,49 @@ fn test2(a1: *const A, a2: *mut A) {
703} 703}
704"#), 704"#),
705 @r###" 705 @r###"
706 [44; 45) 'a': A 706 44..45 'a': A
707 [50; 213) '{ ...5.b; }': () 707 50..213 '{ ...5.b; }': ()
708 [60; 62) 'a1': A 708 60..62 'a1': A
709 [65; 66) 'a': A 709 65..66 'a': A
710 [72; 74) 'a1': A 710 72..74 'a1': A
711 [72; 76) 'a1.b': B 711 72..76 'a1.b': B
712 [86; 88) 'a2': &A 712 86..88 'a2': &A
713 [91; 93) '&a': &A 713 91..93 '&a': &A
714 [92; 93) 'a': A 714 92..93 'a': A
715 [99; 101) 'a2': &A 715 99..101 'a2': &A
716 [99; 103) 'a2.b': B 716 99..103 'a2.b': B
717 [113; 115) 'a3': &mut A 717 113..115 'a3': &mut A
718 [118; 124) '&mut a': &mut A 718 118..124 '&mut a': &mut A
719 [123; 124) 'a': A 719 123..124 'a': A
720 [130; 132) 'a3': &mut A 720 130..132 'a3': &mut A
721 [130; 134) 'a3.b': B 721 130..134 'a3.b': B
722 [144; 146) 'a4': &&&&&&&A 722 144..146 'a4': &&&&&&&A
723 [149; 157) '&&&&&&&a': &&&&&&&A 723 149..157 '&&&&&&&a': &&&&&&&A
724 [150; 157) '&&&&&&a': &&&&&&A 724 150..157 '&&&&&&a': &&&&&&A
725 [151; 157) '&&&&&a': &&&&&A 725 151..157 '&&&&&a': &&&&&A
726 [152; 157) '&&&&a': &&&&A 726 152..157 '&&&&a': &&&&A
727 [153; 157) '&&&a': &&&A 727 153..157 '&&&a': &&&A
728 [154; 157) '&&a': &&A 728 154..157 '&&a': &&A
729 [155; 157) '&a': &A 729 155..157 '&a': &A
730 [156; 157) 'a': A 730 156..157 'a': A
731 [163; 165) 'a4': &&&&&&&A 731 163..165 'a4': &&&&&&&A
732 [163; 167) 'a4.b': B 732 163..167 'a4.b': B
733 [177; 179) 'a5': &mut &&mut &&mut A 733 177..179 'a5': &mut &&mut &&mut A
734 [182; 200) '&mut &...&mut a': &mut &&mut &&mut A 734 182..200 '&mut &...&mut a': &mut &&mut &&mut A
735 [187; 200) '&&mut &&mut a': &&mut &&mut A 735 187..200 '&&mut &&mut a': &&mut &&mut A
736 [188; 200) '&mut &&mut a': &mut &&mut A 736 188..200 '&mut &&mut a': &mut &&mut A
737 [193; 200) '&&mut a': &&mut A 737 193..200 '&&mut a': &&mut A
738 [194; 200) '&mut a': &mut A 738 194..200 '&mut a': &mut A
739 [199; 200) 'a': A 739 199..200 'a': A
740 [206; 208) 'a5': &mut &&mut &&mut A 740 206..208 'a5': &mut &&mut &&mut A
741 [206; 210) 'a5.b': B 741 206..210 'a5.b': B
742 [224; 226) 'a1': *const A 742 224..226 'a1': *const A
743 [238; 240) 'a2': *mut A 743 238..240 'a2': *mut A
744 [250; 273) '{ ...2.b; }': () 744 250..273 '{ ...2.b; }': ()
745 [256; 258) 'a1': *const A 745 256..258 'a1': *const A
746 [256; 260) 'a1.b': B 746 256..260 'a1.b': B
747 [266; 268) 'a2': *mut A 747 266..268 'a2': *mut A
748 [266; 270) 'a2.b': B 748 266..270 'a2.b': B
749 "### 749 "###
750 ); 750 );
751} 751}
@@ -782,30 +782,30 @@ fn test() {
782} 782}
783"#), 783"#),
784 @r###" 784 @r###"
785 [68; 72) 'self': &Self 785 68..72 'self': &Self
786 [139; 143) 'self': &A<T> 786 139..143 'self': &A<T>
787 [151; 174) '{ ... }': &T 787 151..174 '{ ... }': &T
788 [161; 168) '&self.0': &T 788 161..168 '&self.0': &T
789 [162; 166) 'self': &A<T> 789 162..166 'self': &A<T>
790 [162; 168) 'self.0': T 790 162..168 'self.0': T
791 [255; 259) 'self': &B<T> 791 255..259 'self': &B<T>
792 [278; 301) '{ ... }': &T 792 278..301 '{ ... }': &T
793 [288; 295) '&self.0': &T 793 288..295 '&self.0': &T
794 [289; 293) 'self': &B<T> 794 289..293 'self': &B<T>
795 [289; 295) 'self.0': T 795 289..295 'self.0': T
796 [315; 353) '{ ...))); }': () 796 315..353 '{ ...))); }': ()
797 [325; 326) 't': &i32 797 325..326 't': &i32
798 [329; 335) 'A::foo': fn foo<i32>(&A<i32>) -> &i32 798 329..335 'A::foo': fn foo<i32>(&A<i32>) -> &i32
799 [329; 350) 'A::foo...42))))': &i32 799 329..350 'A::foo...42))))': &i32
800 [336; 349) '&&B(B(A(42)))': &&B<B<A<i32>>> 800 336..349 '&&B(B(A(42)))': &&B<B<A<i32>>>
801 [337; 349) '&B(B(A(42)))': &B<B<A<i32>>> 801 337..349 '&B(B(A(42)))': &B<B<A<i32>>>
802 [338; 339) 'B': B<B<A<i32>>>(B<A<i32>>) -> B<B<A<i32>>> 802 338..339 'B': B<B<A<i32>>>(B<A<i32>>) -> B<B<A<i32>>>
803 [338; 349) 'B(B(A(42)))': B<B<A<i32>>> 803 338..349 'B(B(A(42)))': B<B<A<i32>>>
804 [340; 341) 'B': B<A<i32>>(A<i32>) -> B<A<i32>> 804 340..341 'B': B<A<i32>>(A<i32>) -> B<A<i32>>
805 [340; 348) 'B(A(42))': B<A<i32>> 805 340..348 'B(A(42))': B<A<i32>>
806 [342; 343) 'A': A<i32>(i32) -> A<i32> 806 342..343 'A': A<i32>(i32) -> A<i32>
807 [342; 347) 'A(42)': A<i32> 807 342..347 'A(42)': A<i32>
808 [344; 346) '42': i32 808 344..346 '42': i32
809 "### 809 "###
810 ); 810 );
811} 811}
@@ -842,34 +842,34 @@ fn test(a: A<i32>) {
842} 842}
843"#), 843"#),
844 @r###" 844 @r###"
845 [68; 72) 'self': &Self 845 68..72 'self': &Self
846 [144; 148) 'self': &A<T> 846 144..148 'self': &A<T>
847 [150; 151) 'x': &A<T> 847 150..151 'x': &A<T>
848 [166; 187) '{ ... }': &T 848 166..187 '{ ... }': &T
849 [176; 181) '&*x.0': &T 849 176..181 '&*x.0': &T
850 [177; 181) '*x.0': T 850 177..181 '*x.0': T
851 [178; 179) 'x': &A<T> 851 178..179 'x': &A<T>
852 [178; 181) 'x.0': *mut T 852 178..181 'x.0': *mut T
853 [268; 272) 'self': &B<T> 853 268..272 'self': &B<T>
854 [291; 314) '{ ... }': &T 854 291..314 '{ ... }': &T
855 [301; 308) '&self.0': &T 855 301..308 '&self.0': &T
856 [302; 306) 'self': &B<T> 856 302..306 'self': &B<T>
857 [302; 308) 'self.0': T 857 302..308 'self.0': T
858 [326; 327) 'a': A<i32> 858 326..327 'a': A<i32>
859 [337; 383) '{ ...))); }': () 859 337..383 '{ ...))); }': ()
860 [347; 348) 't': &i32 860 347..348 't': &i32
861 [351; 352) 'A': A<i32>(*mut i32) -> A<i32> 861 351..352 'A': A<i32>(*mut i32) -> A<i32>
862 [351; 365) 'A(0 as *mut _)': A<i32> 862 351..365 'A(0 as *mut _)': A<i32>
863 [351; 380) 'A(0 as...B(a)))': &i32 863 351..380 'A(0 as...B(a)))': &i32
864 [353; 354) '0': i32 864 353..354 '0': i32
865 [353; 364) '0 as *mut _': *mut i32 865 353..364 '0 as *mut _': *mut i32
866 [370; 379) '&&B(B(a))': &&B<B<A<i32>>> 866 370..379 '&&B(B(a))': &&B<B<A<i32>>>
867 [371; 379) '&B(B(a))': &B<B<A<i32>>> 867 371..379 '&B(B(a))': &B<B<A<i32>>>
868 [372; 373) 'B': B<B<A<i32>>>(B<A<i32>>) -> B<B<A<i32>>> 868 372..373 'B': B<B<A<i32>>>(B<A<i32>>) -> B<B<A<i32>>>
869 [372; 379) 'B(B(a))': B<B<A<i32>>> 869 372..379 'B(B(a))': B<B<A<i32>>>
870 [374; 375) 'B': B<A<i32>>(A<i32>) -> B<A<i32>> 870 374..375 'B': B<A<i32>>(A<i32>) -> B<A<i32>>
871 [374; 378) 'B(a)': B<A<i32>> 871 374..378 'B(a)': B<A<i32>>
872 [376; 377) 'a': A<i32> 872 376..377 'a': A<i32>
873 "### 873 "###
874 ); 874 );
875} 875}
@@ -888,16 +888,16 @@ fn main(foo: Foo) {
888} 888}
889"#), 889"#),
890 @r###" 890 @r###"
891 [35; 38) 'foo': Foo 891 35..38 'foo': Foo
892 [45; 109) '{ ... } }': () 892 45..109 '{ ... } }': ()
893 [51; 107) 'if tru... }': () 893 51..107 'if tru... }': ()
894 [54; 58) 'true': bool 894 54..58 'true': bool
895 [59; 67) '{ }': () 895 59..67 '{ }': ()
896 [73; 107) 'if fal... }': () 896 73..107 'if fal... }': ()
897 [76; 81) 'false': bool 897 76..81 'false': bool
898 [82; 107) '{ ... }': i32 898 82..107 '{ ... }': i32
899 [92; 95) 'foo': Foo 899 92..95 'foo': Foo
900 [92; 101) 'foo.field': i32 900 92..101 'foo.field': i32
901 "### 901 "###
902 ) 902 )
903} 903}
@@ -929,38 +929,38 @@ fn foo() {
929 }; 929 };
930}"#), 930}"#),
931 @r###" 931 @r###"
932 [10; 323) '{ ... }; }': () 932 10..323 '{ ... }; }': ()
933 [20; 23) '_x1': i32 933 20..23 '_x1': i32
934 [26; 80) 'if tru... }': i32 934 26..80 'if tru... }': i32
935 [29; 33) 'true': bool 935 29..33 'true': bool
936 [34; 51) '{ ... }': i32 936 34..51 '{ ... }': i32
937 [44; 45) '1': i32 937 44..45 '1': i32
938 [57; 80) '{ ... }': ! 938 57..80 '{ ... }': !
939 [67; 73) 'return': ! 939 67..73 'return': !
940 [90; 93) '_x2': i32 940 90..93 '_x2': i32
941 [96; 149) 'if tru... }': i32 941 96..149 'if tru... }': i32
942 [99; 103) 'true': bool 942 99..103 'true': bool
943 [104; 121) '{ ... }': i32 943 104..121 '{ ... }': i32
944 [114; 115) '2': i32 944 114..115 '2': i32
945 [127; 149) '{ ... }': ! 945 127..149 '{ ... }': !
946 [137; 143) 'return': ! 946 137..143 'return': !
947 [159; 162) '_x3': i32 947 159..162 '_x3': i32
948 [165; 247) 'match ... }': i32 948 165..247 'match ... }': i32
949 [171; 175) 'true': bool 949 171..175 'true': bool
950 [186; 190) 'true': bool 950 186..190 'true': bool
951 [186; 190) 'true': bool 951 186..190 'true': bool
952 [194; 195) '3': i32 952 194..195 '3': i32
953 [205; 206) '_': bool 953 205..206 '_': bool
954 [210; 241) '{ ... }': ! 954 210..241 '{ ... }': !
955 [224; 230) 'return': ! 955 224..230 'return': !
956 [257; 260) '_x4': i32 956 257..260 '_x4': i32
957 [263; 320) 'match ... }': i32 957 263..320 'match ... }': i32
958 [269; 273) 'true': bool 958 269..273 'true': bool
959 [284; 288) 'true': bool 959 284..288 'true': bool
960 [284; 288) 'true': bool 960 284..288 'true': bool
961 [292; 293) '4': i32 961 292..293 '4': i32
962 [303; 304) '_': bool 962 303..304 '_': bool
963 [308; 314) 'return': ! 963 308..314 'return': !
964 "### 964 "###
965 ) 965 )
966} 966}
@@ -988,24 +988,24 @@ fn test(a: A) {
988} 988}
989"#), 989"#),
990 @r###" 990 @r###"
991 [32; 36) 'self': A 991 32..36 'self': A
992 [38; 39) 'x': u32 992 38..39 'x': u32
993 [53; 55) '{}': () 993 53..55 '{}': ()
994 [103; 107) 'self': &A 994 103..107 'self': &A
995 [109; 110) 'x': u64 995 109..110 'x': u64
996 [124; 126) '{}': () 996 124..126 '{}': ()
997 [144; 145) 'a': A 997 144..145 'a': A
998 [150; 198) '{ ...(1); }': () 998 150..198 '{ ...(1); }': ()
999 [156; 157) 'a': A 999 156..157 'a': A
1000 [156; 164) 'a.foo(1)': i32 1000 156..164 'a.foo(1)': i32
1001 [162; 163) '1': u32 1001 162..163 '1': u32
1002 [170; 181) '(&a).bar(1)': i64 1002 170..181 '(&a).bar(1)': i64
1003 [171; 173) '&a': &A 1003 171..173 '&a': &A
1004 [172; 173) 'a': A 1004 172..173 'a': A
1005 [179; 180) '1': u64 1005 179..180 '1': u64
1006 [187; 188) 'a': A 1006 187..188 'a': A
1007 [187; 195) 'a.bar(1)': i64 1007 187..195 'a.bar(1)': i64
1008 [193; 194) '1': u64 1008 193..194 '1': u64
1009 "### 1009 "###
1010 ); 1010 );
1011} 1011}
@@ -1024,11 +1024,11 @@ fn test() {
1024} 1024}
1025"#), 1025"#),
1026 @r###" 1026 @r###"
1027 [40; 44) 'self': &str 1027 40..44 'self': &str
1028 [53; 55) '{}': () 1028 53..55 '{}': ()
1029 [69; 89) '{ ...o(); }': () 1029 69..89 '{ ...o(); }': ()
1030 [75; 80) '"foo"': &str 1030 75..80 '"foo"': &str
1031 [75; 86) '"foo".foo()': i32 1031 75..86 '"foo".foo()': i32
1032 "### 1032 "###
1033 ); 1033 );
1034} 1034}
@@ -1047,33 +1047,33 @@ fn test(x: &str, y: isize) {
1047} 1047}
1048"#), 1048"#),
1049 @r###" 1049 @r###"
1050 [9; 10) 'x': &str 1050 9..10 'x': &str
1051 [18; 19) 'y': isize 1051 18..19 'y': isize
1052 [28; 170) '{ ...d"); }': () 1052 28..170 '{ ...d"); }': ()
1053 [38; 39) 'a': (u32, &str) 1053 38..39 'a': (u32, &str)
1054 [55; 63) '(1, "a")': (u32, &str) 1054 55..63 '(1, "a")': (u32, &str)
1055 [56; 57) '1': u32 1055 56..57 '1': u32
1056 [59; 62) '"a"': &str 1056 59..62 '"a"': &str
1057 [73; 74) 'b': ((u32, &str), &str) 1057 73..74 'b': ((u32, &str), &str)
1058 [77; 83) '(a, x)': ((u32, &str), &str) 1058 77..83 '(a, x)': ((u32, &str), &str)
1059 [78; 79) 'a': (u32, &str) 1059 78..79 'a': (u32, &str)
1060 [81; 82) 'x': &str 1060 81..82 'x': &str
1061 [93; 94) 'c': (isize, &str) 1061 93..94 'c': (isize, &str)
1062 [97; 103) '(y, x)': (isize, &str) 1062 97..103 '(y, x)': (isize, &str)
1063 [98; 99) 'y': isize 1063 98..99 'y': isize
1064 [101; 102) 'x': &str 1064 101..102 'x': &str
1065 [113; 114) 'd': ((isize, &str), &str) 1065 113..114 'd': ((isize, &str), &str)
1066 [117; 123) '(c, x)': ((isize, &str), &str) 1066 117..123 '(c, x)': ((isize, &str), &str)
1067 [118; 119) 'c': (isize, &str) 1067 118..119 'c': (isize, &str)
1068 [121; 122) 'x': &str 1068 121..122 'x': &str
1069 [133; 134) 'e': (i32, &str) 1069 133..134 'e': (i32, &str)
1070 [137; 145) '(1, "e")': (i32, &str) 1070 137..145 '(1, "e")': (i32, &str)
1071 [138; 139) '1': i32 1071 138..139 '1': i32
1072 [141; 144) '"e"': &str 1072 141..144 '"e"': &str
1073 [155; 156) 'f': ((i32, &str), &str) 1073 155..156 'f': ((i32, &str), &str)
1074 [159; 167) '(e, "d")': ((i32, &str), &str) 1074 159..167 '(e, "d")': ((i32, &str), &str)
1075 [160; 161) 'e': (i32, &str) 1075 160..161 'e': (i32, &str)
1076 [163; 166) '"d"': &str 1076 163..166 '"d"': &str
1077 "### 1077 "###
1078 ); 1078 );
1079} 1079}
@@ -1101,58 +1101,58 @@ fn test(x: &str, y: isize) {
1101} 1101}
1102"#), 1102"#),
1103 @r###" 1103 @r###"
1104 [9; 10) 'x': &str 1104 9..10 'x': &str
1105 [18; 19) 'y': isize 1105 18..19 'y': isize
1106 [28; 293) '{ ... []; }': () 1106 28..293 '{ ... []; }': ()
1107 [38; 39) 'a': [&str; _] 1107 38..39 'a': [&str; _]
1108 [42; 45) '[x]': [&str; _] 1108 42..45 '[x]': [&str; _]
1109 [43; 44) 'x': &str 1109 43..44 'x': &str
1110 [55; 56) 'b': [[&str; _]; _] 1110 55..56 'b': [[&str; _]; _]
1111 [59; 65) '[a, a]': [[&str; _]; _] 1111 59..65 '[a, a]': [[&str; _]; _]
1112 [60; 61) 'a': [&str; _] 1112 60..61 'a': [&str; _]
1113 [63; 64) 'a': [&str; _] 1113 63..64 'a': [&str; _]
1114 [75; 76) 'c': [[[&str; _]; _]; _] 1114 75..76 'c': [[[&str; _]; _]; _]
1115 [79; 85) '[b, b]': [[[&str; _]; _]; _] 1115 79..85 '[b, b]': [[[&str; _]; _]; _]
1116 [80; 81) 'b': [[&str; _]; _] 1116 80..81 'b': [[&str; _]; _]
1117 [83; 84) 'b': [[&str; _]; _] 1117 83..84 'b': [[&str; _]; _]
1118 [96; 97) 'd': [isize; _] 1118 96..97 'd': [isize; _]
1119 [100; 112) '[y, 1, 2, 3]': [isize; _] 1119 100..112 '[y, 1, 2, 3]': [isize; _]
1120 [101; 102) 'y': isize 1120 101..102 'y': isize
1121 [104; 105) '1': isize 1121 104..105 '1': isize
1122 [107; 108) '2': isize 1122 107..108 '2': isize
1123 [110; 111) '3': isize 1123 110..111 '3': isize
1124 [122; 123) 'd': [isize; _] 1124 122..123 'd': [isize; _]
1125 [126; 138) '[1, y, 2, 3]': [isize; _] 1125 126..138 '[1, y, 2, 3]': [isize; _]
1126 [127; 128) '1': isize 1126 127..128 '1': isize
1127 [130; 131) 'y': isize 1127 130..131 'y': isize
1128 [133; 134) '2': isize 1128 133..134 '2': isize
1129 [136; 137) '3': isize 1129 136..137 '3': isize
1130 [148; 149) 'e': [isize; _] 1130 148..149 'e': [isize; _]
1131 [152; 155) '[y]': [isize; _] 1131 152..155 '[y]': [isize; _]
1132 [153; 154) 'y': isize 1132 153..154 'y': isize
1133 [165; 166) 'f': [[isize; _]; _] 1133 165..166 'f': [[isize; _]; _]
1134 [169; 175) '[d, d]': [[isize; _]; _] 1134 169..175 '[d, d]': [[isize; _]; _]
1135 [170; 171) 'd': [isize; _] 1135 170..171 'd': [isize; _]
1136 [173; 174) 'd': [isize; _] 1136 173..174 'd': [isize; _]
1137 [185; 186) 'g': [[isize; _]; _] 1137 185..186 'g': [[isize; _]; _]
1138 [189; 195) '[e, e]': [[isize; _]; _] 1138 189..195 '[e, e]': [[isize; _]; _]
1139 [190; 191) 'e': [isize; _] 1139 190..191 'e': [isize; _]
1140 [193; 194) 'e': [isize; _] 1140 193..194 'e': [isize; _]
1141 [206; 207) 'h': [i32; _] 1141 206..207 'h': [i32; _]
1142 [210; 216) '[1, 2]': [i32; _] 1142 210..216 '[1, 2]': [i32; _]
1143 [211; 212) '1': i32 1143 211..212 '1': i32
1144 [214; 215) '2': i32 1144 214..215 '2': i32
1145 [226; 227) 'i': [&str; _] 1145 226..227 'i': [&str; _]
1146 [230; 240) '["a", "b"]': [&str; _] 1146 230..240 '["a", "b"]': [&str; _]
1147 [231; 234) '"a"': &str 1147 231..234 '"a"': &str
1148 [236; 239) '"b"': &str 1148 236..239 '"b"': &str
1149 [251; 252) 'b': [[&str; _]; _] 1149 251..252 'b': [[&str; _]; _]
1150 [255; 265) '[a, ["b"]]': [[&str; _]; _] 1150 255..265 '[a, ["b"]]': [[&str; _]; _]
1151 [256; 257) 'a': [&str; _] 1151 256..257 'a': [&str; _]
1152 [259; 264) '["b"]': [&str; _] 1152 259..264 '["b"]': [&str; _]
1153 [260; 263) '"b"': &str 1153 260..263 '"b"': &str
1154 [275; 276) 'x': [u8; _] 1154 275..276 'x': [u8; _]
1155 [288; 290) '[]': [u8; _] 1155 288..290 '[]': [u8; _]
1156 "### 1156 "###
1157 ); 1157 );
1158} 1158}
@@ -1174,21 +1174,21 @@ fn test(a1: A<u32>, i: i32) {
1174} 1174}
1175"#), 1175"#),
1176 @r###" 1176 @r###"
1177 [36; 38) 'a1': A<u32> 1177 36..38 'a1': A<u32>
1178 [48; 49) 'i': i32 1178 48..49 'i': i32
1179 [56; 147) '{ ...3.x; }': () 1179 56..147 '{ ...3.x; }': ()
1180 [62; 64) 'a1': A<u32> 1180 62..64 'a1': A<u32>
1181 [62; 66) 'a1.x': u32 1181 62..66 'a1.x': u32
1182 [76; 78) 'a2': A<i32> 1182 76..78 'a2': A<i32>
1183 [81; 91) 'A { x: i }': A<i32> 1183 81..91 'A { x: i }': A<i32>
1184 [88; 89) 'i': i32 1184 88..89 'i': i32
1185 [97; 99) 'a2': A<i32> 1185 97..99 'a2': A<i32>
1186 [97; 101) 'a2.x': i32 1186 97..101 'a2.x': i32
1187 [111; 113) 'a3': A<i128> 1187 111..113 'a3': A<i128>
1188 [116; 134) 'A::<i1...x: 1 }': A<i128> 1188 116..134 'A::<i1...x: 1 }': A<i128>
1189 [131; 132) '1': i128 1189 131..132 '1': i128
1190 [140; 142) 'a3': A<i128> 1190 140..142 'a3': A<i128>
1191 [140; 144) 'a3.x': i128 1191 140..144 'a3.x': i128
1192 "### 1192 "###
1193 ); 1193 );
1194} 1194}
@@ -1211,22 +1211,22 @@ fn test() {
1211} 1211}
1212"#), 1212"#),
1213 @r###" 1213 @r###"
1214 [76; 184) '{ ...one; }': () 1214 76..184 '{ ...one; }': ()
1215 [82; 83) 'A': A<i32>(i32) -> A<i32> 1215 82..83 'A': A<i32>(i32) -> A<i32>
1216 [82; 87) 'A(42)': A<i32> 1216 82..87 'A(42)': A<i32>
1217 [84; 86) '42': i32 1217 84..86 '42': i32
1218 [93; 94) 'A': A<u128>(u128) -> A<u128> 1218 93..94 'A': A<u128>(u128) -> A<u128>
1219 [93; 102) 'A(42u128)': A<u128> 1219 93..102 'A(42u128)': A<u128>
1220 [95; 101) '42u128': u128 1220 95..101 '42u128': u128
1221 [108; 112) 'Some': Some<&str>(&str) -> Option<&str> 1221 108..112 'Some': Some<&str>(&str) -> Option<&str>
1222 [108; 117) 'Some("x")': Option<&str> 1222 108..117 'Some("x")': Option<&str>
1223 [113; 116) '"x"': &str 1223 113..116 '"x"': &str
1224 [123; 135) 'Option::Some': Some<&str>(&str) -> Option<&str> 1224 123..135 'Option::Some': Some<&str>(&str) -> Option<&str>
1225 [123; 140) 'Option...e("x")': Option<&str> 1225 123..140 'Option...e("x")': Option<&str>
1226 [136; 139) '"x"': &str 1226 136..139 '"x"': &str
1227 [146; 150) 'None': Option<{unknown}> 1227 146..150 'None': Option<{unknown}>
1228 [160; 161) 'x': Option<i64> 1228 160..161 'x': Option<i64>
1229 [177; 181) 'None': Option<i64> 1229 177..181 'None': Option<i64>
1230 "### 1230 "###
1231 ); 1231 );
1232} 1232}
@@ -1244,20 +1244,20 @@ fn test() {
1244} 1244}
1245"#), 1245"#),
1246 @r###" 1246 @r###"
1247 [10; 11) 't': T 1247 10..11 't': T
1248 [21; 26) '{ t }': T 1248 21..26 '{ t }': T
1249 [23; 24) 't': T 1249 23..24 't': T
1250 [38; 98) '{ ...(1); }': () 1250 38..98 '{ ...(1); }': ()
1251 [44; 46) 'id': fn id<u32>(u32) -> u32 1251 44..46 'id': fn id<u32>(u32) -> u32
1252 [44; 52) 'id(1u32)': u32 1252 44..52 'id(1u32)': u32
1253 [47; 51) '1u32': u32 1253 47..51 '1u32': u32
1254 [58; 68) 'id::<i128>': fn id<i128>(i128) -> i128 1254 58..68 'id::<i128>': fn id<i128>(i128) -> i128
1255 [58; 71) 'id::<i128>(1)': i128 1255 58..71 'id::<i128>(1)': i128
1256 [69; 70) '1': i128 1256 69..70 '1': i128
1257 [81; 82) 'x': u64 1257 81..82 'x': u64
1258 [90; 92) 'id': fn id<u64>(u64) -> u64 1258 90..92 'id': fn id<u64>(u64) -> u64
1259 [90; 95) 'id(1)': u64 1259 90..95 'id(1)': u64
1260 [93; 94) '1': u64 1260 93..94 '1': u64
1261 "### 1261 "###
1262 ); 1262 );
1263} 1263}
@@ -1291,38 +1291,38 @@ fn test() -> i128 {
1291} 1291}
1292"#), 1292"#),
1293 @r###" 1293 @r###"
1294 [74; 78) 'self': A<X, Y> 1294 74..78 'self': A<X, Y>
1295 [85; 107) '{ ... }': X 1295 85..107 '{ ... }': X
1296 [95; 99) 'self': A<X, Y> 1296 95..99 'self': A<X, Y>
1297 [95; 101) 'self.x': X 1297 95..101 'self.x': X
1298 [117; 121) 'self': A<X, Y> 1298 117..121 'self': A<X, Y>
1299 [128; 150) '{ ... }': Y 1299 128..150 '{ ... }': Y
1300 [138; 142) 'self': A<X, Y> 1300 138..142 'self': A<X, Y>
1301 [138; 144) 'self.y': Y 1301 138..144 'self.y': Y
1302 [163; 167) 'self': A<X, Y> 1302 163..167 'self': A<X, Y>
1303 [169; 170) 't': T 1303 169..170 't': T
1304 [188; 223) '{ ... }': (X, Y, T) 1304 188..223 '{ ... }': (X, Y, T)
1305 [198; 217) '(self.....y, t)': (X, Y, T) 1305 198..217 '(self.....y, t)': (X, Y, T)
1306 [199; 203) 'self': A<X, Y> 1306 199..203 'self': A<X, Y>
1307 [199; 205) 'self.x': X 1307 199..205 'self.x': X
1308 [207; 211) 'self': A<X, Y> 1308 207..211 'self': A<X, Y>
1309 [207; 213) 'self.y': Y 1309 207..213 'self.y': Y
1310 [215; 216) 't': T 1310 215..216 't': T
1311 [245; 342) '{ ...(1); }': () 1311 245..342 '{ ...(1); }': ()
1312 [255; 256) 'a': A<u64, i64> 1312 255..256 'a': A<u64, i64>
1313 [259; 281) 'A { x:...1i64 }': A<u64, i64> 1313 259..281 'A { x:...1i64 }': A<u64, i64>
1314 [266; 270) '1u64': u64 1314 266..270 '1u64': u64
1315 [275; 279) '1i64': i64 1315 275..279 '1i64': i64
1316 [287; 288) 'a': A<u64, i64> 1316 287..288 'a': A<u64, i64>
1317 [287; 292) 'a.x()': u64 1317 287..292 'a.x()': u64
1318 [298; 299) 'a': A<u64, i64> 1318 298..299 'a': A<u64, i64>
1319 [298; 303) 'a.y()': i64 1319 298..303 'a.y()': i64
1320 [309; 310) 'a': A<u64, i64> 1320 309..310 'a': A<u64, i64>
1321 [309; 319) 'a.z(1i128)': (u64, i64, i128) 1321 309..319 'a.z(1i128)': (u64, i64, i128)
1322 [313; 318) '1i128': i128 1322 313..318 '1i128': i128
1323 [325; 326) 'a': A<u64, i64> 1323 325..326 'a': A<u64, i64>
1324 [325; 339) 'a.z::<u128>(1)': (u64, i64, u128) 1324 325..339 'a.z::<u128>(1)': (u64, i64, u128)
1325 [337; 338) '1': u128 1325 337..338 '1': u128
1326 "### 1326 "###
1327 ); 1327 );
1328} 1328}
@@ -1344,15 +1344,15 @@ fn test(o: Option<u32>) {
1344} 1344}
1345"#), 1345"#),
1346 @r###" 1346 @r###"
1347 [78; 82) 'self': &Option<T> 1347 78..82 'self': &Option<T>
1348 [98; 100) '{}': () 1348 98..100 '{}': ()
1349 [111; 112) 'o': Option<u32> 1349 111..112 'o': Option<u32>
1350 [127; 165) '{ ...f(); }': () 1350 127..165 '{ ...f(); }': ()
1351 [133; 146) '(&o).as_ref()': Option<&u32> 1351 133..146 '(&o).as_ref()': Option<&u32>
1352 [134; 136) '&o': &Option<u32> 1352 134..136 '&o': &Option<u32>
1353 [135; 136) 'o': Option<u32> 1353 135..136 'o': Option<u32>
1354 [152; 153) 'o': Option<u32> 1354 152..153 'o': Option<u32>
1355 [152; 162) 'o.as_ref()': Option<&u32> 1355 152..162 'o.as_ref()': Option<&u32>
1356 "### 1356 "###
1357 ); 1357 );
1358} 1358}
@@ -1381,35 +1381,35 @@ fn test() -> i128 {
1381} 1381}
1382"#), 1382"#),
1383 @r###" 1383 @r###"
1384 [53; 57) 'self': A<T2> 1384 53..57 'self': A<T2>
1385 [65; 87) '{ ... }': T2 1385 65..87 '{ ... }': T2
1386 [75; 79) 'self': A<T2> 1386 75..79 'self': A<T2>
1387 [75; 81) 'self.x': T2 1387 75..81 'self.x': T2
1388 [99; 100) 't': T 1388 99..100 't': T
1389 [110; 115) '{ t }': T 1389 110..115 '{ t }': T
1390 [112; 113) 't': T 1390 112..113 't': T
1391 [135; 261) '{ ....x() }': i128 1391 135..261 '{ ....x() }': i128
1392 [146; 147) 'x': i128 1392 146..147 'x': i128
1393 [150; 151) '1': i128 1393 150..151 '1': i128
1394 [162; 163) 'y': i128 1394 162..163 'y': i128
1395 [166; 168) 'id': fn id<i128>(i128) -> i128 1395 166..168 'id': fn id<i128>(i128) -> i128
1396 [166; 171) 'id(x)': i128 1396 166..171 'id(x)': i128
1397 [169; 170) 'x': i128 1397 169..170 'x': i128
1398 [182; 183) 'a': A<i128> 1398 182..183 'a': A<i128>
1399 [186; 200) 'A { x: id(y) }': A<i128> 1399 186..200 'A { x: id(y) }': A<i128>
1400 [193; 195) 'id': fn id<i128>(i128) -> i128 1400 193..195 'id': fn id<i128>(i128) -> i128
1401 [193; 198) 'id(y)': i128 1401 193..198 'id(y)': i128
1402 [196; 197) 'y': i128 1402 196..197 'y': i128
1403 [211; 212) 'z': i128 1403 211..212 'z': i128
1404 [215; 217) 'id': fn id<i128>(i128) -> i128 1404 215..217 'id': fn id<i128>(i128) -> i128
1405 [215; 222) 'id(a.x)': i128 1405 215..222 'id(a.x)': i128
1406 [218; 219) 'a': A<i128> 1406 218..219 'a': A<i128>
1407 [218; 221) 'a.x': i128 1407 218..221 'a.x': i128
1408 [233; 234) 'b': A<i128> 1408 233..234 'b': A<i128>
1409 [237; 247) 'A { x: z }': A<i128> 1409 237..247 'A { x: z }': A<i128>
1410 [244; 245) 'z': i128 1410 244..245 'z': i128
1411 [254; 255) 'b': A<i128> 1411 254..255 'b': A<i128>
1412 [254; 259) 'b.x()': i128 1412 254..259 'b.x()': i128
1413 "### 1413 "###
1414 ); 1414 );
1415} 1415}
@@ -1447,16 +1447,16 @@ fn test() {
1447} 1447}
1448"#), 1448"#),
1449 @r###" 1449 @r###"
1450 [52; 53) '1': u32 1450 52..53 '1': u32
1451 [105; 106) '2': u32 1451 105..106 '2': u32
1452 [213; 214) '5': u32 1452 213..214 '5': u32
1453 [229; 307) '{ ...:ID; }': () 1453 229..307 '{ ...:ID; }': ()
1454 [239; 240) 'x': u32 1454 239..240 'x': u32
1455 [243; 254) 'Struct::FOO': u32 1455 243..254 'Struct::FOO': u32
1456 [264; 265) 'y': u32 1456 264..265 'y': u32
1457 [268; 277) 'Enum::BAR': u32 1457 268..277 'Enum::BAR': u32
1458 [287; 288) 'z': u32 1458 287..288 'z': u32
1459 [291; 304) 'TraitTest::ID': u32 1459 291..304 'TraitTest::ID': u32
1460 "### 1460 "###
1461 ); 1461 );
1462} 1462}
@@ -1479,22 +1479,22 @@ fn test(x: Foo, y: Bar<&str>, z: Baz<i8, u8>) {
1479} 1479}
1480"#), 1480"#),
1481 @r###" 1481 @r###"
1482 [116; 117) 'x': A<u32, i128> 1482 116..117 'x': A<u32, i128>
1483 [124; 125) 'y': A<&str, u128> 1483 124..125 'y': A<&str, u128>
1484 [138; 139) 'z': A<u8, i8> 1484 138..139 'z': A<u8, i8>
1485 [154; 211) '{ ...z.y; }': () 1485 154..211 '{ ...z.y; }': ()
1486 [160; 161) 'x': A<u32, i128> 1486 160..161 'x': A<u32, i128>
1487 [160; 163) 'x.x': u32 1487 160..163 'x.x': u32
1488 [169; 170) 'x': A<u32, i128> 1488 169..170 'x': A<u32, i128>
1489 [169; 172) 'x.y': i128 1489 169..172 'x.y': i128
1490 [178; 179) 'y': A<&str, u128> 1490 178..179 'y': A<&str, u128>
1491 [178; 181) 'y.x': &str 1491 178..181 'y.x': &str
1492 [187; 188) 'y': A<&str, u128> 1492 187..188 'y': A<&str, u128>
1493 [187; 190) 'y.y': u128 1493 187..190 'y.y': u128
1494 [196; 197) 'z': A<u8, i8> 1494 196..197 'z': A<u8, i8>
1495 [196; 199) 'z.x': u8 1495 196..199 'z.x': u8
1496 [205; 206) 'z': A<u8, i8> 1496 205..206 'z': A<u8, i8>
1497 [205; 208) 'z.y': i8 1497 205..208 'z.y': i8
1498 "### 1498 "###
1499 ) 1499 )
1500} 1500}
@@ -1509,8 +1509,8 @@ type Bar = A<Bar>;
1509fn test(x: Foo) {} 1509fn test(x: Foo) {}
1510"#), 1510"#),
1511 @r###" 1511 @r###"
1512 [59; 60) 'x': {unknown} 1512 59..60 'x': {unknown}
1513 [67; 69) '{}': () 1513 67..69 '{}': ()
1514 "### 1514 "###
1515 ) 1515 )
1516} 1516}
@@ -1535,26 +1535,26 @@ fn test() {
1535} 1535}
1536"#), 1536"#),
1537 @r###" 1537 @r###"
1538 [10; 11) 'x': T 1538 10..11 'x': T
1539 [21; 30) '{ x }': T 1539 21..30 '{ x }': T
1540 [27; 28) 'x': T 1540 27..28 'x': T
1541 [44; 45) 'x': &T 1541 44..45 'x': &T
1542 [56; 66) '{ *x }': T 1542 56..66 '{ *x }': T
1543 [62; 64) '*x': T 1543 62..64 '*x': T
1544 [63; 64) 'x': &T 1544 63..64 'x': &T
1545 [78; 158) '{ ...(1); }': () 1545 78..158 '{ ...(1); }': ()
1546 [88; 89) 'y': u32 1546 88..89 'y': u32
1547 [92; 97) '10u32': u32 1547 92..97 '10u32': u32
1548 [103; 105) 'id': fn id<u32>(u32) -> u32 1548 103..105 'id': fn id<u32>(u32) -> u32
1549 [103; 108) 'id(y)': u32 1549 103..108 'id(y)': u32
1550 [106; 107) 'y': u32 1550 106..107 'y': u32
1551 [118; 119) 'x': bool 1551 118..119 'x': bool
1552 [128; 133) 'clone': fn clone<bool>(&bool) -> bool 1552 128..133 'clone': fn clone<bool>(&bool) -> bool
1553 [128; 136) 'clone(z)': bool 1553 128..136 'clone(z)': bool
1554 [134; 135) 'z': &bool 1554 134..135 'z': &bool
1555 [142; 152) 'id::<i128>': fn id<i128>(i128) -> i128 1555 142..152 'id::<i128>': fn id<i128>(i128) -> i128
1556 [142; 155) 'id::<i128>(1)': i128 1556 142..155 'id::<i128>(1)': i128
1557 [153; 154) '1': i128 1557 153..154 '1': i128
1558 "### 1558 "###
1559 ); 1559 );
1560} 1560}
@@ -1574,16 +1574,16 @@ fn test() {
1574} 1574}
1575"#), 1575"#),
1576 @r###" 1576 @r###"
1577 [49; 50) '0': u32 1577 49..50 '0': u32
1578 [80; 83) '101': u32 1578 80..83 '101': u32
1579 [95; 213) '{ ...NST; }': () 1579 95..213 '{ ...NST; }': ()
1580 [138; 139) 'x': u32 1580 138..139 'x': u32
1581 [142; 153) 'LOCAL_CONST': u32 1581 142..153 'LOCAL_CONST': u32
1582 [163; 164) 'z': u32 1582 163..164 'z': u32
1583 [167; 179) 'GLOBAL_CONST': u32 1583 167..179 'GLOBAL_CONST': u32
1584 [189; 191) 'id': u32 1584 189..191 'id': u32
1585 [194; 210) 'Foo::A..._CONST': u32 1585 194..210 'Foo::A..._CONST': u32
1586 [126; 128) '99': u32 1586 126..128 '99': u32
1587 "### 1587 "###
1588 ); 1588 );
1589} 1589}
@@ -1604,19 +1604,19 @@ fn test() {
1604} 1604}
1605"#), 1605"#),
1606 @r###" 1606 @r###"
1607 [29; 32) '101': u32 1607 29..32 '101': u32
1608 [70; 73) '101': u32 1608 70..73 '101': u32
1609 [85; 280) '{ ...MUT; }': () 1609 85..280 '{ ...MUT; }': ()
1610 [173; 174) 'x': u32 1610 173..174 'x': u32
1611 [177; 189) 'LOCAL_STATIC': u32 1611 177..189 'LOCAL_STATIC': u32
1612 [199; 200) 'y': u32 1612 199..200 'y': u32
1613 [203; 219) 'LOCAL_...IC_MUT': u32 1613 203..219 'LOCAL_...IC_MUT': u32
1614 [229; 230) 'z': u32 1614 229..230 'z': u32
1615 [233; 246) 'GLOBAL_STATIC': u32 1615 233..246 'GLOBAL_STATIC': u32
1616 [256; 257) 'w': u32 1616 256..257 'w': u32
1617 [260; 277) 'GLOBAL...IC_MUT': u32 1617 260..277 'GLOBAL...IC_MUT': u32
1618 [118; 120) '99': u32 1618 118..120 '99': u32
1619 [161; 163) '99': u32 1619 161..163 '99': u32
1620 "### 1620 "###
1621 ); 1621 );
1622} 1622}
@@ -1684,12 +1684,12 @@ fn foo() -> u32 {
1684} 1684}
1685"#), 1685"#),
1686 @r###" 1686 @r###"
1687 [17; 59) '{ ...; }; }': () 1687 17..59 '{ ...; }; }': ()
1688 [27; 28) 'x': || -> usize 1688 27..28 'x': || -> usize
1689 [31; 56) '|| -> ...n 1; }': || -> usize 1689 31..56 '|| -> ...n 1; }': || -> usize
1690 [43; 56) '{ return 1; }': ! 1690 43..56 '{ return 1; }': !
1691 [45; 53) 'return 1': ! 1691 45..53 'return 1': !
1692 [52; 53) '1': usize 1692 52..53 '1': usize
1693 "### 1693 "###
1694 ); 1694 );
1695} 1695}
@@ -1703,11 +1703,11 @@ fn foo() -> u32 {
1703} 1703}
1704"#), 1704"#),
1705 @r###" 1705 @r###"
1706 [17; 48) '{ ...; }; }': () 1706 17..48 '{ ...; }; }': ()
1707 [27; 28) 'x': || -> () 1707 27..28 'x': || -> ()
1708 [31; 45) '|| { return; }': || -> () 1708 31..45 '|| { return; }': || -> ()
1709 [34; 45) '{ return; }': ! 1709 34..45 '{ return; }': !
1710 [36; 42) 'return': ! 1710 36..42 'return': !
1711 "### 1711 "###
1712 ); 1712 );
1713} 1713}
@@ -1721,11 +1721,11 @@ fn foo() -> u32 {
1721} 1721}
1722"#), 1722"#),
1723 @r###" 1723 @r###"
1724 [17; 47) '{ ..." }; }': () 1724 17..47 '{ ..." }; }': ()
1725 [27; 28) 'x': || -> &str 1725 27..28 'x': || -> &str
1726 [31; 44) '|| { "test" }': || -> &str 1726 31..44 '|| { "test" }': || -> &str
1727 [34; 44) '{ "test" }': &str 1727 34..44 '{ "test" }': &str
1728 [36; 42) '"test"': &str 1728 36..42 '"test"': &str
1729 "### 1729 "###
1730 ); 1730 );
1731} 1731}
@@ -1744,14 +1744,14 @@ fn main() {
1744} 1744}
1745"#), 1745"#),
1746 @r###" 1746 @r###"
1747 [48; 121) '{ ...hod; }': () 1747 48..121 '{ ...hod; }': ()
1748 [58; 64) 'vtable': Vtable 1748 58..64 'vtable': Vtable
1749 [67; 91) 'Vtable...| {} }': Vtable 1749 67..91 'Vtable...| {} }': Vtable
1750 [84; 89) '|| {}': || -> () 1750 84..89 '|| {}': || -> ()
1751 [87; 89) '{}': () 1751 87..89 '{}': ()
1752 [101; 102) 'm': fn() 1752 101..102 'm': fn()
1753 [105; 111) 'vtable': Vtable 1753 105..111 'vtable': Vtable
1754 [105; 118) 'vtable.method': fn() 1754 105..118 'vtable.method': fn()
1755 "### 1755 "###
1756 ); 1756 );
1757} 1757}
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs
index a46f03b7f..f51cdd496 100644
--- a/crates/ra_hir_ty/src/tests/traits.rs
+++ b/crates/ra_hir_ty/src/tests/traits.rs
@@ -256,16 +256,16 @@ fn test() {
256} 256}
257"#), 257"#),
258 @r###" 258 @r###"
259 [86; 87) 't': T 259 86..87 't': T
260 [92; 94) '{}': () 260 92..94 '{}': ()
261 [105; 144) '{ ...(s); }': () 261 105..144 '{ ...(s); }': ()
262 [115; 116) 's': S<u32> 262 115..116 's': S<u32>
263 [119; 120) 'S': S<u32>(u32) -> S<u32> 263 119..120 'S': S<u32>(u32) -> S<u32>
264 [119; 129) 'S(unknown)': S<u32> 264 119..129 'S(unknown)': S<u32>
265 [121; 128) 'unknown': u32 265 121..128 'unknown': u32
266 [135; 138) 'foo': fn foo<S<u32>>(S<u32>) 266 135..138 'foo': fn foo<S<u32>>(S<u32>)
267 [135; 141) 'foo(s)': () 267 135..141 'foo(s)': ()
268 [139; 140) 's': S<u32> 268 139..140 's': S<u32>
269 "### 269 "###
270 ); 270 );
271} 271}
@@ -284,17 +284,17 @@ fn test() {
284} 284}
285"#), 285"#),
286 @r###" 286 @r###"
287 [87; 88) 't': T 287 87..88 't': T
288 [98; 100) '{}': () 288 98..100 '{}': ()
289 [111; 163) '{ ...(s); }': () 289 111..163 '{ ...(s); }': ()
290 [121; 122) 's': S<u32> 290 121..122 's': S<u32>
291 [125; 126) 'S': S<u32>(u32) -> S<u32> 291 125..126 'S': S<u32>(u32) -> S<u32>
292 [125; 135) 'S(unknown)': S<u32> 292 125..135 'S(unknown)': S<u32>
293 [127; 134) 'unknown': u32 293 127..134 'unknown': u32
294 [145; 146) 'x': u32 294 145..146 'x': u32
295 [154; 157) 'foo': fn foo<u32, S<u32>>(S<u32>) -> u32 295 154..157 'foo': fn foo<u32, S<u32>>(S<u32>) -> u32
296 [154; 160) 'foo(s)': u32 296 154..160 'foo(s)': u32
297 [158; 159) 's': S<u32> 297 158..159 's': S<u32>
298 "### 298 "###
299 ); 299 );
300} 300}
@@ -312,12 +312,12 @@ trait Trait {
312} 312}
313"#), 313"#),
314 @r###" 314 @r###"
315 [27; 31) 'self': &Self 315 27..31 'self': &Self
316 [53; 57) 'self': &Self 316 53..57 'self': &Self
317 [62; 97) '{ ... }': () 317 62..97 '{ ... }': ()
318 [76; 77) 'x': i64 318 76..77 'x': i64
319 [80; 84) 'self': &Self 319 80..84 'self': &Self
320 [80; 90) 'self.foo()': i64 320 80..90 'self.foo()': i64
321 "### 321 "###
322 ); 322 );
323} 323}
@@ -337,12 +337,12 @@ trait Trait: SuperTrait {
337} 337}
338"#), 338"#),
339 @r###" 339 @r###"
340 [32; 36) 'self': &Self 340 32..36 'self': &Self
341 [86; 90) 'self': &Self 341 86..90 'self': &Self
342 [95; 130) '{ ... }': () 342 95..130 '{ ... }': ()
343 [109; 110) 'x': i64 343 109..110 'x': i64
344 [113; 117) 'self': &Self 344 113..117 'self': &Self
345 [113; 123) 'self.foo()': i64 345 113..123 'self.foo()': i64
346 "### 346 "###
347 ); 347 );
348} 348}
@@ -364,15 +364,15 @@ fn test<T: Iterable>() {
364} 364}
365"#), 365"#),
366 @r###" 366 @r###"
367 [108; 261) '{ ...ter; }': () 367 108..261 '{ ...ter; }': ()
368 [118; 119) 'x': u32 368 118..119 'x': u32
369 [145; 146) '1': u32 369 145..146 '1': u32
370 [156; 157) 'y': Iterable::Item<T> 370 156..157 'y': Iterable::Item<T>
371 [183; 192) 'no_matter': Iterable::Item<T> 371 183..192 'no_matter': Iterable::Item<T>
372 [202; 203) 'z': Iterable::Item<T> 372 202..203 'z': Iterable::Item<T>
373 [215; 224) 'no_matter': Iterable::Item<T> 373 215..224 'no_matter': Iterable::Item<T>
374 [234; 235) 'a': Iterable::Item<T> 374 234..235 'a': Iterable::Item<T>
375 [249; 258) 'no_matter': Iterable::Item<T> 375 249..258 'no_matter': Iterable::Item<T>
376 "### 376 "###
377 ); 377 );
378} 378}
@@ -396,25 +396,25 @@ fn test() {
396} 396}
397"#), 397"#),
398 @r###" 398 @r###"
399 [106; 107) 't': T 399 106..107 't': T
400 [123; 125) '{}': () 400 123..125 '{}': ()
401 [147; 148) 't': T 401 147..148 't': T
402 [178; 180) '{}': () 402 178..180 '{}': ()
403 [202; 203) 't': T 403 202..203 't': T
404 [221; 223) '{}': () 404 221..223 '{}': ()
405 [234; 300) '{ ...(S); }': () 405 234..300 '{ ...(S); }': ()
406 [244; 245) 'x': u32 406 244..245 'x': u32
407 [248; 252) 'foo1': fn foo1<S>(S) -> <S as Iterable>::Item 407 248..252 'foo1': fn foo1<S>(S) -> <S as Iterable>::Item
408 [248; 255) 'foo1(S)': u32 408 248..255 'foo1(S)': u32
409 [253; 254) 'S': S 409 253..254 'S': S
410 [265; 266) 'y': u32 410 265..266 'y': u32
411 [269; 273) 'foo2': fn foo2<S>(S) -> <S as Iterable>::Item 411 269..273 'foo2': fn foo2<S>(S) -> <S as Iterable>::Item
412 [269; 276) 'foo2(S)': u32 412 269..276 'foo2(S)': u32
413 [274; 275) 'S': S 413 274..275 'S': S
414 [286; 287) 'z': u32 414 286..287 'z': u32
415 [290; 294) 'foo3': fn foo3<S>(S) -> <S as Iterable>::Item 415 290..294 'foo3': fn foo3<S>(S) -> <S as Iterable>::Item
416 [290; 297) 'foo3(S)': u32 416 290..297 'foo3(S)': u32
417 [295; 296) 'S': S 417 295..296 'S': S
418 "### 418 "###
419 ); 419 );
420} 420}
@@ -431,9 +431,9 @@ fn test<T: Iterable<Item=u32>>() {
431} 431}
432"#), 432"#),
433 @r###" 433 @r###"
434 [67; 100) '{ ...own; }': () 434 67..100 '{ ...own; }': ()
435 [77; 78) 'y': u32 435 77..78 'y': u32
436 [90; 97) 'unknown': u32 436 90..97 'unknown': u32
437 "### 437 "###
438 ); 438 );
439} 439}
@@ -446,13 +446,13 @@ const A: u32 = 1 + 1;
446static B: u64 = { let x = 1; x }; 446static B: u64 = { let x = 1; x };
447"#), 447"#),
448 @r###" 448 @r###"
449 [16; 17) '1': u32 449 16..17 '1': u32
450 [16; 21) '1 + 1': u32 450 16..21 '1 + 1': u32
451 [20; 21) '1': u32 451 20..21 '1': u32
452 [39; 55) '{ let ...1; x }': u64 452 39..55 '{ let ...1; x }': u64
453 [45; 46) 'x': u64 453 45..46 'x': u64
454 [49; 50) '1': u64 454 49..50 '1': u64
455 [52; 53) 'x': u64 455 52..53 'x': u64
456 "### 456 "###
457 ); 457 );
458} 458}
@@ -469,17 +469,17 @@ fn test() -> u64 {
469} 469}
470"#), 470"#),
471 @r###" 471 @r###"
472 [38; 87) '{ ... a.1 }': u64 472 38..87 '{ ... a.1 }': u64
473 [48; 49) 'a': S 473 48..49 'a': S
474 [52; 53) 'S': S(i32, u64) -> S 474 52..53 'S': S(i32, u64) -> S
475 [52; 59) 'S(4, 6)': S 475 52..59 'S(4, 6)': S
476 [54; 55) '4': i32 476 54..55 '4': i32
477 [57; 58) '6': u64 477 57..58 '6': u64
478 [69; 70) 'b': i32 478 69..70 'b': i32
479 [73; 74) 'a': S 479 73..74 'a': S
480 [73; 76) 'a.0': i32 480 73..76 'a.0': i32
481 [82; 83) 'a': S 481 82..83 'a': S
482 [82; 85) 'a.1': u64 482 82..85 'a.1': u64
483 "### 483 "###
484 ); 484 );
485} 485}
@@ -496,24 +496,24 @@ fn test() -> u64 {
496} 496}
497"#), 497"#),
498 @r###" 498 @r###"
499 [44; 102) '{ ...0(2) }': u64 499 44..102 '{ ...0(2) }': u64
500 [54; 55) 'a': S 500 54..55 'a': S
501 [58; 59) 'S': S(fn(u32) -> u64) -> S 501 58..59 'S': S(fn(u32) -> u64) -> S
502 [58; 68) 'S(|i| 2*i)': S 502 58..68 'S(|i| 2*i)': S
503 [60; 67) '|i| 2*i': |u32| -> u64 503 60..67 '|i| 2*i': |u32| -> u64
504 [61; 62) 'i': u32 504 61..62 'i': u32
505 [64; 65) '2': u32 505 64..65 '2': u32
506 [64; 67) '2*i': u32 506 64..67 '2*i': u32
507 [66; 67) 'i': u32 507 66..67 'i': u32
508 [78; 79) 'b': u64 508 78..79 'b': u64
509 [82; 83) 'a': S 509 82..83 'a': S
510 [82; 85) 'a.0': fn(u32) -> u64 510 82..85 'a.0': fn(u32) -> u64
511 [82; 88) 'a.0(4)': u64 511 82..88 'a.0(4)': u64
512 [86; 87) '4': u32 512 86..87 '4': u32
513 [94; 95) 'a': S 513 94..95 'a': S
514 [94; 97) 'a.0': fn(u32) -> u64 514 94..97 'a.0': fn(u32) -> u64
515 [94; 100) 'a.0(2)': u64 515 94..100 'a.0(2)': u64
516 [98; 99) '2': u32 516 98..99 '2': u32
517 "### 517 "###
518 ); 518 );
519} 519}
@@ -523,12 +523,12 @@ fn indexing_arrays() {
523 assert_snapshot!( 523 assert_snapshot!(
524 infer("fn main() { &mut [9][2]; }"), 524 infer("fn main() { &mut [9][2]; }"),
525 @r###" 525 @r###"
526 [10; 26) '{ &mut...[2]; }': () 526 10..26 '{ &mut...[2]; }': ()
527 [12; 23) '&mut [9][2]': &mut {unknown} 527 12..23 '&mut [9][2]': &mut {unknown}
528 [17; 20) '[9]': [i32; _] 528 17..20 '[9]': [i32; _]
529 [17; 23) '[9][2]': {unknown} 529 17..23 '[9][2]': {unknown}
530 [18; 19) '9': i32 530 18..19 '9': i32
531 [21; 22) '2': i32 531 21..22 '2': i32
532 "### 532 "###
533 ) 533 )
534} 534}
@@ -944,34 +944,34 @@ fn test(x: impl Trait<u64>, y: &impl Trait<u32>) {
944} 944}
945"#, true), 945"#, true),
946 @r###" 946 @r###"
947 [30; 34) 'self': &Self 947 30..34 'self': &Self
948 [55; 59) 'self': &Self 948 55..59 'self': &Self
949 [78; 79) 'x': impl Trait<u16> 949 78..79 'x': impl Trait<u16>
950 [98; 100) '{}': () 950 98..100 '{}': ()
951 [155; 156) 'x': impl Trait<u64> 951 155..156 'x': impl Trait<u64>
952 [175; 176) 'y': &impl Trait<u32> 952 175..176 'y': &impl Trait<u32>
953 [196; 324) '{ ...2(); }': () 953 196..324 '{ ...2(); }': ()
954 [202; 203) 'x': impl Trait<u64> 954 202..203 'x': impl Trait<u64>
955 [209; 210) 'y': &impl Trait<u32> 955 209..210 'y': &impl Trait<u32>
956 [220; 221) 'z': S<u16> 956 220..221 'z': S<u16>
957 [224; 225) 'S': S<u16>(u16) -> S<u16> 957 224..225 'S': S<u16>(u16) -> S<u16>
958 [224; 228) 'S(1)': S<u16> 958 224..228 'S(1)': S<u16>
959 [226; 227) '1': u16 959 226..227 '1': u16
960 [234; 237) 'bar': fn bar(S<u16>) 960 234..237 'bar': fn bar(S<u16>)
961 [234; 240) 'bar(z)': () 961 234..240 'bar(z)': ()
962 [238; 239) 'z': S<u16> 962 238..239 'z': S<u16>
963 [246; 247) 'x': impl Trait<u64> 963 246..247 'x': impl Trait<u64>
964 [246; 253) 'x.foo()': u64 964 246..253 'x.foo()': u64
965 [259; 260) 'y': &impl Trait<u32> 965 259..260 'y': &impl Trait<u32>
966 [259; 266) 'y.foo()': u32 966 259..266 'y.foo()': u32
967 [272; 273) 'z': S<u16> 967 272..273 'z': S<u16>
968 [272; 279) 'z.foo()': u16 968 272..279 'z.foo()': u16
969 [285; 286) 'x': impl Trait<u64> 969 285..286 'x': impl Trait<u64>
970 [285; 293) 'x.foo2()': i64 970 285..293 'x.foo2()': i64
971 [299; 300) 'y': &impl Trait<u32> 971 299..300 'y': &impl Trait<u32>
972 [299; 307) 'y.foo2()': i64 972 299..307 'y.foo2()': i64
973 [313; 314) 'z': S<u16> 973 313..314 'z': S<u16>
974 [313; 321) 'z.foo2()': i64 974 313..321 'z.foo2()': i64
975 "### 975 "###
976 ); 976 );
977} 977}
@@ -1005,39 +1005,39 @@ fn test() {
1005} 1005}
1006"#, true), 1006"#, true),
1007 @r###" 1007 @r###"
1008 [156; 157) 'x': impl Trait 1008 156..157 'x': impl Trait
1009 [176; 187) '{ loop {} }': T 1009 176..187 '{ loop {} }': T
1010 [178; 185) 'loop {}': ! 1010 178..185 'loop {}': !
1011 [183; 185) '{}': () 1011 183..185 '{}': ()
1012 [200; 201) 'x': impl Trait 1012 200..201 'x': impl Trait
1013 [220; 231) '{ loop {} }': T 1013 220..231 '{ loop {} }': T
1014 [222; 229) 'loop {}': ! 1014 222..229 'loop {}': !
1015 [227; 229) '{}': () 1015 227..229 '{}': ()
1016 [301; 510) '{ ... i32 }': () 1016 301..510 '{ ... i32 }': ()
1017 [307; 315) 'Foo::bar': fn bar<{unknown}, {unknown}>(S) -> {unknown} 1017 307..315 'Foo::bar': fn bar<{unknown}, {unknown}>(S) -> {unknown}
1018 [307; 318) 'Foo::bar(S)': {unknown} 1018 307..318 'Foo::bar(S)': {unknown}
1019 [316; 317) 'S': S 1019 316..317 'S': S
1020 [324; 339) '<F as Foo>::bar': fn bar<F, {unknown}>(S) -> {unknown} 1020 324..339 '<F as Foo>::bar': fn bar<F, {unknown}>(S) -> {unknown}
1021 [324; 342) '<F as ...bar(S)': {unknown} 1021 324..342 '<F as ...bar(S)': {unknown}
1022 [340; 341) 'S': S 1022 340..341 'S': S
1023 [348; 354) 'F::bar': fn bar<F, {unknown}>(S) -> {unknown} 1023 348..354 'F::bar': fn bar<F, {unknown}>(S) -> {unknown}
1024 [348; 357) 'F::bar(S)': {unknown} 1024 348..357 'F::bar(S)': {unknown}
1025 [355; 356) 'S': S 1025 355..356 'S': S
1026 [363; 378) 'Foo::bar::<u32>': fn bar<{unknown}, u32>(S) -> u32 1026 363..378 'Foo::bar::<u32>': fn bar<{unknown}, u32>(S) -> u32
1027 [363; 381) 'Foo::b...32>(S)': u32 1027 363..381 'Foo::b...32>(S)': u32
1028 [379; 380) 'S': S 1028 379..380 'S': S
1029 [387; 409) '<F as ...:<u32>': fn bar<F, u32>(S) -> u32 1029 387..409 '<F as ...:<u32>': fn bar<F, u32>(S) -> u32
1030 [387; 412) '<F as ...32>(S)': u32 1030 387..412 '<F as ...32>(S)': u32
1031 [410; 411) 'S': S 1031 410..411 'S': S
1032 [419; 422) 'foo': fn foo<{unknown}>(S) -> {unknown} 1032 419..422 'foo': fn foo<{unknown}>(S) -> {unknown}
1033 [419; 425) 'foo(S)': {unknown} 1033 419..425 'foo(S)': {unknown}
1034 [423; 424) 'S': S 1034 423..424 'S': S
1035 [431; 441) 'foo::<u32>': fn foo<u32>(S) -> u32 1035 431..441 'foo::<u32>': fn foo<u32>(S) -> u32
1036 [431; 444) 'foo::<u32>(S)': u32 1036 431..444 'foo::<u32>(S)': u32
1037 [442; 443) 'S': S 1037 442..443 'S': S
1038 [450; 465) 'foo::<u32, i32>': fn foo<u32>(S) -> u32 1038 450..465 'foo::<u32, i32>': fn foo<u32>(S) -> u32
1039 [450; 468) 'foo::<...32>(S)': u32 1039 450..468 'foo::<...32>(S)': u32
1040 [466; 467) 'S': S 1040 466..467 'S': S
1041 "### 1041 "###
1042 ); 1042 );
1043} 1043}
@@ -1062,24 +1062,24 @@ fn test() {
1062} 1062}
1063"#, true), 1063"#, true),
1064 @r###" 1064 @r###"
1065 [88; 92) 'self': F<T> 1065 88..92 'self': F<T>
1066 [94; 95) 'x': impl Trait 1066 94..95 'x': impl Trait
1067 [119; 130) '{ loop {} }': (T, U) 1067 119..130 '{ loop {} }': (T, U)
1068 [121; 128) 'loop {}': ! 1068 121..128 'loop {}': !
1069 [126; 128) '{}': () 1069 126..128 '{}': ()
1070 [144; 284) '{ ...ored }': () 1070 144..284 '{ ...ored }': ()
1071 [150; 151) 'F': F<{unknown}> 1071 150..151 'F': F<{unknown}>
1072 [150; 158) 'F.foo(S)': ({unknown}, {unknown}) 1072 150..158 'F.foo(S)': ({unknown}, {unknown})
1073 [156; 157) 'S': S 1073 156..157 'S': S
1074 [164; 172) 'F::<u32>': F<u32> 1074 164..172 'F::<u32>': F<u32>
1075 [164; 179) 'F::<u32>.foo(S)': (u32, {unknown}) 1075 164..179 'F::<u32>.foo(S)': (u32, {unknown})
1076 [177; 178) 'S': S 1076 177..178 'S': S
1077 [185; 193) 'F::<u32>': F<u32> 1077 185..193 'F::<u32>': F<u32>
1078 [185; 207) 'F::<u3...32>(S)': (u32, i32) 1078 185..207 'F::<u3...32>(S)': (u32, i32)
1079 [205; 206) 'S': S 1079 205..206 'S': S
1080 [213; 221) 'F::<u32>': F<u32> 1080 213..221 'F::<u32>': F<u32>
1081 [213; 240) 'F::<u3...32>(S)': (u32, i32) 1081 213..240 'F::<u3...32>(S)': (u32, i32)
1082 [238; 239) 'S': S 1082 238..239 'S': S
1083 "### 1083 "###
1084 ); 1084 );
1085} 1085}
@@ -1098,13 +1098,13 @@ fn test() {
1098} 1098}
1099"#, true), 1099"#, true),
1100 @r###" 1100 @r###"
1101 [23; 24) 'x': impl Trait 1101 23..24 'x': impl Trait
1102 [38; 49) '{ loop {} }': () 1102 38..49 '{ loop {} }': ()
1103 [40; 47) 'loop {}': ! 1103 40..47 'loop {}': !
1104 [45; 47) '{}': () 1104 45..47 '{}': ()
1105 [91; 124) '{ ...foo; }': () 1105 91..124 '{ ...foo; }': ()
1106 [101; 102) 'f': fn(S) 1106 101..102 'f': fn(S)
1107 [118; 121) 'foo': fn foo(S) 1107 118..121 'foo': fn foo(S)
1108 "### 1108 "###
1109 ); 1109 );
1110} 1110}
@@ -1133,29 +1133,29 @@ fn test(x: impl Trait<u64>, y: &impl Trait<u64>) {
1133} 1133}
1134"#), 1134"#),
1135 @r###" 1135 @r###"
1136 [30; 34) 'self': &Self 1136 30..34 'self': &Self
1137 [55; 59) 'self': &Self 1137 55..59 'self': &Self
1138 [99; 101) '{}': () 1138 99..101 '{}': ()
1139 [111; 112) 'x': impl Trait<u64> 1139 111..112 'x': impl Trait<u64>
1140 [131; 132) 'y': &impl Trait<u64> 1140 131..132 'y': &impl Trait<u64>
1141 [152; 269) '{ ...2(); }': () 1141 152..269 '{ ...2(); }': ()
1142 [158; 159) 'x': impl Trait<u64> 1142 158..159 'x': impl Trait<u64>
1143 [165; 166) 'y': &impl Trait<u64> 1143 165..166 'y': &impl Trait<u64>
1144 [176; 177) 'z': impl Trait<u64> 1144 176..177 'z': impl Trait<u64>
1145 [180; 183) 'bar': fn bar() -> impl Trait<u64> 1145 180..183 'bar': fn bar() -> impl Trait<u64>
1146 [180; 185) 'bar()': impl Trait<u64> 1146 180..185 'bar()': impl Trait<u64>
1147 [191; 192) 'x': impl Trait<u64> 1147 191..192 'x': impl Trait<u64>
1148 [191; 198) 'x.foo()': u64 1148 191..198 'x.foo()': u64
1149 [204; 205) 'y': &impl Trait<u64> 1149 204..205 'y': &impl Trait<u64>
1150 [204; 211) 'y.foo()': u64 1150 204..211 'y.foo()': u64
1151 [217; 218) 'z': impl Trait<u64> 1151 217..218 'z': impl Trait<u64>
1152 [217; 224) 'z.foo()': u64 1152 217..224 'z.foo()': u64
1153 [230; 231) 'x': impl Trait<u64> 1153 230..231 'x': impl Trait<u64>
1154 [230; 238) 'x.foo2()': i64 1154 230..238 'x.foo2()': i64
1155 [244; 245) 'y': &impl Trait<u64> 1155 244..245 'y': &impl Trait<u64>
1156 [244; 252) 'y.foo2()': i64 1156 244..252 'y.foo2()': i64
1157 [258; 259) 'z': impl Trait<u64> 1157 258..259 'z': impl Trait<u64>
1158 [258; 266) 'z.foo2()': i64 1158 258..266 'z.foo2()': i64
1159 "### 1159 "###
1160 ); 1160 );
1161} 1161}
@@ -1183,29 +1183,29 @@ fn test(x: dyn Trait<u64>, y: &dyn Trait<u64>) {
1183} 1183}
1184"#), 1184"#),
1185 @r###" 1185 @r###"
1186 [30; 34) 'self': &Self 1186 30..34 'self': &Self
1187 [55; 59) 'self': &Self 1187 55..59 'self': &Self
1188 [98; 100) '{}': () 1188 98..100 '{}': ()
1189 [110; 111) 'x': dyn Trait<u64> 1189 110..111 'x': dyn Trait<u64>
1190 [129; 130) 'y': &dyn Trait<u64> 1190 129..130 'y': &dyn Trait<u64>
1191 [149; 266) '{ ...2(); }': () 1191 149..266 '{ ...2(); }': ()
1192 [155; 156) 'x': dyn Trait<u64> 1192 155..156 'x': dyn Trait<u64>
1193 [162; 163) 'y': &dyn Trait<u64> 1193 162..163 'y': &dyn Trait<u64>
1194 [173; 174) 'z': dyn Trait<u64> 1194 173..174 'z': dyn Trait<u64>
1195 [177; 180) 'bar': fn bar() -> dyn Trait<u64> 1195 177..180 'bar': fn bar() -> dyn Trait<u64>
1196 [177; 182) 'bar()': dyn Trait<u64> 1196 177..182 'bar()': dyn Trait<u64>
1197 [188; 189) 'x': dyn Trait<u64> 1197 188..189 'x': dyn Trait<u64>
1198 [188; 195) 'x.foo()': u64 1198 188..195 'x.foo()': u64
1199 [201; 202) 'y': &dyn Trait<u64> 1199 201..202 'y': &dyn Trait<u64>
1200 [201; 208) 'y.foo()': u64 1200 201..208 'y.foo()': u64
1201 [214; 215) 'z': dyn Trait<u64> 1201 214..215 'z': dyn Trait<u64>
1202 [214; 221) 'z.foo()': u64 1202 214..221 'z.foo()': u64
1203 [227; 228) 'x': dyn Trait<u64> 1203 227..228 'x': dyn Trait<u64>
1204 [227; 235) 'x.foo2()': i64 1204 227..235 'x.foo2()': i64
1205 [241; 242) 'y': &dyn Trait<u64> 1205 241..242 'y': &dyn Trait<u64>
1206 [241; 249) 'y.foo2()': i64 1206 241..249 'y.foo2()': i64
1207 [255; 256) 'z': dyn Trait<u64> 1207 255..256 'z': dyn Trait<u64>
1208 [255; 263) 'z.foo2()': i64 1208 255..263 'z.foo2()': i64
1209 "### 1209 "###
1210 ); 1210 );
1211} 1211}
@@ -1231,17 +1231,17 @@ fn test(s: S<u32, i32>) {
1231} 1231}
1232"#), 1232"#),
1233 @r###" 1233 @r###"
1234 [33; 37) 'self': &Self 1234 33..37 'self': &Self
1235 [103; 107) 'self': &S<T, U> 1235 103..107 'self': &S<T, U>
1236 [129; 140) '{ loop {} }': &dyn Trait<T, U> 1236 129..140 '{ loop {} }': &dyn Trait<T, U>
1237 [131; 138) 'loop {}': ! 1237 131..138 'loop {}': !
1238 [136; 138) '{}': () 1238 136..138 '{}': ()
1239 [176; 180) 'self': &Self 1239 176..180 'self': &Self
1240 [252; 253) 's': S<u32, i32> 1240 252..253 's': S<u32, i32>
1241 [268; 290) '{ ...z(); }': () 1241 268..290 '{ ...z(); }': ()
1242 [274; 275) 's': S<u32, i32> 1242 274..275 's': S<u32, i32>
1243 [274; 281) 's.bar()': &dyn Trait<u32, i32> 1243 274..281 's.bar()': &dyn Trait<u32, i32>
1244 [274; 287) 's.bar().baz()': (u32, i32) 1244 274..287 's.bar().baz()': (u32, i32)
1245 "### 1245 "###
1246 ); 1246 );
1247} 1247}
@@ -1265,22 +1265,22 @@ fn test(x: Trait, y: &Trait) -> u64 {
1265} 1265}
1266"#), 1266"#),
1267 @r###" 1267 @r###"
1268 [27; 31) 'self': &Self 1268 27..31 'self': &Self
1269 [61; 63) '{}': () 1269 61..63 '{}': ()
1270 [73; 74) 'x': dyn Trait 1270 73..74 'x': dyn Trait
1271 [83; 84) 'y': &dyn Trait 1271 83..84 'y': &dyn Trait
1272 [101; 176) '{ ...o(); }': () 1272 101..176 '{ ...o(); }': ()
1273 [107; 108) 'x': dyn Trait 1273 107..108 'x': dyn Trait
1274 [114; 115) 'y': &dyn Trait 1274 114..115 'y': &dyn Trait
1275 [125; 126) 'z': dyn Trait 1275 125..126 'z': dyn Trait
1276 [129; 132) 'bar': fn bar() -> dyn Trait 1276 129..132 'bar': fn bar() -> dyn Trait
1277 [129; 134) 'bar()': dyn Trait 1277 129..134 'bar()': dyn Trait
1278 [140; 141) 'x': dyn Trait 1278 140..141 'x': dyn Trait
1279 [140; 147) 'x.foo()': u64 1279 140..147 'x.foo()': u64
1280 [153; 154) 'y': &dyn Trait 1280 153..154 'y': &dyn Trait
1281 [153; 160) 'y.foo()': u64 1281 153..160 'y.foo()': u64
1282 [166; 167) 'z': dyn Trait 1282 166..167 'z': dyn Trait
1283 [166; 173) 'z.foo()': u64 1283 166..173 'z.foo()': u64
1284 "### 1284 "###
1285 ); 1285 );
1286} 1286}
@@ -1294,13 +1294,13 @@ fn test(a: impl Trait + 'lifetime, b: impl 'lifetime, c: impl (Trait), d: impl (
1294} 1294}
1295"#), 1295"#),
1296 @r###" 1296 @r###"
1297 [24; 25) 'a': impl Trait + {error} 1297 24..25 'a': impl Trait + {error}
1298 [51; 52) 'b': impl {error} 1298 51..52 'b': impl {error}
1299 [70; 71) 'c': impl Trait 1299 70..71 'c': impl Trait
1300 [87; 88) 'd': impl {error} 1300 87..88 'd': impl {error}
1301 [108; 109) 'e': impl {error} 1301 108..109 'e': impl {error}
1302 [124; 125) 'f': impl Trait + {error} 1302 124..125 'f': impl Trait + {error}
1303 [148; 151) '{ }': () 1303 148..151 '{ }': ()
1304 "### 1304 "###
1305 ); 1305 );
1306} 1306}
@@ -1349,41 +1349,41 @@ fn test<T: Trait<Type = u32>>(x: T, y: impl Trait<Type = i64>) {
1349} 1349}
1350"#), 1350"#),
1351 @r###" 1351 @r###"
1352 [50; 51) 't': T 1352 50..51 't': T
1353 [78; 80) '{}': () 1353 78..80 '{}': ()
1354 [112; 113) 't': T 1354 112..113 't': T
1355 [123; 125) '{}': () 1355 123..125 '{}': ()
1356 [155; 156) 't': T 1356 155..156 't': T
1357 [166; 169) '{t}': T 1357 166..169 '{t}': T
1358 [167; 168) 't': T 1358 167..168 't': T
1359 [257; 258) 'x': T 1359 257..258 'x': T
1360 [263; 264) 'y': impl Trait<Type = i64> 1360 263..264 'y': impl Trait<Type = i64>
1361 [290; 398) '{ ...r>); }': () 1361 290..398 '{ ...r>); }': ()
1362 [296; 299) 'get': fn get<T>(T) -> <T as Trait>::Type 1362 296..299 'get': fn get<T>(T) -> <T as Trait>::Type
1363 [296; 302) 'get(x)': u32 1363 296..302 'get(x)': u32
1364 [300; 301) 'x': T 1364 300..301 'x': T
1365 [308; 312) 'get2': fn get2<u32, T>(T) -> u32 1365 308..312 'get2': fn get2<u32, T>(T) -> u32
1366 [308; 315) 'get2(x)': u32 1366 308..315 'get2(x)': u32
1367 [313; 314) 'x': T 1367 313..314 'x': T
1368 [321; 324) 'get': fn get<impl Trait<Type = i64>>(impl Trait<Type = i64>) -> <impl Trait<Type = i64> as Trait>::Type 1368 321..324 'get': fn get<impl Trait<Type = i64>>(impl Trait<Type = i64>) -> <impl Trait<Type = i64> as Trait>::Type
1369 [321; 327) 'get(y)': i64 1369 321..327 'get(y)': i64
1370 [325; 326) 'y': impl Trait<Type = i64> 1370 325..326 'y': impl Trait<Type = i64>
1371 [333; 337) 'get2': fn get2<i64, impl Trait<Type = i64>>(impl Trait<Type = i64>) -> i64 1371 333..337 'get2': fn get2<i64, impl Trait<Type = i64>>(impl Trait<Type = i64>) -> i64
1372 [333; 340) 'get2(y)': i64 1372 333..340 'get2(y)': i64
1373 [338; 339) 'y': impl Trait<Type = i64> 1373 338..339 'y': impl Trait<Type = i64>
1374 [346; 349) 'get': fn get<S<u64>>(S<u64>) -> <S<u64> as Trait>::Type 1374 346..349 'get': fn get<S<u64>>(S<u64>) -> <S<u64> as Trait>::Type
1375 [346; 357) 'get(set(S))': u64 1375 346..357 'get(set(S))': u64
1376 [350; 353) 'set': fn set<S<u64>>(S<u64>) -> S<u64> 1376 350..353 'set': fn set<S<u64>>(S<u64>) -> S<u64>
1377 [350; 356) 'set(S)': S<u64> 1377 350..356 'set(S)': S<u64>
1378 [354; 355) 'S': S<u64> 1378 354..355 'S': S<u64>
1379 [363; 367) 'get2': fn get2<u64, S<u64>>(S<u64>) -> u64 1379 363..367 'get2': fn get2<u64, S<u64>>(S<u64>) -> u64
1380 [363; 375) 'get2(set(S))': u64 1380 363..375 'get2(set(S))': u64
1381 [368; 371) 'set': fn set<S<u64>>(S<u64>) -> S<u64> 1381 368..371 'set': fn set<S<u64>>(S<u64>) -> S<u64>
1382 [368; 374) 'set(S)': S<u64> 1382 368..374 'set(S)': S<u64>
1383 [372; 373) 'S': S<u64> 1383 372..373 'S': S<u64>
1384 [381; 385) 'get2': fn get2<str, S<str>>(S<str>) -> str 1384 381..385 'get2': fn get2<str, S<str>>(S<str>) -> str
1385 [381; 395) 'get2(S::<str>)': str 1385 381..395 'get2(S::<str>)': str
1386 [386; 394) 'S::<str>': S<str> 1386 386..394 'S::<str>': S<str>
1387 "### 1387 "###
1388 ); 1388 );
1389} 1389}
@@ -1448,11 +1448,11 @@ fn test<T: Trait1<Type = u32>>(x: T) {
1448} 1448}
1449"#), 1449"#),
1450 @r###" 1450 @r###"
1451 [62; 66) 'self': Self 1451 62..66 'self': Self
1452 [164; 165) 'x': T 1452 164..165 'x': T
1453 [170; 186) '{ ...o(); }': () 1453 170..186 '{ ...o(); }': ()
1454 [176; 177) 'x': T 1454 176..177 'x': T
1455 [176; 183) 'x.foo()': u32 1455 176..183 'x.foo()': u32
1456 "### 1456 "###
1457 ); 1457 );
1458} 1458}
@@ -1494,15 +1494,15 @@ fn test<T: Trait1, U: Trait2>(x: T, y: U) {
1494} 1494}
1495"#), 1495"#),
1496 @r###" 1496 @r###"
1497 [50; 54) 'self': &Self 1497 50..54 'self': &Self
1498 [63; 65) '{}': () 1498 63..65 '{}': ()
1499 [182; 183) 'x': T 1499 182..183 'x': T
1500 [188; 189) 'y': U 1500 188..189 'y': U
1501 [194; 223) '{ ...o(); }': () 1501 194..223 '{ ...o(); }': ()
1502 [200; 201) 'x': T 1502 200..201 'x': T
1503 [200; 207) 'x.foo()': u32 1503 200..207 'x.foo()': u32
1504 [213; 214) 'y': U 1504 213..214 'y': U
1505 [213; 220) 'y.foo()': u32 1505 213..220 'y.foo()': u32
1506 "### 1506 "###
1507 ); 1507 );
1508} 1508}
@@ -1523,12 +1523,12 @@ fn test(x: &impl Trait1) {
1523} 1523}
1524"#), 1524"#),
1525 @r###" 1525 @r###"
1526 [50; 54) 'self': &Self 1526 50..54 'self': &Self
1527 [63; 65) '{}': () 1527 63..65 '{}': ()
1528 [116; 117) 'x': &impl Trait1 1528 116..117 'x': &impl Trait1
1529 [133; 149) '{ ...o(); }': () 1529 133..149 '{ ...o(); }': ()
1530 [139; 140) 'x': &impl Trait1 1530 139..140 'x': &impl Trait1
1531 [139; 146) 'x.foo()': u32 1531 139..146 'x.foo()': u32
1532 "### 1532 "###
1533 ); 1533 );
1534} 1534}
@@ -1546,10 +1546,10 @@ fn test<T: A>(x: T) {
1546} 1546}
1547"#), 1547"#),
1548 @r###" 1548 @r###"
1549 [44; 45) 'x': T 1549 44..45 'x': T
1550 [50; 66) '{ ...o(); }': () 1550 50..66 '{ ...o(); }': ()
1551 [56; 57) 'x': T 1551 56..57 'x': T
1552 [56; 63) 'x.foo()': {unknown} 1552 56..63 'x.foo()': {unknown}
1553 "### 1553 "###
1554 ); 1554 );
1555} 1555}
@@ -1573,17 +1573,17 @@ fn test() {
1573} 1573}
1574"#), 1574"#),
1575 @r###" 1575 @r###"
1576 [103; 104) 't': T 1576 103..104 't': T
1577 [114; 116) '{}': () 1577 114..116 '{}': ()
1578 [146; 147) 't': T 1578 146..147 't': T
1579 [157; 160) '{t}': T 1579 157..160 '{t}': T
1580 [158; 159) 't': T 1580 158..159 't': T
1581 [259; 280) '{ ...S)); }': () 1581 259..280 '{ ...S)); }': ()
1582 [265; 269) 'get2': fn get2<u64, S<u64>>(S<u64>) -> u64 1582 265..269 'get2': fn get2<u64, S<u64>>(S<u64>) -> u64
1583 [265; 277) 'get2(set(S))': u64 1583 265..277 'get2(set(S))': u64
1584 [270; 273) 'set': fn set<S<u64>>(S<u64>) -> S<u64> 1584 270..273 'set': fn set<S<u64>>(S<u64>) -> S<u64>
1585 [270; 276) 'set(S)': S<u64> 1585 270..276 'set(S)': S<u64>
1586 [274; 275) 'S': S<u64> 1586 274..275 'S': S<u64>
1587 "### 1587 "###
1588 ); 1588 );
1589} 1589}
@@ -1603,15 +1603,15 @@ fn test<F: FnOnce(u32, u64) -> u128>(f: F) {
1603} 1603}
1604"#), 1604"#),
1605 @r###" 1605 @r###"
1606 [57; 61) 'self': Self 1606 57..61 'self': Self
1607 [63; 67) 'args': Args 1607 63..67 'args': Args
1608 [150; 151) 'f': F 1608 150..151 'f': F
1609 [156; 184) '{ ...2)); }': () 1609 156..184 '{ ...2)); }': ()
1610 [162; 163) 'f': F 1610 162..163 'f': F
1611 [162; 181) 'f.call...1, 2))': u128 1611 162..181 'f.call...1, 2))': u128
1612 [174; 180) '(1, 2)': (u32, u64) 1612 174..180 '(1, 2)': (u32, u64)
1613 [175; 176) '1': u32 1613 175..176 '1': u32
1614 [178; 179) '2': u64 1614 178..179 '2': u64
1615 "### 1615 "###
1616 ); 1616 );
1617} 1617}
@@ -1638,32 +1638,32 @@ fn test() {
1638} 1638}
1639"#), 1639"#),
1640 @r###" 1640 @r###"
1641 [148; 152) 'self': Option<T> 1641 148..152 'self': Option<T>
1642 [154; 155) 'f': F 1642 154..155 'f': F
1643 [173; 175) '{}': () 1643 173..175 '{}': ()
1644 [189; 308) '{ ... 1); }': () 1644 189..308 '{ ... 1); }': ()
1645 [199; 200) 'x': Option<u32> 1645 199..200 'x': Option<u32>
1646 [203; 215) 'Option::Some': Some<u32>(u32) -> Option<u32> 1646 203..215 'Option::Some': Some<u32>(u32) -> Option<u32>
1647 [203; 221) 'Option...(1u32)': Option<u32> 1647 203..221 'Option...(1u32)': Option<u32>
1648 [216; 220) '1u32': u32 1648 216..220 '1u32': u32
1649 [227; 228) 'x': Option<u32> 1649 227..228 'x': Option<u32>
1650 [227; 243) 'x.map(...v + 1)': Option<u32> 1650 227..243 'x.map(...v + 1)': Option<u32>
1651 [233; 242) '|v| v + 1': |u32| -> u32 1651 233..242 '|v| v + 1': |u32| -> u32
1652 [234; 235) 'v': u32 1652 234..235 'v': u32
1653 [237; 238) 'v': u32 1653 237..238 'v': u32
1654 [237; 242) 'v + 1': u32 1654 237..242 'v + 1': u32
1655 [241; 242) '1': u32 1655 241..242 '1': u32
1656 [249; 250) 'x': Option<u32> 1656 249..250 'x': Option<u32>
1657 [249; 265) 'x.map(... 1u64)': Option<u64> 1657 249..265 'x.map(... 1u64)': Option<u64>
1658 [255; 264) '|_v| 1u64': |u32| -> u64 1658 255..264 '|_v| 1u64': |u32| -> u64
1659 [256; 258) '_v': u32 1659 256..258 '_v': u32
1660 [260; 264) '1u64': u64 1660 260..264 '1u64': u64
1661 [275; 276) 'y': Option<i64> 1661 275..276 'y': Option<i64>
1662 [292; 293) 'x': Option<u32> 1662 292..293 'x': Option<u32>
1663 [292; 305) 'x.map(|_v| 1)': Option<i64> 1663 292..305 'x.map(|_v| 1)': Option<i64>
1664 [298; 304) '|_v| 1': |u32| -> i64 1664 298..304 '|_v| 1': |u32| -> i64
1665 [299; 301) '_v': u32 1665 299..301 '_v': u32
1666 [303; 304) '1': i64 1666 303..304 '1': i64
1667 "### 1667 "###
1668 ); 1668 );
1669} 1669}
@@ -1684,26 +1684,26 @@ fn test<F: FnOnce(u32) -> u64>(f: F) {
1684} 1684}
1685"#), 1685"#),
1686 @r###" 1686 @r###"
1687 [73; 74) 'f': F 1687 73..74 'f': F
1688 [79; 155) '{ ...+ v; }': () 1688 79..155 '{ ...+ v; }': ()
1689 [85; 86) 'f': F 1689 85..86 'f': F
1690 [85; 89) 'f(1)': {unknown} 1690 85..89 'f(1)': {unknown}
1691 [87; 88) '1': i32 1691 87..88 '1': i32
1692 [99; 100) 'g': |u64| -> i32 1692 99..100 'g': |u64| -> i32
1693 [103; 112) '|v| v + 1': |u64| -> i32 1693 103..112 '|v| v + 1': |u64| -> i32
1694 [104; 105) 'v': u64 1694 104..105 'v': u64
1695 [107; 108) 'v': u64 1695 107..108 'v': u64
1696 [107; 112) 'v + 1': i32 1696 107..112 'v + 1': i32
1697 [111; 112) '1': i32 1697 111..112 '1': i32
1698 [118; 119) 'g': |u64| -> i32 1698 118..119 'g': |u64| -> i32
1699 [118; 125) 'g(1u64)': i32 1699 118..125 'g(1u64)': i32
1700 [120; 124) '1u64': u64 1700 120..124 '1u64': u64
1701 [135; 136) 'h': |u128| -> u128 1701 135..136 'h': |u128| -> u128
1702 [139; 152) '|v| 1u128 + v': |u128| -> u128 1702 139..152 '|v| 1u128 + v': |u128| -> u128
1703 [140; 141) 'v': u128 1703 140..141 'v': u128
1704 [143; 148) '1u128': u128 1704 143..148 '1u128': u128
1705 [143; 152) '1u128 + v': u128 1705 143..152 '1u128 + v': u128
1706 [151; 152) 'v': u128 1706 151..152 'v': u128
1707 "### 1707 "###
1708 ); 1708 );
1709} 1709}
@@ -1736,54 +1736,54 @@ fn test() {
1736} 1736}
1737"#), 1737"#),
1738 @r###" 1738 @r###"
1739 [95; 96) 'x': T 1739 95..96 'x': T
1740 [101; 102) 'f': F 1740 101..102 'f': F
1741 [112; 114) '{}': () 1741 112..114 '{}': ()
1742 [148; 149) 'f': F 1742 148..149 'f': F
1743 [154; 155) 'x': T 1743 154..155 'x': T
1744 [165; 167) '{}': () 1744 165..167 '{}': ()
1745 [202; 206) 'self': S 1745 202..206 'self': S
1746 [254; 258) 'self': S 1746 254..258 'self': S
1747 [260; 261) 'x': T 1747 260..261 'x': T
1748 [266; 267) 'f': F 1748 266..267 'f': F
1749 [277; 279) '{}': () 1749 277..279 '{}': ()
1750 [317; 321) 'self': S 1750 317..321 'self': S
1751 [323; 324) 'f': F 1751 323..324 'f': F
1752 [329; 330) 'x': T 1752 329..330 'x': T
1753 [340; 342) '{}': () 1753 340..342 '{}': ()
1754 [356; 515) '{ ... S); }': () 1754 356..515 '{ ... S); }': ()
1755 [366; 368) 'x1': u64 1755 366..368 'x1': u64
1756 [371; 375) 'foo1': fn foo1<S, u64, |S| -> u64>(S, |S| -> u64) -> u64 1756 371..375 'foo1': fn foo1<S, u64, |S| -> u64>(S, |S| -> u64) -> u64
1757 [371; 394) 'foo1(S...hod())': u64 1757 371..394 'foo1(S...hod())': u64
1758 [376; 377) 'S': S 1758 376..377 'S': S
1759 [379; 393) '|s| s.method()': |S| -> u64 1759 379..393 '|s| s.method()': |S| -> u64
1760 [380; 381) 's': S 1760 380..381 's': S
1761 [383; 384) 's': S 1761 383..384 's': S
1762 [383; 393) 's.method()': u64 1762 383..393 's.method()': u64
1763 [404; 406) 'x2': u64 1763 404..406 'x2': u64
1764 [409; 413) 'foo2': fn foo2<S, u64, |S| -> u64>(|S| -> u64, S) -> u64 1764 409..413 'foo2': fn foo2<S, u64, |S| -> u64>(|S| -> u64, S) -> u64
1765 [409; 432) 'foo2(|...(), S)': u64 1765 409..432 'foo2(|...(), S)': u64
1766 [414; 428) '|s| s.method()': |S| -> u64 1766 414..428 '|s| s.method()': |S| -> u64
1767 [415; 416) 's': S 1767 415..416 's': S
1768 [418; 419) 's': S 1768 418..419 's': S
1769 [418; 428) 's.method()': u64 1769 418..428 's.method()': u64
1770 [430; 431) 'S': S 1770 430..431 'S': S
1771 [442; 444) 'x3': u64 1771 442..444 'x3': u64
1772 [447; 448) 'S': S 1772 447..448 'S': S
1773 [447; 472) 'S.foo1...hod())': u64 1773 447..472 'S.foo1...hod())': u64
1774 [454; 455) 'S': S 1774 454..455 'S': S
1775 [457; 471) '|s| s.method()': |S| -> u64 1775 457..471 '|s| s.method()': |S| -> u64
1776 [458; 459) 's': S 1776 458..459 's': S
1777 [461; 462) 's': S 1777 461..462 's': S
1778 [461; 471) 's.method()': u64 1778 461..471 's.method()': u64
1779 [482; 484) 'x4': u64 1779 482..484 'x4': u64
1780 [487; 488) 'S': S 1780 487..488 'S': S
1781 [487; 512) 'S.foo2...(), S)': u64 1781 487..512 'S.foo2...(), S)': u64
1782 [494; 508) '|s| s.method()': |S| -> u64 1782 494..508 '|s| s.method()': |S| -> u64
1783 [495; 496) 's': S 1783 495..496 's': S
1784 [498; 499) 's': S 1784 498..499 's': S
1785 [498; 508) 's.method()': u64 1785 498..508 's.method()': u64
1786 [510; 511) 'S': S 1786 510..511 'S': S
1787 "### 1787 "###
1788 ); 1788 );
1789} 1789}
@@ -1858,18 +1858,18 @@ impl Trait for S2 {
1858} 1858}
1859"#, 1859"#,
1860 ), @r###" 1860 ), @r###"
1861 [54; 58) 'self': &Self 1861 54..58 'self': &Self
1862 [60; 61) 'x': Trait::Item<Self> 1862 60..61 'x': Trait::Item<Self>
1863 [140; 144) 'self': &S 1863 140..144 'self': &S
1864 [146; 147) 'x': u32 1864 146..147 'x': u32
1865 [161; 175) '{ let y = x; }': () 1865 161..175 '{ let y = x; }': ()
1866 [167; 168) 'y': u32 1866 167..168 'y': u32
1867 [171; 172) 'x': u32 1867 171..172 'x': u32
1868 [242; 246) 'self': &S2 1868 242..246 'self': &S2
1869 [248; 249) 'x': i32 1869 248..249 'x': i32
1870 [265; 279) '{ let y = x; }': () 1870 265..279 '{ let y = x; }': ()
1871 [271; 272) 'y': i32 1871 271..272 'y': i32
1872 [275; 276) 'x': i32 1872 275..276 'x': i32
1873 "###); 1873 "###);
1874} 1874}
1875 1875
@@ -2077,15 +2077,15 @@ impl TokenStream for Rustc {
2077} 2077}
2078"#, true), 2078"#, true),
2079 @r###" 2079 @r###"
2080 [1115; 1126) '{ loop {} }': T 2080 1115..1126 '{ loop {} }': T
2081 [1117; 1124) 'loop {}': ! 2081 1117..1124 'loop {}': !
2082 [1122; 1124) '{}': () 2082 1122..1124 '{}': ()
2083 [1190; 1253) '{ ... }': {unknown} 2083 1190..1253 '{ ... }': {unknown}
2084 [1204; 1209) 'group': {unknown} 2084 1204..1209 'group': {unknown}
2085 [1225; 1229) 'make': fn make<{unknown}>() -> {unknown} 2085 1225..1229 'make': fn make<{unknown}>() -> {unknown}
2086 [1225; 1231) 'make()': {unknown} 2086 1225..1231 'make()': {unknown}
2087 [1241; 1245) 'make': fn make<{unknown}>() -> {unknown} 2087 1241..1245 'make': fn make<{unknown}>() -> {unknown}
2088 [1241; 1247) 'make()': {unknown} 2088 1241..1247 'make()': {unknown}
2089 "### 2089 "###
2090 ); 2090 );
2091} 2091}
@@ -2112,37 +2112,37 @@ fn test() -> impl Trait<i32> {
2112} 2112}
2113"#, true), 2113"#, true),
2114 @r###" 2114 @r###"
2115 [27; 28) 'x': impl Trait<u32> 2115 27..28 'x': impl Trait<u32>
2116 [47; 58) '{ loop {} }': () 2116 47..58 '{ loop {} }': ()
2117 [49; 56) 'loop {}': ! 2117 49..56 'loop {}': !
2118 [54; 56) '{}': () 2118 54..56 '{}': ()
2119 [69; 70) 'x': impl Trait<T> 2119 69..70 'x': impl Trait<T>
2120 [92; 103) '{ loop {} }': T 2120 92..103 '{ loop {} }': T
2121 [94; 101) 'loop {}': ! 2121 94..101 'loop {}': !
2122 [99; 101) '{}': () 2122 99..101 '{}': ()
2123 [172; 183) '{ loop {} }': T 2123 172..183 '{ loop {} }': T
2124 [174; 181) 'loop {}': ! 2124 174..181 'loop {}': !
2125 [179; 181) '{}': () 2125 179..181 '{}': ()
2126 [214; 310) '{ ...t()) }': S<{unknown}> 2126 214..310 '{ ...t()) }': S<{unknown}>
2127 [224; 226) 's1': S<u32> 2127 224..226 's1': S<u32>
2128 [229; 230) 'S': S<u32>(u32) -> S<u32> 2128 229..230 'S': S<u32>(u32) -> S<u32>
2129 [229; 241) 'S(default())': S<u32> 2129 229..241 'S(default())': S<u32>
2130 [231; 238) 'default': fn default<u32>() -> u32 2130 231..238 'default': fn default<u32>() -> u32
2131 [231; 240) 'default()': u32 2131 231..240 'default()': u32
2132 [247; 250) 'foo': fn foo(S<u32>) 2132 247..250 'foo': fn foo(S<u32>)
2133 [247; 254) 'foo(s1)': () 2133 247..254 'foo(s1)': ()
2134 [251; 253) 's1': S<u32> 2134 251..253 's1': S<u32>
2135 [264; 265) 'x': i32 2135 264..265 'x': i32
2136 [273; 276) 'bar': fn bar<i32>(S<i32>) -> i32 2136 273..276 'bar': fn bar<i32>(S<i32>) -> i32
2137 [273; 290) 'bar(S(...lt()))': i32 2137 273..290 'bar(S(...lt()))': i32
2138 [277; 278) 'S': S<i32>(i32) -> S<i32> 2138 277..278 'S': S<i32>(i32) -> S<i32>
2139 [277; 289) 'S(default())': S<i32> 2139 277..289 'S(default())': S<i32>
2140 [279; 286) 'default': fn default<i32>() -> i32 2140 279..286 'default': fn default<i32>() -> i32
2141 [279; 288) 'default()': i32 2141 279..288 'default()': i32
2142 [296; 297) 'S': S<{unknown}>({unknown}) -> S<{unknown}> 2142 296..297 'S': S<{unknown}>({unknown}) -> S<{unknown}>
2143 [296; 308) 'S(default())': S<{unknown}> 2143 296..308 'S(default())': S<{unknown}>
2144 [298; 305) 'default': fn default<{unknown}>() -> {unknown} 2144 298..305 'default': fn default<{unknown}>() -> {unknown}
2145 [298; 307) 'default()': {unknown} 2145 298..307 'default()': {unknown}
2146 "### 2146 "###
2147 ); 2147 );
2148} 2148}
@@ -2176,15 +2176,15 @@ fn main() {
2176} 2176}
2177"#), 2177"#),
2178 @r###" 2178 @r###"
2179 [147; 149) '_v': F 2179 147..149 '_v': F
2180 [192; 195) '{ }': () 2180 192..195 '{ }': ()
2181 [207; 238) '{ ... }); }': () 2181 207..238 '{ ... }); }': ()
2182 [213; 223) 'f::<(), _>': fn f<(), |&()| -> ()>(|&()| -> ()) 2182 213..223 'f::<(), _>': fn f<(), |&()| -> ()>(|&()| -> ())
2183 [213; 235) 'f::<()... z; })': () 2183 213..235 'f::<()... z; })': ()
2184 [224; 234) '|z| { z; }': |&()| -> () 2184 224..234 '|z| { z; }': |&()| -> ()
2185 [225; 226) 'z': &() 2185 225..226 'z': &()
2186 [228; 234) '{ z; }': () 2186 228..234 '{ z; }': ()
2187 [230; 231) 'z': &() 2187 230..231 'z': &()
2188 "### 2188 "###
2189 ); 2189 );
2190} 2190}
@@ -2337,46 +2337,46 @@ fn main() {
2337} 2337}
2338"#), 2338"#),
2339 @r###" 2339 @r###"
2340 [240; 244) 'self': Self 2340 240..244 'self': Self
2341 [246; 247) 'f': F 2341 246..247 'f': F
2342 [331; 342) '{ loop {} }': FilterMap<Self, F> 2342 331..342 '{ loop {} }': FilterMap<Self, F>
2343 [333; 340) 'loop {}': ! 2343 333..340 'loop {}': !
2344 [338; 340) '{}': () 2344 338..340 '{}': ()
2345 [363; 367) 'self': Self 2345 363..367 'self': Self
2346 [369; 370) 'f': F 2346 369..370 'f': F
2347 [419; 430) '{ loop {} }': () 2347 419..430 '{ loop {} }': ()
2348 [421; 428) 'loop {}': ! 2348 421..428 'loop {}': !
2349 [426; 428) '{}': () 2349 426..428 '{}': ()
2350 [539; 543) 'self': Self 2350 539..543 'self': Self
2351 [868; 872) 'self': I 2351 868..872 'self': I
2352 [879; 899) '{ ... }': I 2352 879..899 '{ ... }': I
2353 [889; 893) 'self': I 2353 889..893 'self': I
2354 [958; 969) '{ loop {} }': Vec<T> 2354 958..969 '{ loop {} }': Vec<T>
2355 [960; 967) 'loop {}': ! 2355 960..967 'loop {}': !
2356 [965; 967) '{}': () 2356 965..967 '{}': ()
2357 [1156; 1287) '{ ... }); }': () 2357 1156..1287 '{ ... }); }': ()
2358 [1162; 1177) 'Vec::<i32>::new': fn new<i32>() -> Vec<i32> 2358 1162..1177 'Vec::<i32>::new': fn new<i32>() -> Vec<i32>
2359 [1162; 1179) 'Vec::<...:new()': Vec<i32> 2359 1162..1179 'Vec::<...:new()': Vec<i32>
2360 [1162; 1191) 'Vec::<...iter()': IntoIter<i32> 2360 1162..1191 'Vec::<...iter()': IntoIter<i32>
2361 [1162; 1256) 'Vec::<...one })': FilterMap<IntoIter<i32>, |i32| -> Option<u32>> 2361 1162..1256 'Vec::<...one })': FilterMap<IntoIter<i32>, |i32| -> Option<u32>>
2362 [1162; 1284) 'Vec::<... y; })': () 2362 1162..1284 'Vec::<... y; })': ()
2363 [1210; 1255) '|x| if...None }': |i32| -> Option<u32> 2363 1210..1255 '|x| if...None }': |i32| -> Option<u32>
2364 [1211; 1212) 'x': i32 2364 1211..1212 'x': i32
2365 [1214; 1255) 'if x >...None }': Option<u32> 2365 1214..1255 'if x >...None }': Option<u32>
2366 [1217; 1218) 'x': i32 2366 1217..1218 'x': i32
2367 [1217; 1222) 'x > 0': bool 2367 1217..1222 'x > 0': bool
2368 [1221; 1222) '0': i32 2368 1221..1222 '0': i32
2369 [1223; 1241) '{ Some...u32) }': Option<u32> 2369 1223..1241 '{ Some...u32) }': Option<u32>
2370 [1225; 1229) 'Some': Some<u32>(u32) -> Option<u32> 2370 1225..1229 'Some': Some<u32>(u32) -> Option<u32>
2371 [1225; 1239) 'Some(x as u32)': Option<u32> 2371 1225..1239 'Some(x as u32)': Option<u32>
2372 [1230; 1231) 'x': i32 2372 1230..1231 'x': i32
2373 [1230; 1238) 'x as u32': u32 2373 1230..1238 'x as u32': u32
2374 [1247; 1255) '{ None }': Option<u32> 2374 1247..1255 '{ None }': Option<u32>
2375 [1249; 1253) 'None': Option<u32> 2375 1249..1253 'None': Option<u32>
2376 [1273; 1283) '|y| { y; }': |u32| -> () 2376 1273..1283 '|y| { y; }': |u32| -> ()
2377 [1274; 1275) 'y': u32 2377 1274..1275 'y': u32
2378 [1277; 1283) '{ y; }': () 2378 1277..1283 '{ y; }': ()
2379 [1279; 1280) 'y': u32 2379 1279..1280 'y': u32
2380 "### 2380 "###
2381 ); 2381 );
2382} 2382}
@@ -2428,13 +2428,13 @@ fn test(x: &dyn Foo) {
2428} 2428}
2429"#, true), 2429"#, true),
2430 @r###" 2430 @r###"
2431 [22; 23) 'x': &dyn Foo 2431 22..23 'x': &dyn Foo
2432 [35; 37) '{}': () 2432 35..37 '{}': ()
2433 [47; 48) 'x': &dyn Foo 2433 47..48 'x': &dyn Foo
2434 [60; 75) '{ foo(x); }': () 2434 60..75 '{ foo(x); }': ()
2435 [66; 69) 'foo': fn foo(&dyn Foo) 2435 66..69 'foo': fn foo(&dyn Foo)
2436 [66; 72) 'foo(x)': () 2436 66..72 'foo(x)': ()
2437 [70; 71) 'x': &dyn Foo 2437 70..71 'x': &dyn Foo
2438 "### 2438 "###
2439 ); 2439 );
2440} 2440}
diff --git a/crates/ra_ide/src/assists.rs b/crates/ra_ide/src/assists.rs
index 40d56a4f7..2b5d11681 100644
--- a/crates/ra_ide/src/assists.rs
+++ b/crates/ra_ide/src/assists.rs
@@ -37,6 +37,10 @@ fn action_to_edit(
37 file_id: FileId, 37 file_id: FileId,
38 assist_label: &AssistLabel, 38 assist_label: &AssistLabel,
39) -> SourceChange { 39) -> SourceChange {
40 let file_id = match action.file {
41 ra_assists::AssistFile::TargetFile(it) => it,
42 _ => file_id,
43 };
40 let file_edit = SourceFileEdit { file_id, edit: action.edit }; 44 let file_edit = SourceFileEdit { file_id, edit: action.edit };
41 SourceChange::source_file_edit(assist_label.label.clone(), file_edit) 45 SourceChange::source_file_edit(assist_label.label.clone(), file_edit)
42 .with_cursor_opt(action.cursor_position.map(|offset| FilePosition { offset, file_id })) 46 .with_cursor_opt(action.cursor_position.map(|offset| FilePosition { offset, file_id }))
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs
index b00b6d431..85d1f0cb1 100644
--- a/crates/ra_ide/src/call_hierarchy.rs
+++ b/crates/ra_ide/src/call_hierarchy.rs
@@ -183,8 +183,8 @@ mod tests {
183 call<|>ee(); 183 call<|>ee();
184 } 184 }
185 "#, 185 "#,
186 "callee FN_DEF FileId(1) [0; 14) [3; 9)", 186 "callee FN_DEF FileId(1) 0..14 3..9",
187 &["caller FN_DEF FileId(1) [15; 44) [18; 24) : [[33