File tree 2 files changed +27
-0
lines changed
2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -762,17 +762,29 @@ fn write_shared(cx: &Context,
762
762
}
763
763
} ;
764
764
765
+ let mut have_impls = false ;
765
766
let mut implementors = format ! ( r#"implementors["{}"] = ["# , krate. name) ;
766
767
for imp in imps {
767
768
// If the trait and implementation are in the same crate, then
768
769
// there's no need to emit information about it (there's inlining
769
770
// going on). If they're in different crates then the crate defining
770
771
// the trait will be interested in our implementation.
771
772
if imp. def_id . krate == did. krate { continue }
773
+ // If the implementation is from another crate then that crate
774
+ // should add it.
775
+ if !imp. def_id . is_local ( ) { continue }
776
+ have_impls = true ;
772
777
write ! ( implementors, "{}," , as_json( & imp. impl_. to_string( ) ) ) . unwrap ( ) ;
773
778
}
774
779
implementors. push_str ( "];" ) ;
775
780
781
+ // Only create a js file if we have impls to add to it. If the trait is
782
+ // documented locally though we always create the file to avoid dead
783
+ // links.
784
+ if !have_impls && !cache. paths . contains_key ( & did) {
785
+ continue ;
786
+ }
787
+
776
788
let mut mydst = dst. clone ( ) ;
777
789
for part in & remote_path[ ..remote_path. len ( ) - 1 ] {
778
790
mydst. push ( part) ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #![ crate_name = "foo" ]
12
+
13
+ pub use std:: vec:: Vec ;
14
+
15
+ // @!has implementors/core/clone/trait.Clone.js
You can’t perform that action at this time.
0 commit comments