1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // copyright 2014 the rust project developers. see the copyright
12 // file at the top-level directory of this distribution and at
13 // http://rust-lang.org/copyright.
15 // licensed under the apache license, version 2.0 <license-apache or
16 // http://www.apache.org/licenses/license-2.0> or the mit license
17 // <license-mit or http://opensource.org/licenses/mit>, at your
18 // option. this file may not be copied, modified, or distributed
19 // except according to those terms.
21 // Test that cleanups for the RHS of shortcircuiting operators work.
23 // pretty-expanded FIXME #23616
28 let args: Vec<String> = env::args().collect();
30 // Here, the rvalue `"signal".to_string()` requires cleanup. Older versions
31 // of the code had a problem that the cleanup scope for this
32 // expression was the end of the `if`, and as the `"signal".to_string()`
33 // expression was never evaluated, we wound up trying to clean
34 // uninitialized memory.
36 if args.len() >= 2 && args[1] == "signal" {
38 unsafe { *(0 as *mut int) = 0; }