Skip to content

Commit

Permalink
add comment to use of invocation_parent
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Nov 25, 2024
1 parent 99c6d26 commit 51a3ab0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,10 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
if self.cx.sess.opts.incremental.is_some() {
for (invoc, _) in invocations.iter_mut() {
let expn_id = invoc.expansion_data.id;
// When lowering anon-consts, we may end up with spans whose
// parent is the containing item instead of the anon-const itself.
//
// This shouldn't cause any issues wrt to incremental compilation.
let parent_def = self.cx.resolver.invocation_parent(expn_id);
let span = invoc.span_mut();
*span = span.with_parent(Some(parent_def));
Expand Down

0 comments on commit 51a3ab0

Please sign in to comment.