File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -882,6 +882,16 @@ impl<G: ?Sized + Generator + Unpin> Generator for Box<G> {
882
882
}
883
883
}
884
884
885
+ #[ unstable( feature = "generator_trait" , issue = "43122" ) ]
886
+ impl < G : ?Sized + Generator > Generator for Pin < Box < G > > {
887
+ type Yield = G :: Yield ;
888
+ type Return = G :: Return ;
889
+
890
+ fn resume ( mut self : Pin < & mut Self > ) -> GeneratorState < Self :: Yield , Self :: Return > {
891
+ G :: resume ( ( * self ) . as_mut ( ) )
892
+ }
893
+ }
894
+
885
895
#[ unstable( feature = "futures_api" , issue = "50547" ) ]
886
896
impl < F : ?Sized + Future + Unpin > Future for Box < F > {
887
897
type Output = F :: Output ;
Original file line number Diff line number Diff line change
1
+ // run-pass
2
+
3
+ #![ feature( generators, generator_trait) ]
4
+
5
+ use std:: ops:: Generator ;
6
+
7
+ fn assert_generator < G : Generator > ( _: G ) {
8
+ }
9
+
10
+ fn main ( ) {
11
+ assert_generator ( static || yield ) ;
12
+ assert_generator ( Box :: pin ( static || yield ) ) ;
13
+ }
You can’t perform that action at this time.
0 commit comments