Created
July 29, 2016 14:11
-
-
Save Limeth/1d3bb4b954076ffe0c5488bc4ed9ab0d to your computer and use it in GitHub Desktop.
MOPA rewrite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [I] I ~/w/r/mopa master * env RUST_BACKTRACE=1 cargo test 41.4s Fr 29 Jul 2016 16:04:40 CEST | |
| Compiling mopa v0.2.2 (file:///home/limeth/workspace/rust/mopa) | |
| mopafy! { Person } | |
| mopafy_only_core! { Person } | |
| parse_generics_shim! { { .. } , then mopafy_only_core_internal ! ( Person ) , } | |
| parse_generics_shim! { @ parse_start { { .. } , ( mopafy_only_core_internal ! ( Person ) ) } , } | |
| parse_generics_shim! { @ emit_output { { .. } , ( mopafy_only_core_internal ! ( Person ) ) } , { | |
| constr : [ ] , ltimes : [ ] , tnames : [ ] , } , } | |
| parse_generics_shim_util! { @ callback ( mopafy_only_core_internal ! ( Person ) ) , { | |
| constr : [ ] , params : [ ] , ltimes : [ ] , tnames : [ ] , .. } , } | |
| mopafy_only_core_internal! { Person { constr : [ ] , params : [ ] , ltimes : [ ] , tnames : [ ] , .. } | |
| , } | |
| as_item! { # [ allow ( dead_code ) ] impl < > Person < > { | |
| /// Returns true if the boxed type is the same as `T` | |
| # [ inline ] pub fn is < T : Person < >> ( & self ) -> bool { | |
| :: __ :: TypeId :: of :: < T > ( ) == :: Any :: __get_type_id ( self ) } | |
| /// Returns some reference to the boxed value if it is of type `T`, or | |
| /// `None` if it isn't. | |
| # [ inline ] pub fn downcast_ref < T : Person < >> ( & self ) -> :: __ :: | |
| Option < & T > { | |
| if self . is :: < T > ( ) { | |
| unsafe { :: __ :: Option :: Some ( self . downcast_ref_unchecked ( ) ) } } | |
| else { :: __ :: Option :: None } } | |
| /// Returns a reference to the boxed value, blindly assuming it to be of type `T`. | |
| /// If you are not *absolutely certain* of `T`, you *must not* call this. | |
| # [ inline ] pub unsafe fn downcast_ref_unchecked < T : Person < >> ( & self | |
| ) -> & T { & * ( self as * const Self as * const T ) } | |
| /// Returns some mutable reference to the boxed value if it is of type `T`, or | |
| /// `None` if it isn't. | |
| # [ inline ] pub fn downcast_mut < T : Person < >> ( & mut self ) -> :: __ :: | |
| Option < & mut T > { | |
| if self . is :: < T > ( ) { | |
| unsafe { :: __ :: Option :: Some ( self . downcast_mut_unchecked ( ) ) } } | |
| else { :: __ :: Option :: None } } | |
| /// Returns a mutable reference to the boxed value, blindly assuming it to be of type `T`. | |
| /// If you are not *absolutely certain* of `T`, you *must not* call this. | |
| # [ inline ] pub unsafe fn downcast_mut_unchecked < T : Person < >> ( | |
| & mut self ) -> & mut T { & mut * ( self as * mut Self as * mut T ) } } } | |
| parse_generics_shim! { { .. } , then mopafy_internal ! ( Person ) , } | |
| parse_generics_shim! { @ parse_start { { .. } , ( mopafy_internal ! ( Person ) ) } , } | |
| parse_generics_shim! { @ emit_output { { .. } , ( mopafy_internal ! ( Person ) ) } , { | |
| constr : [ ] , ltimes : [ ] , tnames : [ ] , } , } | |
| parse_generics_shim_util! { @ callback ( mopafy_internal ! ( Person ) ) , { | |
| constr : [ ] , params : [ ] , ltimes : [ ] , tnames : [ ] , .. } , } | |
| mopafy_internal! { Person { constr : [ ] , params : [ ] , ltimes : [ ] , tnames : [ ] , .. } | |
| , } | |
| as_item! { # [ allow ( dead_code ) ] impl < > Person < > { | |
| /// Returns the boxed value if it is of type `T`, or `Err(Self)` if it isn't. | |
| # [ inline ] pub fn downcast < T : Person < >> ( self : Box < Self > ) -> :: | |
| __ :: Result < Box < T > , Box < Self >> { | |
| if self . is :: < T > ( ) { | |
| unsafe { :: __ :: Result :: Ok ( self . downcast_unchecked ( ) ) } } else { | |
| :: __ :: Result :: Err ( self ) } } | |
| /// Returns the boxed value, blindly assuming it to be of type `T`. | |
| /// If you are not *absolutely certain* of `T`, you *must not* call this. | |
| # [ inline ] pub unsafe fn downcast_unchecked < T : Person < >> ( | |
| self : Box < Self > ) -> Box < T > { | |
| Box :: from_raw ( Box :: into_raw ( self ) as * mut T ) } } } | |
| mopafy! { Parameterized < A , B > } | |
| mopafy_only_core! { Parameterized < A , B > } | |
| parse_generics_shim! { { .. } , then mopafy_only_core_internal ! ( Parameterized ) , < A , B > } | |
| parse_generics_shim! { @ parse_start { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } , | |
| < A , B > } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } , { | |
| constr : [ ] , ltimes : [ ] , tnames : [ ] , } , A , B > } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } , { | |
| constr : [ A , ] , ltimes : [ ] , tnames : [ A , ] , } , , B > } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } , { | |
| constr : [ A , ] , ltimes : [ ] , tnames : [ A , ] , } , B > } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } , { | |
| constr : [ A , B , ] , ltimes : [ ] , tnames : [ A , B , ] , } , > } | |
| parse_generics_shim! { @ emit_output { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } , | |
| { constr : [ A , B , ] , ltimes : [ ] , tnames : [ A , B , ] , } , } | |
| parse_generics_shim_util! { @ callback ( mopafy_only_core_internal ! ( Parameterized ) ) , { | |
| constr : [ A , B , ] , params : [ A , B , ] , ltimes : [ ] , tnames : [ | |
| A , B , ] , .. } , } | |
| mopafy_only_core_internal! { Parameterized { | |
| constr : [ A , B , ] , params : [ A , B , ] , ltimes : [ ] , tnames : [ | |
| A , B , ] , .. } , } | |
| as_item! { # [ allow ( dead_code ) ] impl < A , B , > Parameterized < A , B , > { | |
| /// Returns true if the boxed type is the same as `T` | |
| # [ inline ] pub fn is < T : Parameterized < A , B , >> ( & self ) -> bool { | |
| :: __ :: TypeId :: of :: < T > ( ) == :: Any :: __get_type_id ( self ) } | |
| /// Returns some reference to the boxed value if it is of type `T`, or | |
| /// `None` if it isn't. | |
| # [ inline ] pub fn downcast_ref < T : Parameterized < A , B , >> ( & self ) | |
| -> :: __ :: Option < & T > { | |
| if self . is :: < T > ( ) { | |
| unsafe { :: __ :: Option :: Some ( self . downcast_ref_unchecked ( ) ) } } | |
| else { :: __ :: Option :: None } } | |
| /// Returns a reference to the boxed value, blindly assuming it to be of type `T`. | |
| /// If you are not *absolutely certain* of `T`, you *must not* call this. | |
| # [ inline ] pub unsafe fn downcast_ref_unchecked < T : Parameterized < A , B | |
| , >> ( & self ) -> & T { & * ( self as * const Self as * const T ) } | |
| /// Returns some mutable reference to the boxed value if it is of type `T`, or | |
| /// `None` if it isn't. | |
| # [ inline ] pub fn downcast_mut < T : Parameterized < A , B , >> ( | |
| & mut self ) -> :: __ :: Option < & mut T > { | |
| if self . is :: < T > ( ) { | |
| unsafe { :: __ :: Option :: Some ( self . downcast_mut_unchecked ( ) ) } } | |
| else { :: __ :: Option :: None } } | |
| /// Returns a mutable reference to the boxed value, blindly assuming it to be of type `T`. | |
| /// If you are not *absolutely certain* of `T`, you *must not* call this. | |
| # [ inline ] pub unsafe fn downcast_mut_unchecked < T : Parameterized < A , B | |
| , >> ( & mut self ) -> & mut T { & mut * ( self as * mut Self as * mut T ) } } } | |
| parse_generics_shim! { { .. } , then mopafy_internal ! ( Parameterized ) , < A , B > } | |
| parse_generics_shim! { @ parse_start { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , < A , B > } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , { | |
| constr : [ ] , ltimes : [ ] , tnames : [ ] , } , A , B > } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , { | |
| constr : [ A , ] , ltimes : [ ] , tnames : [ A , ] , } , , B > } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , { | |
| constr : [ A , ] , ltimes : [ ] , tnames : [ A , ] , } , B > } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , { | |
| constr : [ A , B , ] , ltimes : [ ] , tnames : [ A , B , ] , } , > } | |
| parse_generics_shim! { @ emit_output { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , { | |
| constr : [ A , B , ] , ltimes : [ ] , tnames : [ A , B , ] , } , } | |
| parse_generics_shim_util! { @ callback ( mopafy_internal ! ( Parameterized ) ) , { | |
| constr : [ A , B , ] , params : [ A , B , ] , ltimes : [ ] , tnames : [ | |
| A , B , ] , .. } , } | |
| mopafy_internal! { Parameterized { | |
| constr : [ A , B , ] , params : [ A , B , ] , ltimes : [ ] , tnames : [ | |
| A , B , ] , .. } , } | |
| as_item! { # [ allow ( dead_code ) ] impl < A , B , > Parameterized < A , B , > { | |
| /// Returns the boxed value if it is of type `T`, or `Err(Self)` if it isn't. | |
| # [ inline ] pub fn downcast < T : Parameterized < A , B , >> ( | |
| self : Box < Self > ) -> :: __ :: Result < Box < T > , Box < Self >> { | |
| if self . is :: < T > ( ) { | |
| unsafe { :: __ :: Result :: Ok ( self . downcast_unchecked ( ) ) } } else { | |
| :: __ :: Result :: Err ( self ) } } | |
| /// Returns the boxed value, blindly assuming it to be of type `T`. | |
| /// If you are not *absolutely certain* of `T`, you *must not* call this. | |
| # [ inline ] pub unsafe fn downcast_unchecked < T : Parameterized < A , B , | |
| >> ( self : Box < Self > ) -> Box < T > { | |
| Box :: from_raw ( Box :: into_raw ( self ) as * mut T ) } } } | |
| mopafy! { Constrained < X , F : Float , D : Deep < F >> } | |
| mopafy_only_core! { Constrained < X , F : Float , D : Deep < F >> } | |
| parse_generics_shim! { { .. } , then mopafy_only_core_internal ! ( Constrained ) , < X , F : Float , | |
| D : Deep < F >> } | |
| parse_generics_shim! { @ parse_start { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , < | |
| X , F : Float , D : Deep < F >> } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ ] , ltimes : [ ] , tnames : [ ] , } , X , F : Float , D : Deep < | |
| F >> } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , , F : Float , D : | |
| Deep < F >> } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : Float , D : Deep | |
| < F >> } | |
| parse_constr! { ( true , true ) , then parse_generics_shim ! { | |
| @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : } , Float , D : | |
| Deep < F >> } | |
| parse_constr! { @ parse { | |
| ( | |
| parse_generics_shim ! { | |
| @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : } ) } , ( | |
| true , true ) , { } , Float , D : Deep < F >> } | |
| parse_constr! { @ parse { | |
| ( | |
| parse_generics_shim ! { | |
| @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : } ) } , ( | |
| false , true ) , { Float } , , D : Deep < F >> } | |
| parse_generics_shim_util! { @ callback ( | |
| parse_generics_shim ! { | |
| @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : } ) , { Float } | |
| , , D : Deep < F >> } | |
| parse_generics_shim! { @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : { Float } , , D | |
| : Deep < F >> } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , , D | |
| : Deep < F >> } | |
| parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D : | |
| Deep < F >> } | |
| parse_constr! { ( true , true ) , then parse_generics_shim ! { | |
| @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D : | |
| } , Deep < F >> } | |
| parse_constr! { @ parse { | |
| ( | |
| parse_generics_shim ! { | |
| @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D : | |
| } ) } , ( true , true ) , { } , Deep < F >> } | |
| parse_constr! { @ parse { | |
| ( | |
| parse_generics_shim ! { | |
| @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D : | |
| } ) } , ( false , true ) , { Deep } , < F >> } | |
| parse_constr! { @ parse_delim { | |
| { | |
| ( | |
| parse_generics_shim ! { | |
| @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D : | |
| } ) } , ( false , true ) } , [ # ] , { Deep < } , F >> } | |
| parse_constr! { @ parse_delim { | |
| { | |
| ( | |
| parse_generics_shim ! { | |
| @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D : | |
| } ) } , ( false , true ) } , [ # ] , { Deep < F } , >> } | |
| parse_constr! { @ parse_delim { | |
| { | |
| ( | |
| parse_generics_shim ! { | |
| @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , { | |
| constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D : | |
| } ) } , ( false , true ) } , [ # ] , { Deep < F >> } , } | |
| <parse_generics_shim macros>:207:65: 207:66 error: unexpected end of macro invocation | |
| <parse_generics_shim macros>:207 @ parse_delim $ prefix , $ stack , { $ ( $ constr ) * $ other } , $ ( $ body ) | |
| ^ | |
| error: Could not compile `mopa`. | |
| To learn more, run the command again with --verbose. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment