Commit Graph

26135 Commits

Author SHA1 Message Date
vsrs
6b559c4a9a Better trait implementation support 2023-08-29 22:56:31 +07:00
Kirill Bulatov
62d189702c Only send inlay hint refresh requests on initial load
Editor itself is able to invalidate hints after edits, and /refresh was
sent after editor reports changes to the language server.
This forces the editor to either query & invalidate the hints twice
after every edit, or wait for /refresh to come before querying the
hints.

Both options are rather useless, so instead, send a request on server
startup only: client editors do not know when the server actually starts
up, this will help to query the initial hints after editor was open and
the server was still starting up.
2023-08-29 13:04:04 +03:00
bors
b06503b6ec Auto merge of #15465 - Wilfred:command_handle_fixes, r=Veykril
Fix cargo handle logging in flycheck

This PR has two commits, so it's probably easier to review them separately:

(1) Rename `CargoHandle` to `CommandHandle`, as the command may not be a cargo command.

(2) Logging should format the current command, rather than calling `check_command()` again. This ensures that any later configuration changes don't cause us to log incorrect information.
2023-08-29 07:16:20 +00:00
vsrs
6b20c1b091 Apply suggestions. 2023-08-29 13:39:56 +07:00
bors
62268e474e Auto merge of #15527 - HKalbasi:diagnostics-allow, r=HKalbasi
Respect `#[allow(unused_braces)]`

fix #15526
2023-08-28 18:54:08 +00:00
hkalbasi
514fefab9c Respect #[allow(unused_braces)] 2023-08-28 22:22:28 +03:30
vsrs
19e99941b6 Add cov_mark tests 2023-08-28 16:41:08 +07:00
vsrs
e457759cbb Add bind_unused_param assistant. 2023-08-28 15:23:20 +07:00
bors
144526c908 Auto merge of #15523 - lnicola:bootstrap, r=lnicola
internal: Fix release workflow
2023-08-28 07:24:24 +00:00
Laurențiu Nicola
a6f53567b0 Fix release workflow 2023-08-28 10:23:24 +03:00
Laurențiu Nicola
a0d27610ac Use env node to set RUSTC_BOOTSTRAP 2023-08-28 10:22:33 +03:00
bors
029baaad22 Auto merge of #15517 - xffxff:label_in_condition, r=lnicola
fix: diagnostics for 'while let' loop with label in condition

fix #15516
2023-08-26 17:02:57 +00:00
xffxff
204bc2cb60 fix: diagnostics for 'while let' loop with label in condition 2023-08-26 10:41:19 +08:00
bors
0a0bb777b1 Auto merge of #15512 - HKalbasi:mir, r=HKalbasi
Update offset intrinsic to match 1.72

fix #15498
2023-08-25 18:56:29 +00:00
hkalbasi
fa76f60cc1 Run cargo fmt on 1.72 2023-08-25 22:24:41 +03:30
hkalbasi
3864b43d28 Update offset intrinsic to match 1.72 2023-08-25 22:24:40 +03:30
Laurențiu Nicola
4e034d78de Set RUSTC_BOOTSTRAP=1 when running analysis-stats on libstd 2023-08-25 18:03:55 +03:00
bors
f5b7c60ff7 Auto merge of #15385 - inferiorhumanorgans:explicit-cross-target, r=Veykril
proc-macro-test: Pass target to cargo invocation

When cross compiling macos → dragonfly the dist build fails in the proc-maro-test-impl crate with the following error:

`ld: unknown option: -z\nclang: error: linker command failed with exit code 1 (use -v to see invocation)`

This appears to be a wart stemming from using an Apple host for cross compiling.  Passing the target along to cargo allows it to pick up a linker that it understands and DTRT.
2023-08-23 07:29:30 +00:00
bors
8b8c7d7ffd Auto merge of #15504 - lnicola:sync-from-rust, r=lnicola
minor: Sync from downstream
2023-08-23 07:07:37 +00:00
Laurențiu Nicola
a4b25034d6 Merge branch 'master' into sync-from-rust 2023-08-23 10:06:55 +03:00
bors
6444211205 Auto merge of #15503 - Wilfred:scip_version, r=Veykril
SCIP: Report the correct version of rust-analyzer in the metadata

Previously this was hard coded to "0.1". The SCIP protocol allows this to be an arbitrary string:

```
message ToolInfo {
  // Name of the indexer that produced this index.
  string name = 1;
  // Version of the indexer that produced this index.
  string version = 2;
  // Command-line arguments that were used to invoke this indexer.
  repeated string arguments = 3;
}
```

