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

⬆️ rust-analyzer #104454

Closed
wants to merge 61 commits into from
Closed

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented Nov 15, 2022

r? @ghost

TiddoLangerak and others added 30 commits August 10, 2022 13:07
Previously, when triggering a method extraction from within a trait
impl block, then this would always create a new impl block for
the struct, even if there already is one. Now, it'll put the extracted
method in the matching existing block if it exists.
…it-into-impl-root, r=Veykril

Feat: extracted method from trait impl is placed in existing impl

**Before**

https://user-images.githubusercontent.com/1759192/183872883-3b0eafd2-d1dc-440e-9e66-38e3372f8b64.mp4

**After**

https://user-images.githubusercontent.com/1759192/183875769-87f34c7d-52f0-4dfc-9766-f591ee738ebb.mp4

Previously, when triggering a method extraction from within an impl trait block, then this would always create a new impl block for
the struct, even if there already is one. Now, if there is already an existing trait-less impl block, then it'll put the extracted method in there.

**Caveats**:
- It currently requires the target impl block to be non-empty. This limitation is because the current architecture takes a `node_to_insert_after` as reference for where to insert the extracted function. An empty impl block doesn't have such a reference node, since it's empty. It seems that supporting this requires a much larger and more complex change.
- This is my first contribution in rust, so apologies for any beginner mistakes.
The length of byte strings containing escaped newlines is displayed two
bytes longer when the first escaped character is a newline.

This is due to a small bug in handling the first escaped newline in
string literals.

Closes rust-lang#13567
Thanks to Lukas Wirth for a suggestion.
Bump Cargo rust-version fields to latest stable

We already depend on `let ... else` now anyways

Closes rust-lang/rust-analyzer#13562
Generalize reborrow hints as adjustment hints

Like reborrow hints, these are still mainly useful for teaching/learning

![image](https://user-images.githubusercontent.com/3757771/200073606-b5cd3b95-a9ad-454d-a3c4-d4d89bf45928.png)
…escaped-newlines, r=Veykril

Fix the length displayed for byte string literals with escaped newlines

This is a fix for the problem I reported earlier: "the length of byte strings containing escaped newlines is displayed two bytes longer when the first escaped character is a newline".

I would appreciate it if you could review the fix.
Many thanks.

Closes rust-lang#13567
Veykril and others added 13 commits November 11, 2022 13:00
fix: Send status notification if there are no found workspaces

Closes rust-lang/rust-analyzer#5829
Fix `tt::Punct`'s spacing calculation

Fixes rust-lang#13499

We currently set a `tt::Punct`'s spacing to `Spacing::Joint` unless its next token is a trivia (i.e. whitespaces or comment). As I understand it, rustc only [sets `Spacing::Joint` if the next token is an operator](https://github.com/rust-lang/rust/blob/5b3e9090757da9a95b22f589fe39b6a4b5455b96/compiler/rustc_parse/src/lexer/tokentrees.rs#L77-L78) and we should follow it to guarantee the consistent behavior of proc macros.
…y, r=Veykril

fix: check visibility of each path segment

Upon path resolution, we have not been checking if every def pointed to by each segment of the path is visible from the original module. This leads to incorrect import resolutions, in particular when one uses glob imports and names collide.

There is decent amount of changes in this PR because:
- some of our tests were not correct in terms of visibility
  - I left several basic nameres tests as-is (with expect test updated) since I thought it would be nice to ensure we don't resolve defs that are not visible.
- `fix_visibility` assist relied on `Semantics::resolve_path()`, which uses the name resolution procedure I'm fixing and wouldn't be able to "see through" the items with strict visibility with this patch

The first commit is the gist of the fix itself.

Fixes rust-lang#10991
Fixes rust-lang#11473
Fixes rust-lang#13252
fix: Fix hover in attributed items not preferring similar kinded tokens
fix: Fix r-a eagerly showing no discovered workspace errors
fix: Add trait alias grammar to rust.ungram

We already parse them, but the grammar was never updated to reflect that
internal: Add version info to unsupported proc macro abi error

cc rust-lang/rust-analyzer#13589 (comment)
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 15, 2022
@lnicola
Copy link
Member Author

lnicola commented Nov 15, 2022

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 15, 2022

📌 Commit 5d36be5 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 Nov 15, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 16, 2022
…r=lnicola

⬆️ rust-analyzer

r? `@ghost`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 16, 2022
…r=lnicola

⬆️ rust-analyzer

r? ``@ghost``
@matthiaskrgr
Copy link
Member

@bors r- failed in a rollup
https://github.com/rust-lang-ci/rust/actions/runs/3476992153/jobs/5812720533#step:25:32620
#104480

@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 Nov 16, 2022
@lnicola lnicola closed this Nov 16, 2022
@lnicola lnicola deleted the rust-analyzer-2022-11-15 branch November 16, 2022 16:58
bors added a commit to rust-lang/rust-analyzer that referenced this pull request Nov 16, 2022
internal: Update proc-macro-srv tests

Should have been included in #13548, but I didn't notice as those tests aren't run in our CI.

cc rust-lang/rust#104454
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants