diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index b01afa02b8b..1ef41d62e5e 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -170,6 +170,7 @@ impl Serialize for IndexItemFunctionType {
_ => seq.serialize_element(&self.inputs)?,
}
match &self.output[..] {
+ [] => {}
[one] if one.generics.is_none() => seq.serialize_element(one)?,
_ => seq.serialize_element(&self.output)?,
}
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index a766dd68e10..46fab7ee57b 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -1910,7 +1910,7 @@ function initSearch(rawSearchIndex) {
output = buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA], lowercasePaths);
}
} else {
- output = null;
+ output = [];
}
return {
inputs, output,