Skip to content

[rustdoc] Stop showing impl items for negative impls #128923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add regression tests for negative impls not showing their items
  • Loading branch information
GuillaumeGomez committed Aug 10, 2024
commit 5baf7c21cfb872a82714d0f59a78bd37b6db5236
26 changes: 26 additions & 0 deletions tests/rustdoc/negative-impl-no-items.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This test ensures that negative impls don't have items listed inside them.

#![feature(negative_impls)]
#![crate_name = "foo"]

pub struct Thing;

//@ has 'foo/struct.Thing.html'
// We check the full path to ensure there is no `<details>` element.
//@ has - '//div[@id="trait-implementations-list"]/section[@id="impl-Iterator-for-Thing"]/h3' \
// 'impl !Iterator for Thing'
impl !Iterator for Thing {}

// This struct will allow us to compare both paths.
pub struct Witness;

//@ has 'foo/struct.Witness.html'
//@ has - '//div[@id="trait-implementations-list"]/details//section[@id="impl-Iterator-for-Witness"]/h3' \
// 'impl Iterator for Witness'
impl Iterator for Witness {
type Item = u8;

fn next(&mut self) -> Option<Self::Item> {
None
}
}
Loading