Commit Graph

273 Commits

Author SHA1 Message Date
Jonas Schievink
63744fe128 Test for name resolution with DefMap shortcut 2021-02-03 15:33:25 +01:00
Jonas Schievink
da57f5dc17 Shortcut block_def_map if there's no inner items
This previously didn't work, but apparently only because of the wonky
test setup
2021-02-03 15:33:25 +01:00
Jonas Schievink
7eff6705cc Use body lowering for block_def_map tests
Removes the hacky and buggy custom lowering code
2021-02-03 14:21:15 +01:00
Jonas Schievink
b7be2b1d3c Use block_def_map in body lowering 2021-02-03 14:21:15 +01:00
Jonas Schievink
5914f86d47 Fix resolution of crate paths from within blocks
They resolve to the crate root, not the DefMap's root module (which
can be a block)
2021-02-02 18:02:12 +01:00
Jonas Schievink
cd9659ffce Use the right DefMap when looking up modules 2021-02-02 12:36:38 +01:00
Jonas Schievink
7202ce6c96
Revert "Use block_def_map in body lowering" 2021-02-02 11:46:58 +01:00
Jonas Schievink
b4aa860cac Shortcut block_def_map if there's no inner items
This previously didn't work, but apparently only because of the wonky
test setup
2021-02-01 13:33:18 +01:00
Jonas Schievink
80ae583dc0 Use body lowering for block_def_map tests
Removes the hacky and buggy custom lowering code
2021-02-01 13:33:18 +01:00
Jonas Schievink
9cc7d57429 Use block_def_map in body lowering 2021-02-01 13:33:18 +01:00
bors[bot]
1a59f75cda
Merge #7503
7503: Return inner attributes of outline mod declarations in `attrs_query` r=jonas-schievink a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-31 20:13:28 +00:00
Lukas Wirth
999e020da2 Return inner attributes of outline mod declarations in attrs_query 2021-01-31 19:53:01 +01:00
Lukas Wirth
412f180d71 Honor #![macro_use] in mod source files 2021-01-31 19:33:02 +01:00
Jonas Schievink
090b2f0e50 Fix incorrect FileId and remove broken shortcut
Apparently we were using the crate's root file instead of the file
containing the block.
2021-01-28 19:33:00 +01:00
Jonas Schievink
7177045a67 block_def_map: add a few macro tests 2021-01-28 18:53:35 +01:00
Jonas Schievink
232b75394e Update original_module when ascending DefMaps 2021-01-28 18:27:27 +01:00
Jonas Schievink
2aebde6c0b ItemTree: Treat items in MacroStmts as top-level 2021-01-28 18:00:10 +01:00
Jonas Schievink
ad254f4c97 Fix legacy macro resolution in block expressions 2021-01-27 19:16:39 +01:00
Aleksey Kladov
181590412e add more counts 2021-01-27 12:16:24 +03:00
Jonas Schievink
08253d5473 Traverse parent DefMap for super paths 2021-01-25 19:15:39 +01:00
Jonas Schievink
98a88ebb9e Intern block locations and handle them in ModuleId 2021-01-25 19:02:05 +01:00
bors[bot]
2c735ed734
Merge #7426
7426: Create all `ModuleId`s through a `DefMap` method r=jonas-schievink a=jonas-schievink

`ModuleId` needs to be able to represent blocks, and only the
associated `DefMap` will know how to construct that `ModuleId`

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-25 14:22:24 +00:00
Jonas Schievink
5c241b0766 Create all ModuleIds through a DefMap method
`ModuleId` needs to be able to represent blocks, and only the
associated `DefMap` will know how to construct that `ModuleId`
2021-01-25 15:21:33 +01:00
Laurențiu Nicola
5ed5a542fb Derive Default on ItemTree 2021-01-25 14:12:53 +02:00
Phil Ellison
8c7ccdc29d Identify methods using functions ids rather than string names 2021-01-23 07:40:25 +00:00
bors[bot]
eab5db20ed
Merge #7391
7391: Fix error when using "extern crate self as" r=kazatsuyu a=kazatsuyu

Fix #6957

Co-authored-by: kazatsuyu <shirayama.kazatsuyu@gmail.com>
2021-01-23 04:04:09 +00:00
Jonas Schievink
3de8f57c51 Make ModuleId's krate field private 2021-01-22 18:09:55 +01:00
Jonas Schievink
ce29730bc7 Obtain ModuleId's DefMap through a method 2021-01-22 16:33:58 +01:00
kazatsuyu
90d6740e32 Add mark::check! and mark::hit! 2021-01-23 00:11:37 +09:00
kazatsuyu
0fb4544403 cargo fmt 2021-01-22 22:52:04 +09:00
kazatsuyu
e52589e3a7 Fix error when using "extern crate self as" 2021-01-22 22:28:45 +09:00
Daiki Ihara
f5b97e52c9 Fix broken link in intra-doc 2021-01-22 20:06:45 +09:00
Jonas Schievink
8916b0c6cb Remove unused field 2021-01-21 21:12:26 +01:00
Jonas Schievink
4d19607057 Add test for path resolution bug 2021-01-21 20:35:36 +01:00
Jonas Schievink
3f4f253028
Revert "Make use of block_def_map in body lowering" 2021-01-21 19:04:31 +01:00
bors[bot]
e76d8c1d9a
Merge #7378
7378: Include `countme` crate to count important data structures. r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-21 17:46:44 +00:00
Jonas Schievink
cdb0e25aaa Make use of block_def_map in body lowering
Removes the `local_scope` hack from `Expander` in favor of tracking the
`DefMap` in use during body lowering
2021-01-21 18:05:52 +01:00
Aleksey Kladov
e5c5c0a040 Include countme crate to count important data structures. 2021-01-21 19:30:52 +03:00
Jonas Schievink
d157a03e93 Remove unnecessary annotations from tests 2021-01-21 17:19:46 +01:00
Jonas Schievink
4e603b7947 Add test for nameres in nested blocks 2021-01-21 16:42:56 +01:00
Jonas Schievink
ec4a1dc297 Add test that merges inner and outer names 2021-01-21 16:23:50 +01:00
Jonas Schievink
d62c9c6c63 Fix lowering with multiple block expressions 2021-01-21 16:23:22 +01:00
Jonas Schievink
f8f44cfb9b Fall back to parent DefMaps when resolving paths 2021-01-21 15:24:15 +01:00
Jonas Schievink
896dfacfc4 Add name resolution query for block expressions 2021-01-21 15:22:17 +01:00
Jonas Schievink
82146737ac Treat BlockExpr as a potential module origin 2021-01-20 20:05:48 +01:00
Jonas Schievink
5f319ca7ee DefMap: hide remaining crate-visible fields 2021-01-20 18:17:48 +01:00
bors[bot]
e62533c3ec
Merge #7359
7359: ItemTree: store a mapping from blocks to inner items r=jonas-schievink a=jonas-schievink

To do name resolution within block expressions, we need to know which inner items are located inside each block expression. This adds such a mapping to `ItemTree`, replacing the previous one, which was seemingly unused other than to access all the inner items.

This also assigns `AstId`s to block expressions, which is needed to store the mapping in salsa.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-20 16:09:22 +00:00
Jonas Schievink
0587b99fde Make public DefMap fields private 2021-01-20 15:41:18 +01:00
Jonas Schievink
c5ed2284b5 Create a mapping from blocks to inner items 2021-01-20 15:00:28 +01:00
Lukas Wirth
bed12833cc Show const params in completions 2021-01-19 20:06:39 +01:00