Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.64 KB | None | 0 0
  1.  
  2. [I] !  I  ~/w/r/bjorn3-mopa   master *  env RUST_BACKTRACE=1 cargo test 585ms  Fr 29 Jul 2016 21:07:25 CEST
  3. Compiling mopa v0.2.2 (file:///home/limeth/workspace/rust/bjorn3-mopa)
  4. mopafy! { Person }
  5. mopafy_only_core! { Person }
  6. parse_generics_shim! { { .. } , then mopafy_only_core_internal ! ( Person ) , }
  7. parse_generics_shim! { @ parse_start { { .. } , ( mopafy_only_core_internal ! ( Person ) ) } , }
  8. parse_generics_shim! { @ emit_output { { .. } , ( mopafy_only_core_internal ! ( Person ) ) } , {
  9. constr : [ ] , ltimes : [ ] , tnames : [ ] , } , }
  10. parse_generics_shim_util! { @ callback ( mopafy_only_core_internal ! ( Person ) ) , {
  11. constr : [ ] , params : [ ] , ltimes : [ ] , tnames : [ ] , .. } , }
  12. mopafy_only_core_internal! { Person { constr : [ ] , params : [ ] , ltimes : [ ] , tnames : [ ] , .. }
  13. , }
  14. as_item! { # [ allow ( dead_code ) ] impl < > Person < > {
  15. /// Returns true if the boxed type is the same as `T`
  16. # [ inline ] pub fn is < T : Person < >> ( & self ) -> bool {
  17. :: __ :: TypeId :: of :: < T > ( ) == :: Any :: __get_type_id ( self ) }
  18. /// Returns some reference to the boxed value if it is of type `T`, or
  19. /// `None` if it isn't.
  20. # [ inline ] pub fn downcast_ref < T : Person < >> ( & self ) -> :: __ ::
  21. Option < & T > {
  22. if self . is :: < T > ( ) {
  23. unsafe { :: __ :: Option :: Some ( self . downcast_ref_unchecked ( ) ) } }
  24. else { :: __ :: Option :: None } }
  25. /// Returns a reference to the boxed value, blindly assuming it to be of type `T`.
  26. /// If you are not *absolutely certain* of `T`, you *must not* call this.
  27. # [ inline ] pub unsafe fn downcast_ref_unchecked < T : Person < >> ( & self
  28. ) -> & T { & * ( self as * const Self as * const T ) }
  29. /// Returns some mutable reference to the boxed value if it is of type `T`, or
  30. /// `None` if it isn't.
  31. # [ inline ] pub fn downcast_mut < T : Person < >> ( & mut self ) -> :: __ ::
  32. Option < & mut T > {
  33. if self . is :: < T > ( ) {
  34. unsafe { :: __ :: Option :: Some ( self . downcast_mut_unchecked ( ) ) } }
  35. else { :: __ :: Option :: None } }
  36. /// Returns a mutable reference to the boxed value, blindly assuming it to be of type `T`.
  37. /// If you are not *absolutely certain* of `T`, you *must not* call this.
  38. # [ inline ] pub unsafe fn downcast_mut_unchecked < T : Person < >> (
  39. & mut self ) -> & mut T { & mut * ( self as * mut Self as * mut T ) } } }
  40. example! { ( ) then parse_generic ! ( Person ) }
  41. example! { @ inner ( ) ( ) ( parse_generic Person ) }
  42. parse_generic! { ( Person ) ( ) }
  43. parse_generics_shim! { { .. } , then mopafy_internal ! ( Person ) , }
  44. parse_generics_shim! { @ parse_start { { .. } , ( mopafy_internal ! ( Person ) ) } , }
  45. parse_generics_shim! { @ emit_output { { .. } , ( mopafy_internal ! ( Person ) ) } , {
  46. constr : [ ] , ltimes : [ ] , tnames : [ ] , } , }
  47. parse_generics_shim_util! { @ callback ( mopafy_internal ! ( Person ) ) , {
  48. constr : [ ] , params : [ ] , ltimes : [ ] , tnames : [ ] , .. } , }
  49. mopafy_internal! { Person { constr : [ ] , params : [ ] , ltimes : [ ] , tnames : [ ] , .. }
  50. , }
  51. as_item! { # [ allow ( dead_code ) ] impl < > Person < > {
  52. /// Returns the boxed value if it is of type `T`, or `Err(Self)` if it isn't.
  53. # [ inline ] pub fn downcast < T : Person < >> ( self : Box < Self > ) -> ::
  54. __ :: Result < Box < T > , Box < Self >> {
  55. if self . is :: < T > ( ) {
  56. unsafe { :: __ :: Result :: Ok ( self . downcast_unchecked ( ) ) } } else {
  57. :: __ :: Result :: Err ( self ) } }
  58. /// Returns the boxed value, blindly assuming it to be of type `T`.
  59. /// If you are not *absolutely certain* of `T`, you *must not* call this.
  60. # [ inline ] pub unsafe fn downcast_unchecked < T : Person < >> (
  61. self : Box < Self > ) -> Box < T > {
  62. Box :: from_raw ( Box :: into_raw ( self ) as * mut T ) } } }
  63. mopafy! { Parameterized < A , B > }
  64. mopafy_only_core! { Parameterized < A , B > }
  65. parse_generics_shim! { { .. } , then mopafy_only_core_internal ! ( Parameterized ) , < A , B > }
  66. parse_generics_shim! { @ parse_start { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } ,
  67. < A , B > }
  68. parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } , {
  69. constr : [ ] , ltimes : [ ] , tnames : [ ] , } , A , B > }
  70. parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } , {
  71. constr : [ A , ] , ltimes : [ ] , tnames : [ A , ] , } , , B > }
  72. parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } , {
  73. constr : [ A , ] , ltimes : [ ] , tnames : [ A , ] , } , B > }
  74. parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } , {
  75. constr : [ A , B , ] , ltimes : [ ] , tnames : [ A , B , ] , } , > }
  76. parse_generics_shim! { @ emit_output { { .. } , ( mopafy_only_core_internal ! ( Parameterized ) ) } ,
  77. { constr : [ A , B , ] , ltimes : [ ] , tnames : [ A , B , ] , } , }
  78. parse_generics_shim_util! { @ callback ( mopafy_only_core_internal ! ( Parameterized ) ) , {
  79. constr : [ A , B , ] , params : [ A , B , ] , ltimes : [ ] , tnames : [
  80. A , B , ] , .. } , }
  81. mopafy_only_core_internal! { Parameterized {
  82. constr : [ A , B , ] , params : [ A , B , ] , ltimes : [ ] , tnames : [
  83. A , B , ] , .. } , }
  84. as_item! { # [ allow ( dead_code ) ] impl < A , B , > Parameterized < A , B , > {
  85. /// Returns true if the boxed type is the same as `T`
  86. # [ inline ] pub fn is < T : Parameterized < A , B , >> ( & self ) -> bool {
  87. :: __ :: TypeId :: of :: < T > ( ) == :: Any :: __get_type_id ( self ) }
  88. /// Returns some reference to the boxed value if it is of type `T`, or
  89. /// `None` if it isn't.
  90. # [ inline ] pub fn downcast_ref < T : Parameterized < A , B , >> ( & self )
  91. -> :: __ :: Option < & T > {
  92. if self . is :: < T > ( ) {
  93. unsafe { :: __ :: Option :: Some ( self . downcast_ref_unchecked ( ) ) } }
  94. else { :: __ :: Option :: None } }
  95. /// Returns a reference to the boxed value, blindly assuming it to be of type `T`.
  96. /// If you are not *absolutely certain* of `T`, you *must not* call this.
  97. # [ inline ] pub unsafe fn downcast_ref_unchecked < T : Parameterized < A , B
  98. , >> ( & self ) -> & T { & * ( self as * const Self as * const T ) }
  99. /// Returns some mutable reference to the boxed value if it is of type `T`, or
  100. /// `None` if it isn't.
  101. # [ inline ] pub fn downcast_mut < T : Parameterized < A , B , >> (
  102. & mut self ) -> :: __ :: Option < & mut T > {
  103. if self . is :: < T > ( ) {
  104. unsafe { :: __ :: Option :: Some ( self . downcast_mut_unchecked ( ) ) } }
  105. else { :: __ :: Option :: None } }
  106. /// Returns a mutable reference to the boxed value, blindly assuming it to be of type `T`.
  107. /// If you are not *absolutely certain* of `T`, you *must not* call this.
  108. # [ inline ] pub unsafe fn downcast_mut_unchecked < T : Parameterized < A , B
  109. , >> ( & mut self ) -> & mut T { & mut * ( self as * mut Self as * mut T ) } } }
  110. example! { ( < A , B > ) then parse_generic ! ( Parameterized ) }
  111. example! { @ inner ( < A , B > ) ( ) ( parse_generic Parameterized ) }
  112. example! { @ inner ( A , B > ) ( < ) ( parse_generic Parameterized ) }
  113. example! { @ inner ( , B > ) ( < A ) ( parse_generic Parameterized ) }
  114. example! { @ inner ( B > ) ( < A , ) ( parse_generic Parameterized ) }
  115. example! { @ inner ( > ) ( < A , B ) ( parse_generic Parameterized ) }
  116. example! { @ inner ( ) ( < A , B > ) ( parse_generic Parameterized ) }
  117. parse_generic! { ( Parameterized ) ( < A , B > ) }
  118. parse_generics_shim! { { .. } , then mopafy_internal ! ( Parameterized ) , < A , B > }
  119. parse_generics_shim! { @ parse_start { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , < A , B > }
  120. parse_generics_shim! { @ parse { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , {
  121. constr : [ ] , ltimes : [ ] , tnames : [ ] , } , A , B > }
  122. parse_generics_shim! { @ parse { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , {
  123. constr : [ A , ] , ltimes : [ ] , tnames : [ A , ] , } , , B > }
  124. parse_generics_shim! { @ parse { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , {
  125. constr : [ A , ] , ltimes : [ ] , tnames : [ A , ] , } , B > }
  126. parse_generics_shim! { @ parse { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , {
  127. constr : [ A , B , ] , ltimes : [ ] , tnames : [ A , B , ] , } , > }
  128. parse_generics_shim! { @ emit_output { { .. } , ( mopafy_internal ! ( Parameterized ) ) } , {
  129. constr : [ A , B , ] , ltimes : [ ] , tnames : [ A , B , ] , } , }
  130. parse_generics_shim_util! { @ callback ( mopafy_internal ! ( Parameterized ) ) , {
  131. constr : [ A , B , ] , params : [ A , B , ] , ltimes : [ ] , tnames : [
  132. A , B , ] , .. } , }
  133. mopafy_internal! { Parameterized {
  134. constr : [ A , B , ] , params : [ A , B , ] , ltimes : [ ] , tnames : [
  135. A , B , ] , .. } , }
  136. as_item! { # [ allow ( dead_code ) ] impl < A , B , > Parameterized < A , B , > {
  137. /// Returns the boxed value if it is of type `T`, or `Err(Self)` if it isn't.
  138. # [ inline ] pub fn downcast < T : Parameterized < A , B , >> (
  139. self : Box < Self > ) -> :: __ :: Result < Box < T > , Box < Self >> {
  140. if self . is :: < T > ( ) {
  141. unsafe { :: __ :: Result :: Ok ( self . downcast_unchecked ( ) ) } } else {
  142. :: __ :: Result :: Err ( self ) } }
  143. /// Returns the boxed value, blindly assuming it to be of type `T`.
  144. /// If you are not *absolutely certain* of `T`, you *must not* call this.
  145. # [ inline ] pub unsafe fn downcast_unchecked < T : Parameterized < A , B ,
  146. >> ( self : Box < Self > ) -> Box < T > {
  147. Box :: from_raw ( Box :: into_raw ( self ) as * mut T ) } } }
  148. src/lib.rs:214:1: 216:2 warning: function is never used: `main`, #[warn(dead_code)] on by defaultmopafy! { Constrained < X , F : Float , D : Deep < F >> }
  149.  
  150. src/lib.rs:214 fn main(){
  151. ^
  152. mopafy_only_core! { Constrained < X , F : Float , D : Deep < F >> }
  153. parse_generics_shim! { { .. } , then mopafy_only_core_internal ! ( Constrained ) , < X , F : Float ,
  154. D : Deep < F >> }
  155. parse_generics_shim! { @ parse_start { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , <
  156. X , F : Float , D : Deep < F >> }
  157. parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  158. constr : [ ] , ltimes : [ ] , tnames : [ ] , } , X , F : Float , D : Deep <
  159. F >> }
  160. parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  161. constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , , F : Float , D :
  162. Deep < F >> }
  163. parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  164. constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : Float , D : Deep
  165. < F >> }
  166. parse_constr! { ( true , true ) , then parse_generics_shim ! {
  167. @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  168. constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : } , Float , D :
  169. Deep < F >> }
  170. parse_constr! { @ parse {
  171. (
  172. parse_generics_shim ! {
  173. @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  174. constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : } ) } , (
  175. true , true ) , { } , Float , D : Deep < F >> }
  176. parse_constr! { @ parse {
  177. (
  178. parse_generics_shim ! {
  179. @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  180. constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : } ) } , (
  181. false , true ) , { Float } , , D : Deep < F >> }
  182. parse_generics_shim_util! { @ callback (
  183. parse_generics_shim ! {
  184. @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  185. constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : } ) , { Float }
  186. , , D : Deep < F >> }
  187. parse_generics_shim! { @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  188. constr : [ X , ] , ltimes : [ ] , tnames : [ X , ] , } , F : { Float } , , D
  189. : Deep < F >> }
  190. parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  191. constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , , D
  192. : Deep < F >> }
  193. parse_generics_shim! { @ parse { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  194. constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D :
  195. Deep < F >> }
  196. parse_constr! { ( true , true ) , then parse_generics_shim ! {
  197. @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  198. constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D :
  199. } , Deep < F >> }
  200. parse_constr! { @ parse {
  201. (
  202. parse_generics_shim ! {
  203. @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  204. constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D :
  205. } ) } , ( true , true ) , { } , Deep < F >> }
  206. parse_constr! { @ parse {
  207. (
  208. parse_generics_shim ! {
  209. @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  210. constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D :
  211. } ) } , ( false , true ) , { Deep } , < F >> }
  212. parse_constr! { @ parse_delim {
  213. {
  214. (
  215. parse_generics_shim ! {
  216. @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  217. constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D :
  218. } ) } , ( false , true ) } , [ # ] , { Deep < } , F >> }
  219. parse_constr! { @ parse_delim {
  220. {
  221. (
  222. parse_generics_shim ! {
  223. @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  224. constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D :
  225. } ) } , ( false , true ) } , [ # ] , { Deep < F } , >> }
  226. parse_constr! { @ parse_delim {
  227. {
  228. (
  229. parse_generics_shim ! {
  230. @ app_ty { { .. } , ( mopafy_only_core_internal ! ( Constrained ) ) } , {
  231. constr : [ X , F : Float , ] , ltimes : [ ] , tnames : [ X , F , ] , } , D :
  232. } ) } , ( false , true ) } , [ # ] , { Deep < F >> } , }
  233. <parse_generics_shim macros>:207:65: 207:66 error: unexpected end of macro invocation
  234. <parse_generics_shim macros>:207 @ parse_delim $ prefix , $ stack , { $ ( $ constr ) * $ other } , $ ( $ body )
  235. ^
  236. Build failed, waiting for other jobs to finish...
  237. error: Could not compile `mopa`.
  238.  
  239. T
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement