diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-10-17 09:07:45 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-10-21 12:32:36 -0400 |
| commit | dad2db7c83de71063b9311eb3e41bdf4027616f6 (patch) | |
| tree | c6a25441b841f140e5edd80f7a97345825f49743 /src/libsyntax | |
| parent | 1562d8cbd890d39640d98afa59424cc8002ea85a (diff) | |
| download | rust-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.rs | 8 |
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) } |
