]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #9140 : alexcrichton/rust/issue-9119, r=huonw
authorbors <bors@rust-lang.org>
Thu, 12 Sep 2013 18:56:00 +0000 (11:56 -0700)
committerbors <bors@rust-lang.org>
Thu, 12 Sep 2013 18:56:00 +0000 (11:56 -0700)
Closes #9119

src/libstd/fmt/parse.rs
src/test/run-pass/ifmt.rs

index fd0e86d7a3177b0ef92c77245f45d1ee82d0213d..9888af9313b9df01a756e914c04fec1577a0b7fa 100644 (file)
@@ -554,7 +554,7 @@ fn count(&mut self) -> Count {
     /// characters.
     fn word(&mut self) -> &'self str {
         let start = match self.cur.clone().next() {
-            Some((pos, c)) if char::is_alphabetic(c) => {
+            Some((pos, c)) if char::is_XID_start(c) => {
                 self.cur.next();
                 pos
             }
@@ -563,7 +563,7 @@ fn word(&mut self) -> &'self str {
         let mut end;
         loop {
             match self.cur.clone().next() {
-                Some((_, c)) if char::is_alphanumeric(c) => {
+                Some((_, c)) if char::is_XID_continue(c) => {
                     self.cur.next();
                 }
                 Some((pos, _)) => { end = pos; break }
index 08d5ac5c1fb8e1b6d478c09c8f8b1ebef2d075ca..351bad193da2dfc85249039f122df30e7a2241c2 100644 (file)
@@ -87,6 +87,7 @@ pub fn main() {
     t!(format!("{foo} {1} {bar} {0}", 0, 1, foo=2, bar=3), "2 1 3 0");
     t!(format!("{} {0:s}", "a"), "a a");
     t!(format!("{} {0}", "a"), "a a");
+    t!(format!("{foo_bar}", foo_bar=1), "1");
 
     // Methods should probably work
     t!(format!("{0, plural, =1{a#} =2{b#} zero{c#} other{d#}}", 0u), "c0");