diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2022-05-06 20:05:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-06 20:05:43 +0200 |
| commit | bcfb95afd394610ffd97fca7dbef7ac92b782dbe (patch) | |
| tree | b0deb15996850e118a819f3dba82beeac035e00e /src/librustdoc/html/static | |
| parent | 28d85ab8c485efb8475b04ee5436453e4e1029bb (diff) | |
| parent | bd11e22203c0d7bb87375a3a39c53649af50593c (diff) | |
| download | rust-bcfb95afd394610ffd97fca7dbef7ac92b782dbe.tar.gz rust-bcfb95afd394610ffd97fca7dbef7ac92b782dbe.zip | |
Rollup merge of #96754 - notriddle:notriddle/impl-dups, r=GuillaumeGomez
rustdoc: ensure HTML/JS side implementors don't have dups Fixes #94641 Rendered: - https://notriddle.com/notriddle-rustdoc-test/impl-dups/std/iter/trait.Iterator.html - https://notriddle.com/notriddle-rustdoc-test/impl-dups/core/iter/trait.Iterator.html
Diffstat (limited to 'src/librustdoc/html/static')
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 66a7d484f33..2d8339e8394 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -759,8 +759,14 @@ function loadCss(cssFileName) { const traitName = document.querySelector("h1.fqn > .in-band > .trait").textContent; const baseIdName = "impl-" + traitName + "-"; const libs = Object.getOwnPropertyNames(imp); + // We don't want to include impls from this JS file, when the HTML already has them. + // The current crate should always be ignored. Other crates that should also be + // ignored are included in the attribute `data-ignore-extern-crates`. + const ignoreExternCrates = document + .querySelector("script[data-ignore-extern-crates]") + .getAttribute("data-ignore-extern-crates"); for (const lib of libs) { - if (lib === window.currentCrate) { + if (lib === window.currentCrate || ignoreExternCrates.indexOf(lib) !== -1) { continue; } const structs = imp[lib]; |
