Skip to content

Use contiguous spans for empty_line_after_* suggestion #13439

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

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

flip1995
Copy link
Member

Replacing an empty span (which an empty line is) with an empty string triggers a debug assertion in rustc. This fixes the debug assertion by using contiguous spans, with the same resulting suggestion.

r? @Alexendoo

This unblocks the sync

changelog: none

@flip1995 flip1995 added the I-sync-blocker Issue: Prevents a change to be synced to rust-lang/rust label Sep 22, 2024
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 22, 2024
@Alexendoo
Copy link
Member

Alexendoo commented Sep 22, 2024

Ah sorry I didn't see that rust-lang/rust#129991 was a direct mention rather than a team one, feel free to poke me on zulip if that happens again

Looks like I missed a test case for it but this would remove the comment in e.g.

#[allow(unused)]

// comment

fn main() {}

To unblock the sync we could turn it into a regular .help() message and look at solving it separately, may need to disable rustfix for the tests

@flip1995
Copy link
Member Author

Good catch. I added the test and fixed the issue. It's now a bit more complicated. If you have a better idea how to do this, let me know.

@flip1995 flip1995 force-pushed the empty-line-fix branch 3 times, most recently from 9841850 to 5636f07 Compare September 23, 2024 12:30
@Alexendoo
Copy link
Member

https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.chunk_by + .map could work here but I haven't tried it

@flip1995
Copy link
Member Author

Good idea! Makes the code way cleaner.

Replacing an empty span (which an empty line is) with an empty string triggers a
debug assertion in rustc. This fixes the debug assertion by using contiguous
spans, with the same resulting suggestion.
@Alexendoo
Copy link
Member

👍

@bors r+

@bors
Copy link
Contributor

bors commented Sep 23, 2024

📌 Commit 7f30daf has been approved by Alexendoo

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 23, 2024

⌛ Testing commit 7f30daf with merge b7ab258...

@bors
Copy link
Contributor

bors commented Sep 23, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing b7ab258 to master...

@bors bors merged commit b7ab258 into rust-lang:master Sep 23, 2024
8 checks passed
@flip1995 flip1995 deleted the empty-line-fix branch September 24, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-sync-blocker Issue: Prevents a change to be synced to rust-lang/rust 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.

5 participants