Skip to content

Commit b17c625

Browse files
committed
syntax: remove #[feature(quote, unsafe_destructor)]
1 parent 32e08c2 commit b17c625

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
@@ -74,7 +74,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
7474
));
7575
}
7676
});
77-
MacEager::expr(quote_expr!(ecx, ()))
77+
MacEager::expr(ecx.expr_tuple(span, Vec::new()))
7878
}
7979

8080
pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
@@ -107,7 +107,15 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
107107
let sym = Ident::new(token::gensym(&(
108108
"__register_diagnostic_".to_string() + &token::get_ident(*code)
109109
)));
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+
]))
111119
}
112120

113121
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,
132140
(descriptions.len(), ecx.expr_vec(span, descriptions))
133141
});
134142

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

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)