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

fix: Don't provide add_missing_match_arms assist when upmapping match arm list failed #15345

Merged

Conversation

lowr
Copy link
Contributor

@lowr lowr commented Jul 27, 2023

Fixes #15310

We shouldn't provide the assist when we fail to find the original match arm list.

Note that this PR will temporarily make the assist not applicable when attribute macro operates on the match expression in question, just like the case in #15310, for most of the current stable toolchain users. This is because the sysroot-abi proc-macro-srv on the current stable discards spans for Group delimiters in some code paths, which the popular proc-macro2 crate almost always calls, and it makes the identity of match arm list's brackets lost, leading to the upmapping failure. This has been fixed by #14960, which will land in the next stable, 1.71.

- use `str::parse()` rather than `FromStr::from_str()`
- use `iter::once()` instead of constructing `Vec` for a single element
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 27, 2023
@lowr lowr force-pushed the fix/add_missing_match_arms-upmap-failure branch from a89e0e8 to fbec711 Compare July 27, 2023 07:43
@lowr lowr changed the title Don't show add_missing_match_arms assist when upmapping match arm list failed Don't provide add_missing_match_arms assist when upmapping match arm list failed Jul 27, 2023
@Veykril
Copy link
Member

Veykril commented Aug 1, 2023

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 1, 2023

📌 Commit fbec711 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Aug 1, 2023

⌛ Testing commit fbec711 with merge f6bffa4...

@bors
Copy link
Collaborator

bors commented Aug 1, 2023

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing f6bffa4 to master...

@bors bors merged commit f6bffa4 into rust-lang:master Aug 1, 2023
10 checks passed
@lnicola lnicola changed the title Don't provide add_missing_match_arms assist when upmapping match arm list failed fix: Don't provide add_missing_match_arms assist when upmapping match arm list failed Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fill match arms fill at the wrong place on vscode
4 participants