Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4304d1d

Browse files
Update rustdoc tests
1 parent 803e35a commit 4304d1d

25 files changed

+77
-52
lines changed

src/test/rustdoc-gui/src/lib2/lib.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,30 @@ pub struct LongItemInfo2;
143143
/// Some docs.
144144
#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
145145
impl SimpleTrait for LongItemInfo2 {}
146+
147+
pub struct WhereWhitespace<T>;
148+
149+
impl<T> WhereWhitespace<T> {
150+
pub fn new<F>(f: F) -> Self
151+
where
152+
F: FnMut() -> i32,
153+
{}
154+
}
155+
156+
impl<K, T> Whitespace<&K> for WhereWhitespace<T>
157+
where
158+
K: std::fmt::Debug,
159+
{
160+
type Output = WhereWhitespace<T>;
161+
fn index(&self, _key: &K) -> &Self::Output {
162+
self
163+
}
164+
}
165+
166+
pub trait Whitespace<Idx>
167+
where
168+
Idx: ?Sized,
169+
{
170+
type Output;
171+
fn index(&self, index: Idx) -> &Self::Output;
172+
}

src/test/rustdoc/const-generics/const-generics-docs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ impl Trait<{1 + 2}> for u8 {}
3131
impl<const N: usize> Trait<N> for [u8; N] {}
3232

3333
// @has foo/struct.Foo.html '//pre[@class="rust struct"]' \
34-
// 'pub struct Foo<const N: usize> where u8: Trait<N>'
34+
// 'pub struct Foo<const N: usize>where u8: Trait<N>'
3535
pub struct Foo<const N: usize> where u8: Trait<N>;
3636
// @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar<T, const N: usize>(_)'
3737
pub struct Bar<T, const N: usize>([T; N]);
3838

