diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-11-21 15:07:50 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-11-22 06:48:46 +0530 |
| commit | 99925fb562086ff789df95220104f9d8d5fc8b3c (patch) | |
| tree | 4c9d43140cf526bbf64584c800b5f0f169360744 /src/libsyntax/ext/base.rs | |
| parent | ef5ee7d895f227c3b5dfbc1b57509136957b871a (diff) | |
| download | rust-99925fb562086ff789df95220104f9d8d5fc8b3c.tar.gz rust-99925fb562086ff789df95220104f9d8d5fc8b3c.zip | |
Look up macro names as well when suggesting replacements for function resolve errors
fixes #5780
Diffstat (limited to 'src/libsyntax/ext/base.rs')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 18db028b60b..0dba15760cd 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -27,7 +27,7 @@ use util::small_vector::SmallVector; use ext::mtwt; use fold::Folder; -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; use std::rc::Rc; use std::default::Default; @@ -856,7 +856,10 @@ pub fn get_exprs_from_tts(cx: &mut ExtCtxt, /// /// This environment maps Names to SyntaxExtensions. pub struct SyntaxEnv { - chain: Vec<MapChainFrame> , + chain: Vec<MapChainFrame>, + /// All bang-style macro/extension names + /// encountered so far; to be used for diagnostics in resolve + pub names: HashSet<Name>, } // impl question: how to implement it? Initially, the @@ -876,7 +879,7 @@ struct MapChainFrame { impl SyntaxEnv { fn new() -> SyntaxEnv { - let mut map = SyntaxEnv { chain: Vec::new() }; + let mut map = SyntaxEnv { chain: Vec::new() , names: HashSet::new()}; map.push_frame(); map } @@ -913,6 +916,9 @@ impl SyntaxEnv { } pub fn insert(&mut self, k: Name, v: SyntaxExtension) { + if let NormalTT(..) = v { + self.names.insert(k); + } self.find_escape_frame().map.insert(k, Rc::new(v)); } |
