Commit graph

19795 commits

Author SHA1 Message Date
Laurențiu Nicola
79d3f61590 Bump some deps 2021-10-29 23:26:58 +03: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
Lukas Wirth
54e6583f53 Add dummy impls for trace_macros and log_syntax 2021-10-26 20:52:38 +02:00
bors[bot]
a3830dfd3b
Merge #10641
10641: fix: make `expand_macro` multi-token mapping aware r=spookyvision a=spookyvision



Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
Co-authored-by: Anatol Ulrich <45840+spookyvision@users.noreply.github.com>
2021-10-26 18:18:22 +00:00
Anatol Ulrich
b42093915a
Update crates/ide/src/expand_macro.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-26 20:17:47 +02:00
Anatol Ulrich
e6913be47b fix test 2021-10-26 20:15:25 +02:00
Anatol Ulrich
04f2eb0fba wording 2021-10-26 20:10:09 +02:00
Anatol Ulrich
3f82989153 fix: make expand_macro multi-token mapping aware 2021-10-26 20:09:14 +02:00
bors[bot]
c48730cb72
Merge #10639 #10640
10639: fix: make `goto_declaration` multi-token mapping aware r=Veykril a=spookyvision



10640: assume valid identifier r=Veykril a=spookyvision

improve https://github.com/rust-analyzer/rust-analyzer/pull/10637/ by always returning `Some(potentially_empty_vec)` instead of `None` in the empty case

Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
2021-10-26 17:51:33 +00:00
Anatol Ulrich
53be26df50 assume valid identifier 2021-10-26 19:33:50 +02:00
Anatol Ulrich
d8ed15b6a6 fix: make goto_declaration multi-token mapping aware 2021-10-26 19:31:49 +02:00
bors[bot]
ba2b599131
Merge #10592
10592: Fix: only shows one # when we encounter ## r=Veykril a=dzvon

Fixes #10584

Co-authored-by: Dezhi Wu <wu543065657@163.com>
2021-10-26 13:17:13 +00:00
Dezhi Wu
31af94b73a perf: avoid allocating by just slicing.
Signed-off-by: Dezhi Wu <wu543065657@163.com>
2021-10-26 20:59:48 +08:00
bors[bot]
ee1d6cffbf
Merge #10637
10637: fix: make `goto_type_definition` multi-token mapping aware r=Veykril a=spookyvision



Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
2021-10-26 10:46:33 +00:00
Anatol Ulrich
c69879423e fix imports 2021-10-26 12:34:40 +02:00
Anatol Ulrich
686f8fbea3 simplify 2021-10-26 12:21:18 +02:00
Anatol Ulrich
2490807ca5 fix: make goto_type_definition multi-token mapping aware 2021-10-25 23:43:58 +02:00
bors[bot]
ed39b45e8d
Merge #10635
10635: fix: fix extract_variable not working on macro_call r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-25 19:47:41 +00:00
Lukas Wirth
a2365ea18a fix: fix extract_variable not working on macro_call 2021-10-25 21:46:44 +02:00
bors[bot]
e4ca952be6
Merge #10633
10633: fix: Implement most proc_macro span handling for other ABIs r=Veykril a=Veykril

Follow up to #10378
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-25 15:33:41 +00:00
bors[bot]
aa04d3eb4f
Merge #10634
10634: minor: Drop resolver and `authors` manifest entry in `limit` r=lnicola a=lnicola

The new resolver is on by default in the 2021 edition,

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-25 15:13:34 +00:00
Laurențiu Nicola
0e0ad0377c Drop resolver and authors manifest entries 2021-10-25 18:12:40 +03:00
Lukas Wirth
d2b8ca9b52 fix: Implement most proc_macro span handling for other ABIs 2021-10-25 16:43:49 +02:00
bors[bot]
142b6dc650
Merge #10631
10631: fix: Fix postfix completions panicking r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10243, I couldn't reproduce the panic with the given snippet, but this change should still guard against it.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-25 13:24:07 +00:00
Lukas Wirth
a932935d4e Fix postfix completions panicking 2021-10-25 15:22:29 +02:00
bors[bot]
e81e3c3980
Merge #10630
10630: fix: Don't ask the user to reload when chaning HoverAction configs in VSCode r=Veykril a=Veykril

To my knowledge, all of these are re-read on hover requests so there is no longer a reason to reload when changing these.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-25 12:50:17 +00:00
Lukas Wirth
4c582ffe9f Don't ask the user to reload when chaning HoverAction configs in VSCode 2021-10-25 14:48:36 +02:00
bors[bot]
1f47693e02
Merge #10624
10624: minor: revert edition change in test r=lnicola a=lnicola

Fixes https://github.com/rust-analyzer/rust-analyzer/pull/10607#discussion_r734963606

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-24 11:53:51 +00:00
Laurențiu Nicola
f0ad6fa68b Revert edition change in test 2021-10-24 14:52:42 +03:00
bors[bot]
9d33d05d85
Merge #10617
10617: Set MSRV r=Veykril a=lnicola

Set the MSRV to `1.56` since we're already on the 2021 edition and building with older version fails.

