rust/compiler
Esteban Küber d3a148fe07 When encountering unexpected closure return type, point at return type/expression
```
error[E0271]: expected `{closure@fallback-closure-wrap.rs:18:40}` to be a closure that returns `()`, but it returns `!`
  --> $DIR/fallback-closure-wrap.rs:19:9
   |
LL |     let error = Closure::wrap(Box::new(move || {
   |                                        -------
LL |         panic!("Can't connect to server.");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `!`
   |
   = note: expected unit type `()`
                   found type `!`
   = note: required for the cast from `Box<{closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47}>` to `Box<dyn FnMut()>`
```

```
error[E0271]: expected `{closure@dont-ice-for-type-mismatch-in-closure-in-async.rs:6:10}` to be a closure that returns `bool`, but it returns `Option<()>`
  --> $DIR/dont-ice-for-type-mismatch-in-closure-in-async.rs:6:16
   |
LL |     call(|| -> Option<()> {
   |     ---- ------^^^^^^^^^^
   |     |          |
   |     |          expected `bool`, found `Option<()>`
   |     required by a bound introduced by this call
   |
   = note: expected type `bool`
              found enum `Option<()>`
note: required by a bound in `call`
  --> $DIR/dont-ice-for-type-mismatch-in-closure-in-async.rs:3:25
   |
LL | fn call(_: impl Fn() -> bool) {}
   |                         ^^^^ required by this bound in `call`
```

