Skip to content

Commit 1e6a857

Browse files
committed
rustdoc: show auto/blanket docs for tuple and unit
1 parent 9940ed0 commit 1e6a857

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

library/core/src/primitive_docs.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,11 @@ mod prim_char {}
439439
#[stable(feature = "rust1", since = "1.0.0")]
440440
mod prim_unit {}
441441

442+
// Required to make auto trait impls render.
443+
// See /src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
444+
#[doc(hidden)]
445+
impl () {}
446+
442447
#[doc(primitive = "pointer")]
443448
#[doc(alias = "ptr")]
444449
#[doc(alias = "*")]
@@ -949,6 +954,11 @@ mod prim_str {}
949954
#[stable(feature = "rust1", since = "1.0.0")]
950955
mod prim_tuple {}
951956

957+
// Required to make auto trait impls render.
958+
// See /src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
959+
#[doc(hidden)]
960+
impl<T, U> (T, U) {}
961+
952962
#[doc(primitive = "f32")]
953963
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
954964
///

library/std/src/primitive_docs.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,11 @@ mod prim_char {}
439439
#[stable(feature = "rust1", since = "1.0.0")]
440440
mod prim_unit {}
441441

442+
// Required to make auto trait impls render.
443+
// See /src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
444+
#[doc(hidden)]
445+
impl () {}
446+
442447
#[doc(primitive = "pointer")]
443448
#[doc(alias = "ptr")]
444449
#[doc(alias = "*")]
@@ -949,6 +954,11 @@ mod prim_str {}
949954
#[stable(feature = "rust1", since = "1.0.0")]
950955
mod prim_tuple {}
951956

957+
// Required to make auto trait impls render.
958+
// See /src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
959+
#[doc(hidden)]
960+
impl<T, U> (T, U) {}
961+
952962
#[doc(primitive = "f32")]
953963
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
954964
///
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// compile-flags: --crate-type lib --edition 2018
2+
3+
#![crate_name = "foo"]
4+
#![feature(rustdoc_internals)]
5+
6+
// @has foo/primitive.tuple.html '//a[@class="primitive"]' 'tuple'
7+
// @has - '//span[@class="in-band"]' 'Primitive Type tuple'
8+
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
9+
// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
10+
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'Send'
11+
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'Sync'
12+
#[doc(primitive = "tuple")]
13+
/// this is a test!
14+
mod tuple_prim {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// compile-flags: --crate-type lib --edition 2018
2+
3+
#![crate_name = "foo"]
4+
#![feature(rustdoc_internals)]
5+
6+
// @has foo/primitive.unit.html '//a[@class="primitive"]' 'unit'
7+
// @has - '//span[@class="in-band"]' 'Primitive Type unit'
8+
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
9+
// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
10+
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl Send for ()'
11+
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl Sync for ()'
12+
#[doc(primitive = "unit")]
13+
/// this is a test!
14+
mod unit_prim {}

0 commit comments

Comments
 (0)