1
- use deriving:: path_std;
2
- use deriving:: generic:: * ;
3
- use deriving:: generic:: ty:: * ;
1
+ use crate :: deriving:: path_std;
2
+ use crate :: deriving:: generic:: * ;
3
+ use crate :: deriving:: generic:: ty:: * ;
4
4
5
- use syntax:: ast:: { self , Expr , Generics , ItemKind , MetaItem , VariantData } ;
6
- use syntax:: ast:: GenericArg ;
5
+ use syntax:: ast:: { self , Expr , GenericArg , Generics , ItemKind , MetaItem , VariantData } ;
7
6
use syntax:: attr;
8
7
use syntax:: ext:: base:: { Annotatable , ExtCtxt } ;
9
8
use syntax:: ext:: build:: AstBuilder ;
10
9
use syntax:: ptr:: P ;
11
10
use syntax:: symbol:: { Symbol , keywords} ;
12
11
use syntax_pos:: Span ;
13
12
14
- pub fn expand_deriving_clone ( cx : & mut ExtCtxt ,
13
+ pub fn expand_deriving_clone ( cx : & mut ExtCtxt < ' _ > ,
15
14
span : Span ,
16
15
mitem : & MetaItem ,
17
16
item : & Annotatable ,
@@ -105,12 +104,12 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt,
105
104
}
106
105
107
106
fn cs_clone_shallow ( name : & str ,
108
- cx : & mut ExtCtxt ,
107
+ cx : & mut ExtCtxt < ' _ > ,
109
108
trait_span : Span ,
110
- substr : & Substructure ,
109
+ substr : & Substructure < ' _ > ,
111
110
is_union : bool )
112
111
-> P < Expr > {
113
- fn assert_ty_bounds ( cx : & mut ExtCtxt , stmts : & mut Vec < ast:: Stmt > ,
112
+ fn assert_ty_bounds ( cx : & mut ExtCtxt < ' _ > , stmts : & mut Vec < ast:: Stmt > ,
114
113
ty : P < ast:: Ty > , span : Span , helper_name : & str ) {
115
114
// Generate statement `let _: helper_name<ty>;`,
116
115
// set the expn ID so we can use the unstable struct.
@@ -120,7 +119,7 @@ fn cs_clone_shallow(name: &str,
120
119
vec ! [ GenericArg :: Type ( ty) ] , vec ! [ ] ) ;
121
120
stmts. push ( cx. stmt_let_type_only ( span, cx. ty_path ( assert_path) ) ) ;
122
121
}
123
- fn process_variant ( cx : & mut ExtCtxt , stmts : & mut Vec < ast:: Stmt > , variant : & VariantData ) {
122
+ fn process_variant ( cx : & mut ExtCtxt < ' _ > , stmts : & mut Vec < ast:: Stmt > , variant : & VariantData ) {
124
123
for field in variant. fields ( ) {
125
124
// let _: AssertParamIsClone<FieldTy>;
126
125
assert_ty_bounds ( cx, stmts, field. ty . clone ( ) , field. span , "AssertParamIsClone" ) ;
@@ -151,14 +150,14 @@ fn cs_clone_shallow(name: &str,
151
150
}
152
151
153
152
fn cs_clone ( name : & str ,
154
- cx : & mut ExtCtxt ,
153
+ cx : & mut ExtCtxt < ' _ > ,
155
154
trait_span : Span ,
156
- substr : & Substructure )
155
+ substr : & Substructure < ' _ > )
157
156
-> P < Expr > {
158
157
let ctor_path;
159
158
let all_fields;
160
159
let fn_path = cx. std_path ( & [ "clone" , "Clone" , "clone" ] ) ;
161
- let subcall = |cx : & mut ExtCtxt , field : & FieldInfo | {
160
+ let subcall = |cx : & mut ExtCtxt < ' _ > , field : & FieldInfo < ' _ > | {
162
161
let args = vec ! [ cx. expr_addr_of( field. span, field. self_. clone( ) ) ] ;
163
162
cx. expr_call_global ( field. span , fn_path. clone ( ) , args)
164
163
} ;
0 commit comments