about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorYacin Tmimi <ytmimi@horizonmedia.com>2021-10-06 13:09:24 -0400
committerCaleb Cartwright <calebcartwright@users.noreply.github.com>2021-10-13 19:36:37 -0500
commitf2fb3c9659e072d7df6315906f1adbd06c3bc9e3 (patch)
tree51b08981e28b333454a1cf4cb4024a214893b4e9 /src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parentf7c4a44149b4e3a683f5506929050f2b50117328 (diff)
downloadrust-f2fb3c9659e072d7df6315906f1adbd06c3bc9e3.tar.gz
rust-f2fb3c9659e072d7df6315906f1adbd06c3bc9e3.zip
Update connector search in ControlFlow::rewrite_pat_expr for for loops
Resolves 5009

For loops represented by a ControlFlow object use " in" as their connector.
rustfmt searches for the first uncommented occurrence of the word "in" within the
current span and adjusts it's starting point to look for comments right after that.
visually this looks like this:

    rustfmt starts looking for comments here
            |
            V
    for x in /* ... */ 0..1 {}

This works well in most cases, however when the pattern also contains
the word "in", this leads to issues.

    rustfmt starts looking for comments here
          |
          V
    for in_here in /* ... */ 0..1 {}
        -------
        pattern

In order to correctly identify the connector, the new approach first
updates the span to start after the pattern and then searches for the
first uncommented occurrence of "in".
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions