Skip to content

Commit c8a16d9

Browse files
committed
---
yaml --- r: 183278 b: refs/heads/beta c: 74b8740 h: refs/heads/master v: v3
1 parent a195ad1 commit c8a16d9

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 312f8bd850ca4d575b1414badabab4f5aee99c67
34+
refs/heads/beta: 74b8740719c1b427f79b67d6bc51e9d448dd9c49
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: eb836bf767aa1d8d4cba488a9091cde3c0ab4b2f

branches/beta/src/doc/reference.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ cases mentioned in [Number literals](#number-literals) below.
256256

257257
| [Number literals](#number-literals)`*` | Example | Exponentiation | Suffixes |
258258
|----------------------------------------|---------|----------------|----------|
259-
| Decimal integer | `98_222is` | `N/A` | Integer suffixes |
260-
| Hex integer | `0xffis` | `N/A` | Integer suffixes |
261-
| Octal integer | `0o77is` | `N/A` | Integer suffixes |
262-
| Binary integer | `0b1111_0000is` | `N/A` | Integer suffixes |
263-
| Floating-point | `123.0E+77f64` | `Optional` | Floating-point suffixes |
259+
| Decimal integer | `98_222` | `N/A` | Integer suffixes |
260+
| Hex integer | `0xff` | `N/A` | Integer suffixes |
261+
| Octal integer | `0o77` | `N/A` | Integer suffixes |
262+
| Binary integer | `0b1111_0000` | `N/A` | Integer suffixes |
263+
| Floating-point | `123.0E+77` | `Optional` | Floating-point suffixes |
264264

265265
`*` All number literals allow `_` as a visual separator: `1_234.0E+18f64`
266266

branches/beta/src/libsyntax/ext/expand.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,18 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
231231
ast::ExprForLoop(pat, head, body, opt_ident) => {
232232
// to:
233233
//
234-
// match ::std::iter::IntoIterator::into_iter(<head>) {
235-
// mut iter => {
236-
// [opt_ident]: loop {
237-
// match ::std::iter::Iterator::next(&mut iter) {
238-
// ::std::option::Option::Some(<pat>) => <body>,
239-
// ::std::option::Option::None => break
234+
// {
235+
// let result = match ::std::iter::IntoIterator::into_iter(<head>) {
236+
// mut iter => {
237+
// [opt_ident]: loop {
238+
// match ::std::iter::Iterator::next(&mut iter) {
239+
// ::std::option::Option::Some(<pat>) => <body>,
240+
// ::std::option::Option::None => break
241+
// }
240242
// }
241243
// }
242-
// }
244+
// };
245+
// result
243246
// }
244247

245248
// expand <head>
@@ -320,7 +323,16 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
320323

321324
fld.cx.expr_call(span, fld.cx.expr_path(into_iter_path), vec![head])
322325
};
323-
fld.cx.expr_match(span, into_iter_expr, vec![iter_arm])
326+
327+
let match_expr = fld.cx.expr_match(span, into_iter_expr, vec![iter_arm]);
328+
329+
// `{ let result = ...; result }`
330+
let result_ident = token::gensym_ident("result");
331+
fld.cx.expr_block(
332+
fld.cx.block_all(
333+
span,
334+
vec![fld.cx.stmt_let(span, false, result_ident, match_expr)],
335+
Some(fld.cx.expr_ident(span, result_ident))))
324336
}
325337

326338
ast::ExprClosure(capture_clause, fn_decl, block) => {

branches/beta/src/test/run-pass/loop-label-shadowing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
fn main() {
1414
let mut foo = Vec::new();
1515
'foo: for i in &[1, 2, 3] {
16-
foo.push(i);
16+
foo.push(*i);
1717
}
1818
}
1919

0 commit comments

Comments
 (0)