Coalesce duplicate missing clone tests

This commit is contained in:
mejrs 2025-04-29 12:46:26 +02:00
parent fc2cd77e11
commit a4ce307c01
8 changed files with 44 additions and 99 deletions

View file

@ -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

View file

@ -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

View file

@ -1,14 +0,0 @@
struct C {
x: isize,
}
impl Drop for C {
fn drop(&mut self) {
println!("dropping: {}", self.x);
}
}
fn main() {
let c = C{ x: 2};
let _d = c.clone(); //~ ERROR no method named `clone` found
}

View file

@ -1,16 +0,0 @@
error[E0599]: no method named `clone` found for struct `C` in the current scope
--> $DIR/issue-2823.rs:13:16
|
LL | struct C {
| -------- method `clone` not found for this struct
...
LL | let _d = c.clone();
| ^^^^^ method not found in `C`
|
= 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
For more information about this error, try `rustc --explain E0599`.

View file

@ -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
}

View file

@ -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`.

View file

@ -1,36 +0,0 @@
// Test that a class with a non-copyable field can't be
// copied
#[derive(Debug)]
struct Bar {
x: isize,
}
impl Drop for Bar {
fn drop(&mut self) {}
}
fn bar(x:isize) -> Bar {
Bar {
x: x
}
}
#[derive(Debug)]
struct Foo {
i: isize,
j: Bar,
}
fn foo(i:isize) -> Foo {
Foo {
i: i,
j: bar(5)
}
}
fn main() {
let x = foo(10);
let _y = x.clone(); //~ ERROR no method named `clone` found
println!("{:?}", x);
}

View file

@ -1,16 +0,0 @@
error[E0599]: no method named `clone` found for struct `Foo` in the current scope
--> $DIR/noncopyable-class.rs:34:16
|
LL | struct Foo {
| ---------- method `clone` not found for this struct
...
LL | let _y = x.clone();
| ^^^^^ method not found in `Foo`
|
= 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
For more information about this error, try `rustc --explain E0599`.