about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-01-11 20:57:40 -0800
committerMichael Goulet <michael@errs.io>2022-01-11 21:13:45 -0800
commit40f33a7a4c3cf928576429a89bca522b94b081cd (patch)
tree93fa30d7cbce514619cb2c370d12d076c24f156a /src
parent72e74d7b9cf1a7901650227e74650f1fcc797600 (diff)
Deduplicate box deref and regular deref suggestions
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/infinite/infinite-autoderef.stderr9
-rw-r--r--src/test/ui/occurs-check-2.stderr9
-rw-r--r--src/test/ui/occurs-check.stderr9
-rw-r--r--src/test/ui/span/coerce-suggestions.stderr9
-rw-r--r--src/test/ui/suggestions/boxed-variant-field.rs2
-rw-r--r--src/test/ui/suggestions/boxed-variant-field.stderr8
-rw-r--r--src/test/ui/terr-sorts.stderr2
7 files changed, 30 insertions, 18 deletions
diff --git a/src/test/ui/infinite/infinite-autoderef.stderr b/src/test/ui/infinite/infinite-autoderef.stderr
index 03e4718f5df..2d29f0592e1 100644
--- a/src/test/ui/infinite/infinite-autoderef.stderr
+++ b/src/test/ui/infinite/infinite-autoderef.stderr
@@ -2,9 +2,12 @@ error[E0308]: mismatched types
   --> $DIR/infinite-autoderef.rs:20:13
    |
 LL |         x = Box::new(x);
-   |             ^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
-   |             |
-   |             cyclic type of infinite size
+   |             ^^^^^^^^^^^ cyclic type of infinite size
+   |
+help: consider unboxing the value
+   |
+LL |         x = *Box::new(x);
+   |             +
 
 error[E0055]: reached the recursion limit while auto-dereferencing `Foo`
   --> $DIR/infinite-autoderef.rs:25:5
diff --git a/src/test/ui/occurs-check-2.stderr b/src/test/ui/occurs-check-2.stderr
index dcbfc81b4d5..b68c3fa5bcc 100644
--- a/src/test/ui/occurs-check-2.stderr
+++ b/src/test/ui/occurs-check-2.stderr
@@ -2,9 +2,12 @@ error[E0308]: mismatched types
   --> $DIR/occurs-check-2.rs:7:9
    |
 LL |     f = Box::new(g);
-   |         ^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
-   |         |
-   |         cyclic type of infinite size
+   |         ^^^^^^^^^^^ cyclic type of infinite size
+   |
+help: consider unboxing the value
+   |
+LL |     f = *Box::new(g);
+   |         +
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/occurs-check.stderr b/src/test/ui/occurs-check.stderr
index 3e1ef2e719a..fdbbdc3abb3 100644
--- a/src/test/ui/occurs-check.stderr
+++ b/src/test/ui/occurs-check.stderr
@@ -2,9 +2,12 @@ error[E0308]: mismatched types
   --> $DIR/occurs-check.rs:5:9
    |
 LL |     f = Box::new(f);
-   |         ^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
-   |         |
-   |         cyclic type of infinite size
+   |         ^^^^^^^^^^^ cyclic type of infinite size
+   |
+help: consider unboxing the value
+   |
+LL |     f = *Box::new(f);
+   |         +
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr
index 74caae8645c..5a964c5d5cc 100644
--- a/src/test/ui/span/coerce-suggestions.stderr
+++ b/src/test/ui/span/coerce-suggestions.stderr
@@ -38,9 +38,12 @@ error[E0308]: mismatched types
   --> $DIR/coerce-suggestions.rs:17:9
    |
 LL |     f = Box::new(f);
-   |         ^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
-   |         |
-   |         cyclic type of infinite size
+   |         ^^^^^^^^^^^ cyclic type of infinite size
+   |
+help: consider unboxing the value
+   |
+LL |     f = *Box::new(f);
+   |         +
 
 error[E0308]: mismatched types
   --> $DIR/coerce-suggestions.rs:21:9
diff --git a/src/test/ui/suggestions/boxed-variant-field.rs b/src/test/ui/suggestions/boxed-variant-field.rs
index 9b9e70a675f..e79be2f6127 100644
--- a/src/test/ui/suggestions/boxed-variant-field.rs
+++ b/src/test/ui/suggestions/boxed-variant-field.rs
@@ -8,7 +8,7 @@ fn foo(x: Ty) -> Ty {
         Ty::Unit => Ty::Unit,
         Ty::List(elem) => foo(elem),
         //~^ ERROR mismatched types
-        //~| HELP try dereferencing the `Box`
+        //~| HELP consider unboxing the value
         //~| HELP try wrapping
     }
 }
diff --git a/src/test/ui/suggestions/boxed-variant-field.stderr b/src/test/ui/suggestions/boxed-variant-field.stderr
index e865b993a4c..4df8e7b20b7 100644
--- a/src/test/ui/suggestions/boxed-variant-field.stderr
+++ b/src/test/ui/suggestions/boxed-variant-field.stderr
@@ -6,14 +6,14 @@ LL |         Ty::List(elem) => foo(elem),
    |
    = note: expected enum `Ty`
             found struct `Box<Ty>`
-help: try dereferencing the `Box`
-   |
-LL |         Ty::List(elem) => foo(*elem),
-   |                               +
 help: try wrapping the expression in `Ty::List`
    |
 LL |         Ty::List(elem) => foo(Ty::List(elem)),
    |                               +++++++++    +
+help: consider unboxing the value
+   |
+LL |         Ty::List(elem) => foo(*elem),
+   |                               +
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/terr-sorts.stderr b/src/test/ui/terr-sorts.stderr
index 65d90678040..34d4d9eaded 100644
--- a/src/test/ui/terr-sorts.stderr
+++ b/src/test/ui/terr-sorts.stderr
@@ -6,7 +6,7 @@ LL |     want_foo(b);
    |
    = note: expected struct `Foo`
               found struct `Box<Foo>`
-help: try dereferencing the `Box`
+help: consider unboxing the value
    |
 LL |     want_foo(*b);
    |              +