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 0000000000000..4d67c3a6733bd --- /dev/null +++ b/tests/ui/autoref-autoderef/autoderef-vec-to-slice-by-value.rs @@ -0,0 +1,18 @@ +//! Tests that a `Vec` 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 c594385eec2d6..0000000000000 --- 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 aee1108d96d86..0000000000000 --- 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 similarity index 84% rename from tests/ui/bounds-lifetime.rs rename to tests/ui/higher-ranked/higher-ranked-invalid-bounds.rs index f26976066ac3d..be161aeb53d48 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 similarity index 84% rename from tests/ui/bounds-lifetime.stderr rename to tests/ui/higher-ranked/higher-ranked-invalid-bounds.stderr index 01b314f3d1bb1..60ee7a7cf7670 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 Fn(); | ^ ^ diff --git a/tests/ui/bitwise.rs b/tests/ui/numbers-arithmetic/bitwise-ops-platform.rs similarity index 90% rename from tests/ui/bitwise.rs rename to tests/ui/numbers-arithmetic/bitwise-ops-platform.rs index 0779e7f229c2c..60d552e904b75 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 similarity index 73% rename from tests/ui/bind-by-move.rs rename to tests/ui/pattern/pattern-match-arc-move.rs index 99f3536e533fb..bc79401e4e37a 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 0000000000000..183031553c043 --- /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 similarity index 68% rename from tests/ui/bogus-tag.stderr rename to tests/ui/pattern/pattern-match-invalid-variant.stderr index d94bd489ec609..08a99f696f6d6 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