]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agointernal: remove unreasonable crate dependency
Aleksey Kladov [Sun, 22 Aug 2021 11:05:12 +0000 (14:05 +0300)]
internal: remove unreasonable crate dependency

Proc macro expansion shouldn't know about salsa at all.

2 years agointernal: reduce crate interdependence
Aleksey Kladov [Sun, 22 Aug 2021 10:32:00 +0000 (13:32 +0300)]
internal: reduce crate interdependence

I don't think there's anything wrong with project_model depending on
proc_macro_api directly -- fundamentally, both are about gluing our pure
data model to the messy outside world.

However, it's easy enough to avoid the dependency, so why not.

As an additional consideration, `proc_macro_api` now pulls in `base_db`.
project_model should definitely not depend on that!

2 years agointernal: improve consistency
Aleksey Kladov [Sun, 22 Aug 2021 10:15:18 +0000 (13:15 +0300)]
internal: improve consistency

load and load_proc_macro do similar things

2 years agoMerge #9978
bors[bot] [Sat, 21 Aug 2021 21:26:00 +0000 (21:26 +0000)]
Merge #9978

9978: fix: Expand attributes recursively in expand_macro r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoExpand attributes recursively in expand_macro
Lukas Wirth [Sat, 21 Aug 2021 21:24:12 +0000 (23:24 +0200)]
Expand attributes recursively in expand_macro

2 years agoMerge #9976
bors[bot] [Sat, 21 Aug 2021 18:45:50 +0000 (18:45 +0000)]
Merge #9976

9976: fix: Do not show functional update completion when already qualified r=Veykril a=Veykril

Fixes #9964
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Do not show functional update completion when already qualified
Lukas Wirth [Sat, 21 Aug 2021 18:45:15 +0000 (20:45 +0200)]
fix: Do not show functional update completion when already qualified

2 years agoMerge #9975
bors[bot] [Sat, 21 Aug 2021 18:07:36 +0000 (18:07 +0000)]
Merge #9975

9975: minor: Fix panic caused by #9966 r=flodiebold a=flodiebold

Chalk can introduce new type variables when doing lazy normalization, so we have to do the proper 'fudging' after all.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoFix panic caused by #9966
Florian Diebold [Sat, 21 Aug 2021 17:47:06 +0000 (19:47 +0200)]
Fix panic caused by #9966

Chalk can introduce new type variables when doing lazy normalization, so
we have to do the proper 'fudging' after all.

2 years agoMerge #9973
bors[bot] [Sat, 21 Aug 2021 16:10:04 +0000 (16:10 +0000)]
Merge #9973

9973: Handle coercion on binary operator RHS r=flodiebold a=lnicola

Closes #9968
CC #8961

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoHandle coercion on binary operator RHS
Laurențiu Nicola [Sat, 21 Aug 2021 14:54:45 +0000 (17:54 +0300)]
Handle coercion on binary operator RHS

2 years agoMerge #9908
bors[bot] [Sat, 21 Aug 2021 13:41:09 +0000 (13:41 +0000)]
Merge #9908

9908: fix check of the toolchain's path r=lnicola a=gfreezy

fixed #9907

Co-authored-by: Alex.F <gfreezy@gmail.com>
2 years agoMerge #9966
bors[bot] [Sat, 21 Aug 2021 12:35:26 +0000 (12:35 +0000)]
Merge #9966

9966: fix: Determine expected parameters from expected return in calls r=flodiebold a=flodiebold

Second attempt :sweat_smile:

Fixes #9560

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoDetermine expected parameters from expected return in calls
Florian Diebold [Thu, 15 Jul 2021 18:02:58 +0000 (20:02 +0200)]
Determine expected parameters from expected return in calls

Fixes #9560

2 years agoAdapt tests for correct behavior
Florian Diebold [Thu, 15 Jul 2021 18:02:48 +0000 (20:02 +0200)]
Adapt tests for correct behavior

2 years agoAdd another test
Florian Diebold [Thu, 5 Aug 2021 18:32:07 +0000 (20:32 +0200)]
Add another test

2 years agoMerge #9965
bors[bot] [Sat, 21 Aug 2021 10:56:09 +0000 (10:56 +0000)]
Merge #9965

9965: minor: Don't ask for the builtin attribute input twice r=Veykril a=Veykril

`tt` and `item` here were the same, I misunderstood what the main input for attributes was in #9943
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoDon't ask for the builtin attribute input twice
Lukas Wirth [Sat, 21 Aug 2021 10:55:05 +0000 (12:55 +0200)]
Don't ask for the builtin attribute input twice

2 years agoMerge #9962
bors[bot] [Sat, 21 Aug 2021 10:12:17 +0000 (10:12 +0000)]
Merge #9962

9962: Add empty-body check to replace_match_with_if_let and re-prioritize choices r=elkowar a=elkowar

This PR changes some behaviour of the `replace_match_with_if_let` ide-assist.
Concretely, it makes two changes:

it introduces a check for empty expression bodies. This means that checks of the shape
```rs
match x {
  A => {}
  B => {
    println!("hi");
  }
}
```
will prefer to use the B branch as the first (and only) variant.

It also reprioritizes the importance of "happy" and "sad" patterns.
Concretely, if there are reasons to prefer having the sad pattern be the first (/only) pattern,
it will follow these.
This means that in the case of
```rs
match x {
  Ok(_) => {
    println!("Success");
  }
  Err(e) => {
    println!("Failure: {}", e);
  }
}
```
the `Err` variant will correctly be used as the first expression in the generated if.
Up until now, the generated code was actually invalid, as it would generate
```rs
if let Ok(_) = x {
  println!("Success");
} else {
  println!("Failure: {}", e);
}
```
where `e` in the else branch is not defined.

Co-authored-by: elkowar <5300871+elkowar@users.noreply.github.com>
2 years agoFix smaller nitpicks
elkowar [Sat, 21 Aug 2021 10:02:21 +0000 (12:02 +0200)]
Fix smaller nitpicks

2 years agoUse NameClass::classify to check for ConstReference
elkowar [Sat, 21 Aug 2021 09:11:27 +0000 (11:11 +0200)]
Use NameClass::classify to check for ConstReference

2 years agoAdd heuristic to determine type of IdentPat, make check for empty expressions correct
elkowar [Sat, 21 Aug 2021 09:00:43 +0000 (11:00 +0200)]
Add heuristic to determine type of IdentPat, make check for empty expressions correct

2 years agoMerge #9963
bors[bot] [Fri, 20 Aug 2021 14:02:08 +0000 (14:02 +0000)]
Merge #9963

9963: fix: resolve core::arch module r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agofix: resolve core::arch module
Aleksey Kladov [Fri, 20 Aug 2021 13:56:02 +0000 (16:56 +0300)]
fix: resolve core::arch module

See https://users.rust-lang.org/t/rust-analyzer-unable-to-resolve-target-specific-module/63797/4?u=matklad

The fix is to put all sysroot crates into the same source root

2 years agoAdd empty-body check to replace_match_with_if_let and re-prioritize choices
elkowar [Fri, 20 Aug 2021 13:20:54 +0000 (15:20 +0200)]
Add empty-body check to replace_match_with_if_let and re-prioritize choices

2 years agoMerge #9961
bors[bot] [Fri, 20 Aug 2021 13:20:43 +0000 (13:20 +0000)]
Merge #9961

9961: internal: prep to 2021 edition r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: prep to 2021 edition
Aleksey Kladov [Fri, 20 Aug 2021 13:20:18 +0000 (16:20 +0300)]
internal: prep to 2021 edition

2 years agoMerge #9960
bors[bot] [Fri, 20 Aug 2021 12:36:36 +0000 (12:36 +0000)]
Merge #9960

9960: internal: Use ExpandResult in all TokenExpanders r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSwitch AstDatabase::exapnd_proc_macro to ExpandResult
Lukas Wirth [Fri, 20 Aug 2021 12:34:46 +0000 (14:34 +0200)]
Switch AstDatabase::exapnd_proc_macro to ExpandResult

2 years agoSwitch BuiltinDeriveExpander::expand to ExpandResult
Lukas Wirth [Fri, 20 Aug 2021 12:28:36 +0000 (14:28 +0200)]
Switch BuiltinDeriveExpander::expand to ExpandResult

