1
Fork 0

More docs

This commit is contained in:
Michael Goulet 2022-08-17 16:20:22 +00:00
parent 8917894fda
commit 2a16a127a0
3 changed files with 18 additions and 5 deletions

View file

@ -664,6 +664,9 @@ impl Span {
Some(self)
}
/// Like `find_ancestor_inside`, but specifically for when spans might not
/// overlaps. Take care when using this, and prefer `find_ancestor_inside`
/// when you know that the spans are nested (modulo macro expansion).
pub fn find_ancestor_in_same_ctxt(mut self, other: Span) -> Option<Span> {
while !Span::eq_ctxt(self, other) {
self = self.parent_callsite()?;