aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/tests/diagnostics.rs
Commit message (Collapse)AuthorAgeFilesLines
* Support `#[register_attr]` and `#[register_tool]`Jonas Schievink2021-05-201-0/+17
|
* Include path in `unresolved-macro-call` diagnosticJonas Schievink2021-04-161-2/+2
|
* Update `OUT_DIR` diagnostic to match settingJonas Schievink2021-04-071-1/+1
|
* Allow include! an empty content fileEdwin Cheng2021-04-031-0/+20
|
* Improve diagnostic when including nonexistent fileJonas Schievink2021-03-171-1/+1
|
* Use first early expansion error during nameresJonas Schievink2021-03-171-0/+17
|
* Merge #7970bors[bot]2021-03-151-0/+45
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7970: Fix incorrect diagnostics for failing built in macros r=jonas-schievink a=brandondong **Reproduction:** 1. Use a built in macro in such a way that rust-analyzer fails to expand it. For example: **lib.rs** ``` include!("<valid file but without a .rs extension so it is not indexed by rust-analyzer>"); ``` 2. rust-analyzer highlights the macro call and says the macro itself cannot be resolved even though include! is in the standard library (unresolved-macro-call diagnostic). 3. No macro-error diagnostic is raised. **Root cause for incorrect unresolved-macro-call diagnostic:** 1. collector:collect_macro_call is able to resolve include! in legacy scope but the expansion fails. Therefore, it's pushed into unexpanded_macros to be retried with module scope. 2. include! fails at the resolution step in collector:resolve_macros now that it's using module scope. Therefore, it's retained in unexpanded_macros. 3. Finally, collector:finish tries resolving the remaining unexpanded macros but only with module scope. include! again fails at the resolution step so a diagnostic is created. **Root cause for missing macro-error diagnostic:** 1. In collector:resolve_macros, directive.legacy is None since eager expansion failed in collector:collect_macro_call. The macro_call_as_call_id fails to resolve since we're retrying in module scope. Therefore, collect_macro_expansion is not called for the macro and no macro-error diagnostic is generated. **Fix:** - In collector:collect_macro_call, do not add failing built-in macros to the unexpanded_macros list and immediately raise the macro-error diagnostic. This is in contrast to lazy macros which are resolved in collector::resolve_macros and later expanded in collect_macro_expansion where a macro-error diagnostic may be raised. Co-authored-by: Brandon <[email protected]> Co-authored-by: brandondong <[email protected]>
| * Fix incorrect diagnositics for failing built in eager macrosBrandon2021-03-141-0/+45
| |
* | Extend cfg_attr testJonas Schievink2021-03-131-0/+3
|/
* Use upstream cov-markLaurențiu Nicola2021-03-081-3/+2
|
* Add mark::check! and mark::hit!kazatsuyu2021-01-221-0/+1
|
* Fix error when using "extern crate self as"kazatsuyu2021-01-221-0/+15
|
* Hit a markJonas Schievink2020-12-181-0/+2
|
* Add testJonas Schievink2020-12-181-0/+16
|
* Diagnose #[cfg]s in bodiesJonas Schievink2020-10-231-33/+1
|
* Emit better #[cfg] diagnosticsJonas Schievink2020-10-221-0/+22
|
* Don't diagnose imports whose base crate is missingJonas Schievink2020-09-171-0/+24
|
* Add annotation-based nameres diagnostic testsJonas Schievink2020-09-161-0/+107