Skip to content

Commit 8553658

Browse files
committed
syntax: remove #[feature(quote, unsafe_destructor)]
1 parent bc6d990 commit 8553658

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

src/libsyntax/diagnostics/plugin.rs

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
7777
));
7878
}
7979
});
80-
MacEager::expr(quote_expr!(ecx, ()))
80+
MacEager::expr(ecx.expr_tuple(span, Vec::new()))
8181
}
8282

8383
pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
@@ -128,7 +128,15 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
128128
let sym = Ident::new(token::gensym(&(
129129
"__register_diagnostic_".to_string() + &token::get_ident(*code)
130130
)));
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+
]))
132140
}
133141

134142
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,
153161
(descriptions.len(), ecx.expr_vec(span, descriptions))
154162
});
155163

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+
]))
159197
}

src/libsyntax/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#![feature(collections)]
2929
#![feature(core)]
3030
#![feature(libc)]
31-
#![feature(quote, unsafe_destructor)]
3231
#![feature(rustc_private)]
3332
#![feature(staged_api)]
3433
#![feature(unicode)]

0 commit comments

Comments
 (0)