about summary refs log tree commit diff
path: root/tests/ui/error-codes
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-07-31 23:20:11 +0200
committerGitHub <noreply@github.com>2024-07-31 23:20:11 +0200
commit52f7d33109973345b49b35e5289441e162a83c58 (patch)
tree68d7ebc4aa82fbafa6e12b6829608a5827294a02 /tests/ui/error-codes
parent19f6ff065514d187a70ff917bbf6aebba4f87d28 (diff)
parent91acacf85b9f81aeb41901f8918128bfe02946c8 (diff)
downloadrust-52f7d33109973345b49b35e5289441e162a83c58.tar.gz
rust-52f7d33109973345b49b35e5289441e162a83c58.zip
Rollup merge of #128244 - compiler-errors:move-clone-sugg, r=estebank
Peel off explicit (or implicit) deref before suggesting clone on move error in borrowck, remove some hacks

Also remove a heck of a lot of weird hacks in `suggest_cloning` that I don't think we should have around.

I know this regresses tests, but I don't believe most of these suggestions were accurate, b/c:
1. They either produced type errors (e.g. turning `&x` into `x.clone()`)
2. They don't fix the issue
3. They fix the issue ostensibly, but introduce logic errors (e.g. cloning a `&mut Option<T>` to then `Option::take` out...)

Most of the suggestions are still wrong, but they're not particularly *less* wrong IMO.

Stacked on top of #128241, which is an "obviously worth landing" subset of this PR.

r? estebank
Diffstat (limited to 'tests/ui/error-codes')
-rw-r--r--tests/ui/error-codes/E0504.stderr2
-rw-r--r--tests/ui/error-codes/E0505.stderr2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/ui/error-codes/E0504.stderr b/tests/ui/error-codes/E0504.stderr
index 343bca9a72e..58266959333 100644
--- a/tests/ui/error-codes/E0504.stderr
+++ b/tests/ui/error-codes/E0504.stderr
@@ -21,7 +21,7 @@ LL | struct FancyNum {
    | ^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
 ...
 LL |     let fancy_ref = &fancy_num;
-   |                     ---------- you could clone this value
+   |                      --------- you could clone this value
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0505.stderr b/tests/ui/error-codes/E0505.stderr
index 266df9ea32a..3f2913e9fe3 100644
--- a/tests/ui/error-codes/E0505.stderr
+++ b/tests/ui/error-codes/E0505.stderr
@@ -18,7 +18,7 @@ LL | struct Value {}
    | ^^^^^^^^^^^^ consider implementing `Clone` for this type
 ...
 LL |         let _ref_to_val: &Value = &x;
-   |                                   -- you could clone this value
+   |                                    - you could clone this value
 
 error: aborting due to 1 previous error