rust/compiler
Matthias Krüger 3379721a30
Rollup merge of #91021 - compiler-errors:print_future_output, r=estebank
Elaborate `Future::Output` when printing opaque `impl Future` type

I would love to see the `Output =` type when printing type errors involving opaque `impl Future`.

[Test code](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a800b481edd31575fbcaf5771a9c3678)

Before (cut relevant part of output):
```
note: while checking the return type of the `async fn`
 --> /home/michael/test.rs:5:19
  |
5 | async fn bar() -> usize {
  |                   ^^^^^ checked the `Output` of this `async fn`, found opaque type
  = note:     expected type `usize`
          found opaque type `impl Future`
```

After:
```
note: while checking the return type of the `async fn`
 --> /home/michael/test.rs:5:19
  |
5 | async fn bar() -> usize {
  |                   ^^^^^ checked the `Output` of this `async fn`, found opaque type
  = note:     expected type `usize`
          found opaque type `impl Future<Output = usize>`
```

Note the "found opaque type `impl Future<Output = usize>`" in the new output.

----

Questions:
1. We skip printing the output type when it's a projection, since I have been seeing some types like `impl Future<Output = <[static generator@/home/michael/test.rs:2:11: 2:21] as Generator<ResumeTy>>::Return>` which are not particularly helpful and leak implementation detail.
    * Am I able to normalize this type within `rustc_middle::ty::print::pretty`? Alternatively, can we normalize it when creating the diagnostic? Otherwise, I'm fine with skipping it and falling back to the old output.
    * Should I suppress any other types? I didn't encounter anything other than this generator projection type.
2. Not sure what the formatting of this should be. Do I include spaces in `Output = `?
2021-11-20 10:21:16 +01:00
..
rustc
rustc_apfloat
rustc_arena Add some comments. 2021-11-19 07:52:59 +11:00
rustc_ast
rustc_ast_lowering Rollup merge of #90990 - nnethercote:arenas-cleanup, r=oli-obk 2021-11-19 13:06:38 +09:00
rustc_ast_passes
rustc_ast_pretty
rustc_attr
rustc_borrowck Rollup merge of #90801 - b-naber:missing_normalization_equate_inputs_output, r=jackh726 2021-11-16 15:59:39 +09:00
rustc_builtin_macros
rustc_codegen_cranelift
rustc_codegen_gcc
rustc_codegen_llvm Auto merge of #90382 - alexcrichton:wasm64-libstd, r=joshtriplett 2021-11-18 17:19:27 +00:00
rustc_codegen_ssa Rollup merge of #90900 - andjo403:removeLlvm12Check, r=nikic 2021-11-17 15:58:05 +01:00
rustc_const_eval Auto merge of #90535 - tmiasko:clone-from, r=oli-obk 2021-11-20 04:12:03 +00:00
rustc_data_structures
rustc_driver
rustc_error_codes
rustc_errors
rustc_expand
rustc_feature rustc: Remove #[rustc_synthetic] 2021-11-18 14:32:29 +08:00
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #90990 - nnethercote:arenas-cleanup, r=oli-obk 2021-11-19 13:06:38 +09:00
rustc_hir_pretty
rustc_incremental
rustc_index
rustc_infer Rollup merge of #90884 - Nilstrieb:fix-span-trivial-trait-bound, r=estebank 2021-11-17 15:58:04 +01:00
rustc_interface Auto merge of #90329 - nbdd0121:typeck, r=nagisa 2021-11-19 03:00:46 +00:00
rustc_lexer
rustc_lint
rustc_lint_defs
rustc_llvm
rustc_macros
rustc_metadata
rustc_middle Rollup merge of #91021 - compiler-errors:print_future_output, r=estebank 2021-11-20 10:21:16 +01:00
rustc_mir_build Rollup merge of #90925 - krasimirgg:rustc_mir_build_fix, r=petrochenkov 2021-11-16 15:59:42 +09:00
rustc_mir_dataflow
rustc_mir_transform
rustc_monomorphize
rustc_parse Inline printable function 2021-11-16 08:06:31 +00:00
rustc_parse_format
rustc_passes Rollup merge of #89610 - guswynn:must_use_future, r=wesleywiser 2021-11-17 15:57:56 +01:00
rustc_plugin_impl
rustc_privacy
rustc_query_impl
rustc_query_system
rustc_resolve Rollup merge of #90930 - Nilstrieb:fix-non-const-value-ice, r=estebank 2021-11-20 10:21:14 +01:00
rustc_save_analysis
rustc_serialize
rustc_session Auto merge of #90329 - nbdd0121:typeck, r=nagisa 2021-11-19 03:00:46 +00:00
rustc_span Rollup merge of #90930 - Nilstrieb:fix-non-const-value-ice, r=estebank 2021-11-20 10:21:14 +01:00
rustc_symbol_mangling
rustc_target Auto merge of #90382 - alexcrichton:wasm64-libstd, r=joshtriplett 2021-11-18 17:19:27 +00:00
rustc_trait_selection rustc: Remove #[rustc_synthetic] 2021-11-18 14:32:29 +08:00
rustc_traits
rustc_ty_utils
rustc_type_ir
rustc_typeck Rollup merge of #90575 - m-ou-se:compatible-variant-improvements, r=estebank 2021-11-20 10:21:12 +01:00