Pass ExpnData by reference.
This commit is contained in:
parent
a51b131fd1
commit
0f8573e57b
@ -372,7 +372,7 @@ pub fn serialize<'tcx>(
|
|||||||
|encoder, expn_id, data, hash| -> FileEncodeResult {
|
|encoder, expn_id, data, hash| -> FileEncodeResult {
|
||||||
if expn_id.krate == LOCAL_CRATE {
|
if expn_id.krate == LOCAL_CRATE {
|
||||||
let pos = AbsoluteBytePos::new(encoder.position());
|
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);
|
expn_data.insert(hash, pos);
|
||||||
} else {
|
} else {
|
||||||
foreign_expn_data.insert(hash, expn_id.local_id.as_u32());
|
foreign_expn_data.insert(hash, expn_id.local_id.as_u32());
|
||||||
|
@ -1142,7 +1142,7 @@ pub fn encode<T, R>(
|
|||||||
&self,
|
&self,
|
||||||
encoder: &mut T,
|
encoder: &mut T,
|
||||||
mut encode_ctxt: impl FnMut(&mut T, u32, &SyntaxContextData) -> Result<(), R>,
|
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> {
|
) -> Result<(), R> {
|
||||||
// When we serialize a `SyntaxContextData`, we may end up serializing
|
// When we serialize a `SyntaxContextData`, we may end up serializing
|
||||||
// a `SyntaxContext` that we haven't seen before
|
// a `SyntaxContext` that we haven't seen before
|
||||||
@ -1344,7 +1344,7 @@ fn for_all_ctxts_in<E, F: FnMut(u32, SyntaxContext, &SyntaxContextData) -> Resul
|
|||||||
|
|
||||||
fn for_all_expns_in<E>(
|
fn for_all_expns_in<E>(
|
||||||
expns: impl Iterator<Item = ExpnId>,
|
expns: impl Iterator<Item = ExpnId>,
|
||||||
mut f: impl FnMut(ExpnId, ExpnData, ExpnHash) -> Result<(), E>,
|
mut f: impl FnMut(ExpnId, &ExpnData, ExpnHash) -> Result<(), E>,
|
||||||
) -> Result<(), E> {
|
) -> Result<(), E> {
|
||||||
let all_data: Vec<_> = HygieneData::with(|data| {
|
let all_data: Vec<_> = HygieneData::with(|data| {
|
||||||
expns
|
expns
|
||||||
@ -1352,7 +1352,7 @@ fn for_all_expns_in<E>(
|
|||||||
.collect()
|
.collect()
|
||||||
});
|
});
|
||||||
for (expn, data, hash) in all_data.into_iter() {
|
for (expn, data, hash) in all_data.into_iter() {
|
||||||
f(expn, data, hash)?;
|
f(expn, &data, hash)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user