Commit Graph

16771 Commits

Author SHA1 Message Date
Edwin Cheng
c4173bb468 Handle extended key value attr in mbe 2021-04-17 14:31:52 +08:00
bors[bot]
df5b6f7d45
Merge #8549
8549: Fix `TestDB::module_at_position` with submodules r=jonas-schievink a=jonas-schievink

Found while looking into https://github.com/rust-analyzer/rust-analyzer/issues/8519

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-17 01:35:22 +00:00
Jonas Schievink
9e8feeb94a Fix TestDB::module_at_position with submodules 2021-04-17 03:34:05 +02:00
bors[bot]
52585df24a
Merge #8546
8546: Return CallInfo for unclosed call expressions r=Veykril a=Veykril

Closes #8522
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-16 21:00:55 +00:00
Lukas Wirth
992965cd82 Return CallInfo for unclosed call expressions 2021-04-16 22:57:33 +02:00
bors[bot]
2009556472
Merge #8542
8542: Include path in `unresolved-macro-call` diagnostic r=matklad a=jonas-schievink



Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-16 20:52:56 +00:00
Dawer
edbb1797fb Fill partial match arms for a tuple of enums 2021-04-17 01:09:09 +05:00
bors[bot]
5274eb12dd
Merge #8539
8539:  fix: Do not propose inherent traits in flyimports and import assists r=flodiebold a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8520

I've went with a separate method approach, since the [highlighted code](https://github.com/rust-analyzer/rust-analyzer/issues/8520#issuecomment-819856337) has not`Type` and uses `Ty` to get his data, but the code I had to change has no access to `Ty` and has `Type` only.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-04-16 17:54:47 +00:00
bors[bot]
47b40b6603
Merge #8545
8545: Fix primitive shadowing with inner items r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-16 17:32:02 +00:00
Jonas Schievink
543d4ef7c5 Fix primitive shadowing with inner items 2021-04-16 19:28:22 +02:00
bors[bot]
e53919a425
Merge #8543
8543: Assist fix: Fill match arms for a tuple of a single enum. r=Veykril a=iDawer

This is rather a small fix addressing an issue mentioned in https://github.com/rust-analyzer/rust-analyzer/issues/8493#issuecomment-818770670


Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-04-16 15:47:43 +00:00
Jonas Schievink
ff858376aa Include path in unresolved-macro-call diagnostic 2021-04-16 15:48:03 +02:00
Dawer
8965be3d0e Fill match arms for a tuple of a single enum. 2021-04-16 17:22:11 +05:00
Kirill Bulatov
739edfd5cf Exclude inherent traits from flyimports 2021-04-16 11:13:17 +03:00
bors[bot]
75371eb0fa
Merge #8536
8536: change grammar r=kjeremy a=Milo123459

indexing -> Indexing
fetching -> Fetching
loading -> Loading
roots scanned -> Roots Scanned

Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
2021-04-15 18:48:25 +00:00
Milo
2fa5086424 change grammar 2021-04-15 19:40:07 +01:00
bors[bot]
a78c50f1fe
Merge #8535
8535: Fix markdown links r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-15 17:46:10 +00:00
Jonas Schievink
93128efef8 Fix markdown links 2021-04-15 19:45:07 +02:00
bors[bot]
427ba9d49b
Merge #8534
8534: Remove unneeded annotations from find_path tests r=jonas-schievink a=jonas-schievink

Addresses https://github.com/rust-analyzer/rust-analyzer/pull/8532#discussion_r614247375

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-15 17:28:10 +00:00
Jonas Schievink
d073c3e56d Remove unneeded annotations from find_path tests 2021-04-15 19:24:09 +02:00
bors[bot]
3af303600a
Merge #8510 #8533
8510: Move cursor position when using item movers r=jonas-schievink a=jonas-schievink

This updates the cursor position when moving items around to stay in the same location within the moved node.

