Skip to content

tests/ui: A New Order [2/N] #141833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/ui/autoref-autoderef/autoderef-vec-to-slice-by-value.rs
Original file line number Diff line number Diff line change
@@ -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();
}
10 changes: 0 additions & 10 deletions tests/ui/bogus-tag.rs

This file was deleted.

14 changes: 0 additions & 14 deletions tests/ui/borrow-by-val-method-receiver.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
| ^
Expand All @@ -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();
| ^ ^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Tests bitwise operations with platform-specific and negative number behavior.
Copy link
Member

Choose a reason for hiding this comment

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

Remark: honestly, this test slightly confuses me because it doesn't seem to be covering all of the interesting boundary cases 🤔 Not for this PR tho.


//@ run-pass

#[cfg(any(target_pointer_width = "32"))]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Tests moving an `Arc` value out of an `Option` in a match expression.
//@ run-pass

use std::sync::Arc;
Expand Down
19 changes: 19 additions & 0 deletions tests/ui/pattern/pattern-match-invalid-variant.rs
Original file line number Diff line number Diff line change
@@ -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");
}
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading