rustfmt hangs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
// run-pass
pub fn main() { return isize(); }
pub mod foo {
pub fn f() -> isize { return 2; }
pub fn g() {
||||||||||||||H||||isize||||||||||||||(|| ||||isize||||||||||||||||isize|||||||||||||||||||||||||| isize!(f(), 2))();
isize!(::f(), 1);
}
}
pub fn main() { return ||||||||||||||H||||isize||||||||||||||(|| ||||H||||||||||||||||isize|||||||||||||||||||||||||| isize!(f(), 2))(); }
While rustc throws errors after 0.2 seconds, rustfmt (cargo fmt) seems to crunch this indefinitely (I gave up after 15 minutes) with no output whatsoever.
A lot of processing by
<rustfmt_nightly::comment::UngroupedCommentCodeSlices as core::iter::traits::iterator::Iterator>::next and <rustfmt_nightly::comment::CharClasses<core::str::iter::CharIndices> as core::iter::traits::iterator::Iterator>::next
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the Rust snippet in the report by running cargo fmt, then inspect rustfmt_nightly::comment::UngroupedCommentCodeSlices::next and CharClasses<CharIndices>::next, where profiling shows most processing. Done means rustfmt no longer runs indefinitely on this input and instead completes with observable output or an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100