Commit Graph

9534 Commits

Author SHA1 Message Date
bors[bot]
95e8766db6
Merge #4178
4178: Validate the location of `crate` in paths r=matklad a=djrenren

**This solution does not fully handle `use` statements. See below**

This pull requests implements simple validation of usages of the `crate` keyword in `Path`s. Specifically it validates that:

- If a `PathSegment` is starts with the `crate` keyword, it is also the first segment of the `Path`
- All other usages of `crate` in `Path`s are considered errors.

This aligns with `rustc`'s rules. Unlike rustc this implementation does not issue a special error message in the case of `::crate` but it does catch the error.

Furthermore, this change does not cover all error cases. Specifically the following is not caught:

```rust
use foo::{crate}
```

This is because this check is context sensitive. From an AST perspective, `crate` is the root of the `Path`. Only by inspecting the full `UseItem` do we see that it is not in fact the root. This problem becomes worse because `UseTree`s are allowed to be arbitrarily nested:

```rust
use {crate, {{crate, foo::{crate}}}
```

So this is a hard problem to solve without essentially a breadth-first search. In a traditional compiler, I'd say this error is most easily found during the AST -> HIR conversion pass but within rust-analyzer I'm not sure where it belongs.  

Under the implementation in this PR, such errors are ignored so we're *more correct* just not *entirely correct*. 

Co-authored-by: John Renner <john@jrenner.net>
2020-04-30 10:17:40 +00:00
bors[bot]
c2425fd88b
Merge #4216
4216: docs(user): method chaining hints support r=flodiebold a=fannheyward

https://github.com/fannheyward/coc-rust-analyzer/issues/177#issuecomment-621109410

<img width="490" alt="" src="https://user-images.githubusercontent.com/345274/80584717-acd0dd80-8a44-11ea-9505-c408a259a5b5.png">

Co-authored-by: Heyward Fann <fannheyward@gmail.com>
2020-04-30 08:12:35 +00:00
Heyward Fann
2e4ce5390c docs(user): method chaining hints support
https://github.com/fannheyward/coc-rust-analyzer/issues/177#issuecomment-621109410
2020-04-30 11:38:20 +08:00
bors[bot]
913eff5ad7
Merge #4162
4162: Complete assoc. items on type parameters r=jonas-schievink a=jonas-schievink

This is fairly messy and seems to leak a lot through the `ra_hir` abstraction (`TypeNs`, `AssocItemId`, ...), so I'd be glad for any advise for how to improve this.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-04-29 22:24:17 +00:00
Jonas Schievink
0cd6a88cf6 if let -> match 2020-04-30 00:10:30 +02:00
Jonas Schievink
15233a467d ? 2020-04-30 00:10:30 +02:00
Jonas Schievink
cafa7a780a Use or-patterns more 2020-04-30 00:10:30 +02:00
Jonas Schievink
3e41483932 Remove .clone() 2020-04-30 00:10:30 +02:00
Jonas Schievink
3cb73da949 Rename to associated_type_shorthand_candidates 2020-04-30 00:10:30 +02:00
Jonas Schievink
8c2670026a Complete assoc. items on type parameters 2020-04-30 00:10:30 +02:00
bors[bot]
4ff3573e18
Merge #4212
4212: Fix Typos on features.md r=kjeremy a=lonesometraveler



Co-authored-by: KENTARO OKUDA <lonesometraveler@mac.com>
2020-04-29 20:47:33 +00:00
KENTARO OKUDA
9ff566212e Fix Typos on features.md 2020-04-29 16:00:52 -04:00
John Renner
0af727da91 Validate the location of crate in paths 2020-04-29 11:06:51 -07:00
bors[bot]
1cde354c35
Merge #4119
4119: Cache proc-macro dlls r=matklad a=edwin0cheng

This PR try to fix a deadlock in proc-macro srv by not unloading dlls.

Currently we load and unload dlls for each request, however rustc TLS is leaky , such that if we do it a lot of times, all TLS index will be consumed and it will be deadlocked inside panic (it is because panic itself is using TLS too).


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-29 13:28:57 +00:00
bors[bot]
12aae7771d
Merge #4208
4208: More principled approach for finding From trait r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-29 13:03:40 +00:00
Aleksey Kladov
b4dd475257 More principled approach for finding From trait 2020-04-29 14:51:44 +02:00
bors[bot]
69cf9fcc0a
Merge #4205
4205: Fix YouComplteMe instructions link r=matklad a=bstaletic

Like I mentioned in #4098, the link to the instructions is for setting up RLS. This pull request fixes that mistake.

Co-authored-by: Boris Staletic <boris.staletic@gmail.com>
2020-04-29 11:07:55 +00:00
Boris Staletic
6b0be2f67f Fix YouComplteMe instructions link 2020-04-29 12:50:54 +02:00
bors[bot]
c3dfeba165
Merge #4204
4204: Use specific pattern when translating if-let-else to match r=matklad a=matklad

