Commit Graph

14885 Commits

Author SHA1 Message Date
bors[bot]
36191543a6
Merge #7557
7557: Intern `TypeRef`s in the containing `ItemTree` r=jonas-schievink a=jonas-schievink

This reduces the memory used by `ItemTreeQuery` by ~20%. As it turns out, `TypeRef` is very heavy, and is used a lot in `ItemTree`:

* Many types are frequently repeated throughout the same file. This is what this PR addresses by storing identical `TypeRef`s only once per `ItemTree`.
* The vast majority of `TypeRef` consist of a plain path with only a single element. "Type anchors" like in `<Ty>::func` are used incredibly rarely, and even multi-segment paths are much rarer than single-segment paths.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-04 18:33:57 +00:00
Jonas Schievink
003ee0086a Intern TypeRefs in the containing ItemTree 2021-02-04 19:23:56 +01:00
bors[bot]
663d404a4e
Merge #7555
7555: Expander: store a LocalModuleId, not ModuleId r=jonas-schievink a=jonas-schievink

It already stores the DefMap containing the module, so having
a full ModuleId is unnecessary and makes it easier to mix things up

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-04 14:05:25 +00:00
Jonas Schievink
cacaebcb33 Expander: store a LocalModuleId, not ModuleId
It already stores the DefMap containing the module, so having
a full ModuleId is unnecessary and makes it easier to mix things up
2021-02-04 15:04:21 +01:00
bors[bot]
1bae5509ad
Merge #7554
7554: Don't keep the parent DefMap alive via Arc r=jonas-schievink a=jonas-schievink

This seems like it could easily leak a lot of memory since we don't
currently run GC

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-04 12:45:40 +00:00
Jonas Schievink
26a2a2433c Don't keep the parent DefMap alive via Arc
This seems like it could easily leak a lot of memory since we don't
currently run GC
2021-02-04 13:44:54 +01:00
bors[bot]
01bc1fdff8
Merge #7553
7553: More architecture.md r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-04 10:28:13 +00:00
Aleksey Kladov
06aa34cd10 More architecture.md 2021-02-04 13:27:34 +03:00
bors[bot]
74a223faa3
Merge #7547
7547: Split out ItemScope::dump from DefMap::dump r=jonas-schievink a=jonas-schievink

This is helpful for more targeted debugging

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-03 18:06:55 +00:00
Jonas Schievink
1a8ea81a79 Split out ItemScope::dump from DefMap::dump 2021-02-03 19:05:11 +01:00
bors[bot]
3ff2aa6d09
Merge #7546
7546: Add newline between block and crate maps r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-03 17:25:06 +00:00
Jonas Schievink
6458f9107c Add newline between block and crate maps 2021-02-03 18:23:59 +01:00
bors[bot]
a6ccd50ece
Merge #7545
7545: Add a FIXME to ItemTree r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-03 17:15:21 +00:00
Jonas Schievink
eda1cb7ceb Add a FIXME to ItemTree 2021-02-03 18:14:39 +01:00
bors[bot]
6817f1ff99
Merge #7544
7544: Update `DefMap` and `block_def_map` docs r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-03 16:54:29 +00:00
Jonas Schievink
d4a22fc801 Update DefMap and block_def_map docs 2021-02-03 17:54:03 +01:00
bors[bot]
c92be90fd2
Merge #7543
7543: Grammar fixes r=Kushagra-0801 a=Kushagra-0801

I think line 235 is still wrong, but I am not sure.

Is the `crated/tt` in line 252 supposed to be `crates/tt`?

Co-authored-by: Kushagra Gupta <39802979+Kushagra-0801@users.noreply.github.com>
2021-02-03 16:20:25 +00:00
Kushagra Gupta
b75e85998d
typo fixes 2021-02-03 21:30:42 +05:30
Kushagra Gupta
ed35e516b1
Grammar fixes
I think line 235 is still wrong, but I am not sure.

