]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issues/issue-27021.rs
Various minor/cosmetic improvements to code
[rust.git] / src / test / run-pass / issues / issue-27021.rs
1 // Copyright 2016 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.
4 //
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.
10
11 // run-pass
12
13 // This test is bogus (i.e., should be compile-fail) during the period
14 // where #54986 is implemented and #54987 is *not* implemented. For
15 // now: just ignore it under nll
16 //
17 // ignore-compare-mode-nll
18
19 // These are variants of issue-26996.rs. In all cases we are writing
20 // into a record field that has been moved out of, and ensuring that
21 // such a write won't overwrite the state of the thing it was moved
22 // into.
23 //
24 // That's a fine thing to test when this code is accepted by the
25 // compiler, and this code is being transcribed accordingly into
26 // the ui test issue-21232-partial-init-and-use.rs
27
28 fn main() {
29     let mut c = (1, (1, "".to_owned()));
30     match c {
31         c2 => { (c.1).0 = 2; assert_eq!((c2.1).0, 1); }
32     }
33
34     let mut c = (1, (1, (1, "".to_owned())));
35     match c.1 {
36         c2 => { ((c.1).1).0 = 3; assert_eq!((c2.1).0, 1); }
37     }
38 }