Commit graph

27723 commits

Author SHA1 Message Date
roife
ce4ae41605 internal: simplify the process of inserting spaces after mut 2024-02-27 20:49:09 +08:00
bors
8929853df7 Auto merge of #16647 - Young-Flash:fix_replace_filter_map_next_with_find_map, r=Veykril
fix: replace_filter_map_next_with_find_map shouldn't work for dyn trait

close https://github.com/rust-lang/rust-analyzer/issues/16596
2024-02-26 11:31:44 +00:00
Young-Flash
7a58a23f16 internal: format code 2024-02-26 19:10:50 +08:00
Young-Flash
fd0cddf655 internal: move strip_references into dyn trait check 2024-02-26 18:57:46 +08:00
bors
e1983d2b90 Auto merge of #16669 - ShoyuVanilla:merge-borrow-kind-unique, r=Veykril
Merge `BorrowKind::Unique` into `BorrowKind::Mut`

Resolves #15170
2024-02-26 10:57:42 +00:00
bors
6903a5c7d6 Auto merge of #16665 - MabezDev:prio-rustup-when-searching, r=Veykril
Prioritise rustup sysroots over system ones

`get_path_for_executable` will now first check `$CARGO_HOME` before falling back to searching `$PATH`.

`rustup` is the recommended way to manage rust toolchains, therefore should be picked before the system toolchain.

Closes #16661
2024-02-26 10:45:11 +00:00
bors
4585b461e5 Auto merge of #16670 - rikhuijzer:rh/inlay-hints-nvim, r=Veykril
Document nvim 0.10 `inlay_hint`

