File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,11 @@ fn main() {
40
40
let y = & Baz ;
41
41
42
42
y. to_owned ( ) == * x;
43
+
44
+ let x = & & Baz ;
45
+ let y = & Baz ;
46
+
47
+ y. to_owned ( ) == * * x;
43
48
}
44
49
45
50
struct Foo ;
Original file line number Diff line number Diff line change @@ -43,10 +43,16 @@ error: this creates an owned instance just for comparison
43
43
| ^^^^^^^^^^^^^^^^^^ help: try: `y == x`
44
44
45
45
error: this creates an owned instance just for comparison
46
- --> $DIR/cmp_owned.rs:49:9
46
+ --> $DIR/cmp_owned.rs:47:5
47
47
|
48
- 49 | self.to_owned() == *other
48
+ 47 | y.to_owned() == **x;
49
+ | ^^^^^^^^^^^^^^^^^^^ help: try: `y == x`
50
+
51
+ error: this creates an owned instance just for comparison
52
+ --> $DIR/cmp_owned.rs:54:9
53
+ |
54
+ 54 | self.to_owned() == *other
49
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^ try implementing the comparison without allocating
50
56
51
- error: aborting due to 8 previous errors
57
+ error: aborting due to 9 previous errors
52
58
You can’t perform that action at this time.
0 commit comments