diff options
| author | bors <bors@rust-lang.org> | 2023-12-31 14:50:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-31 14:50:02 +0000 |
| commit | cf52c4b2b3367ae7355ef23393e2eae1d37de723 (patch) | |
| tree | ba106a64b4a625121375cbae9b44b34466e82fe7 | |
| parent | e872f5085cf5b0e44558442365c1c033d486eff2 (diff) | |
| parent | c13330971d08fbab855ad51ff691979012af8b82 (diff) | |
| download | rust-cf52c4b2b3367ae7355ef23393e2eae1d37de723.tar.gz rust-cf52c4b2b3367ae7355ef23393e2eae1d37de723.zip | |
Auto merge of #16221 - holly-hacker:fix-16200, r=lnicola
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.
| -rw-r--r-- | crates/hir-expand/src/hygiene.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/hir-expand/src/hygiene.rs b/crates/hir-expand/src/hygiene.rs index 1c84103c7f6..6f3b19c5686 100644 --- a/crates/hir-expand/src/hygiene.rs +++ b/crates/hir-expand/src/hygiene.rs @@ -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! @@ -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, |
