Skip to content

Commit

Permalink
Auto merge of #129771 - bvanjoi:donot-clone-old-syntax-context, r=<try>
Browse files Browse the repository at this point in the history
dont clone old syntax context

I guess this regression was caused by too many clones, so this is an attempt to use the old value rather than cloning it. Perhaps a better approach would be to ensure that only the substantial fields mentioned in this [comment](#127279 (comment)) are cacheable.

Anyway, let's run a perf test to see if this can solve the problem.

r? `@pnkfelix` or `@petrochenkov`
  • Loading branch information
bors committed Aug 30, 2024
2 parents 0d63418 + efd2619 commit 89b1569
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_span/src/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,8 @@ pub fn decode_syntax_context<D: Decoder, F: FnOnce(&mut D, u32) -> SyntaxContext
&& old.outer_transparency == ctxt_data.outer_transparency
&& old.parent == ctxt_data.parent
{
ctxt_data = old.clone();
ctxt_data.opaque = old.opaque;
ctxt_data.opaque_and_semitransparent = old.opaque_and_semitransparent;
}

let dummy = std::mem::replace(
Expand Down

0 comments on commit 89b1569

Please sign in to comment.