You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to format a program with a ridiculously nested datatype that is to be matched, rustfmt does not finish. It keeps a cpu core at 100%, but will not finish formatting even after 15 minutes. This might potentially break applications of rustfmt in CI/CD scripts and waste ressources.
Expected behavior rustfmt finishes formatting quickly or returns some kind of error, explaining that it gives up on formatting ridiculously nested types/match statements.
Current behavior rustfmt just keeps going, presumably trying to format the document, using up a full cpu core. This seems to start at a depth of about 16 match statements.
Reproduction
I know this source file is completely ridiculous, but bear with me. Note that compiling and running is near instantaneous.
See here for the full source and here for an example on how cpu time is wasted in context of CI/CD.
fn main(){let deep_type = Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(Option::Some(1337))),)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));matchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatchmatch
deep_type {Some(inner) => inner,None => unreachable!(),}{Some(inner) => inner,None => unreachable!(),}{Some(inner) => inner,None => unreachable!(),}{Some(inner) => inner,None => unreachable!(),}{Some(inner) => inner,None => unreachable!(),/* it goes on a lot longer */
The text was updated successfully, but these errors were encountered:
When trying to format a program with a ridiculously nested datatype that is to be matched, rustfmt does not finish. It keeps a cpu core at 100%, but will not finish formatting even after 15 minutes. This might potentially break applications of
rustfmt
in CI/CD scripts and waste ressources.Expected behavior
rustfmt
finishes formatting quickly or returns some kind of error, explaining that it gives up on formatting ridiculously nested types/match statements.Current behavior
rustfmt
just keeps going, presumably trying to format the document, using up a full cpu core. This seems to start at a depth of about 16match
statements.Reproduction
I know this source file is completely ridiculous, but bear with me. Note that compiling and running is near instantaneous.
See here for the full source and here for an example on how cpu time is wasted in context of CI/CD.
The text was updated successfully, but these errors were encountered: