diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index b475e6418a7..26639a85601 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -673,7 +673,6 @@ function preLoadCss(cssUrl) {
}
//
- // @ts-expect-error
window.register_implementors = imp => {
const implementors = document.getElementById("implementors-list");
const synthetic_implementors = document.getElementById("synthetic-implementors-list");
@@ -765,9 +764,7 @@ function preLoadCss(cssUrl) {
}
}
};
- // @ts-expect-error
if (window.pending_implementors) {
- // @ts-expect-error
window.register_implementors(window.pending_implementors);
}
diff --git a/src/librustdoc/html/static/js/rustdoc.d.ts b/src/librustdoc/html/static/js/rustdoc.d.ts
index def0bd4f71e..4504642480b 100644
--- a/src/librustdoc/html/static/js/rustdoc.d.ts
+++ b/src/librustdoc/html/static/js/rustdoc.d.ts
@@ -44,6 +44,15 @@ declare global {
* Set up event listeners for a scraped source example.
*/
updateScrapedExample?: function(HTMLElement, HTMLElement),
+ /**
+ * register trait implementors, called by code generated in
+ * `write_shared.rs`
+ */
+ register_implementors?: function(Implementors): void,
+ /**
+ * fallback in case `register_implementors` isn't defined yet.
+ */
+ pending_implementors?: Implementors,
}
interface HTMLElement {
/** Used by the popover tooltip code. */
@@ -415,4 +424,12 @@ declare namespace rustdoc {
};
type VlqData = VlqData[] | number;
+
+ /**
+ * Maps from crate names to trait implementation data.
+ * Provied by generated `trait.impl` files.
+ */
+ type Implementors = {
+ [key: string]: Array<[string, number, Array]>
+ }
}