Skip to content

Commit f84d081

Browse files
committed
Avoid instaiblity errors in code generated by syntax_ext::deriving::call_intrinsic().
1 parent 86995dc commit f84d081

File tree

1 file changed

+10
-1
lines changed
  • src/libsyntax_ext/deriving

1 file changed

+10
-1
lines changed

src/libsyntax_ext/deriving/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,19 @@ fn hygienic_type_parameter(item: &Annotatable, base: &str) -> String {
338338

339339
/// Constructs an expression that calls an intrinsic
340340
fn call_intrinsic(cx: &ExtCtxt,
341-
span: Span,
341+
mut span: Span,
342342
intrinsic: &str,
343343
args: Vec<P<ast::Expr>>)
344344
-> P<ast::Expr> {
345+
span.expn_id = cx.codemap().record_expansion(codemap::ExpnInfo {
346+
call_site: span,
347+
callee: codemap::NameAndSpan {
348+
format: codemap::MacroAttribute(intern("derive")),
349+
span: Some(span),
350+
allow_internal_unstable: true,
351+
},
352+
});
353+
345354
let path = cx.std_path(&["intrinsics", intrinsic]);
346355
let call = cx.expr_call_global(span, path, args);
347356

0 commit comments

Comments
 (0)