Matthias Krüger
12cc9b4b6f
Rollup merge of #135044 - compiler-errors:better-infer-suggestions-in-const, r=oli-obk
...
Improve infer (`_`) suggestions in `const`s and `static`s
Fixes https://github.com/rust-lang/rust/issues/135010 .
This PR does a few things to (imo) greatly improve the error message when users write something like `static FOO: [i32; _] = [1, 2, 3]`.
Firstly, it adapts the recovery code for when we encounter `_` in a const/static to work a bit more like `fn foo() -> _`, and removes the somewhat redundant query `diagnostic_only_typeck`.
Secondly, it changes the lowering for `[T; _]` to always lower under the `feature(generic_arg_infer)` logic to `ConstArgKind::Infer`. We still issue the feature error, so it's not doing anything *observable* on the good path, but it does mean that we no longer erroneously interpret `[T; _]`'s array length as a `_` **wildcard expression** (à la destructuring assignment, like `(_, y) = expr`).
Lastly it makes the suggestions verbose and fixes (well, suppresses) a bug with stashing and suggestions.
r? oli-obk
2025-01-03 22:12:45 +01:00
..
2024-11-12 02:54:03 +00:00
2024-02-16 20:02:50 +00:00
2024-11-19 05:07:43 +00:00
2024-02-16 20:02:50 +00:00
2024-11-02 03:08:04 +00:00
2024-12-12 23:36:27 +00:00
2025-01-02 23:39:17 +00:00
2025-01-01 15:58:29 +01:00
2024-10-14 20:24:30 +02:00
2024-12-15 22:18:09 -08:00
2024-03-20 17:29:58 +00:00
2024-12-18 16:35:06 +01:00
2024-11-02 03:08:04 +00:00
2024-06-05 20:08:00 -04:00
2024-09-29 23:40:43 -05:00
2024-09-29 23:40:43 -05:00
2024-09-20 09:41:16 +08:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-07-09 07:44:17 +00:00
2024-07-09 07:44:17 +00:00
2024-01-09 21:08:16 +00:00
2024-01-09 21:08:16 +00:00
2024-11-02 03:08:04 +00:00
2024-02-16 20:02:50 +00:00
2024-03-01 02:03:00 +00:00
2024-01-23 15:23:22 +00:00
2024-01-23 15:23:22 +00:00
2024-09-12 13:56:01 -04:00
2024-09-12 13:56:01 -04:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-11-03 18:59:31 +00:00
2024-11-27 03:34:58 +00:00
2024-11-27 03:34:58 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-11-24 03:32:11 +00:00
2024-02-16 20:02:50 +00:00
2024-03-21 00:03:59 +00:00
2024-02-14 11:00:30 +00:00
2024-02-16 20:02:50 +00:00
2023-11-30 20:59:51 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-09-29 23:40:43 -05:00
2024-09-29 23:40:43 -05:00
2024-09-29 23:40:43 -05:00
2024-02-16 20:02:50 +00:00
2024-09-29 23:40:43 -05:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-06-05 22:25:42 +01:00
2024-06-05 22:25:42 +01:00
2024-06-05 22:25:42 +01:00
2024-07-17 11:01:29 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-08-18 00:07:41 +02:00
2024-02-16 20:02:50 +00:00
2024-08-03 07:57:31 -04:00
2023-12-24 01:58:13 +08:00
2024-09-29 23:40:43 -05:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-07 10:42:01 +08:00
2024-03-21 00:03:59 +00:00
2024-02-16 20:02:50 +00:00
2024-06-12 12:34:47 +00:00
2024-02-16 20:02:50 +00:00
2024-11-12 21:36:42 +00:00
2024-11-12 21:36:42 +00:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-09-29 23:40:43 -05:00
2024-03-21 00:03:59 +00:00
2024-02-16 20:02:50 +00:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-09-29 23:40:43 -05:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-09-29 23:40:43 -05:00
2024-07-17 11:01:29 +01:00
2023-11-24 19:15:52 +01:00
2024-11-24 03:32:11 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-12-02 10:38:42 +01:00
2024-09-29 23:40:43 -05:00
2023-11-24 19:15:52 +01:00
2024-03-21 20:36:13 +01:00
2024-03-21 20:36:13 +01:00
2024-02-16 20:02:50 +00:00
2024-07-22 22:51:53 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-09-29 23:40:43 -05:00
2024-07-17 11:01:29 +01:00
2024-07-22 22:51:53 +00:00
2024-07-22 22:51:53 +00:00
2024-09-07 09:23:28 +08:00
2024-02-18 19:16:17 -03:00
2024-02-16 20:02:50 +00:00
2024-02-01 16:18:03 +01:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-10-26 11:35:56 +08:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-11-21 01:35:34 +00:00
2024-11-21 01:35:34 +00:00
2024-02-16 20:02:50 +00:00
2024-07-11 20:39:24 +00:00
2024-02-16 20:02:50 +00:00
2024-09-29 23:40:43 -05:00
2024-09-29 23:40:43 -05:00
2024-05-14 20:28:55 +08:00
2024-05-14 20:28:55 +08:00
2024-06-19 04:41:56 +00:00
2024-06-19 04:41:56 +00:00
2024-12-23 22:15:32 +00:00
2024-12-23 22:15:32 +00:00
2024-12-23 22:15:32 +00:00
2024-11-23 23:31:30 +00:00
2024-11-23 23:31:30 +00:00
2024-04-04 15:02:27 +00:00
2024-04-04 15:02:27 +00:00
2024-06-12 08:53:59 +00:00
2024-10-04 23:38:41 +00:00
2023-11-30 20:59:51 +01:00
2024-02-16 20:02:50 +00:00
2023-11-30 20:59:51 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-06-19 14:58:29 +00:00
2024-02-16 20:02:50 +00:00
2024-06-28 10:18:20 -04:00
2024-09-29 23:40:43 -05:00
2024-02-16 20:02:50 +00:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-09-29 23:40:43 -05:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-09-29 23:40:43 -05:00
2024-07-17 11:01:29 +01:00
2024-07-16 19:27:28 -07:00
2024-07-16 19:27:28 -07:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2024-09-29 23:40:43 -05:00
2024-07-17 11:01:29 +01:00
2024-07-17 11:01:29 +01:00
2023-11-24 19:15:52 +01:00
2024-07-09 07:44:17 +00:00
2024-07-09 07:44:17 +00:00
2024-02-16 20:02:50 +00:00
2024-07-17 11:01:29 +01:00
2024-09-29 23:40:43 -05:00
2024-07-17 11:01:29 +01:00
2024-12-27 19:58:16 +11:00
2024-12-27 12:42:07 +11:00
2024-03-21 10:45:30 +00:00
2024-08-03 07:57:31 -04:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-09-12 13:56:01 -04:00
2024-09-12 13:56:01 -04:00
2024-06-05 22:25:42 +01:00
2024-06-05 22:25:42 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-06-19 14:58:29 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-01 16:18:03 +01:00
2024-02-01 16:18:03 +01:00
2024-11-19 05:07:43 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-09-24 10:12:05 -04:00
2024-09-24 10:12:05 -04:00
2024-11-19 05:07:43 +00:00