about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-08-10 00:28:47 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-08-12 23:18:51 -0700
commitb820748ff5a2bc09b58dd7ac511e0f607d55f2e9 (patch)
tree7a34e364ae23968eadba2e7bc0ecae8e20b3fced /src/libsyntax
parent44675ac6aff91889f960655b0034964740415e8c (diff)
downloadrust-b820748ff5a2bc09b58dd7ac511e0f607d55f2e9.tar.gz
rust-b820748ff5a2bc09b58dd7ac511e0f607d55f2e9.zip
Implement formatting arguments for strings and integers
Closes #1651
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/ifmt.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libsyntax/ext/ifmt.rs b/src/libsyntax/ext/ifmt.rs
index 65d2f798f31..66b091849c0 100644
--- a/src/libsyntax/ext/ifmt.rs
+++ b/src/libsyntax/ext/ifmt.rs
@@ -127,7 +127,13 @@ impl Context {
                 }
             }
             parse::Argument(ref arg) => {
-                // argument first (it's first in the format string)
+                // width/precision first, if they have implicit positional
+                // parameters it makes more sense to consume them first.
+                self.verify_count(arg.format.width);
+                self.verify_count(arg.format.precision);
+
+                // argument second, if it's an implicit positional parameter
+                // it's written second, so it should come after width/precision.
                 let pos = match arg.position {
                     parse::ArgumentNext => {
                         let i = self.next_arg;
@@ -144,10 +150,6 @@ impl Context {
                 } else { Known(arg.format.ty.to_managed()) };
                 self.verify_arg_type(pos, ty);
 
-                // width/precision next
-                self.verify_count(arg.format.width);
-                self.verify_count(arg.format.precision);
-
                 // and finally the method being applied
                 match arg.method {
                     None => {}