Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Fix panic computing indentation. #199

Merged
merged 1 commit into from
Aug 31, 2021

Conversation

ehuss
Copy link
Collaborator

@ehuss ehuss commented Aug 30, 2021

There is a bug where rustfix would panic on input where the highlight_start appears within whitespace characters. The issue is that the code computing the indent was comparing the indent (which is 0-based) to the highlight_start (which is 1-based). All the following code expects 0-based offsets.

In this particular example, the let lead = text_slice[indent..start] would panic because indent is 1 whereas start is 0.

@ehuss
Copy link
Collaborator Author

ehuss commented Aug 30, 2021

I am tempted to just completely remove the Snippet stuff, since none of this is used by cargo. Does anyone have any thoughts on that?

@Manishearth Manishearth merged commit 7388839 into rust-lang:master Aug 31, 2021
@smoelius smoelius mentioned this pull request May 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants