1
Fork 0

librustc: Remove the broken overloaded assign-ops from the language.

They evaluated the receiver twice. They should be added back with
`AddAssign`, `SubAssign`, etc., traits.
This commit is contained in:
Patrick Walton 2013-06-11 19:13:42 -07:00 committed by Corey Richardson
parent 3fcd4dca30
commit a1531ed946
57 changed files with 316 additions and 209 deletions

View file

@ -60,25 +60,27 @@ fn escape_str(s: &str) -> ~str {
let mut escaped = ~"\"";
for s.iter().advance |c| {
match c {
'"' => escaped += "\\\"",
'\\' => escaped += "\\\\",
'\x08' => escaped += "\\b",
'\x0c' => escaped += "\\f",
'\n' => escaped += "\\n",
'\r' => escaped += "\\r",
'\t' => escaped += "\\t",
_ => escaped += str::from_char(c)
'"' => escaped.push_str("\\\""),
'\\' => escaped.push_str("\\\\"),
'\x08' => escaped.push_str("\\b"),
'\x0c' => escaped.push_str("\\f"),
'\n' => escaped.push_str("\\n"),
'\r' => escaped.push_str("\\r"),
'\t' => escaped.push_str("\\t"),
_ => escaped.push_char(c),
}
};
escaped += "\"";
escaped.push_char('"');
escaped
}
fn spaces(n: uint) -> ~str {
let mut ss = ~"";
for n.times { ss.push_str(" "); }
for n.times {
ss.push_str(" ");
}
return ss;
}