Skip to content

Commit 34319ff

Browse files
Avoid emitting full macro body into JSON
1 parent 3d127e2 commit 34319ff

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

compiler/rustc_errors/src/json.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,14 @@ impl DiagnosticSpan {
454454
let end = je.sm.lookup_char_pos(span.hi());
455455
let backtrace_step = backtrace.next().map(|bt| {
456456
let call_site = Self::from_span_full(bt.call_site, false, None, None, backtrace, je);
457-
let def_site_span =
458-
Self::from_span_full(bt.def_site, false, None, None, [].into_iter(), je);
457+
let def_site_span = Self::from_span_full(
458+
je.sm.guess_head_span(bt.def_site),
459+
false,
460+
None,
461+
None,
462+
[].into_iter(),
463+
je,
464+
);
459465
Box::new(DiagnosticSpanMacroExpansion {
460466
span: call_site,
461467
macro_decl_name: bt.kind.descr(),

0 commit comments

Comments
 (0)