Avoid instaiblity errors in code generated by syntax_ext::deriving::call_intrinsic().

This commit is contained in:
Jeffrey Seyfried 2016-09-06 09:47:35 +00:00
parent 86995dc8c5
commit f84d081a7e

View File

@ -338,10 +338,19 @@ fn hygienic_type_parameter(item: &Annotatable, base: &str) -> String {
/// Constructs an expression that calls an intrinsic
fn call_intrinsic(cx: &ExtCtxt,
span: Span,
mut span: Span,
intrinsic: &str,
args: Vec<P<ast::Expr>>)
-> P<ast::Expr> {
span.expn_id = cx.codemap().record_expansion(codemap::ExpnInfo {
call_site: span,
callee: codemap::NameAndSpan {
format: codemap::MacroAttribute(intern("derive")),
span: Some(span),
allow_internal_unstable: true,
},
});
let path = cx.std_path(&["intrinsics", intrinsic]);
let call = cx.expr_call_global(span, path, args);