Commit Graph

26257 Commits

Author SHA1 Message Date
Lukas Wirth
93562dd5bd Use parent + and_then instead of ancestors 2023-09-22 08:53:24 +02:00
bors
11ffcc08a3 Auto merge of #15615 - shogo-nakano-desu:refactor/fix-clippy-lints, r=Veykril
Refactor/fix clippy lints

As title says.
2023-09-22 06:46:29 +00:00
bors
fccae08dd3 Auto merge of #15649 - tomalexander:master, r=Veykril
Documentation: Add parenthesis to the list of on-typing assists.
2023-09-22 06:12:52 +00:00
bors
c22bb0338a Auto merge of #15651 - rmehri01:15639_fix_inline_local_closure, r=lnicola
Fix inlining closures from local variables and functions

Previously, closures were not properly wrapped in parentheses for the `inline_local_variable` and `inline_call` assists, leading to the usages being incorrectly called:

```rust
fn main() {
    let $0f = || 2;
    let _ = f();
}
```

Now produces:

```rust
fn main() {
    let _ = (|| 2)();
}
```

Instead of:

```rust
fn main() {
    let _ = || 2();
}
```

Closes #15639
2023-09-22 05:07:51 +00:00
Ryan Mehri
ea11846490 fix parens when inlining closure in body of function 2023-09-21 21:55:10 -07:00
Ryan Mehri
60f7473c99 fix parens when inlining closure local variables 2023-09-21 21:31:15 -07:00
Tom Alexander
91b012f91d
Documentation: Add parenthesis to the list of on-typing assists. 2023-09-21 14:58:24 -04:00
bors
d6fef2c7e3 Auto merge of #15621 - kpreid:import, r=Veykril
Give `unmerge_use` a label explaining what it will affect.

When I'm trying to clean up `use`s, I often feel uncertain about what exactly the effects of choosing an assist will be. This PR makes a small improvement to that by giving “Unmerge use” a label which names the root of the tree that it's going to move, when one exists.

There is no test because I didn't see, among the test helpers, a way to assert on the assist label (as opposed to filtering on it). However, I did test the change manually.

I looked into making a similar change to “Merge imports”, but that is considerably trickier.
2023-09-20 14:38:08 +00:00
shogo-nakano-desu
dd843060f9 refactor: remove boxing 2023-09-20 23:02:52 +09:00
bors
4778255b3d Auto merge of #15637 - Wilfred:update_chalk, r=lnicola
Update chalk version

This only pulls in one commit in Chalk, which is an improvement to inference for rust-analyzer: https://github.com/rust-lang/chalk/pull/800
2023-09-20 04:58:09 +00:00
Wilfred Hughes
3a63255d2a Update chalk version 2023-09-19 16:56:59 -07:00
bors
0427a239eb Auto merge of #15635 - SomeoneToIgnore:fix-vscode-edits, r=Veykril
Do not resolve inlayHint.textEdit for VSCode client

Closes https://github.com/rust-lang/rust-analyzer/issues/15604

VSCode behaves strangely, allowing to navigate into label location, but not allowing to apply hint's text edit, after hint is resolved. See https://github.com/microsoft/vscode/issues/193124 for details.

For now, stub hint resolution for VSCode specifically.
2023-09-19 20:36:09 +00:00
Kirill Bulatov
f9fac02c57 Use proper editor name 2023-09-19 23:34:43 +03:00
Kirill Bulatov
184119258e Do not resolve inlayHint.textEdit for VSCode client
VSCode behaves strangely, allowing to navigate into label location, but
not allowing to apply hint's text edit, after hint is resolved.
See https://github.com/microsoft/vscode/issues/193124 for details.

For now, stub hint resolution for VSCode specifically.
2023-09-19 21:40:22 +03:00
bors
22b18b9f77 Auto merge of #15616 - HKalbasi:rustc-deps, r=HKalbasi
Switch to in-tree rustc dependencies with a cfg flag

