@@ -74,7 +74,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
74
74
) ) ;
75
75
}
76
76
} ) ;
77
- MacEager :: expr ( quote_expr ! ( ecx, ( ) ) )
77
+ MacEager :: expr ( ecx. expr_tuple ( span , Vec :: new ( ) ) )
78
78
}
79
79
80
80
pub fn expand_register_diagnostic < ' cx > ( ecx : & ' cx mut ExtCtxt ,
@@ -107,7 +107,15 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
107
107
let sym = Ident :: new ( token:: gensym ( & (
108
108
"__register_diagnostic_" . to_string ( ) + & token:: get_ident ( * code)
109
109
) ) ) ;
110
- MacEager :: items ( SmallVector :: many ( vec ! [ quote_item!( ecx, mod $sym { } ) . unwrap( ) ] ) )
110
+ MacEager :: items ( SmallVector :: many ( vec ! [
111
+ ecx. item_mod(
112
+ span,
113
+ span,
114
+ sym,
115
+ Vec :: new( ) ,
116
+ Vec :: new( )
117
+ )
118
+ ] ) )
111
119
}
112
120
113
121
pub fn expand_build_diagnostic_array < ' cx > ( ecx : & ' cx mut ExtCtxt ,
@@ -132,7 +140,37 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt,
132
140
( descriptions. len ( ) , ecx. expr_vec ( span, descriptions) )
133
141
} ) ;
134
142
135
- MacEager :: items ( SmallVector :: many ( vec ! [ quote_item!( ecx,
136
- pub static $name: [ ( & ' static str , & ' static str ) ; $count] = $expr;
137
- ) . unwrap( ) ] ) )
143
+ let static_ = ecx. lifetime ( span, ecx. name_of ( "static" ) ) ;
144
+ let ty_str = ecx. ty_rptr (
145
+ span,
146
+ ecx. ty_ident ( span, ecx. ident_of ( "str" ) ) ,
147
+ Some ( static_) ,
148
+ ast:: MutImmutable ,
149
+ ) ;
150
+
151
+ let ty = ecx. ty (
152
+ span,
153
+ ast:: TyFixedLengthVec (
154
+ ecx. ty (
155
+ span,
156
+ ast:: TyTup ( vec ! [ ty_str. clone( ) , ty_str] )
157
+ ) ,
158
+ ecx. expr_usize ( span, count) ,
159
+ ) ,
160
+ ) ;
161
+
162
+ MacEager :: items ( SmallVector :: many ( vec ! [
163
+ P ( ast:: Item {
164
+ ident: name. clone( ) ,
165
+ attrs: Vec :: new( ) ,
166
+ id: ast:: DUMMY_NODE_ID ,
167
+ node: ast:: ItemStatic (
168
+ ty,
169
+ ast:: MutImmutable ,
170
+ expr,
171
+ ) ,
172
+ vis: ast:: Public ,
173
+ span: span,
174
+ } )
175
+ ] ) )
138
176
}
0 commit comments