diff options
| author | Ralf Jung <post@ralfj.de> | 2022-08-31 14:29:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-31 14:29:51 +0200 |
| commit | 775e96970fa5c4af239becc16c78c8a37e8b25e9 (patch) | |
| tree | 14f464d8d8fdfc50c6da0033722a469f406c12f7 /src/test | |
| parent | 12e4fd0755d7d976d4ee0f2004dc938290752ff7 (diff) | |
| parent | 477b7ba1657986a31b60ccf149011c037ef649d1 (diff) | |
| download | rust-775e96970fa5c4af239becc16c78c8a37e8b25e9.tar.gz rust-775e96970fa5c4af239becc16c78c8a37e8b25e9.zip | |
Rollup merge of #90946 - GuillaumeGomez:def-id-remove-weird-case, r=Manishearth
Ignore `reference`s in "Type::inner_def_id" Fixes #90775. Reopening of #90726. As discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/rendering.20for.20reference.20primitive.20doc.20page), the reference page shouldn't list these implementations (since they are listed on the types and on the traits in any case). And more generally, you don't implement something on a reference but on something behind a reference. I think it's the important point. So currently it looks like this:  With this PR, only the implementations over generics behind a reference are kept. You can test it [here](https://rustdoc.crud.net/imperio/def-id-remove-weird-case/std/primitive.reference.html). cc ``@camelid``
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/rustdoc/primitive-reference.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/test/rustdoc/primitive-reference.rs b/src/test/rustdoc/primitive-reference.rs new file mode 100644 index 00000000000..5c119340609 --- /dev/null +++ b/src/test/rustdoc/primitive-reference.rs @@ -0,0 +1,37 @@ +#![crate_name = "foo"] + +#![feature(rustdoc_internals)] + +// @has foo/index.html +// @has - '//h2[@id="primitives"]' 'Primitive Types' +// @has - '//a[@href="primitive.reference.html"]' 'reference' +// @has - '//div[@class="sidebar-elems"]//li/a' 'Primitive Types' +// @has - '//div[@class="sidebar-elems"]//li/a/@href' '#primitives' +// @has foo/primitive.reference.html +// @has - '//a[@class="primitive"]' 'reference' +// @has - '//span[@class="in-band"]' 'Primitive Type reference' +// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' + +// There should be only one implementation listed. +// @count - '//*[@class="impl has-srclink"]' 1 +// @has - '//*[@id="impl-Foo%3C%26A%3E-for-%26B"]/*[@class="code-header in-band"]' \ +// 'impl<A, B> Foo<&A> for &B' +#[doc(primitive = "reference")] +/// this is a test! +mod reference {} + +pub struct Bar; + +// This implementation should **not** show up. +impl<T> From<&T> for Bar { + fn from(s: &T) -> Self { + Bar + } +} + +pub trait Foo<T> { + fn stuff(&self, other: &T) {} +} + +// This implementation should show up. +impl<A, B> Foo<&A> for &B {} |
