From 0f8573e57b62576e4acb8fa0d74346cc82645ee0 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 12 Jul 2021 16:56:13 +0200 Subject: [PATCH] Pass ExpnData by reference. --- compiler/rustc_middle/src/ty/query/on_disk_cache.rs | 2 +- compiler/rustc_span/src/hygiene.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_middle/src/ty/query/on_disk_cache.rs b/compiler/rustc_middle/src/ty/query/on_disk_cache.rs index c4847ea16c5..0ac80ebd636 100644 --- a/compiler/rustc_middle/src/ty/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/ty/query/on_disk_cache.rs @@ -372,7 +372,7 @@ pub fn serialize<'tcx>( |encoder, expn_id, data, hash| -> FileEncodeResult { if expn_id.krate == LOCAL_CRATE { let pos = AbsoluteBytePos::new(encoder.position()); - encoder.encode_tagged(TAG_EXPN_DATA, &data)?; + encoder.encode_tagged(TAG_EXPN_DATA, data)?; expn_data.insert(hash, pos); } else { foreign_expn_data.insert(hash, expn_id.local_id.as_u32()); diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index 49ad40fdf4d..b4adf2d46bb 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -1142,7 +1142,7 @@ pub fn encode( &self, encoder: &mut T, mut encode_ctxt: impl FnMut(&mut T, u32, &SyntaxContextData) -> Result<(), R>, - mut encode_expn: impl FnMut(&mut T, ExpnId, ExpnData, ExpnHash) -> Result<(), R>, + mut encode_expn: impl FnMut(&mut T, ExpnId, &ExpnData, ExpnHash) -> Result<(), R>, ) -> Result<(), R> { // When we serialize a `SyntaxContextData`, we may end up serializing // a `SyntaxContext` that we haven't seen before @@ -1344,7 +1344,7 @@ fn for_all_ctxts_in Resul fn for_all_expns_in( expns: impl Iterator, - mut f: impl FnMut(ExpnId, ExpnData, ExpnHash) -> Result<(), E>, + mut f: impl FnMut(ExpnId, &ExpnData, ExpnHash) -> Result<(), E>, ) -> Result<(), E> { let all_data: Vec<_> = HygieneData::with(|data| { expns @@ -1352,7 +1352,7 @@ fn for_all_expns_in( .collect() }); for (expn, data, hash) in all_data.into_iter() { - f(expn, data, hash)?; + f(expn, &data, hash)?; } Ok(()) }