diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-01-03 22:12:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-03 22:12:45 +0100 |
| commit | 12cc9b4b6fb6787e8a1c726827dbcfdba647f737 (patch) | |
| tree | 7f0f8ba444a5a1366feaf1c515b92f7db61055bf /compiler/rustc_codegen_llvm/src | |
| parent | f0c03f640adba4566d820c520da86092c0d03557 (diff) | |
| parent | 0fd64efa2f3677ca0f1f0f970b31474a5218f0b8 (diff) | |
| download | rust-12cc9b4b6fb6787e8a1c726827dbcfdba647f737.tar.gz rust-12cc9b4b6fb6787e8a1c726827dbcfdba647f737.zip | |
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
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
