rust/tests
Guillaume Gomez bd6fb63596
Rollup merge of #145153 - joshtriplett:macro-kinds-plural, r=petrochenkov
Handle macros with multiple kinds, and improve errors

(I recommend reviewing this commit-by-commit.)

Switch to a bitflags `MacroKinds` to support macros with more than one kind

Review everything that uses `MacroKind`, and switch anything that could refer to more than one kind to use `MacroKinds`.

Add a new `SyntaxExtensionKind::MacroRules` for `macro_rules!` macros, using the concrete `MacroRulesMacroExpander` type, and have it track which kinds it can handle. Eliminate the separate optional `attr_ext`, now that a `SyntaxExtension` can handle multiple macro kinds.

This also avoids the need to downcast when calling methods on `MacroRulesMacroExpander`, such as `get_unused_rule`.

Integrate macro kind checking into name resolution's `sub_namespace_match`, so that we only find a macro if it's the right type, and eliminate the special-case hack for attributes.

This allows detecting and report macro kind mismatches early, and more precisely, improving various error messages. In particular, this eliminates the case in `failed_to_match_macro` to check for a function-like invocation of a macro with no function-like rules.

Instead, macro kind mismatches now result in an unresolved macro, and we detect this case in `unresolved_macro_suggestions`, which now carefully distinguishes between a kind mismatch and other errors.

This also handles cases of forward-referenced attributes and cyclic attributes.

----

In this PR, I've minimally fixed up `rustdoc` so that it compiles and passes tests. This is just the minimal necessary fixes to handle the switch to `MacroKinds`, and it only works for macros that don't actually have multiple kinds. This will panic (with a `todo!`) if it encounters a macro with multiple kinds.

rustdoc needs further fixes to handle macros with multiple kinds, and to handle attributes and derive macros that aren't proc macros. I'd appreciate some help from a rustdoc expert on that.

----

r? ````````@petrochenkov````````
2025-08-13 18:43:01 +02:00
..
assembly-llvm Rollup merge of #144962 - Gelbpunkt:aarch64_be-unknown-none-softfloat, r=davidtwco 2025-08-13 18:43:00 +02:00
auxiliary So many test updates x_x 2025-07-20 10:15:14 -07:00
codegen-llvm Auto merge of #145093 - nikic:dead-on-return, r=nnethercote 2025-08-13 04:18:43 +00:00
codegen-units Auto merge of #142893 - Mark-Simulacrum:no-const-collect, r=oli-obk 2025-06-27 12:57:05 +00:00
coverage coverage: Remove all unstable support for MC/DC instrumentation 2025-08-06 22:38:52 +10:00
coverage-run-rustdoc
crashes Rollup merge of #143093 - lqd:polonius-pre-alpha, r=jackh726 2025-08-10 19:45:46 +10:00
debuginfo Revert "Embed GDB pretty printers in rlibs and dylibs" 2025-08-06 18:00:58 +00:00
incremental Bless incremental tests. 2025-07-13 13:50:01 +00:00
mir-opt Rollup merge of #144883 - scottmcm:remove-unneeded-drop_in_place, r=nnethercote 2025-08-09 13:58:44 +10:00
pretty expand: Micro-optimize prelude injection 2025-07-28 17:35:09 +03:00
run-make Fix pgo tests 2025-08-13 09:42:46 +08:00
rustdoc test: Add rustdoc test for enum negative overflow 2025-08-10 23:02:53 +08:00
rustdoc-gui Add GUI regression test for tooltips i icons 2025-08-04 19:17:08 +02:00
rustdoc-js Rollup merge of #145100 - GuillaumeGomez:rank-doc-alias-lower, r=lolbinarycat 2025-08-09 13:58:52 +10:00
rustdoc-js-std Rollup merge of #141658 - lolbinarycat:rustdoc-search-stability-rank-138067, r=GuillaumeGomez 2025-08-09 13:58:42 +10:00
rustdoc-json rustdoc-json: Move #[macro_export] from Other to it's own variant 2025-07-30 19:57:32 +00:00
rustdoc-ui Rollup merge of #144921 - lolbinarycat:rustdoc-intra-doc-gfm-141866, r=fmease,GuillaumeGomez 2025-08-12 20:37:50 +10:00
ui Rollup merge of #145153 - joshtriplett:macro-kinds-plural, r=petrochenkov 2025-08-13 18:43:01 +02:00
ui-fulldeps remove P 2025-08-09 15:47:01 +08:00
COMPILER_TESTS.md