Jacob Pratt
ae9dbf169f
Rollup merge of #132156 - estebank:closure-return, r=Nadrieril,compiler-errors
...
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`
```
CC #111539 .
2025-01-31 00:26:29 -05:00
..
2025-01-26 14:54:01 +00:00
2025-01-23 20:51:29 +08:00
2024-10-10 01:13:29 +02:00
2024-11-27 07:18:25 -08:00
2024-12-27 19:58:16 +11:00
2024-10-20 17:14:53 +08:00
2025-01-23 20:51:29 +08:00
2025-01-28 23:49:02 +09:00
2025-01-22 09:20:57 -08:00
2024-12-27 11:44:23 +01:00
2025-01-22 09:20:57 -08:00
2025-01-28 19:08:50 +00:00
2025-01-23 19:54:23 +01:00
2025-01-30 18:38:42 +00:00
2025-01-24 01:19:50 +00:00
2025-01-06 17:58:30 +00:00
2024-11-27 07:18:25 -08:00
2024-11-26 02:50:48 +08:00
2024-12-05 23:52:21 +00:00
2025-01-23 20:51:29 +08:00
2024-11-26 02:50:48 +08:00
2024-12-04 20:29:36 +00:00
2025-01-23 20:51:29 +08:00
2024-10-29 16:26:57 +00:00
2024-12-20 02:38:46 +08:00
2025-01-29 15:29:49 +01:00
2025-01-23 20:51:29 +08:00
2024-12-31 02:21:17 +00:00
2024-12-07 21:37:13 +00:00
2025-01-06 16:08:29 -08:00
2025-01-06 16:12:11 -08:00
2025-01-27 02:28:04 +01:00
2025-01-26 01:51:15 -05:00
2025-01-30 18:38:42 +00:00
2025-01-27 02:28:04 +01:00
2024-12-27 19:58:16 +11:00
2024-12-12 23:36:27 +00:00
2024-12-12 23:36:27 +00:00
2025-01-25 11:41:21 +00:00
2025-01-23 20:51:29 +08:00
2024-12-28 13:57:13 +11:00
2025-01-07 16:04:14 +01:00
2024-11-02 03:53:59 +00:00
2024-12-04 20:29:35 +00:00
2025-01-28 17:52:28 +00:00
2024-12-27 19:58:16 +11:00
2025-01-30 20:47:07 +01:00
2025-01-27 02:28:04 +01:00
2024-12-25 19:23:48 +11:00
2024-12-27 19:58:16 +11:00
2024-12-02 18:43:37 +01:00
2024-12-09 21:06:29 +08:00
2025-01-20 15:38:07 -06:00
2025-01-24 01:19:50 +00:00
2025-01-18 20:33:15 +00:00
2024-11-27 07:18:25 -08:00
2025-01-24 22:08:39 +00:00
2024-12-09 21:55:01 +00:00
2024-12-18 07:10:55 +01:00
2024-12-10 11:29:43 +08:00
2025-01-25 08:03:37 +01:00
2025-01-29 15:29:49 +01:00
2025-01-24 16:25:43 +01:00
2025-01-06 16:12:04 -08:00
2024-10-29 16:26:57 +00:00
2025-01-21 06:59:15 -07:00
2025-01-24 04:07:10 +00:00
2025-01-11 18:44:12 +00:00
2024-12-22 21:59:27 +01:00
2024-11-26 02:50:48 +08:00
2024-12-15 20:28:16 -08:00
2024-11-23 08:57:25 -07:00
2024-11-26 02:50:48 +08:00
2025-01-27 00:37:34 +01:00
2025-01-25 11:41:21 +00:00
2024-12-26 17:41:43 +00:00
2024-12-27 19:58:16 +11:00
2025-01-24 18:33:00 +01:00
2025-01-23 20:51:29 +08:00
2025-01-23 20:51:29 +08:00
2025-01-24 01:19:50 +00:00
2025-01-25 23:15:22 +01:00
2024-10-05 10:13:18 +02:00
2024-12-30 06:14:26 -08:00
2025-01-25 23:27:01 -05:00
2024-12-12 23:36:27 +00:00
2025-01-22 14:46:41 +00:00
2025-01-10 18:37:57 +00:00
2025-01-24 01:19:50 +00:00
2024-12-19 10:56:31 +00:00
2024-09-13 14:10:56 +03:00
2024-11-26 02:50:48 +08:00
2025-01-27 02:28:04 +01:00
2025-01-29 06:03:23 +01:00
2025-01-23 06:01:36 +00:00
2024-11-23 08:57:25 -07:00
2025-01-23 20:51:29 +08:00
2025-01-30 18:38:42 +00:00
2025-01-24 01:19:50 +00:00
2025-01-27 02:28:04 +01:00
2025-01-25 11:41:21 +00:00
2024-12-27 19:58:16 +11:00
2024-12-31 23:46:39 +08:00
2024-12-31 23:46:39 +08:00
2025-01-11 06:35:21 +02:00
2025-01-27 15:38:29 +01:00
2024-11-27 07:18:25 -08:00
2025-01-09 22:16:51 +00:00
2024-10-08 11:15:24 +08:00
2024-10-29 16:26:57 +00:00
2024-11-03 13:55:52 -08:00
2024-12-17 13:56:10 +11:00
2025-01-24 16:25:43 +01:00
2025-01-07 16:04:14 +01:00
2025-01-08 18:00:26 +00:00
2024-12-27 19:58:16 +11:00
2025-01-27 02:28:49 +01:00
2024-12-15 20:28:16 -08:00
2025-01-27 02:28:04 +01:00
2025-01-24 01:19:50 +00:00
2025-01-22 09:20:57 -08:00
2025-01-21 06:59:15 -07:00
2025-01-27 00:37:34 +01:00
2025-01-27 02:28:04 +01:00
2024-12-13 14:18:41 -08:00
2024-10-30 16:47:47 -07:00
2025-01-23 20:51:29 +08:00
2024-12-27 19:58:16 +11:00
2025-01-07 16:04:14 +01:00
2024-12-07 13:18:05 +11:00
2025-01-29 15:45:13 +00:00
2024-11-26 02:50:48 +08:00
2025-01-23 20:51:29 +08:00
2024-12-27 19:58:16 +11:00
2024-12-12 23:36:27 +00:00
2025-01-25 11:41:21 +00:00
2025-01-23 20:51:29 +08:00
2025-01-23 20:51:29 +08:00
2025-01-03 19:39:39 +00:00
2025-01-25 11:41:21 +00:00
2024-11-22 17:02:04 +11:00
2025-01-28 14:11:29 +00:00
2024-11-16 20:03:31 +00:00
2024-12-07 21:29:58 +00:00
2025-01-22 00:52:27 +00:00
2025-01-24 01:19:50 +00:00
2025-01-06 03:55:19 +00:00
2025-01-28 19:35:51 +00:00
2025-01-30 18:38:42 +00:00
2025-01-27 02:28:04 +01:00
2024-10-29 16:26:57 +00:00
2025-01-23 20:51:29 +08:00
2024-11-26 02:50:48 +08:00
2025-01-07 16:04:14 +01:00
2024-11-04 18:12:48 +01:00
2024-12-12 23:36:27 +00:00
2024-11-26 02:50:48 +08:00
2024-12-27 19:58:16 +11:00
2024-12-27 19:58:16 +11:00
2025-01-23 20:51:29 +08:00
2025-01-23 20:51:29 +08:00
2025-01-26 13:55:59 +00:00
2025-01-27 17:17:22 +00:00
2025-01-30 12:45:18 +01:00
2024-11-03 13:55:52 -08:00
2024-10-19 12:40:12 +00:00
2025-01-21 06:59:15 -07:00
2024-12-27 19:58:16 +11:00
2025-01-28 19:42:32 +03:00
2025-01-19 08:53:02 -07:00
2025-01-23 20:51:29 +08:00
2025-01-06 08:54:27 +01:00
2024-12-09 21:55:12 +00:00
2024-12-14 06:44:05 +00:00
2025-01-23 20:51:29 +08:00
2025-01-27 02:28:04 +01:00
2025-01-17 18:50:29 +00:00
2025-01-09 08:48:00 +00:00
2025-01-10 02:22:57 +01:00
2025-01-25 11:41:21 +00:00
2024-12-12 23:36:27 +00:00
2025-01-27 15:38:29 +01:00
2025-01-27 02:28:04 +01:00
2025-01-23 20:51:29 +08:00
2025-01-24 01:19:50 +00:00
2024-11-27 07:18:25 -08:00
2025-01-27 02:28:04 +01:00
2024-12-17 13:56:10 +11:00
2025-01-27 19:35:53 +01:00
2025-01-27 11:11:27 +00:00
2025-01-23 20:51:29 +08:00
2025-01-23 20:51:29 +08:00
2024-11-23 08:57:25 -07:00
2025-01-23 06:01:36 +00:00
2025-01-27 02:28:04 +01:00
2025-01-18 21:13:27 +00:00
2025-01-27 23:42:47 +00:00
2024-12-23 22:15:32 +00:00
2025-01-22 09:20:57 -08:00
2025-01-01 19:32:51 +00:00
2025-01-23 20:51:29 +08:00
2024-12-08 15:32:04 +08:00
2025-01-23 20:51:29 +08:00
2025-01-27 00:37:34 +01:00
2025-01-23 20:51:29 +08:00
2025-01-28 19:35:51 +00:00
2024-12-27 19:58:16 +11:00
2025-01-06 06:11:06 +00:00
2024-10-29 16:26:57 +00:00
2025-01-28 04:40:42 +01:00
2025-01-23 20:51:29 +08:00
2025-01-29 15:45:13 +00:00
2024-12-25 10:36:32 +01:00
2025-01-23 20:51:29 +08:00
2025-01-24 01:19:50 +00:00
2025-01-01 15:58:29 +01:00
2024-12-07 22:18:51 +00:00
2025-01-29 03:12:19 +01:00
2024-12-12 23:36:27 +00:00
2024-12-27 19:58:16 +11:00
2025-01-27 02:28:04 +01:00
2024-11-02 03:08:04 +00:00
2024-11-02 03:08:04 +00:00
2024-12-07 21:29:58 +00:00
2025-01-29 10:25:55 +00:00
2024-12-07 21:37:15 +00:00
2025-01-27 02:28:04 +01:00
2025-01-29 15:29:41 +01:00
2024-12-13 15:40:37 +00:00
2025-01-06 16:08:29 -08:00
2024-11-27 07:18:25 -08:00
2025-01-06 16:08:29 -08:00
2025-01-27 02:28:04 +01:00
2025-01-22 06:55:38 +00:00
2024-12-18 19:27:44 +00:00
2024-12-07 21:37:13 +00:00
2025-01-22 00:52:27 +00:00
2025-01-24 01:19:50 +00:00
2024-12-15 20:28:16 -08:00
2024-12-22 21:57:57 +00:00
2024-12-07 20:50:00 +00:00
2024-12-06 16:42:09 -05:00
2024-10-29 16:26:57 +00:00
2025-01-21 19:46:20 +00:00
2025-01-11 22:36:25 +01:00
2025-01-23 10:55:01 +00:00
2025-01-22 19:29:43 +01:00
2025-01-22 06:55:38 +00:00
2024-12-12 23:36:27 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-01-23 20:51:29 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-12-27 19:58:16 +11:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-02 14:40:37 -07:00
2024-11-26 02:50:48 +08:00
2024-11-18 08:07:46 +01:00
2024-11-03 13:55:52 -08:00
2024-10-28 14:20:28 +11:00
2024-10-28 14:20:28 +11:00
2024-11-26 02:50:48 +08:00
2025-01-21 06:59:15 -07:00
2024-11-28 14:32:45 -08:00
2024-11-26 02:50:48 +08:00
2024-10-15 13:11:00 +02:00
2025-01-03 05:01:14 +00:00
2024-11-02 03:08:04 +00:00
2025-01-08 00:28:47 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-09-13 14:10:56 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-10-29 16:26:57 +00:00
2024-11-21 03:27:05 -08:00
2024-10-29 16:26:57 +00:00
2025-01-06 03:55:19 +00:00
2025-01-06 03:55:19 +00:00
2024-10-29 16:26:57 +00:00
2024-11-06 20:02:42 +01:00
2024-11-06 20:02:42 +01:00
2024-11-13 20:29:40 -08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-12-07 21:29:58 +00:00
2025-01-16 00:26:55 +01:00
2025-01-23 20:51:29 +08:00
2024-11-26 02:50:48 +08:00
2024-12-02 03:43:50 -07:00
2024-11-12 22:34:31 +01:00
2024-11-23 09:15:25 +01:00
2024-11-14 22:14:11 +09:00
2024-11-23 09:15:25 +01:00
2024-11-23 09:15:25 +01:00
2024-11-23 09:15:25 +01:00
2024-11-24 09:54:04 +01:00
2024-11-24 09:54:04 +01:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-12 22:34:31 +01:00
2024-11-23 09:15:25 +01:00
2025-01-23 20:51:29 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-10-28 14:20:28 +11:00
2024-10-28 14:20:28 +11:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-12-27 19:58:16 +11:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-10-30 16:47:47 -07:00
2025-01-23 20:51:29 +08:00