Skip to content

Commit e067470

Browse files
committed
Fix inlining
1 parent 16c1a1e commit e067470

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
@@ -2651,6 +2651,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
26512651
<ul class='item-list' id='synthetic-implementors-list'>
26522652
";
26532653

2654+
let mut synthetic_types = Vec::new();
2655+
26542656
if let Some(implementors) = cache.implementors.get(&it.def_id) {
26552657
// The DefId is for the first Type found with that name. The bool is
26562658
// if any Types with the same name but different DefId have been found.
@@ -2706,6 +2708,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
27062708
if t.auto {
27072709
write!(w, "{}", synthetic_impl_header)?;
27082710
for implementor in synthetic {
2711+
synthetic_types.extend(
2712+
collect_paths_for_type(implementor.inner_impl().for_.clone())
2713+
);
27092714
render_implementor(cx, implementor, w, &implementor_dups)?;
27102715
}
27112716
write!(w, "</ul>")?;
@@ -2716,13 +2721,13 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
27162721
write!(w, "{}", impl_header)?;
27172722
write!(w, "</ul>")?;
27182723

2719-
write!(w, r#"<script type="text/javascript">window.inlined_types=new Set();</script>"#)?;
2720-
27212724
if t.auto {
27222725
write!(w, "{}", synthetic_impl_header)?;
27232726
write!(w, "</ul>")?;
27242727
}
27252728
}
2729+
write!(w, r#"<script type="text/javascript">window.inlined_types=new Set({});</script>"#,
2730+
as_json(&synthetic_types))?;
27262731

27272732
write!(w, r#"<script type="text/javascript" async
27282733
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
@@ -1564,6 +1564,7 @@
15641564
window.register_implementors = function(imp) {
15651565
var implementors = document.getElementById('implementors-list');
15661566
var synthetic_implementors = document.getElementById('synthetic-implementors-list');
1567+
15671568
var libs = Object.getOwnPropertyNames(imp);
15681569
for (var i = 0; i < libs.length; ++i) {
15691570
if (libs[i] === currentCrate) { continue; }
@@ -1572,11 +1573,15 @@
15721573
struct_loop:
15731574
for (var j = 0; j < structs.length; ++j) {
15741575
var struct = structs[j];
1576+
15751577
var list = struct.synthetic ? synthetic_implementors : implementors;
15761578

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

0 commit comments

Comments
 (0)