about summary refs log tree commit diff
path: root/src/libsyntax/source_map.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-08-16 06:53:13 +0000
committerbors <bors@rust-lang.org>2019-08-16 06:53:13 +0000
commit5a6d801bf9399004a0f0a19e510d996f4686c093 (patch)
tree3950734898164dfdf746e2fc3d0951dbb1e0b6cc /src/libsyntax/source_map.rs
parentf7af19c279b8b7ea3d2c21fcbd67164af8d5d968 (diff)
parent0bd3a852557c1e52c4c38207891e5230bfa62cdb (diff)
downloadrust-5a6d801bf9399004a0f0a19e510d996f4686c093.tar.gz
rust-5a6d801bf9399004a0f0a19e510d996f4686c093.zip
Auto merge of #63627 - Centril:rollup-v8i7x5i, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #62593 (Group all ABI tests.)
 - #63173 (Use libunwind from llvm-project submodule for musl targets)
 - #63535 (Continue refactoring resolve and hygiene)
 - #63539 (Suggest Rust 2018 on `<expr>.await` with no such field)
 - #63584 (libcore: more cleanups using `#![feature(associated_type_bounds)]`)
 - #63612 (Do not suggest `try_into` for base types inside of macro expansions)
 - #63615 (Fix typo in DoubleEndedIterator::nth_back doc)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax/source_map.rs')
-rw-r--r--src/libsyntax/source_map.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs
index 74cab00d3c1..940687cb5d4 100644
--- a/src/libsyntax/source_map.rs
+++ b/src/libsyntax/source_map.rs
@@ -8,7 +8,7 @@
 //! information, source code snippets, etc.
 
 pub use syntax_pos::*;
-pub use syntax_pos::hygiene::{ExpnKind, ExpnInfo};
+pub use syntax_pos::hygiene::{ExpnKind, ExpnData};
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::stable_hasher::StableHasher;
@@ -29,14 +29,15 @@ mod tests;
 
 /// Returns the span itself if it doesn't come from a macro expansion,
 /// otherwise return the call site span up to the `enclosing_sp` by
-/// following the `expn_info` chain.
+/// following the `expn_data` 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);
-    match (call_site1, call_site2) {
-        (None, _) => sp,
-        (Some(call_site1), Some(call_site2)) if call_site1 == call_site2 => sp,
-        (Some(call_site1), _) => original_sp(call_site1, enclosing_sp),
+    let expn_data1 = sp.ctxt().outer_expn_data();
+    let expn_data2 = enclosing_sp.ctxt().outer_expn_data();
+    if expn_data1.is_root() ||
+       !expn_data2.is_root() && expn_data1.call_site == expn_data2.call_site {
+        sp
+    } else {
+        original_sp(expn_data1.call_site, enclosing_sp)
     }
 }