tests: add UI test for .swap() suggestion#159719
Merged
rust-bors[bot] merged 2 commits intoJul 24, 2026
Merged
Conversation
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @chenyukang (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
chenyukang
reviewed
Jul 22, 2026
Author
|
@rustbot review |
Member
|
@bors r+ rollup |
Contributor
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 23, 2026
…t-swap, r=chenyukang tests: add UI test for `.swap()` suggestion adds a UI test covering the borrow checker diagnostic that suggests using `.swap()` when `std::mem::swap(&mut arr[i], &mut arr[j])` is used. closes rust-lang#159664
This was referenced Jul 23, 2026
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 24, 2026
Rollup of 20 pull requests Successful merges: - #150161 (Remove 'static requirement on try_as_dyn) - #159412 (Reorganize `tests/ui/issues` [26/N]) - #159466 (cmse: clear variant-dependent padding in `enum`s) - #157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs) - #158479 (Reject static item as direct const generic arg) - #159041 (Reorganize `tests/ui/issues` [22/N]) - #159108 (Reorganize `tests/ui/issues` [23/N]) - #159138 (doc: document wasm import symbol mangling) - #159531 (Reorganize `tests/ui/issues` [28/N]) - #159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable) - #159612 (Reorganize `tests/ui/issues` [29/N]) - #159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`) - #159719 (tests: add UI test for `.swap()` suggestion) - #159737 (rustfmt fix: allow file not found errors for external mods annotated with `#[my_macro]`) - #159759 (rustc-dev-guide subtree update) - #159761 (Remove outdated comment for resolve_vars_with_obligations) - #159764 (use `minicore::simd::Simd` more) - #159773 (Remove outdated workaround for `P` type) - #159778 (use lowest edition the test accepts) - #159788 (Avoid ICEing in RPIT method chain suggestion)
github-actions Bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Jul 25, 2026
Rollup of 20 pull requests Successful merges: - rust-lang/rust#150161 (Remove 'static requirement on try_as_dyn) - rust-lang/rust#159412 (Reorganize `tests/ui/issues` [26/N]) - rust-lang/rust#159466 (cmse: clear variant-dependent padding in `enum`s) - rust-lang/rust#157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs) - rust-lang/rust#158479 (Reject static item as direct const generic arg) - rust-lang/rust#159041 (Reorganize `tests/ui/issues` [22/N]) - rust-lang/rust#159108 (Reorganize `tests/ui/issues` [23/N]) - rust-lang/rust#159138 (doc: document wasm import symbol mangling) - rust-lang/rust#159531 (Reorganize `tests/ui/issues` [28/N]) - rust-lang/rust#159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable) - rust-lang/rust#159612 (Reorganize `tests/ui/issues` [29/N]) - rust-lang/rust#159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`) - rust-lang/rust#159719 (tests: add UI test for `.swap()` suggestion) - rust-lang/rust#159737 (rustfmt fix: allow file not found errors for external mods annotated with `#[my_macro]`) - rust-lang/rust#159759 (rustc-dev-guide subtree update) - rust-lang/rust#159761 (Remove outdated comment for resolve_vars_with_obligations) - rust-lang/rust#159764 (use `minicore::simd::Simd` more) - rust-lang/rust#159773 (Remove outdated workaround for `P` type) - rust-lang/rust#159778 (use lowest edition the test accepts) - rust-lang/rust#159788 (Avoid ICEing in RPIT method chain suggestion)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
adds a UI test covering the borrow checker diagnostic that suggests using
.swap()whenstd::mem::swap(&mut arr[i], &mut arr[j])is used.closes #159664