Commit Graph

18995 Commits

Author SHA1 Message Date
Frank Steffahn
75073451c6 Fix three more (reverse) “a”/“an” typos 2021-08-22 17:48:15 +02:00
bors[bot]
1c27243f95
Merge #9988
9988: fix: Refactor & improve handling of overloaded binary operators r=flodiebold a=flodiebold

Fixes #9971. Also records them as method resolutions, which we could use later.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-08-22 15:37:06 +00:00
Frank Steffahn
5f5d45468d Fix two more “a”/“an” typos (this time the other way) 2021-08-22 17:36:58 +02:00
Florian Diebold
424dda8113 Refactor & improve handling of overloaded binary operators
Fixes #9971. Also records them as method resolutions, which we could use
later.
2021-08-22 17:35:50 +02:00
bors[bot]
c8fd4fd410
Merge #9987
9987: Fix two more “a”/“an” typos r=lnicola a=steffahn

Follow-up to #9985

you guys are merging these fast 😅 

Co-authored-by: Frank Steffahn <frank.steffahn@stu.uni-kiel.de>
2021-08-22 15:27:39 +00:00
Frank Steffahn
35a7fdd2c1 Fix two more “a”/“an” typos 2021-08-22 17:24:48 +02:00
bors[bot]
0960d4ebe2
Merge #9937 #9985
9937: internal: incentivize rust-analyzed developers to fix panics r=matklad a=matklad



9985: minor: Fix another “a”/“an” typo r=Veykril a=steffahn

Follow-up to #9984.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: Frank Steffahn <frank.steffahn@stu.uni-kiel.de>
2021-08-22 15:01:15 +00:00
Aleksey Kladov
85fbbc5372 internal: incentivize rust-analyzed developers to fix panics
It's good that rust-analyzer doesn't belly-up on a panic in some random
assist.

It is less good that rust-analyzer devs only know that the assists are
buggy when they are actively looking at the logs.
2021-08-22 17:54:50 +03:00
bors[bot]
107b2f1890
Merge #9972
9972: refactor : function generation assists r=Veykril a=mahdi-frms

Separated code generation from finding position for generated code. This will be ground work for introducing static associated function generation.

Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2021-08-22 14:53:41 +00:00
Frank Steffahn
ab23af439d Fix another “a”/“an” typo 2021-08-22 16:45:58 +02:00
bors[bot]
c6baf3dcf8
Merge #9984
9984: Fix typos “a”→“an” r=Veykril a=steffahn

See rust-lang/rust#88230

Co-authored-by: Frank Steffahn <frank.steffahn@stu.uni-kiel.de>
2021-08-22 13:06:34 +00:00
Frank Steffahn
3a5a93595f Fix typos “a”→“an” 2021-08-22 14:31:37 +02:00
bors[bot]
b9d879876e
Merge #9979
9979: fix: Incorrect up-mapping for tokens in derive attributes r=Veykril a=Veykril

Merely detaching the attributes causes incorrect spans to appear when mapping tokens up as the token ids resolve to the ranges of the stripped item so all the text ranges of its tokens are actually lower than the non-stripped ones.

Same fix as with attributes can be applied here, just replace the derive attribute with an equal amount of whitespace.

