Commit Graph

27049 Commits

Author SHA1 Message Date
YouWei Zhao
0380d982f9 highlight rustdoc 2024-01-10 21:55:41 +08:00
bors
1c9bb31970 Auto merge of #16209 - l1nxy:add-merge-nested-if, r=Veykril
feat: assist to merge nested if

resolve: #16095
2024-01-10 09:18:05 +00:00
bors
00eb8ce41e Auto merge of #16271 - Veykril:gate-proc-macro-test, r=Veykril
Remove sysroot-abi feature flag from proc-macro-test

Closes https://github.com/rust-lang/rust-analyzer/issues/16194
2024-01-10 09:05:00 +00:00
Lukas Wirth
4b7b602da9 Remove sysroot-abi feature flag from proc-macro-test 2024-01-10 09:53:12 +01:00
bors
5871b61c0d Auto merge of #16333 - roife:fix/issue-14371, r=Veykril
Preserve comments for extracted block expression in 'extract_function'

Fix #14371

Preserve comments for extracted block expression in 'extract_function'.

In the original implementation, `block.statements()` was used to construct a new function, removing the comments within the block. In the updated implementation, we use manual traversal of nodes and `hacky_block_expr` to generate a new block, thereby preserving the comments.
2024-01-10 08:09:38 +00:00
bors
f31b1fc617 Auto merge of #16334 - Veykril:salsa, r=Veykril
Bump salsa
2024-01-10 07:49:27 +00:00
Lukas Wirth
9c2d331e16 Bump salsa 2024-01-10 08:47:26 +01:00
roife
d327f3036c Add test 'comments_in_block_expr' in in 'extract_function' 2024-01-10 15:00:58 +08:00
roife
bc54775c9d Preserve comments for extracted block expr in 'extract_function' assist 2024-01-10 15:00:35 +08:00
bors
ae6e737724 Auto merge of #16329 - Veykril:perfperf, r=Veykril
internal: Some minor perf/memory improvements
2024-01-09 20:51:23 +00:00
Lukas Wirth
f8b130a6aa unreachable pub 2024-01-09 21:35:22 +01:00
Lukas Wirth
c4b3075be0 Don't allocate inherent_impls_in_block and trait_impls_in_block if its empty 2024-01-09 21:20:03 +01:00
Lukas Wirth
4e16e0f2c1 Don't allocate DefDatabase::crate_lang_items if its empty 2024-01-09 21:06:21 +01:00
Lukas Wirth
9673915045 Make DefDatabase::lang_attr transparent 2024-01-09 20:52:10 +01:00
Lukas Wirth
06aaf20f10 Some minor perf improvements 2024-01-09 20:43:17 +01:00
bors
51ac6de6f3 Auto merge of #16277 - roife:fix-issue16276, r=Veykril
Resolve panic in `generate_delegate_methods`

Fixes #16276

This PR addresses two issues:

1. When using `PathTransform`, it searches for the node corresponding to the `path` in the `source_scope` during `make::fn_`. Therefore, we need to perform the transform before `make::fn_` (similar to the problem in issue #15804). Otherwise, even though the tokens are the same, their offsets (i.e., `span`) differ, resulting in the error "Can't find CONST_ARG@xxx."

2. As mentioned in the first point, `PathTransform` searches for the node corresponding to the `path` in the `source_scope`. Thus, when transforming paths, we should update nodes from right to left (i.e., use **reverse of preorder** (right -> left -> root) instead of **postorder** (left -> right -> root)). Reasons are as follows:

    In the red-green tree (rowan), we do not store absolute ranges but instead store the length of each node and dynamically calculate offsets (spans). Therefore, when modifying the left-side node (such as nodes are inserted or deleted), it causes all right-side nodes' spans to change. This, in turn, leads to PathTransform being unable to find nodes with the same paths (due to different spans), resulting in errors.
2024-01-09 15:52:34 +00:00
bors
da6f7e2c7b Auto merge of #16275 - davidsemakula:ast-path-segments, r=Veykril
fix: Fix `ast::Path::segments` implementation

calling `ast::Path::segments` on a qualifier currently returns all the segments of the top path instead of just the segments of the qualifier.

The issue can be summarized by the simple failing test below:
```rust
#[test]
fn path_segments() {
    //use ra_ap_syntax::ast;
    let path: ast::Path = ...; // e.g. `ast::Path` for "foo::bar::item".

    let path_segments: Vec<_> = path.segments().collect();
    let qualifier_segments: Vec<_> = path.qualifier().unwrap().segments().collect();
    assert_eq!(path_segments.len(), qualifier_segments.len() + 1); // Fails because `LHS = RHS`.
}
```

This PR:
- Fixes the implementation of `ast::Path::segments`
- Fixes `ast::Path::segments` callers that either implicitly relied on behavior of previous implementation or exhibited other "wrong" behavior directly related to the result of `ast::Path::segments` (all callers have been reviewed, only one required modification)
- Removes unnecessary (and now unused) `ast::Path::segments` alternatives
2024-01-09 15:41:48 +00:00
bors
bffafc4eb1 Auto merge of #16318 - rust-lang:dependabot/npm_and_yarn/editors/code/follow-redirects-1.15.4, r=Veykril
Bump follow-redirects from 1.15.2 to 1.15.4 in /editors/code

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
<details>
<summary>Commits</summary>
<ul>
<li><a href="65858205e5"><code>6585820</code></a> Release version 1.15.4 of the npm package.</li>
<li><a href="7a6567e16d"><code>7a6567e</code></a> Disallow bracketed hostnames.</li>
<li><a href="05629af696"><code>05629af</code></a> Prefer native URL instead of deprecated url.parse.</li>
<li><a href="1cba8e85fa"><code>1cba8e8</code></a> Prefer native URL instead of legacy url.resolve.</li>
<li><a href="72bc2a4229"><code>72bc2a4</code></a> Simplify _processResponse error handling.</li>
<li><a href="3d42aecdca"><code>3d42aec</code></a> Add bracket tests.</li>
<li><a href="bcbb096b32"><code>bcbb096</code></a> Do not directly set Error properties.</li>
<li><a href="192dbe7ce6"><code>192dbe7</code></a> Release version 1.15.3 of the npm package.</li>
<li><a href="bd8c81e4f3"><code>bd8c81e</code></a> Fix resource leak on destroy.</li>
<li><a href="9c728c314b"><code>9c728c3</code></a> Split linting and testing.</li>
<li>Additional commits viewable in <a href="https://github.com/follow-redirects/follow-redirects/compare/v1.15.2...v1.15.4">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=follow-redirects&package-manager=npm_and_yarn&previous-version=1.15.2&new-version=1.15.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/rust-lang/rust-analyzer/network/alerts).

</details>
2024-01-09 14:26:13 +00:00
bors
9e34e643a1 Auto merge of #16319 - Veykril:no-double-load, r=Veykril
fix: Differentiate between vfs config load and file changed events

Kind of fixes https://github.com/rust-lang/rust-analyzer/issues/14730 in a pretty bad way. We need to rethink the vfs-notify layer entirely. For a decent fix.
2024-01-09 10:24:23 +00:00
bors
e3575a87de Auto merge of #16312 - Veykril:win-proc-macro-srv, r=Veykril
fix: Fix rust-analyzer-proc-macro-srv failing to spawn on windows
2024-01-09 10:12:57 +00:00
bors
acafce3389 Auto merge of #16309 - Veykril:proc-macro-srv-err, r=Veykril
Recognize proc macro server unexpectedly exiting and report the exit code
2024-01-09 10:01:10 +00:00
bors
c246ecfd55 Auto merge of #16310 - Veykril:range-access-parse, r=Veykril
fix: Fix incorrect parsing error on method call on range

Fixes https://github.com/rust-lang/rust-analyzer/issues/16289
2024-01-09 09:49:25 +00:00
bors
25f71469f1 Auto merge of #16311 - Veykril:rustc-deps, r=Veykril
internal: Remove `rustc_dependencies ` crate