We *probably* should actually use the same machinery here, as we do
for fill match arms, but just special-casing options and results seems
to be a good first step.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-29 10:01:26 +00:00
Aleksey Kladov
7c3c289dab Use specific pattern when translating if-let-else to match
We *probably* should actually use the same machinery here, as we do
for fill match arms, but just special-casing options and results seems
to be a good first step.
2020-04-29 11:59:11 +02:00
bors[bot]
b1408271a3
Merge #4203
4203: Better filtering of qualified enum variants in completion r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-29 09:31:22 +00:00
Aleksey Kladov
041aea2263 Better filtering of qualified enum variants in completion 2020-04-29 11:26:21 +02:00
Aleksey Kladov
73bef854ab Move shared assist code to utils 2020-04-29 10:38:51 +02:00
bors[bot]
6046804cec
Merge #4199
4199: add ale to the nvim setup section of the readme r=matklad a=c-cube



Co-authored-by: Simon Cruanes <simon.cruanes.2007@m4x.org>
2020-04-29 06:32:58 +00:00
Simon Cruanes
7edd293e5c
add ale to the nvim setup section of the readme 2020-04-28 21:01:10 -04:00
bors[bot]
549ce9a9cf
Merge #4198
4198: Complete union fields after dot r=matklad a=jonas-schievink



Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-04-28 21:17:03 +00:00
bors[bot]
0d7c9974b0
Merge #4196
4196: Rebuild rust-analyzer when launching in VS Code r=matklad a=jonas-schievink

This is usually the right thing, and previously would launch a stale r-a server.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-04-28 21:09:37 +00:00
Jonas Schievink
8cb139090f Complete union fields after dot 2020-04-28 22:45:46 +02:00
Jonas Schievink
61c28c2b22 Build extension too 2020-04-28 22:32:23 +02:00
bors[bot]
07f690ddf6
Merge #4161
4161: lsp-types 0.74 r=kjeremy a=kjeremy

* Fixes a bunch of param types to take partial progress into account.
* Will allow us to support insert/replace text in completions

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-28 20:12:44 +00:00
bors[bot]
db441de0a8
Merge #4193
4193: Make it impossible to forget to add a semantic token type / modifier r=kjeremy a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-28 20:05:08 +00:00
bors[bot]
2096db90b4
Merge #4184
4184: Treat comments beginning with four slashes as regular line comments r=kjeremy a=adamrk

Addresses https://github.com/rust-analyzer/rust-analyzer/issues/4040

Co-authored-by: adamrk <ark.email@gmail.com>
2020-04-28 19:57:23 +00:00
adamrk
0bd7d81805 Fix comment prefix method for four slash comments 2020-04-28 21:13:37 +02:00
bors[bot]
9230ae5492
Merge #4148
4148: Simplify profiler impl (bubble up Option) r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-28 18:44:34 +00:00
Aleksey Kladov
fdaa5e7ccf
Merge pull request #4157 from lnicola/glibc-releases
Use x86_64-unknown-linux-gnu for releases
2020-04-28 20:16:11 +02:00
Jonas Schievink
0ee12079bc Rebuild rust-analyzer when launching in VS Code 2020-04-28 20:15:52 +02:00
Laurențiu Nicola
77de40192e Use x86_64-unknown-linux-gnu for releases 2020-04-28 20:47:13 +03:00
Aleksey Kladov
890938a48c Make it impossible to forget to add a semantic token type / modifier 2020-04-28 17:14:05 +02:00
bors[bot]
c3c7edb9bc
Merge #4190
4190: tiny fix in markdown ordered list r=edwin0cheng a=JOE1994

`.3` => `3.`

Co-authored-by: Youngsuk Kim <joseph942010@gmail.com>
2020-04-28 14:21:22 +00:00
Youngsuk Kim
b40a237baf
tiny fix in markdown ordered list
`.3` => `3.`
2020-04-28 10:18:12 -04:00
bors[bot]
965e621d20
Merge #4183
4183: Introduce new semantic highlight token for format specifier r=matklad a=ltentrup

Follow up from #4006: Instead of using the `attribute` highlight token, introduce a new semantic token for format specifier.

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
2020-04-28 12:45:30 +00:00
Leander Tentrup
052e9faa90 Introduce new semantic highlight token for format specifier 2020-04-28 11:13:12 +02:00
adamrk
b6560e3ebb Treat comments beginning with four slashes as regular line comments 2020-04-28 10:23:45 +02:00
bors[bot]
da1f316b02
Merge #4173
4173: Use core instead of std for builtin derive macros r=edwin0cheng a=edwin0cheng

Fixed #4087.

We can't use `$crate` here right now because : 

1. We have to able to detect `macro` 2.0 in collecting phase for finding `rustc_builtin_macro` attrs.
2. And we have to make hygiene works for builtin derive macro.

r= @flodiebold 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-27 20:12:27 +00:00
Edwin Cheng
c69f9c1b0a Check dep name to detect it is core 2020-04-28 04:11:24 +08:00
Edwin Cheng
6d3b0af900 Use empty-deps tricks to detect it is core 2020-04-28 03:32:47 +08:00
Edwin Cheng
213d208e2d Add test 2020-04-28 02:10:17 +08:00
Edwin Cheng
6a5014329a Use core instead of std for builtin derive macros 2020-04-28 01:48:55 +08:00
bors[bot]
7a9ba1657d
Merge #4158
4158: Clarify rust-analyzer binary  install r=matklad a=zoechi



Co-authored-by: Günter Zöchbauer <guenter@gzoechbauer.com>
2020-04-26 20:33:38 +00:00
kjeremy
61f1c0a990 lsp-types 0.74
* Fixes a bunch of param types to take partial progress into account.
* Will allow us to support insert/replace text in completions
2020-04-26 16:05:22 -04:00