diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 21c1eb631e0..b6d90091bba 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -891,8 +891,10 @@ so that we can apply CSS-filters to change the arrow color in themes */
color: var(--search-results-grey-color);
}
.search-results .result-name .typename {
+ display: inline-block;
color: var(--search-results-grey-color);
font-size: 0.875rem;
+ width: 6.25rem;
}
.popover {
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index 452348dc865..b8cc0a6db71 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -52,9 +52,9 @@ const longItemTypes = [
"enum variant",
"macro",
"primitive type",
- "associated type",
+ "assoc type",
"constant",
- "associated constant",
+ "assoc const",
"union",
"foreign type",
"keyword",
diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml
index afb3a44be30..6593c1a9c45 100644
--- a/tests/rustdoc-gui/search-result-display.goml
+++ b/tests/rustdoc-gui/search-result-display.goml
@@ -14,7 +14,8 @@ set-window-size: (600, 100)
assert-size: (".search-results div.desc", {"width": 566})
// The result set is all on one line.
-assert-css: (".search-results .result-name > span", {"display": "inline"})
+assert-css: (".search-results .result-name > span:not(.typename)", {"display": "inline"})
+assert-css: (".search-results .result-name > span.typename", {"display": "inline-block"})
// Check that the crate filter `