bors [Sat, 22 Oct 2022 15:49:00 +0000 (15:49 +0000)]
Auto merge of #13463 - lowr:fix/builtin-derive-with-const-generics, r=Veykril
Support const generics for builtin derive macro
Fixes #13121
We have been treating every generic parameter as type parameter during builtin derive macro expansion. This patch adds support for const generics in such expansions.
bors [Thu, 20 Oct 2022 12:07:28 +0000 (12:07 +0000)]
Auto merge of #13365 - feniljain:master, r=Veykril
feat: add multiple getters mode in `generate_getter`
This commit adds two modes to generate_getter action.
First, the plain old working on single fields.
Second, working on a selected range of fields.
Should partially solve #13246
If this gets approved will create a separate PR for setters version of the same
### Points to help in review:
- `generate_getter_from_record_info` contains code which is mostly taken from assist before refactor
- Same goes for `parse_record_fields`
- There are changes in other assists, as one of the methods in utils named `find_struct_impl` is changed, before it used to accept a single `fn_name`, now it takes a list of function names to check against. All old impls are updated to create a small list to pass their single element.
### Assumptions:
- If any of the fields have an implementation, the action will quit.
This allows to change how we run build scripts (and `checkOnSave`), exposing two configs:
- `once`: run the specified command once in the project root (the working dir of the server)
- `per_workspace`: run the specified command per workspace in the corresponding workspace
This also applies to `checkOnSave` likewise, though `once_in_root` is useless there currently, due to https://github.com/rust-lang/cargo/issues/11007
bors [Tue, 18 Oct 2022 12:19:58 +0000 (12:19 +0000)]
Auto merge of #13433 - rust-lang:revert-13354-try-stuff, r=Veykril
Revert "feat: Diagnose some incorrect usages of the question mark operator"
Reverts rust-lang/rust-analyzer#13354
It seems like we are getting stuck with inference variables here, not just placeholders and errors so there is probably more wrong here that I don't understand. Reverting seems like the best solution right now as I don't have the time to look into this this week.
bors [Mon, 17 Oct 2022 16:21:32 +0000 (16:21 +0000)]
Auto merge of #13428 - Veykril:fmt-stuck, r=Veykril
fix: Fix formatting requests hanging when r-a is still starting
The reason for that was that we were calculating the crate defmaps of the file we are saving by accident causing us to get stuck waiting on their expensive computation, while we only need the relevant crate id.
Lukas Wirth [Mon, 17 Oct 2022 15:53:50 +0000 (17:53 +0200)]
fix: Fix formatting requests hanging when r-a is still starting
The reason for that was that we were calculating the crate defmaps
of the file we are saving by accident causing us to get stuck waiting
on their expensive computation, while we only need the relevant crate
id.
bors [Mon, 17 Oct 2022 14:41:57 +0000 (14:41 +0000)]
Auto merge of #13427 - Veykril:cancel-check, r=Veykril
feat: Make flycheck workdone progress reports cancellable
In clients that support this (like VSCode), the clients will now render a cancel button on the notification message which can be clicked to cancel the flycheck instead.
bors [Mon, 17 Oct 2022 14:12:01 +0000 (14:12 +0000)]
Auto merge of #13426 - Veykril:client-refactor, r=Veykril
Refactor language client handling
Follow up to https://github.com/rust-lang/rust-analyzer/pull/12847 (turns out they fixed parts of the problem)
The PR will attempt to allow us to dispose more resources at will, so that we can implement restarts for the server properly instead of restating the entire extension as well as allowing us to implement a stop command.
bors [Sun, 16 Oct 2022 10:57:23 +0000 (10:57 +0000)]
Auto merge of #13408 - lowr:patch/bump-chalk-0.86, r=Veykril
Bump chalk
There's a bug in current chalk that prevents us from properly supporting GATs, which is supposed to be fixed in v0.86. Note the following:
- v0.86 is only going to be released next Sunday so I'll keep this PR as draft until then.
- This doesn't compile without https://github.com/rust-lang/chalk/pull/779, which I hope will be included in v0.86. I confirmed this compiles with it locally.
Two breaking changes from v0.84:
- `TypeFolder` has been split into `TypeFolder` and `FallibleTypeFolder` (https://github.com/rust-lang/chalk/pull/772)
- `ProjectionTy::self_type_parameter()` has been removed (https://github.com/rust-lang/chalk/pull/778)
Ryo Yoshida [Thu, 13 Oct 2022 15:39:14 +0000 (00:39 +0900)]
Bump chalk to 0.86
Two breaking changes:
- `TypeFolder` has been split into `TypeFolder` and `FallibleTypeFolder`
- `ProjectionTy::self_type_parameter()` has been removed
bors [Fri, 14 Oct 2022 07:32:44 +0000 (07:32 +0000)]
Auto merge of #13413 - rust-lang:revert-13367-fix-problem-matchers, r=jonas-schievink
Revert "fix: in VSCode, correctly resolve relative paths to errors"
Reverts rust-lang/rust-analyzer#13367
I didn't manage to figure out what exactly is the issue, so reverting this to fix https://github.com/rust-lang/rust-analyzer/issues/13404 before monday.
bors [Tue, 11 Oct 2022 18:45:31 +0000 (18:45 +0000)]
Auto merge of #13358 - btwotwo:feature/env-vars-autocompletion, r=Veykril
feat: Autocomplete Cargo-defined env vars in `env!` and `option_env!` (#12448)
Closes #12448
Important to know:
- Variables are taken from https://doc.rust-lang.org/cargo/reference/environment-variables.html and hardcoded as a const array.
- For the sake of simplicity I didn't include the autocompletion of `CARGO_BIN_EXE_<name>` and `OUT_DIR` since it would require information about build.rs and binary name. If somebody knows an easy way of obtaining them I can add those vars as well :)
bors [Tue, 11 Oct 2022 11:44:32 +0000 (11:44 +0000)]
Auto merge of #13382 - lowr:fix/reorder-dyn-bounds-on-render, r=lowr
fix: reorder dyn bounds on render
Fixes #13368
#13192 changed the order of dyn bounds, violating the [contract](https://github.com/rust-lang/rust-analyzer/blob/3a69435af7a1e6273744085cb251adb2b9c30a03/crates/hir-ty/src/display.rs#L896-L901) with `write_bounds_like_dyn_trait()` on render. The projection bounds are expected to come right after the trait bound they are accompanied with.
Although the reordering procedure can be made a bit more efficient, I opted for relying only on the [invariants](https://github.com/rust-lang/rust-analyzer/blob/3a69435af7a1e6273744085cb251adb2b9c30a03/crates/hir-ty/src/lower.rs#L995-L998) currently documented in `lower_dyn_trait()`. It's not the hottest path and dyn bounds tend to be short so I believe it shouldn't hurt performance noticeably.