about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKivooeo <Kivooeo123@gmail.com>2025-06-01 00:03:54 +0500
committerKivooeo <Kivooeo123@gmail.com>2025-06-03 07:38:06 +0500
commite7e884b0a4b5f012864562b0bb550d80d3e5f03b (patch)
tree20e189b8ec9a54f4e63b4136e2756c246396c210
parent852f15c0f146fc292c9b20f2a8f44c1f671d7845 (diff)
downloadrust-e7e884b0a4b5f012864562b0bb550d80d3e5f03b.tar.gz
rust-e7e884b0a4b5f012864562b0bb550d80d3e5f03b.zip
cleaned up some tests
-rw-r--r--tests/ui/autoref-autoderef/autoderef-vec-to-slice-by-value.rs18
-rw-r--r--tests/ui/bogus-tag.rs10
-rw-r--r--tests/ui/borrow-by-val-method-receiver.rs14
-rw-r--r--tests/ui/higher-ranked/higher-ranked-invalid-bounds.rs (renamed from tests/ui/bounds-lifetime.rs)2
-rw-r--r--tests/ui/higher-ranked/higher-ranked-invalid-bounds.stderr (renamed from tests/ui/bounds-lifetime.stderr)10
-rw-r--r--tests/ui/numbers-arithmetic/bitwise-ops-platform.rs (renamed from tests/ui/bitwise.rs)2
-rw-r--r--tests/ui/pattern/pattern-match-arc-move.rs (renamed from tests/ui/bind-by-move.rs)2
-rw-r--r--tests/ui/pattern/pattern-match-invalid-variant.rs19
-rw-r--r--tests/ui/pattern/pattern-match-invalid-variant.stderr (renamed from tests/ui/bogus-tag.stderr)6
9 files changed, 51 insertions, 32 deletions
diff --git a/tests/ui/autoref-autoderef/autoderef-vec-to-slice-by-value.rs b/tests/ui/autoref-autoderef/autoderef-vec-to-slice-by-value.rs
new file mode 100644
index 00000000000..4d67c3a6733
--- /dev/null
+++ b/tests/ui/autoref-autoderef/autoderef-vec-to-slice-by-value.rs
@@ -0,0 +1,18 @@
+//! Tests that a `Vec<isize>` can call a method defined in a trait (`Foo`)
+//! implemented for `&[isize]` with a by-value receiver (`self`), relying on auto-dereferencing
+//! from `Vec` to `&[isize]` during method resolution.
+
+//@ run-pass
+
+trait Foo {
+    fn foo(self);
+}
+
+impl<'a> Foo for &'a [isize] {
+    fn foo(self) {}
+}
+
+pub fn main() {
+    let items = vec![ 3, 5, 1, 2, 4 ];
+    items.foo();
+}
diff --git a/tests/ui/bogus-tag.rs b/tests/ui/bogus-tag.rs
deleted file mode 100644
index c594385eec2..00000000000
--- a/tests/ui/bogus-tag.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), }
-
-fn main() {
-    let red: Color = Color::Rgb(255, 0, 0);
-    match red {
-        Color::Rgb(r, g, b) => { println!("rgb"); }
-        Color::Hsl(h, s, l) => { println!("hsl"); }
-        //~^ ERROR no variant
-    }
-}
diff --git a/tests/ui/borrow-by-val-method-receiver.rs b/tests/ui/borrow-by-val-method-receiver.rs
deleted file mode 100644
index aee1108d96d..00000000000
--- a/tests/ui/borrow-by-val-method-receiver.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-//@ run-pass
-
-trait Foo {
-    fn foo(self);
-}
-
-impl<'a> Foo for &'a [isize] {
-    fn foo(self) {}
-}
-
-pub fn main() {
-    let items = vec![ 3, 5, 1, 2, 4 ];
-    items.foo();
-}
diff --git a/tests/ui/bounds-lifetime.rs b/tests/ui/higher-ranked/higher-ranked-invalid-bounds.rs
index f26976066ac..be161aeb53d 100644
--- a/tests/ui/bounds-lifetime.rs
+++ b/tests/ui/higher-ranked/higher-ranked-invalid-bounds.rs
@@ -1,3 +1,5 @@
+//! Tests invalid lifetime bounds and generic parameters in higher-ranked types.
+
 type A = for<'b, 'a: 'b> fn(); //~ ERROR bounds cannot be used in this context
 type B = for<'b, 'a: 'b,> fn(); //~ ERROR bounds cannot be used in this context
 type C = for<'b, 'a: 'b +> fn(); //~ ERROR bounds cannot be used in this context
