diff options
| author | bors <bors@rust-lang.org> | 2022-04-01 14:57:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-01 14:57:45 +0000 |
| commit | 99da9aec246e6b500a4e589e4b9096306bb89b07 (patch) | |
| tree | a7970727498950f449826e42bc65af553eefaec9 /src | |
| parent | 0677edc86e342f333d4828b0ee1ef395a4e70fe5 (diff) | |
| parent | a92286f9c92d7dc6189bf56c8fa0487bb51d2298 (diff) | |
| download | rust-99da9aec246e6b500a4e589e4b9096306bb89b07.tar.gz rust-99da9aec246e6b500a4e589e4b9096306bb89b07.zip | |
Auto merge of #95558 - matthiaskrgr:rollup-vpmk7t8, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #95475 (rustdoc: Only show associated consts from inherent impls in sidebar) - #95516 (ptr_metadata test: avoid ptr-to-int transmutes) - #95528 (skip slow int_log tests in Miri) - #95531 (expand: Do not count metavar declarations on RHS of `macro_rules`) - #95532 (make utf8_char_counts test faster in Miri) - #95546 (add notes about alignment-altering reallocations to Allocator docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 1 | ||||
| -rw-r--r-- | src/test/rustdoc/associated-consts.rs | 28 |
2 files changed, 25 insertions, 4 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 93b33b0d609..0cfe12abcd1 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1987,6 +1987,7 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) { let used_links_bor = &mut used_links; let mut assoc_consts = v .iter() + .filter(|i| i.inner_impl().trait_.is_none()) .flat_map(|i| get_associated_constants(i.inner_impl(), used_links_bor)) .collect::<Vec<_>>(); if !assoc_consts.is_empty() { diff --git a/src/test/rustdoc/associated-consts.rs b/src/test/rustdoc/associated-consts.rs index da50fb86cd5..9319a073bb7 100644 --- a/src/test/rustdoc/associated-consts.rs +++ b/src/test/rustdoc/associated-consts.rs @@ -9,8 +9,8 @@ pub trait Trait { pub struct Bar; // @has 'foo/struct.Bar.html' -// @has - '//h3[@class="sidebar-title"]' 'Associated Constants' -// @has - '//div[@class="sidebar-elems"]//a' 'FOO' +// @!has - '//h3[@class="sidebar-title"]' 'Associated Constants' +// @!has - '//div[@class="sidebar-elems"]//a' 'FOO' impl Trait for Bar { const FOO: u32 = 1; @@ -22,10 +22,30 @@ pub enum Foo { } // @has 'foo/enum.Foo.html' -// @has - '//h3[@class="sidebar-title"]' 'Associated Constants' -// @has - '//div[@class="sidebar-elems"]//a' 'FOO' +// @!has - '//h3[@class="sidebar-title"]' 'Associated Constants' +// @!has - '//div[@class="sidebar-elems"]//a' 'FOO' impl Trait for Foo { const FOO: u32 = 1; fn foo() {} } + +pub struct Baz; + +// @has 'foo/struct.Baz.html' +// @has - '//h3[@class="sidebar-title"]' 'Associated Constants' +// @has - '//div[@class="sidebar-elems"]//a' 'FOO' +impl Baz { + pub const FOO: u32 = 42; +} + +pub enum Quux { + B, +} + +// @has 'foo/enum.Quux.html' +// @has - '//h3[@class="sidebar-title"]' 'Associated Constants' +// @has - '//div[@class="sidebar-elems"]//a' 'FOO' +impl Quux { + pub const FOO: u32 = 42; +} |