We can use this flag to detect and prevent breakages in rustc CI. (see #14846 and #15569)

~The `IN_RUSTC_REPOSITORY` is just a placeholder. Is there any existing cfg flag that rustc CI sets?~
2023-09-19 17:41:12 +00:00
bors
cdaadb6138 Auto merge of #15632 - emilio:scip-build-rs, r=lnicola
scip: Use load_workspace_at.

This honors the build script config, and is also simpler.
2023-09-19 11:54:17 +00:00
Emilio Cobos Álvarez
c372431123
scip: Use load_workspace_at.
This honors the build script config, and is also simpler.
2023-09-19 13:48:05 +02:00
bors
258b15c506 Auto merge of #15628 - lnicola:sync-from-rust, r=lnicola
minor: Sync from downstream
2023-09-18 09:05:50 +00:00
Laurențiu Nicola
d39b45a58d Merge branch 'master' into sync-from-rust 2023-09-18 12:04:59 +03:00
bors
05666441ba Auto merge of #15625 - jDomantas:domantas/fix-15623, r=HKalbasi
fix: Don't skip closure captures after let-else

As I understand that `return` was left there by accident. It caused capture analysis to skip the rest of the block after a let-else, and then missed captures caused incorrect results in borrowck, closure hints, layout calculation, etc.

Fixes #15623

I didn't understand why I using the example from #15623 as-is doesn't work - I don't get the warnings unless I remove the `call_me()` call, even on the same commit as my own RA version which does show those warnings.
2023-09-17 17:53:15 +00:00
jDomantas
a961068504 add layout test 2023-09-17 17:00:57 +03:00
jDomantas
b3aba94cbd use code from bug report for regression test 2023-09-17 16:52:32 +03:00
jDomantas
a0c31b73d8 don't skip the rest of the block after let-else 2023-09-17 12:46:41 +03:00
jDomantas
a77789e7aa regression test 2023-09-17 11:54:42 +03:00
Kevin Reid
cac796acb3 Give unmerge_use a label explaining what it will affect. 2023-09-16 13:29:03 -07:00
Peter Jaszkowiak
24b6922957 triagebot exclude_labels -> exclude_titles 2023-09-16 10:58:53 -06:00
bors
9d0ccf01a1 Auto merge of #15597 - rmehri01:fix_promote_local_field_shorthand, r=HKalbasi
Field shorthand overwritten in promote local to const assist

Currently, running `promote_local_to_const` on the following:

```rust
struct Foo {
    bar: usize,
}

fn main() {
    let $0bar = 0;
    let foo = Foo { bar };
}
```

Results in:

```rust
struct Foo {
    bar: usize,
}

fn main() {
    const BAR: usize = 0;
    let foo = Foo { BAR };
}
```

But instead should be something like:

```rust
struct Foo {
    bar: usize,
}

fn main() {
    const BAR: usize = 0;
    let foo = Foo { bar: BAR };
}
```
2023-09-16 16:48:21 +00:00
hkalbasi
f4704bc8ae Switch to in-tree rustc dependencies with a cfg flag 2023-09-15 18:10:11 +03:30
shogo-nakano-desu
96c333262a refactor: fix clippy lint 2023-09-15 16:47:39 +09:00
shogo-nakano-desu
0bb2298ac6 refactor: remove TODO with no explanation 2023-09-15 16:43:31 +09:00
shogo-nakano-desu
ebbbaaa90f refactor: fix clippy lints 2023-09-15 16:43:21 +09:00
bors
12e28c3575 Auto merge of #15611 - Veykril:stability-import, r=Veykril
Prefer stable paths over unstable ones in import path calculation

Fixes https://github.com/rust-lang/rust-analyzer/issues/15610
2023-09-14 09:11:12 +00:00
Lukas Wirth
e63e323823 Prefer stable paths over unstable ones in import path calculation 2023-09-14 11:03:41 +02:00
bors
47c51b70dd Auto merge of #15609 - WaffleLapkin:undup_sema, r=Veykril
Remove most of the duplication from `Semantics{,Impl}` via deref

See https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Semantics.20vs.20SemanticsImpl/near/390795952
2023-09-14 06:23:54 +00:00
Maybe Waffle
a219dbda2b Remove most of the duplication from Semantics{,Impl} via deref 2023-09-13 22:02:28 +00:00
bors
089ae47ebe Auto merge of #15606 - Veykril:annotation-above-item-fi, r=Veykril
fix: Fix lens location "above_whole_item" breaking lenses

Fixes https://github.com/rust-lang/rust-analyzer/issues/15602
2023-09-13 20:02:06 +00:00
Lukas Wirth
712e67cf11 fix: Fix lens location "above_whole_item" breaking lenses 2023-09-13 22:01:04 +02:00
bors
15e1356149 Auto merge of #15601 - Veykril:diag-derive, r=Veykril
fix: Temporarily skip decl check in derive expansions

"Fixes https://github.com/rust-lang/rust-analyzer/issues/15344"
2023-09-12 21:11:28 +00:00
Lukas Wirth
affe5a7315 fix: Temporarily skip decl check in derive expansions 2023-09-12 23:10:03 +02:00
Ryan Mehri
cd0a89ac4f fix: field shorthand overwritten in promote local to const assist 2023-09-11 10:59:23 -07:00
dfireBird
df1239bf92
add tests for insert use with renamed imports
Tested for two cases:
1. Simple Use
2. Complex Use
2023-09-11 17:43:53 +05:30
dfireBird
d79486529e
remove as _ on auto importing on trait that is aliased with _ 2023-09-11 17:43:53 +05:30
Ali Bektas
145a101fe8 Deunwrap add_missing_match_arms 2023-09-11 14:09:19 +02:00
Ali Bektas
893e19137e Make assist lazy again 2023-09-11 13:33:26 +02:00
Ali Bektas
0863024b1a Make assist lazy again 2023-09-11 13:31:42 +02:00
bors
cc6c8209cb Auto merge of #15431 - alibektas:deunwrap/extract_function, r=Veykril
minor : Deunwrap extract_function

#15398 subtask 5.
2023-09-11 08:37:57 +00:00
bors
0e251ff768 Auto merge of #15232 - alibektas:14850, r=Veykril
ide : Disallow renaming of non-local items

fixes #14850 . This makes me wonder , why stop at structs and not do the same for other ADTs? Would be happy to add them too if nothing speaks against it.
2023-09-11 08:21:51 +00:00
Ryan Mehri
25b1b3e753 feat: add support for other ADT types and destructuring patterns 2023-09-10 22:21:12 -07:00
Ali Bektas
0118741632 v4 2023-09-10 23:25:36 +02:00
Ali Bektas
a0c8bee35e Add more comments as requested 2023-09-10 23:19:58 +02:00