The crate serves no purpose really
2024-01-09 09:37:48 +00:00
Lukas Wirth
21a953fe37 Recognize proc macro server unexpectedly exiting and report the exit code 2024-01-09 10:37:26 +01:00
Lukas Wirth
a8c94eaf13 fix: Fix rust-analyzer-proc-macro-srv failing to spawn on windows 2024-01-09 10:35:54 +01:00
Lukas Wirth
e1c67485bf fix: Differentiate between vfs config load and file changed events 2024-01-09 10:30:16 +01:00
dependabot[bot]
3926ff5d20
Bump follow-redirects from 1.15.2 to 1.15.4 in /editors/code
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-09 08:49:11 +00:00
bors
f5f7ddae23 Auto merge of #16317 - lnicola:sync-from-rust, r=Veykril
internal: sync from downstream
2024-01-09 08:36:57 +00:00
Laurențiu Nicola
4413aeb9e8 Temporarily disable resolve_proc_macro test 2024-01-09 10:27:36 +02:00
Laurențiu Nicola
b0b2b1c5f1 Fix allow(dead_code) 2024-01-09 10:00:57 +02:00
Laurențiu Nicola
0ae73738ad Try to fix feature gates 2024-01-09 09:52:58 +02:00
Laurențiu Nicola
f52f2f9c3c Merge branch 'master' into sync-from-rust 2024-01-09 08:46:16 +02:00
Laurențiu Nicola
c6a02e375b Merge branch 'release' into sync-from-rust 2024-01-09 08:45:49 +02:00
bors
12e7aa3132 Auto merge of #16313 - Urhengulas:tidy-syntax-docs, r=lnicola
minor: Remove newline and add dot in syntax docs

While reading through the docs I came across these two small typos.
2024-01-08 17:21:48 +00:00
Johann Hemmann
d94f572fe2 Remove newline and add dot 2024-01-08 18:10:48 +01:00
bors
598511b4e8 Auto merge of #16308 - Veykril:builtin-macro-hygiene, r=lnicola
Builtin derives are hygienic

Closes https://github.com/rust-lang/rust-analyzer/issues/16295
2024-01-08 17:10:32 +00:00
bors
c1c242180e Auto merge of #16307 - Veykril:vfs2, r=lnicola
internal: VFS no longer stores all source files in memory

Turns out there is no need to keep the files around. We either upload them to salsa once processed, or we need to keep them around for the `DidChangeTextDocumentNotification`, but that notification is only valid for opened documents, so instead we can just keep the files around in the `MemDocs`!

Fixes https://github.com/rust-lang/rust-analyzer/issues/16301
2024-01-08 16:56:44 +00:00
Lukas Wirth
f972da70d4 Remove rustc_dependencies crate 2024-01-08 15:39:35 +01:00
Lukas Wirth
e25e0dd0ad Split out rustc_parse_format from rustc_dependencies 2024-01-08 15:30:26 +01:00
Lukas Wirth
b97ab00bd4 Split out rustc_lexer from rustc_dependencies 2024-01-08 15:24:46 +01:00
Lukas Wirth
72200641c1 fix: Fix incorrect parsing error on method call on range 2024-01-08 15:09:26 +01:00
Lukas Wirth
1c40ac79c8 VFS no longer stores all source files in memory 2024-01-08 12:51:16 +01:00
Lukas Wirth
7dd9f20ce3 Builtin derives are hygienic 2024-01-08 12:50:11 +01:00
Laurențiu Nicola
3afeb24198 Merge commit 'af40101841c45aa75b56f4e9ca745369da8fb4ba' into sync-from-ra 2024-01-08 11:29:25 +02:00
bors
af40101841 Auto merge of #16302 - homersimpsons:patch-1, r=lnicola
line-index: Create README.md

Fixes #16180
2024-01-07 14:41:45 +00:00
homersimpsons
0f69276e60
line-index: Update README.md with suggestions
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2024-01-07 15:38:40 +01:00
homersimpsons
747fa7dd6e
line-index: Create README.md 2024-01-07 14:25:42 +01:00
bors
6ce3f44597 Auto merge of #16298 - riverbl:exclusive-range-hint, r=Veykril
feat: Add inlay hint for exclusive ranges

Adds an inlay hint containing a '<' character to exclusive range expressions and patterns that specify an upper bound.

![2024-01-07-095056_257x415_scrot](https://github.com/rust-lang/rust-analyzer/assets/94326797/d6bbc0de-52a5-4af4-b53c-a034749b6cab)

Inspired by [this comment](https://github.com/rust-lang/rust/issues/37854#issuecomment-1865124907) noting that IntelliJ Rust has this feature.
2024-01-07 10:21:39 +00:00
bors
1c5fa447d9 Auto merge of #16294 - matthiaskrgr:less_alloc, r=Veykril
minor: some minor clippy::perf fixes

can be read commit by commit if you want 🤷
2024-01-07 10:02:38 +00:00
riverbl
3c378b9c70 Add inlay hint for exclusive ranges
Adds an inlay hint containing a '<' character to exclusive range expressions and patterns that specify an upper bound.
2024-01-07 09:33:56 +00:00