about summary refs log tree commit diff
path: root/src/test/ui/error-codes
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/error-codes
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/error-codes')
-rw-r--r--src/test/ui/error-codes/E0282.stderr7
-rw-r--r--src/test/ui/error-codes/E0283.stderr11
-rw-r--r--src/test/ui/error-codes/E0401.stderr9
3 files changed, 14 insertions, 13 deletions
diff --git a/src/test/ui/error-codes/E0282.stderr b/src/test/ui/error-codes/E0282.stderr
index 0f610a5e42f..d01aa3617c7 100644
--- a/src/test/ui/error-codes/E0282.stderr
+++ b/src/test/ui/error-codes/E0282.stderr
@@ -2,7 +2,12 @@ error[E0282]: type annotations needed
   --> $DIR/E0282.rs:2:9
    |
 LL |     let x = "hello".chars().rev().collect();
-   |         ^ consider giving `x` a type
+   |         ^
+   |
+help: consider giving `x` an explicit type
+   |
+LL |     let x: _ = "hello".chars().rev().collect();
+   |          +++
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/error-codes/E0283.stderr b/src/test/ui/error-codes/E0283.stderr
index e2bab486064..a107160d11a 100644
--- a/src/test/ui/error-codes/E0283.stderr
+++ b/src/test/ui/error-codes/E0283.stderr
@@ -10,10 +10,7 @@ error[E0283]: type annotations needed
   --> $DIR/E0283.rs:35:24
    |
 LL |     let bar = foo_impl.into() * 1u32;
-   |               ---------^^^^--
-   |               |        |
-   |               |        cannot infer type for type parameter `T` declared on the trait `Into`
-   |               this method call resolves to `T`
+   |                        ^^^^
    |
 note: multiple `impl`s satisfying `Impl: Into<_>` found
   --> $DIR/E0283.rs:17:1
@@ -23,10 +20,10 @@ LL | impl Into<u32> for Impl {
    = note: and another `impl` found in the `core` crate:
            - impl<T, U> Into<U> for T
              where U: From<T>;
-help: use the fully qualified path for the potential candidate
+help: try using a fully qualified path to specify the expected types
    |
-LL |     let bar = <Impl as Into<u32>>::into(foo_impl) * 1u32;
-   |               ++++++++++++++++++++++++++        ~
+LL |     let bar = <Impl as Into<T>>::into(foo_impl) * 1u32;
+   |               ++++++++++++++++++++++++        ~
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/error-codes/E0401.stderr b/src/test/ui/error-codes/E0401.stderr
index e58c9d3116a..81715621dd9 100644
--- a/src/test/ui/error-codes/E0401.stderr
+++ b/src/test/ui/error-codes/E0401.stderr
@@ -36,13 +36,12 @@ error[E0282]: type annotations needed
   --> $DIR/E0401.rs:11:5
    |
 LL |     bfnr(x);
-   |     ^^^^ cannot infer type for type parameter `U` declared on the function `bfnr`
+   |     ^^^^ cannot infer type of the type parameter `U` declared on the function `bfnr`
    |
-help: type parameter declared here
-  --> $DIR/E0401.rs:4:13
+help: consider specifying the generic arguments
    |
-LL |     fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) {
-   |             ^
+LL |     bfnr::<U, V, W>(x);
+   |         +++++++++++
 
 error: aborting due to 4 previous errors