| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |_|/
| |/| | |
|
| | |/
| |/| |
|
| | | |
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |\
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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 <[email protected]>
|
| | | |
|
| |/ |
|
| |
| |
| |
| |
| | |
Hopefully fixes power 32-bit build.
See: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Running.20check.20builds.20on.2032.20bit.20power
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
insta review wouldn't update the test, so ...
|
| | |
|
| | |
|
| |\
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
5270: Add argument count mismatch diagnostic r=matklad a=jonas-schievink
Closes https://github.com/rust-analyzer/rust-analyzer/issues/4025.
This currently has one false positive on this line, where `max` is resolved to `Iterator::max` instead of `Ord::max`:
https://github.com/rust-analyzer/rust-analyzer/blob/8aa10c00a4c5b957d459fac5a103cd9688e8dcdd/crates/expect/src/lib.rs#L263
(I have no idea why it thinks that `usize` is an `Iterator`)
TODO:
* [x] Tests
* [x] Improve diagnostic text for method calls
Co-authored-by: Jonas Schievink <[email protected]>
|
| | | |
|
| | | |
|
| | | |
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| |\
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
5255: Replace ad hocery with science r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
|
| | | |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Co-authored-by: bjorn3 <[email protected]>
Override miniz_oxide to build it with optimizations
Building this crate with optimizations decreases the gzipping
part of `cargo xtask dist` from `30-40s` down to `3s`,
the overhead for `rustc` to apply optimizations is miserable on this background
|
| | |
|
| | |
|
| |
| |
| |
| | |
This improves compile times quite a bit
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |\
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
5142: analysis-stats: allow parallel type inference r=matklad a=jonas-schievink
This is mostly just for testing/fun, but it looks like type inference can be sped up massively with little to no effort (since it runs after the serial phases are already done).
Without `--parallel`:
```
Item Collection: 16.43597698s, 683mb allocated 720mb resident
Inference: 25.429774879s, 1720mb allocated 1781mb resident
Total: 41.865866352s, 1720mb allocated 1781mb resident
```
With `--parallel`:
```
Item Collection: 16.380369815s, 683mb allocated 735mb resident
Parallel Inference: 7.449166445s, 1721mb allocated 1812mb resident
Inference: 143.437157ms, 1721mb allocated 1812mb resident
Total: 23.973303611s, 1721mb allocated 1812mb resident
```
Co-authored-by: Jonas Schievink <[email protected]>
|
| | | |
|
| |/ |
|
| |\
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
5101: Add expect -- a light-weight alternative to insta r=matklad a=matklad
This PR implements a small snapshot-testing library. Snapshot updating is done by setting an env var, or by using editor feature (which runs a test with env-var set).
Here's workflow for updating a failing test:
![expect](https://user-images.githubusercontent.com/1711539/85926956-28afa080-b8a3-11ea-9260-c6d0d8914d0b.gif)
Here's workflow for adding a new test:
![expect-fresh](https://user-images.githubusercontent.com/1711539/85926961-306f4500-b8a3-11ea-9369-f2373e327a3f.gif)
Note that colorized diffs are not implemented in this PR, but should be easy to add (we already use them in test_utils).
Main differences from insta (which is essential for rust-analyzer development, thanks @mitsuhiko!):
* self-updating tests, no need for a separate tool
* fewer features (only inline snapshots, no redactions)
* fewer deps (no yaml, no persistence)
* tighter integration with editor
* first-class snapshot object, which can be used to write test functions (as opposed to testing macros)
* trivial to tweak for rust-analyzer needs, by virtue of being a workspace member.
I think eventually we should converge to a single snapshot testing library, but I am not sure that `expect` is exactly right, so I suggest rolling with both insta and expect for some time (if folks agree that expect might be better in the first place!).
# Editor Integration Implementation
The thing I am most excited about is the ability to update a specific snapshot from the editor. I want this to be available to other snapshot-testing libraries (cc @mitsuhiko, @aaronabramov), so I want to document how this works.
The ideal UI here would be a code action (:bulb:). Unfortunately, it seems like it is impossible to implement without some kind of persistence (if you save test failures into some kind of a database, like insta does, than you can read the database from the editor plugin). Note that it is possible to highlight error by outputing error message in rustc's format. Unfortunately, one can't use the same trick to implement a quick fix.
For this reason, expect makes use of another rust-analyzer feature -- ability to run a single test at the cursor position. This does need some expect-specific code in rust-analyzer unfortunately. Specifically, if rust-analyzer notices that the cursor is on `expect!` macro, it adds a special flag to runnable's JSON. However, given #5017 it is possible to approximate this well-enough without rust-analyzer integration. Specifically, an extension can register a special runner which checks (using regexes) if rust-anlyzer runnable covers text with specific macro invocation and do special magic in that case.
closes #3835
Co-authored-by: Aleksey Kladov <[email protected]>
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|