Commit Graph

4227 Commits

Author SHA1 Message Date
bors[bot]
1541b2d689 Merge #1409
1409: The Fall down of failures r=matklad a=mominul

😁
Replaced all the uses of `failure` crate with `std::error::Error`.

Closes #1400 
Depends on rust-analyzer/teraron#1

Co-authored-by: Muhammad Mominul Huque <mominul2082@gmail.com>
2019-06-16 19:58:33 +00:00
Muhammad Mominul Huque
d3e74bfd2c
Update teraron version 2019-06-17 00:07:31 +06:00
bors[bot]
924d4d7ca8 Merge #1411
1411: add analysis-bench to benchmark incremental analysis r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-16 16:45:30 +00:00
Aleksey Kladov
6314e62cfb add analysis-bench to benchmark incremental analysis
Can be used like this:

```
$ cargo run --release -p ra_cli -- \
  analysis-bench ../chalk/ \
  --complete ../chalk/chalk-engine/src/logic.rs:94:0

loading: 225.970093ms

from scratch:   8.492373325s
no change:      445.265µs
trivial change: 95.631242ms
```

Or like this:

```
$ cargo run --release -p ra_cli -- \
  analysis-bench ../chalk/ \
  --highlight ../chalk/chalk-engine/src/logic.rs

loading: 209.873484ms

from scratch:   9.504916942s
no change:      7.731119ms
trivial change: 124.984039ms
```

"from scratch" includes initial analysis of the relevant bits of the
project

"no change" just asks the same question for the second time. It
measures overhead on assembling the answer outside of salsa.

"trivial change" doesn't do an actual salsa change, it just advances
the revision. This test how fast is salsa at validating things.
2019-06-16 19:45:05 +03:00
bors[bot]
b81caed43f Merge #1408
1408: Associated type basics & Deref support r=matklad a=flodiebold

This adds the necessary Chalk integration to handle associated types and uses it to implement support for `Deref` in the `*` operator and autoderef; so e.g. dot completions through an `Arc` work now.

It doesn't yet implement resolution of associated types in paths, though. Also, there's a big FIXME about handling variables in the solution we get from Chalk correctly.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-06-16 12:00:41 +00:00
Florian Diebold
ad3673d8d8 Add test for autoderef infinite recursion 2019-06-16 12:25:04 +02:00
Florian Diebold
96c2b9c41d Simplifications / cleanup from review 2019-06-16 12:25:04 +02:00
bors[bot]
e6fbff3246 Merge #1406
1406: reuse AnalysisHost in batch analysis r=matklad a=matklad

We do some custom setup in `AnalysisHost`, like setting up LRU size. I figure it's a good idea to not duplicate this work in batch analysis, *if* we want to keep batch and non-batch close.

Long-term, I see a value in keeping batch a separate, lighter weight thing. However, because now we use batch to measure performance, keeping them closer makes more sense.

I'd also like to add ability to get completions by using batch analysis, and that will require ra_ide_api as well.

@flodiebold were there some reason why we haven't started with this approach from the start?

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-16 08:08:10 +00:00
bors[bot]
ce9ea0939a Merge #1407
1407: Skip attrs in `ast::Literal::token` r=matklad a=sinkuu

`ast::Literal::token` panics on literals containing attributes. rust-analyzer crashed on the `rust-lang/rust` repository by parsing [a test containing this](9ebf47851a/src/test/run-pass/proc-macro/attr-stmt-expr.rs (L22-L25)).

Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2019-06-16 07:58:15 +00:00
Muhammad Mominul Huque
91510db6d8
Fall down of failures 2019-06-16 00:48:50 +06:00
Shotaro Yamada
774537fb01 Fix formatting 2019-06-16 01:45:38 +09:00
Florian Diebold
30647cd195 Some more cleanup 2019-06-15 18:36:58 +02:00
Florian Diebold
94a6aff9f8 Check that Deref has the right number of parameters 2019-06-15 18:33:30 +02:00
Florian Diebold
3e78a6e3e0 Somewhat handle variables in the derefed type, and add another test 2019-06-15 18:21:23 +02:00
Florian Diebold
ca5ed2307c Implement * operation using Deref trait 2019-06-15 18:21:23 +02:00
Florian Diebold
9c5e7dd849 Implement autoderef using the Deref trait
- add support for other lang item targets, since we need the Deref lang item
2019-06-15 18:21:23 +02:00
Florian Diebold
49489dc20c Add basic infrastructure for assoc type projection 2019-06-15 18:21:23 +02:00
Florian Diebold
6f946f9656 Add test for Deref 2019-06-15 18:21:23 +02:00
Shotaro Yamada
474a04615c Skip attrs in Literal::token 2019-06-15 23:36:12 +09:00
Aleksey Kladov
b0be4207d0 reuse AnalysisHost in batch analysis 2019-06-15 16:29:23 +03:00
bors[bot]
41c56c8a0d Merge #1405
1405: re-enable backtraces on panic r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-15 09:58:43 +00:00
Aleksey Kladov
24703acf26 re-enable backtraces on panic 2019-06-15 12:58:17 +03:00
bors[bot]
257a15b939 Merge #1404
1404: Fight down failures! r=matklad a=mominul

