Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Fix macro expansion for statements w/o semicolon | Edwin Cheng | 2021-03-16 | 2 | -47/+63 |
| | |||||
* | Merge #7970 | bors[bot] | 2021-03-15 | 3 | -11/+69 |
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.rs | brandondong | 2021-03-15 | 1 | -1/+1 |
| | | | | | | Co-authored-by: Jonas Schievink <[email protected]> | ||||
| * | Fix incorrect diagnositics for failing built in eager macros | Brandon | 2021-03-14 | 2 | -10/+68 |
| | | |||||
| * | Fix spelling error | Brandon | 2021-03-14 | 1 | -1/+1 |
| | | |||||
* | | Simplify source maps for fields | Aleksey Kladov | 2021-03-15 | 2 | -18/+25 |
| | | |||||
* | | Create TraitEnvironment through a query | Florian Diebold | 2021-03-13 | 1 | -0/+10 |
| | | |||||
* | | Handle `cfg_attr` gating multiple attributes | Jonas Schievink | 2021-03-13 | 1 | -29/+19 |
| | | |||||
* | | Extend cfg_attr test | Jonas Schievink | 2021-03-13 | 1 | -0/+3 |
| | | |||||
* | | Simplify hir_def TestDB | Jonas Schievink | 2021-03-13 | 1 | -7/+2 |
| | | |||||
* | | Remove `ItemTree::source` | Jonas Schievink | 2021-03-12 | 1 | -12/+0 |
|/ | | | | `HasSource` should be used instead | ||||
* | Prefer names from outer DefMap over extern prelude | Jonas Schievink | 2021-03-10 | 1 | -5/+11 |
| | |||||
* | Stop fetching ItemTrees for no reason | Jonas Schievink | 2021-03-10 | 1 | -14/+1 |
| | |||||
* | Delete `ContainerId` | Jonas Schievink | 2021-03-09 | 6 | -72/+45 |
| | |||||
* | Stop using `ContainerId` in `AssocContainerId` | Jonas Schievink | 2021-03-09 | 3 | -7/+7 |
| | |||||
* | Check ancestor maps when computing traits in scope | Jonas Schievink | 2021-03-09 | 1 | -0/+10 |
| | |||||
* | Remove `item_scope` field from `Body` | Jonas Schievink | 2021-03-09 | 3 | -175/+6 |
| | |||||
* | Use `body.block_scopes` in `ChildBySource` | Jonas Schievink | 2021-03-09 | 1 | -1/+5 |
| | |||||
* | Store inner `BlockId`s in `Body` | Jonas Schievink | 2021-03-09 | 2 | -1/+6 |
| | |||||
* | Change `ChildBySource` to allow reusing `DynMap` | Jonas Schievink | 2021-03-09 | 2 | -32/+18 |
| | |||||
* | Use upstream cov-mark | Laurențiu Nicola | 2021-03-08 | 20 | -73/+57 |
| | |||||
* | Do not process indexed values more than once | Kirill Bulatov | 2021-03-08 | 1 | -29/+31 |
| | |||||
* | Deduplicate search_dependencies results | Kirill Bulatov | 2021-03-08 | 1 | -18/+19 |
| | |||||
* | Rename a few `crate_def_map`s to `def_map` | Jonas Schievink | 2021-03-06 | 3 | -16/+16 |
| | | | | These could all be block `DefMap`s instead of crate-level `DefMap`s | ||||
* | Make two calls virtual | Laurențiu Nicola | 2021-03-05 | 1 | -1/+1 |
| | |||||
* | Fix some warnings | Laurențiu Nicola | 2021-03-05 | 1 | -1/+1 |
| | |||||
* | Remove incorrect broken test | Jonas Schievink | 2021-03-03 | 1 | -24/+0 |
| | | | | | `Struct` cannot be named at all in that position, since `super` doesn't resolve to the block scope | ||||
* | Fix `find_path` when inner items are present | Jonas Schievink | 2021-03-01 | 4 | -28/+88 |
| | |||||
* | Merge #7778 | bors[bot] | 2021-03-01 | 1 | -2/+11 |
|\ | | | | | | | | | | | | | | | 7778: Fix lowering trailing self paths in UseTrees r=Veykril a=Veykril Noticed that hovering over `self` in a use tree like `use foo::bar::{self}` showing documentation and such for the current module instead of `bar`. Co-authored-by: Lukas Wirth <[email protected]> | ||||
| * | Fix lowering trailing self paths in UseTrees | Lukas Wirth | 2021-02-28 | 1 | -2/+11 |
| | | |||||
* | | Merge #7804 | bors[bot] | 2021-02-28 | 3 | -79/+73 |
|\ \ | | | | | | | | | | | | | | | | | | | | | | 7804: Introduce TypeCtor::Scalar r=lnicola a=Veykril `TypeCtor::Int(..) | TypeCtor::Float(..) | TypeCtor::Char | TypeCtor::Bool` => `TypeCtor::Scalar(..)`, in this case we can actually just straight up use `chalk_ir::Scalar` already since its just a POD without any IDs or anything. Co-authored-by: Lukas Wirth <[email protected]> | ||||
| * | | Introduce TypeCtor::Scalar | Lukas Wirth | 2021-02-28 | 3 | -79/+73 |
| |/ | |||||
* | | For unresolved macros, hightlight only the last segment | Aleksey Kladov | 2021-02-28 | 5 | -92/+147 |
| | | |||||
* | | Restrict visibilities to the containing DefMap | Jonas Schievink | 2021-02-28 | 2 | -4/+46 |
|/ | |||||
* | is_visible_from_def_map: handle block expressions | Jonas Schievink | 2021-02-23 | 3 | -9/+37 |
| | |||||
* | Wrap `BuiltinType` in code model | Jonas Schievink | 2021-02-11 | 1 | -0/+1 |
| | |||||
* | Remove unneeded return | Jonas Schievink | 2021-02-09 | 1 | -2/+2 |
| | |||||
* | Remove `pub` | Jonas Schievink | 2021-02-09 | 1 | -2/+2 |
| | |||||
* | Use `block_def_map` in `Resolver` | Jonas Schievink | 2021-02-09 | 1 | -118/+97 |
| | | | | | | | This required a few changes to not bail out immediately if a `ModuleScope` doesn't resolve a path. The `LocalItemsScope` hack is now removed. | ||||
* | Teach `find_path` about inner items | Jonas Schievink | 2021-02-09 | 1 | -10/+91 |
| | |||||
* | Add another block def map test | Jonas Schievink | 2021-02-09 | 1 | -0/+27 |
| | |||||
* | Make `with_ancestor_maps` public | Jonas Schievink | 2021-02-09 | 1 | -1/+1 |
| | |||||
* | Add `TestDB::module_at_position` | Jonas Schievink | 2021-02-09 | 2 | -104/+99 |
| | |||||
* | Add expression scopes for blocks | Jonas Schievink | 2021-02-09 | 1 | -4/+18 |
| | |||||
* | Test `super` resolution too | Jonas Schievink | 2021-02-05 | 1 | -0/+2 |
| | |||||
* | Fix resolution of `self` module within blocks | Jonas Schievink | 2021-02-05 | 2 | -7/+17 |
| | |||||
* | Remove redundant clones | Yoshua Wuyts | 2021-02-05 | 3 | -3/+3 |
| | |||||
* | Fix merging of `segment_index` in path resolution | Jonas Schievink | 2021-02-05 | 1 | -2/+5 |
| | |||||
* | Avoid using ModPath's fields directly | Jonas Schievink | 2021-02-04 | 3 | -8/+9 |
| | |||||
* | Make `ModPath`'s representation private | Jonas Schievink | 2021-02-04 | 9 | -39/+58 |
| |