Is the `crated/tt` in line 252 supposed to be `crates/tt`?
2021-02-03 21:05:21 +05:30
bors[bot]
fd84df9e1b
Merge #7541
7541: Use block_def_map in body lowering (third time's the charm) r=jonas-schievink a=jonas-schievink

After https://github.com/rust-analyzer/rust-analyzer/pull/7380 and https://github.com/rust-analyzer/rust-analyzer/pull/7506 both had to be reverted, this should have finally resolved all remaining bugs.

Most importantly, the optimization to skip `block_def_map` computation when the block contains no inner items was fixed (which fortunately was simpler than expected).

I've ran `analysis-stats` on libstd locally, which works fine, and also ran this PR locally for a short while without issues.

Note that this *still* has no (or almost no) user-facing impact, because the rest of r-a still relies on some local item support hacks.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-03 14:41:13 +00:00
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
bors[bot]
93ecef53a3
Merge #7539
7539: Add cargo file tidy test r=edwin0cheng a=edwin0cheng

bors r+

cc @pksunkara 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-02-03 14:02:30 +00:00
Edwin Cheng
e73ffbf1e5 Add cargo file tidy test 2021-02-03 22:01:09 +08: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
bors[bot]
85e1f0905a
Merge #7538
7538: Make sure normal dependencies always have version r=edwin0cheng a=pksunkara

How do I prevent this happening in the future by doing something in the CI? IIRC this is the second time.

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2021-02-03 12:59:22 +00:00
Pavan Kumar Sunkara
a89fc070c6
Make sure normal dependencies always have version 2021-02-03 12:51:07 +00:00
bors[bot]
05b3fe4255
Merge #7537
7537: Fix spelling mistakes in docs/dev r=Veykril a=Veykril

Also adds a line for `crates/cfg` and `crates/stdx` to the architecture.

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-03 12:48:13 +00:00
Lukas Wirth
f82ce500a9 Fix spelling mistakes in docs/dev 2021-02-03 13:46:51 +01:00
bors[bot]
81a9ad3672
Merge #7536
7536: Make architecture more informative r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-03 11:26:49 +00:00
Aleksey Kladov
1008aaae58 Make architecture more informative
Call out boundaries and invariants
2021-02-03 14:26:23 +03:00
bors[bot]
95e03ec499
Merge #7528
7528: Update mimalloc r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-02-02 22:18:58 +00:00
kjeremy
b9ad1f587d Update mimalloc 2021-02-02 17:17:49 -05:00
bors[bot]
7e66cde764
Merge #7525
7525: Fix resolution of `crate` paths from within blocks r=jonas-schievink a=jonas-schievink

They resolve to the crate root, not the DefMap's root module (which
can be a block)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-02 17:02:48 +00: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
bors[bot]
12e8cc4aa2
Merge #7523
7523: Bump chalk and rustc_lexer r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-02-02 15:40:43 +00:00
Laurențiu Nicola
6b60206669 Bump rustc_lexer 2021-02-02 17:40:01 +02:00
Laurențiu Nicola
9c4b799dce Bump chalk 2021-02-02 17:40:01 +02:00
bors[bot]
042e07d891
Merge #7522
7522: Use non-deprecated memmap2 crate r=kjeremy a=kjeremy

`cargo audit` complains that `memmap` is unmaintained so switch to
RazrFalcon's maintained version.

Removes yet another edge on winapi

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-02-02 15:27:01 +00:00
kjeremy
953883ca54 Use non-deprecated memmap2 crate
`cargo audit` complains that `memmap` is unmaintained so switch to
RazrFalcon's maintained version.

Removes yet another edge on winapi
2021-02-02 10:25:17 -05:00
bors[bot]
a02a7a9aa6
Merge #7521
7521: cargo update r=kjeremy a=kjeremy

Pulls in soundness fix from rowan.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-02-02 15:09:34 +00:00
kjeremy
1c9e216f69 cargo update 2021-02-02 10:00:34 -05:00
bors[bot]
cc3112de1b
Merge #7520
7520: Show alias underlying type r=lnicola a=lumenian

Closes #7511 

Display underlying type in the tooltip:
```rust
pub type SomeAlias = f64
```
instead of:
```rust
pub type SomeAlias
```

Co-authored-by: lumenian <lumenian@gmail.com>
2021-02-02 14:59:29 +00:00
lumenian
cafaab8b96 Show alias underlying type 2021-02-02 17:47:56 +03:00
bors[bot]
96f9f0741f
Merge #7519
7519: add useless types to the styleguide r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-02 13:09:21 +00:00
Aleksey Kladov
283c3b0133 add useless types to the styleguide 2021-02-02 15:41:57 +03:00
bors[bot]
8720f7f146
Merge #7518
7518: Use the right `DefMap` when looking up modules r=jonas-schievink a=jonas-schievink

Fixes the bugs encountered in https://github.com/rust-analyzer/rust-analyzer/pull/7506#issuecomment-771417467

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-02 11:37:45 +00:00
Jonas Schievink
cd9659ffce Use the right DefMap when looking up modules 2021-02-02 12:36:38 +01:00
bors[bot]
157156276b
Merge #7516
7516: Revert "Use block_def_map in body lowering" r=jonas-schievink a=jonas-schievink

Reverts rust-analyzer/rust-analyzer#7506

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-02 10:47:22 +00:00