Skip to content

Commit f768697

Browse files
committed
only retrieve expn_data once
1 parent a359e3c commit f768697

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_expand/src/proc_macro.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,16 @@ impl MultiItemModifier for DeriveProcMacro {
136136
// FIXME(pr-time): without flattened some (weird) tests fail, but no idea if it's correct/enough
137137
let input = tcx.arena.alloc(input.flattened()) as &TokenStream;
138138
let invoc_id = ecx.current_expansion.id;
139+
let invoc_expn_data = invoc_id.expn_data();
139140

140141
// FIXME(pr-time): Just using the crate hash to notice when the proc-macro code has
141142
// changed. How to *correctly* depend on exactly the macro definition?
142143
// I.e., depending on the crate hash is just a HACK (and leaves garbage in the
143144
// incremental compilation dir).
144-
let macro_def_id = invoc_id.expn_data().macro_def_id.unwrap();
145+
let macro_def_id = invoc_expn_data.macro_def_id.unwrap();
145146
let proc_macro_crate_hash = tcx.crate_hash(macro_def_id.krate);
146147

147-
assert_eq!(invoc_id.expn_data().call_site, span);
148+
assert_eq!(invoc_expn_data.call_site, span);
148149

149150
let res = crate::derive_macro_expansion::enter_context((ecx, self.client), move || {
150151
let key = (invoc_id, proc_macro_crate_hash, input);

0 commit comments

Comments
 (0)