Skip to content

Add regression test for issue 6300 - #7164

Merged
ytmimi merged 1 commit into
rust-lang:mainfrom
matthewhughes934:issue-6300-fixed
Oct 6, 2026
Merged

ytmimi merged 1 commit into
rust-lang:mainfrom
matthewhughes934:issue-6300-fixed

Conversation

@matthewhughes934

@matthewhughes934 matthewhughes934 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

It looks like this issue has been fixed, so add a test to ensure we
never regress.

You may ask when this was fixed, the best I could do was bisect to
a merge commit: d97c4fb, via:

# use --first-parent so we don't try and build commits that were
# originally added in rust-lang/rust, since it's a pain to find the
# correct toolchain to build those against
$ git bisect start --term-new=fixed --term-old=broken --first-parent main 46cb7d322055625c07823dea8fdfad4c07f98754
$ git bisect run ./bisect.sh

Where bisect.sh is:

#!/usr/bin/env bash

set -o errexit

if ! cargo build --quiet --bin rustfmt
then
  echo "failed to build" >&2
  # exit: magic code that tells git-bisect to skip this commit (see
  # git-bisect(1))
  exit 125
fi

export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
# reverse the exit code: the basis of 'git bisect' is that the 'new' commit is
# bad, the 'old' commit is good (e.g. there's a bug in HEAD but not HEAD~4,
# which commit introduced that?). But we want the _opposite_
! ./target/debug/rustfmt --check ./samples/bugs.rs >/dev/null

Closes: #6300

  • I did not use an LLM to create a change in this PR.
  • I used an LLM to create a change in this PR, and I have explained below how it was used.

It looks like this issue has been fixed, so add a test to ensure we
never regress.

You may ask _when_ this was fixed, the best I could do was bisect to
a merge commit: d97c4fb, via:

    # use --first-parent so we don't try and build commits that were
    # originally added in rust-lang/rust, since it's a pain to find the
    # correct toolchain to build those against
    $ git bisect start --term-new=fixed --term-old=broken --first-parent main 46cb7d3
    $ git bisect run ./bisect.sh

Where `bisect.sh` is:

    #!/usr/bin/env bash

    set -o errexit

    if ! cargo build --quiet --bin rustfmt
    then
      echo "failed to build" >&2
      # exit: magic code that tells git-bisect to skip this commit (see
      # git-bisect(1))
      exit 125
    fi

    export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
    # reverse the exit code: the basis of 'git bisect' is that the 'new' commit is
    # bad, the 'old' commit is good (e.g. there's a bug in HEAD but not HEAD~4,
    # which commit introduced that?). But we want the _opposite_
    ! ./target/debug/rustfmt --check ./samples/bugs.rs >/dev/null

References: rust-lang#6300
@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Oct 6, 2026

@ytmimi ytmimi left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ytmimi
ytmimi added this pull request to the merge queue Oct 6, 2026
Merged via the queue into rust-lang:main with commit d243ef1 Oct 6, 2026
33 checks passed
@rustbot rustbot added release-notes Needs an associated changelog entry and removed S-waiting-on-review Status: awaiting review from the assignee but also interested parties. labels Oct 6, 2026
@matthewhughes934
matthewhughes934 deleted the issue-6300-fixed branch October 6, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes Needs an associated changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrectly and non-idempotently modifies .. in macro

3 participants