about summary refs log tree commit diff
path: root/src/test/ui/pattern
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-03 12:37:16 +0000
committerbors <bors@rust-lang.org>2022-06-03 12:37:16 +0000
commite40d5e83dc133d093c22c7ff016b10daa4f40dcf (patch)
treedc2a28093b19836d6f14e25763b33904e9d12186 /src/test/ui/pattern
parent72f7e3144a386c820c188350092d2d93a74889b8 (diff)
parentb343a466c650cd43d81b7fc98d3571eda64fe35b (diff)
downloadrust-e40d5e83dc133d093c22c7ff016b10daa4f40dcf.tar.gz
rust-e40d5e83dc133d093c22c7ff016b10daa4f40dcf.zip
Auto merge of #89862 - lcnr:path-generics-diagnostics, r=estebank
rewrite error handling for unresolved inference vars

Pretty much completely rewrites `fn emit_inference_failure_err`.

This new setup should hopefully be easier to extend and is already a lot better when looking for generic arguments.
Because this is a rewrite there are still some parts which are lacking, these are tracked in #94483 and will be fixed in later PRs.

r? `@estebank` `@petrochenkov`
Diffstat (limited to 'src/test/ui/pattern')
-rw-r--r--src/test/ui/pattern/pat-tuple-bad-type.rs4
-rw-r--r--src/test/ui/pattern/pat-tuple-bad-type.stderr11
-rw-r--r--src/test/ui/pattern/rest-pat-semantic-disallowed.stderr7
3 files changed, 14 insertions, 8 deletions
diff --git a/src/test/ui/pattern/pat-tuple-bad-type.rs b/src/test/ui/pattern/pat-tuple-bad-type.rs
index 01e793e8685..98481167a59 100644
--- a/src/test/ui/pattern/pat-tuple-bad-type.rs
+++ b/src/test/ui/pattern/pat-tuple-bad-type.rs
@@ -1,8 +1,8 @@
 fn main() {
-    let x;
+    let x; //~ ERROR type annotations needed
 
     match x {
-        (..) => {} //~ ERROR type annotations needed
+        (..) => {}
         _ => {}
     }
 
diff --git a/src/test/ui/pattern/pat-tuple-bad-type.stderr b/src/test/ui/pattern/pat-tuple-bad-type.stderr
index 598b6a3794e..11b28987848 100644
--- a/src/test/ui/pattern/pat-tuple-bad-type.stderr
+++ b/src/test/ui/pattern/pat-tuple-bad-type.stderr
@@ -1,13 +1,14 @@
 error[E0282]: type annotations needed
-  --> $DIR/pat-tuple-bad-type.rs:5:9
+  --> $DIR/pat-tuple-bad-type.rs:2:9
    |
 LL |     let x;
-   |         - consider giving `x` a type
-...
-LL |         (..) => {}
-   |         ^^^^ cannot infer type
+   |         ^
    |
    = note: type must be known at this point
+help: consider giving `x` an explicit type
+   |
+LL |     let x: _;
+   |          +++
 
 error[E0308]: mismatched types
   --> $DIR/pat-tuple-bad-type.rs:10:9
diff --git a/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr b/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr
index 06b6e80b44f..e6a4e5f19b7 100644
--- a/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr
+++ b/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr
@@ -189,7 +189,12 @@ error[E0282]: type annotations needed
   --> $DIR/rest-pat-semantic-disallowed.rs:33:9
    |
 LL |     let x @ ..;
-   |         ^^^^^^ consider giving this pattern a type
+   |         ^^^^^^
+   |
+help: consider giving this pattern a type
+   |
+LL |     let x @ ..: _;
+   |               +++
 
 error: aborting due to 23 previous errors