rust-analyzer/crates/ra_ide_api/src
bors[bot] c4ead49361 Merge #1034
1034: HIR diagnostics API r=matklad a=matklad

This PR introduces diagnostics API for HIR, so we can now start issuing errors and warnings! Here are requirements that this solution aims to fulfill:

* structured diagnostics: rather than immediately rendering error to string, we provide a well-typed blob of data with error-description. These data is used by IDE to provide fixes
* open set diagnostics: there's no single enum with all possible diagnostics, which hopefully should result in better modularity

The `Diagnostic` trait describes "a diagnostic", which can be downcast to a specific diagnostic kind. Diagnostics are expressed in terms of macro-expanded syntax tree: they store pointers to syntax nodes. Diagnostics are self-contained: you don't need any context, besides `db`, to fully understand the meaning of a diagnostic. 

Because diagnostics are tied to the source, we can't store them in salsa. So subsystems like type-checking produce subsystem-local diagnostic (which is a closed `enum`), which is expressed in therms of subsystem IR. A separate step converts these proto-diagnostics into `Diagnostic`, by merging them with source-maps.

Note that this PR stresses type-system quite a bit: we now type-check every function in open files to compute errors!

Discussion on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Diagnostics.20API

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-25 11:38:46 +00:00
..
completion replace todo with fixme 2019-03-23 11:07:09 +03:00
snapshots structure moved to ra_ide_api 2019-03-25 11:41:21 +03:00
assists.rs Rename source_edit to source_file_edit to match file_system_edit 2019-03-25 09:13:58 +02:00
call_info.rs Be precise about the argument list 2019-02-14 10:28:48 -05:00
change.rs remove lower module 2019-03-17 12:52:52 +03:00
completion.rs rename type to type_alias in the AST as well 2019-02-25 13:49:32 +03:00
db.rs rename persistent hir database -> def database 2019-03-23 15:44:24 +03:00
diagnostics.rs move tests to where they belong 2019-03-25 14:29:24 +03:00
extend_selection.rs move extend selection from ra_ide_api_light to ra_ide_api 2019-03-20 23:52:55 +03:00
folding_ranges.rs Move folding_ranges to ra_ide_api 2019-03-22 16:31:21 +03:00
goto_definition.rs replace todo with fixme 2019-03-23 11:07:09 +03:00
hover.rs replace todo with fixme 2019-03-23 11:07:09 +03:00
impls.rs sort navigations to make tests stable 2019-03-14 13:28:45 +03:00
join_lines.rs Simplify changes and fix tests 2019-03-22 17:12:32 +01:00
lib.rs structure moved to ra_ide_api 2019-03-25 11:41:21 +03:00
line_index.rs replace todo with fixme 2019-03-23 11:07:09 +03:00
line_index_utils.rs line_index and line_index_utils moved to ra_ide_api 2019-03-22 15:24:43 +03:00
marks.rs Allow goto-definition to work for named fields in struct initializer 2019-02-27 17:51:59 +02:00
matching_brace.rs Move highlighting and matching_brace 2019-03-23 17:34:49 +01:00
mock_analysis.rs remove ignored macro tests 2019-02-19 20:06:53 +03:00
navigation_target.rs Add support for goto definition and hover on Self 2019-03-07 17:34:44 +02:00
parent_module.rs move crate for 2019-02-08 14:34:30 +03:00
references.rs Rename source_edit to source_file_edit to match file_system_edit 2019-03-25 09:13:58 +02:00
runnables.rs Replace module_tree with CrateDefMap 2019-03-17 12:49:07 +03:00
status.rs reformat the world 2019-02-08 14:49:43 +03:00
structure.rs structure moved to ra_ide_api 2019-03-25 11:41:21 +03:00
symbol_index.rs replace todo with fixme 2019-03-23 11:07:09 +03:00
syntax_highlighting.rs Move highlighting and matching_brace 2019-03-23 17:34:49 +01:00
syntax_tree.rs Allow syntax strings to contain test markers 2019-03-04 09:19:46 +02:00
test_utils.rs Simplify changes and fix tests 2019-03-22 17:12:32 +01:00
typing.rs Rename source_edit to source_file_edit to match file_system_edit 2019-03-25 09:13:58 +02:00