From 857a18735f99e6e3e520a2e3330643e74df797ba Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 27 Oct 2025 15:58:56 +0100 Subject: [PATCH 1/2] rustdoc search: Include attribute and derive macros when filtering on "macros" --- src/librustdoc/html/static/js/search.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 337c973a2c84f..0a73d32dac2de 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -3904,6 +3904,8 @@ class DocSearch { return name === "primitive" || name === "associatedtype"; case "trait": return name === "traitalias"; + case "macro": + return name === "attr" || name === "derive"; } // No match From 52c99e6d0dd40b1331d24fc5b71910e7e0de6e5e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 27 Oct 2025 16:00:32 +0100 Subject: [PATCH 2/2] Add regression test for including derive macros in macro filtering --- tests/rustdoc-js-std/filter-macro-attr-derive.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/rustdoc-js-std/filter-macro-attr-derive.js diff --git a/tests/rustdoc-js-std/filter-macro-attr-derive.js b/tests/rustdoc-js-std/filter-macro-attr-derive.js new file mode 100644 index 0000000000000..4c8ec77030b42 --- /dev/null +++ b/tests/rustdoc-js-std/filter-macro-attr-derive.js @@ -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' }, + ], +};