Commit Graph

27036 Commits

Author SHA1 Message Date
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
Matthias Krüger
3fb2cd2002 autofix remaining perf findings 2024-01-07 01:20:20 +01:00
Matthias Krüger
196650dfaf don't to_string() format args 2024-01-07 01:11:57 +01:00
Matthias Krüger
b22bd36f6e remove more redundant clones manually 2024-01-07 00:26:49 +01:00
Matthias Krüger
476e10e961 remove redundant clones 2024-01-07 00:17:48 +01:00
bors
f595e60b6d Auto merge of #16290 - Veykril:chalk, r=Veykril
internal: Reduce vec cloning in mir lowering/eval
2024-01-06 22:13:09 +00:00
bors
e9ae0b7ab4 Auto merge of #16285 - lnicola:repr-packed-unaligned, r=Veykril
fix: Fix panic on unaligned packed attribute

Closes #16284
2024-01-06 20:35:56 +00:00
Lukas Wirth
5ac0c14384 Remove some vec clones in const-eval 2024-01-06 21:33:47 +01:00
Laurențiu Nicola
d17156a774 Add some repr(packed) tests 2024-01-06 21:24:01 +02:00