auto merge of #14831 : alexcrichton/rust/format-intl, r=brson

* The select/plural methods from format strings are removed
* The # character no longer needs to be escaped
* The \-based escapes have been removed
* '{{' is now an escape for '{'
* '}}' is now an escape for '}'

Closes #14810
[breaking-change]
This commit is contained in:
bors
2014-06-13 14:42:03 +00:00
57 changed files with 736 additions and 1087 deletions

View File

@@ -1208,11 +1208,18 @@ impl<'a> Parser<'a> {
})
}
#[cfg(stage0)]
_ => {
let token_str = p.this_token_to_str();
p.fatal((format!("expected `;` or `\\{` but found `{}`",
token_str)).as_slice())
}
#[cfg(not(stage0))]
_ => {
let token_str = p.this_token_to_str();
p.fatal((format!("expected `;` or `{{` but found `{}`",
token_str)).as_slice())
}
}
})
}
@@ -2739,7 +2746,7 @@ impl<'a> Parser<'a> {
self.bump();
if self.token != token::RBRACE {
let token_str = self.this_token_to_str();
self.fatal(format!("expected `\\}`, found `{}`",
self.fatal(format!("expected `{}`, found `{}`", "}",
token_str).as_slice())
}
etc = true;
@@ -3149,6 +3156,7 @@ impl<'a> Parser<'a> {
// consuming more tokens).
let (bra, ket) = match token::close_delimiter_for(&self.token) {
Some(ket) => (self.token.clone(), ket),
#[cfg(stage0)]
None => {
// we only expect an ident if we didn't parse one
// above.
@@ -3162,6 +3170,20 @@ impl<'a> Parser<'a> {
ident_str,
tok_str).as_slice())
}
#[cfg(not(stage0))]
None => {
// we only expect an ident if we didn't parse one
// above.
let ident_str = if id == token::special_idents::invalid {
"identifier, "
} else {
""
};
let tok_str = self.this_token_to_str();
self.fatal(format!("expected {}`(` or `{{`, but found `{}`",
ident_str,
tok_str).as_slice())
}
};
let tts = self.parse_unspanned_seq(
@@ -4041,8 +4063,8 @@ impl<'a> Parser<'a> {
fields = Vec::new();
} else {
let token_str = self.this_token_to_str();
self.fatal(format!("expected `\\{`, `(`, or `;` after struct \
name but found `{}`",
self.fatal(format!("expected `{}`, `(`, or `;` after struct \
name but found `{}`", "{",
token_str).as_slice())
}
@@ -4069,12 +4091,20 @@ impl<'a> Parser<'a> {
self.bump();
}
token::RBRACE => {}
#[cfg(stage0)]
_ => {
let token_str = self.this_token_to_str();
self.span_fatal(self.span,
format!("expected `,`, or `\\}` but found `{}`",
token_str).as_slice())
}
#[cfg(not(stage0))]
_ => {
let token_str = self.this_token_to_str();
self.span_fatal(self.span,
format!("expected `,`, or `}}` but found `{}`",
token_str).as_slice())
}
}
a_var
}
@@ -4684,7 +4714,7 @@ impl<'a> Parser<'a> {
let token_str = self.this_token_to_str();
self.span_fatal(self.span,
format!("expected `\\{` or `fn` but found `{}`",
format!("expected `{}` or `fn` but found `{}`", "{",
token_str).as_slice());
}