diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-08-27 05:41:53 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-08-28 03:37:13 +0530 |
| commit | 25cbb4385ee58804cb2483af56d1333fbee6e27d (patch) | |
| tree | 9a74f5e9796a15356f53fc9b66ec2b642e46e395 /src/libsyntax/ext | |
| parent | 4ec7b713dd2de43f4b0b03d33271f9c7dbb56d1c (diff) | |
| download | rust-25cbb4385ee58804cb2483af56d1333fbee6e27d.tar.gz rust-25cbb4385ee58804cb2483af56d1333fbee6e27d.zip | |
Move ExpnInfo to Name
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/asm.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/generic/mod.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 30 |
3 files changed, 19 insertions, 19 deletions
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index 2509a071807..c48b740d83a 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -19,7 +19,7 @@ use codemap::Span; use ext::base; use ext::base::*; use feature_gate; -use parse::token::InternedString; +use parse::token::{intern, InternedString}; use parse::token; use ptr::P; @@ -211,7 +211,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) let expn_id = cx.codemap().record_expansion(codemap::ExpnInfo { call_site: sp, callee: codemap::NameAndSpan { - format: codemap::MacroBang("asm".to_string()), + format: codemap::MacroBang(intern("asm")), span: None, allow_internal_unstable: false, }, diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index f23dec92f93..3196380ec6c 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -205,7 +205,7 @@ use codemap::Span; use diagnostic::SpanHandler; use fold::MoveMap; use owned_slice::OwnedSlice; -use parse::token::InternedString; +use parse::token::{intern, InternedString}; use parse::token::special_idents; use ptr::P; @@ -1436,7 +1436,7 @@ impl<'a> TraitDef<'a> { to_set.expn_id = cx.codemap().record_expansion(codemap::ExpnInfo { call_site: to_set, callee: codemap::NameAndSpan { - format: codemap::MacroAttribute(format!("derive({})", trait_name)), + format: codemap::MacroAttribute(intern(&format!("derive({})", trait_name))), span: Some(self.span), allow_internal_unstable: false, } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index bf995c00009..3459caecb26 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -543,7 +543,7 @@ fn expand_mac_invoc<T, F, G>(mac: ast::Mac, fld.cx.bt_push(ExpnInfo { call_site: span, callee: NameAndSpan { - format: MacroBang(extname.to_string()), + format: MacroBang(extname), span: exp_span, allow_internal_unstable: allow_internal_unstable, }, @@ -721,7 +721,7 @@ pub fn expand_item_mac(it: P<ast::Item>, fld.cx.bt_push(ExpnInfo { call_site: it.span, callee: NameAndSpan { - format: MacroBang(extname.to_string()), + format: MacroBang(extname), span: span, allow_internal_unstable: allow_internal_unstable, } @@ -740,7 +740,7 @@ pub fn expand_item_mac(it: P<ast::Item>, fld.cx.bt_push(ExpnInfo { call_site: it.span, callee: NameAndSpan { - format: MacroBang(extname.to_string()), + format: MacroBang(extname), span: span, allow_internal_unstable: allow_internal_unstable, } @@ -760,7 +760,7 @@ pub fn expand_item_mac(it: P<ast::Item>, fld.cx.bt_push(ExpnInfo { call_site: it.span, callee: NameAndSpan { - format: MacroBang(extname.to_string()), + format: MacroBang(extname), span: None, // `macro_rules!` doesn't directly allow // unstable (this is orthogonal to whether @@ -1087,7 +1087,7 @@ fn expand_pat(p: P<ast::Pat>, fld: &mut MacroExpander) -> P<ast::Pat> { fld.cx.bt_push(ExpnInfo { call_site: span, callee: NameAndSpan { - format: MacroBang(extname.to_string()), + format: MacroBang(extname), span: tt_span, allow_internal_unstable: allow_internal_unstable, } @@ -1289,8 +1289,8 @@ fn expand_decorators(a: Annotatable, new_attrs: &mut Vec<ast::Attribute>) { for attr in a.attrs() { - let mname = attr.name(); - match fld.cx.syntax_env.find(&intern(&mname)) { + let mname = intern(&attr.name()); + match fld.cx.syntax_env.find(&mname) { Some(rc) => match *rc { Decorator(ref dec) => { attr::mark_used(&attr); @@ -1298,7 +1298,7 @@ fn expand_decorators(a: Annotatable, fld.cx.bt_push(ExpnInfo { call_site: attr.span, callee: NameAndSpan { - format: MacroAttribute(mname.to_string()), + format: MacroAttribute(mname), span: Some(attr.span), // attributes can do whatever they like, // for now. @@ -1325,7 +1325,7 @@ fn expand_decorators(a: Annotatable, fld.cx.bt_push(ExpnInfo { call_site: attr.span, callee: NameAndSpan { - format: MacroAttribute(mname.to_string()), + format: MacroAttribute(mname), span: Some(attr.span), // attributes can do whatever they like, // for now. @@ -1366,16 +1366,16 @@ fn expand_item_multi_modifier(mut it: Annotatable, } for attr in &modifiers { - let mname = attr.name(); + let mname = intern(&attr.name()); - match fld.cx.syntax_env.find(&intern(&mname)) { + match fld.cx.syntax_env.find(&mname) { Some(rc) => match *rc { MultiModifier(ref mac) => { attr::mark_used(attr); fld.cx.bt_push(ExpnInfo { call_site: attr.span, callee: NameAndSpan { - format: MacroAttribute(mname.to_string()), + format: MacroAttribute(mname), span: Some(attr.span), // attributes can do whatever they like, // for now @@ -1414,16 +1414,16 @@ fn expand_item_modifiers(mut it: P<ast::Item>, } for attr in &modifiers { - let mname = attr.name(); + let mname = intern(&attr.name()); - match fld.cx.syntax_env.find(&intern(&mname)) { + match fld.cx.syntax_env.find(&mname) { Some(rc) => match *rc { Modifier(ref mac) => { attr::mark_used(attr); fld.cx.bt_push(ExpnInfo { call_site: attr.span, callee: NameAndSpan { - format: MacroAttribute(mname.to_string()), + format: MacroAttribute(mname), span: Some(attr.span), // attributes can do whatever they like, // for now |
