Skip to content

chore: fix some tests #140446

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 3 commits into from
Apr 30, 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
1 change: 0 additions & 1 deletion src/tools/tidy/src/issues.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,6 @@ ui/issues/issue-27997.rs
ui/issues/issue-28105.rs
ui/issues/issue-28109.rs
ui/issues/issue-28181.rs
ui/issues/issue-2823.rs
ui/issues/issue-28279.rs
ui/issues/issue-28344.rs
ui/issues/issue-28433.rs
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/ui_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ignore::Walk;
const ENTRY_LIMIT: u32 = 901;
// FIXME: The following limits should be reduced eventually.

const ISSUES_ENTRY_LIMIT: u32 = 1626;
const ISSUES_ENTRY_LIMIT: u32 = 1624;

const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// used to ICE, see <https://github.com/rust-lang/rust/issues/130627>
// Instead it should just ignore the diagnostic attribute
//! used to ICE, see <https://github.com/rust-lang/rust/issues/130627>
//! Instead it should just ignore the diagnostic attribute

#![feature(trait_alias)]

trait Test {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
--> $DIR/on_impl_trait.rs:7:1
--> $DIR/on_impl_trait.rs:8:1
|
LL | #[diagnostic::on_unimplemented(message = "blah", label = "blah", note = "blah")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default

error[E0277]: the trait bound `{integer}: Alias` is not satisfied
--> $DIR/on_impl_trait.rs:15:9
--> $DIR/on_impl_trait.rs:16:9
|
LL | foo(&1);
| --- ^^ the trait `Test` is not implemented for `{integer}`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/on_impl_trait.rs:5:1
--> $DIR/on_impl_trait.rs:6:1
|
LL | trait Test {}
| ^^^^^^^^^^
= note: required for `{integer}` to implement `Alias`
note: required by a bound in `foo`
--> $DIR/on_impl_trait.rs:12:11
--> $DIR/on_impl_trait.rs:13:11
|
LL | fn foo<T: Alias>(v: &T) {}
| ^^^^^ required by this bound in `foo`
Expand Down
14 changes: 0 additions & 14 deletions tests/ui/issues/issue-2823.rs

This file was deleted.

16 changes: 0 additions & 16 deletions tests/ui/issues/issue-2823.stderr

This file was deleted.

33 changes: 24 additions & 9 deletions tests/ui/methods/clone-missing.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
// This test checks that calling `.clone()` on a type that does not implement the `Clone` trait
// results in a compilation error. The `Foo` struct does not derive or implement `Clone`,
// so attempting to clone it should fail.
//! This test checks that calling `.clone()` on a type that does
//! not implement the `Clone` trait results in a compilation error.
//! The `NotClone` and AlsoNotClone structs do not derive or
//! implement `Clone`, so attempting to clone them should fail.

struct Foo {
i: isize,
struct NotClone {
i: isize,
}

fn foo(i:isize) -> Foo {
Foo {
i: i
fn not_clone(i: isize) -> NotClone {
NotClone { i }
}

struct AlsoNotClone {
i: isize,
j: NotClone,
}

fn also_not_clone(i: isize) -> AlsoNotClone {
AlsoNotClone {
i,
j: NotClone { i: i },
}
}

fn main() {
let x = foo(10);
let x = not_clone(10);
let _y = x.clone();
//~^ ERROR no method named `clone` found

let x = also_not_clone(10);
let _y = x.clone();
//~^ ERROR no method named `clone` found
}
25 changes: 19 additions & 6 deletions tests/ui/methods/clone-missing.stderr
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
error[E0599]: no method named `clone` found for struct `Foo` in the current scope
--> $DIR/clone-missing.rs:17:16
error[E0599]: no method named `clone` found for struct `NotClone` in the current scope
--> $DIR/clone-missing.rs:28:16
|
LL | struct Foo {
| ---------- method `clone` not found for this struct
LL | struct NotClone {
| --------------- method `clone` not found for this struct
...
LL | let _y = x.clone();
| ^^^^^ method not found in `Foo`
| ^^^^^ method not found in `NotClone`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `clone`, perhaps you need to implement it:
candidate #1: `Clone`

error: aborting due to 1 previous error
error[E0599]: no method named `clone` found for struct `AlsoNotClone` in the current scope
--> $DIR/clone-missing.rs:32:16
|
LL | struct AlsoNotClone {
| ------------------- method `clone` not found for this struct
...
LL | let _y = x.clone();
| ^^^^^ method not found in `AlsoNotClone`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `clone`, perhaps you need to implement it:
candidate #1: `Clone`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0599`.
36 changes: 0 additions & 36 deletions tests/ui/noncopyable-class.rs

This file was deleted.

16 changes: 0 additions & 16 deletions tests/ui/noncopyable-class.stderr

This file was deleted.

7 changes: 2 additions & 5 deletions tests/ui/on-unimplemented/expected-comma-found-token.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// Tests that two closures cannot simultaneously have mutable
// access to the variable, whether that mutable access be used
// for direct assignment or for taking mutable ref. Issue #6801.
//! Test for invalid MetaItem syntax in the attribute

#![crate_type = "lib"]
#![feature(rustc_attrs)]

#[rustc_on_unimplemented(
message="the message"
label="the label" //~ ERROR expected `,`, found `label`
)]
trait T {}

fn main() { }
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: expected `,`, found `label`
--> $DIR/expected-comma-found-token.rs:9:5
--> $DIR/expected-comma-found-token.rs:8:5
|
LL | message="the message"
| - expected `,`
Expand Down
Loading