From 3ff866ed7c814add27d32a31caaf29fa44cb53f5 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Thu, 7 Jan 2021 15:23:25 +0300 Subject: resolve: Scope visiting doesn't need an `Ident` --- compiler/rustc_span/src/hygiene.rs | 4 ++++ compiler/rustc_span/src/lib.rs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_span/src') diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index 27dc9e9ecea..1fb5642912f 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -622,6 +622,10 @@ impl SyntaxContext { pub fn dollar_crate_name(self) -> Symbol { HygieneData::with(|data| data.syntax_context_data[self.0 as usize].dollar_crate_name) } + + pub fn edition(self) -> Edition { + self.outer_expn_data().edition + } } impl fmt::Debug for SyntaxContext { diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 99f01062545..62ca7b066d9 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -300,6 +300,10 @@ pub struct SpanData { } impl SpanData { + #[inline] + pub fn span(&self) -> Span { + Span::new(self.lo, self.hi, self.ctxt) + } #[inline] pub fn with_lo(&self, lo: BytePos) -> Span { Span::new(lo, self.hi, self.ctxt) @@ -468,7 +472,7 @@ impl Span { /// Edition of the crate from which this span came. pub fn edition(self) -> edition::Edition { - self.ctxt().outer_expn_data().edition + self.ctxt().edition() } #[inline] -- cgit 1.4.1-3-g733a5