Skip to content

Commit 52a49d9

Browse files
committed
rustdoc: Add test for impl_trait_in_accos_type
1 parent e60ebb2 commit 52a49d9

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// ignore-tidy-linelength
2+
#![feature(impl_trait_in_assoc_type)]
3+
4+
pub struct AlwaysTrue;
5+
6+
/// impl IntoIterator
7+
impl IntoIterator for AlwaysTrue {
8+
//@ set Item = '$.index[*][?(@.docs=="type Item")].id'
9+
/// type Item
10+
type Item = bool;
11+
12+
//@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.default.impl_trait[*]' 1
13+
//@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.default.impl_trait[0].trait_bound.trait.name' '"Iterator"'
14+
//@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.default.impl_trait[0].trait_bound.trait.args.angle_bracketed.bindings[*]' 1
15+
//@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.default.impl_trait[0].trait_bound.trait.args.angle_bracketed.bindings[0].name' '"Item"'
16+
//@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.default.impl_trait[0].trait_bound.trait.args.angle_bracketed.bindings[0].binding.equality.type.primitive' '"bool"'
17+
18+
//@ set IntoIter = '$.index[*][?(@.docs=="type IntoIter")].id'
19+
/// type IntoIter
20+
type IntoIter = impl Iterator<Item = bool>;
21+
22+
//@ set into_iter = '$.index[*][?(@.docs=="fn into_iter")].id'
23+
/// fn into_iter
24+
fn into_iter(self) -> Self::IntoIter {
25+
std::iter::repeat(true)
26+
}
27+
}
28+
29+
//@ ismany '$.index[*][?(@.docs=="impl IntoIterator")].inner.impl.items[*]' $Item $IntoIter $into_iter
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(impl_trait_in_assoc_type)]
2+
3+
pub struct AlwaysTrue;
4+
5+
//@ has impl_trait_in_assoc_type/struct.AlwaysTrue.html
6+
7+
impl IntoIterator for AlwaysTrue {
8+
type Item = bool;
9+
10+
//@ has - '//*[@id="associatedtype.IntoIter"]//h4[@class="code-header"]' \
11+
// 'type IntoIter = impl Iterator<Item = bool>'
12+
type IntoIter = impl Iterator<Item = bool>;
13+
14+
fn into_iter(self) -> Self::IntoIter {
15+
std::iter::repeat(true)
16+
}
17+
}

0 commit comments

Comments
 (0)