diff options
| author | Josh Mcguigan <joshmcg88@gmail.com> | 2018-10-10 04:51:06 -0700 |
|---|---|---|
| committer | Josh Mcguigan <joshmcg88@gmail.com> | 2018-10-10 04:51:06 -0700 |
| commit | d41615548e47f57c60ac8aed5d47a74dba048c13 (patch) | |
| tree | 3b1802ecb7dafb15894e3b34e76887103a4b68f5 | |
| parent | 88ee209a1d2596efa1582cb7f993aca4308bf1c7 (diff) | |
| download | rust-d41615548e47f57c60ac8aed5d47a74dba048c13.tar.gz rust-d41615548e47f57c60ac8aed5d47a74dba048c13.zip | |
cmp_owned add test for multiple dereference
| -rw-r--r-- | tests/ui/cmp_owned.rs | 5 | ||||
| -rw-r--r-- | tests/ui/cmp_owned.stderr | 12 |
2 files changed, 14 insertions, 3 deletions
diff --git a/tests/ui/cmp_owned.rs b/tests/ui/cmp_owned.rs index 65351cd9b9d..dc0880e7089 100644 --- a/tests/ui/cmp_owned.rs +++ b/tests/ui/cmp_owned.rs @@ -40,6 +40,11 @@ fn main() { let y = &Baz; y.to_owned() == *x; + + let x = &&Baz; + let y = &Baz; + + y.to_owned() == **x; } struct Foo; diff --git a/tests/ui/cmp_owned.stderr b/tests/ui/cmp_owned.stderr index 2613d3b7500..0982467aeee 100644 --- a/tests/ui/cmp_owned.stderr +++ b/tests/ui/cmp_owned.stderr @@ -43,10 +43,16 @@ error: this creates an owned instance just for comparison | ^^^^^^^^^^^^^^^^^^ help: try: `y == x` 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 -error: aborting due to 8 previous errors +error: aborting due to 9 previous errors |