I changed the `moveItem` response to `SnippetTextEdit[]`, since that made more sense to me (the file was ignored by the client anyways, since the edits always apply to the current document). It also matches `onEnter`, which seems logical to me, but please let me know if this doesn't make sense.

There's still a bug in the client-side snippet code that will cause the cursor position to be slightly off when moving parameters in the same line (presumably we don't track the column correctly after deleting `$0`). Not really sure how to fix that immediately, but this PR should already be an improvement despite that bug.

8533: Fix typo in style guide r=jonas-schievink a=jonas-schievink

Fixes bold text rendering

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-15 16:42:36 +00:00
Jonas Schievink
6e575d8c73 Fix typo in style guide 2021-04-15 18:38:52 +02:00
bors[bot]
8d17d0c58c
Merge #8532
8532: Make `find_path` tests adhere to style guide r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-15 16:32:53 +00:00
Jonas Schievink
6acd0ac51a Make find_path tests adhere to style guide 2021-04-15 18:32:19 +02:00
bors[bot]
4dafc57019
Merge #8529
8529: minor: notify 5.0.0.pre7 r=kjeremy a=kjeremy

Fixes windows leak: https://github.com/notify-rs/notify/pull/298

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-04-15 16:16:10 +00:00
kjeremy
236814db0d Update license check 2021-04-15 12:15:23 -04:00
kjeremy
7091082f38 notify 5.0.0.pre7
Fixes windows leak: https://github.com/notify-rs/notify/pull/298
2021-04-15 11:51:32 -04:00
Dawer
cedbf2e1c5 Finish GenericParamsOwnerEdit impls 2021-04-15 15:57:45 +05:00
bors[bot]
042c248cc5
Merge #8526
8526: fix: Do not show flyimports in trait or impl declarations r=SomeoneToIgnore a=SomeoneToIgnore

Part of https://github.com/rust-analyzer/rust-analyzer/issues/8518

Removes autoimport suggestions for the case: 

> inside trait definitions / impls (trait Trait {$0} / impl Foo {$0}), nothing except the fn, type and const keywords (and the full item completions for trait impls) should appear (currently many types and autoimport suggestions)

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-04-15 08:53:03 +00:00
Kirill Bulatov
1c75d64c70 Do not show flyimports in trait or impl declarations 2021-04-15 11:51:43 +03:00
Brandon
ffefbf2ba4 Fix extract function with partial block selection 2021-04-14 21:34:01 -07:00
Dawer
144afa55a6 Switch introduce_named_lifetime assist to use mutable syntax tree 2021-04-15 01:56:19 +05:00
bors[bot]
e131bfc747
Merge #8515
8515: internal: Profile trait solving for all invocations r=flodiebold a=SomeoneToIgnore

Follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/8514#issuecomment-819610492

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-04-14 20:53:27 +00:00
Kirill Bulatov
af8a6049a5 Profile trait solving for all invocations 2021-04-14 19:11:17 +03:00
bors[bot]
678af41065
Merge #8514
8514: Add more profiling spans into type inference r=matklad a=SomeoneToIgnore

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

I've added a minimal set of spans to remove `???` and showcase the underlying issue:

<img width="1552" alt="image" src="https://user-images.githubusercontent.com/2690773/114722983-f2181900-9d42-11eb-821d-9e93ded5f81f.png">

`db.trait_solve` reliably produces the same timings for the same input in the same place for me, despite supposedly being cached by Salsa.
In my perception, this is a bit odd, so I've decided to stop at this point and discuss it with people with better knowledge on the topic.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-04-14 14:20:13 +00:00
Kirill Bulatov
75a2605361 Better places for spans 2021-04-14 17:15:37 +03:00
Kirill Bulatov
3390e73816 We need to go deeper 2021-04-14 16:59:08 +03:00
Kirill Bulatov
d1fc9d727b Add a missing span 2021-04-14 15:52:56 +03:00
Jonas Schievink
30aae2cefb Move cursor position when using item movers 2021-04-14 00:03:04 +02:00
bors[bot]
10a243ea55
Merge #8507
8507: internal: follow test style guide in typing.rs r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-13 12:34:12 +00:00
Jonas Schievink
43071e81a6 internal: follow test style guide in typing.rs 2021-04-13 14:31:05 +02:00
bors[bot]
9f18ba675f
Merge #8506
8506: crossbeam-channel 0.5.1 r=kjeremy a=kjeremy

Fixes a potential memory leak in unbound channels.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-04-13 12:23:37 +00:00
kjeremy
9b673aa9d8 crossbeam-channel 0.5.1
Fixes a potential memory leak in unbound channels.
2021-04-13 08:19:47 -04:00
bors[bot]
7f53d3acba
Merge #8504
8504: decl_check: follow test style guide r=jonas-schievink a=jonas-schievink

changelog skip

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-13 12:14:16 +00:00
Jonas Schievink
31594bcd01 decl_check: follow test style guide 2021-04-13 14:13:35 +02:00
bors[bot]
9beed98f2a
Merge #8432
8432: decl_check: consider outer scopes' allows r=jonas-schievink a=lf-

Fix #8417. Also makes it less noisy about no_mangle annotated stuff the
user can do nothing about.

Note: this still is broken with bitfield! macros. A repro in an ignore
test is included here. I believe this bug is elsewhere, and I don't
think I can work around it here.

I would like help filing the remaining bug, as it does actually affect
users, but I don't know how to describe the behaviour (or even if it
is unintended).

Co-authored-by: Jade <software@lfcode.ca>
2021-04-13 12:02:26 +00:00
bors[bot]
03e0bf7f55
Merge #8354
8354: Distinguishing between different operators in semantic highlighting r=matklad a=chetankhilosiya



Co-authored-by: Chetan Khilosiya <chetan.khilosiya@gmail.com>
2021-04-13 11:46:23 +00:00
bors[bot]
e6728a8cd3
Merge #8415
8415: Fix faulty assertion when extracting function with macro call r=matklad a=brandondong

**Reproduction:**
```rust
fn main() {
    let n = 1;
    let k = n * n;
    dbg!(n);
}
```
1. Select the second and third lines of the main function. Use the "Extract into function" code assist.
2. Panic occurs in debug, error is logged in release: "[ERROR ide_assists::handlers::extract_function] assertion failed: matches!(path, ast :: Expr :: PathExpr(_))".
3. Function generates successfully on release where the panic was bypassed.
```rust
fn fun_name(n: i32) {
    let k = n * n;
    dbg!(n);
}
```

**Cause:**
- The generated function will take `n` as a parameter. The extraction logic needs to search the usages of `n` to determine whether it is used mutably or not. The helper `path_element_of_reference` is called for each usage but the second usage is a macro call and fails the `Expr::PathExpr(_)` match assertion.
- The caller of `path_element_of_reference` does implicitly assume it to be a `Expr::PathExpr(_)` in how it looks at its parent node for determining whether it is used mutably. This logic will not work for macros.
- I'm not sure if there are any other cases besides macros where it could be something other than a `Expr::PathExpr(_)`. I tried various examples and could not find any.

**Fix:**
- Update assertion to include the macro case.
- Add a FIXME to properly handle checking if a macro usage requires mutable access. For now, return false instead of running the existing logic that is tailored for `Expr::PathExpr(_)`'s.

Co-authored-by: Brandon <brandondong604@hotmail.com>
2021-04-13 11:39:03 +00:00
bors[bot]
0c02208fd8
Merge #8489
8489: Indent block expressions on enter r=matklad a=jonas-schievink

This improves on https://github.com/rust-analyzer/rust-analyzer/pull/8388 by also indenting the created block expression on enter.

![on enter](https://user-images.githubusercontent.com/1786438/114444123-cb38d600-9bce-11eb-8af2-8e8d1c0f9908.gif)


Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-04-13 10:06:36 +00:00
bors[bot]
d8120ed1a0
Merge #8500
8500: internal: fix flakiness of accidentally quadratic test r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-13 09:56:45 +00:00