about summary refs log tree commit diff
path: root/src/test/ui/parser
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/parser
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/parser')
-rw-r--r--src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr7
-rw-r--r--src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr22
2 files changed, 18 insertions, 11 deletions
diff --git a/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr
index 34f1397ce1d..85c9fe409db 100644
--- a/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr
+++ b/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr
@@ -116,7 +116,12 @@ error[E0282]: type annotations needed
   --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:14
    |
 LL |         V = [Vec::new; { [0].len() ].len() as isize,
-   |              ^^^^^^^^ cannot infer type for type parameter `T`
+   |              ^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `Vec`
+   |
+help: consider specifying the generic argument
+   |
+LL |         V = [Vec::<T>::new; { [0].len() ].len() as isize,
+   |                 +++++
 
 error: aborting due to 14 previous errors
 
diff --git a/src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr b/src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr
index 427234e97cf..bad241634cb 100644
--- a/src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr
+++ b/src/test/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr
@@ -40,24 +40,26 @@ LL |   let v : Vec<'a> = vec![];
    |                 +
 
 error[E0282]: type annotations needed for `Vec<T>`
-  --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:25
+  --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:7
    |
 LL |   let v : Vec<(u32,_) = vec![];
-   |       -                 ^^^^^^ cannot infer type for type parameter `T`
-   |       |
-   |       consider giving `v` the explicit type `Vec<T>`, where the type parameter `T` is specified
+   |       ^
+   |
+help: consider giving `v` an explicit type, where the type for type parameter `T` is specified
    |
-   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+LL |   let v: Vec<T> : Vec<(u32,_) = vec![];
+   |        ++++++++
 
 error[E0282]: type annotations needed for `Vec<T>`
-  --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:20
+  --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:7
    |
 LL |   let v : Vec<'a = vec![];
-   |       -            ^^^^^^ cannot infer type for type parameter `T`
-   |       |
-   |       consider giving `v` the explicit type `Vec<T>`, where the type parameter `T` is specified
+   |       ^
+   |
+help: consider giving `v` an explicit type, where the type for type parameter `T` is specified
    |
-   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+LL |   let v: Vec<T> : Vec<'a = vec![];
+   |        ++++++++
 
 error: aborting due to 5 previous errors