Commit Graph

4165 Commits

Author SHA1 Message Date
bors[bot]
fc0f4ed635 Merge #1442
1442: add cpuprofile to ra_prof r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-26 08:13:09 +00:00
Aleksey Kladov
d621533f15 add cpuprofile to ra_prof
Now, one can use `let _p = ra_prof::cpu_profiler()` to capture profile
of a block of code.

This is not an out of the box experience, as that relies on gperfools

See the docs on https://github.com/AtheMathmo/cpuprofiler for more!
2019-06-26 11:11:28 +03:00
bors[bot]
0129790a8f Merge #1432
1432: Make fill_match_arm work with trivial arm r=matklad a=ironyman

Addresses this issue https://github.com/rust-analyzer/rust-analyzer/issues/1399

One minor issue I noticed is that complete_postfix creates an arm like this

```
                match E::X {
                    <|>_ => {},
                }
```

but fill_match_arms creates arms like this
```
                     E::X => (), 
```

Co-authored-by: ironyman <ironyman@users.noreply.github.com>
Co-authored-by: Changyu Li <changyl@microsoft.com>
2019-06-25 21:06:17 +00:00
Changyu Li
3a2a13756f Review 1 2019-06-25 13:26:12 -07:00
bors[bot]
4b0c37bd6e Merge #1439
1439: Rich mapping of cargo watch output r=matklad a=etaoins

Currently we depend on the ASCII rendering string that `rustc` provides to populate Visual Studio Code's diagnostic. This has a number of shortcomings:

1. It's not a very good use of space in the error list
2. We can't jump to secondary spans (e.g. where a called function is defined)
3. We can't use Code Actions aka Quick Fix

This moves all of the low-level parsing and mapping to a `rust_diagnostics.ts`. This uses some heuristics to map Rust diagnostics to VsCode:

1. As before, the Rust diagnostic message and primary span is used for the root diagnostic. However, we now just use the message instead of the rendered version.

2. Every secondary span is converted to "related information". This  shows as child in the error list and can be jumped to.

3. Every child diagnostic is categorised in to three buckets:
    1. If they have no span they're treated as another line of the root messages
    2. If they have replacement text they're treated as a Code Action
    3. If they have a span but no replacement text they're treated as related information (same as secondary spans).

Co-authored-by: Ryan Cumming <etaoins@gmail.com>
2019-06-25 12:37:07 +00:00
bors[bot]
ba97a5fbd2 Merge #1436
1436: Method resolution for slices r=sinkuu a=sinkuu

`impl<T> [T]` is separately defined in `core` and `alloc`, so I changed `def_crate` function in `method_resolution.rs` to return multiple crates.

Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2019-06-25 12:24:13 +00:00
Shotaro Yamada
9668737d05 Add comment 2019-06-25 20:57:42 +09:00
Ryan Cumming
5c6ab11453 Tweak isUnusedOrUnnecessary
The first cut was a bit rough with the blanket `unused_*` rule. This
trigger for things like `unused_mut` where the code is used but it's
suboptimal. It's misleading to grey out the code in those cases.
Instead, use an explicit list of things known to be dead code.
2019-06-25 21:44:27 +10:00
Ryan Cumming
d997fd8ea5 Fix comparison of Code Action edit lengths
This happened to work because we always produce a single edit but this
is obviously dubious.
2019-06-25 21:36:55 +10:00
Ryan Cumming
6d6cb25cf4 Rich mapping of cargo watch output
Currently we depend on the ASCII rendering string that `rustc` provides
to populate Visual Studio Code's diagnostic. This has a number of
shortcomings:

1. It's not a very good use of space in the error list
2. We can't jump to secondary spans (e.g. where a called function is
   defined)
3. We can't use Code Actions aka Quick Fix

This moves all of the low-level parsing and mapping to a
`rust_diagnostics.ts`. This uses some heuristics to map Rust diagnostics
to VsCode:

1. As before, the Rust diagnostic message and primary span is used for
   the root diagnostic. However, we now just use the message instead of
   the rendered version.

2. Every secondary span is converted to "related information". This
   shows as child in the error list and can be jumped to.

3. Every child diagnostic is categorised in to three buckets:
    1. If they have no span they're treated as another line of the root
       messages
    2. If they have replacement text they're treated as a Code Action
    3. If they have a span but no replacement text they're treated as
       related information (same as secondary spans).
2019-06-25 21:16:04 +10:00
Shotaro Yamada
9e7a6bd66e Method resolution for slices 2019-06-25 02:17:44 +09:00
bors[bot]
364ac9b946 Merge #1434
1434: Introduce cargo-watch.check-command option for Code extension r=matklad a=alekseysidorov

