Skip to content

Commit 5baf7c2

Browse files
Add regression tests for negative impls not showing their items
1 parent 6a90be3 commit 5baf7c2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Diff for: tests/rustdoc/negative-impl-no-items.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// This test ensures that negative impls don't have items listed inside them.
2+
3+
#![feature(negative_impls)]
4+
#![crate_name = "foo"]
5+
6+
pub struct Thing;
7+
8+
//@ has 'foo/struct.Thing.html'
9+
// We check the full path to ensure there is no `<details>` element.
10+
//@ has - '//div[@id="trait-implementations-list"]/section[@id="impl-Iterator-for-Thing"]/h3' \
11+
// 'impl !Iterator for Thing'
12+
impl !Iterator for Thing {}
13+
14+
// This struct will allow us to compare both paths.
15+
pub struct Witness;
16+
17+
//@ has 'foo/struct.Witness.html'
18+
//@ has - '//div[@id="trait-implementations-list"]/details//section[@id="impl-Iterator-for-Witness"]/h3' \
19+
// 'impl Iterator for Witness'
20+
impl Iterator for Witness {
21+
type Item = u8;
22+
23+
fn next(&mut self) -> Option<Self::Item> {
24+
None
25+
}
26+
}

0 commit comments

Comments
 (0)