Aleksey Kladov
b5ce84b170
Align CallableDefId naming with other ids
2020-07-16 13:16:34 +02:00
Aleksey Kladov
b598ab8be4
Rename CallableDefId -> InternedCallabelDefid
2020-07-16 13:13:17 +02:00
Aleksey Kladov
1d6cf33663
Simplify
2020-07-16 11:37:26 +02:00
Aleksey Kladov
bb2613ed4d
Move type
2020-07-16 10:29:21 +02:00
Aleksey Kladov
1d63b3efc9
simplify
2020-07-16 10:25:36 +02:00
bors[bot]
6a74a91713
Merge #5401
...
5401: Implement Chalk closure support r=matklad a=flodiebold
This makes use of Chalk's closure support, which means we can get rid of our last built-in impls and a bunch of other surrounding stuff.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-07-16 08:02:39 +00:00
Jeremy Kolb
7fba2274d9
Update lsp-types for HoverOptions
2020-07-15 18:17:46 -04:00
Florian Diebold
2077004463
Remove TypeCtor interning
...
Our TypeCtor and Chalk's TypeName match now!
2020-07-15 22:07:13 +02:00
Florian Diebold
a48843a16a
Use Chalk closure support
2020-07-15 22:04:49 +02:00
bors[bot]
b63e23e98e
Merge #5350
...
5350: Filter assists r=matklad a=kjeremy
Uses the `CodeActionContext::only` field to compute only those assists the client cares about.
It works but I don't really like the implementation.
Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-07-15 17:58:46 +00:00
bors[bot]
e30d39d502
Merge #5396
...
5396: Cap macro expansion depth for IDE features r=matklad a=matklad
closes #4453
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-15 15:19:07 +00:00
Aleksey Kladov
6b9c725673
Cap macro expansion depth for IDE features
...
closes #4453
2020-07-15 17:18:19 +02:00
Leander Tentrup
119e71d9ea
Add new Punctuation
highlight tag
2020-07-15 16:42:47 +02:00
Leander Tentrup
33832d43fc
Highlight punctuation as HighlightTag::Operator
2020-07-15 16:40:38 +02:00
bors[bot]
57652fc9d4
Merge #5395
...
5395: Show fewer syntax errors r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-15 14:06:28 +00:00
Aleksey Kladov
0908318171
Show fewer syntax errors
2020-07-15 16:06:04 +02:00
bors[bot]
e0ef6d5c09
Merge #5394
...
5394: Add missing cancellation point r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-15 13:54:04 +00:00
Aleksey Kladov
4c08fc9be3
Cleanup limits
2020-07-15 15:53:33 +02:00
Aleksey Kladov
8baa2b727d
Check cancellation when updating imports recursively
...
For winapi, this takes a lot of CPU time without doing queries and
causes the main event loop to stall on cancellation.
2020-07-15 15:49:20 +02:00
Aleksey Kladov
760ee8173c
Micro-optimize update
2020-07-15 15:45:34 +02:00
Jeremy Kolb
21c1504ca9
Move allow list into AssistConfig
2020-07-15 09:45:30 -04:00
bors[bot]
fbdc3c7849
Merge #5390
...
5390: Don't drop flycheck messages during restart r=matklad a=matklad
closes #5386
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-15 12:38:24 +00:00
Aleksey Kladov
a40e05dd5d
Don't drop flycheck messages during restart
...
closes #5386
2020-07-15 14:37:44 +02:00
Jeremy Kolb
6a7d1d4412
Invert condition
2020-07-15 08:17:48 -04:00
Jeremy Kolb
26725fcfbb
Fix conversion
2020-07-15 08:17:32 -04:00
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
kjeremy
aa598ecb75
Filter assists
2020-07-13 17:41:47 -04: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
Florian Diebold
209c492432
Upgrade Chalk
2020-07-12 19:58:34 +02:00
Jeremy Kolb
6a18dbe116
Update lsp-types
2020-07-12 12:28:00 -04:00
Florian Diebold
8a72e40ca9
Fix #4966
...
We add a level of binders when converting our function pointer to Chalk's; we
need to remove it again on the way back.
2020-07-12 15:37:32 +02:00
bors[bot]
70d1b848eb
Merge #5330
...
5330: Fix ignore attribute autocompletion r=matklad a=avrong
Fixes #5232
<img width="273" alt="image" src="https://user-images.githubusercontent.com/6342851/87242025-a4782400-c431-11ea-91b7-5127f9742122.png ">
<img width="238" alt="image" src="https://user-images.githubusercontent.com/6342851/87242044-c96c9700-c431-11ea-8161-f197f8e97ca0.png ">
Co-authored-by: Aleksei Trifonov <avrong@avrong.me>
2020-07-12 09:57:11 +00:00
bors[bot]
28f0171dbd
Merge #5326
...
5326: infer: Add type inference support for Union types r=flodiebold a=otavio
This adds the type inference to Union types and add a small test case
for it, ensuring it keeps working in future.
Fixes : #5277
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
----
#
Co-authored-by: Otavio Salvador <otavio@ossystems.com.br>
2020-07-12 09:45:37 +00:00
Aleksei Trifonov
e78d468b22
Fix ignore attribute autocompletion
2020-07-12 11:17:15 +03:00
Aleksey Kladov
f48ab3ebeb
Comment decorations
...
closes #4461
2020-07-12 02:23:41 +02:00
Aleksey Kladov
d9fd7ca6a5
change vis works on statics
2020-07-12 01:49:51 +02:00
bors[bot]
49fbd1b625
Merge #5325
...
5325: Update lsp-types to account for new CodeActionKind structure r=kjeremy a=kjeremy
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-07-11 22:36:53 +00:00
Otavio Salvador
9d114b9707
infer: Add type inference support for Union types
...
This adds the type inference to Union types and add a small test case
for it, ensuring it keeps working in future.
Fixes : #5277
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2020-07-11 19:30:02 -03:00
Jeremy Kolb
8c81465d5b
Update tests
2020-07-11 18:23:08 -04:00
Jeremy Kolb
007812dcae
Update lsp-types to account for new CodeActionKind structure
2020-07-11 17:29:45 -04:00
bors[bot]
02efda91d0
Merge #5324
...
5324: Implementations lens for unions r=matklad a=matklad
closes #4728
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-11 20:53:57 +00:00
Aleksey Kladov
b34cdf7bf4
Implementations lens for unions
...
closes #4728
2020-07-11 22:53:31 +02:00
Aleksey Kladov
b20a6b582b
Rewrite item_tree tests to expect
...
insta review wouldn't update the test, so ...
2020-07-11 22:11:31 +02:00
Aleksey Kladov
66e2266d04
Extern fns are implicitly unsafe
...
closes #4865
2020-07-11 21:53:32 +02:00
Aleksey Kladov
b4443b0398
Bump macro recursion limit in release
2020-07-11 20:01:56 +02:00
Aleksey Kladov
a8891ae3ca
More tight recursion limit when expanding macros in function bodies
...
cc #4944
cc #5317
This doesn't fully close #4944 -- looks like we hit SO in syntax
highlighting, when we use `Semantics::expand_macro`.
Seems like we need to place expansion limit on the macro itself (store
it as a part of MacroCallId?)!
2020-07-11 18:39:49 +02:00
Aleksey Kladov
19f8912506
Minor
2020-07-11 14:57:07 +02:00
Aleksey Kladov
e1d6b7f7c4
Use dedicated semantic highlight tag for parameters
...
closes #5106
2020-07-11 14:51:41 +02:00
bors[bot]
87ddcba05f
Merge #5313
...
5313: no doctests r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-11 11:31:32 +00:00
Aleksey Kladov
847135495f
no doctests
2020-07-11 13:31:02 +02:00
bors[bot]
9e75b39115
Merge #5312
...
5312: Make slow test parallel r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-11 10:57:21 +00:00
Aleksey Kladov
9a3c22bbfd
Make slow test parallel
2020-07-11 12:56:44 +02:00
bors[bot]
ba48c6548c
Merge #5311
...
5311: Fix goto definition for type alias type parameters r=matklad a=matklad
closes https://github.com/rust-analyzer/rust-analyzer/issues/5042
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-11 10:46:25 +00:00
Aleksey Kladov
8c4919c9fd
Fix goto definition for type alias type parameters
...
closes https://github.com/rust-analyzer/rust-analyzer/issues/5042
2020-07-11 12:45:30 +02:00
bors[bot]
45be08c708
Merge #5310
...
5310: Reduce visibility r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-11 10:34:14 +00:00
Aleksey Kladov
3fc4916b53
Reduce visibility
2020-07-11 12:31:50 +02:00
bors[bot]
33ebfa8dcc
Merge #5309
...
5309: Make sure there are no commands in code actions r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-11 09:58:56 +00:00
Aleksey Kladov
0f0c5081c0
Make sure there are no commands in code actions
2020-07-11 11:53:24 +02:00
bors[bot]
6c1546c3a4
Merge #4996
...
4996: Correctly generate new struct field in file containing struct def r=matklad a=TimoFreiberg
WIP because the test doesn't pass.
Testing the fix by hand looked good, although quickfixes seem to not support setting the editor cursor yet, which i think we want for "generate missing defs from usage" fixes.
Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-07-11 09:51:31 +00:00
Aleksey Kladov
7f6e5de37c
disable profiling
2020-07-11 03:41:52 +02:00
Aleksey Kladov
5e25000763
Profiling example
2020-07-11 03:41:01 +02:00
Aleksey Kladov
e7ba7f47a7
Profiling tweaks
2020-07-11 03:04:37 +02:00
Aleksey Kladov
e6ea395fb0
Don't show error when speculatively reloading workspace
2020-07-11 01:39:06 +02:00
Aleksey Kladov
a36ff4a100
Speed up completion
2020-07-11 01:26:24 +02:00
Aleksey Kladov
a425d7d871
Simplify
2020-07-10 23:57:10 +02:00
Aleksey Kladov
dac9a4cebd
Don't spawn notify unnecessary
2020-07-10 23:45:07 +02:00
Aleksey Kladov
a1ef6cc553
Optimize VFS processing
2020-07-10 22:30:24 +02:00
Aleksey Kladov
676d2e040d
Sort cargo metadata
...
See https://github.com/rust-lang/cargo/issues/8477
We need this to prevent spurious workspace reloads
2020-07-10 22:30:24 +02:00
Aleksey Kladov
be679a02ab
Add profiling calls
2020-07-10 22:30:24 +02:00
Aleksey Kladov
86bc4d20b3
Also reload when adding new examples, tests, etc
2020-07-10 22:30:24 +02:00
Timo Freiberg
43079ba80d
Correctly generate new struct field in file containing struct def
2020-07-10 19:16:41 +02:00
Aleksey Kladov
a482eb0cd8
Better caret placement when filling match arms
2020-07-10 18:22:04 +02:00
Aleksey Kladov
3558736582
Better name
2020-07-10 17:56:55 +02:00
Aleksey Kladov
2d20c8f218
Don't add braces after struct
...
Unit structs are a thing
2020-07-10 17:42:18 +02:00
Aleksey Kladov
e4983daa5e
Better complete expression keywords
2020-07-10 17:41:43 +02:00
Aleksey Kladov
51dd06566e
Complete params in nested fns
2020-07-10 16:29:14 +02:00
Aleksey Kladov
d02aabe633
Complete parameters more aggressively
2020-07-10 16:07:12 +02:00
Aleksey Kladov
74d376763c
Refresh tests
2020-07-10 16:05:01 +02:00
bors[bot]
9ab59e2162
Merge #5293
...
5293: Automatically reload project info on Cargo.toml changes r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-10 13:35:46 +00:00
Aleksey Kladov
d0a8f6a3eb
Automatically reload project info on Cargo.toml changes
2020-07-10 15:35:15 +02:00
Aleksey Kladov
075380dd56
Look through Arc for goto type definition
2020-07-10 14:42:26 +02:00
Aleksey Kladov
cd4502fd47
Simplify tests
2020-07-10 14:39:05 +02:00
Aleksey Kladov
f4147f6a34
Dont expose ID
2020-07-10 14:11:31 +02:00
Aleksey Kladov
9c54537ecf
Rename
2020-07-10 14:09:31 +02:00
Aleksey Kladov
b85042601d
Goto type definition works for self
2020-07-10 14:08:35 +02:00
bors[bot]
5fa8f8e376
Merge #5286
...
5286: Only take first 500 syntax errors r=jonas-schievink a=yihuang
Too many syntax errors make some editor/ide slow, fix #3434 .
Co-authored-by: yihuang <yi.codeplayer@gmail.com>
2020-07-10 09:33:29 +00:00
yihuang
17ff67dd7e
Only take first 500 syntax errors
...
Too many syntax errors make some editor/ide slow, fix #3434 .
2020-07-10 17:30:57 +08:00
Aleksey Kladov
17edf50e2c
Avoid accidently stumping over config values
2020-07-10 10:07:08 +02:00
Aleksey Kladov
68706b59c9
Don't mess with cursor position when adding hashes
2020-07-09 19:21:41 +02:00
bors[bot]
1fb92d791e
Merge #5284
...
5284: Fold struct literals r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-09 16:49:44 +00:00
Aleksey Kladov
ca8969a104
Fold struct literals
2020-07-09 18:49:17 +02:00
Jonas Schievink
74aa0ab9f7
arg count mismatch: handle tuple ctors
2020-07-09 18:24:02 +02:00
bors[bot]
89c7c55995
Merge #5270
...
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`:
8aa10c00a4/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 <jonas.schievink@ferrous-systems.com>
2020-07-09 15:34:43 +00:00
Jonas Schievink
f4a9d9a00f
Address review comments
2020-07-09 17:33:49 +02:00
Aleksey Kladov
65d9966a4f
Always put config first
2020-07-09 16:12:53 +02:00
Aleksey Kladov
e075e6eef2
Move diagnostics tests to expect
2020-07-09 16:04:29 +02:00
Jonas Schievink
984b6889eb
Add tests
2020-07-09 15:52:10 +02:00
Jonas Schievink
3ce4407dcb
Fix diagnostic for method calls
2020-07-09 15:51:32 +02:00
Jonas Schievink
d04f3604d5
Correctly pluralize message
2020-07-09 15:50:53 +02:00
Jonas Schievink
73327c647d
Remove unnecessary DiagnosticSink handlers
2020-07-09 15:50:35 +02:00
Aleksey Kladov
d70f4f5da5
Add fixmes
2020-07-09 15:41:13 +02:00
Aleksey Kladov
9d0196a491
Simplify
2020-07-09 15:35:52 +02:00
Aleksey Kladov
b398519011
Cleanup diagnostic conversion code
2020-07-09 15:34:37 +02:00
Aleksey Kladov
117392e879
Remove insta from ra_ide
2020-07-09 14:33:57 +02:00
Aleksey Kladov
fb0bc941a5
Cleanup diagnostics tests
2020-07-09 14:33:03 +02:00
Aleksey Kladov
ea68a1d0c9
Reduce code duplication
2020-07-09 13:59:49 +02:00
Jonas Schievink
47d0cf201c
Don't emit diagnostic if there are type errors
2020-07-09 12:41:35 +02:00
Jonas Schievink
63ce2c7b5f
Add argument count mismatch diagnostic
2020-07-09 12:16:29 +02:00
Aleksey Kladov
4399eff2d0
Re-enable IDE features for incomplete impl blocs
2020-07-09 12:14:26 +02:00
Aleksey Kladov
8e1ebbcc13
Simplify
2020-07-09 11:47:27 +02:00
Aleksey Kladov
2aa27d612e
expect should be a dev dep
2020-07-09 10:59:41 +02:00
Aleksey Kladov
b660681a6b
Unify tests
2020-07-09 10:58:56 +02:00
Aleksey Kladov
b9aab22d56
No blank indent
2020-07-09 10:33:32 +02:00
Aleksey Kladov
c66812193e
Prettier rendering
2020-07-09 10:31:12 +02:00
Aleksey Kladov
e7c47eb7f5
Streamline
2020-07-09 10:19:37 +02:00
Aleksey Kladov
3a26752c66
Reduce API
2020-07-09 10:03:28 +02:00
Aleksey Kladov
22269c67b8
Cleanup
2020-07-09 09:56:15 +02:00
Aleksey Kladov
3ef9ef34c6
Reduce API
2020-07-09 09:42:01 +02:00
Aleksey Kladov
ed12bd2791
Rename
2020-07-09 09:39:53 +02:00
Aleksey Kladov
abbb539f97
Refactor hover tests
2020-07-09 00:10:49 +02:00
Aleksey Kladov
9ce9a4ae0d
Simplify tests
2020-07-08 23:06:15 +02:00
Aleksey Kladov
e4b4600752
better language
2020-07-08 22:47:50 +02:00
Aleksey Kladov
e8bb153b19
Add Markup type
2020-07-08 22:37:35 +02:00
Aleksey Kladov
16dcf020c4
simplify
2020-07-08 20:35:54 +02:00
Aleksey Kladov
d74a77efb1
Minimize API
2020-07-08 20:35:54 +02:00
Aleksey Kladov
7238acab78
Dead code
2020-07-08 20:35:54 +02:00
Aleksey Kladov
86aac4303f
Reduce visibility
2020-07-08 19:41:57 +02:00
Aleksey Kladov
dab7f3d2c6
Remove relative_path dependency
2020-07-08 19:32:36 +02:00
Aleksey Kladov
7ae696ba76
Remove unwanted dependency
2020-07-08 18:26:31 +02:00
Aleksey Kladov
35e4bb3506
Document failed refactor
2020-07-08 18:17:45 +02:00
kjeremy
4b7f473223
Clippy perf warnings
2020-07-08 09:45:29 -04:00
Aleksey Kladov
69b79e3a73
Replace ad hocery with science
2020-07-07 23:28:48 +02:00
Aleksey Kladov
5d2225f4bc
Fix symbol search in salsa
...
Previous solution for binning paths into disjoint directories was
simple and fast -- just a single binary search.
Unfortunatelly, it wasn't coorrect: if the ditr are
/d
/d/a
/d/c
then partitioning the file /d/b/lib.rs won't pick /d as a correct
directory.
The correct solution here is a trie, but it requires exposing path
components.
So, we use a poor man's substitution -- a *vector* of sorted paths,
such that each bucket is prefix-free
closes #5246
2020-07-07 17:38:02 +02:00
Aleksey Kladov
9effc6116f
Upstream salsa
2020-07-07 15:48:55 +02:00
bors[bot]
73e972a173
Merge #5244
...
5244: Add a command to compute memory usage statistics r=matklad a=jonas-schievink
This allows inspecting memory usage on a live rust-analyzer instance after it has been used interactively.
This will only work with `--features jemalloc`, so maybe it should print something more useful when that's not available? Right now it will just print 0 Bytes for every query.
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-07 11:00:04 +00:00
bors[bot]
0719f2824c
Merge #5247
...
5247: Modernize unqualified reference completion tests r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-07 10:52:54 +00:00
Aleksey Kladov
5b8a5bfb15
Modernize unqualified reference completion tests
2020-07-07 12:52:09 +02:00
bors[bot]
687fb031d2
Merge #5245
...
5245: Refactor AssistBuilder to manage a SourceChange r=matklad a=theduke
`AssistBuilder` now managaes a full `SourceChange` instead of a
`Vec<SourceFileEdit>`.
This prepares AssistBuilder to handle creation of new files.
Co-authored-by: Christoph Herzog <chris@theduke.at>
2020-07-07 10:25:17 +00:00
Christoph Herzog
3360118040
Refactor AssistBuilder to manage a SourceChange
...
`AssistBuilder`` now managaes a full `SourceChange` instead of a
Vec<SourceFileEdit>.
This prepares AssistBuilder to handle creation of new files.
2020-07-07 12:10:18 +02:00
Jonas Schievink
f44c4b61e1
Add a command to compute memory usage statistics
2020-07-07 12:10:14 +02:00
Aleksey Kladov
9b2847885d
cleanup
2020-07-07 11:44:16 +02:00
bors[bot]
0f5d62a3f3
Merge #5235 #5236 #5241
...
5235: Don't ping people in PRs r=matklad a=lnicola
5236: Disable ES module interop r=matklad a=lnicola
5241: Clippy perf warnings r=matklad a=kjeremy
Removes redundant clones
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-07 09:29:52 +00:00
Aleksey Kladov
4bbc385277
Switch to fully dynamically dispatched salsa
...
This improves compile times quite a bit
2020-07-07 10:14:48 +02:00
kjeremy
ebdee366b0
Clippy perf warnings
...
Removes redundant clones
2020-07-06 17:13:55 -04:00
Aleksey Kladov
23258d8436
Simplify file watcher
2020-07-06 09:28:17 +02:00
bors[bot]
8b0983e89a
Merge #5228
...
5228: Fix typo r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-05 09:24:58 +00:00
Aleksey Kladov
569504938e
Fix typo
2020-07-05 11:19:16 +02:00
Aleksey Kladov
4be73c2b7f
AbsPath
2020-07-05 11:15:35 +02:00
Aleksey Kladov
453167b492
Modernise item completion tests
2020-07-04 23:25:33 +02:00
Paul Daniel Faria
5b96d4103e
Fallback to target in cfg if not specified in project json config
2020-07-04 13:50:27 -04:00
Paul Daniel Faria
db99f2dd7e
Add optional target to crates in json project, lookup default cfgs per target when generating cfg list
2020-07-04 13:49:44 -04:00
Aleksey Kladov
943fa46395
Alight details in comkplation list
2020-07-04 19:03:58 +02:00
Aleksey Kladov
c14a3b4a20
Modernize qual path completion tests
2020-07-04 18:53:30 +02:00
Aleksey Kladov
824a24c710
Modernize snippet completion tests
2020-07-04 18:03:34 +02:00
Aleksey Kladov
3902e5574c
Add Item change to the set of benches
2020-07-04 17:04:33 +02:00
Aleksey Kladov
000d1db351
Fix bench to work with relative paths
2020-07-04 17:03:02 +02:00
Aleksey Kladov
ba9c398144
Modernize postfix completion tests
2020-07-04 15:44:21 +02:00
Aleksey Kladov
7a7fd6d239
Modernize pattern completion tests
2020-07-04 15:10:55 +02:00
Aleksey Kladov
9dacd2338c
Fix lookup in tests
2020-07-04 15:05:33 +02:00
Aleksey Kladov
216e093f90
Macro tests
2020-07-04 15:04:57 +02:00
Aleksey Kladov
03ca33406e
Modernize tests
2020-07-04 14:53:43 +02:00
Aleksey Kladov
f2f6a46aa4
Cleanup dot completiont tests
2020-07-04 10:41:50 +02:00
Aleksey Kladov
caeddff543
Comments
2020-07-04 10:03:27 +02:00
Aleksey Kladov
5c68dd6b59
Better tests for completion scoring
2020-07-04 09:53:54 +02:00
Aleksey Kladov
aaba2300fb
Modernize completion presentation tests
2020-07-04 09:36:53 +02:00
Aleksey Kladov
65768feaff
Unify naming
2020-07-04 09:08:51 +02:00
Aleksey Kladov
6518f18f80
Cleanup tests
2020-07-04 09:07:18 +02:00
bors[bot]
212fa29a69
Merge #5197
...
5197: SSR internal refactorings r=davidlattimore a=davidlattimore
- Extract error code out to a separate module
- Improve error reporting when a test fails
- Refactor matching code
- Update tests so that all paths in search patterns can be resolved
Co-authored-by: David Lattimore <dml@google.com>
2020-07-04 00:13:11 +00:00
David Lattimore
a354e5b5cf
SSR: Update tests so that all paths in patterns can be resolved
2020-07-04 08:56:58 +10:00
David Lattimore
69051d2f9d
SSR: Refactor matching code.
...
Mutable state is now stored in the enum Phase.
MatchState, since it now has no mutable state is renamed Matcher.
MatchInputs is merged into Matcher
2020-07-04 08:56:58 +10:00
David Lattimore
4a8679824b
SSR: Improve error reporting when a test fails
2020-07-04 08:56:58 +10:00
David Lattimore
a5ef644a16
SSR: Extract error code out to a separate module
...
This is to make reusing it outside of parsing easier in a subsequent
change.
2020-07-04 08:56:51 +10:00
Aleksey Kladov
cda1a6c638
Cleanup more completion tests
2020-07-04 00:01:45 +02:00
Aleksey Kladov
9f9b38bdb4
Cleanup presentation tests
2020-07-03 23:15:44 +02:00
Aleksey Kladov
d09f692300
Add AssistKind::Generate
2020-07-03 19:32:18 +02:00
Aleksey Kladov
66b6a433c6
Unify naming of generating assists
2020-07-03 19:32:18 +02:00
bors[bot]
a434ecef51
Merge #5212
...
5212: Fix module renaming r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-03 16:55:01 +00:00
Aleksey Kladov
f4a3bc30b8
Fix module renaming
2020-07-03 18:47:26 +02:00
Aleksey Kladov
4c347a9f65
Compress rename tests
2020-07-03 18:39:36 +02:00
Aleksey Kladov
2656c415c8
Use expect for rename tests
2020-07-03 18:35:43 +02:00
Aleksey Kladov
ee7ab0104d
Adhere to code style in rename tests
2020-07-03 18:29:37 +02:00
bors[bot]
7ad7f3ca8c
Merge #5211
...
5211: Fix inference of indexing argument (partly) r=flodiebold a=flodiebold
We need to add the `T: Index<Arg>` obligation to be resolved later as well, otherwise we can't make inferences about `Arg` later based on the `Index` impls.
This still doesn't fix indexing with integer variables though; there's a further problem with Chalk floundering because of the variable, I think.
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-07-03 16:18:34 +00:00
Florian Diebold
57feb323f7
Fix inference of indexing argument (partly)
...
We need to add the `T: Index<Arg>` obligation to be resolved later as well,
otherwise we can't make inferences about `Arg` later based on the `Index` impls.
This still doesn't fix indexing with integer variables though; there's a further
problem with Chalk floundering because of the variable, I think.
2020-07-03 18:17:06 +02:00
bors[bot]
0f68fed4a0
Merge #5209
...
5209: Fixes to memory usage stats r=matklad a=jonas-schievink
This brings the unaccounted memory down from 287mb to 250mb, and displays memory used by VFS and "other" allocations.
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-03 15:58:46 +00:00
Aleksey Kladov
b8ef8539a6
Fix workspace reloading
2020-07-03 17:19:00 +02:00
Jonas Schievink
f01e7e3601
Track VFS and remaining/unaccounted memory
2020-07-03 17:16:01 +02:00
Jonas Schievink
93d0ac7fa0
Fix memory usage accounting for interned queries
2020-07-03 17:12:29 +02:00
bors[bot]
88a602f305
Merge #5205
...
5205: Refactor attribut completion tests r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-03 14:06:13 +00:00
Aleksey Kladov
314efae29d
Refactor attribut completion tests
2020-07-03 15:59:37 +02:00
Aleksey Kladov
f1671f460b
Compress attribute completion tests
2020-07-03 15:38:53 +02:00
bors[bot]
f51b0cfdd6
Merge #5116
...
5116: Categorize assists r=matklad a=kjeremy
Categorize assists so that editors can use them. Follows the LSP spec pretty close (and some things may need adjustments) but this populates the Refactor menu in vscode and pushes quickfixes through again.
This is a prerequisite to filtering out assists that the client doesn't care about.
Fixes #4147
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-03 12:44:09 +00:00
Aleksey Kladov
503de8e229
Add function to test completion edit
2020-07-03 13:21:48 +02:00
Aleksey Kladov
e2b04621f9
Refactor keyword completion tests
2020-07-03 12:51:18 +02:00
Aleksey Kladov
0e23175a07
Cleanup record completion tests
2020-07-03 11:48:48 +02:00
kjeremy
4c9347ecc3
Don't categorize things we don't care about
2020-07-02 18:01:22 -04:00
kjeremy
36cc81ac71
Move AssistKind into AssistId
2020-07-02 17:48:35 -04:00
kjeremy
1d58e16824
Recategorize a few
2020-07-02 17:14:15 -04:00
Jeremy Kolb
b98c16a034
Categorize assists
2020-07-02 17:13:02 -04:00
bors[bot]
4cb8bf03c5
Merge #5192
...
5192: Implement rust-analyzer feature configuration to tests. r=matklad a=daxpedda
Fixes #3198 .
I'm unsure if it is desired this way, maybe we want to make a seperate configuration?
Co-authored-by: daxpedda <daxpedda@gmail.com>
2020-07-02 15:48:54 +00:00
Aleksey Kladov
6c7578bd7a
Move cargo metadata off the main loop
2020-07-02 17:39:51 +02:00
daxpedda
eb75a644a1
Implement rust-analyzer feature configuration to tests.
2020-07-02 16:13:24 +02:00
bors[bot]
83f3cdca4f
Merge #5191
...
5191: Minor r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-02 14:10:13 +00:00
Aleksey Kladov
6a694ad047
Minor
2020-07-02 16:06:00 +02:00
bors[bot]
1a3a7f4237
Merge #5188
...
5188: Implement StatusBar r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-02 14:02:52 +00:00
bors[bot]
e75b4fc85e
Merge #5189
...
5189: Record and suggest assoc. items of traits via ImportMap r=matklad a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5115
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-02 13:55:14 +00:00
Jonas Schievink
6ee73cd334
Use SmolStr
2020-07-02 15:42:37 +02:00
Aleksey Kladov
4f26a3734e
Indicate when project needs a reload
2020-07-02 15:34:12 +02:00
Aleksey Kladov
3ef7676076
Implement StatusBar
2020-07-02 15:32:14 +02:00
Jonas Schievink
361b399b6d
Fix tests
2020-07-02 13:34:08 +02:00
Jonas Schievink
31f5b48817
Record and suggest trait items via ImportMap
2020-07-02 12:43:52 +02:00
bors[bot]
57ed622ec4
Merge #5089 #5161 #5184 #5185 #5186
...
5089: Disable auto-complete on comments r=matklad a=BGluth
Resolves #4907 by disabling any auto-completion on comments.
As flodiebold [pointed out](https://github.com/rust-analyzer/rust-analyzer/issues/4907#issuecomment-648439979 ), in the future we may want to support some form of auto-completion within doc comments, but for now it was suggested to just disable auto-completion on them entirely.
The implementation involves adding a new field `is_comment` to `CompletionContext` and checking if the immediate token we auto-completed on is a comment. I couldn't see a case where we need to check any of the ancestors, but let me know if this is not sufficient. I also wasn't sure if it was necessary to add a new field to this struct, but I decided it's probably the best option if we want to potentially do auto-completion on doc comments in the future.
Finally, the three tests I added should I think ideally not filter results by `CompletionKind::Keyword`, but if I want to get unfiltered results, I need access to a non-public function [get_all_completion_items](9a4d02faf9/crates/ra_ide/src/completion/test_utils.rs (L32-L39)
) which I don't know if I should make public just for this.
5161: SSR: Add initial support for placeholder constraints r=matklad a=davidlattimore
5184: Always install required nightly extension if current one is not nightly r=matklad a=Veetaha
This is weird, but having switched back to stable by uninstalling the extension appears that vscode doesn't destroy the `PersistentState` and thus changing to `nightly` channel doesn't work because the last check for nightly extension was less than 1 hour ago. The simple solution is to skip this check if we know that the current extension version is not nightly.
5185: Force showing extension activation error pop-up notification r=matklad a=Veetaha
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5091
5186: fix: correct pd/ppd/tfn/tmod completion doc r=matklad a=fannheyward
a33eefa3b2/crates/ra_ide/src/completion/complete_snippet.rs (L23-L24)
Co-authored-by: BGluth <gluthb@gmail.com>
Co-authored-by: David Lattimore <dml@google.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
Co-authored-by: Heyward Fann <fannheyward@gmail.com>
2020-07-02 09:12:46 +00:00
Heyward Fann
f1986be8fd
fix: correct pd/ppd/tfn/tmod completion doc
...
a33eefa3b2/crates/ra_ide/src/completion/complete_snippet.rs (L23)
2020-07-02 11:06:00 +08:00
David Lattimore
83588a1c45
SSR: Use T! instead of SyntaxKind::* where possible
2020-07-02 09:19:58 +10:00
BGluth
cc77bdf59a
Auto-completion no longer occurs on comments
2020-07-01 15:20:07 -06:00
BGluth
0bbd6428ad
Added tests for no auto-completion on comments
2020-07-01 15:16:47 -06:00
bors[bot]
a33eefa3b2
Merge #5149
...
5149: Implement Chalk variable kinds r=flodiebold a=flodiebold
This means we need to keep track of the kinds (general/int/float) of variables in `Canonical`, which requires some more ceremony. (It also exposes some places where we're not really dealing with canonicalization correctly -- another thing to be cleaned up when we switch to using Chalk's types directly.)
Should fix the last remaining issue of #2534 .
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-07-01 18:41:06 +00:00
Florian Diebold
d5d485ef92
Implement Chalk variable kinds
...
This means we need to keep track of the kinds (general/int/float) of variables
in `Canonical`, which requires some more ceremony. (It also exposes some places
where we're not really dealing with canonicalization correctly -- another thing
to be cleaned up when we switch to using Chalk's types directly.)
Should fix the last remaining issue of #2534 .
2020-07-01 20:40:38 +02:00
bors[bot]
ec1d1a1b70
Merge #5179
...
5179: ItemTree: Lower fields despite invalid type r=jonas-schievink a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5147
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-01 17:28:12 +00:00
Jonas Schievink
4ef1d533bd
ItemTree: Lower fields despite invalid type
2020-07-01 19:24:39 +02:00
bors[bot]
43dfd29d8d
Merge #5174
...
5174: Colorize more test fixtures r=matklad a=lnicola
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 17:20:02 +00:00
bors[bot]
ad1a0e626b
Merge #5175
...
5175: More memory-efficient impl collection r=matklad a=jonas-schievink
This saves roughly 90 MB in `ImplsFromDepsQuery`, which used to copy the list of all impls from libcore into *every* crate in the graph. It also stops collecting inherent impls from dependencies entirely, as those can only be located within the crate defining the self type.
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-01 17:12:06 +00:00
bors[bot]
8943c2cb97
Merge #5178
...
5178: Fold multiline calls r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 16:35:16 +00:00
Aleksey Kladov
8295dc42a0
Fold multiline calls
2020-07-01 18:27:58 +02:00
Laurențiu Nicola
dbb940fa7d
Colorize more test fixtures
2020-07-01 19:05:34 +03:00
Aleksey Kladov
53e3a7aeb4
Update file structure tests
2020-07-01 17:59:44 +02:00
Aleksey Kladov
bebbbb61a7
Update expand macro tests
2020-07-01 17:52:22 +02:00
Jonas Schievink
6bde542a39
Split CrateImplDefs
in inherent and trait impls
...
This makes the intention of inherent vs. trait impls somewhat more
clear and also fixes (?) an issue where trait impls with an unresolved
trait were added as inherent impls instead (hence the test changes).
2020-07-01 17:15:20 +02:00
bors[bot]
14bf5bb7ee
Merge #5167
...
5167: Reuse Semantics instances r=matklad a=lnicola
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 15:06:13 +00:00
bors[bot]
f565447775
Merge #5173
...
5173: Automatically reload project on config change r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 14:43:11 +00:00
Aleksey Kladov
a03cfa4926
Automatically reload project on config change
2020-07-01 16:42:14 +02:00
bors[bot]
3cf389f88b
Merge #5171
...
5171: Better account for project reload r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 14:01:36 +00:00
Aleksey Kladov
298adb27b9
Better account for project reload
2020-07-01 16:01:03 +02:00
Jonas Schievink
07ba986db7
Don't recursively call impls_from_deps
...
It creates a big map and duplicates lots of impls that are then left
lying around
2020-07-01 15:19:36 +02:00
Jonas Schievink
63ea8f2af0
Add a transitive deps iterator to CrateGraph
2020-07-01 15:18:51 +02:00
bors[bot]
3f94ad332a
Merge #5169
...
5169: Add reload workspace command r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 13:08:25 +00:00
Aleksey Kladov
c9f878962a
Add reload workspace command
2020-07-01 14:57:59 +02:00
Aleksey Kladov
18ec1ed72e
Log flycheck command
2020-07-01 14:49:13 +02:00
Laurențiu Nicola
9710ad8c48
Reuse Semantics instances
2020-07-01 15:27:01 +03:00
Jeremy Kolb
20d864807d
Use the selection range when resolving call hierarchy items
...
Add a test in call_hierarchy that already passed
Fixes #5103
2020-07-01 07:56:15 -04:00
bors[bot]
248b656c21
Merge #5162
...
5162: Try to reduce Semantics monomorphisations r=matklad a=lnicola
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 11:40:47 +00:00
Laurențiu Nicola
d89827f9e0
Make less code generic
2020-07-01 14:38:42 +03:00
Laurențiu Nicola
e8505f14d4
Try to reduce Semantics monomorphisations
2020-07-01 14:38:42 +03:00
Aleksey Kladov
44b8737ced
Dont show empty progress for empty workspaces
2020-07-01 13:05:34 +02:00
Aleksey Kladov
991850bc3c
Unify magic env var name
2020-07-01 12:31:03 +02:00
Aleksey Kladov
7b0113b3d5
Move parser specific tests utils to parser tests
2020-07-01 12:30:17 +02:00
bors[bot]
a9db3d53a0
Merge #5159
...
5159: Don't fail expect tests in rewrite mode r=matklad a=matklad
bors r+
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 09:35:31 +00:00
Aleksey Kladov
05d67a9a0e
Move test data to test_data directory
2020-07-01 11:26:09 +02:00
Aleksey Kladov
adf624b433
Add file support to expect
2020-07-01 11:19:40 +02:00
Laurențiu Nicola
c1139a5a44
Use the existing Semantics in auto_import
2020-07-01 11:48:15 +03:00
Aleksey Kladov
82838f5eda
Cleanup
2020-07-01 10:44:16 +02:00
Aleksey Kladov
977b688144
Don't fail tests when updating snapshot
2020-07-01 10:44:16 +02:00
David Lattimore
3d9997889b
SSR: Add initial support for placeholder constraints
2020-07-01 18:44:11 +10:00
bors[bot]
dd3ad2bd41
Merge #5154 #5157
...
5154: Structured search debugging r=matklad a=davidlattimore
Adds a "search" mode to the rust-analyzer binary that does structured search (SSR without the replace part). This is intended primarily for debugging why a bit of code isn't matching a pattern.
5157: Use dynamic dispatch in AstDiagnostic r=matklad a=lnicola
Co-authored-by: David Lattimore <dml@google.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 08:11:23 +00:00
bors[bot]
686e115e73
Merge #5158
...
5158: Use CrateName correctly r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 08:03:47 +00:00
Aleksey Kladov
80386ca5be
Use Strings for display names
2020-07-01 10:03:07 +02:00
Aleksey Kladov
307c6fec61
Use CrateName for semantic names
2020-07-01 09:53:53 +02:00
Laurențiu Nicola
1be5e848b0
Use dynamic dispatch in AstDiagnostic
2020-07-01 10:46:27 +03:00
Laurențiu Nicola
331e6d8f16
Remove db from AssistsContext
2020-07-01 10:25:59 +03:00
bors[bot]
98ae447fa7
Merge #5153
...
5153: Make SemanticsScope non-generic r=matklad a=lnicola
This slightly reduces the build times:
![image](https://user-images.githubusercontent.com/308347/86210975-3a809480-bb7e-11ea-8975-788457f6b353.png )
(compare to https://github.com/rust-analyzer/rust-analyzer/issues/1987#issuecomment-652202248 )
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 07:17:16 +00:00
Aleksey Kladov
e336a96998
FileSetConfig works with empty set of roots
...
Closes #5139
2020-07-01 09:06:51 +02:00
David Lattimore
95f8310514
Structured search debugging
2020-07-01 16:50:45 +10:00
Laurențiu Nicola
5953cbd7ae
Make SemanticsScope non-generic
2020-07-01 09:34:45 +03:00
bors[bot]
b1a2d01645
Merge #5142
...
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 <jonas.schievink@ferrous-systems.com>
2020-06-30 21:17:54 +00:00
Aleksey Kladov
cec92407f4
Don't crash on empty out_dirs with older cargos
...
closes #5125
2020-06-30 22:12:27 +02:00
Aleksey Kladov
8b725a2f77
Switch to expect for the rest of inlay tests
2020-06-30 21:55:21 +02:00
Aleksey Kladov
442c13ba17
Simplify most of the inlay hints tests
2020-06-30 18:04:25 +02:00
Jonas Schievink
4602c2eeaa
analysis-stats: allow parallel type inference
2020-06-30 17:00:17 +02:00
bors[bot]
0954d31bee
Merge #5138
...
5138: Refactor runnable tests r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 12:18:31 +00:00
Aleksey Kladov
de464f5e4a
Refactor runnable tests
2020-06-30 14:12:55 +02:00
bors[bot]
3e70d0f308
Merge #5136
...
5136: Split namespace maps in `ItemScope` r=jonas-schievink a=jonas-schievink
Reduces memory usage of the CrateDefMap query by ~130 MB (50%) on r-a.
I was also looking into handling glob imports more efficiently (storing scope chains instead of always duplicating everything into the glob-importing module's scope), but it seems that this already gives the most significant wins.
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-06-30 12:10:21 +00:00
Jonas Schievink
7c9b3d154c
Remove entries_without_primitives
2020-06-30 14:06:23 +02:00
Jonas Schievink
a80e8fea85
Simplify entry API usage
2020-06-30 13:54:40 +02:00
Aleksey Kladov
af7e300041
Remove confusing API
2020-06-30 13:29:53 +02:00
Jonas Schievink
56fb8a401a
Reorder imports
2020-06-30 13:25:15 +02:00
Jonas Schievink
0fcbc716fd
Split namespace maps in ItemScope
...
Reduces memory usage of the CrateDefMap query by ~130 MB on r-a.
2020-06-30 13:23:42 +02:00
Aleksey Kladov
34072d53b6
Rewrite goto implementation tests
2020-06-30 13:20:16 +02:00
Aleksey Kladov
4484908a86
Rewrite goto definition tests
2020-06-30 13:03:08 +02:00
Aleksey Kladov
d34e725f09
Better factoring
2020-06-30 12:14:16 +02:00
Aleksey Kladov
d21c84abd4
Generalize annotations
2020-06-30 12:13:08 +02:00
bors[bot]
e87cba85ef
Merge #5132
...
5132: Fix some typos r=matklad a=davidlattimore
Co-authored-by: David Lattimore <dml@google.com>
2020-06-30 08:45:16 +00:00
bors[bot]
d13ded6cbc
Merge #5101
...
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 (💡 ). 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 <aleksey.kladov@gmail.com>
2020-06-30 08:34:08 +00:00
David Lattimore
ef49bbeec4
Fix some typos
2020-06-30 10:43:37 +10:00
bors[bot]
2bd7171399
Merge #5120
...
5120: Add a simple SSR subcommand to the rust-analyzer command line binary r=davidlattimore a=davidlattimore
Is adding the dependency on ra_ide_db OK? It's needed for the call to `db.local_roots()`
Co-authored-by: David Lattimore <dml@google.com>
2020-06-29 23:33:34 +00:00
David Lattimore
867f29559f
Moved new deps to CLI-only section
2020-06-30 09:31:45 +10:00
bors[bot]
e1a5bd866e
Merge #5096 #5097
...
5096: Fix handling of whitespace when applying SSR within macro expansions. r=matklad a=davidlattimore
I originally did replacement by passing in the full file text. Then as some point I thought I could do without it. Turns out calling .text() on a node coming from a macro expansion isn't a great idea, especially when you then try and use ranges from the original source to cut that text. The test I added here actually panics without the rest of this change (sorry I didn't notice sooner).
5097: Fix SSR prompt following #4919 r=matklad a=davidlattimore
Co-authored-by: David Lattimore <dml@google.com>
2020-06-29 16:03:10 +00:00
bors[bot]
86f1556f7c
Merge #5122
...
5122: Fix "Run | Debug" lens for examples r=matklad a=vsrs
Fixes #4974
Co-authored-by: vsrs <vit@conrlab.com>
2020-06-29 15:55:42 +00:00
bors[bot]
4da0a78c4e
Merge #5126
...
5126: Use more of FxHash* r=matklad a=lnicola
```
-rwxr-xr-x 1 me me 37917528 Jun 29 17:26 /home/me/.cargo/bin/rust-analyzer
-rwxr-xr-x 1 me me 37904056 Jun 29 18:14 /home/me/.cargo/bin/rust-analyzer
```
Saved 13.5 KB there :-).
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-29 15:39:51 +00:00
Aleksey Kladov
bbc4dc9956
Update the rest of the tests
2020-06-29 17:23:01 +02:00
Aleksey Kladov
e805e8c1d5
(T): make typification tests more data driven
2020-06-29 17:23:01 +02:00
Laurențiu Nicola
95d67ec401
Use more of FxHash*
2020-06-29 18:07:52 +03:00
bors[bot]
82ce5792ab
Merge #5124
...
5124: (Partially) fix handling of type params depending on type params r=matklad a=flodiebold
If the first type parameter gets inferred, that's still not handled correctly; it'll require some more refactoring: E.g. if we have `Thing<T, F=fn() -> T>` and then instantiate `Thing<_>`, that gets turned into `Thing<_, fn() -> _>` before the `_` is instantiated into a type variable -- so afterwards, we have two type variables without any connection to each other.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-06-29 14:13:41 +00:00
Florian Diebold
8e8d2ffecb
(Partially) fix handling of type params depending on type params
...
If the first type parameter gets inferred, that's still not handled correctly;
it'll require some more refactoring: E.g. if we have `Thing<T, F=fn() -> T>` and
then instantiate `Thing<_>`, that gets turned into `Thing<_, fn() -> _>` before
the `_` is instantiated into a type variable -- so afterwards, we have two type
variables without any connection to each other.
2020-06-29 16:10:20 +02:00
vsrs
05e6cbf310
Fix "Run | Debug" lens for examples
2020-06-29 14:05:52 +03:00
David Lattimore
93a91ae9de
Add a simple SSR subcommand to the rust-analyzer command line binary
2020-06-29 13:34:45 +10:00
bors[bot]
ca31b1d63a
Merge #5105
...
5105: Simlify with matches!() r=matklad a=Veetaha
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-28 22:37:25 +00:00
Veetaha
36128c170d
Get rid of unused imports
2020-06-29 01:23:39 +03:00
Veetaha
503f9498cd
Follow matklad suggestions
...
- Move vis_offset() to utils.rs
- Shorten explicit ra_syntax::ast -> ast
- Undo refactoring exhaustive pattern to non-exhaustive
2020-06-29 01:18:50 +03:00
bors[bot]
11f31ae4c3
Merge #5114
...
5114: Cleanup cargo process handling in flycheck r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-28 21:43:18 +00:00
Aleksey Kladov
5cdd8d442e
Cleanup cargo process handling in flycheck
2020-06-28 23:42:44 +02:00
Aleksey Kladov
32e85a1a89
More standard pattern for Cargo
2020-06-28 23:01:28 +02:00
Aleksey Kladov
eddb744d90
Naming
2020-06-28 22:35:18 +02:00
Aleksey Kladov
309b21f378
Rename
2020-06-28 22:31:40 +02:00
Florian Diebold
3fe0d73670
Update Chalk to released version
2020-06-28 21:24:20 +02:00
Aleksey Kladov
80ef52f0d5
Make sure to join the child
2020-06-28 20:00:04 +02:00
Aleksey Kladov
7cf1981a2d
Don't show ra_fixture param hints
2020-06-28 13:11:41 +02:00
Veetaha
e75e2ae5b6
Simlify with matches!()
2020-06-28 04:03:59 +03:00
Aleksey Kladov
a4f934efa8
Update crates/rust-analyzer/src/handlers.rs
...
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-28 01:23:32 +02:00
Veetaha
39a58ed19a
Simplify
2020-06-28 01:30:45 +03:00
Aleksey Kladov
3c1714d76d
Fix potential overflow
2020-06-27 21:35:52 +02:00
Aleksey Kladov
53787c7eba
style
2020-06-27 21:33:14 +02:00
Aleksey Kladov
a9b4fb034b
Add colors
2020-06-27 21:14:25 +02:00
Aleksey Kladov
175e48e5be
Remove fragile test
...
This test needs to be updated after every change (it contains line
number), which is annoying.
It also fails on windows due to \, so it's easier to remove it.
2020-06-27 20:50:16 +02:00
Aleksey Kladov
18e4e9fb0b
Update crates/expect/src/lib.rs
...
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-06-27 20:50:16 +02:00
Aleksey Kladov
d21dae738b
Update crates/expect/src/lib.rs
...
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-06-27 20:50:16 +02:00
Laurențiu Nicola
f8d37ff0b2
Add support for include_bytes
2020-06-27 21:02:47 +03:00
Aleksey Kladov
be265ece02
Add example expect test for goto definition
2020-06-27 19:22:31 +02:00
Aleksey Kladov
03c5a6690d
Add light-weight snapshot testing library with editor integration
2020-06-27 19:22:31 +02:00
bors[bot]
446fd3f515
Merge #5100
...
5100: Add support for include_str r=edwin0cheng a=lnicola
r? @edwin0cheng
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-27 16:36:38 +00:00
Laurențiu Nicola
b4420626fb
Add support for include_str
2020-06-27 19:34:48 +03:00
Paul Daniel Faria
68a649d547
Simplify unsafe expr collection match
2020-06-27 12:00:46 -04:00
Paul Daniel Faria
b7e25ba854
Improve perf of finding unsafe exprs
2020-06-27 11:55:54 -04:00
Paul Daniel Faria
b1992b469c
Remove unneeded code, filename from tests, fix rebasing issues
2020-06-27 11:38:34 -04:00
Paul Daniel Faria
28bb8ed9cb
Cleanup changes leftover from previous tracking attempt
2020-06-27 10:16:19 -04:00
Paul Daniel Faria
2ca52bbb32
Revert ide highlighting changes (addressing on another branch)
2020-06-27 10:16:19 -04:00
Paul Daniel Faria
2fc92fa28c
Remove track_parent and parent_map, replace with simple walk in missign unsafe validator
2020-06-27 10:13:14 -04:00
Paul Daniel Faria
f78df42f81
Fix issues caused during rebase
2020-06-27 10:13:14 -04:00
Paul Daniel Faria
2608a6fd3a
unsafe: Clean up, improve tracking, add debug_assert
...
Move unsafe_expressions to unsafe_validation.rs, replace vec tracking of
child exprs with inline macro, add debug assert to ensure tracked
children match walked children exactly
2020-06-27 10:13:14 -04:00
Paul Daniel Faria
f678e0d837
Add HighlightTag::Operator, use it for unsafe deref. Move unsafe validation to its own file
2020-06-27 10:13:14 -04:00
Paul Daniel Faria
6c1682396c
Account for deref token in syntax highlighting of unsafe, add test for that case
2020-06-27 10:11:10 -04:00
Paul Daniel Faria
7f2219dc76
Track expr parents during lowering, use parent map when checking if unsafe exprs are within unsafe blocks
2020-06-27 10:10:26 -04:00
Paul Daniel Faria
9ce44be2ab
Address review comments, have MissingUnsafe diagnostic point to each unsafe use, update tests
2020-06-27 10:10:26 -04:00
Paul Daniel Faria
b9569886a9
Rename Expr::UnsafeBlock to Expr::Unsafe
2020-06-27 10:10:26 -04:00
Paul Daniel Faria
278cbf12cd
Track unsafe blocks, don't trigger missing unsafe diagnostic when unsafe exprs within unsafe block
2020-06-27 10:10:26 -04:00
Paul Daniel Faria
3df0f9ce7e
Add missing self param to test
2020-06-27 10:09:42 -04:00
Paul Daniel Faria
c622551ec2
Fix typo in test
2020-06-27 10:09:42 -04:00
Paul Daniel Faria
499d4c454d
Remove UnnecessaryUnsafe diagnostic, Fix Expr::Call unsafe analysis
2020-06-27 10:09:42 -04:00
Paul Daniel Faria
b358fbfdf8
Add tests covering unsafe blocks, more attempts to get call expr tests passing
2020-06-27 10:09:29 -04:00
Paul Daniel Faria
daf1cac9f8
Move diagnostics back into expr, add tests for diagnostics, fix logic to account for derefs of raw ptrs
2020-06-27 10:09:29 -04:00
Paul Daniel Faria
0b95bed83f
Add unsafe diagnostics and unsafe highlighting
2020-06-27 10:08:14 -04:00
bors[bot]
6a067ce947
Merge #5090
...
5090: Bump deps r=matklad a=lnicola
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-27 11:00:51 +00:00
Laurențiu Nicola
52a488982f
Bump rustc_lexer
2020-06-27 13:56:54 +03:00
Laurențiu Nicola
d036006c95
Bump deps
2020-06-27 13:56:54 +03:00
David Lattimore
64a49589e7
Fix handling of whitespace when applying SSR within macro expansions.
...
I originally did replacement by passing in the full file text. Then as some point I thought I could do without it. Turns out calling .text() on a node coming from a macro expansion isn't a great idea, especially when you then try and use ranges from the original source to cut that text. The test I added here actually panics without the rest of this change (sorry I didn't notice sooner).
2020-06-27 20:38:31 +10:00
Aleksey Kladov
491d000c27
Add ::
to label for crate::
completion
2020-06-27 12:26:25 +02:00
Aleksey Kladov
4e3e8d1ab2
cleanup
2020-06-27 12:07:48 +02:00
bors[bot]
18a6dd4635
Merge #4982
...
4982: Bump chalk r=matklad a=lnicola
This passes the tests, but fails in a weird way on `analysis-stats`:
```
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-solve-0.14.0/src/clauses/builtin_traits/fn_family.rs:96:20
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1076
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1537
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:218
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:477
11: rust_begin_unwind
at src/libstd/panicking.rs:385
12: core::panicking::panic_fmt
at src/libcore/panicking.rs:86
13: core::panicking::panic
at src/libcore/panicking.rs:51
14: chalk_solve::clauses::builtin_traits::fn_family::add_fn_trait_program_clauses
15: chalk_solve::clauses::builder::ClauseBuilder<I>::push_binders
16: chalk_solve::clauses::program_clauses_that_could_match
17: chalk_solve::clauses::program_clauses_for_goal
18: chalk_solve::recursive::Solver<I>::solve_new_subgoal
19: <chalk_solve::recursive::Solver<I> as chalk_solve::recursive::solve::SolveDatabase<I>>::solve_goal
20: chalk_solve::recursive::Solver<I>::solve_root_goal
21: chalk_solve::solve::Solver<I>::solve_limited
22: ra_hir_ty::traits::trait_solve_query
23: salsa::runtime::Runtime<DB>::execute_query_implementation
24: salsa::derived::slot::Slot<DB,Q,MP>::read_upgrade
25: salsa::derived::slot::Slot<DB,Q,MP>::read
26: <salsa::derived::DerivedStorage<DB,Q,MP> as salsa::plumbing::QueryStorageOps<DB,Q>>::try_fetch
27: salsa::QueryTable<DB,Q>::get
28: <T as ra_hir_ty::db::HirDatabase>::trait_solve
29: ra_hir_ty::infer::InferenceContext::resolve_ty_as_possible
30: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
31: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce
32: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::check_call_arguments
33: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_method_call
34: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
35: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr
36: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_method_call
37: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
38: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce
39: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
40: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
41: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce
42: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
43: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce
44: ra_hir_ty::infer::infer_query
45: salsa::runtime::Runtime<DB>::execute_query_implementation
46: salsa::derived::slot::Slot<DB,Q,MP>::read_upgrade
47: salsa::derived::slot::Slot<DB,Q,MP>::read
48: <salsa::derived::DerivedStorage<DB,Q,MP> as salsa::plumbing::QueryStorageOps<DB,Q>>::try_fetch
49: ra_hir_ty::db::infer_wait
50: rust_analyzer::cli::analysis_stats::analysis_stats
51: rust_analyzer::main
52: std::rt::lang_start::{{closure}}
53: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:52
54: std::panicking::try::do_call
at src/libstd/panicking.rs:297
55: std::panicking::try
at src/libstd/panicking.rs:274
56: std::panic::catch_unwind
at src/libstd/panic.rs:394
57: std::rt::lang_start_internal
at src/libstd/rt.rs:51
58: main
59: __libc_start_main
60: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```
It's as if we're returning `None` for a well-known trait that `chalk` asks about. That seems to happen for `Deref`, `CoerceUnsized` and `Try`.
r? @flodiebold
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-27 09:50:08 +00:00
bors[bot]
dd3f9eaceb
Merge #5007
...
5007: SSR: Allow matching within macro calls r=matklad a=davidlattimore
#3186
Co-authored-by: David Lattimore <dml@google.com>
2020-06-27 09:43:08 +00:00
bors[bot]
656cbc68a1
Merge #5033
...
5033: Order of glob imports should not affect import shadowing r=Nashenas88 a=Nashenas88
Fixes #5032
Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-06-27 02:51:54 +00:00
Paul Daniel Faria
1f5d30ff16
Replace simple is_named with matches macro
2020-06-26 22:51:13 -04:00
David Lattimore
fc46c12e36
Fix test following change to fixture parsing ( d016cb4867
)
2020-06-27 11:33:00 +10:00
David Lattimore
f4dc549582
SSR: Allow matching within macro calls
2020-06-27 11:33:00 +10:00
Aleksey Kladov
f89722f357
Better exe probing
2020-06-27 02:04:33 +02:00