@@ -5,22 +5,24 @@ use super::*;
55// FIXME(eddyb) generate the definition of `HandleStore` in `server.rs`.
66use super :: client:: HandleStore ;
77
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+ }
2322
23+ /// Declare an associated fn of one of the traits below, adding necessary
24+ /// default bodies.
25+ macro_rules! associated_fn {
2426 ( fn drop( & mut self , $arg: ident: $arg_ty: ty) ) =>
2527 ( fn drop( & mut self , $arg: $arg_ty) { mem:: drop( $arg) } ) ;
2628
@@ -34,12 +36,8 @@ macro_rules! declare_server_traits {
3436 ( $( $name: ident {
3537 $( fn $method: ident( $( $arg: ident: $arg_ty: ty) ,* $( , ) ?) $( -> $ret_ty: ty) ?; ) *
3638 } ) ,* $( , ) ?) => {
37- pub trait Types {
38- $( associated_item!( type $name) ; ) *
39- }
40-
4139 $( 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) ?) ; ) *
4341 } ) *
4442
4543 pub trait Server : Types $( + $name) * { }
0 commit comments