@@ -5,22 +5,24 @@ use super::*;
5
5
// FIXME(eddyb) generate the definition of `HandleStore` in `server.rs`.
6
6
use super :: client:: HandleStore ;
7
7
8
- /// Declare an associated item of one of the traits below, optionally
9
- /// adjusting it (i.e., adding bounds to types and default bodies to methods).
10
- macro_rules! associated_item {
11
- ( type FreeFunctions ) => ( type FreeFunctions : ' static ; ) ;
12
- ( type TokenStream ) => ( type TokenStream : ' static + Clone ; ) ;
13
- ( type TokenStreamBuilder ) => ( type TokenStreamBuilder : ' static ; ) ;
14
- ( type TokenStreamIter ) => ( type TokenStreamIter : ' static + Clone ; ) ;
15
- ( type Group ) => ( type Group : ' static + Clone ; ) ;
16
- ( type Punct ) => ( type Punct : ' static + Copy + Eq + Hash ; ) ;
17
- ( type Ident ) => ( type Ident : ' static + Copy + Eq + Hash ; ) ;
18
- ( type Literal ) => ( type Literal : ' static + Clone ; ) ;
19
- ( type SourceFile ) => ( type SourceFile : ' static + Clone ; ) ;
20
- ( type MultiSpan ) => ( type MultiSpan : ' static ; ) ;
21
- ( type Diagnostic ) => ( type Diagnostic : ' static ; ) ;
22
- ( type Span ) => ( type Span : ' static + Copy + Eq + Hash ; ) ;
8
+ pub trait Types {
9
+ type FreeFunctions : ' static ;
10
+ type TokenStream : ' static + Clone ;
11
+ type TokenStreamBuilder : ' static ;
12
+ type TokenStreamIter : ' static + Clone ;
13
+ type Group : ' static + Clone ;
14
+ type Punct : ' static + Copy + Eq + Hash ;
15
+ type Ident : ' static + Copy + Eq + Hash ;
16
+ type Literal : ' static + Clone ;
17
+ type SourceFile : ' static + Clone ;
18
+ type MultiSpan : ' static ;
19
+ type Diagnostic : ' static ;
20
+ type Span : ' static + Copy + Eq + Hash ;
21
+ }
23
22
23
+ /// Declare an associated fn of one of the traits below, adding necessary
24
+ /// default bodies.
25
+ macro_rules! associated_fn {
24
26
( fn drop( & mut self , $arg: ident: $arg_ty: ty) ) =>
25
27
( fn drop( & mut self , $arg: $arg_ty) { mem:: drop( $arg) } ) ;
26
28
@@ -34,12 +36,8 @@ macro_rules! declare_server_traits {
34
36
( $( $name: ident {
35
37
$( fn $method: ident( $( $arg: ident: $arg_ty: ty) ,* $( , ) ?) $( -> $ret_ty: ty) ?; ) *
36
38
} ) ,* $( , ) ?) => {
37
- pub trait Types {
38
- $( associated_item!( type $name) ; ) *
39
- }
40
-
41
39
$( pub trait $name: Types {
42
- $( associated_item !( fn $method( & mut self , $( $arg: $arg_ty) ,* ) $( -> $ret_ty) ?) ; ) *
40
+ $( associated_fn !( fn $method( & mut self , $( $arg: $arg_ty) ,* ) $( -> $ret_ty) ?) ; ) *
43
41
} ) *
44
42
45
43
pub trait Server : Types $( + $name) * { }
0 commit comments