rust/tests
Nicholas Nethercote 9f089e080c Add {ast,hir,thir}::PatKind::Missing variants.
"Missing" patterns are possible in bare fn types (`fn f(u32)`) and
similar places. Currently these are represented in the AST with
`ast::PatKind::Ident` with no `by_ref`, no `mut`, an empty ident, and no
sub-pattern. This flows through to `{hir,thir}::PatKind::Binding` for
HIR and THIR.

This is a bit nasty. It's very non-obvious, and easy to forget to check
for the exceptional empty identifier case.

This commit adds a new variant, `PatKind::Missing`, to do it properly.

The process I followed:
- Add a `Missing` variant to `{ast,hir,thir}::PatKind`.
- Chang `parse_param_general` to produce `ast::PatKind::Missing`
  instead of `ast::PatKind::Missing`.
- Look through `kw::Empty` occurrences to find functions where an
  existing empty ident check needs replacing with a `PatKind::Missing`
  check: `print_param`, `check_trait_item`, `is_named_param`.
- Add a `PatKind::Missing => unreachable!(),` arm to every exhaustive
  match identified by the compiler.
- Find which arms are actually reachable by running the test suite,
  changing them to something appropriate, usually by looking at what
  would happen to a `PatKind::Ident`/`PatKind::Binding` with no ref, no
  `mut`, an empty ident, and no subpattern.

Quite a few of the `unreachable!()` arms were never reached. This makes
sense because `PatKind::Missing` can't happen in every pattern, only
in places like bare fn tys and trait fn decls.

I also tried an alternative approach: modifying `ast::Param::pat` to
hold an `Option<P<Pat>>` instead of a `P<Pat>`, but that quickly turned
into a very large and painful change. Adding `PatKind::Missing` is much
easier.
2025-03-28 09:18:57 +11:00
..
assembly Auto merge of #133984 - DaniPopes:scmp-ucmp, r=scottmcm 2025-03-24 22:53:12 +00:00
auxiliary tests: use minicore more 2025-02-24 09:26:54 +00:00
codegen Rollup merge of #138818 - khuey:138198, r=jieyouxu 2025-03-26 19:40:28 +11:00
codegen-units Remove -Zinline-in-all-cgus and clean up CGU partitioning tests 2025-01-27 23:48:47 -05:00
coverage coverage: Add some more cases to tests/coverage/holes.rs 2025-02-19 13:56:20 +11:00
coverage-run-rustdoc
crashes Auto merge of #138719 - lcnr:concrete_opaque_types-closures, r=oli-obk 2025-03-22 06:55:52 +00:00
debuginfo Rollup merge of #137967 - mustartt:fix-aix-test-hangs, r=workingjubilee 2025-03-11 13:30:50 +01:00
incremental Rollup merge of #130883 - madsmtm:env-var-query, r=petrochenkov 2025-03-27 15:57:21 +11:00
mir-opt Rollup merge of #138135 - scottmcm:chaining-ord, r=Mark-Simulacrum 2025-03-23 20:44:09 -04:00
pretty Rollup merge of #138627 - EnzymeAD:autodiff-cleanups, r=oli-obk 2025-03-21 15:48:55 +01:00
run-make Rollup merge of #138652 - ferrocene:pa-remote-test-rmake, r=jieyouxu 2025-03-25 15:36:32 +09:00
rustdoc rustdoc: be more strict about "Methods from Deref" 2025-03-22 12:47:05 -05:00
rustdoc-gui Rollup merge of #137539 - GuillaumeGomez:copy-content-tests, r=notriddle 2025-02-25 13:07:34 +01:00
rustdoc-js
rustdoc-js-std Remove the common prelude module 2025-02-11 13:04:27 -08:00
rustdoc-json rustdoc: Use own logic to print #[repr(..)] attributes in JSON output. 2025-03-22 18:47:12 +00:00
rustdoc-ui Rollup merge of #138877 - TaKO8Ki:enable-per-target-ignores-for-doctests, r=notriddle 2025-03-25 20:34:48 -04:00
ui Add {ast,hir,thir}::PatKind::Missing variants. 2025-03-28 09:18:57 +11:00
ui-fulldeps Rollup merge of #138964 - compiler-errors:usage-of-interner, r=lcnr 2025-03-27 15:57:24 +11:00
COMPILER_TESTS.md