Skip to content

Commit 749b6bf

Browse files
committed
rustdoc.d.ts: add window.{register_implementors,pending_implementors}
1 parent 2e1c8f0 commit 749b6bf

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Diff for: src/librustdoc/html/static/js/main.js

-3
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ function preLoadCss(cssUrl) {
673673
}
674674

675675
// <https://github.com/search?q=repo%3Arust-lang%2Frust+[RUSTDOCIMPL]+trait.impl&type=code>
676-
// @ts-expect-error
677676
window.register_implementors = imp => {
678677
const implementors = document.getElementById("implementors-list");
679678
const synthetic_implementors = document.getElementById("synthetic-implementors-list");
@@ -765,9 +764,7 @@ function preLoadCss(cssUrl) {
765764
}
766765
}
767766
};
768-
// @ts-expect-error
769767
if (window.pending_implementors) {
770-
// @ts-expect-error
771768
window.register_implementors(window.pending_implementors);
772769
}
773770

Diff for: src/librustdoc/html/static/js/rustdoc.d.ts

+17
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ declare global {
4444
* Set up event listeners for a scraped source example.
4545
*/
4646
updateScrapedExample?: function(HTMLElement, HTMLElement),
47+
/**
48+
* register trait implementors, called by code generated in
49+
* `write_shared.rs`
50+
*/
51+
register_implementors?: function(Implementors): void,
52+
/**
53+
* fallback in case `register_implementors` isn't defined yet.
54+
*/
55+
pending_implementors?: Implementors,
4756
}
4857
interface HTMLElement {
4958
/** Used by the popover tooltip code. */
@@ -415,4 +424,12 @@ declare namespace rustdoc {
415424
};
416425

417426
type VlqData = VlqData[] | number;
427+
428+
/**
429+
* Maps from crate names to trait implementation data.
430+
* Provied by generated `trait.impl` files.
431+
*/
432+
type Implementors = {
433+
[key: string]: Array<[string, number, Array<string>]>
434+
}
418435
}

0 commit comments

Comments
 (0)