diff --git a/tests/ui/bounds-lifetime.stderr b/tests/ui/higher-ranked/higher-ranked-invalid-bounds.stderr
index 01b314f3d1b..60ee7a7cf76 100644
--- a/tests/ui/bounds-lifetime.stderr
+++ b/tests/ui/higher-ranked/higher-ranked-invalid-bounds.stderr
@@ -1,23 +1,23 @@
 error: bounds cannot be used in this context
-  --> $DIR/bounds-lifetime.rs:1:22
+  --> $DIR/higher-ranked-invalid-bounds.rs:3:22
    |
 LL | type A = for<'b, 'a: 'b> fn();
    |                      ^^
 
 error: bounds cannot be used in this context
-  --> $DIR/bounds-lifetime.rs:2:22
+  --> $DIR/higher-ranked-invalid-bounds.rs:4:22
    |
 LL | type B = for<'b, 'a: 'b,> fn();
    |                      ^^
 
 error: bounds cannot be used in this context
-  --> $DIR/bounds-lifetime.rs:3:22
+  --> $DIR/higher-ranked-invalid-bounds.rs:5:22
    |
 LL | type C = for<'b, 'a: 'b +> fn();
    |                      ^^
 
 error[E0658]: only lifetime parameters can be used in this context
-  --> $DIR/bounds-lifetime.rs:4:18
+  --> $DIR/higher-ranked-invalid-bounds.rs:6:18
    |
 LL | type D = for<'a, T> fn();
    |                  ^
@@ -27,7 +27,7 @@ LL | type D = for<'a, T> fn();
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: only lifetime parameters can be used in this context
-  --> $DIR/bounds-lifetime.rs:5:18
+  --> $DIR/higher-ranked-invalid-bounds.rs:7:18
    |
 LL | type E = dyn for<T, U> Fn();
    |                  ^  ^
diff --git a/tests/ui/bitwise.rs b/tests/ui/numbers-arithmetic/bitwise-ops-platform.rs
index 0779e7f229c..60d552e904b 100644
--- a/tests/ui/bitwise.rs
+++ b/tests/ui/numbers-arithmetic/bitwise-ops-platform.rs
@@ -1,3 +1,5 @@
+//! Tests bitwise operations with platform-specific and negative number behavior.
+
 //@ run-pass
 
 #[cfg(any(target_pointer_width = "32"))]
diff --git a/tests/ui/bind-by-move.rs b/tests/ui/pattern/pattern-match-arc-move.rs
index 99f3536e533..bc79401e4e3 100644
--- a/tests/ui/bind-by-move.rs
+++ b/tests/ui/pattern/pattern-match-arc-move.rs
@@ -1,3 +1,5 @@
+//! Tests moving an `Arc` value out of an `Option` in a match expression.
+
 //@ run-pass
 
 use std::sync::Arc;
diff --git a/tests/ui/pattern/pattern-match-invalid-variant.rs b/tests/ui/pattern/pattern-match-invalid-variant.rs
new file mode 100644
index 00000000000..183031553c0
--- /dev/null
+++ b/tests/ui/pattern/pattern-match-invalid-variant.rs
@@ -0,0 +1,19 @@
+//! Tests invalid enum variant in a match expression.
+
+enum Color {
+    Rgb(isize, isize, isize),
+    Rgba(isize, isize, isize, isize),
+}
+
+fn main() {
+    let red: Color = Color::Rgb(255, 0, 0);
+    match red {
+        Color::Rgb(r, g, b) => {
+            println!("rgb");
+        }
+        Color::Hsl(h, s, l) => {
+            //~^ ERROR no variant
+            println!("hsl");
+        }
+    }
+}
diff --git a/tests/ui/bogus-tag.stderr b/tests/ui/pattern/pattern-match-invalid-variant.stderr
index d94bd489ec6..08a99f696f6 100644
--- a/tests/ui/bogus-tag.stderr
+++ b/tests/ui/pattern/pattern-match-invalid-variant.stderr
@@ -1,10 +1,10 @@
 error[E0599]: no variant or associated item named `Hsl` found for enum `Color` in the current scope
-  --> $DIR/bogus-tag.rs:7:16
+  --> $DIR/pattern-match-invalid-variant.rs:14:16
    |
-LL | enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), }
+LL | enum Color {
    | ---------- variant or associated item `Hsl` not found for this enum
 ...
-LL |         Color::Hsl(h, s, l) => { println!("hsl"); }
+LL |         Color::Hsl(h, s, l) => {
    |                ^^^ variant or associated item not found in `Color`
 
 error: aborting due to 1 previous error