1
Fork 0

do not overwrite spans as eagerly

this was required to preserve the span from
the #[structural_match] attribute -- but honestly
I am not 100% sure if it makes sense.
This commit is contained in:
Niko Matsakis 2016-03-11 13:29:06 -05:00
parent 99c2a6b335
commit 05baf645e4
2 changed files with 61 additions and 6 deletions

View file

@ -1304,6 +1304,31 @@ impl CodeMap {
return a;
}
/// Check if the backtrace `subtrace` contains `suptrace` as a prefix.
pub fn more_specific_trace(&self,
mut subtrace: ExpnId,
suptrace: ExpnId)
-> bool {
loop {
if subtrace == suptrace {
return true;
}
let stop = self.with_expn_info(subtrace, |opt_expn_info| {
if let Some(expn_info) = opt_expn_info {
subtrace = expn_info.call_site.expn_id;
false
} else {
true
}
});
if stop {
return false;
}
}
}
pub fn record_expansion(&self, expn_info: ExpnInfo) -> ExpnId {
let mut expansions = self.expansions.borrow_mut();
expansions.push(expn_info);