rust-analyzer/crates/ide/src
Francis McKenzie e77752eaf0 Fix for #17497 - Invalid RA diagnostic error: expected 2 arguments, found 1
The issue occurs because in some configurations of traits where one of them has Deref as a supertrait, RA's type inference algorithm fails to resolve the Deref::Target type, and instead uses a TyKind::BoundVar (i.e. an unknown type). This "autoderefed" type then incorrectly acts as if it implements all traits in scope.

The fix is to re-apply the same sanity-check that is done in iterate_method_candidates_with_autoref(), that is: don't try to resolve methods on unknown types. This same sanity-check is now done on each autoderefed type for which trait methods are about to be checked. If the autoderefed type is unknown, then the iterating of the trait methods for that type is skipped.

Includes a unit test that only passes after applying the fixes in this commit.

Includes a change to the assertion count in test syntax_highlighting::tests::benchmark_syntax_highlighting_parser as suggested by Lukas Wirth during review.

Includes a change to the sanity-check code as suggested by Florian Diebold during review.
2024-07-28 00:32:37 +08:00
..
annotations Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
doc_links Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
hover Update test fixtures 2024-07-18 09:09:31 +02:00
inlay_hints internal: Shrink size of Binding 2024-07-22 17:14:17 +02:00
syntax_highlighting Fix for #17497 - Invalid RA diagnostic error: expected 2 arguments, found 1 2024-07-28 00:32:37 +08:00
typing Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
annotations.rs Update test fixtures 2024-07-18 09:09:31 +02:00
call_hierarchy.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
doc_links.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
expand_macro.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
extend_selection.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
fetch_crates.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
file_structure.rs fix: Allow flyimport to import primitive shadowing modules 2024-07-21 13:26:19 +02:00
fixture.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
folding_ranges.rs internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros 2024-04-14 16:02:38 +02:00
goto_declaration.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
goto_definition.rs internal: move NavigationTarget::from_expr to goto_definition 2024-07-20 01:58:51 +08:00
goto_implementation.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
goto_type_definition.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
highlight_related.rs internal: move NavigationTarget::from_expr to goto_definition 2024-07-20 01:58:51 +08:00
hover.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
inlay_hints.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
interpret_function.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
join_lines.rs internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros 2024-04-14 16:02:38 +02:00
lib.rs Reduce maximum LRU size to 2^16 entries, reducing memory footprint of LRU entries 2024-07-19 17:48:12 +02:00
markdown_remove.rs Auto merge of #16155 - Waqar144:work/fix-16142, r=lnicola 2023-12-19 07:22:46 +00:00
markup.rs feat: Hover for literals showing additional value information 2024-01-16 14:28:47 +01:00
matching_brace.rs internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros 2024-04-14 16:02:38 +02:00
moniker.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
move_item.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
navigation_target.rs internal: move NavigationTarget::from_expr to goto_definition 2024-07-20 01:58:51 +08:00
parent_module.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
references.rs fix: sort references in tests 2024-07-20 01:55:55 +08:00
rename.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
runnables.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
shuffle_crate_graph.rs fix: Split toolchain and datalayout out of CrateData 2024-02-16 14:48:25 +01:00
signature_help.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
ssr.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
static_index.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
status.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
syntax_highlighting.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
syntax_tree.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
test_explorer.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
typing.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
view_crate_graph.rs cargo clippy --fix 2024-01-18 13:59:49 +01:00
view_hir.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
view_item_tree.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
view_memory_layout.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
view_mir.rs Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00