Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtree update of rust-analyzer #121581

Merged
merged 84 commits into from
Feb 25, 2024
Merged

Subtree update of rust-analyzer #121581

merged 84 commits into from
Feb 25, 2024

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented Feb 25, 2024

r? @ghost

nnethercote and others added 30 commits February 12, 2024 18:39
Now that we have both `delayed_bug` and `span_delayed_bug`, it makes
sense to use the generic term "delayed bug" more.
This mostly works well, and eliminates a couple of delayed bugs.

One annoying thing is that we should really also add an
`ErrorGuaranteed` to `proc_macro::bridge::LitKind::Err`. But that's
difficult because `proc_macro` doesn't have access to `ErrorGuaranteed`,
so we have to fake it.
Uses the native VSCode support for `SnippetTextEdit`s, but in a semi-hacky way as it's not fully supported yet.
We can't tell vscode to not add in the extra indentation, so we instead opt to remove it from the edits themselves, and then let vscode add it back in.
internal: Downgrade actions/checkout in release workflow
internal: Also downgrade actions/setup-node
internal: Also downgrade node to 16

:roll_eyes:
fix: checkout repo before run typos

I see some typos at lastest master :(
…t-edit, r=Veykril

feat: Support multiple tab stops for completions in VSCode

Uses the native VSCode support for `SnippetTextEdit`s. Fixes rust-lang#13229 and fixes rust-lang#8531.

https://github.com/rust-lang/rust-analyzer/assets/13354275/a2d2c033-bb30-4f34-92ca-bf3f4f744cdc

This is done in a slightly hacky way, as `vscode-languageclient` can't convert RA's `SnippetTextEdit`s into vscode `SnippetTextEdit`s and will appear to use a [different format](https://github.com/microsoft/vscode-languageserver-node/blob/295aaa393fda8ecce110c38880a00466b9320e63/types/src/main.ts#L1501-L1516) in the future.

---

~~Marked as draft since as-is, this will cause completions to double-indent any multi-line code generated.~~
**Update:** This also fixes up edits so that any multi-line code won't be double-indented.
Commit 6a06f6f (Deduplicate reference search results, 2022-11-07) deduplicates references
within each definition.

There is an edge case when requesting references of a macro argument.  Apparently, our
descend_into_macros() stanza in references.rs produces a cartesian product of
- references inside the macro times
- times references outside the macro.

Since the above deduplication only applies to the references within a single definition, we
return them all, leading to many redundant references.

Work around this by deduplicating definitions as well.  Perhaps there is a better fix to not
produce this cartesian product in the first place; but I think at least for definitions the
problem would remain; a macro can contain multiple definitions of the same name, but since the
navigation target will be the unresolved location, it's the same for all of them.

We can't use unique() because we don't want to drop references that don't have a declaration
(though I dont' have an example for this case).

I discovered this working with the "bitflags" macro from the crate of the same name.

Fixes rust-lang#16357
test: include `rename_path_inside_use_tree`.

Keeps tracks the progress of the changes. 3 other tests broke with the changes
of this.

feat: rename all other usages within the current file.

feat: fix most of the implementation problems.

test: `rename_path_inside_use_tree` tests a more complicated scenario.
…h-macros, r=Veykril

Deduplicate references when some of them are in macro expansions

EDIT: I wonder if this is a regression, I'll try to investigate.

Commit 6a06f6f (Deduplicate reference search results, 2022-11-07)
deduplicates references within each definition.

Apparently our descend_into_macros() stanza returns
one definition for each time a name is used in a macro.
Each of those definitions has the same set of references.
We return them all, leading to many redundant references.

Work around this by deduplicating definitions as well.  Perhaps there
is a better fix to not produce duplicate definitions in the first
place.

I discovered this working with the "bitflags" macro from the crate
of the same name.

Fixes rust-lang#16357
bors and others added 4 commits February 23, 2024 20:39
…643, r=Veykril

internal: fix deadlock introduced by rust-lang#16643

This fixes a deadlock introduced by rust-lang#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)
…, 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 (07dca48 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 (07dca48 2024-02-04)`
```

> cargo -V
```bash
cargo 1.76.0 (c84b36747 2024-01-18)
```
@rustbot
Copy link
Collaborator

rustbot commented Feb 25, 2024

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 25, 2024
@rust-log-analyzer

This comment has been minimized.

@lnicola
Copy link
Member Author

lnicola commented Feb 25, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Feb 25, 2024

📌 Commit 5ee6a5d has been approved by lnicola

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 25, 2024
@lnicola
Copy link
Member Author

lnicola commented Feb 25, 2024

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 25, 2024
@lnicola
Copy link
Member Author

lnicola commented Feb 25, 2024

@bors r+ p=1 subtree sync

@bors
Copy link
Contributor

bors commented Feb 25, 2024

📌 Commit 5ee6a5d has been approved by lnicola

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 25, 2024
@bors
Copy link
Contributor

bors commented Feb 25, 2024

⌛ Testing commit 5ee6a5d with merge 43fdd49...

@bors
Copy link
Contributor

bors commented Feb 25, 2024

☀️ Test successful - checks-actions
Approved by: lnicola
Pushing 43fdd49 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 25, 2024
@bors bors merged commit 43fdd49 into rust-lang:master Feb 25, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 25, 2024
@lnicola lnicola deleted the sync-from-ra branch February 25, 2024 12:19
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (43fdd49): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.7% [0.7%, 0.8%] 4
Regressions ❌
(secondary)
0.4% [0.2%, 0.7%] 23
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [0.7%, 0.8%] 4

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.9% [2.9%, 2.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
7.1% [6.0%, 8.1%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 648.977s -> 649.797s (0.13%)
Artifact size: 311.08 MiB -> 311.14 MiB (0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Feb 25, 2024
@rylev
Copy link
Member

rylev commented Feb 27, 2024

This is all noise - regressions revert in the next run.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.