Commit Graph

26021 Commits

Author SHA1 Message Date
hkalbasi
a481e004b0 Lower const params with a bad id 2023-06-11 00:39:28 +03:30
bors
68bdf609f3 Auto merge of #14974 - max-heller:issue-14958, r=lowr
Properly format documentation for `SignatureHelpRequest`s

Properly formats function documentation instead of returning it raw when responding to `SignatureHelpRequest`s.

I added a test in `crates/rust-analyzer/tests/slow-tests/main.rs` -- not sure if this is the best location given the relevant code is in `crates/rust-analyzer` or if it's possible to test in a less heavyweight manner.

Closes #14958
2023-06-10 14:15:37 +00:00
max-heller
78fab7d5d5 format documentation for SignatureHelpRequests 2023-06-10 09:54:34 -04:00
bors
95228d23bb Auto merge of #14875 - ponyii:fix/implement-missing-members-do-not-transform-lifetimes, r=Veykril
fix: implemeted lifetime transformation fot assits

A part of https://github.com/rust-lang/rust-analyzer/issues/13363
I expect to implement transformation of const params in a separate PR

Other assists and a completion affected:
- `generate_function` currently just ignores lifetimes and, consequently, is not affected
- `inline_call` and `replace_derive_with...` don't seem to need lifetime transformation
- `trait_impl` (a completion) is fixed and tested
2023-06-10 13:22:50 +00:00
bors
cee7a72d81 Auto merge of #14827 - davidlattimore:autopublish-offset, r=Veykril
autopublish: Offset version number

The workflow is currently failing because it's trying to publish 0.0.16, while the last version published was 0.0.149.
2023-06-10 11:33:06 +00:00
bors
489eeab978 Auto merge of #14960 - jneem:group-delim-span, r=Veykril
Add span to group.

This appears to fix #14959, but I've never contributed to rust-analyzer before and there were some things that confused me:

