Commit Graph

19897 Commits

Author SHA1 Message Date
Anatol Ulrich
7581ba3f30 forgot a dbg 2021-11-03 14:21:29 +01:00
bors[bot]
71f5dae4b6
Merge #10683
10683: minor: Use `.into_iter()` method on array to avoid dereference r=lnicola a=arzg

Arguably it’s nicer to just use `.into_iter()` instead of iterating over references which are immediately dereferenced.

I also changed the use of `String::from` to `.to_string()` because the latter has around twenty times more usages in rust-analyzer.

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-11-03 07:40:23 +00:00
Aramis Razzaghipour
16d38ec8b8
Use .into_iter() method on array to avoid dereference 2021-11-03 16:13:47 +11:00
Anatol Ulrich
9bce4d6696 accept identical Indels when merging; add rename test case 2021-11-02 21:38:38 +01:00
bors[bot]
04f03a360a
Merge #10672
10672: feat: upgrade ubuntu builders r=matklad a=matklad

For `-gnu` triples, use 20.04, the current LTS. This upgrades the
required version of glibc. For musl, just use `latest` as, presumably,
we don't care about glibc version in that case.

Hopefully, this unbreaks nightly publishing!

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-10-31 10:16:59 +00:00
Aleksey Kladov
045be6545f minor: group -gnu builders together 2021-10-31 13:16:36 +03:00
Aleksey Kladov
a4b40e60cb feat: upgrade ubuntu builders
For `-gnu` triples, use 20.04, the current LTS. This upgrades the
required version of glibc. For musl, just use `latest` as, presumably,
we don't care about glibc version in that case.
2021-10-31 13:16:36 +03:00
bors[bot]
eb32b60dc7
Merge #10671
10671: minor: Run apt-get update for AArch64 builds r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-31 08:50:24 +00:00
Laurențiu Nicola
d6c162e40f Run apt-get update for AArch64 builds 2021-10-31 10:49:43 +02:00
bors[bot]
7765c1a94f
Merge #10668
10668: fix: Fix for-loop expressions breaking with BlockExpr iterable r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10665
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-30 14:42:53 +00:00
Lukas Wirth
c93983e76f Fix for-loop expressions breaking with BlockExpr iterable 2021-10-30 16:37:32 +02:00
Lukas Wirth
1d80302b76 Set server status to warning when proc-macro sources change 2021-10-30 14:49:32 +02:00
bors[bot]
3ad83cc08d
Merge #10663
10663: minor: Bump `object` avoid a duplicate dependency r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-30 06:03:26 +00:00
Laurențiu Nicola
80f9afa1ec Bump object avoid a duplicate dependency 2021-10-30 09:02:45 +03:00
bors[bot]
103bef178c
Merge #10650
10650: minor: Bump deps r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-29 20:27:51 +00:00
Laurențiu Nicola
d0a99ad54e Bump chalk 2021-10-29 23:26:59 +03:00
Laurențiu Nicola
79d3f61590 Bump some deps 2021-10-29 23:26:58 +03:00
bors[bot]
8c078147b5
Merge #10662
10662: Fix Plaintext textDocument/hover r=Veykril a=vsrs

Relates to #10028

Note: the PR corrects only invalid content kind, not formatting.

Co-authored-by: vsrs <vit@conrlab.com>
2021-10-29 16:16:13 +00:00
vsrs
2f862cd6fe Fix Plaintext textDocument/hover 2021-10-29 18:23:47 +03:00
bors[bot]
b9fa37f5b4
Merge #10648
10648: fix: Don't discard attributed items when a proc-macro unexpectedly fails to expand r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9205

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-29 13:13:12 +00:00
Lukas Wirth
98cff6572d Don't discard attributed items when a proc-macro unexpectedly fails to expand 2021-10-29 15:10:44 +02:00
bors[bot]
78108235d5
Merge #10657
10657: feat: Make unqualified derive attributes flyimportable r=Veykril a=Veykril

