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 shorcircuiting operators work.
26 let args = os::args();
28 // Here, the rvalue `"signal".to_owned()` requires cleanup. Older versions
29 // of the code had a problem that the cleanup scope for this
30 // expression was the end of the `if`, and as the `"signal".to_owned()`
31 // expression was never evaluated, we wound up trying to clean
32 // uninitialized memory.
34 if args.len() >= 2 && args[1] == "signal".to_owned() {
36 unsafe { *(0 as *mut int) = 0; }