so use the same string reported by `rust-analyzer --version`.
2023-08-23 05:31:09 +00:00
Wilfred Hughes
bc42b9911d SCIP: Report the correct version of rust-analyzer in the metadata
Previously this was hard coded to "0.1". The SCIP protocol allows this
to be an arbitrary string:

```
message ToolInfo {
  // Name of the indexer that produced this index.
  string name = 1;
  // Version of the indexer that produced this index.
  string version = 2;
  // Command-line arguments that were used to invoke this indexer.
  repeated string arguments = 3;
}
```

so use the same string reported by `rust-analyzer --version`.
2023-08-22 18:51:39 -07:00
Michael Goulet
ce0eeee400 Rollup merge of #115011 - compiler-errors:warn-on-elided-assoc-ct-lt, r=cjgillot
Warn on elided lifetimes in associated constants (`ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT`)

Elided lifetimes in associated constants (in impls) erroneously resolve to fresh lifetime parameters on the impl since #97313. This is not correct behavior (see #38831).

I originally opened #114716 to fix this, but given the time that has passed, the crater results seem pretty bad: https://github.com/rust-lang/rust/pull/114716#issuecomment-1682091952

This PR alternatively implements a lint against this behavior, and I'm hoping to bump this to deny in a few versions.
2023-08-22 09:00:49 -07:00
bors
9e3bf69ad3 Auto merge of #15499 - matklad:up-lsp-server, r=lnicola
internal: up lsp-server
2023-08-22 10:51:31 +00:00
Alex Kladov
43e868807e internal: up lsp-server 2023-08-22 11:42:53 +01:00
bors
9b82437de1 Auto merge of #15495 - matklad:matklad/unpin, r=lnicola
internal: unpin serde

Serde no longer uses blobs as of

https://github.com/serde-rs/serde/pull/2590

As such, there's no longer need for us to pin it.

Note that this doesn't upgrade serde version we use: I am fairly confident that the blobs are already there are fine, and now I am fairly confident that all future versions of serde will be fine as well.
2023-08-22 10:20:31 +00:00
bors
7f659a3b2f Auto merge of #15494 - lnicola:sync-from-rust, r=lnicola
minor: Sync from downstream
2023-08-22 07:58:11 +00:00
Laurențiu Nicola
b4576b52b7 Run analysis-stats on stable 2023-08-22 09:26:04 +03:00
Michael Goulet
7012fff9ab Fix elided lifetimes in rust-lang/rust 2023-08-21 23:53:09 +00:00
Laurențiu Nicola
6caf79c36e Allow internal_features in test 2023-08-21 22:15:56 +03:00
Alex Kladov
343ee8bacf internal: unpin serde
Sered no longer uses blobs as of

https://github.com/serde-rs/serde/pull/2590

As such, there's no longer need for us to pin it.

Note that this doesn't upgrade serde version we use: I am fairly
confident that the blobs are already there are fine, and now I am fairly
confident that all future versions of serde will be fine as well.
2023-08-21 14:29:18 +01:00
Laurențiu Nicola
a4cf40537a Merge branch 'master' into sync-from-rust 2023-08-21 16:16:04 +03:00
Laurențiu Nicola
30d8aa1bec Merge commit '9b3d03408c66749d56466bb09baf2a7177deb6ce' into sync-from-ra 2023-08-21 12:44:09 +03:00
bors
9b3d03408c Auto merge of #15490 - RalfJung:check-invocation-help, r=Veykril
fix help text for rust-analyzer.check.invocation{Strategy,Location}

I highly doubt that `check.invocationLocation` only has an effect if `cargo.buildScripts.overrideCommand` is set -- looks like a copy-paste mistake from `buildScripts.invocationLocation` to me.
2023-08-21 08:06:50 +00:00
Ralf Jung
887cc48ba8 fix help text for rust-analyzer.check.invocation{Strategy,Location} 2023-08-21 09:54:24 +02:00
bors
a3892f0ed9 Auto merge of #15374 - jmintb:extern_crate, r=Veykril
feat: Implement extern crate completion

Hi, this is a draft PR for #13002.

I have basic completion working as well as a filter for existing extern crate imports in the same file. This is based on the tests, I have not actually tried this in an editor. Before going further I think this is a good point to stop and get feedback on the
structure and approach I have taken so far. Let me know what you think :)

I will make sure to add more tests, rebase commits and align with the code style guidelines before submitting a final version.