- I had to add the `fn byte_range` method to get it to build. This was added to rust in [April](https://github.com/rust-lang/rust/pull/109002), so I don't understand why it wasn't needed until now
- When testing, I ran into the fact that rust recently updated its `METADATA_VERSION`, so I had to test this with nightly-2023-05-20. But then I noticed that rust has its own copy of `rust-analyzer`, and the metadata version bump has already been [handled there](60e95e76d0). So I guess I don't really understand the relationship between the code there and the code here.
2023-06-10 11:15:16 +00:00
bors
49b4f15973 Auto merge of #15022 - HKalbasi:nightly-mir-eval-panic, r=HKalbasi
Fix panic in displaying unsized structs
2023-06-10 08:06:56 +00:00
hkalbasi
1dd76e8a9d Fix panic in displaying unsized structs 2023-06-10 11:32:37 +03:30
bors
5f8a6f67b9 Auto merge of #15020 - Veykril:perf2, r=Veykril
Count query entries in memory usage command
2023-06-09 23:50:34 +00:00
Lukas Wirth
ccce893577 Count query entries in memory usage command 2023-06-10 01:49:32 +02:00
Lukas Wirth
b6fb35f20c Shrink hir_expand::attr::AttrInput by boxing a variant 2023-06-10 01:21:52 +02:00
bors
993299ee3f Auto merge of #15019 - HKalbasi:nightly-mir-eval-panic, r=HKalbasi
Fix panic in displaying const trait objects

I hope this fixes the panic on recent nightly stdlib, but I didn't test it locally.
2023-06-09 22:43:58 +00:00
hkalbasi
6fbf6ef514 Fix panic in displaying const trait objects 2023-06-10 02:10:52 +03:30
bors
60d952e902 Auto merge of #14979 - DropDemBits:structure-snippets-migrate-1, r=Veykril
internal: Migrate some assists to use the structured snippet API

Migrates the following assists:

- `add_missing_impl_members`
- `extract_type_alias`

As an additional requirement, these assists are also migrated to use the mutable AST API, since otherwise there would be overlapping `Indel` spans
2023-06-09 19:26:01 +00:00
bors
425619dd28 Auto merge of #15014 - Wilfred:document_sysroot, r=Veykril
Document the sysroot field in JsonProject

rust-analyzer supports both `sysroot` and `sysroot_src` in `rust-project.json`. Document `sysroot` and show example values for both fields.
2023-06-09 18:37:25 +00:00
bors
2796851961 Auto merge of #14998 - Veykril:eager-mapping, r=Veykril
internal: Lazy eager macros

This PR makes eager macros less eager. We now only eagerly expand the input of them, while the actual expansion of the macro itself now happens like other lazy macros.
This change allows unifying a lot of macro handling between the two now, most of the special casing now happens for `include!` specifically as it is a very unique macro (by having two inputs that come from differing files).
Fixes https://github.com/rust-lang/rust-analyzer/issues/14841
Fixes https://github.com/rust-lang/rust-analyzer/issues/14996
2023-06-09 11:15:12 +00:00
Lukas Wirth
a02b9b279e internal: Lazy eager macros 2023-06-09 13:02:13 +02:00
bors
9973b11218 Auto merge of #15012 - lowr:patch/generate-fn-async-ret-ty, r=HKalbasi
Infer return type for async function in `generate_function`

Part of #10122

In `generate_function` assist, when we infer the return type of async function we're generating, we should retrieve the type of parent await expression rather than the call expression itself.
2023-06-09 09:00:45 +00:00
Wilfred Hughes
5da14237eb Document the sysroot field in JsonProject
rust-analyzer supports both `sysroot` and `sysroot_src` in
`rust-project.json`. Document `sysroot` and show example values for
both fields.
2023-06-08 14:56:37 -07:00
bors
9c03aa1ac2 Auto merge of #14997 - lnicola:fix-warning, r=Veykril
internal: Fix dependency warning

Hope this doesn't break #14984 again.
2023-06-08 15:48:58 +00:00
Ryo Yoshida
32768fe310
Infer return type for async function in generate_function 2023-06-09 00:32:52 +09:00
bors
9157927772 Auto merge of #15006 - HKalbasi:format-panic, r=HKalbasi
Fix unwrap on None in expanding format args

fix #15002
2023-06-07 20:48:09 +00:00
hkalbasi
30e16e20d0 Fix unwrap on None in expanding format args 2023-06-08 00:17:22 +03:30
bors
dcab226210 Auto merge of #15005 - beyarkay:rebuild-to-rebuilt-typo, r=lnicola
Fix typo in reload.rs

Thanks for the amazing LSP! I found a small typo and fixed it.
2023-06-07 19:01:35 +00:00
beyarkay
dac660dc1d Fix typo in reload.rs 2023-06-07 20:57:27 +02:00
Joe Neeman
ad2a0d1093 Add configurable proc-macro-srv path for diagnostics 2023-06-07 08:48:19 -05:00
Joe Neeman
cdab3507eb Add span to group. 2023-06-07 08:48:19 -05:00
bors
085a3112ae Auto merge of #15000 - lowr:fix/builtin-derive-bound-for-assoc, r=HKalbasi
fix: only generate trait bound for associated types in field types

Given the following definitions:

```rust
trait Trait {
    type A;
    type B;
    type C;
}

#[derive(Clone)]
struct S<T: Trait>
where
    T::A: Send,
{
    qualified: <T as Trait>::B,
    shorthand: T::C,
}
```

we currently expand the derive macro to:

```rust
impl<T> Clone for S<T>
where
    T: Trait + Clone,
    T::A: Clone,
    T::B: Clone,
    T::C: Clone,
{ /* ... */ }
```

This does not match how rustc expands it. Specifically, `Clone` bounds for `T::A` and `T::B` should not be generated.

The criteria for associated types to get bound seem to be 1) the associated type appears as part of field types AND 2) it's written in the shorthand form. I have no idea why rustc doesn't consider qualified associated types (there's even a comment that suggests they should be considered; see rust-lang/rust#50730), but it's important to follow rustc.
2023-06-07 13:00:24 +00:00
Ryo Yoshida
4f0c6fac17
fix: only generate trait bound for associated types in field types 2023-06-07 20:52:49 +09:00
Laurențiu Nicola
08ef169435 Fix dependency warning 2023-06-07 12:34:38 +03:00
bors
1c25885bd2 Auto merge of #14995 - Veykril:proc-macro-slow-test, r=lnicola
fix: Fix proc-macro slow test
2023-06-07 05:04:33 +00:00
Lukas Wirth
a6bef7808f fix: Fix proc-macro slow test 2023-06-07 07:03:27 +02:00
bors
058e2d2bdd Auto merge of #14925 - viktorlott:inline-const-expr-as-static-str, r=HKalbasi
feat: inline const as literal

Assist: inline_const_as_literal

Evaluate and inline const variable as literal.

```rust
const STRING: &str = "Hello, World!";

fn something() -> &'static str {
    STR$0ING
}
```
->
```rust
const STRING: &str = "Hello, World!";

fn something() -> &'static str {
    "Hello, World!"
}
```
2023-06-06 21:30:30 +00:00
bors
f3145dc1f1 Auto merge of #14994 - Veykril:ci-fix, r=Veykril
fix: Fix ci never running on nightly when proc-macro things change

Was wondering why this wasn't running on the subtree sync ...
2023-06-06 21:03:56 +00:00
Lukas Wirth
ef09558575 fix: Fix ci never running on nightly when proc-macro things change 2023-06-06 23:02:58 +02:00
Viktor Lott
eef716d5f2 fix: use render_eval instead of inlined expr 2023-06-06 12:08:11 +02:00
Viktor Lott
2d4cb780b6 fix: Use render_eval for all builtins 2023-06-06 00:34:00 +02:00
Viktor Lott
8103a10a78 update assist to include more literals 2023-06-06 00:34:00 +02:00
Viktor Lott
094c1e7b86 feat: inline const expr as static str 2023-06-06 00:34:00 +02:00
bors
d42d55feaa Auto merge of #14988 - lnicola:sync-from-rust, r=lnicola
internal: Sync from rust
2023-06-05 16:55:06 +00:00
Laurențiu Nicola
338f969181 Merge remote-tracking branch 'upstream/master' into sync-from-rust 2023-06-05 19:54:30 +03:00
Laurențiu Nicola
bbd695589e Merge commit 'ed87e0a20a9d196a5ea659ea46ae9574be666d4f' into sync-from-ra 2023-06-05 15:10:05 +03:00
bors
ed87e0a20a Auto merge of #14984 - lnicola:rm-test-gate, r=Veykril
Bring back sysroot-abi feature

https://github.com/rust-lang/rust/pull/112305
2023-06-05 11:54:45 +00:00
Laurențiu Nicola
768a6c5931 Add back sysroot-abi feature gate to rust-analyzer 2023-06-05 14:43:31 +03:00
Laurențiu Nicola
c48062fe2a Merge commit 'aa9bc8612514d216f84eec218dfd19ab83f3598a' into sync-from-ra 2023-06-05 12:04:23 +03:00
bors
aa9bc86125 Auto merge of #14980 - lnicola:sync-from-rust, r=lnicola
Sync from downstream
2023-06-05 08:33:53 +00:00
Laurențiu Nicola
c3dbe7c717 Merge remote-tracking branch 'upstream/master' into sync-from-rust 2023-06-05 11:07:47 +03:00
bors
c6a3fe051a Auto merge of #14978 - HKalbasi:lifetime-display, r=HKalbasi
Emit `'_` for lifetime generics in `HirDisplay`

This makes the generated code not linted by `rust_2018_idioms` lint. But that is an allow by default lint, so should we do this? Maybe we should only do this for `DisplayTarget::SourceCode`?
2023-06-05 07:26:30 +00:00
hkalbasi
5531d46c95 Emit '_ for lifetime generics in HirDisplay 2023-06-05 10:55:47 +03:30
DropDemBits
dd5f05590e
Migrate extract_type_alias to mutable ast 2023-06-05 00:24:12 -04:00