about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-08-29 16:25:35 +0200
committerGitHub <noreply@github.com>2021-08-29 16:25:35 +0200
commitb7388024eb287c5d9b299ad25741a6854a010cd6 (patch)
treee9c70b677213bef7aa0a54610ac7df78165a3ff6 /src
parent9ffbd5029454425c012019aa7f06eb4f70bdf343 (diff)
parent672d370764862272735466346e9291dbf3163aeb (diff)
downloadrust-b7388024eb287c5d9b299ad25741a6854a010cd6.tar.gz
rust-b7388024eb287c5d9b299ad25741a6854a010cd6.zip
Rollup merge of #88411 - Aaron1011:remove-session-if-let, r=estebank
Remove `Session.if_let_suggestions`

We can instead if either the LHS or RHS types contain
`TyKind::Error`. In addition to covering the case where
we would have previously updated `if_let_suggestions`, this might
also prevent redundant errors in other cases as well.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/suggestions/if-let-typo.rs1
-rw-r--r--src/test/ui/suggestions/if-let-typo.stderr13
2 files changed, 13 insertions, 1 deletions
diff --git a/src/test/ui/suggestions/if-let-typo.rs b/src/test/ui/suggestions/if-let-typo.rs
index 688b6e82658..b9714b67e58 100644
--- a/src/test/ui/suggestions/if-let-typo.rs
+++ b/src/test/ui/suggestions/if-let-typo.rs
@@ -10,4 +10,5 @@ fn main() {
     if Some(3) = foo {} //~ ERROR mismatched types
     //~^ ERROR destructuring assignments are unstable
     //~^^ ERROR invalid left-hand side of assignment
+    if x = 5 {}  //~ ERROR cannot find value `x` in this scope
 }
diff --git a/src/test/ui/suggestions/if-let-typo.stderr b/src/test/ui/suggestions/if-let-typo.stderr
index 1e23ede7adc..7f71cb48581 100644
--- a/src/test/ui/suggestions/if-let-typo.stderr
+++ b/src/test/ui/suggestions/if-let-typo.stderr
@@ -9,6 +9,17 @@ help: you might have meant to use pattern matching
 LL |     if let Some(x) = foo {}
    |        +++
 
+error[E0425]: cannot find value `x` in this scope
+  --> $DIR/if-let-typo.rs:13:8
+   |
+LL |     if x = 5 {}
+   |        ^ not found in this scope
+   |
+help: you might have meant to use pattern matching
+   |
+LL |     if let x = 5 {}
+   |        +++
+
 error[E0658]: destructuring assignments are unstable
   --> $DIR/if-let-typo.rs:4:16
    |
@@ -79,7 +90,7 @@ error[E0308]: mismatched types
 LL |     if Some(3) = foo {}
    |        ^^^^^^^^^^^^^ expected `bool`, found `()`
 
-error: aborting due to 9 previous errors
+error: aborting due to 10 previous errors
 
 Some errors have detailed explanations: E0070, E0308, E0425, E0658.
 For more information about an error, try `rustc --explain E0070`.