about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
authorEsteban Kuber <esteban@kuber.com.ar>2022-03-08 05:54:38 +0000
committerEsteban Kuber <esteban@kuber.com.ar>2022-03-08 16:32:08 +0000
commit0d92752b8aac53e033541d04fc7d9677d8bca227 (patch)
tree4315f285b95b6288c8fec03ed4f7b77daee4bcf0 /src/test/ui/error-codes
parentb97dc20784698730bd7bc1a20eabdcd32066d174 (diff)
downloadrust-0d92752b8aac53e033541d04fc7d9677d8bca227.tar.gz
rust-0d92752b8aac53e033541d04fc7d9677d8bca227.zip
Suggest `if let`/`let_else` for refutable pat in `let`
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0005.stderr8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr
index 208c625a53e..55b1112b5f8 100644
--- a/src/test/ui/error-codes/E0005.stderr
+++ b/src/test/ui/error-codes/E0005.stderr
@@ -22,8 +22,12 @@ LL | | }
    = note: the matched value is of type `Option<i32>`
 help: you might want to use `if let` to ignore the variant that isn't matched
    |
-LL |     if let Some(y) = x { /* */ }
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL |     let y = if let Some(y) = x { y } else { todo!() };
+   |     ++++++++++                 ++++++++++++++++++++++
+help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched
+   |
+LL |     let Some(y) = x else { todo!() };
+   |                     ++++++++++++++++
 
 error: aborting due to previous error