It took me a few hours to figure out how to enable inlay type hints on Nvim 0.10 with `lspconfig`. `rustaceanvim` has already dropped support for them (https://github.com/mrcjkb/rustaceanvim/discussions/46#discussioncomment-7518669) and most other plugins, like `rust-tools`, are depreciated in favor of `rustaceanvim`.

This PR documents how to enable the inlay hints on Neovim 0.10 and later. I've tested this and changing the `on_attach` function is the only step that is required.
2024-02-26 10:32:30 +00:00
bors
309e087426 Auto merge of #16627 - Young-Flash:issue_template, r=Veykril
update bug report issue template
2024-02-26 10:18:15 +00:00
Rik Huijzer
4060377c07 Add note 2024-02-25 18:05:52 +01:00
Rik Huijzer
ea837d181e Document nvim 0.10 inlay_hint 2024-02-25 17:59:19 +01:00
Shoyu Vanilla
a336bdc142 Merge BorrowKind::Unique into BorrowKind::Mut 2024-02-26 01:57:03 +09:00
bors
5346002d07 Auto merge of #16668 - lnicola:sync-from-rust, r=lnicola
internal: sync from downstream
2024-02-25 16:29:22 +00:00
Laurențiu Nicola
fb31610ae8 Merge branch 'master' into sync-from-rust 2024-02-25 18:27:30 +02:00
Scott Mabin
9f1d4aa4b9 prioritise rustup sysroots over system ones
`get_path_for_executable` will now first check `$CARGO_HOME` before falling back to searching `$PATH`.

rustup is the recommended way to manage rust toolchains, therefore should be picked before the
system toolchain.
2024-02-24 21:19:10 +00:00
bors
4a8d0f7f56 Auto merge of #16654 - graemer957:feature/short_version_flag, r=lnicola
Add short flag -V for consistency with other rust tooling

Minor change to add the `-V` short flag to `rust-analyzer` to bring it in-line with other rust tooling such as:

> rustc -V
```bash
rustc 1.76.0 (07dca489a 2024-02-04)
```

> rustup -V
```bash
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.76.0 (07dca489a 2024-02-04)`
```

> cargo -V
```bash
cargo 1.76.0 (c84b36747 2024-01-18)
```
2024-02-24 09:51:32 +00:00
Graeme Read
30429f8ece
feat: Add short flag -V for consistency with other rust tooling 2024-02-24 06:45:00 +00:00
bors
03b3cb6be9 Auto merge of #16652 - davidbarsky:david/deadlock-fix-for-16643, r=Veykril
internal: fix deadlock introduced by #16643

This fixes a deadlock introduced by #16643 ([backtrace](https://gist.github.com/davidbarsky/00f17598f5496a9c41aff31fec1c42d6)). `maybe_changed_after` calls back into other queries, so the cloning here is unfortunately inevitable.

(Zulip conversation: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Fixing.20proc-macro.20dirtying.20with.20unindexed.20projects)
2024-02-23 20:39:13 +00:00
David Barsky
64779737db internal: fix deadlock introduced by #16643 2024-02-23 15:34:23 -05:00
bors
12144045fe Auto merge of #16650 - Veykril:metrics-rustc, r=Veykril
Fix: Fix metrics CI failing
2024-02-23 19:23:45 +00:00
Lukas Wirth
0c3a524acb Fix: Fix metrics CI failing 2024-02-23 20:22:01 +01:00
bors
838523dcc2 Auto merge of #16621 - txase:no-build-with-bootstrap, r=Veykril
fix: Recompiles due to RUSTC_BOOTSTRAP

Some packages (e.g. thiserror) force a recompile if the value of the `RUSTC_BOOTSTRAP` env var changes. RA sets the variable to 1 in order to enable rustc / cargo unstable options. This causes flapping recompiles when building outside of RA.

Fixes #15057
2024-02-23 18:46:33 +00:00
bors
c45b3550c3 Auto merge of #16649 - Veykril:metrics-rustc, r=Veykril
internal: Disable rustc test metrics

The CI job for them frequently gets stuck and I am unsure why
2024-02-23 18:33:46 +00:00
Lukas Wirth
d9a08624aa internal: Disable rustc test metrics 2024-02-23 19:31:53 +01:00
bors
84c5481349 Auto merge of #16648 - Veykril:metrics-rustc, r=Veykril
internal: Pin commit of rust-lang/rust for rustc-test metrics
2024-02-23 16:27:56 +00:00
Lukas Wirth
c6a6e63a45 internal: Pin commit of rust-lang/rust for rustc-test metrics 2024-02-23 17:24:29 +01:00
bors
cbc579e51f Auto merge of #16643 - Veykril:salsa-opt, r=Veykril
internal: Optimize salsa memory usage

Reduces memory on self by ~20mb for me, there is a few more mb to save here if we made LRU caching opt-in, as currently every entry in a memoized query will store an `AtomicUsize` for the LRU.
2024-02-23 15:18:58 +00:00
Lukas Wirth
cc4d0e1bd1 Optimize salsa some more 2024-02-23 16:17:39 +01:00
Young-Flash
b132190a9c make clippy happy 2024-02-23 21:18:24 +08:00
Young-Flash
0978d165f3 add test case 2024-02-23 21:05:55 +08:00
Young-Flash
4220f90edf fix: replace_filter_map_next_with_find_map shouldn't work for dyn trait 2024-02-23 21:05:55 +08:00
bors
deddea0d90 Auto merge of #16646 - cuishuang:master, r=lnicola
remove repetitive words
2024-02-23 12:54:06 +00:00
cui fliter
6dca7948f7 remove repetitive words
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-02-23 18:45:03 +08:00
bors
6648f19c56 Auto merge of #16645 - Veykril:deadlock, r=Veykril
fix: Fix deadlock in `recreate_crate_graph` <-> `file_line_index`

Fixes https://github.com/rust-lang/rust-analyzer/issues/16614
2024-02-23 09:13:31 +00:00
Lukas Wirth
9b7284dca7 fix: Fix deadlock in recreate_crate_graph <-> file_line_index 2024-02-23 10:10:48 +01:00
bors
1f54f714ca Auto merge of #16637 - Veykril:fix-proc-macro-srv-literals, r=Veykril
fix: Fix proc-macro server not accounting for string delimiters correctly

Fixes https://github.com/rust-lang/rust-analyzer/issues/16622

Note that this is a bug a in the proc-macro server, so this won't be fixed until the next subtree sync
2024-02-22 21:35:48 +00:00
Lukas Wirth
efa6948b57 Fix rust-analyzer not enabling rust-analyzer spans on the proc-macro server 2024-02-22 22:34:03 +01:00
Lukas Wirth
cdfb73ab9c fix: Fix proc-macro server not accounting for string delimiters correctly 2024-02-22 22:34:03 +01:00
Lukas Wirth
f89d17b426 Remove ops_salsa_runtime_mut, replace it with direct synthetic_write API 2024-02-22 10:42:30 +01:00
Young-Flash
689fa20554 add repository link entry 2024-02-21 20:08:02 +08:00
Young-Flash
f610e7c22a update bug report issue template 2024-02-21 18:07:11 +08:00
Chase Douglas
2826eb51aa Don't build dependencies when retrieving target data layout
`cargo rustc -- <args>` first builds dependencies then calls `rustc <args>` for the current package. Here, we don't want to build dependencies, we just want to call `rustc --print`. An unstable `cargo rustc` `--print` command bypasses building dependencies first. This speeds up execution of this code path and ensures RA doesn't recompile dependencies with the `RUSTC_BOOTSRAP=1` env var flag set.

Note that we must pass `-Z unstable-options` twice, first to enable the `cargo` unstable `--print` flag, then later to enable the unstable `rustc` `target-spec-json` print request.
2024-02-20 19:16:55 -08:00
Chase Douglas
344a79c17d Drop RUSTC_BOOTSTRAP env var when building build scripts
Some packages (e.g. thiserror) force a recompile if the value of the `RUSTC_BOOTSTRAP` env var changes. RA sets the variable to 1 in order to enable rustc / cargo unstable options it uses. This causes flapping recompiles when building outside of RA.

As of Cargo 1.75 the `--keep-going` flag is stable. This change uses the flag without `RUSTC_BOOTSTRAP` if the Cargo version is >= 1.75, and drops `--keep-going` otherwise. This fixes build script recompilation.
2024-02-20 16:42:20 -08:00
bors
543d7e98db Auto merge of #16618 - DropDemBits:structured-snippet-fix-escape-left-curly, r=Veykril
fix: Don't add `\` before `{`

Fixes #16607 for `{`. The `}` case is already fixed by #16475.

The [LSP snippet grammar](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#snippet_syntax) only specifies that `$`, `}`, and `\` can be escaped with backslashes, but not `{`.
2024-02-20 20:11:03 +00:00
DropDemBits
07421c13d4
fix: Don't add \ before {
The LSP snippet grammar only specifies that `$`, `}`, and `\` can be escaped with
backslashes, but not `{`.
2024-02-20 14:35:59 -05:00
bors
4760d856bc Auto merge of #16617 - Veykril:rustc-tests-timeout, r=Veykril
internal: Attempt to add a timeout to rustc-tests

Looks like some new test is stuck, this might help with figuring that out, though it unfortunately won't if its a chalk hang (which is the most likely)
2024-02-20 17:06:17 +00:00
Lukas Wirth
16b15a203e internal: Attempt to add a timeout to rustc-tests 2024-02-20 18:04:53 +01:00
bors
9f0495761a Auto merge of #16616 - Veykril:build-script-fix, r=Veykril
fix: server hanging up on build script task

This should fix https://github.com/rust-lang/rust-analyzer/issues/16614, can't say for certain since it might be not 100% reproducible... We really need to replace the current workspace fetching logic, it is completely unreadable and incredibly difficult to follow. I don't really understand how the server even got to hang here honestly (I would expect it to loop re-fetching build scripts, but not hang).
2024-02-20 14:58:03 +00:00
Lukas Wirth
9dee352da0 fix: server hanging up on build script task 2024-02-20 15:55:17 +01:00
bors
c8887241f9 Auto merge of #16606 - Veykril:hover-extern, r=Veykril
internal: Render assoc item owner in hover for items other than functions

Closes https://github.com/rust-lang/rust-analyzer/issues/16603
2024-02-20 13:51:47 +00:00
Lukas Wirth
85203d9721 Render assoc item owner in hover for items other than functions 2024-02-20 13:16:12 +01:00