```
error[E0271]: expected `{closure@f670.rs:28:13}` to be a closure that returns `Result<(), _>`, but it returns `!`
    --> f670.rs:28:20
     |
28   |     let c = |e| -> ! {
     |             -------^
     |                    |
     |                    expected `Result<(), _>`, found `!`
...
32   |     f().or_else(c);
     |         ------- required by a bound introduced by this call
-Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1433:28
     |
     = note: expected enum `Result<(), _>`
                found type `!`
note: required by a bound in `Result::<T, E>::or_else`
    --> /home/gh-estebank/rust/library/core/src/result.rs:1406:39
     |
1406 |     pub fn or_else<F, O: FnOnce(E) -> Result<T, F>>(self, op: O) -> Result<T, F> {
     |                                       ^^^^^^^^^^^^ required by this bound in `Result::<T, E>::or_else`
```
2025-01-30 18:38:37 +00:00
..
rustc
rustc_abi Auto merge of #135047 - Flakebi:amdgpu-kernel-cc, r=workingjubilee 2025-01-17 04:36:09 +00:00
rustc_arena Add inherent versions of MaybeUninit methods for slices 2025-01-11 23:57:00 -05:00
rustc_ast Refactor FnKind variant to hold &Fn 2025-01-28 11:22:25 -08:00
rustc_ast_ir
rustc_ast_lowering Eliminate PatKind::Path 2025-01-29 15:45:13 +00:00
rustc_ast_passes Refactor FnKind variant to hold &Fn 2025-01-28 11:22:25 -08:00
rustc_ast_pretty Refactor FnKind variant to hold &Fn 2025-01-28 11:22:25 -08:00
rustc_attr_data_structures Rename OptimizeAttr::None to Default 2025-01-24 19:34:01 +00:00
rustc_attr_parsing Run clippy --fix for unnecessary_map_or lint 2025-01-19 19:15:00 +00:00
rustc_baked_icu_data
rustc_borrowck Auto merge of #136038 - compiler-errors:outlives, r=lcnr 2025-01-30 11:40:32 +00:00
rustc_builtin_macros parse_format optimize import use 2025-01-28 19:33:00 +01:00
rustc_codegen_cranelift Auto merge of #134290 - tgross35:windows-i128-callconv, r=bjorn3,wesleywiser 2025-01-28 06:11:13 +00:00
rustc_codegen_gcc ABI-required target features: warn when they are missing in base CPU (rather than silently enabling them) 2025-01-28 04:40:42 +01:00
rustc_codegen_llvm Rollup merge of #136147 - RalfJung:required-target-features-check-not-add, r=workingjubilee 2025-01-29 03:12:21 +01:00
rustc_codegen_ssa Rollup merge of #135748 - compiler-errors:len-2, r=RalfJung,oli-obk 2025-01-28 14:23:22 +01:00
rustc_const_eval Auto merge of #136035 - SpecificProtagonist:miri-zeroed-alloc, r=oli-obk 2025-01-30 01:27:21 +00:00
rustc_data_structures Rollup merge of #136149 - cuviper:rustc-rayon-indexmap, r=compiler-errors 2025-01-28 18:17:29 +01:00
rustc_driver
rustc_driver_impl Make crate AST mutation accessible for driver callback 2025-01-28 19:45:20 +00:00
rustc_error_codes Auto merge of #133154 - estebank:issue-133137, r=wesleywiser 2025-01-25 11:41:21 +00:00
rustc_error_messages
rustc_errors Auto merge of #119286 - jyn514:linker-output, r=bjorn3 2025-01-25 17:16:33 +00:00
rustc_expand Auto merge of #134478 - compiler-errors:attr-span, r=oli-obk 2025-01-22 14:46:41 +00:00
rustc_feature Rollup merge of #134300 - RalfJung:remove-dead-attrs, r=chenyukang 2025-01-25 23:15:22 +01:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Eliminate PatKind::Path 2025-01-29 15:45:13 +00:00
rustc_hir_analysis When encountering unexpected closure return type, point at return type/expression 2025-01-30 18:38:37 +00:00
rustc_hir_pretty Eliminate PatKind::Path 2025-01-29 15:45:13 +00:00
rustc_hir_typeck When encountering unexpected closure return type, point at return type/expression 2025-01-30 18:38:37 +00:00
rustc_incremental
rustc_index Run clippy --fix for unnecessary_map_or lint 2025-01-19 19:15:00 +00:00
rustc_index_macros
rustc_infer Auto merge of #136038 - compiler-errors:outlives, r=lcnr 2025-01-30 11:40:32 +00:00
rustc_interface Rollup merge of #136147 - RalfJung:required-target-features-check-not-add, r=workingjubilee 2025-01-29 03:12:21 +01:00
rustc_lexer
rustc_lint Auto merge of #136038 - compiler-errors:outlives, r=lcnr 2025-01-30 11:40:32 +00:00
rustc_lint_defs Downgrade linker-warnings to allow-by-default 2025-01-26 22:57:20 -05:00
rustc_llvm Make our DIFlags match LLVMDIFlags in the LLVM-C API 2025-01-21 14:41:44 +11:00
rustc_log Avoid naming variables str 2025-01-07 14:30:02 +02:00
rustc_macros Avoid naming variables str 2025-01-07 14:30:02 +02:00
rustc_metadata Make item self/non-self bound naming less whack 2025-01-28 19:08:50 +00:00
rustc_middle Auto merge of #136035 - SpecificProtagonist:miri-zeroed-alloc, r=oli-obk 2025-01-30 01:27:21 +00:00
rustc_mir_build Auto merge of #134248 - oli-obk:patkind-path-removal, r=BoxyUwU 2025-01-29 19:16:29 +00:00
rustc_mir_dataflow Represent the raw pointer for a array length check as a new kind of fake borrow 2025-01-28 00:00:33 +00:00
rustc_mir_transform Rollup merge of #135748 - compiler-errors:len-2, r=RalfJung,oli-obk 2025-01-28 14:23:22 +01:00
rustc_monomorphize Rollup merge of #136168 - fmease:gci-fix-mono, r=compiler-errors 2025-01-29 06:03:23 +01:00
rustc_next_trait_solver Do not assume child bound assumptions for rigid alias 2025-01-28 19:08:50 +00:00
rustc_parse Rollup merge of #133151 - tyrone-wu:trim-fn-ptr-whitespace, r=compiler-errors 2025-01-28 14:23:20 +01:00
rustc_parse_format parse_format optimize import use 2025-01-28 19:33:00 +01:00
rustc_passes When encountering unexpected closure return type, point at return type/expression 2025-01-30 18:38:37 +00:00
rustc_pattern_analysis Get rid of mir::Const::from_ty_const 2025-01-20 04:26:44 +00:00
rustc_privacy Split hir TyKind and ConstArgKind in two and update hir::Visitor 2025-01-23 06:01:36 +00:00
rustc_query_impl don't return an Option from try_find_dep_kind 2025-01-07 21:57:00 +01:00
rustc_query_system Properly note when query stack is being cut off 2025-01-16 19:12:22 +00:00
rustc_resolve Refactor FnKind variant to hold &Fn 2025-01-28 11:22:25 -08:00
rustc_sanitizers Eliminate an unnecessary Symbol::to_string; use as_str 2025-01-07 14:24:47 +02:00
rustc_serialize
rustc_session Auto merge of #133929 - saethlin:remove-inline-in-all-cgus, r=nnethercote 2025-01-28 09:43:03 +00:00
rustc_smir Auto merge of #136035 - SpecificProtagonist:miri-zeroed-alloc, r=oli-obk 2025-01-30 01:27:21 +00:00
rustc_span Rollup merge of #136071 - wowinter13:clippy-add-diagnostic-items, r=flip1995 2025-01-28 18:17:26 +01:00
rustc_symbol_mangling Fix legacy symbol mangling of closures 2025-01-14 16:33:03 +00:00
rustc_target Auto merge of #136227 - fmease:rollup-ewpvznh, r=fmease 2025-01-29 11:27:18 +00:00
rustc_trait_selection When encountering unexpected closure return type, point at return type/expression 2025-01-30 18:38:37 +00:00
rustc_traits Auto merge of #136011 - compiler-errors:query-norm-vaniquishes-us, r=jackh726 2025-01-29 02:12:12 +00:00
rustc_transmute Add TooGeneric variant to LayoutError and emit Unknown one 2025-01-27 00:37:34 +01:00
rustc_ty_utils Add TooGeneric variant to LayoutError and emit Unknown one 2025-01-27 00:37:34 +01:00
rustc_type_ir Do not assume child bound assumptions for rigid alias 2025-01-28 19:08:50 +00:00
rustc_type_ir_macros
stable_mir Represent the raw pointer for a array length check as a new kind of fake borrow 2025-01-28 00:00:33 +00:00