@@ -77,7 +77,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
77
77
) ) ;
78
78
}
79
79
} ) ;
80
- MacEager :: expr ( quote_expr ! ( ecx, ( ) ) )
80
+ MacEager :: expr ( ecx. expr_tuple ( span , Vec :: new ( ) ) )
81
81
}
82
82
83
83
pub fn expand_register_diagnostic < ' cx > ( ecx : & ' cx mut ExtCtxt ,
@@ -128,7 +128,15 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
128
128
let sym = Ident :: new ( token:: gensym ( & (
129
129
"__register_diagnostic_" . to_string ( ) + & token:: get_ident ( * code)
130
130
) ) ) ;
131
- MacEager :: items ( SmallVector :: many ( vec ! [ quote_item!( ecx, mod $sym { } ) . unwrap( ) ] ) )
131
+ MacEager :: items ( SmallVector :: many ( vec ! [
132
+ ecx. item_mod(
133
+ span,
134
+ span,
135
+ sym,
136
+ Vec :: new( ) ,
137
+ Vec :: new( )
138
+ )
139
+ ] ) )
132
140
}
133
141
134
142
pub fn expand_build_diagnostic_array < ' cx > ( ecx : & ' cx mut ExtCtxt ,
@@ -153,7 +161,37 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt,
153
161
( descriptions. len ( ) , ecx. expr_vec ( span, descriptions) )
154
162
} ) ;
155
163
156
- MacEager :: items ( SmallVector :: many ( vec ! [ quote_item!( ecx,
157
- pub static $name: [ ( & ' static str , & ' static str ) ; $count] = $expr;
158
- ) . unwrap( ) ] ) )
164
+ let static_ = ecx. lifetime ( span, ecx. name_of ( "'static" ) ) ;
165
+ let ty_str = ecx. ty_rptr (
166
+ span,
167
+ ecx. ty_ident ( span, ecx. ident_of ( "str" ) ) ,
168
+ Some ( static_) ,
169
+ ast:: MutImmutable ,
170
+ ) ;
171
+
172
+ let ty = ecx. ty (
173
+ span,
174
+ ast:: TyFixedLengthVec (
175
+ ecx. ty (
176
+ span,
177
+ ast:: TyTup ( vec ! [ ty_str. clone( ) , ty_str] )
178
+ ) ,
179
+ ecx. expr_usize ( span, count) ,
180
+ ) ,
181
+ ) ;
182
+
183
+ MacEager :: items ( SmallVector :: many ( vec ! [
184
+ P ( ast:: Item {
185
+ ident: name. clone( ) ,
186
+ attrs: Vec :: new( ) ,
187
+ id: ast:: DUMMY_NODE_ID ,
188
+ node: ast:: ItemStatic (
189
+ ty,
190
+ ast:: MutImmutable ,
191
+ expr,
192
+ ) ,
193
+ vis: ast:: Public ,
194
+ span: span,
195
+ } )
196
+ ] ) )
159
197
}
0 commit comments