Skip to content

Commit 2c0df64

Browse files
committed
add comment to use of invocation_parent
1 parent 99c6d26 commit 2c0df64

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_expand/src/expand.rs

+5
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
608608
if self.cx.sess.opts.incremental.is_some() {
609609
for (invoc, _) in invocations.iter_mut() {
610610
let expn_id = invoc.expansion_data.id;
611+
// When lowering anon-consts, we may end up with spans whose
612+
// parent is the containing item instead of the anon-const itself.
613+
//
614+
// This shouldn't cause any issues wrt to incremental compilation.
615+
// See `DefCollector::handle_lazy_anon_const_def` for more details.
611616
let parent_def = self.cx.resolver.invocation_parent(expn_id);
612617
let span = invoc.span_mut();
613618
*span = span.with_parent(Some(parent_def));

0 commit comments

Comments
 (0)