Commit graph

26071 commits

Author SHA1 Message Date
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
bors
49716e681a Auto merge of #15472 - Veykril:import-ide-support, r=Veykril
internal: Record import origins in ItemScope and PerNS

This records the import items definitions come from in the module scope (as well as what an import resolves to in an ItemScope). It does ignore glob imports as thats a lot more work for little to no gain, glob imports act as if the importing items are "inlined" into the scope which suffices for almost all use cases I believe (to my knowledge, attributes on them have little effect).

There is still a lot of work needed to make this available to the IDE layer, but this lays out the ground work for havin IDE layer support.

cc https://github.com/rust-lang/rust-analyzer/issues/14079
2023-08-17 09:56:42 +00:00
Lukas Wirth
a17d73ad36 Thread imports through the resolver 2023-08-17 10:52:13 +02:00
Lukas Wirth
c4e9b5ac64 Add import info to item scope dumps 2023-08-17 09:33:15 +02:00
Lukas Wirth
af8048266c Prepare ItemScope for IDE import resolution 2023-08-16 11:33:42 +02:00
bors
e69b96bd40 Auto merge of #15466 - Veykril:prep-inline-fmt-args, r=Veykril
internal: Add offset param to token descending API

The offset is unused for now as we can't map by spans yet but it will be required for https://github.com/rust-lang/rust-analyzer/issues/11260 to work once the token map has been changed to record spans
2023-08-16 08:09:02 +00:00
Lukas Wirth
53b292478d internal: Add offset param to token descending API 2023-08-16 10:07:18 +02:00
Wilfred Hughes
e2866404ef Format the existing command in logging 2023-08-15 16:07:06 -07:00
Wilfred Hughes
14078ed303 Rename CargoHandle to CommandHandle
This handle wraps an arbitrary command, which might be a rustc command
rather than cargo.
2023-08-15 16:06:25 -07:00
Ali Bektas
2a78173ff8 v2 2023-08-16 00:22:08 +02:00
bors
b14770934a Auto merge of #15463 - ponyii:fix/start-hovering-default-values-of-generic-const, r=HKalbasi
fix: start hovering default values of generic constants

It's just a kind of a postscriptum for [my last PR](https://github.com/rust-lang/rust-analyzer/pull/15179) adding default values of const generics to `hir::ConstParamData`. Here I patch other pieces of code which used to ignore const default values and which I managed to find (you're welcome to show me more)
2023-08-15 20:34:48 +00:00
ponyii
fec5ff9890 start hovering default values of generic constants 2023-08-15 20:26:42 +04:00
bors
54c4125086 Auto merge of #15461 - lnicola:analysis-stats-memory, r=Veykril
internal: Always collect memory usage info in analysis-stats
2023-08-15 16:20:24 +00:00