rust/tests
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
..
assembly tests/assembly/asm: Remove uses of rustc_attrs and lang_items features by using minicore 2024-12-18 02:59:07 +09:00
auxiliary tests/assembly/asm: Remove uses of rustc_attrs and lang_items features by using minicore 2024-12-18 02:59:07 +09:00
codegen Auto merge of #134757 - RalfJung:const_swap, r=scottmcm 2024-12-30 23:46:42 +00:00
codegen-units Use field init shorthand where possible 2024-12-17 14:33:10 -08:00
coverage Add a test for coverage attr on trait function 2024-12-24 00:09:38 +11:00
coverage-run-rustdoc coverage: Restrict empty-span expansion to only cover { and } 2024-11-08 20:43:08 +11:00
crashes taint fcx on selection errors during unsizing 2025-01-02 19:16:00 +01:00
debuginfo Move some things to std::sync::poison and reexport them in std::sync 2025-01-02 15:21:41 +03:00
incremental Add more info on type/trait mismatches for different crate versions 2024-12-07 18:18:08 +00:00
mir-opt MatchBranchSimplification: Consider empty-unreachable otherwise branch 2024-12-27 10:57:46 +00:00
pretty Update tests to use new proc-macro header 2024-11-27 07:18:25 -08:00
run-make Auto merge of #135034 - Noratrieb:strip-correctly, r=jieyouxu 2025-01-03 17:20:39 +00:00
rustdoc chore: fix typos 2024-12-31 23:46:39 +08:00
rustdoc-gui Add GUI test for item info elements color 2024-12-28 20:54:00 +01:00
rustdoc-js Rollup merge of #134277 - notriddle:notriddle/inline-into, r=GuillaumeGomez 2024-12-16 20:00:20 +01:00
rustdoc-js-std rustdoc: treat allowed_through_unstable_modules as deprecation 2025-01-02 12:03:24 -07:00
rustdoc-json Remove rustc::existing_doc_keyword lint. 2024-12-17 13:56:10 +11:00
rustdoc-ui Try to write the panic message with a single write_all call 2025-01-01 15:58:29 +01:00
ui Rollup merge of #135044 - compiler-errors:better-infer-suggestions-in-const, r=oli-obk 2025-01-03 22:12:45 +01:00
ui-fulldeps Rollup merge of #134834 - dtolnay:unnamedcall, r=compiler-errors 2024-12-27 18:43:05 -08:00
COMPILER_TESTS.md