about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2019-05-27 13:52:11 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2019-05-29 09:32:56 +1000
commitcaea42f6c8ba8f5cc5ed04557ec5d072b107e7b4 (patch)
tree9ddcc6be16ffaabb4d5dfbd86340c043c2e08f3a /src/libsyntax
parent828f6fdbe57a7b0e6b7bf7194ee9a2079b2779cd (diff)
downloadrust-caea42f6c8ba8f5cc5ed04557ec5d072b107e7b4.tar.gz
rust-caea42f6c8ba8f5cc5ed04557ec5d072b107e7b4.zip
Introduce and use `SyntaxContext::outer_expn_info()`.
It reduces two `hygiene_data` accesses to one on some hot paths.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/base.rs2
-rw-r--r--src/libsyntax/source_map.rs4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index d72193ffe12..4b5b9ff7bbe 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -872,7 +872,7 @@ impl<'a> ExtCtxt<'a> {
         let mut ctxt = self.backtrace();
         let mut last_macro = None;
         loop {
-            if ctxt.outer().expn_info().map_or(None, |info| {
+            if ctxt.outer_expn_info().map_or(None, |info| {
                 if info.format.name() == sym::include {
                     // Stop going up the backtrace once include! is encountered
                     return None;
diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs
index 8a210db9185..e83cad93d1c 100644
--- a/src/libsyntax/source_map.rs
+++ b/src/libsyntax/source_map.rs
@@ -30,8 +30,8 @@ use errors::SourceMapper;
 /// otherwise return the call site span up to the `enclosing_sp` by
 /// following the `expn_info` chain.
 pub fn original_sp(sp: Span, enclosing_sp: Span) -> Span {
-    let call_site1 = sp.ctxt().outer().expn_info().map(|ei| ei.call_site);
-    let call_site2 = enclosing_sp.ctxt().outer().expn_info().map(|ei| ei.call_site);
+    let call_site1 = sp.ctxt().outer_expn_info().map(|ei| ei.call_site);
+    let call_site2 = enclosing_sp.ctxt().outer_expn_info().map(|ei| ei.call_site);
     match (call_site1, call_site2) {
         (None, _) => sp,
         (Some(call_site1), Some(call_site2)) if call_site1 == call_site2 => sp,