@@ -2020,27 +2020,31 @@ fn async_gen_types_fully_inferred() {
20202020//- minicore: async_iterator, future, deref
20212021use core::task::{Context, Poll};
20222022use core::async_iter::AsyncIterator;
2023+ use core::pin::Pin;
20232024
20242025pub fn test(mut context: Context) {
20252026 let mut async_generator = async gen {
20262027 yield 1i8;
20272028 };
2028- let _result = async_generator.poll_next(&mut context);
2029+ let _result = Pin::new(&mut async_generator) .poll_next(&mut context);
20292030}
20302031 "# ,
20312032 expect ! [ [ r#"
2032- 83..94 'mut context': Context<'_>
2033- 105..235 '{ ...xt); }': ()
2034- 115..134 'mut as...erator': impl AsyncIterator<Item = i8>
2035- 137..173 'async ... }': impl AsyncIterator<Item = i8>
2036- 137..173 'async ... }': ()
2037- 157..166 'yield 1i8': ()
2038- 163..166 '1i8': i8
2039- 183..190 '_result': {unknown}
2040- 193..208 'async_generator': impl AsyncIterator<Item = i8>
2041- 193..232 'async_...ntext)': {unknown}
2042- 219..231 '&mut context': &mut Context<'_>
2043- 224..231 'context': Context<'_>
2033+ 103..114 'mut context': Context<'_>
2034+ 125..270 '{ ...xt); }': ()
2035+ 135..154 'mut as...erator': impl AsyncIterator<Item = i8>
2036+ 157..193 'async ... }': impl AsyncIterator<Item = i8>
2037+ 157..193 'async ... }': ()
2038+ 177..186 'yield 1i8': ()
2039+ 183..186 '1i8': i8
2040+ 203..210 '_result': Poll<Option<i8>>
2041+ 213..221 'Pin::new': fn new<&mut impl AsyncIterator<Item = i8>>(&mut impl AsyncIterator<Item = i8>) -> Pin<&mut impl AsyncIterator<Item = i8>>
2042+ 213..243 'Pin::n...rator)': Pin<&mut impl AsyncIterator<Item = i8>>
2043+ 213..267 'Pin::n...ntext)': Poll<Option<i8>>
2044+ 222..242 '&mut a...erator': &mut impl AsyncIterator<Item = i8>
2045+ 227..242 'async_generator': impl AsyncIterator<Item = i8>
2046+ 254..266 '&mut context': &mut Context<'_>
2047+ 259..266 'context': Context<'_>
20442048 "# ] ] ,
20452049 ) ;
20462050}
@@ -2178,37 +2182,45 @@ fn async_gen_yield_return_unit() {
21782182 //- minicore: async_iterator, future, deref
21792183 use core::task::{Context, Poll};
21802184 use core::async_iter::AsyncIterator;
2185+ use core::pin::Pin;
2186+
21812187 fn test(mut context: Context) {
21822188 let mut g = async gen {
21832189 let () = yield;
21842190 };
2185-
2186- match g.poll_next(&mut context) {
2187- Poll::Ready(()) => {} // FIXME test with 1 there I think this infers stuff it should not
2191+
2192+ match Pin::new(&mut g).poll_next(&mut context) {
2193+ Poll::Ready(Some(())) => {}
2194+ Poll::Ready(None) => {}
21882195 Poll::Pending => {}
21892196 }
2190- g
21912197 }
21922198"# ,
21932199 expect ! [ [ r#"
2194- 78..89 'mut context': Context<'_>
2195- 100..338 '{ ... g }': ()
2196- 110..115 'mut g': impl AsyncIterator<Item = ()>
2197- 118..159 'async ... }': impl AsyncIterator<Item = ()>
2198- 118..159 'async ... }': ()
2199- 142..144 '()': ()
2200- 147..152 'yield': ()
2201- 166..330 'match ... }': ()
2202- 172..173 'g': impl AsyncIterator<Item = ()>
2203- 172..197 'g.poll...ntext)': Poll<()>
2204- 184..196 '&mut context': &mut Context<'_>
2205- 189..196 'context': Context<'_>
2206- 208..223 'Poll::Ready(())': Poll<()>
2207- 220..222 '()': ()
2208- 227..229 '{}': ()
2209- 305..318 'Poll::Pending': Poll<()>
2210- 322..324 '{}': ()
2211- 335..336 'g': impl AsyncIterator<Item = ()>
2200+ 99..110 'mut context': Context<'_>
2201+ 121..339 '{ ... } }': ()
2202+ 131..136 'mut g': impl AsyncIterator<Item = ()>
2203+ 139..180 'async ... }': impl AsyncIterator<Item = ()>
2204+ 139..180 'async ... }': ()
2205+ 163..165 '()': ()
2206+ 168..173 'yield': ()
2207+ 187..337 'match ... }': ()
2208+ 193..201 'Pin::new': fn new<&mut impl AsyncIterator<Item = ()>>(&mut impl AsyncIterator<Item = ()>) -> Pin<&mut impl AsyncIterator<Item = ()>>
2209+ 193..209 'Pin::n...mut g)': Pin<&mut impl AsyncIterator<Item = ()>>
2210+ 193..233 'Pin::n...ntext)': Poll<Option<()>>
2211+ 202..208 '&mut g': &mut impl AsyncIterator<Item = ()>
2212+ 207..208 'g': impl AsyncIterator<Item = ()>
2213+ 220..232 '&mut context': &mut Context<'_>
2214+ 225..232 'context': Context<'_>
2215+ 244..265 'Poll::...e(()))': Poll<Option<()>>
2216+ 256..264 'Some(())': Option<()>
2217+ 261..263 '()': ()
2218+ 269..271 '{}': ()
2219+ 280..297 'Poll::...(None)': Poll<Option<()>>
2220+ 292..296 'None': Option<()>
2221+ 301..303 '{}': ()
2222+ 312..325 'Poll::Pending': Poll<Option<()>>
2223+ 329..331 '{}': ()
22122224 "# ] ] ,
22132225 ) ;
22142226}
0 commit comments