issue #1400 

Now only `ra_tools` crate depends on `failure`, should I also fight those? 😁

Co-authored-by: Muhammad Mominul Huque <mominul2082@gmail.com>
2019-06-15 09:45:55 +00:00
Muhammad Mominul Huque
408e173bb9
Cleanup 2019-06-15 14:04:26 +06:00
Muhammad Mominul Huque
125d6e74f7
Fix a doc test 2019-06-15 13:53:37 +06:00
Muhammad Mominul Huque
ebb40c7f87
cargo format 2019-06-15 13:37:15 +06:00
Muhammad Mominul Huque
f032eeb05f
Get rid of failure: ra_batch ra_cli 2019-06-15 13:24:02 +06:00
Muhammad Mominul Huque
9709bd39ca
Get rid of failure: ra_lsp_server & ra_project_model 2019-06-15 02:42:56 +06:00
bors[bot]
9dbf985df5 Merge #1403
1403: Add alloc -> core dependency r=matklad a=flodiebold

Also a small fix for the ra-emacs-lsp company fix.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-06-14 19:34:51 +00:00
Muhammad Mominul Huque
a931fb1ef6
Get rid of failure: gen_lsp_server 2019-06-15 01:03:17 +06:00
Florian Diebold
882daf4245 ra-emacs-lsp: Fix company-lsp snippet handler override 2019-06-14 20:58:03 +02:00
Florian Diebold
dafa177088 Add alloc -> core dependency 2019-06-13 21:59:50 +02:00
bors[bot]
84b6610782 Merge #1401
1401: Temp fix for slow onEnter issue r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-13 18:30:15 +00:00
Aleksey Kladov
d32e15cae6 Temp fix for slow onEnter issue
The issue was windows specific -- cancellation caused collection of
bracktraces at some point, and that was slow on windows.

The proper fix here is to make sure that we don't collect bracktraces
unnecessary (which we currently do due to failure), but, as a
temporary fix, let's just not force their collection in the first
place!
2019-06-13 21:29:44 +03:00
bors[bot]
a3a03b65dc Merge #1398
1398: check for cancellation when executing queries r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-12 15:49:39 +00:00
Aleksey Kladov
b8cae2cf8f check for cancellation when executing queries
Note that we can't just remove CheckCanceled trait altogether:
sometimes it's useful to check for cancellation while the query is
running! We do this, for example, in the name resolution fixed-point
loop.
2019-06-12 18:47:55 +03:00
bors[bot]
c452d2842c Merge #1393
1393: fix: support existential type r=matklad a=csmoe

Closes https://github.com/rust-analyzer/rust-analyzer/issues/1387
r? @matklad 

Co-authored-by: csmoe <csmoe@msn.com>
2019-06-12 14:46:05 +00:00
csmoe
2ca9f71897 fix: support existential type 2019-06-12 14:32:39 +00:00
bors[bot]
03645c5576 Merge #1382
1382: use salsa's LRU for syntax trees r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-12 10:36:47 +00:00
Aleksey Kladov
fed52706de make LRU cache configurable 2019-06-12 13:36:24 +03:00
Aleksey Kladov
15668119de make LRU_CAP configurable for batch db 2019-06-12 13:25:30 +03:00
Aleksey Kladov
fc2658b074 use salsa's LRU for syntax trees 2019-06-12 13:25:30 +03:00
bors[bot]
6296f51678 Merge #1396
1396: fixed wrong links again r=matklad a=zbelial

Hi
Sorry about that I didn't check all links in my previous PR and two of them were incorrectly fixed.
I think they are all proporly fixed this time :) 

Co-authored-by: zjy <zhaojiyang1@xiaomi.com>
2019-06-12 09:23:23 +00:00
zjy
40bcbcbc1c fixed wrong links again 2019-06-12 10:44:08 +08:00
bors[bot]
98020ef2f3 Merge #1394
1394: Fix hover for pat that shadows items r=matklad a=sinkuu

```rust
fn x() {}

fn y() {
    let x = 0i32;
    x; // hover on `x` is expected to be `i32`, but the actual result was `fn x()`
}
```

This was because: if [`res.is_empty()`](656a0fa9f9/crates/ra_ide_api/src/hover.rs (L205)), it fallbacks to "index based approach" and adds `fn x()` to `res`, which makes [`res.extend(type_of)` below](656a0fa9f9/crates/ra_ide_api/src/hover.rs (L260-L266)) not happen.

Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2019-06-11 17:24:28 +00:00
bors[bot]
80aa9d5f9f Merge #1395
1395: move docs under code model r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-11 15:29:42 +00:00
Aleksey Kladov
ff6f6b3a52 move docs under code model 2019-06-11 18:28:51 +03:00
Aleksey Kladov
f6c227babd fix compilation 2019-06-11 18:28:51 +03:00
Aleksey Kladov
14b1f87634 minor formatting 2019-06-11 18:28:51 +03:00
Aleksey Kladov
26753f0e49 remove unneded From(..) impl 2019-06-11 18:28:51 +03:00