39-
// @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
39+
// @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M>where u8: Trait<M>'
4040
impl<const M: usize> Foo<M> where u8: Trait<M> {
4141
// @has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize'
4242
pub const FOO_ASSOC: usize = M + 13;
@@ -50,14 +50,14 @@ impl<const M: usize> Foo<M> where u8: Trait<M> {
5050
// @has foo/struct.Bar.html '//*[@id="impl-Bar%3Cu8%2C%20M%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Bar<u8, M>'
5151
impl<const M: usize> Bar<u8, M> {
5252
// @has - '//*[@id="method.hey"]' \
53-
// 'pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N>'
53+
// 'pub fn hey<const N: usize>(&self) -> Foo<N>where u8: Trait<N>'
5454
pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N> {
5555
Foo
5656
}
5757
}
5858

5959
// @has foo/fn.test.html '//pre[@class="rust fn"]' \
60-
// 'pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N>'
60+
// 'pub fn test<const N: usize>() -> impl Trait<N>where u8: Trait<N>'
6161
pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N> {
6262
2u8
6363
}

src/test/rustdoc/generic-associated-types/gats.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// @has foo/trait.LendingIterator.html
55
pub trait LendingIterator {
6-
// @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item<'a> where Self: 'a"
6+
// @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item<'a>where Self: 'a"
77
type Item<'a> where Self: 'a;
88

99
// @has - '//*[@id="tymethod.next"]//h4[@class="code-header"]' \
@@ -24,7 +24,7 @@ impl LendingIterator for () {
2424
pub struct Infinite<T>(T);
2525

2626
// @has foo/trait.LendingIterator.html
27-
// @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item<'a> where Self: 'a = &'a T"
27+
// @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item<'a>where Self: 'a = &'a T"
2828
impl<T> LendingIterator for Infinite<T> {
2929
type Item<'a> where Self: 'a = &'a T;
3030

src/test/rustdoc/higher-ranked-trait-bounds.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
pub trait Trait<'x> {}
55

66
// @has foo/fn.test1.html
7-
// @has - '//pre' "pub fn test1<T>() where for<'a> &'a T: Iterator,"
7+
// @has - '//pre' "pub fn test1<T>()where for<'a> &'a T: Iterator,"
88
pub fn test1<T>()
99
where
1010
for<'a> &'a T: Iterator,
1111
{
1212
}
1313

1414
// @has foo/fn.test2.html
15-
// @has - '//pre' "pub fn test2<T>() where for<'a, 'b> &'a T: Trait<'b>,"
15+
// @has - '//pre' "pub fn test2<T>()where for<'a, 'b> &'a T: Trait<'b>,"
1616
pub fn test2<T>()
1717
where
1818
for<'a, 'b> &'a T: Trait<'b>,
1919
{
2020
}
2121

2222
// @has foo/fn.test3.html
23-
// @has - '//pre' "pub fn test3<F>() where F: for<'a, 'b> Fn(&'a u8, &'b u8),"
23+
// @has - '//pre' "pub fn test3<F>()where F: for<'a, 'b> Fn(&'a u8, &'b u8),"
2424
pub fn test3<F>()
2525
where
2626
F: for<'a, 'b> Fn(&'a u8, &'b u8),
@@ -38,7 +38,7 @@ pub struct Foo<'a> {
3838
// @has - '//span[@id="structfield.some_trait"]' "some_trait: &'a dyn for<'b> Trait<'b>"
3939

4040
impl<'a> Foo<'a> {
41-
// @has - '//h4[@class="code-header"]' "pub fn bar<T>() where T: Trait<'a>,"
41+
// @has - '//h4[@class="code-header"]' "pub fn bar<T>()where T: Trait<'a>,"
4242
pub fn bar<T>()
4343
where
4444
T: Trait<'a>,

src/test/rustdoc/impl-parts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub auto trait AnAutoTrait {}
66
pub struct Foo<T> { field: T }
77

88
// @has impl_parts/struct.Foo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
9-
// "impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync,"
9+
// "impl<T: Clone> !AnAutoTrait for Foo<T>where T: Sync,"
1010
// @has impl_parts/trait.AnAutoTrait.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \
11-
// "impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync,"
11+
// "impl<T: Clone> !AnAutoTrait for Foo<T>where T: Sync,"
1212
impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync {}

src/test/rustdoc/issue-20727-4.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
2525

2626
pub mod reexport {
2727
// @has issue_20727_4/reexport/trait.Index.html
28-
// @has - '//*[@class="rust trait"]' 'trait Index<Idx> where Idx: ?Sized, {'
28+
// @has - '//*[@class="rust trait"]' 'trait Index<Idx>where Idx: ?Sized,{'
2929
// @has - '//*[@class="rust trait"]' 'type Output: ?Sized'
3030
// @has - '//*[@class="rust trait"]' \
3131
// 'fn index(&self, index: Idx) -> &Self::Output'
3232
pub use issue_20727::Index;
3333

3434
// @has issue_20727_4/reexport/trait.IndexMut.html
3535
// @has - '//*[@class="rust trait"]' \
36-
// 'trait IndexMut<Idx>: Index<Idx> where Idx: ?Sized, {'
36+
// 'trait IndexMut<Idx>: Index<Idx>where Idx: ?Sized,{'
3737
// @has - '//*[@class="rust trait"]' \
3838
// 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;'
3939
pub use issue_20727::IndexMut;

src/test/rustdoc/issue-21801.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ extern crate issue_21801;
55

66
// @has issue_21801/struct.Foo.html
77
// @has - '//*[@id="method.new"]' \
8-
// 'fn new<F>(f: F) -> Foo where F: FnMut() -> i32'
8+
// 'fn new<F>(f: F) -> Foowhere F: FnMut() -> i32'
99
pub use issue_21801::Foo;

src/test/rustdoc/issue-29503.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub trait MyTrait {
55
fn my_string(&self) -> String;
66
}
77

8-
// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header in-band']" "impl<T> MyTrait for T where T: Debug"
8+
// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header in-band']" "impl<T> MyTrait for Twhere T: Debug"
99
impl<T> MyTrait for T
1010
where
1111
T: fmt::Debug,

src/test/rustdoc/issue-34928.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
pub trait Bar {}
44

5-
// @has foo/struct.Foo.html '//pre' 'pub struct Foo<T>(pub T) where T: Bar;'
5+
// @has foo/struct.Foo.html '//pre' 'pub struct Foo<T>(pub T)where T: Bar;'
66
pub struct Foo<T>(pub T) where T: Bar;

src/test/rustdoc/issue-50159.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ impl<B, C> Signal2 for B where B: Signal<Item = C> {
1111
}
1212

1313
// @has issue_50159/struct.Switch.html
14-
// @has - '//h3[@class="code-header in-band"]' 'impl<B> Send for Switch<B> where <B as Signal>::Item: Send'
15-
// @has - '//h3[@class="code-header in-band"]' 'impl<B> Sync for Switch<B> where <B as Signal>::Item: Sync'
14+
// @has - '//h3[@class="code-header in-band"]' 'impl<B> Send for Switch<B>where <B as Signal>::Item: Send'
15+
// @has - '//h3[@class="code-header in-band"]' 'impl<B> Sync for Switch<B>where <B as Signal>::Item: Sync'
1616
// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0
1717
// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 5
1818
pub struct Switch<B: Signal> {

0 commit comments

Comments
 (0)