From dad2db7c83de71063b9311eb3e41bdf4027616f6 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 17 Oct 2014 09:07:45 -0400 Subject: 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. --- src/libsyntax/ast_map/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/libsyntax') 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) } -- cgit 1.4.1-3-g733a5