about summary refs log tree commit diff
path: root/tests/ui/let-else
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/let-else')
-rw-r--r--tests/ui/let-else/let-else-ref-bindings.stderr16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/let-else/let-else-ref-bindings.stderr b/tests/ui/let-else/let-else-ref-bindings.stderr
index ada1805e725..7093b5fa9af 100644
--- a/tests/ui/let-else/let-else-ref-bindings.stderr
+++ b/tests/ui/let-else/let-else-ref-bindings.stderr
@@ -6,6 +6,10 @@ LL |     let Some(ref a): Option<&[u8]> = some else { return };
    |
    = note: expected enum `Option<&[u8]>`
               found enum `Option<Vec<u8>>`
+help: try using `.as_deref()` to convert `Option<Vec<u8>>` to `Option<&[u8]>`
+   |
+LL |     let Some(ref a): Option<&[u8]> = some.as_deref() else { return };
+   |                                          +++++++++++
 
 error[E0308]: mismatched types
   --> $DIR/let-else-ref-bindings.rs:20:38
@@ -15,6 +19,10 @@ LL |     let Some(ref a): Option<&[u8]> = &some else { return };
    |
    = note:   expected enum `Option<&[u8]>`
            found reference `&Option<Vec<u8>>`
+help: try using `.as_deref()` to convert `&Option<Vec<u8>>` to `Option<&[u8]>`
+   |
+LL |     let Some(ref a): Option<&[u8]> = &some.as_deref() else { return };
+   |                                           +++++++++++
 
 error[E0308]: mismatched types
   --> $DIR/let-else-ref-bindings.rs:24:34
@@ -26,6 +34,10 @@ LL |     let Some(a): Option<&[u8]> = some else { return };
    |
    = note: expected enum `Option<&[u8]>`
               found enum `Option<Vec<u8>>`
+help: try using `.as_deref()` to convert `Option<Vec<u8>>` to `Option<&[u8]>`
+   |
+LL |     let Some(a): Option<&[u8]> = some.as_deref() else { return };
+   |                                      +++++++++++
 
 error[E0308]: mismatched types
   --> $DIR/let-else-ref-bindings.rs:27:34
@@ -37,6 +49,10 @@ LL |     let Some(a): Option<&[u8]> = &some else { return };
    |
    = note:   expected enum `Option<&[u8]>`
            found reference `&Option<Vec<u8>>`
+help: try using `.as_deref()` to convert `&Option<Vec<u8>>` to `Option<&[u8]>`
+   |
+LL |     let Some(a): Option<&[u8]> = &some.as_deref() else { return };
+   |                                       +++++++++++
 
 error[E0308]: mismatched types
   --> $DIR/let-else-ref-bindings.rs:44:46