about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2018-02-15 18:45:52 -0500
committerAaron Hill <aa1ronham@gmail.com>2018-02-18 16:29:25 -0500
commit64a1f6fbfda65afe45ccbb5f5c2e78011048afd6 (patch)
treee2647af2e4a1a5bf9ee48651a978f762e9e0051e /src
parent94fd4f360bacce672a6ec576331a7600edcd6d51 (diff)
downloadrust-64a1f6fbfda65afe45ccbb5f5c2e78011048afd6.tar.gz
rust-64a1f6fbfda65afe45ccbb5f5c2e78011048afd6.zip
Fix inlining
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render.rs9
-rw-r--r--src/librustdoc/html/static/main.js11
2 files changed, 15 insertions, 5 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index dea5c60740b..37b7c6c07b0 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -2451,6 +2451,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
         <ul class='item-list' id='synthetic-implementors-list'>
     ";
 
+    let mut synthetic_types = Vec::new();
+
     if let Some(implementors) = cache.implementors.get(&it.def_id) {
         // The DefId is for the first Type found with that name. The bool is
         // 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,
         if t.auto {
             write!(w, "{}", synthetic_impl_header)?;
             for implementor in synthetic {
+                synthetic_types.extend(
+                    collect_paths_for_type(implementor.inner_impl().for_.clone())
+                );
                 render_implementor(cx, implementor, w, &implementor_dups)?;
             }
             write!(w, "</ul>")?;
@@ -2516,13 +2521,13 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
         write!(w, "{}", impl_header)?;
         write!(w, "</ul>")?;
 
-        write!(w, r#"<script type="text/javascript">window.inlined_types=new Set();</script>"#)?;
-
         if t.auto {
             write!(w, "{}", synthetic_impl_header)?;
             write!(w, "</ul>")?;
         }
     }
+    write!(w, r#"<script type="text/javascript">window.inlined_types=new Set({});</script>"#,
+            as_json(&synthetic_types))?;
 
     write!(w, r#"<script type="text/javascript" async
                          src="{root_path}/implementors/{path}/{ty}.{name}.js">
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 0894d33f44f..5c674cabde5 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -1565,6 +1565,7 @@
     window.register_implementors = function(imp) {
         var implementors = document.getElementById('implementors-list');
         var synthetic_implementors = document.getElementById('synthetic-implementors-list');
+
         var libs = Object.getOwnPropertyNames(imp);
         for (var i = 0; i < libs.length; ++i) {
             if (libs[i] === currentCrate) { continue; }
@@ -1573,11 +1574,15 @@
             struct_loop:
             for (var j = 0; j < structs.length; ++j) {
                 var struct = structs[j];
+
                 var list = struct.synthetic ? synthetic_implementors : implementors;
 
-                for (var k = 0; k < struct.types.length; k++) {
-                    if (window.inlined_types.has(struct.types[k])) {
-                        continue struct_loop;
+                if (struct.synthetic) {
+                    for (var k = 0; k < struct.types.length; k++) {
+                        if (window.inlined_types.has(struct.types[k])) {
+                            continue struct_loop;
+                        }
+                        window.inlined_types.add(struct.types[k]);
                     }
                 }