diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-06-01 11:30:53 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-06-02 09:18:26 -0700 |
| commit | 287af7fa1a2230b25d2ffe98c5cc623ad34c6287 (patch) | |
| tree | b5812cb4e3725ca17dc854d5bcc333d20e0d539d | |
| parent | e1e8db7e4a69825720fb1ae4478b6d29b447d994 (diff) | |
| download | rust-287af7fa1a2230b25d2ffe98c5cc623ad34c6287.tar.gz rust-287af7fa1a2230b25d2ffe98c5cc623ad34c6287.zip | |
rustdoc: Deduplicate lists of implementors
Inlining caused implementors to show up multiple times. cc #14584
| -rw-r--r-- | src/librustdoc/html/render.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 16becde164f..2caedbc2c1c 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -108,6 +108,7 @@ pub enum ExternalLocation { /// Metadata about an implementor of a trait. pub struct Implementor { + def_id: ast::DefId, generics: clean::Generics, trait_: clean::Type, for_: clean::Type, @@ -531,6 +532,11 @@ fn write_shared(cx: &Context, try!(write!(&mut f, r"implementors['{}'] = [", krate.name)); for imp in imps.iter() { + // If the trait and implementation are in the same crate, then + // there's no need to emit information about it (there's inlining + // going on). If they're in different crates then the crate defining + // the trait will be interested in our implementation. + if imp.def_id.krate == did.krate { continue } try!(write!(&mut f, r#""impl{} {} for {}","#, imp.generics, imp.trait_, imp.for_)); } @@ -759,6 +765,7 @@ impl DocFolder for Cache { Vec::new() }); v.push(Implementor { + def_id: item.def_id, generics: i.generics.clone(), trait_: i.trait_.get_ref().clone(), for_: i.for_.clone(), |