From now on, there'll be a change in behavior: `xtask install` used to warn on old toolchains, but now the user will get an error. This isn't so bad because:

 - the check in `xtask install` wasn't always working (because sometimes `xtask` itself required a newer toolchain)
 - we generally bump the required version for a reason (when using a newer feature). We might forget to bump it, but when we do, older toolchains won't work

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-23 13:30:32 +00:00
Laurențiu Nicola
8457ae34bd Set MSRV 2021-10-23 15:07:11 +03:00
bors[bot]
fe7c516084
Merge #10602
10602: Add qualify method call assist r=Veykril a=qepasa

This adds `qualify_method_call` assist that allows to replace a method (or trait) call that resolves with its fully qualified path.

For example, for stuct method:
```rust
struct Foo;
impl Foo {
    fn foo(&self) {}
}
```
```
let foo = Foo {};
foo.fo$0o();
```

becomes
```rust
let foo = Foo {};
Foo::foo(&foo);
```

for a trait method:

```rust
struct Foo;
trait FooTrait {
    fn foo(&self) {}
}
impl FooTrait for Foo {
    fn foo(&self) {}
}
```
following call:
```rust
let foo = Foo {};
foo.fo$0o();
```

becomes:
```rust
let foo = Foo {};
FooTrait::foo(&foo);
```

fixes #10453 

Co-authored-by: Paweł Palenica <pawelpalenica11@gmail.com>
2021-10-23 08:34:51 +00:00
bors[bot]
a75353e8ac
Merge #9939
9939: feat: Adding extract_module assist r=Veykril a=feniljain

Should solve https://github.com/rust-analyzer/rust-analyzer/issues/9591

Co-authored-by: vi_mi <fenil.jain2018@vitstudent.ac.in>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-22 09:29:16 +00:00
vi_mi
3e73a46660 fix: making tests compatible with new trimmed sel_range 2021-10-22 09:16:56 +00:00
bors[bot]
dc5afb1573
Merge #10608
10608: Amend the instruction for rustup. r=lnicola a=jhscheer

The current instruction for installation via rustup are misleading.

Co-authored-by: Jan Scheer <jhscheer@users.noreply.github.com>
2021-10-22 07:18:05 +00:00
Paweł Palenica
bfc86f64c3 apply code review suggestions 2021-10-21 23:42:14 -07:00
bors[bot]
bbbb0e5f9a
Merge #10610
10610: minor: Use array `IntoIter` r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-22 06:24:17 +00:00
Laurențiu Nicola
ca44b6892e Use array IntoIter 2021-10-22 09:23:29 +03:00
Jan Scheer
1bfedc3591
Amend the instruction for rustup.
The current instruction for installation via rustup are misleading.
2021-10-21 23:04:43 +02:00
bors[bot]
56fbf5d7b2
Merge #10607
10607: Migrate to edition 2021 r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-21 18:19:22 +00:00
Lukas Wirth
1294bfce86 Migrate to edition 2021 2021-10-21 20:10:40 +02:00
bors[bot]
6aeeb4ef33
Merge #10603
10603: fix: Don't resolve attributes to non attribute macros r=Veykril a=Veykril

Also changes `const`s to `static`s for `Limit`s as we have interior mutability in those(though only used with a certain feature flag enabled).

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-21 10:39:26 +00:00
Lukas Wirth
ea2a2c52fc Don't resolve attributes to non attribute macros 2021-10-21 12:22:40 +02:00
Paweł Palenica
91988f46b7 Add generated docs 2021-10-20 23:54:22 -07:00
Paweł Palenica
c2fd0c48a6 cleanup qualify_path 2021-10-20 23:39:25 -07:00
Paweł Palenica
b3d92052ce Remove comment 2021-10-20 23:38:28 -07:00
Paweł Palenica
9f31f59fdf Cleanup - remove unnecessary pub 2021-10-20 23:37:31 -07:00
Paweł Palenica
c8820d342f Run cargo fmt 2021-10-20 23:35:14 -07:00
Paweł Palenica
bb00b09d22 Add qualify method call assist 2021-10-20 23:28:30 -07:00
bors[bot]
6877240fdf
Merge #10563
10563: feat: Make "Generate getter" assist use semantic info r=agluszak a=agluszak

This PR makes "Generate getter" assist use semantic info instead of dealing with types encoded as strings.
Getters for types which are:
- `Copy` no longer return references
- `AsRef<str>` (i.e. `String`) return `&str` (instead of `&String`)
- `AsRef<[T]>` (i.e. `Vec<T>`) return `&[T]` (instead of `&Vec<T>`)
- `AsRef<T>` (i.e. `Box<T>`) return `&T` (instead of `&Box<T>`)
- `Option<T>` return `Option<&T>` (instead of `&Option<T>`)
- `Result<T, E>` return `Result<&T, &E>` (instead of `&Result<T, E>`)

String, Vec, Box and Option were previously handled as special cases.

Closes #10295


Co-authored-by: Andrzej Głuszak <gluszak.andrzej@gmail.com>
2021-10-20 21:02:46 +00:00