Skip to content

Commit 02283a3

Browse files
committed
Move tests\ui\copy-a-resource.rs to tests\ui\methods\clone-missing.rs
1 parent 09b73f5 commit 02283a3

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

tests/ui/copy-a-resource.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/ui/methods/clone-missing.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This test checks that calling `.clone()` on a type that does not implement the `Clone` trait
2+
// results in a compilation error. The `Foo` struct does not derive or implement `Clone`,
3+
// so attempting to clone it should fail.
4+
5+
struct Foo {
6+
i: isize,
7+
}
8+
9+
fn foo(i:isize) -> Foo {
10+
Foo {
11+
i: i
12+
}
13+
}
14+
15+
fn main() {
16+
let x = foo(10);
17+
let _y = x.clone();
18+
//~^ ERROR no method named `clone` found
19+
}

tests/ui/copy-a-resource.stderr renamed to tests/ui/methods/clone-missing.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0599]: no method named `clone` found for struct `Foo` in the current scope
2-
--> $DIR/copy-a-resource.rs:18:16
2+
--> $DIR/clone-missing.rs:17:16
33
|
44
LL | struct Foo {
55
| ---------- method `clone` not found for this struct

0 commit comments

Comments
 (0)