File tree Expand file tree Collapse file tree 4 files changed +39
-2
lines changed
Expand file tree Collapse file tree 4 files changed +39
-2
lines changed Original file line number Diff line number Diff line change 1+ //! Futures and supporting APIs.
2+ #![ unstable( feature = "async_await" , issue = "50547" ) ]
3+
4+ /// The Future trait.
5+ #[ unstable( feature = "async_await" , issue = "50547" ) ]
6+ pub trait Future { }
Original file line number Diff line number Diff line change @@ -191,10 +191,11 @@ pub mod ascii;
191191pub mod sync;
192192pub mod cell;
193193pub mod char;
194- pub mod panic;
195- pub mod panicking;
194+ pub mod future;
196195pub mod iter;
197196pub mod option;
197+ pub mod panic;
198+ pub mod panicking;
198199pub mod raw;
199200pub mod result;
200201
Original file line number Diff line number Diff line change @@ -97,3 +97,30 @@ pub struct TraitObject {
9797 pub data : * mut ( ) ,
9898 pub vtable : * mut ( ) ,
9999}
100+
101+ /// An adapter from a generator to a future.
102+ ///
103+ /// This is a permanently unstable API used by the compiler. You should not
104+ /// depend on it.
105+ #[ allow( missing_debug_implementations, dead_code) ]
106+ #[ unstable( feature = "gen_future" , issue = "50547" ) ]
107+ pub struct GenFuture < G , R > {
108+ gen : G ,
109+ marker : :: marker:: PhantomData < R > ,
110+ }
111+
112+ /// Construct a future from a generator (used in lowering async functions).
113+ ///
114+ /// This is a permanently unstable API used by the compiler. You should not
115+ /// depend on it.
116+ #[ unstable( feature = "gen_future" , issue = "50547" ) ]
117+ pub fn gen_future < G > ( gen : G ) -> GenFuture < G , G :: Return > where
118+ G : :: ops:: Generator < Yield = ( ) >
119+ {
120+ GenFuture { gen, marker : :: marker:: PhantomData }
121+ }
122+
123+ #[ unstable( feature = "gen_future" , issue = "50547" ) ]
124+ impl < G > :: future:: Future for GenFuture < G , G :: Return > where
125+ G : :: ops:: Generator < Yield = ( ) >
126+ { }
Original file line number Diff line number Diff line change 242242#![ feature( array_error_internals) ]
243243#![ feature( ascii_ctype) ]
244244#![ feature( asm) ]
245+ #![ feature( async_await) ]
245246#![ feature( attr_literals) ]
246247#![ feature( box_syntax) ]
247248#![ feature( cfg_target_has_atomic) ]
@@ -390,6 +391,8 @@ pub use core::cmp;
390391pub use core:: convert;
391392#[ stable( feature = "rust1" , since = "1.0.0" ) ]
392393pub use core:: default;
394+ #[ unstable( feature = "async_await" , issue = "50547" ) ]
395+ pub use core:: future;
393396#[ stable( feature = "rust1" , since = "1.0.0" ) ]
394397pub use core:: hash;
395398#[ stable( feature = "rust1" , since = "1.0.0" ) ]
You can’t perform that action at this time.
0 commit comments