By this option you can replace `check` command in `cargo watch` by the something else like `clippy`.

Co-authored-by: Aleksei Sidorov <aleksei.sidorov@xdev.re>
Co-authored-by: Aleksey Sidorov <alekseysidorov@users.noreply.github.com>
2019-06-24 11:03:28 +00:00
Aleksei Sidorov
28e9e8d4cf Fix code after "apply suggestions" 2019-06-24 13:50:34 +03:00
Aleksey Sidorov
c40ee089f2
Apply suggestions from code review
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-24 13:35:11 +03:00
Aleksei Sidorov
b1bc629b83 Fix tslints 2019-06-24 13:33:37 +03:00
bors[bot]
f6340022c1 Merge #1429
1429: Add box postfix completion r=matklad a=kanru



Co-authored-by: Kan-Ru Chen <kanru@kanru.info>
2019-06-24 10:21:36 +00:00
bors[bot]
67ecc88f66 Merge #1415
1415: fix: specialization r=matklad a=csmoe

Closes #1402 
r? @matklad 

Co-authored-by: csmoe <csmoe@msn.com>
2019-06-24 10:10:05 +00:00
Aleksei Sidorov
4722e6d491 Introduce cargo-watch.check-command 2019-06-24 13:02:20 +03:00
bors[bot]
b34f65bced Merge #1433
1433: Add SourceRoot::is_library, in preparation for salsa's durability r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-24 09:35:51 +00:00
Aleksey Kladov
8109ebb101 Add SourceRoot::is_library, in preparation for salsa's durability 2019-06-24 12:35:07 +03:00
ironyman
888157b52e fill_match_arm works with trivial arm 2019-06-23 21:05:50 -07:00
Kan-Ru Chen
bf7a35294d Add box postfix completion 2019-06-23 22:18:25 +09:00
bors[bot]
7d79be3280 Merge #1421
1421: Bump cargo_metadata, ena, flexi_logger r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-06-20 19:13:08 +00:00
kjeremy
f8f136e990 Bump cargo_metadata, ena, flexi_logger 2019-06-20 15:09:39 -04:00
bors[bot]
4adb0125f7 Merge #1420
1420: don' collect macros r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-20 13:48:39 +00:00
Aleksey Kladov
9ff872329a don' collect macros 2019-06-20 16:48:10 +03:00
bors[bot]
cd1ff2e2a1 Merge #1419
1419: Add firewall query to lang items r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-19 22:14:12 +00:00
Aleksey Kladov
bcff61257a Add firewall query to lang items
With an intermediate query, changing one module won't cause reparsing
of all modules
2019-06-19 23:46:50 +03:00
csmoe
d04473accb fix: specialization(with blindly parsing)
Change-Id: Ic5d2767e8781568d76d4d0013cd6081e95ae8a95
2019-06-19 18:37:38 +08:00
bors[bot]
363f2f394e Merge #1414
1414: fix: box_syntax/pattern r=matklad a=csmoe

Closes #1412 
r? @matklad 

Co-authored-by: csmoe <csmoe@msn.com>
2019-06-19 10:07:37 +00:00
bors[bot]
09864b3b21 Merge #1418
1418: rename XSignature -> XData r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-19 09:54:16 +00:00
bors[bot]
78494b3c74 Merge #1417
1417: ⬆️ ra_vfs r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-19 09:41:25 +00:00
Aleksey Kladov
889d72c2c8 ⬆️ ra_vfs 2019-06-19 12:40:59 +03:00
csmoe
d6533994e4 fix: box_pattern
Change-Id: I45a856d74fb616d3bce33050f9e69d327186bd59
2019-06-19 14:28:50 +08:00
Aleksey Kladov
0caec7d250 rename XSignature -> XData 2019-06-18 20:20:08 +03:00
bors[bot]
f7da575a98 Merge #1413
1413: More details on how to set up coc r=matklad a=mark-i-m

I spent ~1 hour trying to figure this out. It's all pretty simple stuff, but very annoying...

Co-authored-by: Who? Me?! <mark-i-m@users.noreply.github.com>
2019-06-18 14:33:24 +00:00
Who? Me?!
857f3e546c
More details on how to set up coc 2019-06-18 09:25:59 -05:00
csmoe
5999733ca6 fix: box_syntax(#1412)
Change-Id: I6e20e0163fa545de37226c1561b3b7103615626c
2019-06-18 21:46:47 +08:00
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