rust-analyzer/crates
bors[bot] 7f3ba7d57f
Merge #6645
6645: Publish diagnostics for macro expansion errors r=matklad a=jonas-schievink

This adds 2 new diagnostics, emitted during name resolution:

* `unresolved-proc-macro`, a weak warning that is emitted when a proc macro is supposed to be expanded, but was not provided by the build system. This usually means that proc macro support is turned off, but may also indicate setup issues when using rust-project.json. Being a weak warning, this should help set expectations when users see it, while not being too obstructive. We do not yet emit this for attribute macros though, just custom derives and `!` macros.
* `macro-error`, which is emitted when any macro (procedural or `macro_rules!`) fails to expand due to some error. This is an error-level diagnostic, but currently still marked as experimental, because there might be spurious errors and this hasn't been tested too well.

This does not yet emit diagnostics when expansion in item bodies fails, just for module-level macros.

Known bug: The "proc macro not found" diagnostic points at the whole item for custom derives, it should just point at the macro's name in the `#[derive]` list, but I haven't found an easy way to do that.

Screenshots:

![screenshot-2020-11-26-19:54:14](https://user-images.githubusercontent.com/1786438/100385782-f8bc2300-3023-11eb-9f27-e8f8ce9d6114.png)
![screenshot-2020-11-26-19:55:39](https://user-images.githubusercontent.com/1786438/100385784-f954b980-3023-11eb-9617-ac2eb0a0a9dc.png)


Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-28 15:10:00 +00:00
..
arena Add TBD description to arena 2020-08-24 13:29:10 +02:00
assists Move the helpers into ide_db 2020-11-28 16:30:39 +02:00
base_db Compress code 2020-11-17 11:52:28 +01:00
cfg Remove dead code 2020-11-17 15:25:57 +01:00
completion Move the helpers into ide_db 2020-11-28 16:30:39 +02:00
flycheck Pin cargo_metadata 2020-11-25 10:11:53 -05:00
hir Publish diagnostics for macro expansion errors 2020-11-27 13:50:22 +01:00
hir_def More accurately place proc-macro diagnostic 2020-11-27 16:29:40 +01:00
hir_expand Merge #6645 2020-11-28 15:10:00 +00:00
hir_ty Check structs for match exhaustiveness 2020-11-24 18:50:56 +01:00
ide Merge #6645 2020-11-28 15:10:00 +00:00
ide_db Move the helpers into ide_db 2020-11-28 16:30:39 +02:00
mbe Add dedicated error for "proc macro not found" 2020-11-27 13:50:20 +01:00
parser Parse unsafe extern block 2020-11-22 20:44:56 -08:00
paths Add description for crates that will be published 2020-08-24 13:07:22 +02:00
proc_macro_api Deny unreachable-pub 2020-11-02 14:07:08 +01:00
proc_macro_srv Pin cargo_metadata 2020-11-25 10:11:53 -05:00
proc_macro_test Add description for crates that will be published 2020-08-24 13:07:22 +02:00
profile Deny unreachable-pub 2020-11-02 14:07:08 +01:00
project_model Pin cargo_metadata 2020-11-25 10:11:53 -05:00
rust-analyzer Merge #6650 2020-11-28 14:33:57 +00:00
ssr Remove more unreachable pubs 2020-11-02 16:58:33 +01:00
stdx add open Cargo.toml action 2020-11-12 17:48:07 -08:00
syntax Profile completions better 2020-11-27 18:00:03 +02:00
test_utils Feedback. 2020-11-02 10:57:31 -07:00
text_edit Avoid turning completion objects into builders 2020-11-16 23:16:41 +02:00
toolchain Add description for crates that will be published 2020-08-24 13:07:22 +02:00
tt Simplify error formatting 2020-11-26 21:07:15 +02:00
vfs Remove more unreachable pubs 2020-11-02 16:58:33 +01:00
vfs-notify Follow symlinks when walking project trees 2020-10-15 14:22:36 -04:00