diff options
| author | LeSeulArtichaut <leseulartichaut@gmail.com> | 2021-01-23 18:41:04 +0100 |
|---|---|---|
| committer | LeSeulArtichaut <leseulartichaut@gmail.com> | 2021-01-23 22:02:06 +0100 |
| commit | 20a460e1cf23262b46a7e9672a02c5f07b91eff5 (patch) | |
| tree | 26a945878155ae140c30920fd1719490fdccb627 | |
| parent | 1129e8678038cfc938559b90b4155dde8b84edf3 (diff) | |
| download | rust-20a460e1cf23262b46a7e9672a02c5f07b91eff5.tar.gz rust-20a460e1cf23262b46a7e9672a02c5f07b91eff5.zip | |
Fix rendering of stabilization version for trait implementors
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 8 | ||||
| -rw-r--r-- | src/test/rustdoc/implementor-stable-version.rs | 19 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index f15d43b7b16..bfaadc38763 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -2471,7 +2471,7 @@ fn item_function(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, f: &clean:: fn render_implementor( cx: &Context<'_>, implementor: &Impl, - parent: &clean::Item, + trait_: &clean::Item, w: &mut Buffer, implementor_dups: &FxHashMap<Symbol, (DefId, bool)>, aliases: &[String], @@ -2491,11 +2491,11 @@ fn render_implementor( w, cx, implementor, - parent, + trait_, AssocItemLink::Anchor(None), RenderMode::Normal, - implementor.impl_item.stable_since(cx.tcx()).as_deref(), - implementor.impl_item.const_stable_since(cx.tcx()).as_deref(), + trait_.stable_since(cx.tcx()).as_deref(), + trait_.const_stable_since(cx.tcx()).as_deref(), false, Some(use_absolute), false, diff --git a/src/test/rustdoc/implementor-stable-version.rs b/src/test/rustdoc/implementor-stable-version.rs new file mode 100644 index 00000000000..0a065d8095b --- /dev/null +++ b/src/test/rustdoc/implementor-stable-version.rs @@ -0,0 +1,19 @@ +#![crate_name = "foo"] + +#![feature(staged_api)] + +#[stable(feature = "bar", since = "OLD 1.0")] +pub trait Bar {} + +#[stable(feature = "baz", since = "OLD 1.0")] +pub trait Baz {} + +pub struct Foo; + +// @has foo/trait.Bar.html '//div[@id="implementors-list"]//span[@class="since"]' 'NEW 2.0' +#[stable(feature = "foobar", since = "NEW 2.0")] +impl Bar for Foo {} + +// @!has foo/trait.Baz.html '//div[@id="implementors-list"]//span[@class="since"]' 'OLD 1.0' +#[stable(feature = "foobaz", since = "OLD 1.0")] +impl Baz for Foo {} |
