Skip to content

Commit 89b1569

Browse files
committed
Auto merge of rust-lang#129771 - bvanjoi:donot-clone-old-syntax-context, r=<try>
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](rust-lang#127279 (comment)) are cacheable. Anyway, let's run a perf test to see if this can solve the problem. r? `@pnkfelix` or `@petrochenkov`
2 parents 0d63418 + efd2619 commit 89b1569

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_span/src/hygiene.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,8 @@ pub fn decode_syntax_context<D: Decoder, F: FnOnce(&mut D, u32) -> SyntaxContext
14201420
&& old.outer_transparency == ctxt_data.outer_transparency
14211421
&& old.parent == ctxt_data.parent
14221422
{
1423-
ctxt_data = old.clone();
1423+
ctxt_data.opaque = old.opaque;
1424+
ctxt_data.opaque_and_semitransparent = old.opaque_and_semitransparent;
14241425
}
14251426

14261427
let dummy = std::mem::replace(

0 commit comments

Comments
 (0)