Cleanup interfaces of Name, SyntaxContext and Ident
Make sure Name, SyntaxContext and Ident are passed by value Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined
This commit is contained in:
@@ -646,7 +646,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
loop {
|
||||
if self.codemap().with_expn_info(expn_id, |info| {
|
||||
info.map_or(None, |i| {
|
||||
if i.callee.name() == "include" {
|
||||
if i.callee.name().as_str() == "include" {
|
||||
// Stop going up the backtrace once include! is encountered
|
||||
return None;
|
||||
}
|
||||
@@ -899,9 +899,9 @@ impl SyntaxEnv {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
pub fn find(&self, k: &Name) -> Option<Rc<SyntaxExtension>> {
|
||||
pub fn find(&self, k: Name) -> Option<Rc<SyntaxExtension>> {
|
||||
for frame in self.chain.iter().rev() {
|
||||
match frame.map.get(k) {
|
||||
match frame.map.get(&k) {
|
||||
Some(v) => return Some(v.clone()),
|
||||
None => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user