aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres
Commit message (Collapse)AuthorAgeFilesLines
...
* Update crates/hir_def/src/nameres/tests/incremental.rsAleksey Kladov2021-05-061-1/+1
| | | Co-authored-by: Jonas Schievink <[email protected]>
* internal: add failing incremental testAleksey Kladov2021-05-061-0/+52
|
* Merge #8542bors[bot]2021-04-162-6/+7
|\ | | | | | | | | | | | | | | 8542: Include path in `unresolved-macro-call` diagnostic r=matklad a=jonas-schievink Co-authored-by: Jonas Schievink <[email protected]>
| * Include path in `unresolved-macro-call` diagnosticJonas Schievink2021-04-162-6/+7
| |
* | Fix primitive shadowing with inner itemsJonas Schievink2021-04-161-1/+7
|/
* Resolve prelude and crate root names in the root DefMapJonas Schievink2021-04-092-7/+34
|
*-. Merge #8443 #8446bors[bot]2021-04-092-16/+15
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8443: Rewrite `#[derive]` removal code to be based on AST r=jonas-schievink a=jonas-schievink We now remove any `#[derive]` before and including the one we want to expand, in the `macro_arg` query. The same infra will be needed by attribute macros (except we only remove the attribute we're expanding, not any preceding ones). Part of https://github.com/rust-analyzer/rust-analyzer/issues/8434 (doesn't implement the cfg-expansion yet, because that's more difficult) 8446: Undo path resolution hack for extern prelude r=jonas-schievink a=jonas-schievink Reverts the change made in https://github.com/rust-analyzer/rust-analyzer/pull/7959 We don't populate the extern prelude for block DefMaps anymore, so this is unnecessary bors r+ Co-authored-by: Jonas Schievink <[email protected]>
| | * Undo path resolution hack for extern preludeJonas Schievink2021-04-091-9/+4
| |/ |/| | | | | | | We don't populate the extern prelude for block DefMaps anymore, so this is unnecessary
| * Store `#[derive]` attribute ID along macro invocJonas Schievink2021-04-091-7/+11
|/
* Use named fields in `MacroCallKind`Jonas Schievink2021-04-081-1/+1
|
* Track recursion limit when expanding custom deriveJonas Schievink2021-04-081-1/+1
|
* Update `OUT_DIR` diagnostic to match settingJonas Schievink2021-04-071-1/+1
|
* nameres: collect unnamed constsJonas Schievink2021-04-071-13/+21
|
* Merge #8352bors[bot]2021-04-051-9/+3
|\ | | | | | | | | | | | | | | 8352: Remove dead legacy macro expansion code r=lnicola a=brandondong I was investigating some unrelated macro issue when I noticed this dead code. This legacy macro expansion logic was changed in https://github.com/rust-analyzer/rust-analyzer/pull/8128. Co-authored-by: Brandon <[email protected]>
| * Remove dead legacy macro expansion codeBrandon2021-04-051-9/+3
| |
* | Use shrink_to_fit to reduce DefMap sizesJonas Schievink2021-04-031-1/+3
| |
* | Intern `ModPath` in `Import`Jonas Schievink2021-04-031-2/+6
| | | | | | | | Minor savings only
* | Allow include! an empty content fileEdwin Cheng2021-04-031-0/+20
| |
* | Support `#[rustc_builtin_macro = "builtin_name"]`Jonas Schievink2021-04-031-1/+11
| |
* | Only populate prelude for crate-level DefMapsJonas Schievink2021-04-021-14/+16
| |
* | Intern Attr, MacroCall and Path componentsJonas Schievink2021-04-011-1/+1
| |
* | Remove unused test fixturesEdwin Cheng2021-03-281-4/+0
| |
* | Basic Support Macro 2.0Edwin Cheng2021-03-272-39/+85
|/
* Merge bang-macros and derives in name resolutionJonas Schievink2021-03-231-86/+79
|
* resolver: manually traverse nested block scopesJonas Schievink2021-03-221-1/+1
|
* Merge #8134bors[bot]2021-03-211-4/+9
|\ | | | | | | | | | | | | | | 8134: Correct the paths of submodules from the include! macro r=edwin0cheng a=sticnarf This PR should fix #7846. It mostly follows the instructions from @edwin0cheng in that issue. Co-authored-by: Yilin Chen <[email protected]>
| * check is_include_macro only when attr_path is not specifiedYilin Chen2021-03-211-4/+3
| | | | | | | | Signed-off-by: Yilin Chen <[email protected]>
| * use the included file as the source of expanded include macroYilin Chen2021-03-211-2/+8
| | | | | | | | Signed-off-by: Yilin Chen <[email protected]>
* | Expand legacy-scoped macro during collectionJonas Schievink2021-03-212-6/+28
|/
* Fix handling of `#![cfg]` in outline module fileJonas Schievink2021-03-192-21/+48
|
* Rename derive-specific APIsJonas Schievink2021-03-191-4/+4
|
* Add testJonas Schievink2021-03-181-0/+26
|
* Record custom derive helpers in `DefMap`Jonas Schievink2021-03-182-24/+80
| | | | Also clean up proc macro attribute parsing a bit
* Store an `AstId` for procedural macrosJonas Schievink2021-03-181-6/+7
|
* Make MacroDefId's `AstId` mandatory when possibleJonas Schievink2021-03-181-4/+1
|
* Rename `item_tree` query to `file_item_tree`Jonas Schievink2021-03-181-4/+4
|
* Make `ItemTreeId` its own typeJonas Schievink2021-03-181-6/+6
|
* Merge #8075bors[bot]2021-03-172-16/+37
|\ | | | | | | | | | | | | | | | | | | 8075: Fix `use crate as <name>;` imports r=jonas-schievink a=jonas-schievink Fixes https://github.com/rust-analyzer/rust-analyzer/issues/4644 bors r+ Co-authored-by: Jonas Schievink <[email protected]>
| * Fix `use crate as <name>;` importsJonas Schievink2021-03-172-16/+37
| |
* | Improve diagnostic when including nonexistent fileJonas Schievink2021-03-171-1/+1
|/
* Use first early expansion error during nameresJonas Schievink2021-03-172-1/+20
|
* Merge #7970bors[bot]2021-03-152-10/+68
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
| * Update crates/hir_def/src/nameres/collector.rsbrandondong2021-03-151-1/+1
| | | | | | Co-authored-by: Jonas Schievink <[email protected]>
| * Fix incorrect diagnositics for failing built in eager macrosBrandon2021-03-142-10/+68
| |
* | Extend cfg_attr testJonas Schievink2021-03-131-0/+3
|/
* Prefer names from outer DefMap over extern preludeJonas Schievink2021-03-101-5/+11
|
* Delete `ContainerId`Jonas Schievink2021-03-091-12/+11
|
* Stop using `ContainerId` in `AssocContainerId`Jonas Schievink2021-03-091-3/+3
|
* Use upstream cov-markLaurențiu Nicola2021-03-088-36/+31
|
* For unresolved macros, hightlight only the last segmentAleksey Kladov2021-02-281-33/+48
|