rust/compiler
bors e0e70c0c2c Auto merge of #90677 - bobrippling:suggest-tuple-parens, r=camelid
Suggest tuple-parentheses for enum variants

This follows on from #86493 / #86481, making the parentheses suggestion. To summarise, given the following code:

```rust
fn f() -> Option<(i32, i8)> {
    Some(1, 2)
}
```

The current output is:

```
error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
 --> b.rs:2:5
  |
2 |     Some(1, 2)
  |     ^^^^ -  - supplied 2 arguments
  |     |
  |     expected 1 argument

error: aborting due to previous error

For more information about this error, try `rustc --explain E0061`.
```

With this change, `rustc` will now suggest parentheses when:
- The callee is expecting a single tuple argument
- The number of arguments passed matches the element count in the above tuple
- The arguments' types match the tuple's fields

```
error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
 --> b.rs:2:5
  |
2 |     Some(1, 2)
  |     ^^^^ -  - supplied 2 arguments
  |
help: use parentheses to construct a tuple
  |
2 |     Some((1, 2))
  |          +    +
```
2022-01-28 09:46:22 +00:00
..
rustc
rustc_apfloat
rustc_arena Clarify ArenaAllocatable's second parameter. 2022-01-28 07:37:10 +11:00
rustc_ast
rustc_ast_lowering Filter out local_id == 0, those are already considered on the call site 2022-01-26 12:25:31 -03:00
rustc_ast_passes
rustc_ast_pretty try apply rustc_pass_by_value to Span 2022-01-27 11:29:41 +01:00
rustc_attr
rustc_borrowck Auto merge of #93095 - Aaron1011:remove-assoc-ident, r=cjgillot 2022-01-25 18:53:45 +00:00
rustc_builtin_macros
rustc_codegen_cranelift
rustc_codegen_gcc
rustc_codegen_llvm Rollup merge of #93269 - jacobbramley:dev/pauth-option-1, r=petrochenkov 2022-01-25 05:51:14 +01:00
rustc_codegen_ssa
rustc_const_eval
rustc_data_structures Rollup merge of #93193 - Kobzol:stable-hash-permutation-test, r=the8472 2022-01-27 22:32:24 +01:00
rustc_driver
rustc_error_codes
rustc_errors
rustc_expand
rustc_feature update pass_by_value 2022-01-27 07:58:33 +01:00
rustc_fs_util
rustc_graphviz
rustc_hir Store hir_id_to_def_id in OwnerInfo. 2022-01-25 15:05:19 -03:00
rustc_hir_pretty try apply rustc_pass_by_value to Span 2022-01-27 11:29:41 +01:00
rustc_incremental
rustc_index
rustc_infer Auto merge of #93095 - Aaron1011:remove-assoc-ident, r=cjgillot 2022-01-25 18:53:45 +00:00
rustc_interface
rustc_lexer
rustc_lint Rollup merge of #93363 - lcnr:pass-by-value, r=petrochenkov 2022-01-27 22:32:29 +01:00
rustc_lint_defs
rustc_llvm Use error-on-mismatch policy for PAuth module flags. 2022-01-24 16:50:10 +00:00
rustc_log
rustc_macros
rustc_metadata Auto merge of #88679 - petrochenkov:doctrscope, r=GuillaumeGomez 2022-01-26 09:10:27 +00:00
rustc_middle try apply rustc_pass_by_value to Span 2022-01-27 11:29:41 +01:00
rustc_mir_build Ignore unwinding edges when checking for unconditional recursion 2022-01-26 13:46:01 +01:00
rustc_mir_dataflow
rustc_mir_transform try apply rustc_pass_by_value to Span 2022-01-27 11:29:41 +01:00
rustc_monomorphize
rustc_parse Introduce a limit to Levenshtein distance computation 2022-01-26 12:38:22 +01:00
rustc_parse_format
rustc_passes
rustc_plugin_impl
rustc_privacy
rustc_query_impl
rustc_query_system
rustc_resolve rustdoc: Pre-calculate traits that are in scope for doc links 2022-01-25 21:45:21 +08:00
rustc_save_analysis
rustc_serialize Auto merge of #90842 - pierwill:localdefid-indexmap, r=wesleywiser 2022-01-24 22:04:55 +00:00
rustc_session
rustc_span Rollup merge of #93363 - lcnr:pass-by-value, r=petrochenkov 2022-01-27 22:32:29 +01:00
rustc_symbol_mangling Auto merge of #93095 - Aaron1011:remove-assoc-ident, r=cjgillot 2022-01-25 18:53:45 +00:00
rustc_target
rustc_trait_selection Auto merge of #93343 - lqd:attrs, r=spastorino 2022-01-28 06:28:08 +00:00
rustc_traits
rustc_ty_utils
rustc_type_ir
rustc_typeck Auto merge of #90677 - bobrippling:suggest-tuple-parens, r=camelid 2022-01-28 09:46:22 +00:00