Skip to content

Commit

Permalink
Auto merge of #16221 - holly-hacker:fix-16200, r=lnicola
Browse files Browse the repository at this point in the history
fix: Fix out-of-bounds panic in some macros due to unhandled self_ref

Fixes #16200

I don't fully understand these changes, I just applied and tested the changes suggested in #16200 and they seem to fix the issue on both the repro and my original project.
  • Loading branch information
bors committed Dec 31, 2023
2 parents e872f50 + c133309 commit cf52c4b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/hir-expand/src/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ fn apply_mark_internal(
let mut opaque_and_semitransparent = syntax_context_data.opaque_and_semitransparent;

if transparency >= Transparency::Opaque {
let parent = opaque;
let parent = handle_self_ref(ctxt, opaque);
let new_opaque = SyntaxContextId::SELF_REF;
// But we can't just grab the to be allocated ID either as that would not deduplicate
// things!
Expand All @@ -168,7 +168,7 @@ fn apply_mark_internal(
}

if transparency >= Transparency::SemiTransparent {
let parent = opaque_and_semitransparent;
let parent = handle_self_ref(ctxt, opaque_and_semitransparent);
let new_opaque_and_semitransparent = SyntaxContextId::SELF_REF;
opaque_and_semitransparent = db.intern_syntax_context(SyntaxContextData {
outer_expn: call_id,
Expand Down

0 comments on commit cf52c4b

Please sign in to comment.