Rollup merge of #148176 - GuillaumeGomez:filter-macros, r=notriddle

[rustdoc] Include attribute and derive macros when filtering on "macros"

As discussed [here](https://github.com/rust-lang/rust/pull/147909), some filters should have been "grouped". This PR allows attribute and derive macros to match the `macro` filter.

I'll wait for https://github.com/rust-lang/rust/pull/148005 to add more tests as it would require a proc-macro library for now.

r? ```@notriddle```
This commit is contained in:
Jacob Pratt
2025-10-30 02:43:45 -04:00
committed by GitHub
2 changed files with 11 additions and 0 deletions

View File

@@ -3904,6 +3904,8 @@ class DocSearch {
return name === "primitive" || name === "associatedtype"; return name === "primitive" || name === "associatedtype";
case "trait": case "trait":
return name === "traitalias"; return name === "traitalias";
case "macro":
return name === "attr" || name === "derive";
} }
// No match // No match

View File

@@ -0,0 +1,9 @@
// This test ensures that filtering on "macro" will also include attribute and derive
// macros.
const EXPECTED = {
'query': 'macro:debug',
'others': [
{ 'path': 'std::fmt', 'name': 'Debug', 'href': '../std/fmt/derive.Debug.html' },
],
};