Fixes #9387

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-22 12:25:18 +00:00
Lukas Wirth
5507512eaf Replace stripped derives with whitespace in process_macro_input 2021-08-22 14:23:59 +02:00
bors[bot]
e535791756
Merge #9983
9983: internal: remove unreasonable crate dependency r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-22 11:06:07 +00:00
Aleksey Kladov
e86388689f internal: remove unreasonable crate dependency
Proc macro expansion shouldn't know about salsa at all.
2021-08-22 14:05:12 +03:00
bors[bot]
2943d9aa51
Merge #9982
9982: internal: reduce crate interdependence r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-22 10:45:01 +00:00
Aleksey Kladov
881d71a489 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!
2021-08-22 13:32:00 +03:00
Aleksey Kladov
5cef007bff internal: improve consistency
load and load_proc_macro do similar things
2021-08-22 13:15:18 +03:00
mahdi-frms
c1edbfbacc better assist label 2021-08-22 12:31:16 +04:30
bors[bot]
8cd171cd94
Merge #9978
9978: fix: Expand attributes recursively in expand_macro r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-21 21:26:00 +00:00
Lukas Wirth
2f179adc41 Expand attributes recursively in expand_macro 2021-08-21 23:24:12 +02:00
Lukas Wirth
a0d5290b7f Show try operator propogated types on ranged hover 2021-08-21 22:21:27 +02:00
bors[bot]
62837d7b1b
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>
2021-08-21 18:45:50 +00:00
Lukas Wirth
833de22d0b fix: Do not show functional update completion when already qualified 2021-08-21 20:45:15 +02:00
bors[bot]
9e3517f8f3
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>
2021-08-21 18:07:36 +00:00
Florian Diebold
df77e2448c 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.
2021-08-21 20:07:07 +02:00
Lukas Wirth
5fb8c0ddfd Remove MappedSubtree 2021-08-21 18:19:18 +02:00
Lukas Wirth
177c70128c Map attribute input tokens correctly 2021-08-21 18:13:41 +02:00
bors[bot]
337ccc75a1
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>
2021-08-21 16:10:04 +00:00
Laurențiu Nicola
104d6124d7 Handle coercion on binary operator RHS 2021-08-21 17:54:45 +03:00
mahdi-frms
50923ad741 func gen: seperate generation form position(3) 2021-08-21 19:13:14 +04:30
bors[bot]
19348bc478
Merge #9908
9908: fix check of the toolchain's path r=lnicola a=gfreezy

fixed #9907

Co-authored-by: Alex.F <gfreezy@gmail.com>
2021-08-21 13:41:09 +00:00
mahdi-frms
1ac9400100 func gen: seperate generation form position(2) 2021-08-21 17:31:37 +04:30
bors[bot]
3f4c515223
Merge #9966
9966: fix: Determine expected parameters from expected return in calls r=flodiebold a=flodiebold

Second attempt 😅 

Fixes #9560 

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-08-21 12:35:26 +00:00
Florian Diebold
1791a35f9f Determine expected parameters from expected return in calls
Fixes #9560
2021-08-21 14:33:31 +02:00
Florian Diebold
cd64353288 Adapt tests for correct behavior 2021-08-21 13:35:36 +02:00
Florian Diebold
5cff355059 Add another test 2021-08-21 13:35:34 +02:00
bors[bot]
6f41053ede
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>
2021-08-21 10:56:09 +00:00
Lukas Wirth
cee02673d1 Don't ask for the builtin attribute input twice 2021-08-21 12:55:05 +02:00
bors[bot]
4aa2a44a55
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>
2021-08-21 10:12:17 +00:00
elkowar
e47c9743cf
Fix smaller nitpicks 2021-08-21 12:02:21 +02:00
elkowar
7cff930393
Use NameClass::classify to check for ConstReference 2021-08-21 11:11:27 +02:00
elkowar
75f0701211
Add heuristic to determine type of IdentPat, make check for empty expressions correct 2021-08-21 11:00:43 +02:00
mahdi-frms
87439b1d6a func gen: seperate generation form position(1) 2021-08-21 13:29:15 +04:30
mahdi-frms
e2c233a42b simplify 2021-08-21 11:52:07 +04:30
bors[bot]
13bbed7c16
Merge #9963
9963: fix: resolve core::arch module r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-20 14:02:08 +00:00
Aleksey Kladov
4924c24d91 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
2021-08-20 17:01:27 +03:00
elkowar
d6695286ee
Add empty-body check to replace_match_with_if_let and re-prioritize choices 2021-08-20 15:20:54 +02:00
bors[bot]
3004f2ec90
Merge #9961
9961: internal: prep to 2021 edition r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-20 13:20:43 +00:00