2 years agoMerge #9943
bors[bot] [Fri, 20 Aug 2021 11:57:28 +0000 (11:57 +0000)]
Merge #9943

9943: fix: Do not replace items annotated with builtin attrs with the attr input r=Veykril a=Veykril

This causes runnables to work for paths that actually resolve to the `test` attribute now.
![Code_aUhX1KQfw3](https://user-images.githubusercontent.com/3757771/129917168-bd9ed3f8-3a08-49d2-930a-4b93efaa8acf.png)

Prior to this we replaced items annotated with builtin attributes by the attribute input instead of the item in our dummy expansion which is why the fully written path didn't work as we actually discarded the item while `test` was just ignored.

Fixes #9935

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoUse correct HirFileId in find_related_test
Lukas Wirth [Fri, 20 Aug 2021 11:49:28 +0000 (13:49 +0200)]
Use correct HirFileId in find_related_test

2 years agoFix runnables not seeing test and bench attributes
Lukas Wirth [Wed, 18 Aug 2021 14:30:09 +0000 (16:30 +0200)]
Fix runnables not seeing test and bench attributes

2 years agoDo not replace items annotated with builtin attrs with the attr input
Lukas Wirth [Wed, 18 Aug 2021 13:35:14 +0000 (15:35 +0200)]
Do not replace items annotated with builtin attrs with the attr input

2 years agoMerge #9955
bors[bot] [Thu, 19 Aug 2021 22:13:09 +0000 (22:13 +0000)]
Merge #9955

9955: fix: Rename fails on renaming definitions created by macros instead of renaming the macro invocation r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoRename fails on renaming definitions created by macros
Lukas Wirth [Thu, 19 Aug 2021 20:53:00 +0000 (22:53 +0200)]
Rename fails on renaming definitions created by macros

2 years agoMerge #9855
bors[bot] [Thu, 19 Aug 2021 15:19:06 +0000 (15:19 +0000)]
Merge #9855

9855: feature: Destructure Tuple Assist r=Veykril a=Booksbaum

Part of #8673. This PR only handles tuples, not TupleStruct and RecordStruct.

Code Assist to destructure a tuple into its items:
![Destructure_Tuple_Assist](https://user-images.githubusercontent.com/15612932/129020107-775d7c94-dca7-4d1f-a0a2-cd63cabf4132.gif)

* Should work in nearly all pattern positions, like let assignment, function parameters, match arms, for loops, and nested variables (`if let Some($0t) = Some((1,2))`)
  -> everywhere `IdentPat` is allowed
  * Exception: If there's a sub-pattern (``@`):`
    ```rust
    if let t @ (1..=3, 1..=3) = ... {}
    //     ^
    ```
    -> `t` must be a `Name`; `TuplePat` (`(_0, _1)`) isn't allowed
    * inside subpattern is ok:
      ```rust
      let t @ (a, _) = ((1,2), 3);
      //       ^
      ```
      ->
      ```rust
      let t @ ((_0, _1), _) = ((1,2), 3);
      ```
* Assist triggers only at tuple declaration, not tuple usage.
  (might be useful especially when it creates a sub-pattern (after ``@`)` and only changes the usage under cursor -- but not part of this PR).

### References
References can be destructured:
```rust
let t = &(1,2);
//  ^
let v = t.0;
```
->
```rust
let (_0, _1) = &(1,2);
let v = _0;
```
BUT: `t.0` and `_0` have different types (`i32` vs. `&i32`) -> `v` has now a different type.

I think that's acceptable: I think the destructure assist is mostly used in simple, immediate scopes and not huge existing code.

Additional Notes:
* `ref` has same behaviour (-> `ref` is kept for items)
  ```rust
  let ref t = (1,2);
  //      ^
  ```
  ->
  ```rust
  let (ref _0, ref _1) = (1,2);
  ```
* Rust IntelliJ Plugin: doesn't trigger with `&` or `ref` at all

### mutable
```rust
let mut t = (1,2);
//      ^
```
->
```rust
let (mut _0, mut _1) = (1,2);
```
and
```rust
let t = &mut (1,2);
//  ^
```
->
```rust
let (_0, _1) = &mut (1,2);
```
Again: with reference (`&mut`), `t.0` and `_0` have different types (`i32` vs `&mut i32`).
And there's an additional issue with `&mut` and assignment:
```rust
let t = &mut (1,2);
//  ^
t.0 = 9;
```
->
```rust
let (_0, _1) = &mut (1,2);
_0 = 9;
//   ^
//   mismatched types
//   expected `&mut {integer}`, found integer
//   consider dereferencing here to assign to the mutable borrowed piece of memory
```
But I think that's quite a niche use case, so I don't catch that (`*_0 = 9;`)

Additional Notes:
* Rust IntelliJ Plugin: removes the `mut` (`let mut t = ...` -> `let (_0, _1) = ...`), doesn't trigger with `&mut`

### Binding after ``@``
Destructure tuple in sub-pattern is implemented:
```rust
let t = (1,2);
//  ^
let v = t.0;
let f = t.into();
```
->
```rust
let t @ (_0, _1) = (1,2);
let v = _0;
let f = t.into();
```
BUT: Bindings after ``@`` aren't currently in stable and require `#![feature(bindings_after_at)]` (though should be generally [available quite soon](https://github.com/rust-lang/rust/pull/85305#event-5072889913) (with `1.56.0`)).
But I don't know how to check for an enabled feature -> Destructure tuple in sub-pattern [isn't enabled](https://github.com/Booksbaum/rust-analyzer/blob/a4ee6c7954f910da3ca74fc0e25edda9077ad184/crates/ide_assists/src/handlers/destructure_tuple_binding.rs#L32) yet.

* When Destructure in sub-pattern is enabled there are two assists:
  * `Destructure tuple in place`:
    ```rust
    let t = (1,2);
    //  ^
    ```
    ->
    ```rust
    let (_0, _1) = (1,2);
    let v = _0;
    let f = /*t*/.into();
    ```
  * `Destructure tuple in sub-pattern`:
    ```rust
    let t = (1,2);
    //  ^
    let v = t.0;
    let f = t.into();
    ```
    ->
    ```rust
    let t @ (_0, _1) = (1,2);
    let v = _0;
    let f = t.into();
    ```
* When Destructure in sub-pattern is disabled, only the first one is available and just named `Destructure tuple`

<br/>
<br/>

### Caveats
* Unlike in #8673 or IntelliJ rust plugin, I'm not leaving the previous tuple name at function calls.
  **Reasoning**: It's not too unlikely the tuple variable shadows another variable. Destructuring the tuple while leaving the function call untouched, results in still a valid function call -- but now with another variable:
  ```rust
  let t = (8,9);
  let t = (1,2);
  //  ^
  t.into()
  ```
  => Destructure Tuple
  ```rust
  let t = (8,9);
  let (_0, _1) = (1,2);
  t.into()
  ```
  `t.into()` is still valid -- using the first tuple.
  Instead I comment out the tuple usage, which results in invalid code -> must be handled by user:
  ```rust
  /*t*/.into()
  ```
  * (though that might be a biased decision: For testing I just declared a lot of `t`s and quite ofen in lines next to each other...)
  * Issue: there are some cases that results in still valid code:
    * macro that accept the tuple as well as no arguments:
      ```rust
      macro_rules! m {
          () => { "foo" };
          ($e:expr) => { $e; "foo" };
      }
      let t = (1,2);
      m!(t);
      m!(/*t*/);
      ```
      -> both calls are valid ([test](https://github.com/Booksbaum/rust-analyzer/blob/a4ee6c7954f910da3ca74fc0e25edda9077ad184/crates/ide_assists/src/handlers/destructure_tuple_binding.rs#L1474))
    * Probably with tuple as return value. Changing the return value most likely results in an error -- but in another place; not where the tuple usage was.

  -> not sure that's the best way....
  Additional the tuple name surrounded by comment is more difficult to edit than just the name.
* Code Assists don't support snippet placeholder, and rust analyzer just the first `$0` -> unfortunately no editing of generated tuple item variables. Cursor (`$0`) is placed on first generated item.

<br/>
<br/>

### Issues
* Tuple index usage in macro calls aren't converted:
  ```rust
  let t = (1,2);
  //  ^
  let v = t.0;
  println!("{}", t.0);
  ```
  ->
  ```rust
  let (_0, _1) = (1,2);
  let v = _0;
  println!("{}", /*t*/.0);
  ```
  ([tests](https://github.com/Booksbaum/rust-analyzer/blob/a4ee6c7954f910da3ca74fc0e25edda9077ad184/crates/ide_assists/src/handlers/destructure_tuple_binding.rs#L1294))
  * Issue is:
    [name.syntax()](https://github.com/Booksbaum/rust-analyzer/blob/a4ee6c7954f910da3ca74fc0e25edda9077ad184/crates/ide_assists/src/handlers/destructure_tuple_binding.rs#L242-L244) in each [usage](https://github.com/Booksbaum/rust-analyzer/blob/a4ee6c7954f910da3ca74fc0e25edda9077ad184/crates/ide_assists/src/handlers/destructure_tuple_binding.rs#L108-L113) of a tuple is syntax & text_range in its file.
    EXCEPT when tuple usage is in a macro call (`m!(t.0)`), the macro is expanded and syntax (and range) is based on that expanded macro, not in actual file.
    That leads to several things:
    * I cannot differentiate between calling the macro with the tuple or with tuple item:
      ```rust
      macro_rules! m {
          ($t:expr, $i:expr) => { $t.0 + $i };
      }
      let t = (1,2);
      m!(t, t.0);
      ```
      -> both `t` usages are resolved as tuple index usage
    * Range of resolved tuple index usage is in expanded macro, not in actual file
     -> don't know where to replace index usage

    -> tuple items passed into a macro are ignored, and only the tuple name itself is handled (uncommented)
* I'm not checking if the generated names conflict with already existing variables.
  ```rust
  let _0 = 42;            // >-|
  let t = (1,2);          //   |
  let v = _0;             // <-|
  //  ^ 42
  ```
  => deconstruct tuple
  ```rust
  let _0 = 42;
  let (_0, _1) = (1,2);     // >-|
  let v = _0;               // <-|
  //  ^ now 1
  ```
  * I tried to get the scope at tuple declaration and its usages. And then iterate all names with [`process_all_names`](https://github.com/rust-analyzer/rust-analyzer/blob/145b51f9daf5371f1754c09eb2e3a77e0a24a0dc/crates/hir/src/semantics.rs#L935). But that doesn't find all local names for declarations (`let t = (1,2)`) (for usages it does)
  * This isn't unique to this Code Assist, but happen in others too (like `extract into variable` or `extract into function`). But here a name conflict is more likely (when destructuring multiple tuples, for examples nested ones (`let t = ((1,2),3)` -> `let (_0, _1) = ...` -> `let ((_0, _1), _1) = ...` -> error))
  * IntelliJ rust plugin does handle this (-> name is `_00`)

Co-authored-by: BooksBaum <15612932+Booksbaum@users.noreply.github.com>
2 years agoRemove `match_ast` usage
BooksBaum [Thu, 19 Aug 2021 12:17:23 +0000 (14:17 +0200)]
Remove `match_ast` usage

2 years agoRemove `match_ast!` macro call
BooksBaum [Thu, 19 Aug 2021 12:09:52 +0000 (14:09 +0200)]
Remove `match_ast!` macro call

Add node about uncommenting tuple in macro call

2 years agoMerge #9950
bors[bot] [Thu, 19 Aug 2021 11:31:46 +0000 (11:31 +0000)]
Merge #9950

9950: Fix codegen for is_method documentation r=yoshuawuyts a=yoshuawuyts

While authoring https://github.com/rust-lang/rust/pull/88154 I realized that the codegen for the `enum_generate_is_method` assist currently generates invalid paths, and used snake case instead of spaces for the docs description. This fixes both issues. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2 years agoFix codegen for is_method documentation
Yoshua Wuyts [Thu, 19 Aug 2021 10:39:06 +0000 (12:39 +0200)]
Fix codegen for is_method documentation

Previously the generated paths were invalid. This fixes that.

2 years agoMerge #9942
bors[bot] [Wed, 18 Aug 2021 13:04:53 +0000 (13:04 +0000)]
Merge #9942

9942: fix: Don't trigger related highlighting on unrelated tokens r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoDon't trigger related highlighting on unrelated tokens
Lukas Wirth [Wed, 18 Aug 2021 13:02:31 +0000 (15:02 +0200)]
Don't trigger related highlighting on unrelated tokens

2 years agoMerge #9941
bors[bot] [Wed, 18 Aug 2021 12:36:18 +0000 (12:36 +0000)]
Merge #9941

9941: feat: include full path in the cyclic deps error r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agofeat: include full path in the cyclic deps error
Aleksey Kladov [Wed, 18 Aug 2021 12:04:16 +0000 (15:04 +0300)]
feat: include full path in the cyclic deps error

2 years agoAdd deref (`*`) handling for usages of ref tuples
BooksBaum [Tue, 17 Aug 2021 16:18:02 +0000 (18:18 +0200)]
Add deref (`*`) handling for usages of ref tuples

2 years agoSwitch order of assists
BooksBaum [Fri, 13 Aug 2021 17:16:36 +0000 (19:16 +0200)]
Switch order of assists

Destructure in sub-pattern before Destructure in place to favor the
first one

2 years agoAdd generated doctest
BooksBaum [Tue, 10 Aug 2021 12:20:14 +0000 (14:20 +0200)]
Add generated doctest

2 years agoFix errors from `rebase master`
BooksBaum [Tue, 10 Aug 2021 12:15:12 +0000 (14:15 +0200)]
Fix errors from `rebase master`

Note:
2nd Assist description is moved down: generated doc tests extracts now
all tests (previously only the first one). But it uses the first
`Assist` name -- which is the wrong one for the 2nd test. And 2nd assist
is currently disabled -> would fail anyway.

2 years agoCleanup according to style-requirements in tests
BooksBaum [Tue, 10 Aug 2021 11:28:32 +0000 (13:28 +0200)]
Cleanup according to style-requirements in tests

2 years agoFix: different assist ids in doc and code
BooksBaum [Mon, 9 Aug 2021 18:58:33 +0000 (20:58 +0200)]
Fix: different assist ids in doc and code

2 years agoHandle tuple in macro call
BooksBaum [Mon, 9 Aug 2021 17:56:11 +0000 (19:56 +0200)]
Handle tuple in macro call

Only tuple name is handled (uncommented), not tuple index

2 years agoAdd destructure in sub-pattern (after `@`)
BooksBaum [Fri, 6 Aug 2021 08:55:44 +0000 (10:55 +0200)]
Add destructure in sub-pattern (after `@`)

2 years agoHandle `mut` & `ref`
BooksBaum [Wed, 4 Aug 2021 19:16:53 +0000 (21:16 +0200)]
Handle `mut` & `ref`

2 years agoAdd Destructure Tuple
BooksBaum [Tue, 17 Aug 2021 17:22:57 +0000 (19:22 +0200)]
Add Destructure Tuple

2 years agoMerge #9936
bors[bot] [Tue, 17 Aug 2021 16:26:05 +0000 (16:26 +0000)]
Merge #9936

9936: proc_macro_api: make commit & date suffix of binary version optional r=lnicola a=lnicola

Closes #9916

bors r+

Co-authored-by: Florian sp1rit​ <sp1ritCS@protonmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoFix formatting
Laurențiu Nicola [Tue, 17 Aug 2021 16:25:37 +0000 (19:25 +0300)]
Fix formatting

2 years agoMerge #9934
bors[bot] [Tue, 17 Aug 2021 15:49:02 +0000 (15:49 +0000)]
Merge #9934

9934: Revert "Downgrade notify and use RecommendedWatcher" r=lnicola a=xanderio

This reverts commit 5b0c86af7d1683983a35f232baa7c98cfa3c382d.

The pre-5.0.12 release of notify fixed this issue.

`@lnicola` Could you verify that this now works on NetBSD?

Co-authored-by: Alexander Sieg <alex@xanderio.de>
Co-authored-by: Alexander Sieg <6298052+xanderio@users.noreply.github.com>
2 years agorebuild Cargo.lock
Alexander Sieg [Tue, 17 Aug 2021 15:27:37 +0000 (17:27 +0200)]
rebuild Cargo.lock

2 years agoBump notify version to 5.0.0-pre.12
Alexander Sieg [Tue, 17 Aug 2021 15:25:11 +0000 (17:25 +0200)]
Bump notify version to 5.0.0-pre.12

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2 years agoRevert "Downgrade notify and use RecommendedWatcher"
Alexander Sieg [Tue, 17 Aug 2021 15:17:02 +0000 (17:17 +0200)]
Revert "Downgrade notify and use RecommendedWatcher"

This reverts commit 5b0c86af7d1683983a35f232baa7c98cfa3c382d.

The pre-5.0.12 release of notify fixed this issue.

2 years agoMerge #9929
bors[bot] [Tue, 17 Aug 2021 13:25:08 +0000 (13:25 +0000)]
Merge #9929

9929: fix: Handle all rename special cases for record pattern fields r=Veykril a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoEmit more concise text edits in ide_db::rename
Lukas Wirth [Tue, 17 Aug 2021 13:24:01 +0000 (15:24 +0200)]
Emit more concise text edits in ide_db::rename

2 years agoproc_macro_api: make commit & date suffix of binary version optional
Florian sp1rit​ [Mon, 16 Aug 2021 11:23:53 +0000 (13:23 +0200)]
proc_macro_api: make commit & date suffix of binary version optional

Signed-off-by: Florian "sp1rit"​ <sp1ritCS@protonmail.com>
2 years agoinline await statement
Alex.F [Tue, 17 Aug 2021 07:24:13 +0000 (15:24 +0800)]
inline await statement

2 years agosome code docs for the ide_db/rename module
Lukas Wirth [Mon, 16 Aug 2021 21:06:51 +0000 (23:06 +0200)]
some code docs for the ide_db/rename module

2 years agoHandle all rename special cases for all record pattern fields
Lukas Wirth [Mon, 16 Aug 2021 20:48:38 +0000 (22:48 +0200)]
Handle all rename special cases for all record pattern fields

2 years agoMerge #9928
bors[bot] [Mon, 16 Aug 2021 19:26:18 +0000 (19:26 +0000)]
Merge #9928

9928: internal: Highlight function exit points on `fn` keyword r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoHighlight function exit points on `fn` keyword
Lukas Wirth [Mon, 16 Aug 2021 19:25:22 +0000 (21:25 +0200)]
Highlight function exit points on `fn` keyword

2 years agoMerge #9927
bors[bot] [Mon, 16 Aug 2021 19:04:57 +0000 (19:04 +0000)]
Merge #9927

9927: minor: Fix some clippy lints r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoFix some clippy lints
Laurențiu Nicola [Mon, 16 Aug 2021 19:04:26 +0000 (22:04 +0300)]
Fix some clippy lints

2 years agoMerge #9921
bors[bot] [Mon, 16 Aug 2021 16:38:44 +0000 (16:38 +0000)]
Merge #9921

9921: Only add entries to SourceToDef dynmaps when they come from the same file r=matklad a=Veykril

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

Running the test as described in the issue I do not get any eprintln output at all anymore.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agostyle
Lukas Wirth [Mon, 16 Aug 2021 16:29:16 +0000 (18:29 +0200)]
style

2 years agoMerge #9924
bors[bot] [Mon, 16 Aug 2021 16:25:57 +0000 (16:25 +0000)]
Merge #9924

9924: Fix gen debug for enums r=yoshuawuyts a=yoshuawuyts

Closes https://github.com/rust-analyzer/rust-analyzer/issues/9914. Thanks!

r? `@Veykril`

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2 years agoimplement feedback from review
Yoshua Wuyts [Mon, 16 Aug 2021 16:23:51 +0000 (18:23 +0200)]
implement feedback from review

2 years agoFlatten SourceToDefCache structure
Lukas Wirth [Mon, 16 Aug 2021 15:55:18 +0000 (17:55 +0200)]
Flatten SourceToDefCache structure

2 years agofix debug tuple structs
Yoshua Wuyts [Mon, 16 Aug 2021 15:39:08 +0000 (17:39 +0200)]
fix debug tuple structs

2 years agoOnly add entries to SourceToDef dynmaps when they come from the same file
Lukas Wirth [Mon, 16 Aug 2021 15:07:25 +0000 (17:07 +0200)]
Only add entries to SourceToDef dynmaps when they come from the same file

2 years agoMerge #9920
bors[bot] [Mon, 16 Aug 2021 14:13:04 +0000 (14:13 +0000)]
Merge #9920

9920: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Mon, 16 Aug 2021 14:12:20 +0000 (16:12 +0200)]
Simplify

2 years agoMerge #9918
bors[bot] [Mon, 16 Aug 2021 11:46:21 +0000 (11:46 +0000)]
Merge #9918

9918: minor: simplify r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agominor: simplify
Aleksey Kladov [Mon, 16 Aug 2021 11:45:54 +0000 (14:45 +0300)]
minor: simplify

2 years agoMerge #9917
bors[bot] [Mon, 16 Aug 2021 11:32:43 +0000 (11:32 +0000)]
Merge #9917

9917: minor: remove dead code r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agominor: remove dead code
Aleksey Kladov [Mon, 16 Aug 2021 11:27:36 +0000 (14:27 +0300)]
minor: remove dead code

2 years agofix debug record structs
Yoshua Wuyts [Mon, 16 Aug 2021 10:58:06 +0000 (12:58 +0200)]
fix debug record structs

2 years agoclean imports
Alex.F [Mon, 16 Aug 2021 02:35:27 +0000 (10:35 +0800)]
clean imports

2 years agofix lint
Alex.F [Sun, 15 Aug 2021 16:21:12 +0000 (00:21 +0800)]
fix lint

2 years agouse async version
Alex.F [Sun, 15 Aug 2021 16:19:45 +0000 (00:19 +0800)]
use async version

2 years agoMerge #9905
bors[bot] [Sun, 15 Aug 2021 10:26:59 +0000 (10:26 +0000)]
Merge #9905

9905: internal: optimize compile time r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: optimize compile time
Aleksey Kladov [Sun, 15 Aug 2021 10:24:37 +0000 (13:24 +0300)]
internal: optimize compile time

cargo llvm-lines shows that path_to_error bloats the code. I don't think
I've needed this functionality recently, seems that we've fixed most of
the serialization problems. So let's just remove it. Should be easy to
add back if we ever need it, and it does make sense to keep the
`from_json` function around.

2 years agoMerge #9902
bors[bot] [Sat, 14 Aug 2021 17:43:52 +0000 (17:43 +0000)]
Merge #9902

9902: minor: move functionality to a better place r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agominor: move functionality to a better place
Aleksey Kladov [Sat, 14 Aug 2021 17:38:31 +0000 (20:38 +0300)]
minor: move functionality to a better place

2 years agoMerge #9901
bors[bot] [Sat, 14 Aug 2021 17:30:13 +0000 (17:30 +0000)]
Merge #9901

9901: internal: remove dead code r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: remove dead code
Aleksey Kladov [Sat, 14 Aug 2021 17:29:46 +0000 (20:29 +0300)]
internal: remove dead code

2 years agoMerge #9900
bors[bot] [Sat, 14 Aug 2021 17:17:51 +0000 (17:17 +0000)]
Merge #9900

9900: internal: remove one more usage of old editing API. r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: remove one more usage of old editing API.
Aleksey Kladov [Sat, 14 Aug 2021 17:17:16 +0000 (20:17 +0300)]
internal: remove one more usage of old editing API.

2 years agoMerge #9899
bors[bot] [Sat, 14 Aug 2021 17:10:04 +0000 (17:10 +0000)]
Merge #9899

9899: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Sat, 14 Aug 2021 17:06:35 +0000 (19:06 +0200)]
Simplify

2 years agoMerge #9897
bors[bot] [Sat, 14 Aug 2021 16:46:19 +0000 (16:46 +0000)]
Merge #9897

9897: internal: remove old editing API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: remove old editing API
Aleksey Kladov [Sat, 14 Aug 2021 16:45:47 +0000 (19:45 +0300)]
internal: remove old editing API