This repository was archived by the owner on Nov 24, 2023. It is now read-only.
This repository was archived by the owner on Nov 24, 2023. It is now read-only.
rustfix doesn't work on files with CRLF line endings #176
Closed
Description
I had trouble earlier where cargo fix --edition
resulted in a lot of mangled code, such as use ::foo::bar;
-> usecrate::foo::barr;
with the first space being omitted and last character duplicated.
I tracked this into the way span offsets and replacements work. As far as I could gather, the span offsets count both LF and CRLF as a single character, this means each CRLF makes span offsets off by one.
However I'm a bit confused on this for two reasons:
- "Does not work with CRLF" would seem like a problem that most people on Windows would encounter, yet I couldn't find any references to this issue anywhere. The 2018 edition has been out for almost a year so I would have expected to find reports of this elsewhere.
- The
tests/parse_and_replace.rs
has anot(windows)
cfg with a comment to fix these tests on Windows; So at some point a problem with the tests has been recognized, but no further issue has been raised - so I'm assuming the breakage has only affected tests and the fixes themselves have been working just fine on Windows.
Is the span change a recent breakage by rustc/cargo or is this something specific to my environment? I'm testing this with a recent nightly (2019-09-30).
Metadata
Metadata
Assignees
Labels
No labels