about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-10-16 18:11:22 -0700
committerbors <bors@rust-lang.org>2013-10-16 18:11:22 -0700
commitc92f2168d49ee330992b9e23cd3dabf695e0d248 (patch)
tree0c46e9f339892186b981cdf253d9cf9e4d0e543b /src/libsyntax
parent63e097d8c34143411ea6d3146493bd6d8f3428d7 (diff)
parentfc06f7922db0b4d1063f4f29157635117d853426 (diff)
downloadrust-c92f2168d49ee330992b9e23cd3dabf695e0d248.tar.gz
rust-c92f2168d49ee330992b9e23cd3dabf695e0d248.zip
auto merge of #9833 : alexcrichton/rust/fixes, r=brson
Commits have all the fun details
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/expand.rs1
-rw-r--r--src/libsyntax/ext/format.rs21
2 files changed, 18 insertions, 4 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index c936cb9ab90..1114e3a9893 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -991,6 +991,7 @@ pub fn std_macros() -> @str {
             pub mod $c {
                 #[allow(unused_imports)];
                 #[allow(non_uppercase_statics)];
+                #[allow(missing_doc)];
 
                 use super::*;
 
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs
index 7518816be1e..31befed6c0c 100644
--- a/src/libsyntax/ext/format.rs
+++ b/src/libsyntax/ext/format.rs
@@ -177,6 +177,9 @@ impl Context {
             parse::CountIsParam(i) => {
                 self.verify_arg_type(Left(i), Unsigned);
             }
+            parse::CountIsName(s) => {
+                self.verify_arg_type(Right(s.to_managed()), Unsigned);
+            }
             parse::CountIsNextParam => {
                 if self.check_positional_ok() {
                     self.verify_arg_type(Left(self.next_arg), Unsigned);
@@ -361,21 +364,31 @@ impl Context {
         let trans_count = |c: parse::Count| {
             match c {
                 parse::CountIs(i) => {
-                    self.ecx.expr_call_global(sp, ctpath("CountIs"),
+                    self.ecx.expr_call_global(sp, rtpath("CountIs"),
                                               ~[self.ecx.expr_uint(sp, i)])
                 }
                 parse::CountIsParam(i) => {
-                    self.ecx.expr_call_global(sp, ctpath("CountIsParam"),
+                    self.ecx.expr_call_global(sp, rtpath("CountIsParam"),
                                               ~[self.ecx.expr_uint(sp, i)])
                 }
                 parse::CountImplied => {
-                    let path = self.ecx.path_global(sp, ctpath("CountImplied"));
+                    let path = self.ecx.path_global(sp, rtpath("CountImplied"));
                     self.ecx.expr_path(path)
                 }
                 parse::CountIsNextParam => {
-                    let path = self.ecx.path_global(sp, ctpath("CountIsNextParam"));
+                    let path = self.ecx.path_global(sp, rtpath("CountIsNextParam"));
                     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,
+                        None => 0, // error already emitted elsewhere
+                    };
+                    let i = i + self.args.len();
+                    self.ecx.expr_call_global(sp, rtpath("CountIsParam"),
+                                              ~[self.ecx.expr_uint(sp, i)])
+                }
             }
         };
         let trans_method = |method: &parse::Method| {