about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-10-17 09:07:45 -0400
committerNiko Matsakis <niko@alum.mit.edu>2014-10-21 12:32:36 -0400
commitdad2db7c83de71063b9311eb3e41bdf4027616f6 (patch)
treec6a25441b841f140e5edd80f7a97345825f49743 /src/libsyntax
parent1562d8cbd890d39640d98afa59424cc8002ea85a (diff)
downloadrust-dad2db7c83de71063b9311eb3e41bdf4027616f6.tar.gz
rust-dad2db7c83de71063b9311eb3e41bdf4027616f6.zip
Change method lookup infrastructure to use the trait methods. Instead
of tracking individual candidates per impl, we just track one
candidate for the extension trait itself, and let the trait resolution
handle walking the individual impls and so forth. Also change the
interface to report back a richer notion of error.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_map/mod.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs
index 60e4db405d7..b82a4a0b997 100644
--- a/src/libsyntax/ast_map/mod.rs
+++ b/src/libsyntax/ast_map/mod.rs
@@ -536,6 +536,14 @@ impl<'ast> Map<'ast> {
             .unwrap_or_else(|| fail!("AstMap.span: could not find span for id {}", id))
     }
 
+    pub fn def_id_span(&self, def_id: DefId, fallback: Span) -> Span {
+        if def_id.krate == LOCAL_CRATE {
+            self.span(def_id.node)
+        } else {
+            fallback
+        }
+    }
+
     pub fn node_to_string(&self, id: NodeId) -> String {
         node_id_to_string(self, id)
     }