cmp_owned add test for multiple dereference
This commit is contained in:
parent
88ee209a1d
commit
d41615548e
2 changed files with 14 additions and 3 deletions
|
@ -40,6 +40,11 @@ fn main() {
|
||||||
let y = &Baz;
|
let y = &Baz;
|
||||||
|
|
||||||
y.to_owned() == *x;
|
y.to_owned() == *x;
|
||||||
|
|
||||||
|
let x = &&Baz;
|
||||||
|
let y = &Baz;
|
||||||
|
|
||||||
|
y.to_owned() == **x;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
|
|
@ -43,10 +43,16 @@ error: this creates an owned instance just for comparison
|
||||||
| ^^^^^^^^^^^^^^^^^^ help: try: `y == x`
|
| ^^^^^^^^^^^^^^^^^^ help: try: `y == x`
|
||||||
|
|
||||||
error: this creates an owned instance just for comparison
|
error: this creates an owned instance just for comparison
|
||||||
--> $DIR/cmp_owned.rs:49:9
|
--> $DIR/cmp_owned.rs:47:5
|
||||||
|
|
|
|
||||||
49 | self.to_owned() == *other
|
47 | y.to_owned() == **x;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `y == x`
|
||||||
|
|
||||||
|
error: this creates an owned instance just for comparison
|
||||||
|
--> $DIR/cmp_owned.rs:54:9
|
||||||
|
|
|
||||||
|
54 | self.to_owned() == *other
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ try implementing the comparison without allocating
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ try implementing the comparison without allocating
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error: aborting due to 9 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue