Commit Graph

7520 Commits

Author SHA1 Message Date
bors[bot]
2c67ca0146
Merge #5387
5387: Add --memory-usage to analysis-bench r=matklad a=jonas-schievink



Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-07-15 12:07:05 +00:00
Jonas Schievink
9086c8c663 Add --memory-usage to analysis-bench 2020-07-15 12:14:51 +02:00
bors[bot]
6f3c8dc11d
Merge #5345
5345: Semantic Highlighting: Emit mutable modifier for 'self' when applicable r=matklad a=Veykril

This PR implements emitting the mutable modifier for the self keyword when applicable for semantic highlighting as mentioned in #5041. The rendered highlighting test html file:
![firefox_5lbsFNBqsT](https://user-images.githubusercontent.com/3757771/87346245-a5a07280-c551-11ea-9051-e5901255f8c9.png)
As you can see it does not emit the modifier when `self` is not used in a mutable context even if it is declared mutably in the enclosing function. I'm not sure if this is actually something wanted or not.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-07-15 10:00:10 +00:00
bors[bot]
b8b41c5f41
Merge #5354
5354: Add opt-in mimalloc feature r=matklad a=ivan

This adds a `mimalloc` feature to use [mimalloc](https://github.com/microsoft/mimalloc) via [mimalloc_rust](https://github.com/purpleprotocol/mimalloc_rust), and a corresponding `cargo xtask install --server --mimalloc`.

In my tests on Linux, mimalloc seems to run consistently faster than jemalloc and uses only slightly more memory in `analysis-stats` on chalk. Also, builds with mimalloc produce a binary 3MB smaller than builds with jemalloc.

A summary of `env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/` runs on NixOS master on an Intel 4790K in VMware Workstation:

<table>
<tr>
<td></td><td>self-reported time</td><td>elapsed time</td><td>max RSS</td>
</tr>
<tr><td>glibc 2.30 run 1</td><td>225.1 sec</td><td>3:46.91</td><td>1075208</td></tr>
<tr><td>glibc 2.30 run 2</td><td>228.4 sec</td><td>3:50.13</td><td>1074996</td></tr>
<tr><td>jemalloc run 1</td><td>201.8 sec</td><td>3:23.03</td><td>1055960</td></tr>
<tr><td>jemalloc run 2</td><td>199.2 sec</td><td>3:20.41</td><td>1065040</td></tr>
<tr><td>mimalloc run 1</td><td>188.6 sec</td><td>3:09.77</td><td>1105584</td></tr>
<tr><td>mimalloc run 2</td><td>185.0 sec</td><td>3:06.23</td><td>1108132</td></tr>
<tr><td>mimalloc + lto run 1</td><td>160.7 sec</td><td>2:41.80</td><td>1106076</td></tr>
<tr><td>mimalloc + lto run 2</td><td>162.2 sec</td><td>2:43.31</td><td>1104268</td></tr>
</tr>
</table>

I included an `lto = true; codegen-units = 1` run out of curiosity, this PR doesn't enable it.

<details>
<summary>analysis-stats benchmark runs</summary>

## default

```
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.10s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 333.880345ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 10.176299461s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 214.968806927s, 0b allocated 0b resident
Total: 225.145114417s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 225.34
        System time (seconds): 1.49
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:46.91
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1075208
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 6
        Minor (reclaiming a frame) page faults: 294711
        Voluntary context switches: 365
        Involuntary context switches: 3273
        Swaps: 0
        File system inputs: 2904
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.10s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 332.711598ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 9.895020518s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 218.5001697s, 0b allocated 0b resident
Total: 228.39519833s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 228.26
        System time (seconds): 1.75
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:50.13
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1074996
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 9
        Minor (reclaiming a frame) page faults: 294748
        Voluntary context switches: 330
        Involuntary context switches: 1561
        Swaps: 0
        File system inputs: 12608
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
```

## jemalloc
```
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.11s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 356.090374ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 10.176550183s, 439mb allocated 465mb resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 191.607201827s, 993mb allocated 1036mb resident
Total: 201.783937913s, 993mb allocated 1036mb resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 201.07
        System time (seconds): 1.89
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:23.03
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1055960
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 357755
        Voluntary context switches: 240
        Involuntary context switches: 1889
        Swaps: 0
        File system inputs: 256
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.10s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 317.917622ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 9.902142185s, 439mb allocated 463mb resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 189.295317017s, 993mb allocated 1046mb resident
Total: 199.197555943s, 993mb allocated 1046mb resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 198.64
        System time (seconds): 1.67
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:20.41
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1065040
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 369013
        Voluntary context switches: 243
        Involuntary context switches: 2835
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
```

## mimalloc
```
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.12s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 332.116806ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 9.796643695s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 178.82132362s, 0b allocated 0b resident
Total: 188.617975605s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 187.70
        System time (seconds): 1.97
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:09.77
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1105584
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 296481
        Voluntary context switches: 222
        Involuntary context switches: 1868
        Swaps: 0
        File system inputs: 256
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.13s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 320.046776ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 9.287690124s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 175.710939697s, 0b allocated 0b resident
Total: 184.998640033s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 184.38
        System time (seconds): 1.81
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 3:06.23
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1108132
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 297055
        Voluntary context switches: 374
        Involuntary context switches: 2374
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
```

## mimalloc + lto
```
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.11s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 369.600196ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 7.572726834s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 153.090899101s, 0b allocated 0b resident
Total: 160.663635235s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 160.01
        System time (seconds): 1.70
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 2:41.80
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1106076
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 1
        Minor (reclaiming a frame) page faults: 296610
        Voluntary context switches: 209
        Involuntary context switches: 2798
        Swaps: 0
        File system inputs: 8
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
# env time -v cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
    Finished release [optimized] target(s) in 0.10s
     Running `target/release/rust-analyzer analysis-stats ../chalk/`
[ERROR ra_project_model] cyclic dependency chalk-integration -> chalk-engine
[ERROR ra_project_model] cyclic dependency chalk-recursive -> chalk-integration
[ERROR ra_project_model] cyclic dependency chalk-solve -> chalk-integration
Database loaded 334.630658ms
Crates in this dir: 11
Total modules found: 159
Total declarations: 2631
Total functions: 1947
Item Collection: 7.71699197s, 0b allocated 0b resident
Total expressions: 57094
Expressions of unknown type: 2938 (5%)
Expressions of partially unknown type: 2427 (4%)
Type mismatches: 232
Inference: 154.50351318s, 0b allocated 0b resident
Total: 162.220513775s, 0b allocated 0b resident
        Command being timed: "cargo run --release -p rust-analyzer -- analysis-stats ../chalk/"
        User time (seconds): 161.52
        System time (seconds): 1.74
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 2:43.31
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1104268
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 296183
        Voluntary context switches: 200
        Involuntary context switches: 1666
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
```
</details>

Co-authored-by: Ivan Kozik <ivan@ludios.org>
2020-07-15 09:43:08 +00:00
Aleksey Kladov
fac1b0def1 Off by one error when determining the active param
closes #3615
2020-07-15 10:14:23 +02:00
Aleksey Kladov
1f411f87ea Refactor CallInfo tests 2020-07-15 10:09:10 +02:00
Ivan Kozik
6710856c10 Add opt-in mimalloc feature 2020-07-14 20:57:51 +00:00
Jonas Schievink
fdce4d9f51 Add FIXME 2020-07-14 20:27:48 +02:00
Jonas Schievink
05a9f377ec Update ItemTree snapshots 2020-07-14 20:27:48 +02:00
Jonas Schievink
a09d483802 Thread varargs through r-a 2020-07-14 20:27:47 +02:00
Jonas Schievink
a4a8406c44 ItemTree: Lower tuple types despite invalid type 2020-07-14 19:57:41 +02:00
Aleksey Kladov
d47834ee1b Guard against infinite macro expansions
closes #4463
2020-07-14 18:31:48 +02:00
bors[bot]
ff6cf4f849
Merge #5377
5377: Fix classify_name_ref on multi-path macro calls r=matklad a=jonas-schievink

Previously, "go to definition" on `log<|>::info!(...)` would go to the `info!` macro, not to the `log` crate. This fixes that.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-14 15:46:01 +00:00
bors[bot]
408b5fafc5
Merge #5375
5375: Use more explicit type for save registration r=matklad a=kjeremy

This was introduced in the latest lsp-types

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-14 15:26:10 +00:00
Jonas Schievink
2163ceb7ef Fix classify_name_ref on multi-path macro calls 2020-07-14 17:23:33 +02:00
kjeremy
2257a48cd3 Use more explicity type for save registration 2020-07-14 11:03:44 -04:00
Aleksey Kladov
b9070cc64e Refactor the test of diagnostic tests 2020-07-14 16:44:20 +02:00
Aleksey Kladov
dc2094cfa5 Minor, push allocations down 2020-07-14 15:57:10 +02:00
bors[bot]
ebb4d29d69
Merge #5371
5371: Allow multiline annotations r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-14 12:58:34 +00:00
Aleksey Kladov
abeb003df4 Allow multiline annotations 2020-07-14 14:58:10 +02:00
Aleksey Kladov
92c5036a7c
Merge pull request #5370 from matklad/parens
Don't duplicate parens in patterns
2020-07-14 14:39:46 +02:00
Aleksey Kladov
0b0865ab22 Generaize annotation extraction 2020-07-14 14:01:54 +02:00
Aleksey Kladov
f7f4ea633b Don't duplicate parens in patterns 2020-07-14 13:51:43 +02:00
Aleksey Kladov
f823386db8 Add mark 2020-07-14 13:46:29 +02:00
bors[bot]
83271f9b99
Merge #5367
5367: missing impl members: remove assoc. type bounds r=matklad a=jonas-schievink

Previously "Add missing impl members" would paste bounds on associated types into the impl, which is not allowed. This removes them before pasting the item.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-14 11:37:28 +00:00
Jonas Schievink
85f5cbc9dc Move remove_bounds to edit.rs 2020-07-14 13:33:37 +02:00
bors[bot]
735baad6ce
Merge #5368
5368: Compress match checking tests r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-14 11:13:58 +00:00
Aleksey Kladov
b031899dac Compress match checking tests 2020-07-14 13:12:55 +02:00
Jonas Schievink
0f654b06ab missing impl members: remove assoc. type bounds 2020-07-14 13:12:16 +02:00
Aleksey Kladov
af6984f6a6 Data-driven diagnostics tests 2020-07-14 12:05:50 +02:00
bors[bot]
0f8af1b824
Merge #5355
5355: Add a license field to all the crates r=matklad a=JohnTitor

Some are unnecessary but it's okay to have it, I think.
cc https://github.com/rust-lang/rust/issues/74269

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
2020-07-14 09:18:17 +00:00
Aleksey Kladov
7b2ce1a54f Reduce visibility 2020-07-14 11:09:41 +02:00
Aleksey Kladov
b2390f10fa Cleanup visibility 2020-07-14 10:52:18 +02:00
Aleksey Kladov
19450534cf Cleanup hir diagnostics API 2020-07-14 10:28:55 +02:00
Aleksey Kladov
1fdbf81181 Consolidate hir diagnostics code in one place 2020-07-14 10:18:08 +02:00
Aleksey Kladov
c6f3540121 Use relaxed ordering for marks
We dont' need this for perf. `Relaxed` ordering is enough here, as we
only have one location. I prefer to use minimal ordering, because that
makes it easier to reason about the code.
2020-07-14 09:04:11 +02:00
Yuki Okushi
6f423466d1
Add a license field to all the crates 2020-07-14 10:57:26 +09:00
Lukas Wirth
91b35d8827 Semantic Highlighting: Emit mutable modifier for 'self' when applicable 2020-07-13 21:39:01 +02:00
Aleksey Kladov
693ac892f2 Don't copy-paste impl_froms into every crate 2020-07-13 16:21:02 +02:00
Aleksey Kladov
6b4cf5b7d8 Move stdx macros into submodule 2020-07-13 16:21:02 +02:00
Aleksey Kladov
82b025b05a Reorder imports 2020-07-13 15:40:54 +02:00
bors[bot]
5ca7cd960b
Merge #5331
5331: Fix #4966 r=flodiebold a=flodiebold

We add a level of binders when converting our function pointer to Chalk's; we need to remove it again on the way back.

Fixes #4966.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-07-12 20:31:51 +00:00
Florian Diebold
d885f38011 Remove some unnecessary file names 2020-07-12 20:20:31 +02:00
Florian Diebold
c6f53aaaa4 Add test for #4281
Fixes #4281.
2020-07-12 20:20:31 +02:00
Florian Diebold
7e9c4d58f1 Search more efficiently for int/float impls 2020-07-12 20:20:31 +02:00
Florian Diebold
00bda1cafb Adapt trait object coercion tests to the status quo 2020-07-12 20:20:31 +02:00
Florian Diebold
94f5f69ff4 Use Chalk built-in representation for array types 2020-07-12 20:20:31 +02:00
Florian Diebold
2a4166501d Remove built-in Unsize impls
They exist in Chalk now.
2020-07-12 20:20:31 +02:00
Florian Diebold
71d645101d Upgrade Chalk 2020-07-12 20:20:31 +02:00
Florian Diebold
c82f5379de Enable Chalk tracing in hir_ty tests 2020-07-12 20:12:01 +02:00