about summary refs log tree commit diff
path: root/tests/ui/ptr_ops
diff options
context:
space:
mode:
authorKivooeo <Kivooeo123@gmail.com>2025-07-01 20:20:14 +0500
committerKivooeo <Kivooeo123@gmail.com>2025-07-13 00:03:31 +0500
commit98934707eb7824cd48ee3889d4570c1406c39ba4 (patch)
treeea1189bcf19374f2c0c23a546c3133f2999117a9 /tests/ui/ptr_ops
parent47b8a32ca311e2c441f4e7d747bfd75f0045baa1 (diff)
downloadrust-98934707eb7824cd48ee3889d4570c1406c39ba4.tar.gz
rust-98934707eb7824cd48ee3889d4570c1406c39ba4.zip
cleaned up some tests
Additionally, remove unused `tests/ui/auxiliary/svh-*` crates that are duplicates of `tests/ui/svh/auxiliary/svh-*`.
Diffstat (limited to 'tests/ui/ptr_ops')
-rw-r--r--tests/ui/ptr_ops/ptr-swap-basic.rs6
-rw-r--r--tests/ui/ptr_ops/ptr-swap-overlapping-regions.rs16
2 files changed, 13 insertions, 9 deletions
diff --git a/tests/ui/ptr_ops/ptr-swap-basic.rs b/tests/ui/ptr_ops/ptr-swap-basic.rs
index b104c3ade42..ce230feeb32 100644
--- a/tests/ui/ptr_ops/ptr-swap-basic.rs
+++ b/tests/ui/ptr_ops/ptr-swap-basic.rs
@@ -1,9 +1,13 @@
+//! Check the basic functionality of `std::mem::swap` to ensure it correctly
+//! exchanges the values of two mutable variables.
+
 //@ run-pass
 
 use std::mem::swap;
 
 pub fn main() {
-    let mut x = 3; let mut y = 7;
+    let mut x = 3;
+    let mut y = 7;
     swap(&mut x, &mut y);
     assert_eq!(x, 7);
     assert_eq!(y, 3);
diff --git a/tests/ui/ptr_ops/ptr-swap-overlapping-regions.rs b/tests/ui/ptr_ops/ptr-swap-overlapping-regions.rs
index 38d5a8109d1..8f05e937d59 100644
--- a/tests/ui/ptr_ops/ptr-swap-overlapping-regions.rs
+++ b/tests/ui/ptr_ops/ptr-swap-overlapping-regions.rs
@@ -1,17 +1,17 @@
+//! Check that `std::ptr::swap` behaves correctly when the source and destination
+//! pointers refer to the same memory location, avoiding issues like overlapping `memcpy`.
+//!
+//! Regression test: <https://github.com/rust-lang/rust/issues/5041>
+
 //@ run-pass
 
 #![allow(dead_code)]
-// Issue #5041 - avoid overlapping memcpy when src and dest of a swap are the same
-
 
 use std::ptr;
 
 pub fn main() {
     let mut test = TestDescAndFn {
-        desc: TestDesc {
-            name: TestName::DynTestName("test".to_string()),
-            should_fail: false
-        },
+        desc: TestDesc { name: TestName::DynTestName("test".to_string()), should_fail: false },
         testfn: TestFn::DynTestFn(22),
     };
     do_swap(&mut test);
@@ -24,7 +24,7 @@ fn do_swap(test: &mut TestDescAndFn) {
 }
 
 pub enum TestName {
-    DynTestName(String)
+    DynTestName(String),
 }
 
 pub enum TestFn {
@@ -34,7 +34,7 @@ pub enum TestFn {
 
 pub struct TestDesc {
     name: TestName,
-    should_fail: bool
+    should_fail: bool,
 }
 
 pub struct TestDescAndFn {