]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr
Suggest `if let`/`let_else` for refutable pat in `let`
[rust.git] / src / test / ui / recursion / recursive-types-are-not-uninhabited.stderr
index ded3cf3ad1d44ab24ed3bd39afea4f634b965b7d..a9159562d9d512858354816138493869f75349e5 100644 (file)
@@ -21,8 +21,12 @@ LL | | }
    = note: the matched value is of type `Result<u32, &R>`
 help: you might want to use `if let` to ignore the variant that isn't matched
    |
-LL |     if let Ok(x) = res { /* */ }
+LL |     let x = if let Ok(x) = res { x } else { todo!() };
+   |     ++++++++++                 ++++++++++++++++++++++
+help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched
    |
+LL |     let Ok(x) = res else { todo!() };
+   |                     ++++++++++++++++
 
 error: aborting due to previous error