rust/compiler
Michael Goulet 8ff558b8fc
Rollup merge of #117526 - estebank:issue-24157, r=b-naber
Account for `!` arm in tail `match` expr

On functions with a default return type that influences the coerced type of `match` arms, check if the failing arm is actually of type `!`. If so, suggest changing the return type so the coercion against the prior arms is successful.

```
error[E0308]: `match` arms have incompatible types
  --> $DIR/match-tail-expr-never-type-error.rs:9:13
   |
LL |   fn bar(a: bool) {
   |                  - help: try adding a return type: `-> i32`
LL | /     match a {
LL | |         true => 1,
   | |                 - this is found to be of type `{integer}`
LL | |         false => {
LL | |             never()
   | |             ^^^^^^^
   | |             |
   | |             expected integer, found `()`
   | |             this expression is of type `!`, but it get's coerced to `()` due to its surrounding expression
LL | |         }
LL | |     }
   | |_____- `match` arms have incompatible types
```

Fix #24157.
2023-11-27 19:06:46 -05:00
..
rustc Clean up rustc_*/Cargo.toml. 2023-10-30 08:46:02 +11:00
rustc_abi Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
rustc_arena Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
rustc_ast Detect Python-like slicing and suggest how to fix 2023-11-27 21:48:10 +09:00
rustc_ast_lowering merge DefKind::Coroutine into DefKind::Closure 2023-11-26 21:05:08 +08:00
rustc_ast_passes Use rustc_fluent_macro::fluent_messages! directly. 2023-11-26 08:38:40 +11:00
rustc_ast_pretty Fix some backticks in comments. 2023-11-27 09:38:58 +11:00
rustc_attr Mostly revert "Accept crate name instead of attributes in build_output_filenames" 2023-11-26 18:02:47 +00:00
rustc_baked_icu_data Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
rustc_borrowck Auto merge of #118316 - Mark-Simulacrum:delete-copy-to-upvars, r=cjgillot 2023-11-26 21:47:19 +00:00
rustc_builtin_macros Use rustc_fluent_macro::fluent_messages! directly. 2023-11-26 08:38:40 +11:00
rustc_codegen_cranelift Auto merge of #118279 - bjorn3:sync_cg_clif-2023-11-25, r=bjorn3 2023-11-25 13:08:29 +00:00
rustc_codegen_gcc Use rustc_fluent_macro::fluent_messages! directly. 2023-11-26 08:38:40 +11:00
rustc_codegen_llvm Auto merge of #117947 - Dirbaio:drop-llvm-15, r=cuviper 2023-11-27 21:54:03 +00:00
rustc_codegen_ssa Serialize OutputFilenames into rmeta file 2023-11-26 18:02:42 +00:00
rustc_const_eval rustc: hir().local_def_id_to_hir_id() -> tcx.local_def_id_to_hir_id() cleanup 2023-11-26 12:41:21 +03:00
rustc_data_structures Enforce NonZeroUsize on thread count 2023-11-23 20:10:44 -05:00
rustc_driver Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
rustc_driver_impl Turn write_dep_info into a regular function 2023-11-26 18:02:47 +00:00
rustc_error_codes Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
rustc_error_messages Remove rustc_error_messages/messages.ftl. 2023-11-26 08:37:27 +11:00
rustc_errors Use rustc_fluent_macro::fluent_messages! directly. 2023-11-26 08:38:40 +11:00
rustc_expand Use rustc_fluent_macro::fluent_messages! directly. 2023-11-26 08:38:40 +11:00
rustc_feature Add an experimental feature gate for function delegation 2023-11-23 17:27:31 +03:00
rustc_fluent_macro Add a useful comment. 2023-11-26 08:38:02 +11:00
rustc_fs_util Clean up rustc_*/Cargo.toml. 2023-10-30 08:46:02 +11:00
rustc_graphviz remove unused pub fn 2023-11-23 14:11:02 +03:00
rustc_hir merge DefKind::Coroutine into DefKind::Closure 2023-11-26 21:05:08 +08:00
rustc_hir_analysis Auto merge of #118118 - spastorino:do-not-erase-late-bound-regions-on-iat, r=compiler-errors 2023-11-27 17:11:35 +00:00
rustc_hir_pretty Remove HirId from QPath::LangItem 2023-11-25 18:02:11 +00:00
rustc_hir_typeck Account for ! arm in tail match expr 2023-11-27 16:19:02 +00:00
rustc_incremental Auto merge of #117301 - saethlin:finish-rmeta-encoding, r=WaffleLapkin 2023-11-26 14:43:02 +00:00
rustc_index Replace no_ord_impl with orderable. 2023-11-22 18:38:17 +11:00
rustc_index_macros Put backticks around some attributes in doc comments. 2023-11-27 09:37:01 +11:00
rustc_infer Auto merge of #117200 - rmehri01:repeated_help, r=WaffleLapkin 2023-11-27 19:37:35 +00:00
rustc_interface Auto merge of #117584 - bjorn3:eager_output_filenames, r=b-naber 2023-11-27 00:03:51 +00:00
rustc_lexer Clean up rustc_*/Cargo.toml. 2023-10-30 08:46:02 +11:00
rustc_lint rustc: hir().local_def_id_to_hir_id() -> tcx.local_def_id_to_hir_id() cleanup 2023-11-26 12:41:21 +03:00
rustc_lint_defs Remove --check-cfg checking of --cfg args 2023-11-18 12:21:58 +01:00
rustc_llvm Auto merge of #117947 - Dirbaio:drop-llvm-15, r=cuviper 2023-11-27 21:54:03 +00:00
rustc_log rustc_log: provide a way to init logging based on the values, not names, of the env vars 2023-11-11 15:24:33 +01:00
rustc_macros Unify HashStable implementations 2023-11-21 05:49:45 +00:00
rustc_metadata Auto merge of #118319 - GuillaumeGomez:rollup-vte50yq, r=GuillaumeGomez 2023-11-26 16:42:32 +00:00
rustc_middle Auto merge of #117200 - rmehri01:repeated_help, r=WaffleLapkin 2023-11-27 19:37:35 +00:00
rustc_mir_build Rollup merge of #118311 - bvanjoi:merge_coroutinue_into_closure, r=petrochenkov 2023-11-26 15:44:54 +01:00
rustc_mir_dataflow Rollup merge of #118288 - compiler-errors:is_some_and, r=lqd,dtolnay 2023-11-25 17:23:34 -05:00
rustc_mir_transform Rollup merge of #118311 - bvanjoi:merge_coroutinue_into_closure, r=petrochenkov 2023-11-26 15:44:54 +01:00
rustc_monomorphize merge DefKind::Coroutine into DefKind::Closure 2023-11-26 21:05:08 +08:00
rustc_parse Rollup merge of #111133 - hkmatsumoto:handle-python-slicing, r=TaKO8Ki 2023-11-27 19:06:45 -05:00
rustc_parse_format Auto merge of #117819 - fmease:rustc_parse_format-stable-rustc, r=Nilstrieb 2023-11-15 14:55:35 +00:00
rustc_passes rustc: hir().local_def_id_to_hir_id() -> tcx.local_def_id_to_hir_id() cleanup 2023-11-26 12:41:21 +03:00
rustc_privacy Rollup merge of #118311 - bvanjoi:merge_coroutinue_into_closure, r=petrochenkov 2023-11-26 15:44:54 +01:00
rustc_query_impl rustc: Make def_kind mandatory for all DefIds 2023-11-25 14:49:43 +03:00
rustc_query_system Auto merge of #117301 - saethlin:finish-rmeta-encoding, r=WaffleLapkin 2023-11-26 14:43:02 +00:00
rustc_resolve merge DefKind::Coroutine into DefKind::Closure 2023-11-26 21:05:08 +08:00
rustc_serialize Call FileEncoder::finish in rmeta encoding 2023-11-22 22:49:22 -05:00
rustc_session Serialize OutputFilenames into rmeta file 2023-11-26 18:02:42 +00:00
rustc_smir merge DefKind::Coroutine into DefKind::Closure 2023-11-26 21:05:08 +08:00
rustc_span Rollup merge of #117871 - klensy:unused-pub, r=cjgillot 2023-11-25 19:51:54 +01:00
rustc_symbol_mangling merge DefKind::Coroutine into DefKind::Closure 2023-11-26 21:05:08 +08:00
rustc_target Auto merge of #117947 - Dirbaio:drop-llvm-15, r=cuviper 2023-11-27 21:54:03 +00:00
rustc_trait_selection Auto merge of #117200 - rmehri01:repeated_help, r=WaffleLapkin 2023-11-27 19:37:35 +00:00
rustc_traits Auto merge of #118120 - compiler-errors:closure-kind, r=lcnr 2023-11-22 21:09:01 +00:00
rustc_transmute Update itertools to 0.11. 2023-11-22 08:13:21 +11:00
rustc_ty_utils Rollup merge of #118311 - bvanjoi:merge_coroutinue_into_closure, r=petrochenkov 2023-11-26 15:44:54 +01:00
rustc_type_ir Auto merge of #118120 - compiler-errors:closure-kind, r=lcnr 2023-11-22 21:09:01 +00:00
stable_mir is_{some,ok}_and 2023-11-25 18:47:16 +00:00