![UuwpKODbpB](https://user-images.githubusercontent.com/3757771/139436613-1e6eb8fd-f591-4fca-9383-ff7408ee9b18.gif)
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10052

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-29 13:01:49 +00:00
Lukas Wirth
ebd63ec1cf feat: Make unqualified derive attributes flyimportable 2021-10-29 14:51:26 +02:00
bors[bot]
057558b756
Merge #10595
10595: internal: Fix a format error r=Veykril a=dzvon

Fixes #10581

Co-authored-by: Dezhi Wu <wu543065657@163.com>
2021-10-29 10:40:43 +00:00
Dezhi Wu
74396d27c0 Fix: correct markdown link form. 2021-10-29 18:25:32 +08:00
Dezhi Wu
097d527cbd Fix: use a concise way to change link form when generating package.json 2021-10-29 10:00:10 +08:00
bors[bot]
b025bd6e7d
Merge #10656
10656: fix: Enable auto-import and qualify-path in derive attributes r=Veykril a=Veykril

cc https://github.com/rust-analyzer/rust-analyzer/issues/10052

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-28 16:49:55 +00:00
Lukas Wirth
7fdbdc4ab2 Enable auto-import and qualify-path in derive attributes 2021-10-28 18:40:38 +02:00
bors[bot]
166c0ac0de
Merge #10654
10654: internal: Refactor ide handling for paths in derive inputs r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-28 15:08:33 +00:00
Lukas Wirth
3018ffd85e Refactor ide handling for paths in derive inputs 2021-10-28 16:47:19 +02:00
bors[bot]
f4ba64ee2a
Merge #10623
10623: internal: replace L_DOLLAR/R_DOLLAR with parenthesis hack r=matklad a=matklad

The general problem we are dealing with here is this:

```
macro_rules! thrice {
    ($e:expr) => { $e * 3}
}

fn main() {
    let x = thrice!(1 + 2);
}
```

we really want this to print 9 rather than 7.

The way rustc solves this is rather ad-hoc. In rustc, token trees are
allowed to include whole AST fragments, so 1+2 is passed through macro
expansion as a single unit. This is a significant violation of token
tree model.

In rust-analyzer, we intended to handle this in a more elegant way,
using token trees with "invisible" delimiters. The idea was is that we
introduce a new kind of parenthesis, "left $"/"right $", and let the
parser intelligently handle this.

The idea was inspired by the relevant comment in the proc_macro crate:

https://doc.rust-lang.org/stable/proc_macro/enum.Delimiter.html#variant.None

> An implicit delimiter, that may, for example, appear around tokens
> coming from a “macro variable” $var. It is important to preserve
> operator priorities in cases like $var * 3 where $var is 1 + 2.
> Implicit delimiters might not survive roundtrip of a token stream
> through a string.

Now that we are older and wiser, we conclude that the idea doesn't work.

_First_, the comment in the proc-macro crate is wishful thinking. Rustc
currently completely ignores none delimiters. It solves the (1 + 2) * 3
problem by having magical token trees which can't be duplicated:

* https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/TIL.20that.20token.20streams.20are.20magic
* https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Handling.20of.20Delimiter.3A.3ANone.20by.20the.20parser

_Second_, it's not like our implementation in rust-analyzer works. We
special-case expressions (as opposed to treating all kinds of $var
captures the same) and we don't know how parser error recovery should
work with these dollar-parenthesis.

So, in this PR we simplify the whole thing away by not pretending that
we are doing something proper and instead just explicitly special-casing
expressions by wrapping them into real `()`.

In the future, to maintain bug-parity with `rustc` what we are going to
do is probably adding an explicit `CAPTURED_EXPR` *token* which we can
explicitly account for in the parser.

If/when rustc starts handling delimiter=none properly, we'll port that
logic as well, in addition to special handling.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-10-28 10:32:13 +00:00
Dezhi Wu
ffc6cdd871 Fix: transform the asciidoc form link to markdown style when generating the package.json 2021-10-28 10:13:43 +08:00
bors[bot]
210a1d5ece
Merge #10629
10629: Add assist for replacing turbofish with explicit type. r=Veykril a=terrynsun

Converts `::<_>` to an explicit type assignment.

```
let args = args.collect::<Vec<String>>();
```
->
```
let args: Vec<String> = args.collect();
```

Closes #10285

Co-authored-by: Terry Sun <terrynsun@gmail.com>
2021-10-27 21:40:28 +00:00
Terry Sun
d800a1bc93 fixup! rustfmt 2021-10-27 10:58:31 -07:00
Terry Sun
3bbd61d674 fixup! delay to_string() until assist is called 2021-10-27 10:46:25 -07:00
bors[bot]
9d1f15086a
Merge #10649
10649: internal: Remove `CompletionKind` in favor of `CompletionItemKind` r=Veykril a=Veykril

and move some more tests around
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-27 15:38:42 +00:00
Anatol Ulrich
1ac35532c4 remove TODO comment 2021-10-27 17:26:38 +02:00
Anatol Ulrich
df9fb9b159 re-introduce always! 2021-10-27 17:25:42 +02:00
Lukas Wirth
0468b11de7 Remove CompletionKind in favor of CompletionItemKind 2021-10-27 17:23:43 +02:00
Anatol Ulrich
28c73f8374 unwrap-- 2021-10-27 17:23:23 +02:00
Anatol Ulrich
4a1a5ff54e fix logic error: alias detection was too lenient 2021-10-27 17:20:12 +02:00
Lukas Wirth
722489e3ff Remove filtered completion list usage in completion tests 2021-10-27 16:53:39 +02:00
Anatol Ulrich
6cd15c296d wip 2021-10-27 15:40:49 +02:00
Anatol Ulrich
8d3ac328ee remove resolved TODO questions 2021-10-27 15:40:30 +02:00
Anatol Ulrich
f244ed6a1a doxx 2021-10-27 04:46:02 +02:00
Anatol Ulrich
2e0610e64e one down 2021-10-27 04:42:58 +02:00
Anatol Ulrich
95199ac30b make imports less odd 2021-10-27 04:36:32 +02:00
Anatol Ulrich
6decfceae1 WIP: fix: make rename multi-token mapping aware 2021-10-27 04:31:14 +02:00
Terry Sun
6abdbdd0c9 fixup! narrow range; method calls; check for only one type 2021-10-26 17:50:25 -07:00
bors[bot]
dd43f3f2d1
Merge #10642
10642: minor: Add dummy impls for `trace_macros` and `log_syntax` r=Veykril a=Veykril

Both of these are macros for debugging macros and as such don't really need an implementation for us.
Closes https://github.com/rust-analyzer/rust-analyzer/issues/2212
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-26 18:55:42 +00:00