Track span dependency using a callback.

This commit is contained in:
Camille GILLOT 2021-04-27 19:24:33 +02:00
parent e85ddeb474
commit b19ae20aad
6 changed files with 40 additions and 5 deletions

View file

@ -840,7 +840,7 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for Span {
let dlo = u32::decode(decoder)?;
let dto = u32::decode(decoder)?;
let enclosing = decoder.tcx.definitions_untracked().def_span(parent.unwrap()).data();
let enclosing = decoder.tcx.definitions_untracked().def_span(parent.unwrap()).decode();
let span = Span::new(
enclosing.lo + BytePos::from_u32(dlo),
enclosing.lo + BytePos::from_u32(dto),
@ -1022,7 +1022,7 @@ where
E: 'a + OpaqueEncoder,
{
fn encode(&self, s: &mut CacheEncoder<'a, 'tcx, E>) -> Result<(), E::Error> {
let span_data = self.data();
let span_data = self.decode();
span_data.ctxt.encode(s)?;
span_data.parent.encode(s)?;
@ -1031,7 +1031,7 @@ where
}
if let Some(parent) = span_data.parent {
let enclosing = s.tcx.definitions_untracked().def_span(parent).data();
let enclosing = s.tcx.definitions_untracked().def_span(parent).decode();
if enclosing.contains(span_data) {
TAG_RELATIVE_SPAN.encode(s)?;
(span_data.lo - enclosing.lo).to_u32().encode(s)?;