A few specific questions :
1. Is there a better way to check for matching suggestions? right now I just test if an extern crate name starts with the current
user input.
2. Am I creating the `CompletionItem` correctly? I noticed that `use_.rs` invokes a builder where as I do not.
3. When checking for existing extern crate imports the current implementation only looks at the current source file, is that sufficient?
2023-08-21 07:38:29 +00:00
Jessie Chatham Spencer
37e0e8af10 Implement extern crate completion 2023-08-20 16:36:59 +00:00
Ralf Jung
883f16d805 fix RA build 2023-08-20 18:31:22 +02:00
Ralf Jung
59f9c95ec0 give some unwind-related terminators a more clear name 2023-08-20 15:52:38 +02:00
bors
83b3ba1b81 Auto merge of #15483 - matklad:up-me-baby-one-more-time, r=Veykril
internal: post-bump lsp-server version
2023-08-19 14:54:31 +00:00
Alex Kladov
1cebc0ca13 internal: post-bump lsp-server version 2023-08-19 15:28:32 +01:00
bors
904b326c11 Auto merge of #15482 - matklad:🪄deblobify, r=Veykril
fix: avoid problematic serde release

serde 1.0.172 and up rely on opaque non-reproducible binary blobs to function, explicitly not providing a library-level opt-out.

This is problematic for two reasons:

- directly, unauditable binary blobs are a security issue.
- indirectly, it becomes much harder to predict future behaviors of the crate.

As such, I am willing to go on a limb here and forbid building rust-analyzer with those versions of serde. Normally, my philosophy is to defer the choice to the end user, but it's also a design constraint of rust-analyzer that we don't run random binaries downloaded from the internet without explicit user's concent.

Concretely, this upper-bounds serde for both rust-analyzer workspace, as well as the lsp-server lib.

See https://github.com/serde-rs/serde/issues/2538 for wider context.
2023-08-19 13:35:02 +00:00
Alex Kladov
6c46b98a95 fix: avoid problematic serde release
serde 1.0.172 and up rely on opaque non-reproducible binary blobs to
function, explicitly not providing a library-level opt-out.

This is problematic for two reasons:

- directly, unauditable binary blobs are a security issue.
- indirectly, it becomes much harder to predict future behaviors of the
  crate.

As such, I am willing to go on a limb here and forbid building
rust-analyzer with those versions of serde. Normally, my philosophy is
to defer the choice to the end user, but it's also a design constraint
of rust-analyzer that we don't run random binaries downloaded from the
internet without explicit user's concent.

Concretely, this upper-bounds serde for both rust-analyzer workspace, as
well as the lsp-server lib.

See https://github.com/serde-rs/serde/issues/2538 for wider context.
2023-08-19 14:14:23 +01:00
bors
721e0e3512 Auto merge of #15480 - matklad:lsp-server-up, r=Veykril
upgrade lsp server
2023-08-19 12:41:38 +00:00
Alex Kladov
dadbfe7f4b upgrade lsp server 2023-08-19 13:36:07 +01:00
bors
c0f6ece3c4 Auto merge of #15434 - alibektas:deunwrap/generate_derive, r=lnicola
minor : Deunwrap generate_derive

#15398 subtask 1. Since the editing closure has arms, I did something *experimental* ( in this case just a clever term for bad code ) to bypass creating an `Option` but I am ready to change this.
2023-08-18 16:16:27 +00:00
bors
d895e9effa Auto merge of #15477 - Veykril:import-alias-symbols, r=Veykril
feat: Record import aliases in symbol index

Fixes https://github.com/rust-lang/rust-analyzer/issues/7938
2023-08-18 09:47:39 +00:00
Lukas Wirth
eb6244c5f9 Record import aliases in symbol index 2023-08-18 11:46:35 +02:00
bors
44cf1745a8 Auto merge of #15473 - Veykril:doc-hidden-imports, r=Veykril
fix: Fix auto-import (and completions) importing `#[doc(hidden)]` items

Fixes https://github.com/rust-lang/rust-analyzer/issues/9197 and https://github.com/rust-lang/rust-analyzer/issues/9911

Turns out while https://github.com/rust-lang/rust-analyzer/pull/15472 didn't give access to the import stuff to the IDE layer, these can be fixed already since they use the import map which works in the hir-def crate 🎉
2023-08-17 10:49:42 +00:00
Lukas Wirth
637f496a81 fix: Fix auto-import (and completions) importing #[doc(hidden)] items 2023-08-17 12:30:19 +02:00