]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/anonymous-lifetime.rs
Rollup merge of #106244 - atouchet:readme3, r=workingjubilee
[rust.git] / tests / rustdoc / anonymous-lifetime.rs
1 // Regression test for https://github.com/rust-lang/rust/issues/84634
2 #![crate_name = "foo"]
3
4 use std::pin::Pin;
5 use std::task::Poll;
6
7 pub trait Stream {
8     type Item;
9
10     fn poll_next(mut self: Pin<&mut Self>) -> Poll<Option<Self::Item>>;
11     fn size_hint(&self) -> (usize, Option<usize>);
12 }
13
14 // @has 'foo/trait.Stream.html'
15 // @has - '//*[@class="code-header"]' 'impl<S: ?Sized + Stream + Unpin> Stream for &mut S'
16 impl<S: ?Sized + Stream + Unpin> Stream for &mut S {
17     type Item = S::Item;
18
19     fn poll_next(
20         mut self: Pin<&mut Self>,
21     ) -> Poll<Option<Self::Item>> {
22         S::poll_next(Pin::new(&mut **self), cx)
23     }
24
25     fn size_hint(&self) -> (usize, Option<usize>) {
26         (**self).size_hint()
27     }
28 }