diff options
| author | Michael Goulet <michael@errs.io> | 2022-08-17 06:17:36 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-08-21 02:35:11 +0000 |
| commit | 6848ba2665d10380f259addbd9f60d0ab8d3542a (patch) | |
| tree | 87a269ac4ba606b55f1c70d4bd911c56d04b66fb /compiler/rustc_span/src | |
| parent | 292ab399b339154e77fef54efe8b975654259733 (diff) | |
| download | rust-6848ba2665d10380f259addbd9f60d0ab8d3542a.tar.gz rust-6848ba2665d10380f259addbd9f60d0ab8d3542a.zip | |
Comment a bit, use find_ancestor_in_same_ctxt to suppress some weird macro notes
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/lib.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index d14e28e85be..a624e3ab142 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -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() |
