Skip to content

Commit 64a1f6f

Browse files
committed
Fix inlining
1 parent 94fd4f3 commit 64a1f6f

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/librustdoc/html/render.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,6 +2451,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
24512451
<ul class='item-list' id='synthetic-implementors-list'>
24522452
";
24532453

2454+
let mut synthetic_types = Vec::new();
2455+
24542456
if let Some(implementors) = cache.implementors.get(&it.def_id) {
24552457
// The DefId is for the first Type found with that name. The bool is
24562458
// if any Types with the same name but different DefId have been found.
@@ -2506,6 +2508,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
25062508
if t.auto {
25072509
write!(w, "{}", synthetic_impl_header)?;
25082510
for implementor in synthetic {
2511+
synthetic_types.extend(
2512+
collect_paths_for_type(implementor.inner_impl().for_.clone())
2513+
);
25092514
render_implementor(cx, implementor, w, &implementor_dups)?;
25102515
}
25112516
write!(w, "</ul>")?;
@@ -2516,13 +2521,13 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
25162521
write!(w, "{}", impl_header)?;
25172522
write!(w, "</ul>")?;
25182523

2519-
write!(w, r#"<script type="text/javascript">window.inlined_types=new Set();</script>"#)?;
2520-
25212524
if t.auto {
25222525
write!(w, "{}", synthetic_impl_header)?;
25232526
write!(w, "</ul>")?;
25242527
}
25252528
}
2529+
write!(w, r#"<script type="text/javascript">window.inlined_types=new Set({});</script>"#,
2530+
as_json(&synthetic_types))?;
25262531

25272532
write!(w, r#"<script type="text/javascript" async
25282533
src="{root_path}/implementors/{path}/{ty}.{name}.js">

src/librustdoc/html/static/main.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,7 @@
15651565
window.register_implementors = function(imp) {
15661566
var implementors = document.getElementById('implementors-list');
15671567
var synthetic_implementors = document.getElementById('synthetic-implementors-list');
1568+
15681569
var libs = Object.getOwnPropertyNames(imp);
15691570
for (var i = 0; i < libs.length; ++i) {
15701571
if (libs[i] === currentCrate) { continue; }
@@ -1573,11 +1574,15 @@
15731574
struct_loop:
15741575
for (var j = 0; j < structs.length; ++j) {
15751576
var struct = structs[j];
1577+
15761578
var list = struct.synthetic ? synthetic_implementors : implementors;
15771579

1578-
for (var k = 0; k < struct.types.length; k++) {
1579-
if (window.inlined_types.has(struct.types[k])) {
1580-
continue struct_loop;
1580+
if (struct.synthetic) {
1581+
for (var k = 0; k < struct.types.length; k++) {
1582+
if (window.inlined_types.has(struct.types[k])) {
1583+
continue struct_loop;
1584+
}
1585+
window.inlined_types.add(struct.types[k]);
15811586
}
15821587
}
15831588

0 commit comments

Comments
 (0)