Skip to content

Commit 6848ba2

Browse files
Comment a bit, use find_ancestor_in_same_ctxt to suppress some weird macro notes
1 parent 292ab39 commit 6848ba2

File tree

5 files changed

+151
-100
lines changed

5 files changed

+151
-100
lines changed

compiler/rustc_span/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,13 @@ impl Span {
664664
Some(self)
665665
}
666666

667+
pub fn find_ancestor_in_same_ctxt(mut self, other: Span) -> Option<Span> {
668+
while !Span::eq_ctxt(self, other) {
669+
self = self.parent_callsite()?;
670+
}
671+
Some(self)
672+
}
673+
667674
/// Edition of the crate from which this span came.
668675
pub fn edition(self) -> edition::Edition {
669676
self.ctxt().edition()

0 commit comments

Comments
 (0)