about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-02-07 18:20:55 +0000
committerbors <bors@rust-lang.org>2015-02-07 18:20:55 +0000
commit61626b306314768b273892e3a547b896ef7a4dfd (patch)
treefccabe06769bf28388471d950fa4cd55da128a53 /src/libstd/sys/unix/stack_overflow.rs
parentce5aad2f107e79c5f1baab40aff35b7899322d94 (diff)
parentb445bf2bd1139236fd815bf93610ddaf17726111 (diff)
downloadrust-61626b306314768b273892e3a547b896ef7a4dfd.tar.gz
rust-61626b306314768b273892e3a547b896ef7a4dfd.zip
Auto merge of #21984 - pnkfelix:make-for-loops-a-terminating-scope, r=nikomatsakis
make `for PAT in ITER_EXPR { ... }` a terminating-scope for ITER_EXPR.

In effect, temporary anonymous values created during the evaluation of ITER_EXPR no longer not live for the entirety of the block surrounding the for-loop; instead they only live for the extent of the for-loop itself, and no longer.

----

There is one case I know of that this breaks, demonstrated to me by @nikomatsakis  (but it is also a corner-case that is useless in practice).  Here is that case:

```
fn main() {
    let mut foo: Vec<&i8> = Vec::new();
    for i in &[1, 2, 3] { foo.push(i) }
}
```

Note that if you add any code following the for-loop above, or even a semicolon to the end of it, then the code will stop compiling (i.e., it gathers a vector of references but the gathered vector cannot actually be used.)

(The above code, despite being useless, did occur in one run-pass test by accident; that test is updated here to accommodate the new striction.)

----

So, technically this is a:

[breaking-change]
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions