diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/format.rs | 22 | ||||
| -rw-r--r-- | src/libsyntax/lib.rs | 1 |
2 files changed, 7 insertions, 16 deletions
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 79f49b908d1..c03d174365e 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -18,7 +18,7 @@ use parse::token::InternedString; use parse::token; use rsparse = parse; -use std::fmt::parse; +use parse = fmt_macros; use collections::{HashMap, HashSet}; #[deriving(Eq)] @@ -232,7 +232,7 @@ impl<'a, 'b> Context<'a, 'b> { parse::Keyword(name) => { self.ecx.span_err(self.fmtsp, format!("duplicate selector \ - `{:?}`", name)); + `{}`", name)); } parse::Literal(idx) => { self.ecx.span_err(self.fmtsp, @@ -375,21 +375,11 @@ impl<'a, 'b> Context<'a, 'b> { return vec!(unnamed, allow_dead_code); } - fn parsepath(&self, s: &str) -> Vec<ast::Ident> { - vec!(self.ecx.ident_of("std"), self.ecx.ident_of("fmt"), - self.ecx.ident_of("parse"), self.ecx.ident_of(s)) - } - fn rtpath(&self, s: &str) -> Vec<ast::Ident> { vec!(self.ecx.ident_of("std"), self.ecx.ident_of("fmt"), self.ecx.ident_of("rt"), self.ecx.ident_of(s)) } - fn ctpath(&self, s: &str) -> Vec<ast::Ident> { - vec!(self.ecx.ident_of("std"), self.ecx.ident_of("fmt"), - self.ecx.ident_of("parse"), self.ecx.ident_of(s)) - } - fn none(&self) -> @ast::Expr { let none = self.ecx.path_global(self.fmtsp, vec!( self.ecx.ident_of("std"), @@ -475,7 +465,7 @@ impl<'a, 'b> Context<'a, 'b> { }).collect(); let (lr, selarg) = match arm.selector { parse::Keyword(t) => { - let p = self.ctpath(format!("{:?}", t)); + let p = self.rtpath(t.to_str()); let p = self.ecx.path_global(sp, p); (self.rtpath("Keyword"), self.ecx.expr_path(p)) } @@ -564,13 +554,13 @@ impl<'a, 'b> Context<'a, 'b> { let fill = self.ecx.expr_lit(sp, ast::LitChar(fill)); let align = match arg.format.align { parse::AlignLeft => { - self.ecx.path_global(sp, self.parsepath("AlignLeft")) + self.ecx.path_global(sp, self.rtpath("AlignLeft")) } parse::AlignRight => { - self.ecx.path_global(sp, self.parsepath("AlignRight")) + self.ecx.path_global(sp, self.rtpath("AlignRight")) } parse::AlignUnknown => { - self.ecx.path_global(sp, self.parsepath("AlignUnknown")) + self.ecx.path_global(sp, self.rtpath("AlignUnknown")) } }; let align = self.ecx.expr_path(align); diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 012bc50ecab..5e1d988df5c 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -35,6 +35,7 @@ extern crate term; extern crate collections; #[phase(syntax, link)] extern crate log; +extern crate fmt_macros; pub mod util { pub mod interner; |
