1
Fork 0

Comment a bit, use find_ancestor_in_same_ctxt to suppress some weird macro notes

This commit is contained in:
Michael Goulet 2022-08-17 06:17:36 +00:00
parent 292ab399b3
commit 6848ba2665
5 changed files with 181 additions and 130 deletions

View file

@ -664,6 +664,13 @@ impl Span {
Some(self)
}
pub fn find_ancestor_in_same_ctxt(mut self, other: Span) -> Option<Span> {
while !Span::eq_ctxt(self, other) {
self = self.parent_callsite()?;
}
Some(self)
}
/// Edition of the crate from which this span came.
pub fn edition(self) -> edition::Edition {
self.ctxt().edition()