]> git.lizzy.rs Git - rust.git/commitdiff
librustc: Fix merge fallout.
authorPatrick Walton <pcwalton@mimiga.net>
Tue, 21 Jan 2014 18:08:10 +0000 (10:08 -0800)
committerHuon Wilson <dbau.pp+github@gmail.com>
Sat, 1 Feb 2014 14:44:48 +0000 (01:44 +1100)
18 files changed:
src/librustc/front/feature_gate.rs
src/librustc/front/std_inject.rs
src/librustc/lib.rs
src/librustc/metadata/creader.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/tvec.rs
src/librustdoc/clean.rs
src/librustpkg/util.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/concat_idents.rs
src/libsyntax/ext/deriving/encodable.rs
src/libsyntax/ext/deriving/to_str.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/format.rs
src/libsyntax/ext/source_util.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/fold.rs

index 7903ce00dc312be1e78e210b617e13568eabdbce..c6550ec7c6e86a3d46a413a5313c8fab962a13be 100644 (file)
@@ -122,7 +122,7 @@ fn visit_view_item(&mut self, i: &ast::ViewItem, _: ()) {
             }
             ast::ViewItemExternMod(..) => {
                 for attr in i.attrs.iter() {
-                    if "phase" == attr.name() {
+                    if attr.name().get() == "phase"{
                         self.gate_feature("phase", attr.span,
                                           "compile time crate loading is \
                                            experimental and possibly buggy");
index 71a82536aee0c54cf0ac4edf5538be62218987cc..4eb36b0f3fbd128b0978303f8fe38a17d9bb1395 100644 (file)
@@ -19,6 +19,8 @@
 use syntax::fold::Folder;
 use syntax::fold;
 use syntax::opt_vec;
+use syntax::parse::token::InternedString;
+use syntax::parse::token;
 use syntax::util::small_vector::SmallVector;
 
 pub static VERSION: &'static str = "0.10-pre";
@@ -56,11 +58,13 @@ struct StandardLibraryInjector {
     sess: Session,
 }
 
-pub fn with_version(crate: &str) -> Option<(@str, ast::StrStyle)> {
+pub fn with_version(crate: &str) -> Option<(InternedString, ast::StrStyle)> {
     match option_env!("CFG_DISABLE_INJECT_STD_VERSION") {
         Some("1") => None,
         _ => {
-            Some((format!("{}\\#{}", crate, VERSION).to_managed(),
+            Some((token::intern_and_get_ident(format!("{}\\#{}",
+                                                      crate,
+                                                      VERSION)),
                   ast::CookedStr))
         }
     }
@@ -73,9 +77,12 @@ fn fold_crate(&mut self, crate: ast::Crate) -> ast::Crate {
                                          with_version("std"),
                                          ast::DUMMY_NODE_ID),
             attrs: ~[
-                attr::mk_attr(attr::mk_list_item(@"phase",
-                                                 ~[attr::mk_word_item(@"syntax"),
-                                                   attr::mk_word_item(@"link")]))
+                attr::mk_attr(attr::mk_list_item(
+                        InternedString::new("phase"),
+                        ~[
+                            attr::mk_word_item(InternedString::new("syntax")),
+                            attr::mk_word_item(InternedString::new("link")
+                        )]))
             ],
             vis: ast::Inherited,
             span: DUMMY_SP
index c34f881b2db1866a6416ebe4d9fb7feaca540a66..7ba96516bf91b14cc3b42b816ac63ee60da6326c 100644 (file)
@@ -235,7 +235,7 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
       0u => d::early_error(demitter, "no input filename given"),
       1u => {
         let ifile = matches.free[0].as_slice();
-        if "-" == ifile {
+        if ifile == "-" {
             let src =
                 str::from_utf8_owned(io::stdin().read_to_end()).unwrap();
             (d::StrInput(src), None)
index 56ede9dfce178bfc6a4730080b988df00e0a0626..2a30ca51584e6d9345627f7f1837ecb6e3dc7cce 100644 (file)
@@ -134,7 +134,7 @@ fn visit_crate(e: &Env, c: &ast::Crate) {
 
 fn visit_view_item(e: &mut Env, i: &ast::ViewItem) {
     let should_load = i.attrs.iter().all(|attr| {
-        "phase" != attr.name() ||
+        attr.name().get() != "phase" ||
             attr.meta_item_list().map_or(false, |phases| {
                 attr::contains_name(phases, "link")
             })
@@ -163,11 +163,11 @@ struct CrateInfo {
 
 fn extract_crate_info(i: &ast::ViewItem) -> Option<CrateInfo> {
     match i.node {
-        ast::ViewItemExternMod(ident, path_opt, id) => {
-            let ident = token::ident_to_str(&ident);
+        ast::ViewItemExternMod(ref ident, ref path_opt, id) => {
+            let ident = token::ident_to_str(ident);
             debug!("resolving extern mod stmt. ident: {:?} path_opt: {:?}",
                    ident, path_opt);
-            let (name, version) = match path_opt {
+            let (name, version) = match *path_opt {
                 Some((ref path_str, _)) => {
                     let crateid: Option<CrateId> = from_str(path_str.get());
                     match crateid {
index 42123f536d6e7d93836c3f6ebbb7e9e4f4d8e989..99577efb14d6e805269fed8bb682911eaf3793bf 100644 (file)
 use std::libc::c_uint;
 use std::vec;
 use std::local_data;
+use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32};
 use syntax::ast_map::{PathName, PathPrettyName, path_elem_to_str};
 use syntax::ast_util::{local_def, is_local};
-use syntax::attr;
-use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32};
 use syntax::attr::AttrMetaMethods;
+use syntax::attr;
 use syntax::codemap::Span;
-use syntax::parse::token::{InternedString, special_idents};
+use syntax::parse::token::InternedString;
 use syntax::parse::token;
-use syntax::{ast, ast_util, ast_map};
-use syntax::attr::AttrMetaMethods;
-use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32};
-use syntax::visit;
 use syntax::visit::Visitor;
 use syntax::visit;
-use syntax::{ast, ast_util, codemap, ast_map};
+use syntax::{ast, ast_util, ast_map};
 
 pub use middle::trans::context::task_llcx;
 
index 932b954e266889a24843935fa21a1b7a87709c9f..a601b16e9b25b34a3b46dfebf4bd24bbac78ced3 100644 (file)
@@ -25,7 +25,6 @@
 use middle::trans::cleanup;
 use middle::trans::cleanup::CleanupMethods;
 use middle::trans::common::*;
-use middle::trans::datum::immediate_rvalue;
 use middle::trans::expr;
 use middle::trans::machine::*;
 use middle::trans::reflect;
index b0b7abbf66487840c4e39a5813633ab2f8df892d..ea1e0f78f449f46ef8bd222a24824462f59b2b72 100644 (file)
@@ -232,10 +232,10 @@ pub fn trans_slice_vstore<'a>(
     match content_expr.node {
         ast::ExprLit(lit) => {
             match lit.node {
-                ast::LitStr(s, _) => {
+                ast::LitStr(ref s, _) => {
                     return trans_lit_str(bcx,
                                          content_expr,
-                                         (*s).clone(),
+                                         s.clone(),
                                          dest)
                 }
                 _ => {}
@@ -340,12 +340,12 @@ pub fn trans_uniq_or_managed_vstore<'a>(bcx: &'a Block<'a>,
             match content_expr.node {
                 ast::ExprLit(lit) => {
                     match lit.node {
-                        ast::LitStr(s, _) => {
+                        ast::LitStr(ref s, _) => {
                             let llptrval = C_cstr(bcx.ccx(), (*s).clone());
                             let llptrval = PointerCast(bcx,
                                                        llptrval,
                                                        Type::i8p());
-                            let llsizeval = C_uint(bcx.ccx(), s.len());
+                            let llsizeval = C_uint(bcx.ccx(), s.get().len());
                             let typ = ty::mk_str(bcx.tcx(), ty::vstore_uniq);
                             let lldestval = rvalue_scratch_datum(bcx,
                                                                  typ,
index 09c30ae096c391279e31c801bcade066beaf3a6b..6abafd5995c2facfe4983a3dd10b4be401e51aa5 100644 (file)
@@ -1039,8 +1039,13 @@ pub enum ViewItemInner {
 impl Clean<ViewItemInner> for ast::ViewItem_ {
     fn clean(&self) -> ViewItemInner {
         match self {
-            &ast::ViewItemExternMod(ref i, ref p, ref id) =>
-                ExternMod(i.clean(), p.map(|(ref x, _)| x.to_owned()), *id),
+            &ast::ViewItemExternMod(ref i, ref p, ref id) => {
+                let string = match *p {
+                    None => None,
+                    Some((ref x, _)) => Some(x.get().to_owned()),
+                };
+                ExternMod(i.clean(), string, *id)
+            }
             &ast::ViewItemUse(ref vp) => Import(vp.clean())
         }
     }
index d806194ffbce531429ab246bb2914bfcd097c2bf..ba31699a7d04e54450f894edc3d02e965b630e78 100644 (file)
@@ -472,13 +472,14 @@ fn install_crate(&mut self, vi: &ast::ViewItem) {
 
         match vi.node {
             // ignore metadata, I guess
-            ast::ViewItemExternMod(lib_ident, path_opt, _) => {
-                let lib_name = match path_opt {
-                    Some((p, _)) => p,
-                    None => self.sess.str_of(lib_ident)
+            ast::ViewItemExternMod(ref lib_ident, ref path_opt, _) => {
+                let lib_name = match *path_opt {
+                    Some((ref p, _)) => (*p).clone(),
+                    None => token::get_ident(lib_ident.name),
                 };
                 debug!("Finding and installing... {}", lib_name);
-                let crate_id: CrateId = from_str(lib_name).expect("valid crate id");
+                let crate_id: CrateId =
+                    from_str(lib_name.get()).expect("valid crate id");
                 // Check standard Rust library path first
                 let whatever = system_library(&self.context.sysroot_to_use(), &crate_id);
                 debug!("system library returned {:?}", whatever);
index 74a9dbdd7c9ac542fa86abe1d281bd729a888bef..5df2a9010b1aa7d9e5f8c2ca2df62d1d2df7b8b4 100644 (file)
@@ -16,7 +16,7 @@
 use ext::expand;
 use parse;
 use parse::token;
-use parse::token::{InternedString, ident_to_str, intern, str_to_ident};
+use parse::token::{InternedString, intern, str_to_ident};
 use util::small_vector::SmallVector;
 
 use std::hashmap::HashMap;
@@ -396,9 +396,6 @@ pub fn trace_macros(&self) -> bool {
     pub fn set_trace_macros(&mut self, x: bool) {
         self.trace_mac = x
     }
-    pub fn str_of(&self, id: ast::Ident) -> @str {
-        ident_to_str(&id)
-    }
     pub fn ident_of(&self, st: &str) -> ast::Ident {
         str_to_ident(st)
     }
@@ -411,7 +408,7 @@ pub fn expr_to_str(cx: &ExtCtxt, expr: @ast::Expr, err_msg: &str)
                    -> Option<(InternedString, ast::StrStyle)> {
     match expr.node {
         ast::ExprLit(l) => match l.node {
-            ast::LitStr(s, style) => return Some(((*s).clone(), style)),
+            ast::LitStr(ref s, style) => return Some(((*s).clone(), style)),
             _ => cx.span_err(l.span, err_msg)
         },
         _ => cx.span_err(expr.span, err_msg)
@@ -446,7 +443,8 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt,
         match tts[0] {
             ast::TTTok(_, token::LIT_STR(ident))
             | ast::TTTok(_, token::LIT_STR_RAW(ident, _)) => {
-                return Some(cx.str_of(ident).to_str())
+                let interned_str = token::get_ident(ident.name);
+                return Some(interned_str.get().to_str())
             }
             _ => cx.span_err(sp, format!("{} requires a string.", name)),
         }
index 9dcb5b4cb4c2a49814f728bdb4f2fb27f4eb3219..e0d53add6489fec9e6ced7165996504061b46723 100644 (file)
@@ -30,7 +30,10 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
             }
         } else {
             match *e {
-                ast::TTTok(_, token::IDENT(ident,_)) => res_str.push_str(cx.str_of(ident)),
+                ast::TTTok(_, token::IDENT(ident,_)) => {
+                    let interned_str = token::get_ident(ident.name);
+                    res_str.push_str(interned_str.get())
+                }
                 _ => {
                     cx.span_err(sp, "concat_idents! requires ident args.");
                     return MacResult::dummy_expr();
index 1dfc5b59e062ef2b4befd5a3c95260d0c837a1f3..c50c9f18389c2ff897b979f861b0b0c16687ebd6 100644 (file)
@@ -133,7 +133,7 @@ fn encodable_substructure(cx: &ExtCtxt, trait_span: Span,
                     ..
                 }) in fields.iter().enumerate() {
                 let name = match name {
-                    Some(id) => token::get_ident(id),
+                    Some(id) => token::get_ident(id.name),
                     None => {
                         token::intern_and_get_ident(format!("_field{}", i))
                     }
@@ -181,7 +181,7 @@ fn encodable_substructure(cx: &ExtCtxt, trait_span: Span,
 
             let blk = cx.lambda_stmts_1(trait_span, stmts, blkarg);
             let name = cx.expr_str(trait_span,
-                                   token::get_ident(variant.node.name));
+                                   token::get_ident(variant.node.name.name));
             let call = cx.expr_method_call(trait_span, blkencoder,
                                            cx.ident_of("emit_enum_variant"),
                                            ~[name,
index 97412595b29c38f4dac72583098b817b894a5108..6101d647ca5dd9beed219375ecb0a3623760b211 100644 (file)
@@ -61,7 +61,9 @@ fn to_str_substructure(cx: &ExtCtxt, span: Span, substr: &Substructure)
             cx.expr_str_uniq(span, token::get_ident(name.name))
         } else {
             let buf = cx.ident_of("buf");
-            let start = token::intern_and_get_ident(cx.str_of(name) + start);
+            let interned_str = token::get_ident(name.name);
+            let start =
+                token::intern_and_get_ident(interned_str.get() + start);
             let init = cx.expr_str_uniq(span, start);
             let mut stmts = ~[cx.stmt_let(span, true, buf, init)];
             let push_str = cx.ident_of("push_str");
@@ -79,7 +81,8 @@ fn to_str_substructure(cx: &ExtCtxt, span: Span, substr: &Substructure)
                 match name {
                     None => {}
                     Some(id) => {
-                        let name = cx.str_of(id) + ": ";
+                        let interned_id = token::get_ident(id.name);
+                        let name = interned_id.get() + ": ";
                         push(cx.expr_str(span,
                                          token::intern_and_get_ident(name)));
                     }
index 3eaafba55cda01ba4641ac99270084668c437175..c166240e2043d9aac93a72a3079e38607ea9c1a7 100644 (file)
@@ -385,7 +385,7 @@ pub fn expand_view_item(vi: &ast::ViewItem,
                         fld: &mut MacroExpander)
                         -> ast::ViewItem {
     let should_load = vi.attrs.iter().any(|attr| {
-        "phase" == attr.name() &&
+        attr.name().get() == "phase" &&
             attr.meta_item_list().map_or(false, |phases| {
                 attr::contains_name(phases, "syntax")
             })
@@ -405,12 +405,12 @@ fn load_extern_macros(crate: &ast::ViewItem, fld: &mut MacroExpander) {
         ast::ViewItemExternMod(ref name, _, _) => token::ident_to_str(name),
         _ => unreachable!(),
     };
-    let name = format!("<{} macros>", crate_name).to_managed();
+    let name = format!("<{} macros>", crate_name);
 
     let exported_macros = fld.cx.loader.get_exported_macros(cnum);
     for source in exported_macros.iter() {
-        let item = parse::parse_item_from_source_str(name,
-                                                     source.to_managed(),
+        let item = parse::parse_item_from_source_str(name.clone(),
+                                                     (*source).clone(),
                                                      fld.cx.cfg(),
                                                      fld.cx.parse_sess())
                 .expect("expected a serialized item");
index 5bedb1a887e2c164b78fa534d24d1121ada18156..ba1d5efdd49cd5a8ca787859217eb28fbb975460 100644 (file)
 
 #[deriving(Eq)]
 enum ArgumentType {
-    Known(@str),
+    Known(~str),
     Unsigned,
     String,
 }
 
 enum Position {
     Exact(uint),
-    Named(@str),
+    Named(~str),
 }
 
 struct Context<'a> {
@@ -43,12 +43,12 @@ struct Context<'a> {
     args: ~[@ast::Expr],
     arg_types: ~[Option<ArgumentType>],
     // Parsed named expressions and the types that we've found for them so far
-    names: HashMap<@str, @ast::Expr>,
-    name_types: HashMap<@str, ArgumentType>,
+    names: HashMap<~str, @ast::Expr>,
+    name_types: HashMap<~str, ArgumentType>,
 
     // Collection of the compiled `rt::Piece` structures
     pieces: ~[@ast::Expr],
-    name_positions: HashMap<@str, uint>,
+    name_positions: HashMap<~str, uint>,
     method_statics: ~[@ast::Item],
 
     // Updated as arguments are consumed or methods are entered
@@ -105,10 +105,11 @@ fn parse_args(&mut self, sp: Span, tts: &[ast::TokenTree])
                         return (extra, None);
                     }
                 };
-                let name = self.ecx.str_of(ident);
+                let interned_name = token::get_ident(ident.name);
+                let name = interned_name.get();
                 p.expect(&token::EQ);
                 let e = p.parse_expr();
-                match self.names.find(&name) {
+                match self.names.find_equiv(&name) {
                     None => {}
                     Some(prev) => {
                         self.ecx.span_err(e.span, format!("duplicate argument \
@@ -118,7 +119,7 @@ fn parse_args(&mut self, sp: Span, tts: &[ast::TokenTree])
                         continue
                     }
                 }
-                self.names.insert(name, e);
+                self.names.insert(name.to_str(), e);
             } else {
                 self.args.push(p.parse_expr());
                 self.arg_types.push(None);
@@ -157,13 +158,13 @@ fn verify_piece(&mut self, p: &parse::Piece) {
                         Exact(i)
                     }
                     parse::ArgumentIs(i) => Exact(i),
-                    parse::ArgumentNamed(s) => Named(s.to_managed()),
+                    parse::ArgumentNamed(s) => Named(s.to_str()),
                 };
 
                 // and finally the method being applied
                 match arg.method {
                     None => {
-                        let ty = Known(arg.format.ty.to_managed());
+                        let ty = Known(arg.format.ty.to_str());
                         self.verify_arg_type(pos, ty);
                     }
                     Some(ref method) => { self.verify_method(pos, *method); }
@@ -185,7 +186,7 @@ fn verify_count(&mut self, c: parse::Count) {
                 self.verify_arg_type(Exact(i), Unsigned);
             }
             parse::CountIsName(s) => {
-                self.verify_arg_type(Named(s.to_managed()), Unsigned);
+                self.verify_arg_type(Named(s.to_str()), Unsigned);
             }
             parse::CountIsNextParam => {
                 if self.check_positional_ok() {
@@ -260,7 +261,13 @@ fn verify_arg_type(&mut self, arg: Position, ty: ArgumentType) {
                     self.ecx.span_err(self.fmtsp, msg);
                     return;
                 }
-                self.verify_same(self.args[arg].span, ty, self.arg_types[arg]);
+                {
+                    let arg_type = match self.arg_types[arg] {
+                        None => None,
+                        Some(ref x) => Some(x)
+                    };
+                    self.verify_same(self.args[arg].span, &ty, arg_type);
+                }
                 if self.arg_types[arg].is_none() {
                     self.arg_types[arg] = Some(ty);
                 }
@@ -275,10 +282,9 @@ fn verify_arg_type(&mut self, arg: Position, ty: ArgumentType) {
                         return;
                     }
                 };
-                self.verify_same(span, ty,
-                                 self.name_types.find(&name).map(|&x| x));
+                self.verify_same(span, &ty, self.name_types.find(&name));
                 if !self.name_types.contains_key(&name) {
-                    self.name_types.insert(name, ty);
+                    self.name_types.insert(name.clone(), ty);
                 }
                 // Assign this named argument a slot in the arguments array if
                 // it hasn't already been assigned a slot.
@@ -298,30 +304,36 @@ fn verify_arg_type(&mut self, arg: Position, ty: ArgumentType) {
     ///
     /// Obviously `Some(Some(x)) != Some(Some(y))`, but we consider it true
     /// that: `Some(None) == Some(Some(x))`
-    fn verify_same(&self, sp: Span, ty: ArgumentType,
-                   before: Option<ArgumentType>) {
+    fn verify_same(&self,
+                   sp: Span,
+                   ty: &ArgumentType,
+                   before: Option<&ArgumentType>) {
         let cur = match before {
             None => return,
             Some(t) => t,
         };
-        if ty == cur { return }
+        if *ty == *cur {
+            return
+        }
         match (cur, ty) {
-            (Known(cur), Known(ty)) => {
+            (&Known(ref cur), &Known(ref ty)) => {
                 self.ecx.span_err(sp,
                                   format!("argument redeclared with type `{}` when \
-                                           it was previously `{}`", ty, cur));
+                                           it was previously `{}`",
+                                          *ty,
+                                          *cur));
             }
-            (Known(cur), _) => {
+            (&Known(ref cur), _) => {
                 self.ecx.span_err(sp,
                                   format!("argument used to format with `{}` was \
                                            attempted to not be used for formatting",
-                                           cur));
+                                           *cur));
             }
-            (_, Known(ty)) => {
+            (_, &Known(ref ty)) => {
                 self.ecx.span_err(sp,
                                   format!("argument previously used as a format \
                                            argument attempted to be used as `{}`",
-                                           ty));
+                                           *ty));
             }
             (_, _) => {
                 self.ecx.span_err(sp, "argument declared with multiple formats");
@@ -397,9 +409,8 @@ fn trans_piece(&mut self, piece: &parse::Piece) -> @ast::Expr {
                     self.ecx.expr_path(path)
                 }
                 parse::CountIsName(n) => {
-                    let n = n.to_managed();
-                    let i = match self.name_positions.find_copy(&n) {
-                        Some(i) => i,
+                    let i = match self.name_positions.find_equiv(&n) {
+                        Some(&i) => i,
                         None => 0, // error already emitted elsewhere
                     };
                     let i = i + self.args.len();
@@ -519,9 +530,8 @@ fn trans_piece(&mut self, piece: &parse::Piece) -> @ast::Expr {
                     // Named arguments are converted to positional arguments at
                     // the end of the list of arguments
                     parse::ArgumentNamed(n) => {
-                        let n = n.to_managed();
-                        let i = match self.name_positions.find_copy(&n) {
-                            Some(i) => i,
+                        let i = match self.name_positions.find_equiv(&n) {
+                            Some(&i) => i,
                             None => 0, // error already emitted elsewhere
                         };
                         let i = i + self.args.len();
@@ -633,14 +643,17 @@ fn to_expr(&self, extra: @ast::Expr) -> @ast::Expr {
             locals.push(self.format_arg(e.span, Exact(i),
                                         self.ecx.expr_ident(e.span, name)));
         }
-        for (&name, &e) in self.names.iter() {
-            if !self.name_types.contains_key(&name) { continue }
+        for (name, &e) in self.names.iter() {
+            if !self.name_types.contains_key(name) {
+                continue
+            }
 
-            let lname = self.ecx.ident_of(format!("__arg{}", name));
+            let lname = self.ecx.ident_of(format!("__arg{}", *name));
             let e = self.ecx.expr_addr_of(e.span, e);
             lets.push(self.ecx.stmt_let(e.span, false, lname, e));
-            names[*self.name_positions.get(&name)] =
-                Some(self.format_arg(e.span, Named(name),
+            names[*self.name_positions.get(name)] =
+                Some(self.format_arg(e.span,
+                                     Named((*name).clone()),
                                      self.ecx.expr_ident(e.span, lname)));
         }
 
@@ -682,16 +695,16 @@ fn to_expr(&self, extra: @ast::Expr) -> @ast::Expr {
                                            Some(result)))
     }
 
-    fn format_arg(&self, sp: Span, argno: Position,
-                  arg: @ast::Expr) -> @ast::Expr {
+    fn format_arg(&self, sp: Span, argno: Position, arg: @ast::Expr)
+                  -> @ast::Expr {
         let ty = match argno {
-            Exact(i) => self.arg_types[i].unwrap(),
-            Named(s) => *self.name_types.get(&s)
+            Exact(ref i) => self.arg_types[*i].get_ref(),
+            Named(ref s) => self.name_types.get(s)
         };
 
-        let fmt_trait = match ty {
-            Known(tyname) => {
-                match tyname.as_slice() {
+        let fmt_trait = match *ty {
+            Known(ref tyname) => {
+                match (*tyname).as_slice() {
                     ""  => "Default",
                     "?" => "Poly",
                     "b" => "Bool",
@@ -708,8 +721,9 @@ fn format_arg(&self, sp: Span, argno: Position,
                     "x" => "LowerHex",
                     "X" => "UpperHex",
                     _ => {
-                        self.ecx.span_err(sp, format!("unknown format trait \
-                                                       `{}`", tyname));
+                        self.ecx.span_err(sp,
+                                          format!("unknown format trait `{}`",
+                                                  *tyname));
                         "Dummy"
                     }
                 }
index a248cd84f71d1361243d640d3ff14d083a970074..44f3bb379f63e68267bfd751226d40cc2757a81a 100644 (file)
@@ -71,7 +71,12 @@ pub fn expand_stringify(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
 pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "module_path!");
-    let string = cx.mod_path().map(|x| cx.str_of(*x)).connect("::");
+    let string = cx.mod_path()
+                   .map(|x| {
+                        let interned_str = token::get_ident(x.name);
+                        interned_str.get().to_str()
+                    })
+                   .connect("::");
     base::MRExpr(cx.expr_str(sp, token::intern_and_get_ident(string)))
 }
 
index aabd9c694f7c024bd5f063fa711837583d94d5fa..97981f87393c52e3a7eb2ec807b0eec454aa187f 100644 (file)
@@ -23,6 +23,7 @@
 use parse::attr::ParserAttr;
 use parse::token::{get_ident_interner, special_idents, gensym_ident, ident_to_str};
 use parse::token::{FAT_ARROW, SEMI, NtMatchers, NtTT, EOF};
+use parse::token;
 use print;
 use std::cell::RefCell;
 use util::small_vector::SmallVector;
@@ -112,10 +113,11 @@ fn generic_extension(cx: &ExtCtxt,
                      rhses: &[@NamedMatch])
                      -> MacResult {
     if cx.trace_macros() {
+        let interned_name = token::get_ident(name.name);
         println!("{}! \\{ {} \\}",
-                  cx.str_of(name),
-                  print::pprust::tt_to_str(&TTDelim(@arg.to_owned()),
-                                           get_ident_interner()));
+                 interned_name.get(),
+                 print::pprust::tt_to_str(&TTDelim(@arg.to_owned()),
+                                          get_ident_interner()));
     }
 
     // Which arm's failure should we report? (the one furthest along)
index f41d508f07d4ab554442e37be35e10c6fbc6c776..6e1b2044657e64decc16ec7fbed5ade478b94264 100644 (file)
@@ -497,12 +497,10 @@ fn fold_variant_arg_<T: Folder>(va: &VariantArg, folder: &mut T) -> VariantArg {
 pub fn noop_fold_view_item<T: Folder>(vi: &ViewItem, folder: &mut T)
                                        -> ViewItem{
     let inner_view_item = match vi.node {
-        ViewItemExternMod(ref ident,
-                             string,
-                             node_id) => {
+        ViewItemExternMod(ref ident, ref string, node_id) => {
             ViewItemExternMod(ident.clone(),
-                                 string,
-                                 folder.new_id(node_id))
+                              (*string).clone(),
+                              folder.new_id(node_id))
         }
         ViewItemUse(ref view_paths) => {
             ViewItemUse(folder.fold_view_paths(*view_paths))